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