/*
 TeeChart(tm) for JavaScript(tm)
 @fileOverview TeeChart for JavaScript(tm)
 v1.5 January 2013
 Copyright(c) 2012-2013 by Steema Software SL. All Rights Reserved.
 http://www.steema.com

 Licensed with commercial and non-commercial attributes,
 specifically: http://www.steema.com/licensing/html5

 JavaScript is a trademark of Oracle Corporation.
*/
var Tee=Tee||{};
(function(){"undefined"!==typeof exports&&(exports.Tee=Tee);Tee.ColorGrid=function(c,w){Tee.PaletteSeries.call(this,c,w);this.dataChanged=this.smooth=!0;var m,s,e,i,C,q,B,F,r,t,h,j,x,E,u,v,J;this.addRandom=function(e,a){for(var i,l,e=e||200,a=a||e,d=this.data.values=[],g=0;g<e;g++){i=Array(a);d[g]=i;l=Math.cos(g/(0.2*a));l=0.5*l*l;for(var h=0;h<a;h++){var n=i,c=h,j=Math.cos(h/(0.2*e));n[c]=j*j-Math.cos(h/(0.5*a))+l}}this.dataChanged=!0};this.fillPixels=function(i){for(var a=0,h,l,d=this.palette.grayScale,
g=this.palette.inverted,c=0;c<e;c++){h=m[c];for(var j=0;j<s;j++)d?(l=J*(g?u-h[j]:h[j]-E),C[a++]=l,C[a++]=l,C[a++]=l):(l=this.getColor(h[j]),C[a++]=l.r,C[a++]=l.g,C[a++]=l.b),C[a++]=i}};this.draw=function(){var c=this.chart.ctx;if(0<s){if(!i||q.width!=s||q.height!=e){q||(q=document.createElement("canvas"));if(!q||!q.getContext)return;q.width=s;q.height=e;B=q.getContext("2d");i=B.getImageData(0,0,s,e);C=i.data}this.dataChanged&&(this.fillPixels(255*(1-this.format.transparency)),this.dataChanged=!1);
B.putImageData(i,0,0);var a=this.smooth,m=this.chart.canvas.style;m&&(null!==m.getPropertyValue("image-rendering")&&m.setProperty("image-rendering",a?"optimizeQuality":"optimizeSpeed",null),void 0!==m.msInterpolationMode&&(m.msInterpolationMode=a?"bicubic":"nearest-neighbor"));c.mozImageSmoothingEnabled=a;c.webkitImageSmoothingEnabled=a;F=this.mandatoryAxis;r=this.notmandatory;x=F.calc(-0.5);h=F.calc(e-0.5);t=r.calc(-0.5);j=r.calc(s-0.5);var a=this.chart.chartRect,m=t,l=h,d=1,g=1;F.inverted&&(g=-1,
l=a.y-x-h+a.height);r.inverted&&(d=-1,m=a.x-j-t+a.width);c.scale(d,g);c.drawImage(B.canvas,0,0,s,e,m,l,j-t,x-h);a=this.format.stroke;if(""!==a.fill){l=g=1;g=Math.max(1+4*s/Math.abs(r.calc(s)-r.calc(0))|0,1);l=Math.max(1+4*e/Math.abs(F.calc(e)-F.calc(0))|0,1);c.beginPath();for(d=1;d<s;d+=g)m=r.calc(d-0.5),c.moveTo(m,x),c.lineTo(m,h);for(d=1;d<e;d+=l)m=F.calc(d-0.5),c.moveTo(t,m),c.lineTo(j,m);a.prepare();c.stroke()}}};this.valueText=function(c){return this.data.values[c/s|0][c%s].toFixed(this.decimals)};
this.minXValue=function(){return-0.5};this.maxXValue=function(){return s-0.5};this.minYValue=function(){return-0.5};this.maxYValue=function(){return e-0.5};this.recalcAxes=function(){Tee.Series.prototype.recalcAxes.call(this);m=this.data.values;e=m.length;s=0<e?m[0].length:0;this.size={x:s,y:e};if(0<s&&this.dataChanged){u=E=m[0][0];for(var c,a,h=0;h<e;h++){a=m[h];for(var i=0;i<s;i++)c=a[i],c<E?E=c:c>u&&(u=c)}v=u-E;J=u==E?1:255/(u-E);this._min=E;this._max=u;this._range=v;this.prepareColors()}};this.clicked=
function(c){var a;return c.x>=t&&c.x<=j&&(a=s*(c.x-t)/(j-t)|0,c.y>=h&&c.y<=x)?(c=e*(c.y-h)/(x-h)|0,c*s+a):-1}};Tee.ColorGrid.prototype=new Tee.PaletteSeries;Tee.Surface=function(c,w){Tee.ColorGrid.call(this,c,w);var m;this.grid=(new Tee.Format(c)).stroke;this.wireFrame=!1;this.maxZ=3;this.getY=function(c,e){return m[c][e]};this.draw=function(){if(0<this.size.x&&0<this.size.y&&(m=this.data.values,this.chart.__webgl)){var c={};this.bounds(c);this.chart.ctx.surface(this.size,this.getY,c,this.wireFrame,
this.grid.visible?this.grid.fill:null,this.maxZ)}};this.minXValue=function(){return 0};this.maxXValue=function(){return this.size.y};this.minYValue=function(){return this._min};this.maxYValue=function(){return this._max}};Tee.Surface.prototype=new Tee.ColorGrid;THREE.SubdivisionModifier=function(c){this.subdivisions=void 0===c?1:c;this.useOldVertexColors=!1;this.supportUVs=!0;this.debug=!1};THREE.SubdivisionModifier.prototype.modify=function(c){for(var w=this.subdivisions;0<w--;)this.smooth(c)};THREE.GeometryUtils.orderedKey=
function(c,w){return Math.min(c,w)+"_"+Math.max(c,w)};THREE.GeometryUtils.computeEdgeFaces=function(c){function w(c,i){void 0===C[c]&&(C[c]=[]);C[c].push(i)}var m,s,e,i,C={},q=THREE.GeometryUtils.orderedKey;m=0;for(s=c.faces.length;m<s;m++)e=c.faces[m],e instanceof THREE.Face3?(i=q(e.a,e.b),w(i,m),i=q(e.b,e.c),w(i,m),i=q(e.c,e.a),w(i,m)):e instanceof THREE.Face4&&(i=q(e.a,e.b),w(i,m),i=q(e.b,e.c),w(i,m),i=q(e.c,e.d),w(i,m),i=q(e.d,e.a),w(i,m));return C};THREE.SubdivisionModifier.prototype.smooth=
function(c){function w(){r.debug&&(console&&console.assert)&&console.assert.apply(console,arguments)}function m(){r.debug&&console.log.apply(console,arguments)}function s(){console&&console.log.apply(console,arguments)}function e(b,f,k,a,g,c,L){var M=new THREE.Face4(b,f,k,a,null,g.color,g.materialIndex);if(r.useOldVertexColors){M.vertexColors=[];for(var d,h,e,j=0;4>j;j++){e=c[j];d=new THREE.Color;d.setRGB(0,0,0);for(var l=0;l<e.length;l++)h=g.vertexColors[e[l]-1],d.r+=h.r,d.g+=h.g,d.b+=h.b;d.r/=e.length;
d.g/=e.length;d.b/=e.length;M.vertexColors[j]=d}}B.push(M);r.supportUVs&&(g=[i(b,""),i(f,L),i(k,L),i(a,L)],g[0]?g[1]?g[2]?g[3]?F.push(g):m("d :( ",a+":"+L):m("c :( ",k+":"+L):m("b :( ",f+":"+L):m("a :( ",b+":"+L))}function i(b,f){var k=b+":"+f,a=H[k];return!a?(b>=E&&b<E+x.length?m("face pt"):m("edge pt"),s("warning, UV not found for",k),null):a}function C(b,f,k){var a=b+":"+f;a in H?s("dup vertexNo",b,"oldFaceNo",f,"value",k,"key",a,H[a]):H[a]=k}var q=[],B=[],F=[],r=this,t=THREE.GeometryUtils.orderedKey,
h=THREE.GeometryUtils.computeEdgeFaces,j=c.vertices,x=c.faces,E=j.length,q=j.concat(),u=[],v={},J={},H={},a,G,l,d,g,A=c.faceVertexUvs[0],n;m("originalFaces, uvs, originalVerticesLength",x.length,A.length,E);if(r.supportUVs){a=0;for(G=A.length;a<G;a++){l=0;for(d=A[a].length;l<d;l++)n=x[a]["abcd".charAt(l)],C(n,a,A[a][l])}}0==A.length&&(r.supportUVs=!1);a=0;for(var D in H)a++;a||(r.supportUVs=!1,m("no uvs"));a=0;for(G=x.length;a<G;a++)g=x[a],u.push(g.centroid),q.push(g.centroid),r.supportUVs&&(d=new THREE.Vector2,
g instanceof THREE.Face3?(d.x=i(g.a,a).x+i(g.b,a).x+i(g.c,a).x,d.y=i(g.a,a).y+i(g.b,a).y+i(g.c,a).y,d.x/=3,d.y/=3):g instanceof THREE.Face4&&(d.x=i(g.a,a).x+i(g.b,a).x+i(g.c,a).x+i(g.d,a).x,d.y=i(g.a,a).y+i(g.b,a).y+i(g.c,a).y+i(g.d,a).y,d.x/=4,d.y/=4),C(E+a,"",d));var h=h(c),p;G=0;var y,z;D={};A={};for(a in h){n=h[a];y=a.split("_");z=y[0];y=y[1];l=z;g=[z,y];void 0===D[l]&&(D[l]=[]);D[l].push(g);l=y;g=[z,y];void 0===D[l]&&(D[l]=[]);D[l].push(g);l=0;for(d=n.length;l<d;l++){g=n[l];p=z;var K=g,I=a;void 0===
A[p]&&(A[p]={});A[p][K]=I;p=y;K=a;void 0===A[p]&&(A[p]={});A[p][g]=K}2>n.length&&(J[a]=!0)}for(a in h)n=h[a],g=n[0],p=n[1],y=a.split("_"),z=y[0],y=y[1],d=new THREE.Vector3,w(0<n.length,"an edge without faces?!"),1==n.length?(d.addSelf(j[z]),d.addSelf(j[y]),d.multiplyScalar(0.5)):(d.addSelf(u[g]),d.addSelf(u[p]),d.addSelf(j[z]),d.addSelf(j[y]),d.multiplyScalar(0.25)),v[a]=E+x.length+G,q.push(d),G++,r.supportUVs&&(d=new THREE.Vector2,d.x=i(z,g).x+i(y,g).x,d.y=i(z,g).y+i(y,g).y,d.x/=2,d.y/=2,C(v[a],
g,d),2<=n.length&&(w(2==n.length,"did we plan for more than 2 edges?"),d=new THREE.Vector2,d.x=i(z,p).x+i(y,p).x,d.y=i(z,p).y+i(y,p).y,d.x/=2,d.y/=2,C(v[a],p,d)));m("-- Step 2 done");var b,f;d=["123","12","2","23"];p=["123","23","3","31"];var K=["123","31","1","12"],I=["1234","12","2","23"],k=["1234","23","3","34"],L=["1234","34","4","41"],M=["1234","41","1","12"];a=0;for(G=u.length;a<G;a++)g=x[a],n=E+a,g instanceof THREE.Face3?(z=t(g.a,g.b),y=t(g.b,g.c),b=t(g.c,g.a),e(n,v[z],g.b,v[y],g,d,a),e(n,
v[y],g.c,v[b],g,p,a),e(n,v[b],g.a,v[z],g,K,a)):g instanceof THREE.Face4?(z=t(g.a,g.b),y=t(g.b,g.c),b=t(g.c,g.d),f=t(g.d,g.a),e(n,v[z],g.b,v[y],g,I,a),e(n,v[y],g.c,v[b],g,k,a),e(n,v[b],g.d,v[f],g,L,a),e(n,v[f],g.a,v[z],g,M,a)):m("face should be a face!",g);v=new THREE.Vector3;g=new THREE.Vector3;a=0;for(G=j.length;a<G;a++)if(void 0!==D[a]){v.set(0,0,0);g.set(0,0,0);y=new THREE.Vector3(0,0,0);n=0;for(l in A[a])v.addSelf(u[l]),n++;p=0;z=D[a].length;d=n!=z;for(l=0;l<z;l++)J[t(D[a][l][0],D[a][l][1])]&&
p++;v.divideScalar(n);p=0;if(d){for(l=0;l<z;l++)if(n=D[a][l],K=1==h[t(n[0],n[1])].length)n=j[n[0]].clone().addSelf(j[n[1]]).divideScalar(2),g.addSelf(n),p++;g.divideScalar(4);w(2==p,"should have only 2 boundary edges")}else{for(l=0;l<z;l++)n=D[a][l],n=j[n[0]].clone().addSelf(j[n[1]]).divideScalar(2),g.addSelf(n);g.divideScalar(z)}y.addSelf(j[a]);d?(y.divideScalar(2),y.addSelf(g)):(y.multiplyScalar(z-3),y.addSelf(v),y.addSelf(g.multiplyScalar(2)),y.divideScalar(z));q[a]=y}c.vertices=q;c.faces=B;c.faceVertexUvs[0]=
F;delete c.__tmpVertices;c.computeCentroids();c.computeFaceNormals();c.computeVertexNormals()};Tee.MyTorusGeometry=function(c,w,m,s,e){THREE.Geometry.call(this);this.radius=c||100;this.tube=w||40;this.radialSegments=m||8;this.tubularSegments=s||6;this.arc=e||2*Math.PI;for(var i,C=2*1/this.radialSegments*Math.PI,q=1/this.tubularSegments*this.arc,B,F,r,t,h,w=this.vertices,m=[],s=[],c=0;c<=this.radialSegments;c++){e=c*C;F=B=this.radius+this.tube*Math.cos(e);r=this.tube*Math.sin(e);h=c/this.radialSegments;
for(e=0;e<=this.tubularSegments;e++){i=e*q;t=Math.cos(i);i=Math.sin(i);var j=new THREE.Vector3(B*t,F*i,r);w.push(j);m.push(new THREE.Vector2(e/this.tubularSegments,h));t=new THREE.Vector3(j.x-this.radius*t,j.y-this.radius*i,r);s.push(t.normalize())}}for(var C=this.tubularSegments+1,x,E,u,v,J=0,H=0,a,c=1;c<=this.radialSegments;c++){q=J=H+C;B=H;x=s[q];E=s[B];i=w[q];j=w[B];for(e=1;e<=this.tubularSegments;e++)F=H+e,r=J+e,h=s[F],t=s[r],a=new THREE.Face4(q,B,F,r,[x,E,h,t]),u=a.normal,u.x=x.x+E.x+h.x+t.x,
u.y=x.y+E.y+h.y+t.y,u.z=x.z+E.z+h.z+t.z,u.normalize(),x=a.centroid,u=w[F],v=w[r],x.x=0.25*(i.x+j.x+u.x+v.x),x.y=0.25*(i.y+j.y+u.y+v.y),x.z=0.25*(i.z+j.z+u.z+v.z),this.faces.push(a),this.faceVertexUvs[0].push([m[q],m[B],m[F],m[r]]),q=r,B=F,x=t,E=h,i=v,j=u;H+=C}};"undefined"!==typeof THREE&&(Tee.MyTorusGeometry.prototype=new THREE.Geometry);Tee.MyParametricGeometry=function(c,w,m,s){THREE.Geometry.call(this);var e=this.vertices,i=this.faces,C=this.faceVertexUvs[0],s=void 0===s?!1:s,q,B,F=w+1,r=1/w,
t=1/F,h=1/m,j=1/(m+1);for(q=0;q<=m;q++)for(B=0;B<=w;B++)e.push(new THREE.Vector3(q*h-0.5,c(q,B),0.5-B*r));var x,E,u,v,J,H,a,G;for(q=0;q<m;q++){J=q*j;H=(q+1)*j;a=q*F;G=(q+1)*F;for(B=0;B<w;B++)c=a+B,e=G+B,u=B*t,x=u+t,r=new THREE.Vector2(u,J),h=new THREE.Vector2(x,J),u=new THREE.Vector2(u,H),v=new THREE.Vector2(x,H),s?(x=c+1,E=e+1,i.push(new THREE.Face3(c,x,e)),i.push(new THREE.Face3(x,E,e)),C.push([r,h,u]),C.push([h,v,u])):(i.push(new THREE.Face4(c,c+1,e+1,e)),C.push([r,h,v,u]))}this.computeCentroids();
this.computeFaceNormals();this.computeVertexNormals()};"undefined"!==typeof THREE&&(Tee.MyParametricGeometry.prototype=new THREE.Geometry);var N="undefined"!==typeof HTMLCanvasElement;Tee.Three=function(c){function w(b,f,k,a,c,O,d,e){b&&(f=new THREE.MeshBasicMaterial({vertexColors:THREE.VertexColors}),f.wireframe=b);f.vertexColors=THREE.VertexColors;b||(f.side=THREE.DoubleSide);b=new THREE.Mesh(c,f);c=e-d;e===d&&(c=1);e=a.height/c;b.position.set(a.x+0.5*(a.width-g),a.y+0.5*(a.height-A)-(d+0.5*c)*
e,0.5*-r);b.scale.set(a.width,e,r*O);j.add(b)}function m(b){G.extrudeOptions.amount=r*G.depth;b=0==G.depth?new THREE.ShapeGeometry(b):b.extrude(G.extrudeOptions);b=THREE.SceneUtils.createMultiMaterialObject(b,[G.getMaterial()]);G.showShadows&&(b.receiveShadow=!0,b.castShadow=!0);return b}function s(b,f,k,a,g,c){b.moveTo(f,k+c);b.lineTo(f,k+g-c);b.quadraticCurveTo(f,k+g,f+c,k+g);b.lineTo(f+a-c,k+g);b.quadraticCurveTo(f+a,k+g,f+a,k+g-c);b.lineTo(f+a,k+c);b.quadraticCurveTo(f+a,k,f+a-c,k);b.lineTo(f+
c,k);b.quadraticCurveTo(f,k,f,k+c)}function e(b){if("rgb("==b.substr(0,4))return b=b.slice(4,b.length-1).split(","),b[2]|b[1]<<8|b[0]<<16;switch(b){case "white":return 16777215;case "silver":return 14737632;case "darkgray":case "darkgrey":return 8421504;case "black":return 0;case "red":return 16711680;case "green":return 65280;case "blue":return 255;default:return 16777215}}function i(b,f){var k=d;k.width=b;k.height=f;p.setSize(b,f);D.aspect=b/f;D.updateProjectionMatrix()}function C(){B?(i(F.width,
F.height),B=!1):(F.width=d.width,F.height=d.height,i(window.innerWidth,window.innerHeight),B=!0);G.refresh()}this.setEnabled=function(b,f){if(!b||!Detector||Detector.webgl){if(this.__webgl=b)p&&(f.__webgl=!0,f.canvas.style.display="none",f.canvas=this,f.ctx=this,p&&p.domElement&&(p.domElement.style.display="block"));else{var k=d;h||(N?(h=document.createElement("canvas"),k instanceof HTMLCanvasElement?(k.parentElement.appendChild(h),h.style.background=k.style.background):k.appendChild(h)):"undefined"!=
typeof G_vmlCanvasManager&&(h=document.createElement("canvas"),h=G_vmlCanvasManager.initElement(h),k.appendChild(h)));h&&(h.setAttribute("width",k.width),h.setAttribute("height",k.height),h.height=k.clientHeight,h.width=k.clientWidth);p&&p.domElement?p.domElement.style.display="none":N&&k instanceof HTMLCanvasElement&&(k.style.display="none");h&&(h.style.display="block");f.canvas=h;f.ctx=null;f.__webgl=null;f.bounds.set(0,0,h.width,h.height);h&&(h.chart=f,h.onmousedown=h.ontouchstart=f.domousedown,
h.onmouseup=h.ontouchstop=f.domouseup,h.onmousemove=h.ontouchmove=f.domousemove,h.onmousewheel=h.onmousewheel=f._doWheel)}I&&(I.enabled=b);f.aspect.view3d=b;f.draw()}};this.zPos=function(){return r*(1-this.z-0.5*this.depth)};this.Gradient=function(){this.colors=[];this.stops=[];this.addColorStop=function(b,f){this.stops.push(b);this.colors.push(f)}};this.clearRect=function(){j&&n.remove(j);j=new THREE.Object3D;n.add(j);this.needsRender=!0};this.beginPath=function(){this.items=[];this.closedPath=!1};
this.moveTo=function(b,f,k){this.items.push({kind:0,x:b,y:f,z:k})};this.lineTo=function(b,f,k){this.items.push({kind:1,x:b,y:f,z:k})};this.lineZ=function(b,f,k,a){this.moveTo(b,f,k);this.lineTo(b,f,a)};this.surface=function(b,f,k,a,g,c){f=new Tee.MyParametricGeometry(f,b.x-1,b.y-1,!1);f.computeBoundingBox();var d=f.boundingBox,e=d.min.y,d=d.max.y,h=d-e,i,j,m=["a","b","c","d"],l=f.vertices;for(j=0;j<f.vertices.length;j++)i=new THREE.Color,i.setHSV(0.7*(d-l[j].y)/h,1,0.9),f.colors[j]=i;for(j=0;j<f.faces.length;j++){h=
f.faces[j];for(i=0;4>i;i++)h.vertexColors[i]=f.colors[h[m[i]]]}j=new THREE.MeshLambertMaterial({color:16777215,opacity:this.globalAlpha,wireframe:this.wireframe});w(a,j,b,k,f,c,e,d);g&&!a&&(a=new THREE.MeshBasicMaterial({color:this.colorToInt(g),opacity:this.globalAlpha}),a.wireframe=!0,w(!1,a,b,k,f,c,e,d))};this.slice=function(b,f,k,a,g,c,d,e){this.beveled=void 0===e?!1:e;0<c?(this.path=8,this.p=b,this.torus=d,this.center=f,this.radius=k,this.angle0=a,this.angle1=g,this.donut=c,this.items=[]):(this.beginPath(),
this.moveTo(b.x,b.y),this.arc(f.x,f.y,k,a,g,!1),this.closePath())};this.closePath=function(){this.closedPath=!0};this.createLinearGradient=function(){return new this.Gradient};this.createRadialGradient=function(){return new this.Gradient};var q;this.getMaterial=function(b){var f=this.fillStyle;return b?(q||(q=THREE.ImageUtils.loadTextureCube("textures/pisa/px.png textures/pisa/nx.png textures/pisa/py.png textures/pisa/ny.png textures/pisa/pz.png textures/pisa/nz.png".split(" "),null,function(){G.refresh()})),
new THREE.MeshBasicMaterial({color:16777215,envMap:q})):new THREE.MeshPhongMaterial({color:this.colorToInt(f),opacity:this.globalAlpha,wireframe:this.wireframe,specular:5592405,map:null})};this.spline=function(b,f){this.items=[];var k=this.path=0;if(f){for(var a=[];k<b.length;)a.push(new THREE.Vector2(b[k],-b[k+1])),k+=2;this.items.push({kind:12,p:a})}else{for(a=new THREE.SplineCurve3;k<b.length;)a.points.push(new THREE.Vector3(b[k],-b[k+1],0)),k+=2;this.items.push({kind:8,geo:a})}};this.bezierCurveTo=
function(b,f,a,g,c,d){this.items.push({kind:11,a:b,b:f,c:a,d:g,e:c,f:d})};this.quadraticCurveTo=function(b,f,a,g){this.items.push({kind:7,x:b,y:f,width:a,height:g})};this.arc=function(b,f,a,g,c,d){this.items.push({kind:4,x:b,y:f,radius:a,angle:g,endAngle:c,clockwise:d})};this.extrudeOptions={amount:1,bevelEnabled:!1,bevelSegments:16,steps:12,curveSegments:64,bevelThickness:10,bevelSize:8};this.getContext=function(){return this};this.beginParent=function(){x=j;j=new THREE.Object3D;x.add(j);return j};
this.endParent=function(){j=x};this.fill=function(){var b,f;f=G.getMaterial();var k=this.items,c=k.length,d=this.r;if(0<c)if(8==k[0].kind)k=new THREE.TubeGeometry(k[0].geo,100,0.05*r*this.depth,8,!1,!1),f=new THREE.Mesh(k,f),f.position.set(0.5*-g,0.5*A,this.zPos()),j.add(f);else if(this.closedPath){f=new THREE.Shape;for(var e,i,h,l=0;l<c;l++)if(e=k[l],0==e.kind){if(0==l||i!==e.x||h!==-e.y)i=e.x,h=-e.y,f.moveTo(i,h)}else if(1==e.kind){if(0==l||i!==e.x||h!==-e.y)i=e.x,h=-e.y,f.lineTo(i,h)}else 4==e.kind?
f.absarc(i,h,e.radius,2*Math.PI-e.angle,2*Math.PI-e.endAngle,e.clockwise):7==e.kind?f.quadraticCurveTo(e.x,e.y,e.width,e.height):11==e.kind?f.bezierCurveTo(e.a,-e.b,e.c,-e.d,e.e,-e.f):12==e.kind&&(f.moveTo(e.p[0].x,e.p[0].y),f.splineThru(e.p));k=this.extrudeOptions.bevelEnabled;if(this.extrudeOptions.bevelEnabled=this.beveled)c=0.02*this.extrudeOptions.bevelSize,this.depth-=c,this.z+=0.5*c;f=m(f);f.position.set(0.5*-g,0.5*A,this.zPos()-0.5*r*this.depth);j.add(f);this.extrudeOptions.bevelEnabled=k}else{h=
new THREE.Geometry;i=-r*this.depth;f.side=THREE.DoubleSide;for(l=0;l<c;l++)h.vertices.push(new THREE.Vector3(k[l].x,-k[l].y,0),new THREE.Vector3(k[l].x,-k[l].y,i)),0<l&&(e=new THREE.Face4(2*(l-1),2*l-1,2*l+1,2*l),h.faces.push(e));h.computeFaceNormals();f=new THREE.Mesh(h,f);f.position.set(0.5*-g,0.5*A,this.zPos()-0.5*i);j.add(f)}else 0==this.depth?0<this.rx?(f=new THREE.Shape,s(f,d.x,-d.y,d.width,d.height,this.rx),f=m(f),f.position.set(0.5*-g,-d.height+0.5*A,this.zPos()),j.add(f)):6==this.path?(f=
new THREE.Shape,f.absellipse(0,0,0.5*d.width,0.5*d.height,0,2*Math.PI,!0),f=m(f),f.position.set(this.cx-0.5*g,-this.cy+0.5*A,this.zPos()),j.add(f)):(b=new THREE.PlaneGeometry(d.width,d.height),f.side=THREE.DoubleSide,b=new THREE.Mesh(b,f)):5==this.path?(1==this.topRadius?(u||(u=new THREE.CylinderGeometry(1,1,1,32,64,!1),b=new THREE.SubdivisionModifier(2),b.modify(u)),b=u):(v||(v=new THREE.CylinderGeometry(0,1,1,32,1,!1)),b=v),b=new THREE.Mesh(b,f),f=0.5*Math.min(this.vertical?d.width:d.height,r),
b.scale.x=f,b.scale.z=f,b.scale.y=this.vertical?d.height:d.width,this.vertical||(b.rotation.z=0.5*Math.PI,b.rotation.y=Math.PI)):7==this.path?(a||(a=new THREE.SphereGeometry(1,32,32),b=new THREE.SubdivisionModifier(2),b.modify(a)),b=new THREE.Mesh(a,f),b.scale.set(0.5*d.width,0.5*d.height,r*this.depth)):6==this.path?(f=new THREE.Shape,f.absellipse(0,0,0.5*d.width,0.5*d.height,0,2*Math.PI,!0),f=m(f),f.position.set(this.cx-0.5*g,-this.cy+0.5*A,this.zPos()),j.add(f)):8==this.path?(this.angle0=2*Math.PI-
this.angle0,this.angle1=2*Math.PI-this.angle1,this.torus?(k=Math.abs(this.angle1-this.angle0),c=Math.max(16,90*Math.PI/k|0),k=new Tee.MyTorusGeometry(this.radius-0.5*this.donut,0.5*this.donut,16,c,k),f=new THREE.Mesh(k,f),f.position.set(this.center.x-0.5*g,-this.center.y+0.5*A,this.zPos()+this.donut),f.rotation.z=this.angle1,j.add(f)):(f=new THREE.Shape,f.moveTo(this.p.x,this.p.y),f.absarc(this.center.x,this.center.y,this.radius,this.angle0,this.angle1,!0),f.absarc(this.center.x,this.center.y,this.donut,
this.angle0,this.angle1,!1),k=this.extrudeOptions.bevelEnabled,this.extrudeOptions.bevelEnabled=this.beveled,f=m(f),f.position.set(0.5*-g,0.5*-A,this.zPos()),j.add(f),this.extrudeOptions.bevelEnabled=k)):(1===t?(J||(J=new THREE.CubeGeometry(1,1,1)),b=J):(H||(H=new THREE.CubeGeometry(1,1,1,t,t,t),b=new THREE.SubdivisionModifier(2),b.modify(H)),b=H),b=new THREE.Mesh(b,f),b.scale.set(d.width,d.height,r*this.depth));b&&(b.position.set(d.x+0.5*d.width-0.5*g,-(d.y+0.5*d.height)+0.5*A,this.zPos()),this.showShadows&&
(b.receiveShadow=!0,b.castShadow=!0),j.add(b))};this.setLineDash=function(b){this.dash=b};this.lineMaterial=function(){var b;b={color:this.colorToInt(this.strokeStyle),opacity:this.globalAlpha};this.dash&&0<this.dash.length?(b=new THREE.LineDashedMaterial(b),b.dashSize=3,b.gapSize=1):(b=new THREE.LineBasicMaterial(b),b.linecap=this.cap,b.linejoin=this.join);b.linewidth=this.lineWidth;return b};this.polygon=function(b,f){var a,c=b.length,d,e,h=new THREE.Shape;h.moveTo(b[0].x,-b[0].y);for(a=1;a<c;a++)d=
b[a],h.lineTo(d.x,-d.y);e=h.makeGeometry();""!==f.fill&&(this.fillStyle=f.fill,0<this.depth?a=m(h):(d=this.getMaterial(),a=new THREE.Mesh(e,d),this.wireFrame||(d.side=THREE.DoubleSide)),e=r*(1-this.z),a.position.set(0.5*-g,0.5*A,e-0.5*this.depth),this.showShadows&&(a.castShadow=!0),j.add(a));if(""!==f.stroke.fill){e=new THREE.Geometry;for(a=0;a<c;a++)d=b[a],e.vertices.push(new THREE.Vector3(d.x,-d.y,0));c=new THREE.Line(e,this.lineMaterial());e=r*(1-this.z+this.depth);c.position.set(0.5*-g,0.5*A,
e);j.add(c)}};this.stroke=function(){var b=this.items.length,f=this.lineMaterial(),a;if(0<b){var d,c;c=new THREE.Geometry;for(var e=0;e<b;e++)d=this.items[e],a=void 0===d.z?this.z:d.z,a=r*(1-a),0==d.kind?(0<c.vertices.length&&(c=new THREE.Line(c,f),j.add(c)),c=new THREE.Geometry,c.vertices.push(new THREE.Vector3(d.x-0.5*g,-d.y+0.5*A,a))):1==d.kind&&c.vertices.push(new THREE.Vector3(d.x-0.5*g,-d.y+0.5*A,a));0<c.vertices.length&&(c=new THREE.Line(c,f),j.add(c))}else 0==this.depth&&(b=new THREE.Path,
a=this.r,0==this.path||1==this.path?0<this.rx?s(b,a.x,-a.y-a.height,a.width,a.height,this.rx):(b.moveTo(a.x,-a.y-a.height),b.lineTo(a.x+a.width,-a.y-a.height),b.lineTo(a.x+a.width,-a.y),b.lineTo(a.x,-a.y)):6==this.path&&b.absellipse(this.cx,-this.cy,0.5*a.width,0.5*a.height,0,2*Math.PI,!0),c=new THREE.Line(b.createPointsGeometry(),f),c.position.set(0.5*-g,0.5*A,this.zPos()),j.add(c))};this.measureText=function(b){return{width:1.4*y.measureText(b).width}};this.roundRect=function(b,a,c,d,e,g){this.path=
0;this.r={x:b,y:a,width:c,height:d};this.depth=0;this.rx=e;this.ry=g};this.rect=function(b,a,c,d){this.path=0;this.r={x:b,y:a,width:c,height:d};this.ry=this.rx=this.depth=0};this.cube=function(b,a){this.path=1;this.r=b;this.items=[];t=0<a?6:1};this.sphere=function(b,a,c,d){E||(E=new THREE.SphereGeometry(1,32,32));var e=new THREE.Mesh(E,this.getMaterial());e.position.set(b-0.5*g,-a+0.5*A,this.zPos());e.scale.set(0.5*c,0.5*d,0.5*Math.min(c,r));j.add(e)};this.save=function(){};this.clip=function(){};
this.restore=function(){};this.colorToInt=function(b){b=b instanceof this.Gradient?b.colors[b.colors.length-1]:b;return"#"==b.substr(0,1)?parseInt(b.substr(1),16):e(b)};this.pyramid=function(){var b=[new THREE.Vector3(100,0,0),new THREE.Vector3(0,100,0),new THREE.Vector3(0,0,100),new THREE.Vector3(0,0,0)];new THREE.ConvexGeometry(b)};this.ellipsoid=function(b,a){this.path=7;this.r=b;this.vertical=a;this.items=[]};this.cylinder=function(b,a,c){this.path=5;this.r=b;this.topRadius=a;this.vertical=c;
this.items=[]};this.ellipsePath=function(b,a,c,d){this.path=6;this.cx=b;this.cy=a;this.r={x:b,y:a,width:c,height:d};this.items=[]};this.addLight=function(b,a,c,d,e,g){b=new b(a);b.position.set(c,d,e);b.shadowsEnabled=g;if(this.showShadows&&g&&(b instanceof THREE.SpotLight||b instanceof THREE.DirectionalLight))b.castShadow=!0;n.add(b);this.lights.push(b);return b};this.fillText=function(b,a,c){if(""!==b){var d;a:{var e=this.font.split(" "),h;for(h=0;h<e.length;h++)if(d=parseFloat(e[h]))break a;d=20}a:{h=
l.length;for(var i,e=0;e<h;e++)if(i=l[e],i.text===b&&i.size===d){h=i.obj;break a}h=null}e=0;h||(h=new THREE.TextGeometry(b,{size:d,height:this.textDepth,curveSegments:2,font:"helvetiker"}),h.computeBoundingBox(),l.push({text:b,obj:h,size:d}));b=h.boundingBox;d=b.max.x-b.min.x;b=b.max.y-b.min.y;if("center"===this.textAlign)e=-0.5*d;else if("right"===this.textAlign||"end"===this.textAlign)e=-d;d=new THREE.MeshLambertMaterial({color:this.colorToInt(this.fillStyle),opacity:this.globalAlpha,overdraw:!1});
h=new THREE.Mesh(h,d);b="top"===this.textBaseline?b:"middle"==this.textBaseline?0.5*b:0;h.position.x=a+e-0.5*g;h.position.y=-c+0.5*A-b;h.position.z=1+r*(1-this.z);h.rotation.x=0;h.rotation.y=2*Math.PI;j.add(h)}};this.update=function(){this.__webgl&&(I&&I.enabled&&I.update(1),this.needsRender&&(this.hitTest&&this.doHitTest(),this.doRender()))};this.setCamera=function(b){D&&n.remove(D);this.camera=D=b?new THREE.PerspectiveCamera(45,window.innerWidth/window.innerHeight,0.1,1E4):new THREE.OrthographicCamera(-window.innerWidth/
2,window.innerWidth/2,window.innerHeight/2,-window.innerHeight/2,0.1,1E4);D.lookAt(n.position);n.add(D);D.position.set(0,0,800);I&&(I.object=D);this.refresh()};this.refresh=function(){this.needsRender=!0;this.update()};this.createTrackball=function(){if(p&&"undefined"!==typeof THREE.TrackballControls){I=this.trackBall=new THREE.TrackballControls(D,p.domElement);I.enabled=!0;I.keys=[65,83,68];I.dynamicDampingFactor=0.2;if(-1<("undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"").indexOf("mac os x"))I.zoomSpeed=
0.1;I instanceof THREE.TrackballControls&&I.addEventListener("change",function(){G.needsRender=!0})}};var B,F={};document.addEventListener("fullscreenchange",C,!1);document.addEventListener("mozfullscreenchange",C,!1);document.addEventListener("webkitfullscreenchange",C,!1);this.fullScreen=function(){var b=d,a=b.requestFullscreen||b.mozRequestFullscreen||b.webkitRequestFullscreen||b.msRequestFullScreen;a&&a.call(b)};this.onWindowResize=function(){D instanceof THREE.PerspectiveCamera&&(D.aspect=window.innerWidth/
Math.max(1,window.innerHeight));D.updateProjectionMatrix();p&&p.setSize(window.innerWidth,window.innerHeight)};this.setShowShadows=function(b){this.showShadows=b;for(var a,b=0;b<this.lights.length;b++)if(a=this.lights[b],(a instanceof THREE.SpotLight||a instanceof THREE.DirectionalLight)&&a.shadowsEnabled)a.castShadow=this.showShadows;K.receiveShadow=this.showShadows;p&&(p.shadowMapEnabled=this.showShadows,p.shadowMapType=THREE.PCFSoftShadowMap,this.showShadows&&(p.shadowMapAutoUpdate=!0))};this.setShowLights=
function(b){this.showLights=b;var a,d=this.lights.length,c;for(a=0;a<d;a++)if(c=this.lights[a],c.__helper)b=c.visible&&this.showLights,c.__helper.traverse(function(a){a.visible=b});else if(this.showLights){if(c instanceof THREE.SpotLight)c.__helper=new THREE.SpotLightHelper(c,16,100);else if(c instanceof THREE.PointLight)c.__helper=new THREE.PointLightHelper(c,16);else if(c instanceof THREE.DirectionalLight)c.__helper=new THREE.DirectionalLightHelper(c,16,100);else continue;n.add(c.__helper)}this.needsRender||
this.refresh()};this.showLight=function(b,a){var c=this.lights[b];c.visible=a;c.__helper&&(a=a&&this.showLights,c.__helper.traverse(function(b){b.visible=a}));this.refresh()};this.doHitTest=function(){};this.doRender=function(){p&&(p.render(n,D),p.shadowMapAutoUpdate=!1,z&&z.visible&&z.update());this.needsRender=!1};this.clearTextCache=function(){l=[]};this.toogle=function(a,c){a.visible=c;a.visual?(a.visual.traverse(function(a){a.visible=c}),this.needsRender=!0):a.chart.draw();this.update()};this.isEnabled=
function(){return this.__webgl};this.__webgl="undefined"===typeof Detector||Detector&&Detector.webgl;this.needsRender=!0;var r=200;this.showShadows=this.showLights=!1;this.items=[];this.closedPath=!1;this.textDepth=this.z=0;this.beveled=!1;var t=1,h,j;this.wireframe=!1;this.globalAlpha=1;var x,E,u,v,J,H,a,G=this,l=[],d=document.getElementById(c),g=d.clientWidth,A=d.clientHeight,n,D,p,c=null;N&&d instanceof HTMLCanvasElement&&(c=d);this.__webgl&&(n=new THREE.Scene,p=new THREE.WebGLRenderer({antialias:!0,
canvas:c,clearAlpha:1}));var y=null;N&&(y=document.createElement("canvas").getContext("2d"));this.width=g;this.height=A;this.camera=D;this.scene=n;(this.renderer=p)?p.sortObjects=!1:this.__webgl=!1;var z=this.stats=null;document.addEventListener&&"undefined"!==typeof Stats&&(z=this.stats=new Stats,z.visible=!0,z.setVisible=function(a){z.visible=a;z.domElement.style.display=a?"block":"none"});p&&(p.setSize(g,A),this.showShadows&&(p.shadowMapEnabled=!0,p.shadowMapSoft=!0));n&&n.add(D);c="#AAAA77";window.getComputedStyle&&
(c=window.getComputedStyle(d).backgroundColor);p&&(p.setClearColorHex(this.colorToInt(c),1),d!==p.domElement&&d.appendChild(p.domElement));this.lights=[];if(p){this.addLight(THREE.SpotLight,12303291,-300,300,400,!0);this.addLight(THREE.DirectionalLight,8947848,400,1800,1600,!1);this.addLight(THREE.PointLight,8947848,500,120,-500,!1);this.setShowLights(this.showLights);c=this.ambientLight=new THREE.AmbientLight(2236962);c.visible=!1;n.add(c);c=this.hemiLight=new THREE.HemisphereLight(16777215,16777215,
0.5);c.position.y=500;c.visible=!1;n.add(c);var K=this.floor=new THREE.Mesh(new THREE.CylinderGeometry(4E3,4E3,50,32,1,!1),new THREE.MeshLambertMaterial({color:this.colorToInt("silver"),map:null,opacity:0.9,transparent:!0}));this.showShadows&&(K.receiveShadow=!0);K.position.y=-20-0.5*A;n.add(K);var I=this.trackBall=null;this.createTrackball();this.setCamera(!0)}this.needsRender=!0}}).call(this);
