diff --git a/build/nunu.editor.min.js b/build/nunu.editor.min.js index 21088521e..a01185bfd 100644 --- a/build/nunu.editor.min.js +++ b/build/nunu.editor.min.js @@ -1106,34 +1106,34 @@ e,d,g,f,h,k){this.contactPointPool=f;this.frictionEquationPool=k;this.result=g;t w);w.vadd(k.position,w);var q=k.shapes[p];if(!(y.distanceTo(w)>m.boundingSphereRadius+q.boundingSphereRadius)){var t=null;m.material&&q.material&&(t=d.getContactMaterial(m.material,q.material)||null);this.currentContactMaterial=t||n||d.defaultContactMaterial;(t=this[m.type|q.type])&&(m.type=A.dot(p)){var q=this.createContactEquation(r,n,b,e);q.ni.copy(A);var x=C;A.scale(p.dot(A),x);l.vsub(x,x);q.ri.copy(x);q.ri.vsub(r.position,q.ri);q.rj.copy(l);q.rj.vsub(n.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}}};var E=new h,B=new h,z=(new h,new h),J=new h,H=new h,L=new h,K=new h,M=new h,I=new h,G=new h,W=new h,O=new h,S=new h,R=new f,N=[];d.prototype[g.types.SPHERE|g.types.TRIMESH]=d.prototype.sphereTrimesh=function(b, -e,d,g,f,h,r,l){m.pointToLocalFrame(g,h,d,I);f=b.radius;R.lowerBound.set(I.x-f,I.y-f,I.z-f);R.upperBound.set(I.x+f,I.y+f,I.z+f);e.getTrianglesInAABB(R,N);var n=b.radius*b.radius;for(f=0;fp;p++)if(e.getVertex(e.indices[3*N[f]+p],z),z.vsub(I,B),B.norm2()<=n){J.copy(z);m.pointToWorldFrame(g,h,J,z);z.vsub(d,B);var q=this.createContactEquation(r,l,b,e);q.ni.copy(B);q.ni.normalize();q.ri.copy(q.ni);q.ri.scale(b.radius,q.ri);q.ri.vadd(d,q.ri);q.ri.vsub(r.position,q.ri);q.rj.copy(z); -q.rj.vsub(l.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}for(f=0;fp;p++)e.getVertex(e.indices[3*N[f]+p],H),e.getVertex(e.indices[3*N[f]+(p+1)%3],L),L.vsub(H,K),I.vsub(L,G),d=G.dot(K),I.vsub(H,G),q=G.dot(K),0d&&(I.vsub(H,G),M.copy(K),M.normalize(),q=G.dot(M),M.scale(q,G),G.vadd(H,G),d=G.distanceTo(I),d=A.dot(p)){var q=this.createContactEquation(r,l,b,e);q.ni.copy(A);var x=C;A.scale(p.dot(A),x);n.vsub(x,x);q.ri.copy(x);q.ri.vsub(r.position,q.ri);q.rj.copy(n);q.rj.vsub(l.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}}};var E=new h,B=new h,z=(new h,new h),J=new h,H=new h,L=new h,K=new h,M=new h,I=new h,G=new h,W=new h,O=new h,S=new h,R=new f,N=[];d.prototype[g.types.SPHERE|g.types.TRIMESH]=d.prototype.sphereTrimesh=function(b, +e,d,g,f,h,r,n){m.pointToLocalFrame(g,h,d,I);f=b.radius;R.lowerBound.set(I.x-f,I.y-f,I.z-f);R.upperBound.set(I.x+f,I.y+f,I.z+f);e.getTrianglesInAABB(R,N);var l=b.radius*b.radius;for(f=0;fp;p++)if(e.getVertex(e.indices[3*N[f]+p],z),z.vsub(I,B),B.norm2()<=l){J.copy(z);m.pointToWorldFrame(g,h,J,z);z.vsub(d,B);var q=this.createContactEquation(r,n,b,e);q.ni.copy(B);q.ni.normalize();q.ri.copy(q.ni);q.ri.scale(b.radius,q.ri);q.ri.vadd(d,q.ri);q.ri.vsub(r.position,q.ri);q.rj.copy(z); +q.rj.vsub(n.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}for(f=0;fp;p++)e.getVertex(e.indices[3*N[f]+p],H),e.getVertex(e.indices[3*N[f]+(p+1)%3],L),L.vsub(H,K),I.vsub(L,G),d=G.dot(K),I.vsub(H,G),q=G.dot(K),0d&&(I.vsub(H,G),M.copy(K),M.normalize(),q=G.dot(M),M.scale(q,G),G.vadd(H,G),d=G.distanceTo(I),dw&&0C&&C>-E&&B>ia&&ia>-B&&(w=Math.abs(w-y-h),(null===x||x>w)&&(x=w,p=C,q=ia,n=y,U.copy(A),F.copy(D),ha.copy(z),m++))}}m&&(l=!0,m=this.createContactEquation(k,r,b,e),U.mult(-h,m.ri),m.ni.copy(U),m.ni.negate(m.ni),U.mult(n,U),F.mult(p,F),U.vadd(F,U),ha.mult(q,ha),U.vadd(ha, -m.rj),m.ri.vadd(d,m.ri),m.ri.vsub(k.position,m.ri),m.rj.vadd(g,m.rj),m.rj.vsub(r.position,m.rj),this.result.push(m),this.createFrictionEquationsFromContact(m,this.frictionResult));w=f.get();for(n=0;2!==n&&!l;n++)for(p=0;2!==p&&!l;p++)for(q=0;2!==q&&!l;q++)if(w.set(0,0,0),n?w.vadd(ba[0],w):w.vsub(ba[0],w),p?w.vadd(ba[1],w):w.vsub(ba[1],w),q?w.vadd(ba[2],w):w.vsub(ba[2],w),g.vadd(w,ca),ca.vsub(d,ca),ca.norm2()D&&(l=!0,q=this.createContactEquation(k,r,b,e),t.vadd(u,q.rj),q.rj.copy(q.rj),w.negate(q.ni),q.ni.normalize(),q.ri.copy(q.rj),q.ri.vadd(g,q.ri),q.ri.vsub(d,q.ri),q.ri.normalize(),q.ri.mult(h,q.ri),q.ri.vadd(d,q.ri),q.ri.vsub(k.position,q.ri),q.rj.vadd(g,q.rj),q.rj.vsub(r.position,q.rj),this.result.push(q),this.createFrictionEquationsFromContact(q,this.frictionResult))}f.release(x,t,m,u,w)};var ia=new h,qa=new h,ua=new h,ta=new h,La= -new h,va=new h,Wa=new h,xa=new h,Vb=new h,fa=new h;d.prototype[g.types.SPHERE|g.types.CONVEXPOLYHEDRON]=d.prototype.sphereConvex=function(b,e,d,g,f,h,k,r){f=this.v3pool;d.vsub(g,ia);for(var l=e.faceNormals,n=e.faces,m=e.vertices,p=b.radius,q=0;q!==m.length;q++){var x=La;h.vmult(m[q],x);g.vadd(x,x);var t=ta;if(x.vsub(d,t),t.norm2()y&&0w&&0C&&C>-E&&B>ia&&ia>-B&&(w=Math.abs(w-y-h),(null===x||x>w)&&(x=w,p=C,q=ia,l=y,U.copy(A),F.copy(D),ha.copy(z),m++))}}m&&(n=!0,m=this.createContactEquation(k,r,b,e),U.mult(-h,m.ri),m.ni.copy(U),m.ni.negate(m.ni),U.mult(l,U),F.mult(p,F),U.vadd(F,U),ha.mult(q,ha),U.vadd(ha, +m.rj),m.ri.vadd(d,m.ri),m.ri.vsub(k.position,m.ri),m.rj.vadd(g,m.rj),m.rj.vsub(r.position,m.rj),this.result.push(m),this.createFrictionEquationsFromContact(m,this.frictionResult));w=f.get();for(l=0;2!==l&&!n;l++)for(p=0;2!==p&&!n;p++)for(q=0;2!==q&&!n;q++)if(w.set(0,0,0),l?w.vadd(ba[0],w):w.vsub(ba[0],w),p?w.vadd(ba[1],w):w.vsub(ba[1],w),q?w.vadd(ba[2],w):w.vsub(ba[2],w),g.vadd(w,ca),ca.vsub(d,ca),ca.norm2()D&&(n=!0,q=this.createContactEquation(k,r,b,e),t.vadd(u,q.rj),q.rj.copy(q.rj),w.negate(q.ni),q.ni.normalize(),q.ri.copy(q.rj),q.ri.vadd(g,q.ri),q.ri.vsub(d,q.ri),q.ri.normalize(),q.ri.mult(h,q.ri),q.ri.vadd(d,q.ri),q.ri.vsub(k.position,q.ri),q.rj.vadd(g,q.rj),q.rj.vsub(r.position,q.rj),this.result.push(q),this.createFrictionEquationsFromContact(q,this.frictionResult))}f.release(x,t,m,u,w)};var ia=new h,qa=new h,ua=new h,ta=new h,La= +new h,va=new h,Wa=new h,xa=new h,Vb=new h,fa=new h;d.prototype[g.types.SPHERE|g.types.CONVEXPOLYHEDRON]=d.prototype.sphereConvex=function(b,e,d,g,f,h,k,r){f=this.v3pool;d.vsub(g,ia);for(var n=e.faceNormals,l=e.faces,m=e.vertices,p=b.radius,q=0;q!==m.length;q++){var x=La;h.vmult(m[q],x);g.vadd(x,x);var t=ta;if(x.vsub(d,t),t.norm2()y&&0=C&&!1===z)){F=!1;break a}null===z&&(z=0=Pa.dot(Ba)){var n=this.createContactEquation(k,r,b,e),m=Za;Pa.mult(Pa.dot(Ba), -m);Aa.vsub(m,m);m.vsub(d,n.ri);n.ni.copy(Pa);Aa.vsub(g,n.rj);n.ri.vadd(d,n.ri);n.ri.vsub(k.position,n.ri);n.rj.vadd(g,n.rj);n.rj.vsub(r.position,n.rj);this.result.push(n);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(n,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)};var ra=new h,ma=new h;d.prototype[g.types.CONVEXPOLYHEDRON]=d.prototype.convexConvex=function(b,e,d,g,f,h,k,r,n,l,m,p){if(!(d.distanceTo(g)>b.boundingSphereRadius+e.boundingSphereRadius)&& -b.findSeparatingAxis(e,d,f,g,h,ra,m,p)){m=[];b.clipAgainstHull(d,f,e,g,h,ra,-100,100,m);for(h=f=0;h!==m.length;h++){p=this.createContactEquation(k,r,b,e,n,l);var q=p.ri,x=p.rj;ra.negate(p.ni);m[h].normal.negate(ma);ma.mult(m[h].depth,ma);m[h].point.vadd(ma,q);x.copy(m[h].point);q.vsub(d,q);x.vsub(g,x);q.vadd(d,q);q.vsub(k.position,q);x.vadd(g,x);x.vsub(r.position,x);this.result.push(p);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(p,this.frictionResult)}this.enableFrictionReduction&& +e.material;e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse;this.planeConvex(b,e.convexPolyhedronRepresentation,d,g,f,h,k,r)};var Aa=new h,Pa=new h,Ba=new h,Za=new h;d.prototype[g.types.PLANE|g.types.CONVEXPOLYHEDRON]=d.prototype.planeConvex=function(b,e,d,g,f,h,k,r){Pa.set(0,0,1);f.vmult(Pa,Pa);for(var n=f=0;n!==e.vertices.length;n++)if(Aa.copy(e.vertices[n]),h.vmult(Aa,Aa),g.vadd(Aa,Aa),Aa.vsub(d,Ba),0>=Pa.dot(Ba)){var l=this.createContactEquation(k,r,b,e),m=Za;Pa.mult(Pa.dot(Ba), +m);Aa.vsub(m,m);m.vsub(d,l.ri);l.ni.copy(Pa);Aa.vsub(g,l.rj);l.ri.vadd(d,l.ri);l.ri.vsub(k.position,l.ri);l.rj.vadd(g,l.rj);l.rj.vsub(r.position,l.rj);this.result.push(l);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(l,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)};var ra=new h,ma=new h;d.prototype[g.types.CONVEXPOLYHEDRON]=d.prototype.convexConvex=function(b,e,d,g,f,h,k,r,l,n,m,p){if(!(d.distanceTo(g)>b.boundingSphereRadius+e.boundingSphereRadius)&& +b.findSeparatingAxis(e,d,f,g,h,ra,m,p)){m=[];b.clipAgainstHull(d,f,e,g,h,ra,-100,100,m);for(h=f=0;h!==m.length;h++){p=this.createContactEquation(k,r,b,e,l,n);var q=p.ri,x=p.rj;ra.negate(p.ni);m[h].normal.negate(ma);ma.mult(m[h].depth,ma);m[h].point.vadd(ma,q);x.copy(m[h].point);q.vsub(d,q);x.vsub(g,x);q.vadd(d,q);q.vsub(k.position,q);x.vadd(g,x);x.vsub(r.position,x);this.result.push(p);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(p,this.frictionResult)}this.enableFrictionReduction&& f&&this.createFrictionFromAverage(f)}};var Ja=new h,Ea=new h,V=new h;d.prototype[g.types.PLANE|g.types.PARTICLE]=d.prototype.planeParticle=function(b,e,d,g,f,h,k,r){Ja.set(0,0,1);k.quaternion.vmult(Ja,Ja);g.vsub(k.position,Ea);0>=Ja.dot(Ea)&&(b=this.createContactEquation(r,k,e,b),b.ni.copy(Ja),b.ni.negate(b.ni),b.ri.set(0,0,0),Ja.mult(Ja.dot(g),V),g.vsub(V,V),b.rj.copy(V),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var Ha=new h;d.prototype[g.types.PARTICLE| g.types.SPHERE]=d.prototype.sphereParticle=function(b,e,d,g,f,h,k,r){Ha.set(0,0,1);g.vsub(d,Ha);Ha.norm2()<=b.radius*b.radius&&(e=this.createContactEquation(r,k,e,b),Ha.normalize(),e.rj.copy(Ha),e.rj.mult(b.radius,e.rj),e.ni.copy(Ha),e.ni.negate(e.ni),e.ri.set(0,0,0),this.result.push(e),this.createFrictionEquationsFromContact(e,this.frictionResult))};var aa=new l,Xa=new h,zb=(new h,new h),na=new h,Na=new h;d.prototype[g.types.PARTICLE|g.types.CONVEXPOLYHEDRON]=d.prototype.convexParticle=function(b, -e,d,g,f,h,k,r){var n=-1;h=null;var l=0;if(Xa.copy(g),Xa.vsub(d,Xa),f.conjugate(aa),aa.vmult(Xa,Xa),b.pointIsInside(Xa)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(d,f);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(f);f=0;for(var m=b.faces.length;f!==m;f++){var p=b.worldFaceNormals[f];g.vsub(b.worldVertices[b.faces[f][0]],na);var q=-p.dot(na);(null===h||Math.abs(q)x||0>l||q>n.length||t>n[0].length)){0>q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>l&&(l=0);q>=n.length&& -(q=n.length-1);x>=n.length&&(x=n.length-1);l>=n[0].length&&(l=n[0].length-1);t>=n[0].length&&(t=n[0].length-1);n=[];e.getRectMinMax(q,t,x,l,n);var u=n[0];if(!(Lb.z-p>n[1]||Lb.z+pp;p++)for(q=t;l>q;q++)e.getConvexTrianglePillar(p,q,!1),m.pointToWorldFrame(g,h,e.pillarOffset,Oa),d.distanceTo(Oa)x||0>p||q>n.length||p>n[0].length)){0> -q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>p&&(p=0);q>=n.length&&(q=n.length-1);x>=n.length&&(x=n.length-1);p>=n[0].length&&(p=n[0].length-1);t>=n[0].length&&(t=n[0].length-1);n=[];e.getRectMinMax(q,t,x,p,n);var u=n[0];if(!(Fa.z-l>n[1]||Fa.z+lq;q++)for(n=t;p>n;n++)if(u=l.length,e.getConvexTrianglePillar(q,n,!1),m.pointToWorldFrame(g,h,e.pillarOffset,wb),d.distanceTo(wb)x||0>n||q>l.length||t>l[0].length)){0>q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>n&&(n=0);q>=l.length&& +(q=l.length-1);x>=l.length&&(x=l.length-1);n>=l[0].length&&(n=l[0].length-1);t>=l[0].length&&(t=l[0].length-1);l=[];e.getRectMinMax(q,t,x,n,l);var u=l[0];if(!(Lb.z-p>l[1]||Lb.z+pp;p++)for(q=t;n>q;q++)e.getConvexTrianglePillar(p,q,!1),m.pointToWorldFrame(g,h,e.pillarOffset,Oa),d.distanceTo(Oa)x||0>p||q>l.length||p>l[0].length)){0> +q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>p&&(p=0);q>=l.length&&(q=l.length-1);x>=l.length&&(x=l.length-1);p>=l[0].length&&(p=l[0].length-1);t>=l[0].length&&(t=l[0].length-1);l=[];e.getRectMinMax(q,t,x,p,l);var u=l[0];if(!(Fa.z-n>l[1]||Fa.z+nq;q++)for(l=t;p>l;l++)if(u=n.length,e.getConvexTrianglePillar(q,l,!1),m.pointToWorldFrame(g,h,e.pillarOffset,wb),d.distanceTo(wb)>>=0;128<=a;)f=a&127|128,this.view[b++]=f,a>>>=7;this.view[b++]=a;ret }var d=0,e=0,f;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;f=this.view[a++];5>d&&(e|=(f&127)<<7*d);++d}while(0!==(f&128));e|=0;return b?(this.offset=a,e):{value:e,length:d}};h.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=k.zigZagDecode32(a.value):a=k.zigZagDecode32(a);return a};a&&(k.MAX_VARINT64_BYTES=10,k.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var d=b.toInt()>>> 0,e=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==e?16384>d?128>d?1:2:2097152>d?3:4:16384>e?128>e?5:6:2097152>e?7:8:128>b?9:10},k.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},k.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& (b=b.toSigned());return b.shiftRightUnsigned(1).xor(b.and(a.ONE).toSigned().negate()).toSigned()},h.writeVarint64=function(b,d){var e='undefined'===typeof d;e&&(d=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof d||0!==d%1)throw TypeError('Illegal offset: '+d+' (not an integer)');d>>>=0;if(0>d||d+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -d+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var f=k.calculateVarint64(b),g=b.toInt()>>>0,h=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;d+=f;var n=this.buffer.byteLength;d>n&&this.resize((n*=2)>d?n:d);d-=f;switch(f){case 10:this.view[d+9]=b>>>7&1;case 9:this.view[d+8]=9!==f?b|128:b&127;case 8:this.view[d+7]=8!==f?h>>>21|128:h>>>21&127;case 7:this.view[d+6]= +d+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var f=k.calculateVarint64(b),g=b.toInt()>>>0,h=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;d+=f;var l=this.buffer.byteLength;d>l&&this.resize((l*=2)>d?l:d);d-=f;switch(f){case 10:this.view[d+9]=b>>>7&1;case 9:this.view[d+8]=9!==f?b|128:b&127;case 8:this.view[d+7]=8!==f?h>>>21|128:h>>>21&127;case 7:this.view[d+6]= 7!==f?h>>>14|128:h>>>14&127;case 6:this.view[d+5]=6!==f?h>>>7|128:h>>>7&127;case 5:this.view[d+4]=5!==f?h|128:h&127;case 4:this.view[d+3]=4!==f?g>>>21|128:g>>>21&127;case 3:this.view[d+2]=3!==f?g>>>14|128:g>>>14&127;case 2:this.view[d+1]=2!==f?g>>>7|128:g>>>7&127;case 1:this.view[d]=1!==f?g|128:g&127}return e?(this.offset+=f,this):f},h.writeVarint64ZigZag=function(a,b){return this.writeVarint64(k.zigZagEncode64(a),b)},h.readVarint64=function(b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!== typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var e=b,f,g=0,h=0,k;k=this.view[b++];f=k&127;if(k&128&&(k=this.view[b++],f|=(k&127)<<7,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],f|=(k&127)<<14,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],f|=(k&127)<<21,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++], g=k&127,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],g|=(k&127)<<7,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],g|=(k&127)<<14,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],g|=(k&127)<<21,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],h=k&127,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],h|=(k&127)<<7,k&128||this.noAssert&&'undefined'===typeof k))throw Error('Buffer overrun');f=a.fromBits(f|g<<28,g>>>4| @@ -1921,17 +1921,7 @@ d;return f}catch(e){throw b.littleEndian=d,e;}};f.prototype._decodeValue=functio case b.LONG:return d?f.readVarint64ZigZag():f.readVarint32ZigZag();case b.FLOAT:return f.readFloat32();case b.DOUBLE:return f.readFloat64();case b.STRING:return f.readVString();case b.STRING_ADD:return f=f.readVString(),this.dict.push(f),f;case b.STRING_GET:return this.dict[f.readVarint32()];case b.BINARY:return g=f.readVarint32(),h=f.slice(f.offset,f.offset+g),f.offset+=g,h;default:throw Error('Illegal type at '+f.offset+': '+g);}};return f}(a,b.T);b.Pair=function(){var a=function(){};a.prototype.encode= function(a){return this.encoder.encode(a)};a.prototype.toArrayBuffer=function(a){return this.encoder.encode(a).toArrayBuffer()};a.prototype.toBuffer=function(a){return this.encoder.encode(a).toBuffer()};a.prototype.decode=function(a){return this.decoder.decode(a)};return a}();b.StaticPair=function(a,b,d){var f=function(f,g){a.call(this);this.encoder=new b(f,!1,g);this.decoder=new d(f,!1,g)};f.prototype=Object.create(a.prototype);return f}(b.Pair,b.Encoder,b.Decoder);b.ProgressivePair=function(a,d, f){var g=function(b,g){a.call(this);this.encoder=new d(b,!0,g);this.decoder=new f(b,!0,g)};g.prototype=Object.create(a.prototype);g.prototype.exclude=function(a){b.exclude(a)};g.prototype.include=function(a){b.include(a)};return g}(b.Pair,b.Encoder,b.Decoder);b.exclude=function(a){'object'===typeof a&&Object.defineProperty(a,'_PSON_EXCL_',{value:!0,enumerable:!1,configurable:!0})};b.include=function(a){'object'===typeof a&&delete a._PSON_EXCL_};return b}'undefined'!=typeof module&&module.exports? -module.exports=b(require('bytebuffer')):'undefined'!=typeof define&&define.amd?define('PSON',['ByteBuffer'],b):(a.dcodeIO||(a.dcodeIO={}),a.dcodeIO.PSON=b(a.dcodeIO.ByteBuffer))})(this); -var BufferAttribute=THREE.BufferAttribute,BufferGeometry=THREE.BufferGeometry,Clock=THREE.Clock,Face3=THREE.Face3,Geometry=THREE.Geometry,Object3D=THREE.Object3D,Raycaster=THREE.Raycaster,Material=THREE.Material,LineBasicMaterial=THREE.LineBasicMaterial,LineDashedMaterial=THREE.LineDashedMaterial,MeshBasicMaterial=THREE.MeshBasicMaterial,MeshDepthMaterial=THREE.MeshDepthMaterial,MeshLambertMaterial=THREE.MeshLambertMaterial,MeshNormalMaterial=THREE.MeshNormalMaterial,MeshPhongMaterial=THREE.MeshPhongMaterial, -MeshPhysicalMaterial=THREE.MeshPhysicalMaterial,MeshStandardMaterial=THREE.MeshStandardMaterial,MeshToonMaterial=THREE.MeshToonMaterial,MultiMaterial=THREE.MultiMaterial,PointsMaterial=THREE.PointsMaterial,RawShaderMaterial=THREE.RawShaderMaterial,ShaderMaterial=THREE.ShaderMaterial,SpriteMaterial=THREE.SpriteMaterial,BoxBufferGeometry=THREE.BoxBufferGeometry,BoxGeometry=THREE.BoxGeometry,CircleBufferGeometry=THREE.CircleBufferGeometry,CircleGeometry=THREE.CircleGeometry,ConeBufferGeometry=THREE.ConeBufferGeometry, -ConeGeometry=THREE.ConeGeometry,CylinderBufferGeometry=THREE.CylinderBufferGeometry,CylinderGeometry=THREE.CylinderGeometry,DodecahedronBufferGeometry=THREE.DodecahedronBufferGeometry,DodecahedronGeometry=THREE.DodecahedronGeometry,ExtrudeGeometry=THREE.ExtrudeGeometry,IcosahedronBufferGeometry=THREE.IcosahedronBufferGeometry,IcosahedronGeometry=THREE.IcosahedronGeometry,LatheBufferGeometry=THREE.LatheBufferGeometry,LatheGeometry=THREE.LatheGeometry,OctahedronBufferGeometry=THREE.OctahedronBufferGeometry, -OctahedronGeometry=THREE.OctahedronGeometry,ParametricBufferGeometry=THREE.ParametricBufferGeometry,ParametricGeometry=THREE.ParametricGeometry,PlaneBufferGeometry=THREE.PlaneBufferGeometry,PlaneGeometry=THREE.PlaneGeometry,PolyhedronBufferGeometry=THREE.PolyhedronBufferGeometry,PolyhedronGeometry=THREE.PolyhedronGeometry,RingBufferGeometry=THREE.RingBufferGeometry,RingGeometry=THREE.RingGeometry,ShapeGeometry=THREE.ShapeGeometry,SphereBufferGeometry=THREE.SphereBufferGeometry,SphereGeometry=THREE.SphereGeometry, -TetrahedronBufferGeometry=THREE.TetrahedronBufferGeometry,TetrahedronGeometry=THREE.TetrahedronGeometry,TextGeometry=THREE.TextGeometry,TorusBufferGeometry=THREE.TorusBufferGeometry,TorusGeometry=THREE.TorusGeometry,TorusKnotBufferGeometry=THREE.TorusKnotBufferGeometry,TorusKnotGeometry=THREE.TorusKnotGeometry,TubeGeometry=THREE.TubeGeometry,TubeBufferGeometry=THREE.TubeBufferGeometry,WireframeGeometry=THREE.WireframeGeometry,TrianglesDrawMode=THREE.TrianglesDrawMode,TriangleStripDrawMode=THREE.TriangleStripDrawMode, -TriangleFanDrawMode=THREE.TriangleFanDrawMode,Box2=THREE.Box2,Box3=THREE.Box3,Color=THREE.Color,Euler=THREE.Euler,Line3=THREE.Line3,Frustum=THREE.Frustum,Matrix3=THREE.Matrix3,Matrix4=THREE.Matrix4,Plane=THREE.Plane,Quarternion=THREE.Quarternion,Ray=THREE.Ray,Sphere=THREE.Sphere,Spline=THREE.Spline,Triangle=THREE.Triangle,Vector2=THREE.Vector2,Vector3=THREE.Vector3,Vector4=THREE.Vector4,LOD=THREE.LOD,LensFlare=THREE.LensFlare,Line=THREE.Line,LineSegments=THREE.LineSegments,AABB=CANNON.AABB,ArrayCollisionMatrix= -CANNON.ArrayCollisionMatrix,Body=CANNON.Body,Box=CANNON.Box,Broadphase=CANNON.Broadphase,ConeEquation=CANNON.ConeEquation,ConeTwistConstraint=CANNON.ConeTwistConstraint,Constraint=CANNON.Constraint,ContactEquation=CANNON.ContactEquation,ContactMaterial=CANNON.ContactMaterial,ConvexPolyhedron=CANNON.ConvexPolyhedron,Cylinder=CANNON.Cylinder,DistanceConstraint=CANNON.DistanceConstraint,Equation=CANNON.Equation,EventTarget=CANNON.EventTarget,FrictionEquation=CANNON.FrictionEquation,GridBroadphase=CANNON.GridBroadphase, -GSSolver=CANNON.GSSolver,Heightfield=CANNON.Heightfield,HingeConstraint=CANNON.HingeConstraint,JacobianElement=CANNON.JacobianElement,LockConstraint=CANNON.LockConstraint,Mat3=CANNON.Mat3,PhysicsMaterial=CANNON.Material,NaiveBroadphase=CANNON.NaiveBroadphase,Narrowphase=CANNON.Narrowphase,ObjectCollisionMatrix=CANNON.ObjectCollisionMatrix,Octree=CANNON.Octree,OctreeNode=CANNON.OctreeNode,Particle=CANNON.Particle,PointToPointConstraint=CANNON.PointToPointConstraint,Pool=CANNON.Pool,PhysicsRay=CANNON.Ray, -RaycastResult=CANNON.RaycastResult,RaycastVehicle=CANNON.RaycastVehicle,RigidVehicle=CANNON.RigidVehicle,RotationalEquation=CANNON.RotationalEquation,RotationalMotorEquation=CANNON.RotationalMotorEquation,SAPBroadphase=CANNON.SAPBroadphase,Shape=CANNON.Shape,Solver=CANNON.Solver,SPHSystem=CANNON.SPHSystem,SplitSolver=CANNON.SplitSolver,Spring=CANNON.Spring,Transform=CANNON.Transform,Trimesh=CANNON.Trimesh,TupleDictionary=CANNON.TupleDictionary,Vec3=CANNON.Vec3,Vec3Pool=CANNON.Vec3Pool,WheelInfo=CANNON.WheelInfo, -World=CANNON.World;function FileSystem(){}try{FileSystem.fs=require('fs')}catch(a){} +module.exports=b(require('bytebuffer')):'undefined'!=typeof define&&define.amd?define('PSON',['ByteBuffer'],b):(a.dcodeIO||(a.dcodeIO={}),a.dcodeIO.PSON=b(a.dcodeIO.ByteBuffer))})(this);function importFrom(a){for(var b in a)b in window||(window[b]=a[b])}importFrom(THREE);importFrom(CANNON);importFrom(SPE);function FileSystem(){}try{FileSystem.fs=require('fs')}catch(a){} FileSystem.readFile=function(a,b,f,d){void 0===b&&(b=!0);if(void 0!==FileSystem.fs&&FileSystem.fs.existsSync(g)){if(b)return a=FileSystem.fs.readFileSync(a,'utf8'),void 0!==f&&f(a),a;FileSystem.fs.readFile(a,'utf8',function(a,b){void 0!==f&&f(b)});return null}var g=new XMLHttpRequest;g.overrideMimeType('text/plain');g.open('GET',a,!b);g.onload=function(){200!==g.status&&0!==g.status||void 0===f||f(g.response)};void 0!==d&&(g.onprogress=function(a){d(a)});g.send(null);return g.response}; FileSystem.readFileArrayBuffer=function(a,b,f,d){void 0===b&&(b=!0);if(void 0!==FileSystem.fs){if(b){a=FileSystem.fs.readFileSync(a);b=a.length;for(var g=new ArrayBuffer(b),k=new Uint8Array(g),h=0;ha?a:.05);for(a=0;a>18,k=(m&258048)>>12,h=(m&4032)>>6,m&=63,b+=Base64Utils.encoding[g]+Base64Utils.encoding[k]+Base64Utils.encoding[h]+Base64Utils.encoding[m];1===f?(m=a[d],b+=Base64Utils.encoding[(m&252)>>2]+Base64Utils.encoding[(m&3)<<4]+'=='):2===f&&(m=a[d]<<8|a[d+1],b+=Base64Utils.encoding[(m&64512)>>10]+Base64Utils.encoding[(m&1008)>>4]+Base64Utils.encoding[(m& 15)<<2]+'=');return b}; Base64Utils.fromBinaryString=function(a){for(var b='',f=a.length%3,d=a.length-f,g,k,h,m=0;m>2),b+=Base64Utils.encoding.charAt((g&3)<<4|(k&240)>>4),b+=Base64Utils.encoding.charAt((k&15)<<2|(h&192)>>6),b+=Base64Utils.encoding.charAt(h&63);1===f?(g=a.charCodeAt(m)&255,b+=Base64Utils.encoding.charAt(g>>2),b+=Base64Utils.encoding.charAt((g&3)<<4),b+='=='):2===f&&(g=a.charCodeAt(m)&255,k=a.charCodeAt(m+ @@ -5028,8 +5018,8 @@ function Settings(){}Settings.RADIANS=0;Settings.DEGREES=1;Settings.FREE=10;Sett Settings.loadDefault=function(){Settings.general={};Settings.general.theme='dark';Settings.general.filePreviewSize=70;Settings.general.showStats=!1;Settings.general.showUUID=!1;Settings.editor={};Settings.editor.angleFormat=Settings.RADIANS;Settings.editor.snap=!1;Settings.editor.snapAngle=.1;Settings.editor.gridSize=500;Settings.editor.gridSpacing=5;Settings.editor.gridEnabled=!0;Settings.editor.axisEnabled=!0;Settings.editor.cameraPreviewEnabled=!0;Settings.editor.cameraPreviewPercentage=.35;Settings.editor.cameraPreviewPosition= Settings.BOTTOM_RIGHT;Settings.editor.lockMouse=!0;Settings.editor.transformationSpace='world';Settings.editor.navigation=Settings.FREE;Settings.editor.invertNavigation=!1;Settings.editor.keyboardNavigation=!0;Settings.render={};Settings.render.followProject=!0;Settings.render.toneMapping=THREE.LinearToneMapping;Settings.render.toneMappingExposure=1;Settings.render.toneMappingWhitePoint=1;Settings.render.antialiasing=!0;Settings.render.shadows=!0;Settings.render.shadowsType=THREE.PCFSoftShadowMap; Settings.code={};Settings.code.theme='monokai';Settings.code.keymap='sublime';Settings.code.fontSize=14;Settings.code.lineNumbers=!0;Settings.code.lineWrapping=!1;Settings.code.autoCloseBrackets=!0;Settings.code.highlightActiveLine=!1;Settings.code.showMatchesOnScrollbar=!0;Settings.code.dragFiles=!0}; -Settings.store=function(){var a=JSON.stringify({general:Settings.general,editor:Settings.editor,render:Settings.render,code:Settings.code},null,'\t');a.replace(/[\n\t]+([\d\.e\-\[\]]+)/g,'$1');Nunu.runningOnDesktop()?FileSystem.writeFile('config',a):Cookies.set('config',a)}; -Settings.load=function(){try{var a=Nunu.runningOnDesktop()?JSON.parse(FileSystem.readFile('config')):JSON.parse(Cookies.get('config'));Settings.general=a.general;Settings.editor=a.editor;Settings.render=a.render;Settings.code=a.code}catch(b){Settings.loadDefault()}};function Editor(){}Editor.filePath='editor/files/';Editor.runtimePath='runtime/';Editor.NWJSPath='../nwjs/';Editor.SELECT=0;Editor.MOVE=1;Editor.SCALE=2;Editor.ROTATE=3; +Settings.store=function(){var a=JSON.stringify({general:Settings.general,editor:Settings.editor,render:Settings.render,code:Settings.code},null,'\t');a.replace(/[\n\t]+([\d\.e\-\[\]]+)/g,'$1');Nunu.runningOnDesktop()?FileSystem.writeFile('config',a):Cookies.set('config',a)};Settings.load=function(){try{var a=Nunu.runningOnDesktop()?JSON.parse(FileSystem.readFile('config')):JSON.parse(Cookies.get('config')),b;for(b in a)Settings[b]=a[b]}catch(f){Settings.loadDefault()}};function Editor(){} +Editor.filePath='editor/files/';Editor.runtimePath='runtime/';Editor.NWJSPath='../nwjs/';Editor.SELECT=0;Editor.MOVE=1;Editor.SCALE=2;Editor.ROTATE=3; Editor.initialize=function(){try{Editor.gui=require('nw.gui'),Editor.clipboard=Editor.gui.Clipboard.get(),Editor.args=Editor.gui.App.argv}catch(g){Editor.clipboard=new Clipboard;Editor.args=[];for(var a=location.search.substring(1).split('&'),b=0;ba.keyCode||!a.altKey&&a.ctrlKey&&-1===d.indexOf(a.keyCode))&&a.preventDefault()};window.onbeforeunload=function(a){Settings.store();return a.returnValue='All unsaved changes to the project will be lost! Do you really wanna exit?'}}document.body.ondrop=function(a){0=r||0 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}'].join('\n')); -x.compileShader(I);x.compileShader(Q);x.attachShader(k,I);x.attachShader(k,Q);x.linkProgram(k);F=k;A=x.getAttribLocation(F,'position');C=x.getAttribLocation(F,'uv');b=x.getUniformLocation(F,'uvOffset');d=x.getUniformLocation(F,'uvScale');c=x.getUniformLocation(F,'rotation');h=x.getUniformLocation(F,'scale');f=x.getUniformLocation(F,'color');q=x.getUniformLocation(F,'map');g=x.getUniformLocation(F,'opacity');l=x.getUniformLocation(F,'modelViewMatrix');p=x.getUniformLocation(F,'projectionMatrix');t= +function Nunu(){}Nunu.NAME='nunuStudio';Nunu.VERSION='V0.9.0 Beta';Nunu.TIMESTAMP='201706291910';Nunu.webvrAvailable=function(){return void 0!==navigator.getVRDisplays};Nunu.getVRDisplays=function(a){void 0===navigator.getVRDisplays?console.warn('nunuStudio: WebVR is not supported.'):navigator.getVRDisplays().then(function(e){0=r||0 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}'].join('\n')); +x.compileShader(I);x.compileShader(Q);x.attachShader(k,I);x.attachShader(k,Q);x.linkProgram(k);F=k;A=x.getAttribLocation(F,'position');C=x.getAttribLocation(F,'uv');b=x.getUniformLocation(F,'uvOffset');d=x.getUniformLocation(F,'uvScale');c=x.getUniformLocation(F,'rotation');h=x.getUniformLocation(F,'scale');g=x.getUniformLocation(F,'color');q=x.getUniformLocation(F,'map');e=x.getUniformLocation(F,'opacity');l=x.getUniformLocation(F,'modelViewMatrix');p=x.getUniformLocation(F,'projectionMatrix');t= x.getUniformLocation(F,'fogType');m=x.getUniformLocation(F,'fogDensity');u=x.getUniformLocation(F,'fogNear');v=x.getUniformLocation(F,'fogFar');w=x.getUniformLocation(F,'fogColor');y=x.getUniformLocation(F,'alphaTest');k=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');k.width=8;k.height=8;I=k.getContext('2d');I.fillStyle='white';I.fillRect(0,0,8,8);L=new ca(k)}z.useProgram(F);z.initAttributes();z.enableAttribute(A);z.enableAttribute(C);z.disableUnusedAttributes();z.disable(x.CULL_FACE); z.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,E);x.vertexAttribPointer(A,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(C,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,D);x.uniformMatrix4fv(p,!1,n.projectionMatrix.elements);z.activeTexture(x.TEXTURE0);x.uniform1i(q,0);I=k=0;(Q=B.fog)?(x.uniform3f(w,Q.color.r,Q.color.g,Q.color.b),Q.isFog?(x.uniform1f(u,Q.near),x.uniform1f(v,Q.far),x.uniform1i(t,1),I=k=1):Q.isFogExp2&&(x.uniform1f(m,Q.density),x.uniform1i(t,2),I=k=2)):(x.uniform1i(t,0),I=k=0);for(var Q= -0,wa=a.length;Qa&&(a=e[B]);return a}function da(){Object.defineProperty(this,'id',{value:$d++});this.uuid=ka.generateUUID();this.name='';this.type='BufferGeometry';this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function Ra(e,a,B,b,d,c){aa.call(this);this.type='BoxGeometry';this.parameters={width:e,height:a,depth:B,widthSegments:b,heightSegments:d,depthSegments:c}; -this.fromBufferGeometry(new Sa(e,a,B,b,d,c));this.mergeVertices()}function Sa(e,a,B,b,d,c){function r(e,a,r,B,b,d,c,p,Q,t,m){var u=d/Q,v=c/t,w=d/2,wa=c/2,y=p/2;c=Q+1;var Ca=t+1,A=d=0,Da,x,C=new n;for(x=0;xa&&(a=f[B]);return a}function da(){Object.defineProperty(this,'id',{value:$d++});this.uuid=ka.generateUUID();this.name='';this.type='BufferGeometry';this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function Ra(f,a,B,b,d,c){aa.call(this);this.type='BoxGeometry';this.parameters={width:f,height:a,depth:B,widthSegments:b,heightSegments:d,depthSegments:c}; +this.fromBufferGeometry(new Sa(f,a,B,b,d,c));this.mergeVertices()}function Sa(f,a,B,b,d,c){function r(f,a,r,B,b,d,c,p,Q,t,m){var u=d/Q,v=c/t,w=d/2,wa=c/2,y=p/2;c=Q+1;var Ca=t+1,A=d=0,Da,x,C=new n;for(x=0;x/gm,function(e,a){e=ma[a]; -if(void 0===e)throw Error('Can not resolve #include <'+a+'>');return ae(e)})}function Ke(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,a,b,c){e='';for(a=parseInt(a);a/gm,function(f,a){f=ma[a]; +if(void 0===f)throw Error('Can not resolve #include <'+a+'>');return ae(f)})}function Ke(f){return f.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(f,a,b,c){f='';for(a=parseInt(a);aa||e.height>a){a/=Math.max(e.width,e.height);var r=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');r.width=Math.floor(e.width*a);r.height=Math.floor(e.height*a);r.getContext('2d').drawImage(e, -0,0,e.width,e.height,0,0,r.width,r.height);console.warn('THREE.WebGLRenderer: image is too big ('+e.width+'x'+e.height+'). Resized to '+r.width+'x'+r.height,e);return r}return e}function B(e){return ka.isPowerOfTwo(e.width)&&ka.isPowerOfTwo(e.height)}function k(e,a){return e.generateMipmaps&&a&&1003!==e.minFilter&&1006!==e.minFilter}function f(a){return 1003===a||1004===a||1005===a?e.NEAREST:e.LINEAR}function q(a){a=a.target;a.removeEventListener('dispose',q);a:{var r=d.get(a);if(a.image&&r.__image__webglTextureCube)e.deleteTexture(r.__image__webglTextureCube); -else{if(void 0===r.__webglInit)break a;e.deleteTexture(r.__webglTexture)}d.remove(a)}n.textures--}function l(a){a=a.target;a.removeEventListener('dispose',l);var r=d.get(a),b=d.get(a.texture);if(a){void 0!==b.__webglTexture&&e.deleteTexture(b.__webglTexture);a.depthTexture&&a.depthTexture.dispose();if(a.isWebGLRenderTargetCube)for(b=0;6>b;b++)e.deleteFramebuffer(r.__webglFramebuffer[b]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[b]);else e.deleteFramebuffer(r.__webglFramebuffer), -r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer);d.remove(a.texture);d.remove(a)}n.textures--}function g(a,f){var l=d.get(a);if(0t;t++)I[t]=f||l?l?a.image[t].image:a.image[t]:r(a.image[t],c.maxCubemapSize);var m=B(I[0]),u=h(a.format),Q=h(a.type);p(e.TEXTURE_CUBE_MAP,a,m);for(t= -0;6>t;t++)if(f)for(var v,w=I[t].mipmaps,y=0,wa=w.length;yq;q++)r.__webglFramebuffer[q]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(h){b.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture);p(e.TEXTURE_CUBE_MAP,a.texture,f);for(q=0;6>q;q++)I(r.__webglFramebuffer[q],a,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+q);k(a.texture,f)&&e.generateMipmap(e.TEXTURE_CUBE_MAP);b.bindTexture(e.TEXTURE_CUBE_MAP,null)}else b.bindTexture(e.TEXTURE_2D, -c.__webglTexture),p(e.TEXTURE_2D,a.texture,f),I(r.__webglFramebuffer,a,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),k(a.texture,f)&&e.generateMipmap(e.TEXTURE_2D),b.bindTexture(e.TEXTURE_2D,null);if(a.depthBuffer){r=d.get(a);c=!0===a.isWebGLRenderTargetCube;if(a.depthTexture){if(c)throw Error('target.depthTexture not supported in Cube render targets');if(a&&a.isWebGLRenderTargetCube)throw Error('Depth Texture with cube render targets is not supported!');e.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer); -if(!a.depthTexture||!a.depthTexture.isDepthTexture)throw Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');d.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0);g(a.depthTexture,0);r=d.get(a.depthTexture).__webglTexture;if(1026===a.depthTexture.format)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT, -e.TEXTURE_2D,r,0);else if(1027===a.depthTexture.format)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,r,0);else throw Error('Unknown depthTexture format');}else if(c)for(r.__webglDepthbuffer=[],c=0;6>c;c++)e.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[c]),r.__webglDepthbuffer[c]=e.createRenderbuffer(),t(r.__webglDepthbuffer[c],a);else e.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),t(r.__webglDepthbuffer,a);e.bindFramebuffer(e.FRAMEBUFFER, -null)}};this.updateRenderTargetMipmap=function(a){var r=a.texture,c=B(a);k(r,c)&&(a=a.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,r=d.get(r).__webglTexture,b.bindTexture(a,r),e.generateMipmap(a),b.bindTexture(a,null))}}function yf(){var e={};return{get:function(a){a=a.uuid;var r=e[a];void 0===r&&(r={},e[a]=r);return r},remove:function(a){delete e[a.uuid]},clear:function(){e={}}}}function zf(e,a,b){function r(a,r,b){var d=new Uint8Array(4),B=e.createTexture();e.bindTexture(a,B);e.texParameteri(a, -e.TEXTURE_MIN_FILTER,e.NEAREST);e.texParameteri(a,e.TEXTURE_MAG_FILTER,e.NEAREST);for(a=0;aa||f.height>a){a/=Math.max(f.width,f.height);var r=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');r.width=Math.floor(f.width*a);r.height=Math.floor(f.height*a);r.getContext('2d').drawImage(f, +0,0,f.width,f.height,0,0,r.width,r.height);console.warn('THREE.WebGLRenderer: image is too big ('+f.width+'x'+f.height+'). Resized to '+r.width+'x'+r.height,f);return r}return f}function B(f){return ka.isPowerOfTwo(f.width)&&ka.isPowerOfTwo(f.height)}function k(f,a){return f.generateMipmaps&&a&&1003!==f.minFilter&&1006!==f.minFilter}function g(a){return 1003===a||1004===a||1005===a?f.NEAREST:f.LINEAR}function q(a){a=a.target;a.removeEventListener('dispose',q);a:{var r=d.get(a);if(a.image&&r.__image__webglTextureCube)f.deleteTexture(r.__image__webglTextureCube); +else{if(void 0===r.__webglInit)break a;f.deleteTexture(r.__webglTexture)}d.remove(a)}n.textures--}function e(a){a=a.target;a.removeEventListener('dispose',e);var r=d.get(a),b=d.get(a.texture);if(a){void 0!==b.__webglTexture&&f.deleteTexture(b.__webglTexture);a.depthTexture&&a.depthTexture.dispose();if(a.isWebGLRenderTargetCube)for(b=0;6>b;b++)f.deleteFramebuffer(r.__webglFramebuffer[b]),r.__webglDepthbuffer&&f.deleteRenderbuffer(r.__webglDepthbuffer[b]);else f.deleteFramebuffer(r.__webglFramebuffer), +r.__webglDepthbuffer&&f.deleteRenderbuffer(r.__webglDepthbuffer);d.remove(a.texture);d.remove(a)}n.textures--}function l(a,g){var e=d.get(a);if(0t;t++)I[t]=g||e?e?a.image[t].image:a.image[t]:r(a.image[t],c.maxCubemapSize);var m=B(I[0]),u=h(a.format),Q=h(a.type);p(f.TEXTURE_CUBE_MAP,a,m);for(t= +0;6>t;t++)if(g)for(var v,w=I[t].mipmaps,y=0,wa=w.length;yq;q++)r.__webglFramebuffer[q]=f.createFramebuffer()}else r.__webglFramebuffer=f.createFramebuffer();if(h){b.bindTexture(f.TEXTURE_CUBE_MAP,c.__webglTexture);p(f.TEXTURE_CUBE_MAP,a.texture,g);for(q=0;6>q;q++)I(r.__webglFramebuffer[q],a,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+q);k(a.texture,g)&&f.generateMipmap(f.TEXTURE_CUBE_MAP);b.bindTexture(f.TEXTURE_CUBE_MAP,null)}else b.bindTexture(f.TEXTURE_2D, +c.__webglTexture),p(f.TEXTURE_2D,a.texture,g),I(r.__webglFramebuffer,a,f.COLOR_ATTACHMENT0,f.TEXTURE_2D),k(a.texture,g)&&f.generateMipmap(f.TEXTURE_2D),b.bindTexture(f.TEXTURE_2D,null);if(a.depthBuffer){r=d.get(a);c=!0===a.isWebGLRenderTargetCube;if(a.depthTexture){if(c)throw Error('target.depthTexture not supported in Cube render targets');if(a&&a.isWebGLRenderTargetCube)throw Error('Depth Texture with cube render targets is not supported!');f.bindFramebuffer(f.FRAMEBUFFER,r.__webglFramebuffer); +if(!a.depthTexture||!a.depthTexture.isDepthTexture)throw Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');d.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0);l(a.depthTexture,0);r=d.get(a.depthTexture).__webglTexture;if(1026===a.depthTexture.format)f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT, +f.TEXTURE_2D,r,0);else if(1027===a.depthTexture.format)f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,r,0);else throw Error('Unknown depthTexture format');}else if(c)for(r.__webglDepthbuffer=[],c=0;6>c;c++)f.bindFramebuffer(f.FRAMEBUFFER,r.__webglFramebuffer[c]),r.__webglDepthbuffer[c]=f.createRenderbuffer(),t(r.__webglDepthbuffer[c],a);else f.bindFramebuffer(f.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=f.createRenderbuffer(),t(r.__webglDepthbuffer,a);f.bindFramebuffer(f.FRAMEBUFFER, +null)}};this.updateRenderTargetMipmap=function(a){var r=a.texture,c=B(a);k(r,c)&&(a=a.isWebGLRenderTargetCube?f.TEXTURE_CUBE_MAP:f.TEXTURE_2D,r=d.get(r).__webglTexture,b.bindTexture(a,r),f.generateMipmap(a),b.bindTexture(a,null))}}function yf(){var f={};return{get:function(a){a=a.uuid;var r=f[a];void 0===r&&(r={},f[a]=r);return r},remove:function(a){delete f[a.uuid]},clear:function(){f={}}}}function zf(f,a,b){function r(a,r,b){var d=new Uint8Array(4),B=f.createTexture();f.bindTexture(a,B);f.texParameteri(a, +f.TEXTURE_MIN_FILTER,f.NEAREST);f.texParameteri(a,f.TEXTURE_MAG_FILTER,f.NEAREST);for(a=0;a=ga.maxTextures&&console.warn('THREE.WebGLRenderer: Trying to use '+e+' texture units while this GPU supports only '+ga.maxTextures);ca+=1;return e};this.setTexture2D=function(){var e=!1;return function(a,r){a&&a.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), -e=!0),a=a.texture);ma.setTexture2D(a,r)}}();this.setTexture=function(){var e=!1;return function(a,r){e||(console.warn('THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead.'),e=!0);ma.setTexture2D(a,r)}}();this.setTextureCube=function(){var e=!1;return function(a,r){a&&a.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&& -6===a.image.length?ma.setTextureCube(a,r):ma.setTextureCubeDynamic(a,r)}}();this.getRenderTarget=function(){return fa};this.setRenderTarget=function(e){(fa=e)&&void 0===ra.get(e).__webglFramebuffer&&ma.setupRenderTarget(e);var a=e&&e.isWebGLRenderTargetCube,r;e?(r=ra.get(e),r=a?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,pa.copy(e.scissor),Y=e.scissorTest,Fa.copy(e.viewport)):(r=null,pa.copy(fb).multiplyScalar(Ja),Y=ab,Fa.copy(Ia).multiplyScalar(Ja));N!==r&&(K.bindFramebuffer(K.FRAMEBUFFER, -r),N=r);ia.scissor(pa);ia.setScissorTest(Y);ia.viewport(Fa);a&&(a=ra.get(e.texture),K.framebufferTexture2D(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,a.__webglTexture,e.activeMipMapLevel))};this.readRenderTargetPixels=function(e,a,r,b,d,B){if(e&&e.isWebGLRenderTarget){var c=ra.get(e).__webglFramebuffer;if(c){var h=!1;c!==N&&(K.bindFramebuffer(K.FRAMEBUFFER,c),h=!0);try{var n=e.texture,k=n.format,f=n.type;1023!==k&&x(k)!==K.getParameter(K.IMPLEMENTATION_COLOR_READ_FORMAT)? -console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.'):1009===f||x(f)===K.getParameter(K.IMPLEMENTATION_COLOR_READ_TYPE)||1015===f&&(aa.get('OES_texture_float')||aa.get('WEBGL_color_buffer_float'))||1016===f&&aa.get('EXT_color_buffer_half_float')?K.checkFramebufferStatus(K.FRAMEBUFFER)===K.FRAMEBUFFER_COMPLETE?0<=a&&a<=e.width-b&&0<=r&&r<=e.height-d&&K.readPixels(a,r,b,d,x(k),x(f),B):console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.'): -console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.')}finally{h&&K.bindFramebuffer(K.FRAMEBUFFER,N)}}}else console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.')}}function Zb(e,a){this.name='';this.color=new Y(e);this.density=void 0!==a?a:2.5E-4}function $b(e,a,b){this.name='';this.color=new Y(e);this.near=void 0!==a?a:1;this.far=void 0!==b?b:1E3}function vd(){ba.call(this); -this.type='Scene';this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function de(e,a,b,d,c){ba.call(this);this.lensFlares=[];this.positionScreen=new n;this.customUpdateCallback=void 0;void 0!==e&&this.add(e,a,b,d,c)}function Ab(e){ha.call(this);this.type='SpriteMaterial';this.color=new Y(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(e)}function Jc(e){ba.call(this);this.type='Sprite';this.material=void 0!==e?e:new Ab}function Kc(){ba.call(this); -this.type='LOD';Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Lc(e,a){e=e||[];this.bones=e.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===a)this.calculateInverses();else if(this.bones.length===a.length)this.boneInverses=a.slice(0);else for(console.warn('THREE.Skeleton boneInverses is the wrong length.'),this.boneInverses=[],e=0,a=this.bones.length;e=e.HAVE_CURRENT_DATA&&(B.needsUpdate=!0)}b.call(this,e,a,d,c,h,n,k,f,q);this.generateMipmaps=!1;var B=this;r()}function bc(e,a,d,c,h,n,k,f,q,g,l,p){b.call(this,null,n,k,f,q,g,c,h,l,p);this.image={width:a,height:d};this.mipmaps=e;this.generateMipmaps=this.flipY=!1}function Nc(e,a,d,c,h,n,k,f,q,g){g=void 0!== -g?g:1026;if(1026!==g&&1027!==g)throw Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');void 0===d&&1026===g&&(d=1012);void 0===d&&1027===g&&(d=1020);b.call(this,null,c,h,n,k,f,g,d,q);this.image={width:e,height:a};this.magFilter=void 0!==k?k:1003;this.minFilter=void 0!==f?f:1003;this.generateMipmaps=this.flipY=!1}function cc(e){da.call(this);this.type='WireframeGeometry';var a=[],b,d,c,h,k=[0,0],f={},q,g,l=['a','b','c'];if(e&&e.isGeometry){var p=e.faces;b=0; -for(c=p.length;bd;d++)q=t[l[d]],g=t[l[(d+1)%3]],k[0]=Math.min(q,g),k[1]=Math.max(q,g),q=k[0]+','+k[1],void 0===f[q]&&(f[q]={index1:k[0],index2:k[1]})}for(q in f)b=f[q],l=e.vertices[b.index1],a.push(l.x,l.y,l.z),l=e.vertices[b.index2],a.push(l.x,l.y,l.z)}else if(e&&e.isBufferGeometry){var m,l=new n;if(null!==e.index){p=e.attributes.position;t=e.index;m=e.groups;0===m.length&&(m=[{start:0,count:t.count,materialIndex:0}]);e=0;for(h=m.length;ed;d++)q=t.getX(b+d),g=t.getX(b+(d+1)%3),k[0]=Math.min(q,g),k[1]=Math.max(q,g),q=k[0]+','+k[1],void 0===f[q]&&(f[q]={index1:k[0],index2:k[1]});for(q in f)b=f[q],l.fromBufferAttribute(p,b.index1),a.push(l.x,l.y,l.z),l.fromBufferAttribute(p,b.index2),a.push(l.x,l.y,l.z)}else for(p=e.attributes.position,b=0,c=p.count/3;bd;d++)f=3*b+d,l.fromBufferAttribute(p,f),a.push(l.x,l.y,l.z),f=3*b+(d+1)%3,l.fromBufferAttribute(p,f),a.push(l.x,l.y,l.z)}this.addAttribute('position', -new W(a,3))}function Oc(e,a,b){aa.call(this);this.type='ParametricGeometry';this.parameters={func:e,slices:a,stacks:b};this.fromBufferGeometry(new dc(e,a,b));this.mergeVertices()}function dc(e,a,b){da.call(this);this.type='ParametricBufferGeometry';this.parameters={func:e,slices:a,stacks:b};var r=[],d=[],c=[],B=[],h=new n,k=new n,f=new n,q=new n,l=new n,g,p,t=a+1;for(g=0;g<=b;g++){var m=g/b;for(p=0;p<=a;p++){var u=p/a,k=e(u,m,k);d.push(k.x,k.y,k.z);0<=u-1E-5?(f=e(u-1E-5,m,f),q.subVectors(k,f)):(f= -e(u+1E-5,m,f),q.subVectors(f,k));0<=m-1E-5?(f=e(u,m-1E-5,f),l.subVectors(k,f)):(f=e(u,m+1E-5,f),l.subVectors(f,k));h.crossVectors(q,l).normalize();c.push(h.x,h.y,h.z);B.push(u,m)}}for(g=0;gb&&1===e.x&&(k[a]=e.x-1);0===r.x&&0===r.z&&(k[a]=b/2/Math.PI+.5)}da.call(this);this.type='PolyhedronBufferGeometry';this.parameters={vertices:e,indices:a,radius:b,detail:d};b=b||1;d=d||0;var h=[],k=[];(function(e){for(var b=new n,d=new n,B=new n,h=0;hd&&(.2>a&&(k[e+0]+=1),.2>r&&(k[e+2]+=1),.2>b&&(k[e+4]+=1))})();this.addAttribute('position',new W(h,3));this.addAttribute('normal',new W(h.slice(),3));this.addAttribute('uv',new W(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Qc(e,a){aa.call(this);this.type='TetrahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new ec(e, -a));this.mergeVertices()}function ec(e,a){Ua.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,a);this.type='TetrahedronBufferGeometry';this.parameters={radius:e,detail:a}}function Rc(e,a){aa.call(this);this.type='OctahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new Eb(e,a));this.mergeVertices()}function Eb(e,a){Ua.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,a);this.type='OctahedronBufferGeometry'; -this.parameters={radius:e,detail:a}}function Sc(e,a){aa.call(this);this.type='IcosahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new fc(e,a));this.mergeVertices()}function fc(e,a){var r=(1+Math.sqrt(5))/2;Ua.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,a);this.type='IcosahedronBufferGeometry'; -this.parameters={radius:e,detail:a}}function Tc(e,a){aa.call(this);this.type='DodecahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new gc(e,a));this.mergeVertices()}function gc(e,a){var r=(1+Math.sqrt(5))/2,b=1/r;Ua.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-b,-r,0,-b,r,0,b,-r,0,b,r,-b,-r,0,-b,r,0,b,-r,0,b,r,0,-r,0,-b,r,0,-b,-r,0,b,r,0,b],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1, -18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,a);this.type='DodecahedronBufferGeometry';this.parameters={radius:e,detail:a}}function Uc(e,a,b,d,c,h){aa.call(this);this.type='TubeGeometry';this.parameters={path:e,tubularSegments:a,radius:b,radialSegments:d,closed:c};void 0!==h&&console.warn('THREE.TubeGeometry: taper has been removed.');e=new hc(e,a,b,d,c);this.tangents=e.tangents; -this.normals=e.normals;this.binormals=e.binormals;this.fromBufferGeometry(e);this.mergeVertices()}function hc(e,a,b,d,c){function r(r){var c=e.getPointAt(r/a),n=B.normals[r];r=B.binormals[r];for(g=0;g<=d;g++){var f=g/d*Math.PI*2,q=Math.sin(f),f=-Math.cos(f);k.x=f*n.x+q*r.x;k.y=f*n.y+q*r.y;k.z=f*n.z+q*r.z;k.normalize();p.push(k.x,k.y,k.z);h.x=c.x+b*k.x;h.y=c.y+b*k.y;h.z=c.z+b*k.z;l.push(h.x,h.y,h.z)}}da.call(this);this.type='TubeBufferGeometry';this.parameters={path:e,tubularSegments:a,radius:b,radialSegments:d, -closed:c};a=a||64;b=b||1;d=d||8;c=c||!1;var B=e.computeFrenetFrames(a,c);this.tangents=B.tangents;this.normals=B.normals;this.binormals=B.binormals;var h=new n,k=new n,f=new m,q,g,l=[],p=[],I=[],t=[];for(q=0;qg;g++)c=l[h[g]],e=l[h[(g+1)%3]],b[0]=Math.min(c,e), -b[1]=Math.max(c,e),c=b[0]+','+b[1],void 0===d[c]?d[c]={index1:b[0],index2:b[1],face1:f,face2:void 0}:d[c].face2=f;for(c in d)if(b=d[c],void 0===b.face2||k[b.face1].normal.dot(k[b.face2].normal)<=a)h=n[b.index1],r.push(h.x,h.y,h.z),h=n[b.index2],r.push(h.x,h.y,h.z);this.addAttribute('position',new W(r,3))}function Gb(e,a,b,d,c,h,k,n){aa.call(this);this.type='CylinderGeometry';this.parameters={radiusTop:e,radiusBottom:a,height:b,radialSegments:d,heightSegments:c,openEnded:h,thetaStart:k,thetaLength:n}; -this.fromBufferGeometry(new vb(e,a,b,d,c,h,k,n));this.mergeVertices()}function vb(e,a,b,d,c,h,k,f){function r(r){var b,c,h,I=new m,w=new n,Q=0,y=!0===r?e:a,A=!0===r?1:-1;c=t;for(b=1;b<=d;b++)l.push(0,u*A,0),g.push(0,A,0),p.push(.5,.5),t++;h=t;for(b=0;b<=d;b++){var wa=b/d*f+k,x=Math.cos(wa),wa=Math.sin(wa);w.x=y*wa;w.y=u*A;w.z=y*x;l.push(w.x,w.y,w.z);g.push(0,A,0);I.x=.5*x+.5;I.y=.5*wa*A+.5;p.push(I.x,I.y);t++}for(b=0;b=ga.maxTextures&&console.warn('THREE.WebGLRenderer: Trying to use '+f+' texture units while this GPU supports only '+ga.maxTextures);ca+=1;return f};this.setTexture2D=function(){var f=!1;return function(a,r){a&&a.isWebGLRenderTarget&&(f||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), +f=!0),a=a.texture);ma.setTexture2D(a,r)}}();this.setTexture=function(){var f=!1;return function(a,r){f||(console.warn('THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead.'),f=!0);ma.setTexture2D(a,r)}}();this.setTextureCube=function(){var f=!1;return function(a,r){a&&a.isWebGLRenderTargetCube&&(f||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),f=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&& +6===a.image.length?ma.setTextureCube(a,r):ma.setTextureCubeDynamic(a,r)}}();this.getRenderTarget=function(){return fa};this.setRenderTarget=function(f){(fa=f)&&void 0===ra.get(f).__webglFramebuffer&&ma.setupRenderTarget(f);var a=f&&f.isWebGLRenderTargetCube,r;f?(r=ra.get(f),r=a?r.__webglFramebuffer[f.activeCubeFace]:r.__webglFramebuffer,pa.copy(f.scissor),Y=f.scissorTest,Fa.copy(f.viewport)):(r=null,pa.copy(fb).multiplyScalar(Ja),Y=ab,Fa.copy(Ia).multiplyScalar(Ja));N!==r&&(K.bindFramebuffer(K.FRAMEBUFFER, +r),N=r);ia.scissor(pa);ia.setScissorTest(Y);ia.viewport(Fa);a&&(a=ra.get(f.texture),K.framebufferTexture2D(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_CUBE_MAP_POSITIVE_X+f.activeCubeFace,a.__webglTexture,f.activeMipMapLevel))};this.readRenderTargetPixels=function(f,a,r,b,d,B){if(f&&f.isWebGLRenderTarget){var c=ra.get(f).__webglFramebuffer;if(c){var h=!1;c!==N&&(K.bindFramebuffer(K.FRAMEBUFFER,c),h=!0);try{var n=f.texture,k=n.format,g=n.type;1023!==k&&x(k)!==K.getParameter(K.IMPLEMENTATION_COLOR_READ_FORMAT)? +console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.'):1009===g||x(g)===K.getParameter(K.IMPLEMENTATION_COLOR_READ_TYPE)||1015===g&&(aa.get('OES_texture_float')||aa.get('WEBGL_color_buffer_float'))||1016===g&&aa.get('EXT_color_buffer_half_float')?K.checkFramebufferStatus(K.FRAMEBUFFER)===K.FRAMEBUFFER_COMPLETE?0<=a&&a<=f.width-b&&0<=r&&r<=f.height-d&&K.readPixels(a,r,b,d,x(k),x(g),B):console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.'): +console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.')}finally{h&&K.bindFramebuffer(K.FRAMEBUFFER,N)}}}else console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.')}}function Zb(f,a){this.name='';this.color=new Y(f);this.density=void 0!==a?a:2.5E-4}function $b(f,a,b){this.name='';this.color=new Y(f);this.near=void 0!==a?a:1;this.far=void 0!==b?b:1E3}function vd(){ba.call(this); +this.type='Scene';this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function de(f,a,b,d,c){ba.call(this);this.lensFlares=[];this.positionScreen=new n;this.customUpdateCallback=void 0;void 0!==f&&this.add(f,a,b,d,c)}function Ab(f){ha.call(this);this.type='SpriteMaterial';this.color=new Y(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(f)}function Jc(f){ba.call(this);this.type='Sprite';this.material=void 0!==f?f:new Ab}function Kc(){ba.call(this); +this.type='LOD';Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Lc(f,a){f=f||[];this.bones=f.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===a)this.calculateInverses();else if(this.bones.length===a.length)this.boneInverses=a.slice(0);else for(console.warn('THREE.Skeleton boneInverses is the wrong length.'),this.boneInverses=[],f=0,a=this.bones.length;f=f.HAVE_CURRENT_DATA&&(B.needsUpdate=!0)}b.call(this,f,a,d,c,h,n,k,g,q);this.generateMipmaps=!1;var B=this;r()}function bc(f,a,d,c,h,n,k,g,q,l,e,p){b.call(this,null,n,k,g,q,l,c,h,e,p);this.image={width:a,height:d};this.mipmaps=f;this.generateMipmaps=this.flipY=!1}function Nc(f,a,d,c,h,n,k,g,q,l){l=void 0!== +l?l:1026;if(1026!==l&&1027!==l)throw Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');void 0===d&&1026===l&&(d=1012);void 0===d&&1027===l&&(d=1020);b.call(this,null,c,h,n,k,g,l,d,q);this.image={width:f,height:a};this.magFilter=void 0!==k?k:1003;this.minFilter=void 0!==g?g:1003;this.generateMipmaps=this.flipY=!1}function cc(f){da.call(this);this.type='WireframeGeometry';var a=[],b,d,c,h,k=[0,0],g={},q,l,e=['a','b','c'];if(f&&f.isGeometry){var p=f.faces;b=0; +for(c=p.length;bd;d++)q=t[e[d]],l=t[e[(d+1)%3]],k[0]=Math.min(q,l),k[1]=Math.max(q,l),q=k[0]+','+k[1],void 0===g[q]&&(g[q]={index1:k[0],index2:k[1]})}for(q in g)b=g[q],e=f.vertices[b.index1],a.push(e.x,e.y,e.z),e=f.vertices[b.index2],a.push(e.x,e.y,e.z)}else if(f&&f.isBufferGeometry){var m,e=new n;if(null!==f.index){p=f.attributes.position;t=f.index;m=f.groups;0===m.length&&(m=[{start:0,count:t.count,materialIndex:0}]);f=0;for(h=m.length;fd;d++)q=t.getX(b+d),l=t.getX(b+(d+1)%3),k[0]=Math.min(q,l),k[1]=Math.max(q,l),q=k[0]+','+k[1],void 0===g[q]&&(g[q]={index1:k[0],index2:k[1]});for(q in g)b=g[q],e.fromBufferAttribute(p,b.index1),a.push(e.x,e.y,e.z),e.fromBufferAttribute(p,b.index2),a.push(e.x,e.y,e.z)}else for(p=f.attributes.position,b=0,c=p.count/3;bd;d++)g=3*b+d,e.fromBufferAttribute(p,g),a.push(e.x,e.y,e.z),g=3*b+(d+1)%3,e.fromBufferAttribute(p,g),a.push(e.x,e.y,e.z)}this.addAttribute('position', +new W(a,3))}function Oc(f,a,b){aa.call(this);this.type='ParametricGeometry';this.parameters={func:f,slices:a,stacks:b};this.fromBufferGeometry(new dc(f,a,b));this.mergeVertices()}function dc(f,a,b){da.call(this);this.type='ParametricBufferGeometry';this.parameters={func:f,slices:a,stacks:b};var r=[],d=[],c=[],B=[],h=new n,k=new n,g=new n,q=new n,l=new n,e,p,t=a+1;for(e=0;e<=b;e++){var m=e/b;for(p=0;p<=a;p++){var u=p/a,k=f(u,m,k);d.push(k.x,k.y,k.z);0<=u-1E-5?(g=f(u-1E-5,m,g),q.subVectors(k,g)):(g= +f(u+1E-5,m,g),q.subVectors(g,k));0<=m-1E-5?(g=f(u,m-1E-5,g),l.subVectors(k,g)):(g=f(u,m+1E-5,g),l.subVectors(g,k));h.crossVectors(q,l).normalize();c.push(h.x,h.y,h.z);B.push(u,m)}}for(e=0;eb&&1===f.x&&(k[a]=f.x-1);0===r.x&&0===r.z&&(k[a]=b/2/Math.PI+.5)}da.call(this);this.type='PolyhedronBufferGeometry';this.parameters={vertices:f,indices:a,radius:b,detail:d};b=b||1;d=d||0;var h=[],k=[];(function(f){for(var b=new n,d=new n,B=new n,h=0;hd&&(.2>a&&(k[f+0]+=1),.2>r&&(k[f+2]+=1),.2>b&&(k[f+4]+=1))})();this.addAttribute('position',new W(h,3));this.addAttribute('normal',new W(h.slice(),3));this.addAttribute('uv',new W(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Qc(f,a){aa.call(this);this.type='TetrahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new ec(f, +a));this.mergeVertices()}function ec(f,a){Ua.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],f,a);this.type='TetrahedronBufferGeometry';this.parameters={radius:f,detail:a}}function Rc(f,a){aa.call(this);this.type='OctahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new Eb(f,a));this.mergeVertices()}function Eb(f,a){Ua.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],f,a);this.type='OctahedronBufferGeometry'; +this.parameters={radius:f,detail:a}}function Sc(f,a){aa.call(this);this.type='IcosahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new fc(f,a));this.mergeVertices()}function fc(f,a){var r=(1+Math.sqrt(5))/2;Ua.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],f,a);this.type='IcosahedronBufferGeometry'; +this.parameters={radius:f,detail:a}}function Tc(f,a){aa.call(this);this.type='DodecahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new gc(f,a));this.mergeVertices()}function gc(f,a){var r=(1+Math.sqrt(5))/2,b=1/r;Ua.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-b,-r,0,-b,r,0,b,-r,0,b,r,-b,-r,0,-b,r,0,b,-r,0,b,r,0,-r,0,-b,r,0,-b,-r,0,b,r,0,b],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1, +18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],f,a);this.type='DodecahedronBufferGeometry';this.parameters={radius:f,detail:a}}function Uc(f,a,b,d,c,h){aa.call(this);this.type='TubeGeometry';this.parameters={path:f,tubularSegments:a,radius:b,radialSegments:d,closed:c};void 0!==h&&console.warn('THREE.TubeGeometry: taper has been removed.');f=new hc(f,a,b,d,c);this.tangents=f.tangents; +this.normals=f.normals;this.binormals=f.binormals;this.fromBufferGeometry(f);this.mergeVertices()}function hc(f,a,b,d,c){function r(r){var c=f.getPointAt(r/a),n=B.normals[r];r=B.binormals[r];for(e=0;e<=d;e++){var g=e/d*Math.PI*2,q=Math.sin(g),g=-Math.cos(g);k.x=g*n.x+q*r.x;k.y=g*n.y+q*r.y;k.z=g*n.z+q*r.z;k.normalize();p.push(k.x,k.y,k.z);h.x=c.x+b*k.x;h.y=c.y+b*k.y;h.z=c.z+b*k.z;l.push(h.x,h.y,h.z)}}da.call(this);this.type='TubeBufferGeometry';this.parameters={path:f,tubularSegments:a,radius:b,radialSegments:d, +closed:c};a=a||64;b=b||1;d=d||8;c=c||!1;var B=f.computeFrenetFrames(a,c);this.tangents=B.tangents;this.normals=B.normals;this.binormals=B.binormals;var h=new n,k=new n,g=new m,q,e,l=[],p=[],I=[],t=[];for(q=0;ql;l++)c=e[h[l]],f=e[h[(l+1)%3]],b[0]=Math.min(c,f), +b[1]=Math.max(c,f),c=b[0]+','+b[1],void 0===d[c]?d[c]={index1:b[0],index2:b[1],face1:g,face2:void 0}:d[c].face2=g;for(c in d)if(b=d[c],void 0===b.face2||k[b.face1].normal.dot(k[b.face2].normal)<=a)h=n[b.index1],r.push(h.x,h.y,h.z),h=n[b.index2],r.push(h.x,h.y,h.z);this.addAttribute('position',new W(r,3))}function Gb(f,a,b,d,c,h,k,n){aa.call(this);this.type='CylinderGeometry';this.parameters={radiusTop:f,radiusBottom:a,height:b,radialSegments:d,heightSegments:c,openEnded:h,thetaStart:k,thetaLength:n}; +this.fromBufferGeometry(new vb(f,a,b,d,c,h,k,n));this.mergeVertices()}function vb(f,a,b,d,c,h,k,g){function r(r){var b,c,h,I=new m,w=new n,Q=0,y=!0===r?f:a,A=!0===r?1:-1;c=t;for(b=1;b<=d;b++)e.push(0,u*A,0),l.push(0,A,0),p.push(.5,.5),t++;h=t;for(b=0;b<=d;b++){var wa=b/d*g+k,x=Math.cos(wa),wa=Math.sin(wa);w.x=y*wa;w.y=u*A;w.z=y*x;e.push(w.x,w.y,w.z);l.push(0,A,0);I.x=.5*x+.5;I.y=.5*wa*A+.5;p.push(I.x,I.y);t++}for(b=0;bthis.duration&&this.resetDuration();this.optimize()}function Pd(e){this.manager=void 0!==e?e:Wa;this.textures={}}function he(e){this.manager=void 0!==e?e:Wa}function vc(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}function ie(e){'boolean'=== -typeof e&&(console.warn('THREE.JSONLoader: showStatus parameter has been removed from constructor.'),e=void 0);this.manager=void 0!==e?e:Wa;this.withCredentials=!1}function Me(e){this.manager=void 0!==e?e:Wa;this.texturePath=''}function Ne(e,a,b,d,c){a=.5*(d-a);c=.5*(c-b);var r=e*e;return(2*b-2*d+a+c)*e*r+(-3*b+3*d-2*a-c)*r+a*e+b}function Pb(e,a,b,d){var r=1-e;return r*r*a+2*(1-e)*e*b+e*e*d}function Qb(e,a,b,d,c){var r=1-e,h=1-e;return r*r*r*a+3*h*h*e*b+3*(1-e)*e*e*d+e*e*e*c}function Pa(){this.arcLengthDivisions= -200}function ub(e,a){this.arcLengthDivisions=200;this.v1=e;this.v2=a}function gd(){this.arcLengthDivisions=200;this.curves=[];this.autoClose=!1}function wb(e,a,b,d,c,h,k,n){this.arcLengthDivisions=200;this.aX=e;this.aY=a;this.xRadius=b;this.yRadius=d;this.aStartAngle=c;this.aEndAngle=h;this.aClockwise=k;this.aRotation=n||0}function Rb(e){this.arcLengthDivisions=200;this.points=void 0===e?[]:e}function wc(e,a,b,d){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b;this.v3=d}function xc(e,a, -b){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b}function hd(e){gd.call(this);this.currentPoint=new m;e&&this.fromPoints(e)}function Sb(){hd.apply(this,arguments);this.holes=[]}function je(){this.subPaths=[];this.currentPath=null}function ke(e){this.data=e}function Oe(e){this.manager=void 0!==e?e:Wa}function le(e){this.manager=void 0!==e?e:Wa}function Pe(){this.type='StereoCamera';this.aspect=1;this.eyeSep=.064;this.cameraL=new xa;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate= -!1;this.cameraR=new xa;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function Qd(e,a,b){ba.call(this);this.type='CubeCamera';var r=new xa(90,1,e,a);r.up.set(0,-1,0);r.lookAt(new n(1,0,0));this.add(r);var d=new xa(90,1,e,a);d.up.set(0,-1,0);d.lookAt(new n(-1,0,0));this.add(d);var h=new xa(90,1,e,a);h.up.set(0,0,1);h.lookAt(new n(0,1,0));this.add(h);var k=new xa(90,1,e,a);k.up.set(0,0,-1);k.lookAt(new n(0,-1,0));this.add(k);var B=new xa(90,1,e,a);B.up.set(0,-1,0);B.lookAt(new n(0,0, -1));this.add(B);var f=new xa(90,1,e,a);f.up.set(0,-1,0);f.lookAt(new n(0,0,-1));this.add(f);this.renderTarget=new c(b,b,{format:1022,magFilter:1006,minFilter:1006});this.renderTarget.texture.name='CubeCamera';this.updateCubeMap=function(e,a){null===this.parent&&this.updateMatrixWorld();var b=this.renderTarget,c=b.texture.generateMipmaps;b.texture.generateMipmaps=!1;b.activeCubeFace=0;e.render(a,r,b);b.activeCubeFace=1;e.render(a,d,b);b.activeCubeFace=2;e.render(a,h,b);b.activeCubeFace=3;e.render(a, -k,b);b.activeCubeFace=4;e.render(a,B,b);b.texture.generateMipmaps=c;b.activeCubeFace=5;e.render(a,f,b);e.setRenderTarget(null)}}function me(){ba.call(this);this.type='AudioListener';this.context=ne.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function yc(e){ba.call(this);this.type='Audio';this.context=e.context;this.gain=this.context.createGain();this.gain.connect(e.getInput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.startTime= -0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType='empty';this.filters=[]}function oe(e){yc.call(this,e);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function pe(e,a){this.analyser=e.context.createAnalyser();this.analyser.fftSize=void 0!==a?a:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);e.getOutput().connect(this.analyser)}function qe(e,a,b){this.binding=e;this.valueSize=b;e=Float64Array;switch(a){case 'quaternion':a=this._slerp; -break;case 'string':case 'bool':e=Array;a=this._select;break;default:a=this._lerp}this.buffer=new e(4*b);this._mixBufferRegion=a;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Qe(e,a,b){b=b||La.parseTrackName(a);this._targetGroup=e;this._bindings=e.subscribe_(a,b)}function La(e,a,b){this.path=a;this.parsedPath=b||La.parseTrackName(a);this.node=La.findNode(e,this.parsedPath.nodeName)||e;this.rootNode=e}function Re(e){this.uuid=ka.generateUUID();this._objects=Array.prototype.slice.call(arguments); -this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,d=arguments.length;b!==d;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var c=this;this.stats={objects:{get total(){return c._objects.length},get inUse(){return this.total-c.nCachedObjects_}},get bindingsPerObject(){return c._bindings.length}}}function Se(e,a,b){this._mixer=e;this._clip=a;this._localRoot=b||null;e=a.tracks;a=e.length;b=Array(a);for(var r={endingStart:2400, -endingEnd:2400},d=0;d!==a;++d){var c=e[d].createInterpolant(null);b[d]=c;c.settings=r}this._interpolantSettings=r;this._interpolants=b;this._propertyBindings=Array(a);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd= -this.zeroSlopeAtStart=!0}function Te(e){this._root=e;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Rd(e,a){'string'===typeof e&&(console.warn('THREE.Uniform: Type parameter is no longer needed.'),e=a);this.value=e}function re(){da.call(this);this.type='InstancedBufferGeometry';this.maxInstancedCount=void 0}function se(e,a,b,d){this.uuid=ka.generateUUID();this.data=e;this.itemSize=a;this.offset=b;this.normalized=!0===d}function zc(e,a){this.uuid=ka.generateUUID(); -this.array=e;this.stride=a;this.count=void 0!==e?e.length/a:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};this.version=0}function te(e,a,b){zc.call(this,e,a);this.meshPerAttribute=b||1}function ue(e,a,b){ga.call(this,e,a);this.meshPerAttribute=b||1}function Ue(e,a,b,d){this.ray=new eb(e,a);this.near=b||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'); -return this.Points}}})}function Ve(e,a){return e.distance-a.distance}function ve(e,a,b,d){if(!1!==e.visible&&(e.raycast(a,b),!0===d)){e=e.children;d=0;for(var r=e.length;dr;r++,b++){var d=r/32*Math.PI*2,c=b/32*Math.PI*2;a.push(Math.cos(d),Math.sin(d),1,Math.cos(c),Math.sin(c),1)}e.addAttribute('position', -new W(a,3));a=new va({fog:!1});this.cone=new sa(e,a);this.add(this.cone);this.update()}function Ze(e){var a=[];e&&e.isBone&&a.push(e);for(var b=0;be.length&&console.warn('THREE.CatmullRomCurve3: Points array needs at least two entries.');this.points=e||[];this.closed=!1}function pd(e,a,b,d){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b;this.v3=d}function qd(e,a,b){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b}function rd(e,a){this.arcLengthDivisions=200;this.v1=e;this.v2=a}function Vd(e,a,b,d,c,h){wb.call(this,e,a, -b,b,d,c,h)}function $e(e){console.warn('THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,e);this.type='catmullrom';this.closed=!0}function af(e){console.warn('THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,e);this.type='catmullrom'}function ye(e){console.warn('THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.');lb.call(this,e);this.type='catmullrom'}void 0===Number.EPSILON&&(Number.EPSILON= -Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(e){return'number'===typeof e&&isFinite(e)&&Math.floor(e)===e});void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:0r;r++)8===r|| -13===r||18===r||23===r?a[r]='-':14===r?a[r]='4':(2>=b&&(b=33554432+16777216*Math.random()|0),d=b&15,b>>=4,a[r]=e[19===r?d&3|8:d]);return a.join('')}}(),clamp:function(e,a,b){return Math.max(a,Math.min(b,e))},euclideanModulo:function(e,a){return(e%a+a)%a},mapLinear:function(e,a,b,d,c){return d+(e-a)*(c-d)/(b-a)},lerp:function(e,a,b){return(1-b)*e+b*a},smoothstep:function(e,a,b){if(e<=a)return 0;if(e>=b)return 1;e=(e-a)/(b-a);return e*e*(3-2*e)},smootherstep:function(e,a,b){if(e<=a)return 0;if(e>=b)return 1; -e=(e-a)/(b-a);return e*e*e*(e*(6*e-15)+10)},randInt:function(e,a){return e+Math.floor(Math.random()*(a-e+1))},randFloat:function(e,a){return e+Math.random()*(a-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*ka.DEG2RAD},radToDeg:function(e){return e*ka.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){e--;e|=e>>1;e|=e>>2;e|=e>>4;e|=e>> -8;e|=e>>16;e++;return e}};Object.defineProperties(m.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}});Object.assign(m.prototype,{isVector2:!0,set:function(e,a){this.x=e;this.y=a;return this},setScalar:function(e){this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setComponent:function(e,a){switch(e){case 0:this.x=a;break;case 1:this.y=a;break;default:throw Error('index is out of range: '+ -e);}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){this.x=e.x;this.y=e.y;return this},add:function(e,a){if(void 0!==a)return console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,a);this.x+=e.x;this.y+=e.y;return this},addScalar:function(e){this.x+=e;this.y+=e;return this}, -addVectors:function(e,a){this.x=e.x+a.x;this.y=e.y+a.y;return this},addScaledVector:function(e,a){this.x+=e.x*a;this.y+=e.y*a;return this},sub:function(e,a){if(void 0!==a)return console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,a);this.x-=e.x;this.y-=e.y;return this},subScalar:function(e){this.x-=e;this.y-=e;return this},subVectors:function(e,a){this.x=e.x-a.x;this.y=e.y-a.y;return this},multiply:function(e){this.x*=e.x;this.y*= -e.y;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;return this},divide:function(e){this.x/=e.x;this.y/=e.y;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);return this},max:function(e){this.x=Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);return this},clamp:function(e,a){this.x=Math.max(e.x,Math.min(a.x,this.x));this.y=Math.max(e.y,Math.min(a.y,this.y));return this},clampScalar:function(){var e= -new m,a=new m;return function(r,b){e.set(r,r);a.set(b,b);return this.clamp(e,a)}}(),clampLength:function(e,a){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(a,r)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x): -Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);0>e&& -(e+=2*Math.PI);return e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var a=this.x-e.x;e=this.y-e.y;return a*a+e*e},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,a){this.x+=(e.x-this.x)*a;this.y+=(e.y-this.y)*a;return this},lerpVectors:function(e,a,b){return this.subVectors(a,e).multiplyScalar(b).add(e)},equals:function(e){return e.x=== -this.x&&e.y===this.y},fromArray:function(e,a){void 0===a&&(a=0);this.x=e[a];this.y=e[a+1];return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this.x;e[a+1]=this.y;return e},fromBufferAttribute:function(e,a,b){void 0!==b&&console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');this.x=e.getX(a);this.y=e.getY(a);return this},rotateAround:function(e,a){var r=Math.cos(a);a=Math.sin(a);var b=this.x-e.x,d=this.y-e.y;this.x=b*r-d*a+e.x;this.y=b*a+d*r+e.y; -return this}});var ef=0;b.DEFAULT_IMAGE=void 0;b.DEFAULT_MAPPING=300;Object.defineProperty(b.prototype,'needsUpdate',{set:function(e){!0===e&&this.version++}});Object.assign(b.prototype,g.prototype,{constructor:b,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name;this.image=e.image;this.mipmaps=e.mipmaps.slice(0);this.mapping=e.mapping;this.wrapS=e.wrapS;this.wrapT=e.wrapT;this.magFilter=e.magFilter;this.minFilter=e.minFilter;this.anisotropy=e.anisotropy; -this.format=e.format;this.type=e.type;this.offset.copy(e.offset);this.repeat.copy(e.repeat);this.generateMipmaps=e.generateMipmaps;this.premultiplyAlpha=e.premultiplyAlpha;this.flipY=e.flipY;this.unpackAlignment=e.unpackAlignment;this.encoding=e.encoding;return this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var a={metadata:{version:4.5,type:'Texture',generator:'Texture.toJSON'},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y], -offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var b=this.image;void 0===b.uuid&&(b.uuid=ka.generateUUID());if(void 0===e.images[b.uuid]){var d=e.images,c=b.uuid,h=b.uuid,k;void 0!==b.toDataURL?k=b:(k=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'),k.width=b.width,k.height=b.height,k.getContext('2d').drawImage(b,0,0,b.width,b.height));k=2048e.x||1e.x?0:1;break;case 1002:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(0>e.y||1e.y?0:1;break;case 1002:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}});Object.assign(l.prototype,{isVector4:!0,set:function(e,a,b,d){this.x=e;this.y=a;this.z=b;this.w=d;return this},setScalar:function(e){this.w=this.z=this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setW:function(e){this.w=e;return this},setComponent:function(e, -a){switch(e){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;case 3:this.w=a;break;default:throw Error('index is out of range: '+e);}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;this.w=void 0!==e.w?e.w:1;return this},add:function(e, -a){if(void 0!==a)return console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,a);this.x+=e.x;this.y+=e.y;this.z+=e.z;this.w+=e.w;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;this.w+=e;return this},addVectors:function(e,a){this.x=e.x+a.x;this.y=e.y+a.y;this.z=e.z+a.z;this.w=e.w+a.w;return this},addScaledVector:function(e,a){this.x+=e.x*a;this.y+=e.y*a;this.z+=e.z*a;this.w+=e.w*a;return this},sub:function(e,a){if(void 0!== -a)return console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,a);this.x-=e.x;this.y-=e.y;this.z-=e.z;this.w-=e.w;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;this.w-=e;return this},subVectors:function(e,a){this.x=e.x-a.x;this.y=e.y-a.y;this.z=e.z-a.z;this.w=e.w-a.w;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;this.w*=e;return this},applyMatrix4:function(e){var a=this.x,b=this.y,d=this.z, -c=this.w;e=e.elements;this.x=e[0]*a+e[4]*b+e[8]*d+e[12]*c;this.y=e[1]*a+e[5]*b+e[9]*d+e[13]*c;this.z=e[2]*a+e[6]*b+e[10]*d+e[14]*c;this.w=e[3]*a+e[7]*b+e[11]*d+e[15]*c;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var a=Math.sqrt(1-e.w*e.w);1E-4>a?(this.x=1,this.z=this.y=0):(this.x=e.x/a,this.y=e.y/a,this.z=e.z/a);return this},setAxisAngleFromRotationMatrix:function(e){var a,b,d;e=e.elements;var c=e[0];d=e[4]; -var h=e[8],k=e[1],n=e[5],f=e[9];b=e[2];a=e[6];var q=e[10];if(.01>Math.abs(d-k)&&.01>Math.abs(h-b)&&.01>Math.abs(f-a)){if(.1>Math.abs(d+k)&&.1>Math.abs(h+b)&&.1>Math.abs(f+a)&&.1>Math.abs(c+n+q-3))return this.set(1,0,0,0),this;e=Math.PI;c=(c+1)/2;n=(n+1)/2;q=(q+1)/2;d=(d+k)/4;h=(h+b)/4;f=(f+a)/4;c>n&&c>q?.01>c?(a=0,d=b=.707106781):(a=Math.sqrt(c),b=d/a,d=h/a):n>q?.01>n?(a=.707106781,b=0,d=.707106781):(b=Math.sqrt(n),a=d/b,d=f/b):.01>q?(b=a=.707106781,d=0):(d=Math.sqrt(q),a=h/d,b=f/d);this.set(a,b, -d,e);return this}e=Math.sqrt((a-f)*(a-f)+(h-b)*(h-b)+(k-d)*(k-d));.001>Math.abs(e)&&(e=1);this.x=(a-f)/e;this.y=(h-b)/e;this.z=(k-d)/e;this.w=Math.acos((c+n+q-1)/2);return this},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);this.z=Math.min(this.z,e.z);this.w=Math.min(this.w,e.w);return this},max:function(e){this.x=Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);this.z=Math.max(this.z,e.z);this.w=Math.max(this.w,e.w);return this},clamp:function(e,a){this.x=Math.max(e.x,Math.min(a.x, -this.x));this.y=Math.max(e.y,Math.min(a.y,this.y));this.z=Math.max(e.z,Math.min(a.z,this.z));this.w=Math.max(e.w,Math.min(a.w,this.w));return this},clampScalar:function(){var e,a;return function(b,r){void 0===e&&(e=new l,a=new l);e.set(b,b,b,b);a.set(r,r,r,r);return this.clamp(e,a)}}(),clampLength:function(e,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(e,Math.min(a,b)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z); +this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap='round';this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(f)}function Ib(f){jb.call(this);this.defines={TOON:''};this.type='MeshToonMaterial';this.gradientMap=null;this.setValues(f)}function Jb(f){ha.call(this);this.type='MeshNormalMaterial';this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new m(1,1);this.displacementMap=null;this.displacementScale= +1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.lights=this.fog=!1;this.setValues(f)}function Kb(f){ha.call(this);this.type='MeshLambertMaterial';this.color=new Y(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new Y(0);this.emissiveIntensity=1;this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio= +.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap='round';this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(f)}function Lb(f){ha.call(this);this.type='LineDashedMaterial';this.color=new Y(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.lights=!1;this.setValues(f)}function ee(f,a,b){var r=this,d=!1,c=0,h=0;this.onStart=void 0;this.onLoad=f;this.onProgress=a;this.onError=b;this.itemStart=function(f){h++;if(!1===d&& +void 0!==r.onStart)r.onStart(f,c,h);d=!0};this.itemEnd=function(f){c++;if(void 0!==r.onProgress)r.onProgress(f,c,h);if(c===h&&(d=!1,void 0!==r.onLoad))r.onLoad()};this.itemError=function(f){if(void 0!==r.onError)r.onError(f)}}function kb(f){this.manager=void 0!==f?f:Wa}function Le(f){this.manager=void 0!==f?f:Wa;this._parser=null}function fe(f){this.manager=void 0!==f?f:Wa;this._parser=null}function dd(f){this.manager=void 0!==f?f:Wa}function ge(f){this.manager=void 0!==f?f:Wa}function Ad(f){this.manager= +void 0!==f?f:Wa}function za(f,a){ba.call(this);this.type='Light';this.color=new Y(f);this.intensity=void 0!==a?a:1;this.receiveShadow=void 0}function Bd(f,a,b){za.call(this,f,b);this.type='HemisphereLight';this.castShadow=void 0;this.position.copy(ba.DefaultUp);this.updateMatrix();this.groundColor=new Y(a)}function Mb(f){this.camera=f;this.bias=0;this.radius=1;this.mapSize=new m(512,512);this.map=null;this.matrix=new p}function Cd(){Mb.call(this,new xa(50,1,.5,500))}function Dd(f,a,b,d,c,h){za.call(this, +f,a);this.type='SpotLight';this.position.copy(ba.DefaultUp);this.updateMatrix();this.target=new ba;Object.defineProperty(this,'power',{get:function(){return this.intensity*Math.PI},set:function(f){this.intensity=f/Math.PI}});this.distance=void 0!==b?b:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==c?c:0;this.decay=void 0!==h?h:1;this.shadow=new Cd}function Ed(f,a,b,d){za.call(this,f,a);this.type='PointLight';Object.defineProperty(this,'power',{get:function(){return 4*this.intensity*Math.PI}, +set:function(f){this.intensity=f/(4*Math.PI)}});this.distance=void 0!==b?b:0;this.decay=void 0!==d?d:1;this.shadow=new Mb(new xa(90,1,.5,500))}function Fd(){Mb.call(this,new Qa(-5,5,5,-5,.5,500))}function Gd(f,a){za.call(this,f,a);this.type='DirectionalLight';this.position.copy(ba.DefaultUp);this.updateMatrix();this.target=new ba;this.shadow=new Fd}function Hd(f,a){za.call(this,f,a);this.type='AmbientLight';this.castShadow=void 0}function Id(f,a,b,d){za.call(this,f,a);this.type='RectAreaLight';this.position.set(0, +1,0);this.updateMatrix();this.width=void 0!==b?b:10;this.height=void 0!==d?d:10}function Xa(f,a,b,d){this.parameterPositions=f;this._cachedIndex=0;this.resultBuffer=void 0!==d?d:new a.constructor(b);this.sampleValues=a;this.valueSize=b}function Jd(f,a,b,d){Xa.call(this,f,a,b,d);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function ed(f,a,b,d){Xa.call(this,f,a,b,d)}function Kd(f,a,b,d){Xa.call(this,f,a,b,d)}function Nb(f,a,b,d){if(void 0===f)throw Error('track name is undefined'); +if(void 0===a||0===a.length)throw Error('no keyframes in track named '+f);this.name=f;this.times=Ka.convertArray(a,this.TimeBufferType);this.values=Ka.convertArray(b,this.ValueBufferType);this.setInterpolation(d||this.DefaultInterpolation);this.validate();this.optimize()}function tc(f,a,b,d){Nb.call(this,f,a,b,d)}function Ld(f,a,b,d){Xa.call(this,f,a,b,d)}function fd(f,a,b,d){Nb.call(this,f,a,b,d)}function uc(f,a,b,d){Nb.call(this,f,a,b,d)}function Md(f,a,b,d){Nb.call(this,f,a,b,d)}function Nd(f, +a,b){Nb.call(this,f,a,b)}function Od(f,a,b,d){Nb.call(this,f,a,b,d)}function Ob(f,a,b,d){Nb.apply(this,arguments)}function bb(f,a,b){this.name=f;this.tracks=b;this.duration=void 0!==a?a:-1;this.uuid=ka.generateUUID();0>this.duration&&this.resetDuration();this.optimize()}function Pd(f){this.manager=void 0!==f?f:Wa;this.textures={}}function he(f){this.manager=void 0!==f?f:Wa}function vc(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}function ie(f){'boolean'=== +typeof f&&(console.warn('THREE.JSONLoader: showStatus parameter has been removed from constructor.'),f=void 0);this.manager=void 0!==f?f:Wa;this.withCredentials=!1}function Me(f){this.manager=void 0!==f?f:Wa;this.texturePath=''}function Ne(f,a,b,d,c){a=.5*(d-a);c=.5*(c-b);var r=f*f;return(2*b-2*d+a+c)*f*r+(-3*b+3*d-2*a-c)*r+a*f+b}function Pb(f,a,b,d){var r=1-f;return r*r*a+2*(1-f)*f*b+f*f*d}function Qb(f,a,b,d,c){var r=1-f,h=1-f;return r*r*r*a+3*h*h*f*b+3*(1-f)*f*f*d+f*f*f*c}function Pa(){this.arcLengthDivisions= +200}function ub(f,a){this.arcLengthDivisions=200;this.v1=f;this.v2=a}function gd(){this.arcLengthDivisions=200;this.curves=[];this.autoClose=!1}function wb(f,a,b,d,c,h,k,n){this.arcLengthDivisions=200;this.aX=f;this.aY=a;this.xRadius=b;this.yRadius=d;this.aStartAngle=c;this.aEndAngle=h;this.aClockwise=k;this.aRotation=n||0}function Rb(f){this.arcLengthDivisions=200;this.points=void 0===f?[]:f}function wc(f,a,b,d){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b;this.v3=d}function xc(f,a, +b){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b}function hd(f){gd.call(this);this.currentPoint=new m;f&&this.fromPoints(f)}function Sb(){hd.apply(this,arguments);this.holes=[]}function je(){this.subPaths=[];this.currentPath=null}function ke(f){this.data=f}function Oe(f){this.manager=void 0!==f?f:Wa}function le(f){this.manager=void 0!==f?f:Wa}function Pe(){this.type='StereoCamera';this.aspect=1;this.eyeSep=.064;this.cameraL=new xa;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate= +!1;this.cameraR=new xa;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function Qd(f,a,b){ba.call(this);this.type='CubeCamera';var r=new xa(90,1,f,a);r.up.set(0,-1,0);r.lookAt(new n(1,0,0));this.add(r);var d=new xa(90,1,f,a);d.up.set(0,-1,0);d.lookAt(new n(-1,0,0));this.add(d);var h=new xa(90,1,f,a);h.up.set(0,0,1);h.lookAt(new n(0,1,0));this.add(h);var k=new xa(90,1,f,a);k.up.set(0,0,-1);k.lookAt(new n(0,-1,0));this.add(k);var B=new xa(90,1,f,a);B.up.set(0,-1,0);B.lookAt(new n(0,0, +1));this.add(B);var g=new xa(90,1,f,a);g.up.set(0,-1,0);g.lookAt(new n(0,0,-1));this.add(g);this.renderTarget=new c(b,b,{format:1022,magFilter:1006,minFilter:1006});this.renderTarget.texture.name='CubeCamera';this.updateCubeMap=function(f,a){null===this.parent&&this.updateMatrixWorld();var b=this.renderTarget,c=b.texture.generateMipmaps;b.texture.generateMipmaps=!1;b.activeCubeFace=0;f.render(a,r,b);b.activeCubeFace=1;f.render(a,d,b);b.activeCubeFace=2;f.render(a,h,b);b.activeCubeFace=3;f.render(a, +k,b);b.activeCubeFace=4;f.render(a,B,b);b.texture.generateMipmaps=c;b.activeCubeFace=5;f.render(a,g,b);f.setRenderTarget(null)}}function me(){ba.call(this);this.type='AudioListener';this.context=ne.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function yc(f){ba.call(this);this.type='Audio';this.context=f.context;this.gain=this.context.createGain();this.gain.connect(f.getInput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.startTime= +0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType='empty';this.filters=[]}function oe(f){yc.call(this,f);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function pe(f,a){this.analyser=f.context.createAnalyser();this.analyser.fftSize=void 0!==a?a:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);f.getOutput().connect(this.analyser)}function qe(f,a,b){this.binding=f;this.valueSize=b;f=Float64Array;switch(a){case 'quaternion':a=this._slerp; +break;case 'string':case 'bool':f=Array;a=this._select;break;default:a=this._lerp}this.buffer=new f(4*b);this._mixBufferRegion=a;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Qe(f,a,b){b=b||La.parseTrackName(a);this._targetGroup=f;this._bindings=f.subscribe_(a,b)}function La(f,a,b){this.path=a;this.parsedPath=b||La.parseTrackName(a);this.node=La.findNode(f,this.parsedPath.nodeName)||f;this.rootNode=f}function Re(f){this.uuid=ka.generateUUID();this._objects=Array.prototype.slice.call(arguments); +this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,d=arguments.length;b!==d;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var c=this;this.stats={objects:{get total(){return c._objects.length},get inUse(){return this.total-c.nCachedObjects_}},get bindingsPerObject(){return c._bindings.length}}}function Se(f,a,b){this._mixer=f;this._clip=a;this._localRoot=b||null;f=a.tracks;a=f.length;b=Array(a);for(var r={endingStart:2400, +endingEnd:2400},d=0;d!==a;++d){var c=f[d].createInterpolant(null);b[d]=c;c.settings=r}this._interpolantSettings=r;this._interpolants=b;this._propertyBindings=Array(a);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd= +this.zeroSlopeAtStart=!0}function Te(f){this._root=f;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Rd(f,a){'string'===typeof f&&(console.warn('THREE.Uniform: Type parameter is no longer needed.'),f=a);this.value=f}function re(){da.call(this);this.type='InstancedBufferGeometry';this.maxInstancedCount=void 0}function se(f,a,b,d){this.uuid=ka.generateUUID();this.data=f;this.itemSize=a;this.offset=b;this.normalized=!0===d}function zc(f,a){this.uuid=ka.generateUUID(); +this.array=f;this.stride=a;this.count=void 0!==f?f.length/a:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};this.version=0}function te(f,a,b){zc.call(this,f,a);this.meshPerAttribute=b||1}function ue(f,a,b){ga.call(this,f,a);this.meshPerAttribute=b||1}function Ue(f,a,b,d){this.ray=new eb(f,a);this.near=b||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'); +return this.Points}}})}function Ve(f,a){return f.distance-a.distance}function ve(f,a,b,d){if(!1!==f.visible&&(f.raycast(a,b),!0===d)){f=f.children;d=0;for(var r=f.length;dr;r++,b++){var d=r/32*Math.PI*2,c=b/32*Math.PI*2;a.push(Math.cos(d),Math.sin(d),1,Math.cos(c),Math.sin(c),1)}f.addAttribute('position', +new W(a,3));a=new va({fog:!1});this.cone=new sa(f,a);this.add(this.cone);this.update()}function Ze(f){var a=[];f&&f.isBone&&a.push(f);for(var b=0;bf.length&&console.warn('THREE.CatmullRomCurve3: Points array needs at least two entries.');this.points=f||[];this.closed=!1}function pd(f,a,b,d){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b;this.v3=d}function qd(f,a,b){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b}function rd(f,a){this.arcLengthDivisions=200;this.v1=f;this.v2=a}function Vd(f,a,b,d,c,h){wb.call(this,f,a, +b,b,d,c,h)}function $e(f){console.warn('THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,f);this.type='catmullrom';this.closed=!0}function af(f){console.warn('THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,f);this.type='catmullrom'}function ye(f){console.warn('THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.');lb.call(this,f);this.type='catmullrom'}void 0===Number.EPSILON&&(Number.EPSILON= +Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(f){return'number'===typeof f&&isFinite(f)&&Math.floor(f)===f});void 0===Math.sign&&(Math.sign=function(f){return 0>f?-1:0r;r++)8===r|| +13===r||18===r||23===r?a[r]='-':14===r?a[r]='4':(2>=b&&(b=33554432+16777216*Math.random()|0),d=b&15,b>>=4,a[r]=f[19===r?d&3|8:d]);return a.join('')}}(),clamp:function(f,a,b){return Math.max(a,Math.min(b,f))},euclideanModulo:function(f,a){return(f%a+a)%a},mapLinear:function(f,a,b,d,c){return d+(f-a)*(c-d)/(b-a)},lerp:function(f,a,b){return(1-b)*f+b*a},smoothstep:function(f,a,b){if(f<=a)return 0;if(f>=b)return 1;f=(f-a)/(b-a);return f*f*(3-2*f)},smootherstep:function(f,a,b){if(f<=a)return 0;if(f>=b)return 1; +f=(f-a)/(b-a);return f*f*f*(f*(6*f-15)+10)},randInt:function(f,a){return f+Math.floor(Math.random()*(a-f+1))},randFloat:function(f,a){return f+Math.random()*(a-f)},randFloatSpread:function(f){return f*(.5-Math.random())},degToRad:function(f){return f*ka.DEG2RAD},radToDeg:function(f){return f*ka.RAD2DEG},isPowerOfTwo:function(f){return 0===(f&f-1)&&0!==f},nearestPowerOfTwo:function(f){return Math.pow(2,Math.round(Math.log(f)/Math.LN2))},nextPowerOfTwo:function(f){f--;f|=f>>1;f|=f>>2;f|=f>>4;f|=f>> +8;f|=f>>16;f++;return f}};Object.defineProperties(m.prototype,{width:{get:function(){return this.x},set:function(f){this.x=f}},height:{get:function(){return this.y},set:function(f){this.y=f}}});Object.assign(m.prototype,{isVector2:!0,set:function(f,a){this.x=f;this.y=a;return this},setScalar:function(f){this.y=this.x=f;return this},setX:function(f){this.x=f;return this},setY:function(f){this.y=f;return this},setComponent:function(f,a){switch(f){case 0:this.x=a;break;case 1:this.y=a;break;default:throw Error('index is out of range: '+ +f);}return this},getComponent:function(f){switch(f){case 0:return this.x;case 1:return this.y;default:throw Error('index is out of range: '+f);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(f){this.x=f.x;this.y=f.y;return this},add:function(f,a){if(void 0!==a)return console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(f,a);this.x+=f.x;this.y+=f.y;return this},addScalar:function(f){this.x+=f;this.y+=f;return this}, +addVectors:function(f,a){this.x=f.x+a.x;this.y=f.y+a.y;return this},addScaledVector:function(f,a){this.x+=f.x*a;this.y+=f.y*a;return this},sub:function(f,a){if(void 0!==a)return console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(f,a);this.x-=f.x;this.y-=f.y;return this},subScalar:function(f){this.x-=f;this.y-=f;return this},subVectors:function(f,a){this.x=f.x-a.x;this.y=f.y-a.y;return this},multiply:function(f){this.x*=f.x;this.y*= +f.y;return this},multiplyScalar:function(f){this.x*=f;this.y*=f;return this},divide:function(f){this.x/=f.x;this.y/=f.y;return this},divideScalar:function(f){return this.multiplyScalar(1/f)},min:function(f){this.x=Math.min(this.x,f.x);this.y=Math.min(this.y,f.y);return this},max:function(f){this.x=Math.max(this.x,f.x);this.y=Math.max(this.y,f.y);return this},clamp:function(f,a){this.x=Math.max(f.x,Math.min(a.x,this.x));this.y=Math.max(f.y,Math.min(a.y,this.y));return this},clampScalar:function(){var f= +new m,a=new m;return function(r,b){f.set(r,r);a.set(b,b);return this.clamp(f,a)}}(),clampLength:function(f,a){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(f,Math.min(a,r)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x): +Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(f){return this.x*f.x+this.y*f.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var f=Math.atan2(this.y,this.x);0>f&& +(f+=2*Math.PI);return f},distanceTo:function(f){return Math.sqrt(this.distanceToSquared(f))},distanceToSquared:function(f){var a=this.x-f.x;f=this.y-f.y;return a*a+f*f},distanceToManhattan:function(f){return Math.abs(this.x-f.x)+Math.abs(this.y-f.y)},setLength:function(f){return this.normalize().multiplyScalar(f)},lerp:function(f,a){this.x+=(f.x-this.x)*a;this.y+=(f.y-this.y)*a;return this},lerpVectors:function(f,a,b){return this.subVectors(a,f).multiplyScalar(b).add(f)},equals:function(f){return f.x=== +this.x&&f.y===this.y},fromArray:function(f,a){void 0===a&&(a=0);this.x=f[a];this.y=f[a+1];return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this.x;f[a+1]=this.y;return f},fromBufferAttribute:function(f,a,b){void 0!==b&&console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');this.x=f.getX(a);this.y=f.getY(a);return this},rotateAround:function(f,a){var r=Math.cos(a);a=Math.sin(a);var b=this.x-f.x,d=this.y-f.y;this.x=b*r-d*a+f.x;this.y=b*a+d*r+f.y; +return this}});var ef=0;b.DEFAULT_IMAGE=void 0;b.DEFAULT_MAPPING=300;Object.defineProperty(b.prototype,'needsUpdate',{set:function(f){!0===f&&this.version++}});Object.assign(b.prototype,e.prototype,{constructor:b,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(f){this.name=f.name;this.image=f.image;this.mipmaps=f.mipmaps.slice(0);this.mapping=f.mapping;this.wrapS=f.wrapS;this.wrapT=f.wrapT;this.magFilter=f.magFilter;this.minFilter=f.minFilter;this.anisotropy=f.anisotropy; +this.format=f.format;this.type=f.type;this.offset.copy(f.offset);this.repeat.copy(f.repeat);this.generateMipmaps=f.generateMipmaps;this.premultiplyAlpha=f.premultiplyAlpha;this.flipY=f.flipY;this.unpackAlignment=f.unpackAlignment;this.encoding=f.encoding;return this},toJSON:function(f){if(void 0!==f.textures[this.uuid])return f.textures[this.uuid];var a={metadata:{version:4.5,type:'Texture',generator:'Texture.toJSON'},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y], +offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var b=this.image;void 0===b.uuid&&(b.uuid=ka.generateUUID());if(void 0===f.images[b.uuid]){var d=f.images,c=b.uuid,h=b.uuid,k;void 0!==b.toDataURL?k=b:(k=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'),k.width=b.width,k.height=b.height,k.getContext('2d').drawImage(b,0,0,b.width,b.height));k=2048f.x||1f.x?0:1;break;case 1002:f.x=1===Math.abs(Math.floor(f.x)%2)?Math.ceil(f.x)-f.x:f.x-Math.floor(f.x)}if(0>f.y||1f.y?0:1;break;case 1002:f.y=1===Math.abs(Math.floor(f.y)%2)?Math.ceil(f.y)-f.y:f.y-Math.floor(f.y)}this.flipY&&(f.y=1-f.y)}}});Object.assign(l.prototype,{isVector4:!0,set:function(f,a,b,d){this.x=f;this.y=a;this.z=b;this.w=d;return this},setScalar:function(f){this.w=this.z=this.y=this.x=f;return this},setX:function(f){this.x=f;return this},setY:function(f){this.y=f;return this},setZ:function(f){this.z=f;return this},setW:function(f){this.w=f;return this},setComponent:function(f, +a){switch(f){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;case 3:this.w=a;break;default:throw Error('index is out of range: '+f);}return this},getComponent:function(f){switch(f){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error('index is out of range: '+f);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(f){this.x=f.x;this.y=f.y;this.z=f.z;this.w=void 0!==f.w?f.w:1;return this},add:function(f, +a){if(void 0!==a)return console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(f,a);this.x+=f.x;this.y+=f.y;this.z+=f.z;this.w+=f.w;return this},addScalar:function(f){this.x+=f;this.y+=f;this.z+=f;this.w+=f;return this},addVectors:function(f,a){this.x=f.x+a.x;this.y=f.y+a.y;this.z=f.z+a.z;this.w=f.w+a.w;return this},addScaledVector:function(f,a){this.x+=f.x*a;this.y+=f.y*a;this.z+=f.z*a;this.w+=f.w*a;return this},sub:function(f,a){if(void 0!== +a)return console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(f,a);this.x-=f.x;this.y-=f.y;this.z-=f.z;this.w-=f.w;return this},subScalar:function(f){this.x-=f;this.y-=f;this.z-=f;this.w-=f;return this},subVectors:function(f,a){this.x=f.x-a.x;this.y=f.y-a.y;this.z=f.z-a.z;this.w=f.w-a.w;return this},multiplyScalar:function(f){this.x*=f;this.y*=f;this.z*=f;this.w*=f;return this},applyMatrix4:function(f){var a=this.x,b=this.y,d=this.z, +c=this.w;f=f.elements;this.x=f[0]*a+f[4]*b+f[8]*d+f[12]*c;this.y=f[1]*a+f[5]*b+f[9]*d+f[13]*c;this.z=f[2]*a+f[6]*b+f[10]*d+f[14]*c;this.w=f[3]*a+f[7]*b+f[11]*d+f[15]*c;return this},divideScalar:function(f){return this.multiplyScalar(1/f)},setAxisAngleFromQuaternion:function(f){this.w=2*Math.acos(f.w);var a=Math.sqrt(1-f.w*f.w);1E-4>a?(this.x=1,this.z=this.y=0):(this.x=f.x/a,this.y=f.y/a,this.z=f.z/a);return this},setAxisAngleFromRotationMatrix:function(f){var a,b,d;f=f.elements;var c=f[0];d=f[4]; +var h=f[8],k=f[1],n=f[5],g=f[9];b=f[2];a=f[6];var q=f[10];if(.01>Math.abs(d-k)&&.01>Math.abs(h-b)&&.01>Math.abs(g-a)){if(.1>Math.abs(d+k)&&.1>Math.abs(h+b)&&.1>Math.abs(g+a)&&.1>Math.abs(c+n+q-3))return this.set(1,0,0,0),this;f=Math.PI;c=(c+1)/2;n=(n+1)/2;q=(q+1)/2;d=(d+k)/4;h=(h+b)/4;g=(g+a)/4;c>n&&c>q?.01>c?(a=0,d=b=.707106781):(a=Math.sqrt(c),b=d/a,d=h/a):n>q?.01>n?(a=.707106781,b=0,d=.707106781):(b=Math.sqrt(n),a=d/b,d=g/b):.01>q?(b=a=.707106781,d=0):(d=Math.sqrt(q),a=h/d,b=g/d);this.set(a,b, +d,f);return this}f=Math.sqrt((a-g)*(a-g)+(h-b)*(h-b)+(k-d)*(k-d));.001>Math.abs(f)&&(f=1);this.x=(a-g)/f;this.y=(h-b)/f;this.z=(k-d)/f;this.w=Math.acos((c+n+q-1)/2);return this},min:function(f){this.x=Math.min(this.x,f.x);this.y=Math.min(this.y,f.y);this.z=Math.min(this.z,f.z);this.w=Math.min(this.w,f.w);return this},max:function(f){this.x=Math.max(this.x,f.x);this.y=Math.max(this.y,f.y);this.z=Math.max(this.z,f.z);this.w=Math.max(this.w,f.w);return this},clamp:function(f,a){this.x=Math.max(f.x,Math.min(a.x, +this.x));this.y=Math.max(f.y,Math.min(a.y,this.y));this.z=Math.max(f.z,Math.min(a.z,this.z));this.w=Math.max(f.w,Math.min(a.w,this.w));return this},clampScalar:function(){var f,a;return function(b,r){void 0===f&&(f=new l,a=new l);f.set(b,b,b,b);a.set(r,r,r,r);return this.clamp(f,a)}}(),clampLength:function(f,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(f,Math.min(a,b)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z); this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w): -Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()|| -1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,a){this.x+=(e.x-this.x)*a;this.y+=(e.y-this.y)*a;this.z+=(e.z-this.z)*a;this.w+=(e.w-this.w)*a;return this},lerpVectors:function(e,a,b){return this.subVectors(a,e).multiplyScalar(b).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,a){void 0===a&&(a=0);this.x=e[a];this.y=e[a+1];this.z=e[a+2];this.w=e[a+3];return this},toArray:function(e,a){void 0===e&&(e= -[]);void 0===a&&(a=0);e[a]=this.x;e[a+1]=this.y;e[a+2]=this.z;e[a+3]=this.w;return e},fromBufferAttribute:function(e,a,b){void 0!==b&&console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');this.x=e.getX(a);this.y=e.getY(a);this.z=e.getZ(a);this.w=e.getW(a);return this}});Object.assign(f.prototype,g.prototype,{isWebGLRenderTarget:!0,setSize:function(e,a){if(this.width!==e||this.height!==a)this.width=e,this.height=a,this.dispose();this.viewport.set(0,0,e,a);this.scissor.set(0, -0,e,a)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.width=e.width;this.height=e.height;this.viewport.copy(e.viewport);this.texture=e.texture.clone();this.depthBuffer=e.depthBuffer;this.stencilBuffer=e.stencilBuffer;this.depthTexture=e.depthTexture;return this},dispose:function(){this.dispatchEvent({type:'dispose'})}});c.prototype=Object.create(f.prototype);c.prototype.constructor=c;c.prototype.isWebGLRenderTargetCube=!0;Object.assign(k,{slerp:function(e,a,b,d){return b.copy(e).slerp(a, -d)},slerpFlat:function(e,a,b,d,c,h,k){var r=b[d+0],f=b[d+1],n=b[d+2];b=b[d+3];d=c[h+0];var q=c[h+1],l=c[h+2];c=c[h+3];if(b!==c||r!==d||f!==q||n!==l){h=1-k;var g=r*d+f*q+n*l+b*c,B=0<=g?1:-1,p=1-g*g;p>Number.EPSILON&&(p=Math.sqrt(p),g=Math.atan2(p,g*B),h=Math.sin(h*g)/p,k=Math.sin(k*g)/p);B*=k;r=r*h+d*B;f=f*h+q*B;n=n*h+l*B;b=b*h+c*B;h===1-k&&(k=1/Math.sqrt(r*r+f*f+n*n+b*b),r*=k,f*=k,n*=k,b*=k)}e[a]=r;e[a+1]=f;e[a+2]=n;e[a+3]=b}});Object.defineProperties(k.prototype,{x:{get:function(){return this._x}, -set:function(e){this._x=e;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e;this.onChangeCallback()}}});Object.assign(k.prototype,{set:function(e,a,b,d){this._x=e;this._y=a;this._z=b;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z, -this._w)},copy:function(e){this._x=e.x;this._y=e.y;this._z=e.z;this._w=e.w;this.onChangeCallback();return this},setFromEuler:function(e,a){if(!e||!e.isEuler)throw Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var b=e._x,r=e._y,d=e._z;e=e.order;var c=Math.cos,h=Math.sin,k=c(b/2),f=c(r/2),c=c(d/2),b=h(b/2),r=h(r/2),d=h(d/2);'XYZ'===e?(this._x=b*f*c+k*r*d,this._y=k*r*c-b*f*d,this._z=k*f*d+b*r*c,this._w=k*f*c-b*r*d):'YXZ'===e?(this._x=b*f*c+ -k*r*d,this._y=k*r*c-b*f*d,this._z=k*f*d-b*r*c,this._w=k*f*c+b*r*d):'ZXY'===e?(this._x=b*f*c-k*r*d,this._y=k*r*c+b*f*d,this._z=k*f*d+b*r*c,this._w=k*f*c-b*r*d):'ZYX'===e?(this._x=b*f*c-k*r*d,this._y=k*r*c+b*f*d,this._z=k*f*d-b*r*c,this._w=k*f*c+b*r*d):'YZX'===e?(this._x=b*f*c+k*r*d,this._y=k*r*c+b*f*d,this._z=k*f*d-b*r*c,this._w=k*f*c-b*r*d):'XZY'===e&&(this._x=b*f*c-k*r*d,this._y=k*r*c-b*f*d,this._z=k*f*d+b*r*c,this._w=k*f*c+b*r*d);if(!1!==a)this.onChangeCallback();return this},setFromAxisAngle:function(e, -a){a/=2;var b=Math.sin(a);this._x=e.x*b;this._y=e.y*b;this._z=e.z*b;this._w=Math.cos(a);this.onChangeCallback();return this},setFromRotationMatrix:function(e){var a=e.elements,b=a[0];e=a[4];var d=a[8],c=a[1],h=a[5],k=a[9],f=a[2],n=a[6],a=a[10],q=b+h+a;0h&&b>a?(b=2*Math.sqrt(1+b-h-a),this._w=(n-k)/b,this._x=.25*b,this._y=(e+c)/b,this._z=(d+f)/b):h>a?(b=2*Math.sqrt(1+h-b-a),this._w=(d-f)/b,this._x=(e+c)/b,this._y= -.25*b,this._z=(k+n)/b):(b=2*Math.sqrt(1+a-b-h),this._w=(c-e)/b,this._x=(d+f)/b,this._y=(k+n)/b,this._z=.25*b);this.onChangeCallback();return this},setFromUnitVectors:function(){var e=new n,a;return function(b,r){void 0===e&&(e=new n);a=b.dot(r)+1;1E-6>a?(a=0,Math.abs(b.x)>Math.abs(b.z)?e.set(-b.y,b.x,0):e.set(0,-b.z,b.y)):e.crossVectors(b,r);this._x=e.x;this._y=e.y;this._z=e.z;this._w=a;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*= --1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e);this.onChangeCallback();return this}, -multiply:function(e,a){return void 0!==a?(console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'),this.multiplyQuaternions(e,a)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,a){var b=e._x,r=e._y,d=e._z;e=e._w;var c=a._x,h=a._y,k=a._z;a=a._w;this._x=b*a+e*c+r*k-d*h;this._y=r*a+e*h+d*c-b*k;this._z=d*a+e*k+b*h-r*c;this._w=e*a-b*c-r*h-d*k;this.onChangeCallback(); -return this},slerp:function(e,a){if(0===a)return this;if(1===a)return this.copy(e);var b=this._x,r=this._y,d=this._z,c=this._w,h=c*e._w+b*e._x+r*e._y+d*e._z;0>h?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,h=-h):this.copy(e);if(1<=h)return this._w=c,this._x=b,this._y=r,this._z=d,this;e=Math.sqrt(1-h*h);if(.001>Math.abs(e))return this._w=.5*(c+this._w),this._x=.5*(b+this._x),this._y=.5*(r+this._y),this._z=.5*(d+this._z),this;var k=Math.atan2(e,h),h=Math.sin((1-a)*k)/e;e=Math.sin(a*k)/e; -this._w=c*h+this._w*e;this._x=b*h+this._x*e;this._y=r*h+this._y*e;this._z=d*h+this._z*e;this.onChangeCallback();return this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,a){void 0===a&&(a=0);this._x=e[a];this._y=e[a+1];this._z=e[a+2];this._w=e[a+3];this.onChangeCallback();return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this._x;e[a+1]=this._y;e[a+2]=this._z;e[a+3]=this._w;return e},onChange:function(e){this.onChangeCallback= -e;return this},onChangeCallback:function(){}});Object.assign(n.prototype,{isVector3:!0,set:function(e,a,b){this.x=e;this.y=a;this.z=b;return this},setScalar:function(e){this.z=this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setComponent:function(e,a){switch(e){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;default:throw Error('index is out of range: '+e);}return this},getComponent:function(e){switch(e){case 0:return this.x; -case 1:return this.y;case 2:return this.z;default:throw Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;return this},add:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,a);this.x+=e.x;this.y+=e.y;this.z+=e.z;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;return this}, -addVectors:function(e,a){this.x=e.x+a.x;this.y=e.y+a.y;this.z=e.z+a.z;return this},addScaledVector:function(e,a){this.x+=e.x*a;this.y+=e.y*a;this.z+=e.z*a;return this},sub:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,a);this.x-=e.x;this.y-=e.y;this.z-=e.z;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;return this},subVectors:function(e,a){this.x=e.x-a.x;this.y=e.y-a.y;this.z= -e.z-a.z;return this},multiply:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'),this.multiplyVectors(e,a);this.x*=e.x;this.y*=e.y;this.z*=e.z;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;return this},multiplyVectors:function(e,a){this.x=e.x*a.x;this.y=e.y*a.y;this.z=e.z*a.z;return this},applyEuler:function(){var e=new k;return function(a){a&&a.isEuler||console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.'); -return this.applyQuaternion(e.setFromEuler(a))}}(),applyAxisAngle:function(){var e=new k;return function(a,b){return this.applyQuaternion(e.setFromAxisAngle(a,b))}}(),applyMatrix3:function(e){var a=this.x,b=this.y,d=this.z;e=e.elements;this.x=e[0]*a+e[3]*b+e[6]*d;this.y=e[1]*a+e[4]*b+e[7]*d;this.z=e[2]*a+e[5]*b+e[8]*d;return this},applyMatrix4:function(e){var a=this.x,b=this.y,d=this.z;e=e.elements;var c=1/(e[3]*a+e[7]*b+e[11]*d+e[15]);this.x=(e[0]*a+e[4]*b+e[8]*d+e[12])*c;this.y=(e[1]*a+e[5]*b+e[9]* -d+e[13])*c;this.z=(e[2]*a+e[6]*b+e[10]*d+e[14])*c;return this},applyQuaternion:function(e){var a=this.x,b=this.y,d=this.z,c=e.x,h=e.y,k=e.z;e=e.w;var f=e*a+h*d-k*b,n=e*b+k*a-c*d,q=e*d+c*b-h*a,a=-c*a-h*b-k*d;this.x=f*e+a*-c+n*-k-q*-h;this.y=n*e+a*-h+q*-c-f*-k;this.z=q*e+a*-k+f*-h-n*-c;return this},project:function(){var e=new p;return function(a){e.multiplyMatrices(a.projectionMatrix,e.getInverse(a.matrixWorld));return this.applyMatrix4(e)}}(),unproject:function(){var e=new p;return function(a){e.multiplyMatrices(a.matrixWorld, -e.getInverse(a.projectionMatrix));return this.applyMatrix4(e)}}(),transformDirection:function(e){var a=this.x,b=this.y,d=this.z;e=e.elements;this.x=e[0]*a+e[4]*b+e[8]*d;this.y=e[1]*a+e[5]*b+e[9]*d;this.z=e[2]*a+e[6]*b+e[10]*d;return this.normalize()},divide:function(e){this.x/=e.x;this.y/=e.y;this.z/=e.z;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);this.z=Math.min(this.z,e.z);return this},max:function(e){this.x= -Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);this.z=Math.max(this.z,e.z);return this},clamp:function(e,a){this.x=Math.max(e.x,Math.min(a.x,this.x));this.y=Math.max(e.y,Math.min(a.y,this.y));this.z=Math.max(e.z,Math.min(a.z,this.z));return this},clampScalar:function(){var e=new n,a=new n;return function(b,r){e.set(b,b,b);a.set(r,r,r);return this.clamp(e,a)}}(),clampLength:function(e,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(e,Math.min(a,b)))},floor:function(){this.x= +Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(f){return this.x*f.x+this.y*f.y+this.z*f.z+this.w*f.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()|| +1)},setLength:function(f){return this.normalize().multiplyScalar(f)},lerp:function(f,a){this.x+=(f.x-this.x)*a;this.y+=(f.y-this.y)*a;this.z+=(f.z-this.z)*a;this.w+=(f.w-this.w)*a;return this},lerpVectors:function(f,a,b){return this.subVectors(a,f).multiplyScalar(b).add(f)},equals:function(f){return f.x===this.x&&f.y===this.y&&f.z===this.z&&f.w===this.w},fromArray:function(f,a){void 0===a&&(a=0);this.x=f[a];this.y=f[a+1];this.z=f[a+2];this.w=f[a+3];return this},toArray:function(f,a){void 0===f&&(f= +[]);void 0===a&&(a=0);f[a]=this.x;f[a+1]=this.y;f[a+2]=this.z;f[a+3]=this.w;return f},fromBufferAttribute:function(f,a,b){void 0!==b&&console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');this.x=f.getX(a);this.y=f.getY(a);this.z=f.getZ(a);this.w=f.getW(a);return this}});Object.assign(g.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(f,a){if(this.width!==f||this.height!==a)this.width=f,this.height=a,this.dispose();this.viewport.set(0,0,f,a);this.scissor.set(0, +0,f,a)},clone:function(){return(new this.constructor).copy(this)},copy:function(f){this.width=f.width;this.height=f.height;this.viewport.copy(f.viewport);this.texture=f.texture.clone();this.depthBuffer=f.depthBuffer;this.stencilBuffer=f.stencilBuffer;this.depthTexture=f.depthTexture;return this},dispose:function(){this.dispatchEvent({type:'dispose'})}});c.prototype=Object.create(g.prototype);c.prototype.constructor=c;c.prototype.isWebGLRenderTargetCube=!0;Object.assign(k,{slerp:function(f,a,b,d){return b.copy(f).slerp(a, +d)},slerpFlat:function(f,a,b,d,c,h,k){var r=b[d+0],g=b[d+1],n=b[d+2];b=b[d+3];d=c[h+0];var q=c[h+1],e=c[h+2];c=c[h+3];if(b!==c||r!==d||g!==q||n!==e){h=1-k;var l=r*d+g*q+n*e+b*c,B=0<=l?1:-1,p=1-l*l;p>Number.EPSILON&&(p=Math.sqrt(p),l=Math.atan2(p,l*B),h=Math.sin(h*l)/p,k=Math.sin(k*l)/p);B*=k;r=r*h+d*B;g=g*h+q*B;n=n*h+e*B;b=b*h+c*B;h===1-k&&(k=1/Math.sqrt(r*r+g*g+n*n+b*b),r*=k,g*=k,n*=k,b*=k)}f[a]=r;f[a+1]=g;f[a+2]=n;f[a+3]=b}});Object.defineProperties(k.prototype,{x:{get:function(){return this._x}, +set:function(f){this._x=f;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(f){this._y=f;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(f){this._z=f;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(f){this._w=f;this.onChangeCallback()}}});Object.assign(k.prototype,{set:function(f,a,b,d){this._x=f;this._y=a;this._z=b;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z, +this._w)},copy:function(f){this._x=f.x;this._y=f.y;this._z=f.z;this._w=f.w;this.onChangeCallback();return this},setFromEuler:function(f,a){if(!f||!f.isEuler)throw Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var b=f._x,r=f._y,d=f._z;f=f.order;var c=Math.cos,h=Math.sin,k=c(b/2),g=c(r/2),c=c(d/2),b=h(b/2),r=h(r/2),d=h(d/2);'XYZ'===f?(this._x=b*g*c+k*r*d,this._y=k*r*c-b*g*d,this._z=k*g*d+b*r*c,this._w=k*g*c-b*r*d):'YXZ'===f?(this._x=b*g*c+ +k*r*d,this._y=k*r*c-b*g*d,this._z=k*g*d-b*r*c,this._w=k*g*c+b*r*d):'ZXY'===f?(this._x=b*g*c-k*r*d,this._y=k*r*c+b*g*d,this._z=k*g*d+b*r*c,this._w=k*g*c-b*r*d):'ZYX'===f?(this._x=b*g*c-k*r*d,this._y=k*r*c+b*g*d,this._z=k*g*d-b*r*c,this._w=k*g*c+b*r*d):'YZX'===f?(this._x=b*g*c+k*r*d,this._y=k*r*c+b*g*d,this._z=k*g*d-b*r*c,this._w=k*g*c-b*r*d):'XZY'===f&&(this._x=b*g*c-k*r*d,this._y=k*r*c-b*g*d,this._z=k*g*d+b*r*c,this._w=k*g*c+b*r*d);if(!1!==a)this.onChangeCallback();return this},setFromAxisAngle:function(f, +a){a/=2;var b=Math.sin(a);this._x=f.x*b;this._y=f.y*b;this._z=f.z*b;this._w=Math.cos(a);this.onChangeCallback();return this},setFromRotationMatrix:function(f){var a=f.elements,b=a[0];f=a[4];var d=a[8],c=a[1],h=a[5],k=a[9],g=a[2],n=a[6],a=a[10],q=b+h+a;0h&&b>a?(b=2*Math.sqrt(1+b-h-a),this._w=(n-k)/b,this._x=.25*b,this._y=(f+c)/b,this._z=(d+g)/b):h>a?(b=2*Math.sqrt(1+h-b-a),this._w=(d-g)/b,this._x=(f+c)/b,this._y= +.25*b,this._z=(k+n)/b):(b=2*Math.sqrt(1+a-b-h),this._w=(c-f)/b,this._x=(d+g)/b,this._y=(k+n)/b,this._z=.25*b);this.onChangeCallback();return this},setFromUnitVectors:function(){var f=new n,a;return function(b,r){void 0===f&&(f=new n);a=b.dot(r)+1;1E-6>a?(a=0,Math.abs(b.x)>Math.abs(b.z)?f.set(-b.y,b.x,0):f.set(0,-b.z,b.y)):f.crossVectors(b,r);this._x=f.x;this._y=f.y;this._z=f.z;this._w=a;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*= +-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(f){return this._x*f._x+this._y*f._y+this._z*f._z+this._w*f._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var f=this.length();0===f?(this._z=this._y=this._x=0,this._w=1):(f=1/f,this._x*=f,this._y*=f,this._z*=f,this._w*=f);this.onChangeCallback();return this}, +multiply:function(f,a){return void 0!==a?(console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'),this.multiplyQuaternions(f,a)):this.multiplyQuaternions(this,f)},premultiply:function(f){return this.multiplyQuaternions(f,this)},multiplyQuaternions:function(f,a){var b=f._x,r=f._y,d=f._z;f=f._w;var c=a._x,h=a._y,k=a._z;a=a._w;this._x=b*a+f*c+r*k-d*h;this._y=r*a+f*h+d*c-b*k;this._z=d*a+f*k+b*h-r*c;this._w=f*a-b*c-r*h-d*k;this.onChangeCallback(); +return this},slerp:function(f,a){if(0===a)return this;if(1===a)return this.copy(f);var b=this._x,r=this._y,d=this._z,c=this._w,h=c*f._w+b*f._x+r*f._y+d*f._z;0>h?(this._w=-f._w,this._x=-f._x,this._y=-f._y,this._z=-f._z,h=-h):this.copy(f);if(1<=h)return this._w=c,this._x=b,this._y=r,this._z=d,this;f=Math.sqrt(1-h*h);if(.001>Math.abs(f))return this._w=.5*(c+this._w),this._x=.5*(b+this._x),this._y=.5*(r+this._y),this._z=.5*(d+this._z),this;var k=Math.atan2(f,h),h=Math.sin((1-a)*k)/f;f=Math.sin(a*k)/f; +this._w=c*h+this._w*f;this._x=b*h+this._x*f;this._y=r*h+this._y*f;this._z=d*h+this._z*f;this.onChangeCallback();return this},equals:function(f){return f._x===this._x&&f._y===this._y&&f._z===this._z&&f._w===this._w},fromArray:function(f,a){void 0===a&&(a=0);this._x=f[a];this._y=f[a+1];this._z=f[a+2];this._w=f[a+3];this.onChangeCallback();return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this._x;f[a+1]=this._y;f[a+2]=this._z;f[a+3]=this._w;return f},onChange:function(f){this.onChangeCallback= +f;return this},onChangeCallback:function(){}});Object.assign(n.prototype,{isVector3:!0,set:function(f,a,b){this.x=f;this.y=a;this.z=b;return this},setScalar:function(f){this.z=this.y=this.x=f;return this},setX:function(f){this.x=f;return this},setY:function(f){this.y=f;return this},setZ:function(f){this.z=f;return this},setComponent:function(f,a){switch(f){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;default:throw Error('index is out of range: '+f);}return this},getComponent:function(f){switch(f){case 0:return this.x; +case 1:return this.y;case 2:return this.z;default:throw Error('index is out of range: '+f);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(f){this.x=f.x;this.y=f.y;this.z=f.z;return this},add:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(f,a);this.x+=f.x;this.y+=f.y;this.z+=f.z;return this},addScalar:function(f){this.x+=f;this.y+=f;this.z+=f;return this}, +addVectors:function(f,a){this.x=f.x+a.x;this.y=f.y+a.y;this.z=f.z+a.z;return this},addScaledVector:function(f,a){this.x+=f.x*a;this.y+=f.y*a;this.z+=f.z*a;return this},sub:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(f,a);this.x-=f.x;this.y-=f.y;this.z-=f.z;return this},subScalar:function(f){this.x-=f;this.y-=f;this.z-=f;return this},subVectors:function(f,a){this.x=f.x-a.x;this.y=f.y-a.y;this.z= +f.z-a.z;return this},multiply:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'),this.multiplyVectors(f,a);this.x*=f.x;this.y*=f.y;this.z*=f.z;return this},multiplyScalar:function(f){this.x*=f;this.y*=f;this.z*=f;return this},multiplyVectors:function(f,a){this.x=f.x*a.x;this.y=f.y*a.y;this.z=f.z*a.z;return this},applyEuler:function(){var f=new k;return function(a){a&&a.isEuler||console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.'); +return this.applyQuaternion(f.setFromEuler(a))}}(),applyAxisAngle:function(){var f=new k;return function(a,b){return this.applyQuaternion(f.setFromAxisAngle(a,b))}}(),applyMatrix3:function(f){var a=this.x,b=this.y,d=this.z;f=f.elements;this.x=f[0]*a+f[3]*b+f[6]*d;this.y=f[1]*a+f[4]*b+f[7]*d;this.z=f[2]*a+f[5]*b+f[8]*d;return this},applyMatrix4:function(f){var a=this.x,b=this.y,d=this.z;f=f.elements;var c=1/(f[3]*a+f[7]*b+f[11]*d+f[15]);this.x=(f[0]*a+f[4]*b+f[8]*d+f[12])*c;this.y=(f[1]*a+f[5]*b+f[9]* +d+f[13])*c;this.z=(f[2]*a+f[6]*b+f[10]*d+f[14])*c;return this},applyQuaternion:function(f){var a=this.x,b=this.y,d=this.z,c=f.x,h=f.y,k=f.z;f=f.w;var g=f*a+h*d-k*b,n=f*b+k*a-c*d,q=f*d+c*b-h*a,a=-c*a-h*b-k*d;this.x=g*f+a*-c+n*-k-q*-h;this.y=n*f+a*-h+q*-c-g*-k;this.z=q*f+a*-k+g*-h-n*-c;return this},project:function(){var f=new p;return function(a){f.multiplyMatrices(a.projectionMatrix,f.getInverse(a.matrixWorld));return this.applyMatrix4(f)}}(),unproject:function(){var f=new p;return function(a){f.multiplyMatrices(a.matrixWorld, +f.getInverse(a.projectionMatrix));return this.applyMatrix4(f)}}(),transformDirection:function(f){var a=this.x,b=this.y,d=this.z;f=f.elements;this.x=f[0]*a+f[4]*b+f[8]*d;this.y=f[1]*a+f[5]*b+f[9]*d;this.z=f[2]*a+f[6]*b+f[10]*d;return this.normalize()},divide:function(f){this.x/=f.x;this.y/=f.y;this.z/=f.z;return this},divideScalar:function(f){return this.multiplyScalar(1/f)},min:function(f){this.x=Math.min(this.x,f.x);this.y=Math.min(this.y,f.y);this.z=Math.min(this.z,f.z);return this},max:function(f){this.x= +Math.max(this.x,f.x);this.y=Math.max(this.y,f.y);this.z=Math.max(this.z,f.z);return this},clamp:function(f,a){this.x=Math.max(f.x,Math.min(a.x,this.x));this.y=Math.max(f.y,Math.min(a.y,this.y));this.z=Math.max(f.z,Math.min(a.z,this.z));return this},clampScalar:function(){var f=new n,a=new n;return function(b,r){f.set(b,b,b);a.set(r,r,r);return this.clamp(f,a)}}(),clampLength:function(f,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(f,Math.min(a,b)))},floor:function(){this.x= Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x= --this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,a){this.x+=(e.x- -this.x)*a;this.y+=(e.y-this.y)*a;this.z+=(e.z-this.z)*a;return this},lerpVectors:function(e,a,b){return this.subVectors(a,e).multiplyScalar(b).add(e)},cross:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),this.crossVectors(e,a);a=this.x;var b=this.y,r=this.z;this.x=b*e.z-r*e.y;this.y=r*e.x-a*e.z;this.z=a*e.y-b*e.x;return this},crossVectors:function(e,a){var b=e.x,r=e.y;e=e.z;var d=a.x,c=a.y;a=a.z;this.x=r* -a-e*c;this.y=e*d-b*a;this.z=b*c-r*d;return this},projectOnVector:function(e){var a=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(a)},projectOnPlane:function(){var e=new n;return function(a){e.copy(this).projectOnVector(a);return this.sub(e)}}(),reflect:function(){var e=new n;return function(a){return this.sub(e.copy(a).multiplyScalar(2*this.dot(a)))}}(),angleTo:function(e){e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(ka.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))}, -distanceToSquared:function(e){var a=this.x-e.x,b=this.y-e.y;e=this.z-e.z;return a*a+b*b+e*e},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var a=Math.sin(e.phi)*e.radius;this.x=a*Math.sin(e.theta);this.y=Math.cos(e.phi)*e.radius;this.z=a*Math.cos(e.theta);return this},setFromCylindrical:function(e){this.x=e.radius*Math.sin(e.theta);this.y=e.y;this.z=e.radius*Math.cos(e.theta);return this},setFromMatrixPosition:function(e){e= -e.elements;this.x=e[12];this.y=e[13];this.z=e[14];return this},setFromMatrixScale:function(e){var a=this.setFromMatrixColumn(e,0).length(),b=this.setFromMatrixColumn(e,1).length();e=this.setFromMatrixColumn(e,2).length();this.x=a;this.y=b;this.z=e;return this},setFromMatrixColumn:function(e,a){return this.fromArray(e.elements,4*a)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,a){void 0===a&&(a=0);this.x=e[a];this.y=e[a+1];this.z=e[a+2];return this},toArray:function(e, -a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this.x;e[a+1]=this.y;e[a+2]=this.z;return e},fromBufferAttribute:function(e,a,b){void 0!==b&&console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');this.x=e.getX(a);this.y=e.getY(a);this.z=e.getZ(a);return this}});Object.assign(p.prototype,{isMatrix4:!0,set:function(e,a,b,d,c,h,k,f,n,q,l,g,p,t,m,u){var r=this.elements;r[0]=e;r[4]=a;r[8]=b;r[12]=d;r[1]=c;r[5]=h;r[9]=k;r[13]=f;r[2]=n;r[6]=q;r[10]=l;r[14]=g;r[3]=p;r[7]=t;r[11]= -m;r[15]=u;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new p).fromArray(this.elements)},copy:function(e){var a=this.elements;e=e.elements;a[0]=e[0];a[1]=e[1];a[2]=e[2];a[3]=e[3];a[4]=e[4];a[5]=e[5];a[6]=e[6];a[7]=e[7];a[8]=e[8];a[9]=e[9];a[10]=e[10];a[11]=e[11];a[12]=e[12];a[13]=e[13];a[14]=e[14];a[15]=e[15];return this},copyPosition:function(e){var a=this.elements;e=e.elements;a[12]=e[12];a[13]=e[13];a[14]=e[14];return this},extractBasis:function(e, -a,b){e.setFromMatrixColumn(this,0);a.setFromMatrixColumn(this,1);b.setFromMatrixColumn(this,2);return this},makeBasis:function(e,a,b){this.set(e.x,a.x,b.x,0,e.y,a.y,b.y,0,e.z,a.z,b.z,0,0,0,0,1);return this},extractRotation:function(){var e=new n;return function(a){var b=this.elements,r=a.elements,d=1/e.setFromMatrixColumn(a,0).length(),c=1/e.setFromMatrixColumn(a,1).length();a=1/e.setFromMatrixColumn(a,2).length();b[0]=r[0]*d;b[1]=r[1]*d;b[2]=r[2]*d;b[4]=r[4]*c;b[5]=r[5]*c;b[6]=r[6]*c;b[8]=r[8]*a; -b[9]=r[9]*a;b[10]=r[10]*a;return this}}(),makeRotationFromEuler:function(e){e&&e.isEuler||console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');var a=this.elements,b=e.x,d=e.y,c=e.z,h=Math.cos(b),b=Math.sin(b),k=Math.cos(d),d=Math.sin(d),f=Math.cos(c),c=Math.sin(c);if('XYZ'===e.order){e=h*f;var n=h*c,q=b*f,l=b*c;a[0]=k*f;a[4]=-k*c;a[8]=d;a[1]=n+q*d;a[5]=e-l*d;a[9]=-b*k;a[2]=l-e*d;a[6]=q+n*d;a[10]=h*k}else'YXZ'===e.order?(e=k*f,n=k*c, -q=d*f,l=d*c,a[0]=e+l*b,a[4]=q*b-n,a[8]=h*d,a[1]=h*c,a[5]=h*f,a[9]=-b,a[2]=n*b-q,a[6]=l+e*b,a[10]=h*k):'ZXY'===e.order?(e=k*f,n=k*c,q=d*f,l=d*c,a[0]=e-l*b,a[4]=-h*c,a[8]=q+n*b,a[1]=n+q*b,a[5]=h*f,a[9]=l-e*b,a[2]=-h*d,a[6]=b,a[10]=h*k):'ZYX'===e.order?(e=h*f,n=h*c,q=b*f,l=b*c,a[0]=k*f,a[4]=q*d-n,a[8]=e*d+l,a[1]=k*c,a[5]=l*d+e,a[9]=n*d-q,a[2]=-d,a[6]=b*k,a[10]=h*k):'YZX'===e.order?(e=h*k,n=h*d,q=b*k,l=b*d,a[0]=k*f,a[4]=l-e*c,a[8]=q*c+n,a[1]=c,a[5]=h*f,a[9]=-b*f,a[2]=-d*f,a[6]=n*c+q,a[10]=e-l*c):'XZY'=== -e.order&&(e=h*k,n=h*d,q=b*k,l=b*d,a[0]=k*f,a[4]=-c,a[8]=d*f,a[1]=e*c+l,a[5]=h*f,a[9]=n*c-q,a[2]=q*c-n,a[6]=b*f,a[10]=l*c+e);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this},makeRotationFromQuaternion:function(e){var a=this.elements,b=e._x,d=e._y,c=e._z,h=e._w,k=b+b,f=d+d,n=c+c;e=b*k;var q=b*f,b=b*n,l=d*f,d=d*n,c=c*n,k=h*k,f=h*f,h=h*n;a[0]=1-(l+c);a[4]=q-h;a[8]=b+f;a[1]=q+h;a[5]=1-(e+c);a[9]=d-k;a[2]=b-f;a[6]=d+k;a[10]=1-(e+l);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1; -return this},lookAt:function(){var e=new n,a=new n,b=new n;return function(r,d,c){var h=this.elements;b.subVectors(r,d);0===b.lengthSq()&&(b.z=1);b.normalize();e.crossVectors(c,b);0===e.lengthSq()&&(1===Math.abs(c.z)?b.x+=1E-4:b.z+=1E-4,b.normalize(),e.crossVectors(c,b));e.normalize();a.crossVectors(b,e);h[0]=e.x;h[4]=a.x;h[8]=b.x;h[1]=e.y;h[5]=a.y;h[9]=b.y;h[2]=e.z;h[6]=a.z;h[10]=b.z;return this}}(),multiply:function(e,a){return void 0!==a?(console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'), -this.multiplyMatrices(e,a)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,a){e=e.elements;a=a.elements;var b=this.elements,r=e[0],d=e[4],c=e[8],h=e[12],k=e[1],f=e[5],n=e[9],q=e[13],l=e[2],g=e[6],p=e[10],t=e[14],m=e[3],u=e[7],v=e[11];e=e[15];var w=a[0],y=a[4],A=a[8],x=a[12],C=a[1],z=a[5],E=a[9],F=a[13],D=a[2],L=a[6],U=a[10],H=a[14],G=a[3],T=a[7],M=a[11];a=a[15];b[0]=r*w+d*C+c*D+h*G;b[4]=r*y+d*z+c*L+h*T;b[8]=r*A+d*E+c*U+h*M; -b[12]=r*x+d*F+c*H+h*a;b[1]=k*w+f*C+n*D+q*G;b[5]=k*y+f*z+n*L+q*T;b[9]=k*A+f*E+n*U+q*M;b[13]=k*x+f*F+n*H+q*a;b[2]=l*w+g*C+p*D+t*G;b[6]=l*y+g*z+p*L+t*T;b[10]=l*A+g*E+p*U+t*M;b[14]=l*x+g*F+p*H+t*a;b[3]=m*w+u*C+v*D+e*G;b[7]=m*y+u*z+v*L+e*T;b[11]=m*A+u*E+v*U+e*M;b[15]=m*x+u*F+v*H+e*a;return this},multiplyScalar:function(e){var a=this.elements;a[0]*=e;a[4]*=e;a[8]*=e;a[12]*=e;a[1]*=e;a[5]*=e;a[9]*=e;a[13]*=e;a[2]*=e;a[6]*=e;a[10]*=e;a[14]*=e;a[3]*=e;a[7]*=e;a[11]*=e;a[15]*=e;return this},applyToBufferAttribute:function(){var e= -new n;return function(a){for(var b=0,d=a.count;bthis.determinant()&&(h=-h);b.x=c[12];b.y=c[13];b.z=c[14];a.copy(this);b=1/h;var c=1/k,n=1/f;a.elements[0]*=b;a.elements[1]*=b;a.elements[2]*=b;a.elements[4]*=c;a.elements[5]*= -c;a.elements[6]*=c;a.elements[8]*=n;a.elements[9]*=n;a.elements[10]*=n;d.setFromRotationMatrix(a);r.x=h;r.y=k;r.z=f;return this}}(),makePerspective:function(e,a,b,d,c,h){void 0===h&&console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');var r=this.elements;r[0]=2*c/(a-e);r[4]=0;r[8]=(a+e)/(a-e);r[12]=0;r[1]=0;r[5]=2*c/(b-d);r[9]=(b+d)/(b-d);r[13]=0;r[2]=0;r[6]=0;r[10]=-(h+c)/(h-c);r[14]=-2*h*c/(h-c);r[3]=0;r[7]=0;r[11]=-1;r[15]=0;return this}, -makeOrthographic:function(e,a,b,d,c,h){var r=this.elements,k=1/(a-e),f=1/(b-d),n=1/(h-c);r[0]=2*k;r[4]=0;r[8]=0;r[12]=-((a+e)*k);r[1]=0;r[5]=2*f;r[9]=0;r[13]=-((b+d)*f);r[2]=0;r[6]=0;r[10]=-2*n;r[14]=-((h+c)*n);r[3]=0;r[7]=0;r[11]=0;r[15]=1;return this},equals:function(e){var a=this.elements;e=e.elements;for(var b=0;16>b;b++)if(a[b]!==e[b])return!1;return!0},fromArray:function(e,a){void 0===a&&(a=0);for(var b=0;16>b;b++)this.elements[b]=e[b+a];return this},toArray:function(e,a){void 0===e&&(e=[]); -void 0===a&&(a=0);var b=this.elements;e[a]=b[0];e[a+1]=b[1];e[a+2]=b[2];e[a+3]=b[3];e[a+4]=b[4];e[a+5]=b[5];e[a+6]=b[6];e[a+7]=b[7];e[a+8]=b[8];e[a+9]=b[9];e[a+10]=b[10];e[a+11]=b[11];e[a+12]=b[12];e[a+13]=b[13];e[a+14]=b[14];e[a+15]=b[15];return e}});t.prototype=Object.create(b.prototype);t.prototype.constructor=t;t.prototype.isDataTexture=!0;h.prototype=Object.create(b.prototype);h.prototype.constructor=h;h.prototype.isCubeTexture=!0;Object.defineProperty(h.prototype,'images',{get:function(){return this.image}, -set:function(e){this.image=e}});var He=new b,Ie=new h,De=[],Ee=[],Ge=new Float32Array(16),Fe=new Float32Array(9);pa.prototype.setValue=function(e,a){for(var b=this.seq,d=0,r=b.length;d!==r;++d){var c=b[d];c.setValue(e,a[c.id])}};var Yd=/([\w\d_]+)(\])?(\[|\.)?/g;R.prototype.setValue=function(e,a,b){a=this.map[a];void 0!==a&&a.setValue(e,b,this.renderer)};R.prototype.setOptional=function(e,a,b){a=a[b];void 0!==a&&this.setValue(e,b,a)};R.upload=function(e,a,b,d){for(var r=0,c=a.length;r!==c;++r){var h= -a[r],k=b[h.id];!1!==k.needsUpdate&&h.setValue(e,k.value,d)}};R.seqWithValue=function(e,a){for(var b=[],d=0,r=e.length;d!==r;++d){var c=e[d];c.id in a&&b.push(c)}return b};var Ff={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388, +-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(f){return this.x*f.x+this.y*f.y+this.z*f.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(f){return this.normalize().multiplyScalar(f)},lerp:function(f,a){this.x+=(f.x- +this.x)*a;this.y+=(f.y-this.y)*a;this.z+=(f.z-this.z)*a;return this},lerpVectors:function(f,a,b){return this.subVectors(a,f).multiplyScalar(b).add(f)},cross:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),this.crossVectors(f,a);a=this.x;var b=this.y,r=this.z;this.x=b*f.z-r*f.y;this.y=r*f.x-a*f.z;this.z=a*f.y-b*f.x;return this},crossVectors:function(f,a){var b=f.x,r=f.y;f=f.z;var d=a.x,c=a.y;a=a.z;this.x=r* +a-f*c;this.y=f*d-b*a;this.z=b*c-r*d;return this},projectOnVector:function(f){var a=f.dot(this)/f.lengthSq();return this.copy(f).multiplyScalar(a)},projectOnPlane:function(){var f=new n;return function(a){f.copy(this).projectOnVector(a);return this.sub(f)}}(),reflect:function(){var f=new n;return function(a){return this.sub(f.copy(a).multiplyScalar(2*this.dot(a)))}}(),angleTo:function(f){f=this.dot(f)/Math.sqrt(this.lengthSq()*f.lengthSq());return Math.acos(ka.clamp(f,-1,1))},distanceTo:function(f){return Math.sqrt(this.distanceToSquared(f))}, +distanceToSquared:function(f){var a=this.x-f.x,b=this.y-f.y;f=this.z-f.z;return a*a+b*b+f*f},distanceToManhattan:function(f){return Math.abs(this.x-f.x)+Math.abs(this.y-f.y)+Math.abs(this.z-f.z)},setFromSpherical:function(f){var a=Math.sin(f.phi)*f.radius;this.x=a*Math.sin(f.theta);this.y=Math.cos(f.phi)*f.radius;this.z=a*Math.cos(f.theta);return this},setFromCylindrical:function(f){this.x=f.radius*Math.sin(f.theta);this.y=f.y;this.z=f.radius*Math.cos(f.theta);return this},setFromMatrixPosition:function(f){f= +f.elements;this.x=f[12];this.y=f[13];this.z=f[14];return this},setFromMatrixScale:function(f){var a=this.setFromMatrixColumn(f,0).length(),b=this.setFromMatrixColumn(f,1).length();f=this.setFromMatrixColumn(f,2).length();this.x=a;this.y=b;this.z=f;return this},setFromMatrixColumn:function(f,a){return this.fromArray(f.elements,4*a)},equals:function(f){return f.x===this.x&&f.y===this.y&&f.z===this.z},fromArray:function(f,a){void 0===a&&(a=0);this.x=f[a];this.y=f[a+1];this.z=f[a+2];return this},toArray:function(f, +a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this.x;f[a+1]=this.y;f[a+2]=this.z;return f},fromBufferAttribute:function(f,a,b){void 0!==b&&console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');this.x=f.getX(a);this.y=f.getY(a);this.z=f.getZ(a);return this}});Object.assign(p.prototype,{isMatrix4:!0,set:function(f,a,b,d,c,h,k,g,n,q,e,l,p,t,m,u){var r=this.elements;r[0]=f;r[4]=a;r[8]=b;r[12]=d;r[1]=c;r[5]=h;r[9]=k;r[13]=g;r[2]=n;r[6]=q;r[10]=e;r[14]=l;r[3]=p;r[7]=t;r[11]= +m;r[15]=u;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new p).fromArray(this.elements)},copy:function(f){var a=this.elements;f=f.elements;a[0]=f[0];a[1]=f[1];a[2]=f[2];a[3]=f[3];a[4]=f[4];a[5]=f[5];a[6]=f[6];a[7]=f[7];a[8]=f[8];a[9]=f[9];a[10]=f[10];a[11]=f[11];a[12]=f[12];a[13]=f[13];a[14]=f[14];a[15]=f[15];return this},copyPosition:function(f){var a=this.elements;f=f.elements;a[12]=f[12];a[13]=f[13];a[14]=f[14];return this},extractBasis:function(f, +a,b){f.setFromMatrixColumn(this,0);a.setFromMatrixColumn(this,1);b.setFromMatrixColumn(this,2);return this},makeBasis:function(f,a,b){this.set(f.x,a.x,b.x,0,f.y,a.y,b.y,0,f.z,a.z,b.z,0,0,0,0,1);return this},extractRotation:function(){var f=new n;return function(a){var b=this.elements,r=a.elements,d=1/f.setFromMatrixColumn(a,0).length(),c=1/f.setFromMatrixColumn(a,1).length();a=1/f.setFromMatrixColumn(a,2).length();b[0]=r[0]*d;b[1]=r[1]*d;b[2]=r[2]*d;b[4]=r[4]*c;b[5]=r[5]*c;b[6]=r[6]*c;b[8]=r[8]*a; +b[9]=r[9]*a;b[10]=r[10]*a;return this}}(),makeRotationFromEuler:function(f){f&&f.isEuler||console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');var a=this.elements,b=f.x,d=f.y,c=f.z,h=Math.cos(b),b=Math.sin(b),k=Math.cos(d),d=Math.sin(d),g=Math.cos(c),c=Math.sin(c);if('XYZ'===f.order){f=h*g;var n=h*c,q=b*g,e=b*c;a[0]=k*g;a[4]=-k*c;a[8]=d;a[1]=n+q*d;a[5]=f-e*d;a[9]=-b*k;a[2]=e-f*d;a[6]=q+n*d;a[10]=h*k}else'YXZ'===f.order?(f=k*g,n=k*c, +q=d*g,e=d*c,a[0]=f+e*b,a[4]=q*b-n,a[8]=h*d,a[1]=h*c,a[5]=h*g,a[9]=-b,a[2]=n*b-q,a[6]=e+f*b,a[10]=h*k):'ZXY'===f.order?(f=k*g,n=k*c,q=d*g,e=d*c,a[0]=f-e*b,a[4]=-h*c,a[8]=q+n*b,a[1]=n+q*b,a[5]=h*g,a[9]=e-f*b,a[2]=-h*d,a[6]=b,a[10]=h*k):'ZYX'===f.order?(f=h*g,n=h*c,q=b*g,e=b*c,a[0]=k*g,a[4]=q*d-n,a[8]=f*d+e,a[1]=k*c,a[5]=e*d+f,a[9]=n*d-q,a[2]=-d,a[6]=b*k,a[10]=h*k):'YZX'===f.order?(f=h*k,n=h*d,q=b*k,e=b*d,a[0]=k*g,a[4]=e-f*c,a[8]=q*c+n,a[1]=c,a[5]=h*g,a[9]=-b*g,a[2]=-d*g,a[6]=n*c+q,a[10]=f-e*c):'XZY'=== +f.order&&(f=h*k,n=h*d,q=b*k,e=b*d,a[0]=k*g,a[4]=-c,a[8]=d*g,a[1]=f*c+e,a[5]=h*g,a[9]=n*c-q,a[2]=q*c-n,a[6]=b*g,a[10]=e*c+f);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this},makeRotationFromQuaternion:function(f){var a=this.elements,b=f._x,d=f._y,c=f._z,h=f._w,k=b+b,g=d+d,n=c+c;f=b*k;var q=b*g,b=b*n,e=d*g,d=d*n,c=c*n,k=h*k,g=h*g,h=h*n;a[0]=1-(e+c);a[4]=q-h;a[8]=b+g;a[1]=q+h;a[5]=1-(f+c);a[9]=d-k;a[2]=b-g;a[6]=d+k;a[10]=1-(f+e);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1; +return this},lookAt:function(){var f=new n,a=new n,b=new n;return function(r,d,c){var h=this.elements;b.subVectors(r,d);0===b.lengthSq()&&(b.z=1);b.normalize();f.crossVectors(c,b);0===f.lengthSq()&&(1===Math.abs(c.z)?b.x+=1E-4:b.z+=1E-4,b.normalize(),f.crossVectors(c,b));f.normalize();a.crossVectors(b,f);h[0]=f.x;h[4]=a.x;h[8]=b.x;h[1]=f.y;h[5]=a.y;h[9]=b.y;h[2]=f.z;h[6]=a.z;h[10]=b.z;return this}}(),multiply:function(f,a){return void 0!==a?(console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'), +this.multiplyMatrices(f,a)):this.multiplyMatrices(this,f)},premultiply:function(f){return this.multiplyMatrices(f,this)},multiplyMatrices:function(f,a){f=f.elements;a=a.elements;var b=this.elements,r=f[0],d=f[4],c=f[8],h=f[12],k=f[1],g=f[5],n=f[9],q=f[13],e=f[2],l=f[6],p=f[10],t=f[14],m=f[3],u=f[7],v=f[11];f=f[15];var w=a[0],y=a[4],A=a[8],x=a[12],C=a[1],z=a[5],E=a[9],F=a[13],D=a[2],L=a[6],U=a[10],H=a[14],G=a[3],T=a[7],M=a[11];a=a[15];b[0]=r*w+d*C+c*D+h*G;b[4]=r*y+d*z+c*L+h*T;b[8]=r*A+d*E+c*U+h*M; +b[12]=r*x+d*F+c*H+h*a;b[1]=k*w+g*C+n*D+q*G;b[5]=k*y+g*z+n*L+q*T;b[9]=k*A+g*E+n*U+q*M;b[13]=k*x+g*F+n*H+q*a;b[2]=e*w+l*C+p*D+t*G;b[6]=e*y+l*z+p*L+t*T;b[10]=e*A+l*E+p*U+t*M;b[14]=e*x+l*F+p*H+t*a;b[3]=m*w+u*C+v*D+f*G;b[7]=m*y+u*z+v*L+f*T;b[11]=m*A+u*E+v*U+f*M;b[15]=m*x+u*F+v*H+f*a;return this},multiplyScalar:function(f){var a=this.elements;a[0]*=f;a[4]*=f;a[8]*=f;a[12]*=f;a[1]*=f;a[5]*=f;a[9]*=f;a[13]*=f;a[2]*=f;a[6]*=f;a[10]*=f;a[14]*=f;a[3]*=f;a[7]*=f;a[11]*=f;a[15]*=f;return this},applyToBufferAttribute:function(){var f= +new n;return function(a){for(var b=0,d=a.count;bthis.determinant()&&(h=-h);b.x=c[12];b.y=c[13];b.z=c[14];a.copy(this);b=1/h;var c=1/k,n=1/g;a.elements[0]*=b;a.elements[1]*=b;a.elements[2]*=b;a.elements[4]*=c;a.elements[5]*= +c;a.elements[6]*=c;a.elements[8]*=n;a.elements[9]*=n;a.elements[10]*=n;d.setFromRotationMatrix(a);r.x=h;r.y=k;r.z=g;return this}}(),makePerspective:function(f,a,b,d,c,h){void 0===h&&console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');var r=this.elements;r[0]=2*c/(a-f);r[4]=0;r[8]=(a+f)/(a-f);r[12]=0;r[1]=0;r[5]=2*c/(b-d);r[9]=(b+d)/(b-d);r[13]=0;r[2]=0;r[6]=0;r[10]=-(h+c)/(h-c);r[14]=-2*h*c/(h-c);r[3]=0;r[7]=0;r[11]=-1;r[15]=0;return this}, +makeOrthographic:function(f,a,b,d,c,h){var r=this.elements,k=1/(a-f),g=1/(b-d),n=1/(h-c);r[0]=2*k;r[4]=0;r[8]=0;r[12]=-((a+f)*k);r[1]=0;r[5]=2*g;r[9]=0;r[13]=-((b+d)*g);r[2]=0;r[6]=0;r[10]=-2*n;r[14]=-((h+c)*n);r[3]=0;r[7]=0;r[11]=0;r[15]=1;return this},equals:function(f){var a=this.elements;f=f.elements;for(var b=0;16>b;b++)if(a[b]!==f[b])return!1;return!0},fromArray:function(f,a){void 0===a&&(a=0);for(var b=0;16>b;b++)this.elements[b]=f[b+a];return this},toArray:function(f,a){void 0===f&&(f=[]); +void 0===a&&(a=0);var b=this.elements;f[a]=b[0];f[a+1]=b[1];f[a+2]=b[2];f[a+3]=b[3];f[a+4]=b[4];f[a+5]=b[5];f[a+6]=b[6];f[a+7]=b[7];f[a+8]=b[8];f[a+9]=b[9];f[a+10]=b[10];f[a+11]=b[11];f[a+12]=b[12];f[a+13]=b[13];f[a+14]=b[14];f[a+15]=b[15];return f}});t.prototype=Object.create(b.prototype);t.prototype.constructor=t;t.prototype.isDataTexture=!0;h.prototype=Object.create(b.prototype);h.prototype.constructor=h;h.prototype.isCubeTexture=!0;Object.defineProperty(h.prototype,'images',{get:function(){return this.image}, +set:function(f){this.image=f}});var He=new b,Ie=new h,De=[],Ee=[],Ge=new Float32Array(16),Fe=new Float32Array(9);pa.prototype.setValue=function(f,a){for(var b=this.seq,d=0,r=b.length;d!==r;++d){var c=b[d];c.setValue(f,a[c.id])}};var Yd=/([\w\d_]+)(\])?(\[|\.)?/g;R.prototype.setValue=function(f,a,b){a=this.map[a];void 0!==a&&a.setValue(f,b,this.renderer)};R.prototype.setOptional=function(f,a,b){a=a[b];void 0!==a&&this.setValue(f,b,a)};R.upload=function(f,a,b,d){for(var r=0,c=a.length;r!==c;++r){var h= +a[r],k=b[h.id];!1!==k.needsUpdate&&h.setValue(f,k.value,d)}};R.seqWithValue=function(f,a){for(var b=[],d=0,r=f.length;d!==r;++d){var c=f[d];c.id in a&&b.push(c)}return b};var Ff={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388, crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146, floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323, lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273, moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797, -silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(Y.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){e&&e.isColor?this.copy(e):'number'===typeof e?this.setHex(e):'string'===typeof e&&this.setStyle(e);return this},setScalar:function(e){this.b= -this.g=this.r=e;return this},setHex:function(e){e=Math.floor(e);this.r=(e>>16&255)/255;this.g=(e>>8&255)/255;this.b=(e&255)/255;return this},setRGB:function(e,a,b){this.r=e;this.g=a;this.b=b;return this},setHSL:function(){function e(e,a,b){0>b&&(b+=1);1b?a:b<2/3?e+6*(a-e)*(2/3-b):e}return function(a,b,d){a=ka.euclideanModulo(a,1);b=ka.clamp(b,0,1);d=ka.clamp(d,0,1);0===b?this.r=this.g=this.b=d:(b=.5>=d?d*(1+b):d+b-d*b,d=2*d-b,this.r=e(d,b,a+1/3),this.g=e(d,b,a), -this.b=e(d,b,a-1/3));return this}}(),setStyle:function(e){function a(a){void 0!==a&&1>parseFloat(a)&&console.warn('THREE.Color: Alpha component of '+e+' will be ignored.')}var b;if(b=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var d=b[2];switch(b[1]){case 'rgb':case 'rgba':if(b=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(b[1],10))/255,this.g=Math.min(255,parseInt(b[2],10))/255,this.b=Math.min(255,parseInt(b[3],10))/255,a(b[5]),this;if(b= -/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(b[1],10))/100,this.g=Math.min(100,parseInt(b[2],10))/100,this.b=Math.min(100,parseInt(b[3],10))/100,a(b[5]),this;break;case 'hsl':case 'hsla':if(b=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(b[1])/360,c=parseInt(b[2],10)/100,h=parseInt(b[3],10)/100;a(b[5]);return this.setHSL(d,c,h)}}}else if(b=/^\#([A-Fa-f0-9]+)$/.exec(e)){b= -b[1];d=b.length;if(3===d)return this.r=parseInt(b.charAt(0)+b.charAt(0),16)/255,this.g=parseInt(b.charAt(1)+b.charAt(1),16)/255,this.b=parseInt(b.charAt(2)+b.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(b.charAt(0)+b.charAt(1),16)/255,this.g=parseInt(b.charAt(2)+b.charAt(3),16)/255,this.b=parseInt(b.charAt(4)+b.charAt(5),16)/255,this}e&&0=f?n/(c+h):n/(2-c-h);switch(c){case a:k=(b-d)/n+(b>16&255)/255;this.g=(f>>8&255)/255;this.b=(f&255)/255;return this},setRGB:function(f,a,b){this.r=f;this.g=a;this.b=b;return this},setHSL:function(){function f(f,a,b){0>b&&(b+=1);1b?a:b<2/3?f+6*(a-f)*(2/3-b):f}return function(a,b,d){a=ka.euclideanModulo(a,1);b=ka.clamp(b,0,1);d=ka.clamp(d,0,1);0===b?this.r=this.g=this.b=d:(b=.5>=d?d*(1+b):d+b-d*b,d=2*d-b,this.r=f(d,b,a+1/3),this.g=f(d,b,a), +this.b=f(d,b,a-1/3));return this}}(),setStyle:function(f){function a(a){void 0!==a&&1>parseFloat(a)&&console.warn('THREE.Color: Alpha component of '+f+' will be ignored.')}var b;if(b=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(f)){var d=b[2];switch(b[1]){case 'rgb':case 'rgba':if(b=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(b[1],10))/255,this.g=Math.min(255,parseInt(b[2],10))/255,this.b=Math.min(255,parseInt(b[3],10))/255,a(b[5]),this;if(b= +/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(b[1],10))/100,this.g=Math.min(100,parseInt(b[2],10))/100,this.b=Math.min(100,parseInt(b[3],10))/100,a(b[5]),this;break;case 'hsl':case 'hsla':if(b=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(b[1])/360,c=parseInt(b[2],10)/100,h=parseInt(b[3],10)/100;a(b[5]);return this.setHSL(d,c,h)}}}else if(b=/^\#([A-Fa-f0-9]+)$/.exec(f)){b= +b[1];d=b.length;if(3===d)return this.r=parseInt(b.charAt(0)+b.charAt(0),16)/255,this.g=parseInt(b.charAt(1)+b.charAt(1),16)/255,this.b=parseInt(b.charAt(2)+b.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(b.charAt(0)+b.charAt(1),16)/255,this.g=parseInt(b.charAt(2)+b.charAt(3),16)/255,this.b=parseInt(b.charAt(4)+b.charAt(5),16)/255,this}f&&0=g?n/(c+h):n/(2-c-h);switch(c){case a:k=(b-d)/n+(b 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n', bumpmap_pars_fragment:'#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n', @@ -433,189 +433,189 @@ ja.aomap,ja.lightmap,ja.fog]),vertexShader:ma.meshbasic_vert,fragmentShader:ma.m vertexShader:ma.meshphong_vert,fragmentShader:ma.meshphong_frag},standard:{uniforms:Oa.merge([ja.common,ja.aomap,ja.lightmap,ja.emissivemap,ja.bumpmap,ja.normalmap,ja.displacementmap,ja.roughnessmap,ja.metalnessmap,ja.fog,ja.lights,{emissive:{value:new Y(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:ma.meshphysical_vert,fragmentShader:ma.meshphysical_frag},points:{uniforms:Oa.merge([ja.points,ja.fog]),vertexShader:ma.points_vert,fragmentShader:ma.points_frag}, dashed:{uniforms:Oa.merge([ja.common,ja.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ma.linedashed_vert,fragmentShader:ma.linedashed_frag},depth:{uniforms:Oa.merge([ja.common,ja.displacementmap]),vertexShader:ma.depth_vert,fragmentShader:ma.depth_frag},normal:{uniforms:Oa.merge([ja.common,ja.bumpmap,ja.normalmap,ja.displacementmap,{opacity:{value:1}}]),vertexShader:ma.normal_vert,fragmentShader:ma.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}}, vertexShader:ma.cube_vert,fragmentShader:ma.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:ma.equirect_vert,fragmentShader:ma.equirect_frag},distanceRGBA:{uniforms:Oa.merge([ja.common,ja.displacementmap,{lightPos:{value:new n}}]),vertexShader:ma.distanceRGBA_vert,fragmentShader:ma.distanceRGBA_frag}};yb.physical={uniforms:Oa.merge([yb.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:ma.meshphysical_vert,fragmentShader:ma.meshphysical_frag}; -Object.assign(na.prototype,{set:function(e,a){this.min.copy(e);this.max.copy(a);return this},setFromPoints:function(e){this.makeEmpty();for(var a=0,b=e.length;athis.max.x||e.ythis.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,a){return(a||new m).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y?!1:!0}, -clampPoint:function(e,a){return(a||new m).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new m;return function(a){return e.copy(a).clamp(this.min,this.max).sub(a).length()}}(),intersect:function(e){this.min.max(e.min);this.max.min(e.max);return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this},translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});ca.prototype=Object.create(b.prototype); -ca.prototype.constructor=ca;var hf=0;Object.assign(ha.prototype,g.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var a in e){var b=e[a];if(void 0===b)console.warn("THREE.Material: '"+a+"' parameter is undefined.");else{var d=this[a];void 0===d?console.warn('THREE.'+this.type+": '"+a+"' is not a property of this material."):d&&d.isColor?d.set(b):d&&d.isVector3&&b&&b.isVector3?d.copy(b):this[a]='overdraw'===a?Number(b):b}}},toJSON:function(e){function a(e){var a= -[],b;for(b in e){var d=e[b];delete d.metadata;a.push(d)}return a}var b=void 0===e;b&&(e={textures:{},images:{}});var d={metadata:{version:4.5,type:'Material',generator:'Material.toJSON'}};d.uuid=this.uuid;d.type=this.type;''!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness);void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex()); -this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);void 0!==this.clearCoat&&(d.clearCoat=this.clearCoat);void 0!==this.clearCoatRoughness&&(d.clearCoatRoughness=this.clearCoatRoughness);this.map&&this.map.isTexture&&(d.map=this.map.toJSON(e).uuid);this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(e).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(e).uuid);this.bumpMap&& -this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(e).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(e).uuid,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(e).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(e).uuid); -this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(e).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(e).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(e).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(e).uuid,d.reflectivity=this.reflectivity);this.gradientMap&&this.gradientMap.isTexture&&(d.gradientMap=this.gradientMap.toJSON(e).uuid);void 0!==this.size&& +Object.assign(na.prototype,{set:function(f,a){this.min.copy(f);this.max.copy(a);return this},setFromPoints:function(f){this.makeEmpty();for(var a=0,b=f.length;athis.max.x||f.ythis.max.y?!1:!0},containsBox:function(f){return this.min.x<=f.min.x&&f.max.x<=this.max.x&&this.min.y<=f.min.y&&f.max.y<=this.max.y},getParameter:function(f,a){return(a||new m).set((f.x-this.min.x)/(this.max.x-this.min.x),(f.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(f){return f.max.xthis.max.x||f.max.ythis.max.y?!1:!0}, +clampPoint:function(f,a){return(a||new m).copy(f).clamp(this.min,this.max)},distanceToPoint:function(){var f=new m;return function(a){return f.copy(a).clamp(this.min,this.max).sub(a).length()}}(),intersect:function(f){this.min.max(f.min);this.max.min(f.max);return this},union:function(f){this.min.min(f.min);this.max.max(f.max);return this},translate:function(f){this.min.add(f);this.max.add(f);return this},equals:function(f){return f.min.equals(this.min)&&f.max.equals(this.max)}});ca.prototype=Object.create(b.prototype); +ca.prototype.constructor=ca;var hf=0;Object.assign(ha.prototype,e.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(f){if(void 0!==f)for(var a in f){var b=f[a];if(void 0===b)console.warn("THREE.Material: '"+a+"' parameter is undefined.");else{var d=this[a];void 0===d?console.warn('THREE.'+this.type+": '"+a+"' is not a property of this material."):d&&d.isColor?d.set(b):d&&d.isVector3&&b&&b.isVector3?d.copy(b):this[a]='overdraw'===a?Number(b):b}}},toJSON:function(f){function a(f){var a= +[],b;for(b in f){var d=f[b];delete d.metadata;a.push(d)}return a}var b=void 0===f;b&&(f={textures:{},images:{}});var d={metadata:{version:4.5,type:'Material',generator:'Material.toJSON'}};d.uuid=this.uuid;d.type=this.type;''!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness);void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex()); +this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);void 0!==this.clearCoat&&(d.clearCoat=this.clearCoat);void 0!==this.clearCoatRoughness&&(d.clearCoatRoughness=this.clearCoatRoughness);this.map&&this.map.isTexture&&(d.map=this.map.toJSON(f).uuid);this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(f).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(f).uuid);this.bumpMap&& +this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(f).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(f).uuid,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(f).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(f).uuid); +this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(f).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(f).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(f).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(f).uuid,d.reflectivity=this.reflectivity);this.gradientMap&&this.gradientMap.isTexture&&(d.gradientMap=this.gradientMap.toJSON(f).uuid);void 0!==this.size&& (d.size=this.size);void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(d.blending=this.blending);2!==this.shading&&(d.shading=this.shading);0!==this.side&&(d.side=this.side);0!==this.vertexColors&&(d.vertexColors=this.vertexColors);1>this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0c&&(c=q);l>h&&(h=l);g>k&&(k=g)}this.min.set(a,b,d);this.max.set(c,h,k);return this},setFromBufferAttribute:function(e){for(var a=Infinity,b=Infinity,d=Infinity,c=-Infinity,h=-Infinity,k=-Infinity,f=0,n=e.count;fc&&(c=q);l>h&&(h=l);g>k&&(k=g)}this.min.set(a,b,d);this.max.set(c,h,k);return this}, -setFromPoints:function(e){this.makeEmpty();for(var a=0,b=e.length;athis.max.x||e.ythis.max.y||e.zthis.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,a){return(a||new n).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/ -(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z?!1:!0},intersectsSphere:function(){var e=new n;return function(a){this.clampPoint(a.center,e);return e.distanceToSquared(a.center)<=a.radius*a.radius}}(),intersectsPlane:function(e){var a,b;0=e.constant},clampPoint:function(e,a){return(a||new n).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n;return function(a){return e.copy(a).clamp(this.min,this.max).sub(a).length()}}(),getBoundingSphere:function(){var e=new n;return function(a){a= -a||new qa;this.getCenter(a.center);a.radius=.5*this.getSize(e).length();return a}}(),intersect:function(e){this.min.max(e.min);this.max.min(e.max);this.isEmpty()&&this.makeEmpty();return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this},applyMatrix4:function(){var e=[new n,new n,new n,new n,new n,new n,new n,new n];return function(a){if(this.isEmpty())return this;e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a); -e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(e);return this}}(),translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&& -e.max.equals(this.max)}});Object.assign(qa.prototype,{set:function(e,a){this.center.copy(e);this.radius=a;return this},setFromPoints:function(){var e=new ia;return function(a,b){var d=this.center;void 0!==b?d.copy(b):e.setFromPoints(a).getCenter(d);for(var c=b=0,r=a.length;c= -this.radius},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var a=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=a*a},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,a){var b=this.center.distanceToSquared(e); -a=a||new n;a.copy(e);b>this.radius*this.radius&&(a.sub(this.center).normalize(),a.multiplyScalar(this.radius).add(this.center));return a},getBoundingBox:function(e){e=e||new ia;e.set(this.center,this.center);e.expandByScalar(this.radius);return e},applyMatrix4:function(e){this.center.applyMatrix4(e);this.radius*=e.getMaxScaleOnAxis();return this},translate:function(e){this.center.add(e);return this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});Object.assign(ra.prototype, -{isMatrix3:!0,set:function(e,a,b,d,c,h,k,f,n){var r=this.elements;r[0]=e;r[1]=d;r[2]=k;r[3]=a;r[4]=c;r[5]=f;r[6]=b;r[7]=h;r[8]=n;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var a=this.elements;e=e.elements;a[0]=e[0];a[1]=e[1];a[2]=e[2];a[3]=e[3];a[4]=e[4];a[5]=e[5];a[6]=e[6];a[7]=e[7];a[8]=e[8];return this},setFromMatrix4:function(e){e=e.elements;this.set(e[0],e[4],e[8],e[1],e[5], -e[9],e[2],e[6],e[10]);return this},applyToBufferAttribute:function(){var e=new n;return function(a){for(var b=0,d=a.count;bb;b++)if(a[b]!==e[b])return!1;return!0},fromArray:function(e,a){void 0===a&&(a=0);for(var b=0;9>b;b++)this.elements[b]=e[b+a];return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);var b=this.elements;e[a]=b[0];e[a+1]=b[1];e[a+2]=b[2];e[a+3]=b[3];e[a+4]=b[4];e[a+5]=b[5];e[a+6]=b[6];e[a+7]=b[7];e[a+8]=b[8];return e}});Object.assign(Aa.prototype,{set:function(e,a){this.normal.copy(e);this.constant=a;return this},setComponents:function(e,a,b, -d){this.normal.set(e,a,b);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(e,a){this.normal.copy(e);this.constant=-a.dot(this.normal);return this},setFromCoplanarPoints:function(){var e=new n,a=new n;return function(b,d,c){d=e.subVectors(c,d).cross(a.subVectors(b,d)).normalize();this.setFromNormalAndCoplanarPoint(d,b);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.normal.copy(e.normal);this.constant=e.constant;return this},normalize:function(){var e= -1/this.normal.length();this.normal.multiplyScalar(e);this.constant*=e;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,a){return(a||new n).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new n;return function(a,b){b=b||new n;var d=a.delta(e),c=this.normal.dot(d); -if(0===c){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else return c=-(a.start.dot(this.normal)+this.constant)/c,0>c||1a&&0e&&0b;b++)a[b].copy(e.planes[b]);return this},setFromMatrix:function(e){var a=this.planes,b=e.elements;e=b[0];var d=b[1],c=b[2],h=b[3],k=b[4],f=b[5],n=b[6],q=b[7],l=b[8],g=b[9],p=b[10],t=b[11],m=b[12],u=b[13],v=b[14],b=b[15];a[0].setComponents(h-e,q-k,t-l,b-m).normalize();a[1].setComponents(h+e,q+k,t+l,b+m).normalize();a[2].setComponents(h+d,q+f,t+g,b+u).normalize();a[3].setComponents(h- -d,q-f,t-g,b-u).normalize();a[4].setComponents(h-c,q-n,t-p,b-v).normalize();a[5].setComponents(h+c,q+n,t+p,b+v).normalize();return this},intersectsObject:function(){var e=new qa;return function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();e.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new qa;return function(a){e.center.set(0,0,0);e.radius=.7071067811865476;e.applyMatrix4(a.matrixWorld);return this.intersectsSphere(e)}}(), -intersectsSphere:function(e){var a=this.planes,b=e.center;e=-e.radius;for(var d=0;6>d;d++)if(a[d].distanceToPoint(b)c;c++){var r=d[c];e.x=0 -h&&0>r)return!1}return!0}}(),containsPoint:function(e){for(var a=this.planes,b=0;6>b;b++)if(0>a[b].distanceToPoint(e))return!1;return!0}});nb.RotationOrders='XYZ YZX ZXY XZY YXZ ZYX'.split(' ');nb.DefaultOrder='XYZ';Object.defineProperties(nb.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e;this.onChangeCallback()}}, -order:{get:function(){return this._order},set:function(e){this._order=e;this.onChangeCallback()}}});Object.assign(nb.prototype,{isEuler:!0,set:function(e,a,b,d){this._x=e;this._y=a;this._z=b;this._order=d||this._order;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){this._x=e._x;this._y=e._y;this._z=e._z;this._order=e._order;this.onChangeCallback();return this},setFromRotationMatrix:function(e,a,b){var d=ka.clamp, -c=e.elements;e=c[0];var r=c[4],h=c[8],k=c[1],f=c[5],n=c[9],q=c[2],l=c[6],c=c[10];a=a||this._order;'XYZ'===a?(this._y=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-n,c),this._z=Math.atan2(-r,e)):(this._x=Math.atan2(l,f),this._z=0)):'YXZ'===a?(this._x=Math.asin(-d(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(h,c),this._z=Math.atan2(k,f)):(this._y=Math.atan2(-q,e),this._z=0)):'ZXY'===a?(this._x=Math.asin(d(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-q,c),this._z=Math.atan2(-r, -f)):(this._y=0,this._z=Math.atan2(k,e))):'ZYX'===a?(this._y=Math.asin(-d(q,-1,1)),.99999>Math.abs(q)?(this._x=Math.atan2(l,c),this._z=Math.atan2(k,e)):(this._x=0,this._z=Math.atan2(-r,f))):'YZX'===a?(this._z=Math.asin(d(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(-n,f),this._y=Math.atan2(-q,e)):(this._x=0,this._y=Math.atan2(h,c))):'XZY'===a?(this._z=Math.asin(-d(r,-1,1)),.99999>Math.abs(r)?(this._x=Math.atan2(l,f),this._y=Math.atan2(h,e)):(this._x=Math.atan2(-n,c),this._y=0)):console.warn('THREE.Euler: .setFromRotationMatrix() given unsupported order: '+ -a);this._order=a;if(!1!==b)this.onChangeCallback();return this},setFromQuaternion:function(){var e=new p;return function(a,b,d){e.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(e,b,d)}}(),setFromVector3:function(e,a){return this.set(e.x,e.y,e.z,a||this._order)},reorder:function(){var e=new k;return function(a){e.setFromEuler(this);return this.setFromQuaternion(e,a)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){this._x= -e[0];this._y=e[1];this._z=e[2];void 0!==e[3]&&(this._order=e[3]);this.onChangeCallback();return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this._x;e[a+1]=this._y;e[a+2]=this._z;e[a+3]=this._order;return e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},onChange:function(e){this.onChangeCallback=e;return this},onChangeCallback:function(){}});Object.assign(Gc.prototype,{set:function(e){this.mask=1<c&&(c=q);e>h&&(h=e);l>k&&(k=l)}this.min.set(a,b,d);this.max.set(c,h,k);return this},setFromBufferAttribute:function(f){for(var a=Infinity,b=Infinity,d=Infinity,c=-Infinity,h=-Infinity,k=-Infinity,g=0,n=f.count;gc&&(c=q);e>h&&(h=e);l>k&&(k=l)}this.min.set(a,b,d);this.max.set(c,h,k);return this}, +setFromPoints:function(f){this.makeEmpty();for(var a=0,b=f.length;athis.max.x||f.ythis.max.y||f.zthis.max.z?!1:!0},containsBox:function(f){return this.min.x<=f.min.x&&f.max.x<=this.max.x&&this.min.y<=f.min.y&&f.max.y<=this.max.y&&this.min.z<=f.min.z&&f.max.z<=this.max.z},getParameter:function(f,a){return(a||new n).set((f.x-this.min.x)/(this.max.x-this.min.x),(f.y-this.min.y)/(this.max.y-this.min.y),(f.z-this.min.z)/ +(this.max.z-this.min.z))},intersectsBox:function(f){return f.max.xthis.max.x||f.max.ythis.max.y||f.max.zthis.max.z?!1:!0},intersectsSphere:function(){var f=new n;return function(a){this.clampPoint(a.center,f);return f.distanceToSquared(a.center)<=a.radius*a.radius}}(),intersectsPlane:function(f){var a,b;0=f.constant},clampPoint:function(f,a){return(a||new n).copy(f).clamp(this.min,this.max)},distanceToPoint:function(){var f=new n;return function(a){return f.copy(a).clamp(this.min,this.max).sub(a).length()}}(),getBoundingSphere:function(){var f=new n;return function(a){a= +a||new qa;this.getCenter(a.center);a.radius=.5*this.getSize(f).length();return a}}(),intersect:function(f){this.min.max(f.min);this.max.min(f.max);this.isEmpty()&&this.makeEmpty();return this},union:function(f){this.min.min(f.min);this.max.max(f.max);return this},applyMatrix4:function(){var f=[new n,new n,new n,new n,new n,new n,new n,new n];return function(a){if(this.isEmpty())return this;f[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);f[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a); +f[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);f[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);f[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);f[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);f[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);f[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(f);return this}}(),translate:function(f){this.min.add(f);this.max.add(f);return this},equals:function(f){return f.min.equals(this.min)&& +f.max.equals(this.max)}});Object.assign(qa.prototype,{set:function(f,a){this.center.copy(f);this.radius=a;return this},setFromPoints:function(){var f=new ia;return function(a,b){var d=this.center;void 0!==b?d.copy(b):f.setFromPoints(a).getCenter(d);for(var c=b=0,r=a.length;c= +this.radius},containsPoint:function(f){return f.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(f){return f.distanceTo(this.center)-this.radius},intersectsSphere:function(f){var a=this.radius+f.radius;return f.center.distanceToSquared(this.center)<=a*a},intersectsBox:function(f){return f.intersectsSphere(this)},intersectsPlane:function(f){return Math.abs(this.center.dot(f.normal)-f.constant)<=this.radius},clampPoint:function(f,a){var b=this.center.distanceToSquared(f); +a=a||new n;a.copy(f);b>this.radius*this.radius&&(a.sub(this.center).normalize(),a.multiplyScalar(this.radius).add(this.center));return a},getBoundingBox:function(f){f=f||new ia;f.set(this.center,this.center);f.expandByScalar(this.radius);return f},applyMatrix4:function(f){this.center.applyMatrix4(f);this.radius*=f.getMaxScaleOnAxis();return this},translate:function(f){this.center.add(f);return this},equals:function(f){return f.center.equals(this.center)&&f.radius===this.radius}});Object.assign(ra.prototype, +{isMatrix3:!0,set:function(f,a,b,d,c,h,k,g,n){var r=this.elements;r[0]=f;r[1]=d;r[2]=k;r[3]=a;r[4]=c;r[5]=g;r[6]=b;r[7]=h;r[8]=n;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(f){var a=this.elements;f=f.elements;a[0]=f[0];a[1]=f[1];a[2]=f[2];a[3]=f[3];a[4]=f[4];a[5]=f[5];a[6]=f[6];a[7]=f[7];a[8]=f[8];return this},setFromMatrix4:function(f){f=f.elements;this.set(f[0],f[4],f[8],f[1],f[5], +f[9],f[2],f[6],f[10]);return this},applyToBufferAttribute:function(){var f=new n;return function(a){for(var b=0,d=a.count;bb;b++)if(a[b]!==f[b])return!1;return!0},fromArray:function(f,a){void 0===a&&(a=0);for(var b=0;9>b;b++)this.elements[b]=f[b+a];return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);var b=this.elements;f[a]=b[0];f[a+1]=b[1];f[a+2]=b[2];f[a+3]=b[3];f[a+4]=b[4];f[a+5]=b[5];f[a+6]=b[6];f[a+7]=b[7];f[a+8]=b[8];return f}});Object.assign(Aa.prototype,{set:function(f,a){this.normal.copy(f);this.constant=a;return this},setComponents:function(f,a,b, +d){this.normal.set(f,a,b);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(f,a){this.normal.copy(f);this.constant=-a.dot(this.normal);return this},setFromCoplanarPoints:function(){var f=new n,a=new n;return function(b,d,c){d=f.subVectors(c,d).cross(a.subVectors(b,d)).normalize();this.setFromNormalAndCoplanarPoint(d,b);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(f){this.normal.copy(f.normal);this.constant=f.constant;return this},normalize:function(){var f= +1/this.normal.length();this.normal.multiplyScalar(f);this.constant*=f;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(f){return this.normal.dot(f)+this.constant},distanceToSphere:function(f){return this.distanceToPoint(f.center)-f.radius},projectPoint:function(f,a){return(a||new n).copy(this.normal).multiplyScalar(-this.distanceToPoint(f)).add(f)},intersectLine:function(){var f=new n;return function(a,b){b=b||new n;var d=a.delta(f),c=this.normal.dot(d); +if(0===c){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else return c=-(a.start.dot(this.normal)+this.constant)/c,0>c||1a&&0f&&0b;b++)a[b].copy(f.planes[b]);return this},setFromMatrix:function(f){var a=this.planes,b=f.elements;f=b[0];var d=b[1],c=b[2],h=b[3],k=b[4],g=b[5],n=b[6],q=b[7],e=b[8],l=b[9],p=b[10],t=b[11],m=b[12],u=b[13],v=b[14],b=b[15];a[0].setComponents(h-f,q-k,t-e,b-m).normalize();a[1].setComponents(h+f,q+k,t+e,b+m).normalize();a[2].setComponents(h+d,q+g,t+l,b+u).normalize();a[3].setComponents(h- +d,q-g,t-l,b-u).normalize();a[4].setComponents(h-c,q-n,t-p,b-v).normalize();a[5].setComponents(h+c,q+n,t+p,b+v).normalize();return this},intersectsObject:function(){var f=new qa;return function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();f.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(f)}}(),intersectsSprite:function(){var f=new qa;return function(a){f.center.set(0,0,0);f.radius=.7071067811865476;f.applyMatrix4(a.matrixWorld);return this.intersectsSphere(f)}}(), +intersectsSphere:function(f){var a=this.planes,b=f.center;f=-f.radius;for(var d=0;6>d;d++)if(a[d].distanceToPoint(b)c;c++){var r=d[c];f.x=0 +h&&0>r)return!1}return!0}}(),containsPoint:function(f){for(var a=this.planes,b=0;6>b;b++)if(0>a[b].distanceToPoint(f))return!1;return!0}});nb.RotationOrders='XYZ YZX ZXY XZY YXZ ZYX'.split(' ');nb.DefaultOrder='XYZ';Object.defineProperties(nb.prototype,{x:{get:function(){return this._x},set:function(f){this._x=f;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(f){this._y=f;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(f){this._z=f;this.onChangeCallback()}}, +order:{get:function(){return this._order},set:function(f){this._order=f;this.onChangeCallback()}}});Object.assign(nb.prototype,{isEuler:!0,set:function(f,a,b,d){this._x=f;this._y=a;this._z=b;this._order=d||this._order;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(f){this._x=f._x;this._y=f._y;this._z=f._z;this._order=f._order;this.onChangeCallback();return this},setFromRotationMatrix:function(f,a,b){var d=ka.clamp, +c=f.elements;f=c[0];var r=c[4],h=c[8],k=c[1],g=c[5],n=c[9],q=c[2],e=c[6],c=c[10];a=a||this._order;'XYZ'===a?(this._y=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-n,c),this._z=Math.atan2(-r,f)):(this._x=Math.atan2(e,g),this._z=0)):'YXZ'===a?(this._x=Math.asin(-d(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(h,c),this._z=Math.atan2(k,g)):(this._y=Math.atan2(-q,f),this._z=0)):'ZXY'===a?(this._x=Math.asin(d(e,-1,1)),.99999>Math.abs(e)?(this._y=Math.atan2(-q,c),this._z=Math.atan2(-r, +g)):(this._y=0,this._z=Math.atan2(k,f))):'ZYX'===a?(this._y=Math.asin(-d(q,-1,1)),.99999>Math.abs(q)?(this._x=Math.atan2(e,c),this._z=Math.atan2(k,f)):(this._x=0,this._z=Math.atan2(-r,g))):'YZX'===a?(this._z=Math.asin(d(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(-n,g),this._y=Math.atan2(-q,f)):(this._x=0,this._y=Math.atan2(h,c))):'XZY'===a?(this._z=Math.asin(-d(r,-1,1)),.99999>Math.abs(r)?(this._x=Math.atan2(e,g),this._y=Math.atan2(h,f)):(this._x=Math.atan2(-n,c),this._y=0)):console.warn('THREE.Euler: .setFromRotationMatrix() given unsupported order: '+ +a);this._order=a;if(!1!==b)this.onChangeCallback();return this},setFromQuaternion:function(){var f=new p;return function(a,b,d){f.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(f,b,d)}}(),setFromVector3:function(f,a){return this.set(f.x,f.y,f.z,a||this._order)},reorder:function(){var f=new k;return function(a){f.setFromEuler(this);return this.setFromQuaternion(f,a)}}(),equals:function(f){return f._x===this._x&&f._y===this._y&&f._z===this._z&&f._order===this._order},fromArray:function(f){this._x= +f[0];this._y=f[1];this._z=f[2];void 0!==f[3]&&(this._order=f[3]);this.onChangeCallback();return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this._x;f[a+1]=this._y;f[a+2]=this._z;f[a+3]=this._order;return f},toVector3:function(f){return f?f.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},onChange:function(f){this.onChangeCallback=f;return this},onChangeCallback:function(){}});Object.assign(Gc.prototype,{set:function(f){this.mask=1<c;c++)if(h[c]===h[(c+1)%3]){a.push(k);break}for(k=a.length-1;0<=k;k--)for(h=a[k],this.faces.splice(h,1),d=0,f=this.faceVertexUvs.length;dc;c++)if(h[c]===h[(c+1)%3]){a.push(k);break}for(k=a.length-1;0<=k;k--)for(h=a[k],this.faces.splice(h,1),d=0,g=this.faceVertexUvs.length;da?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)}, -distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new n;return function(e){var b=a.subVectors(e,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(e);a.copy(this.direction).multiplyScalar(b).add(this.origin);return a.distanceToSquared(e)}}(),distanceSqToSegment:function(){var a=new n,b=new n,d=new n;return function(e,c,h,k){a.copy(e).add(c).multiplyScalar(.5);b.copy(c).sub(e).normalize();d.copy(this.origin).sub(a); -var f=.5*e.distanceTo(c),n=-this.direction.dot(b),q=d.dot(this.direction),l=-d.dot(b),g=d.lengthSq(),r=Math.abs(1-n*n),p;0=-p?c<=p?(f=1/r,e*=f,c*=f,n=e*(e+n*c+2*q)+c*(n*e+c+2*l)+g):(c=f,e=Math.max(0,-(n*c+q)),n=-e*e+c*(c+2*l)+g):(c=-f,e=Math.max(0,-(n*c+q)),n=-e*e+c*(c+2*l)+g):c<=-p?(e=Math.max(0,-(-n*f+q)),c=0e)return null;e=Math.sqrt(e-c);c=d-e;d+=e;return 0>c&&0>d?null:0>c?this.at(d,b):this.at(c,b)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<= -a.radius},distanceToPlane:function(a){var e=a.normal.dot(this.direction);if(0===e)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/e;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var e=a.distanceToPoint(this.origin);return 0===e||0>a.normal.dot(this.direction)*e?!0:!1},intersectBox:function(a,b){var e,d,c,h,k;d=1/this.direction.x;h=1/this.direction.y;k=1/this.direction.z; -var f=this.origin;0<=d?(e=(a.min.x-f.x)*d,d*=a.max.x-f.x):(e=(a.max.x-f.x)*d,d*=a.min.x-f.x);0<=h?(c=(a.min.y-f.y)*h,h*=a.max.y-f.y):(c=(a.max.y-f.y)*h,h*=a.min.y-f.y);if(e>h||c>d)return null;if(c>e||e!==e)e=c;if(hk||c>d)return null;if(c>e||e!==e)e=c;if(kd?null:this.at(0<=e?e:d,b)},intersectsBox:function(){var a=new n;return function(e){return null!==this.intersectBox(e,a)}}(),intersectTriangle:function(){var a= -new n,b=new n,d=new n,c=new n;return function(e,h,k,f,n){b.subVectors(h,e);d.subVectors(k,e);c.crossVectors(b,d);h=this.direction.dot(c);if(0h)f=-1,h=-h;else return null;a.subVectors(this.origin,e);e=f*this.direction.dot(d.crossVectors(a,d));if(0>e)return null;k=f*this.direction.dot(b.cross(a));if(0>k||e+k>h)return null;e=-f*a.dot(c);return 0>e?null:this.at(e/h,n)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this}, +this.direction.copy(a.direction);return this},at:function(a,b){return(b||new n).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(){var a=new n;return function(f){this.origin.copy(this.at(f,a));return this}}(),closestPointToPoint:function(a,b){b=b||new n;b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)}, +distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new n;return function(f){var b=a.subVectors(f,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(f);a.copy(this.direction).multiplyScalar(b).add(this.origin);return a.distanceToSquared(f)}}(),distanceSqToSegment:function(){var a=new n,b=new n,d=new n;return function(f,c,h,k){a.copy(f).add(c).multiplyScalar(.5);b.copy(c).sub(f).normalize();d.copy(this.origin).sub(a); +var g=.5*f.distanceTo(c),n=-this.direction.dot(b),q=d.dot(this.direction),e=-d.dot(b),l=d.lengthSq(),r=Math.abs(1-n*n),p;0=-p?c<=p?(g=1/r,f*=g,c*=g,n=f*(f+n*c+2*q)+c*(n*f+c+2*e)+l):(c=g,f=Math.max(0,-(n*c+q)),n=-f*f+c*(c+2*e)+l):(c=-g,f=Math.max(0,-(n*c+q)),n=-f*f+c*(c+2*e)+l):c<=-p?(f=Math.max(0,-(-n*g+q)),c=0f)return null;f=Math.sqrt(f-c);c=d-f;d+=f;return 0>c&&0>d?null:0>c?this.at(d,b):this.at(c,b)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<= +a.radius},distanceToPlane:function(a){var f=a.normal.dot(this.direction);if(0===f)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/f;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var f=a.distanceToPoint(this.origin);return 0===f||0>a.normal.dot(this.direction)*f?!0:!1},intersectBox:function(a,b){var f,d,c,h,k;d=1/this.direction.x;h=1/this.direction.y;k=1/this.direction.z; +var g=this.origin;0<=d?(f=(a.min.x-g.x)*d,d*=a.max.x-g.x):(f=(a.max.x-g.x)*d,d*=a.min.x-g.x);0<=h?(c=(a.min.y-g.y)*h,h*=a.max.y-g.y):(c=(a.max.y-g.y)*h,h*=a.min.y-g.y);if(f>h||c>d)return null;if(c>f||f!==f)f=c;if(hk||c>d)return null;if(c>f||f!==f)f=c;if(kd?null:this.at(0<=f?f:d,b)},intersectsBox:function(){var a=new n;return function(f){return null!==this.intersectBox(f,a)}}(),intersectTriangle:function(){var a= +new n,b=new n,d=new n,c=new n;return function(f,h,k,g,n){b.subVectors(h,f);d.subVectors(k,f);c.crossVectors(b,d);h=this.direction.dot(c);if(0h)g=-1,h=-h;else return null;a.subVectors(this.origin,f);f=g*this.direction.dot(d.crossVectors(a,d));if(0>f)return null;k=g*this.direction.dot(b.cross(a));if(0>k||f+k>h)return null;f=-g*a.dot(c);return 0>f?null:this.at(f/h,n)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this}, equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(fb.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){return(a||new n).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new n).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)}, -distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){b=b||new n;return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new n,b=new n;return function(e,d){a.subVectors(e,this.start);b.subVectors(this.end,this.start);e=b.dot(b);e=b.dot(a)/e;d&&(e=ka.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,d){a=this.closestPointToPointParameter(a,b);d=d||new n;return this.delta(d).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); -this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});Object.assign(ab,{normal:function(){var a=new n;return function(e,b,d,c){c=c||new n;c.subVectors(d,b);a.subVectors(e,b);c.cross(a);e=c.lengthSq();return 0=e.x+e.y}}()});Object.assign(ab.prototype,{set:function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this},setFromPointsAndIndices:function(a,b,d,c){this.a.copy(a[b]);this.b.copy(a[d]);this.c.copy(a[c]);return this},clone:function(){return(new this.constructor).copy(this)}, +distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){b=b||new n;return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new n,b=new n;return function(f,d){a.subVectors(f,this.start);b.subVectors(this.end,this.start);f=b.dot(b);f=b.dot(a)/f;d&&(f=ka.clamp(f,0,1));return f}}(),closestPointToPoint:function(a,b,d){a=this.closestPointToPointParameter(a,b);d=d||new n;return this.delta(d).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); +this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});Object.assign(ab,{normal:function(){var a=new n;return function(f,b,d,c){c=c||new n;c.subVectors(d,b);a.subVectors(f,b);c.cross(a);f=c.lengthSq();return 0=f.x+f.y}}()});Object.assign(ab.prototype,{set:function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this},setFromPointsAndIndices:function(a,b,d,c){this.a.copy(a[b]);this.b.copy(a[d]);this.c.copy(a[c]);return this},clone:function(){return(new this.constructor).copy(this)}, copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new n,b=new n;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new n).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return ab.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new Aa).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return ab.barycoordFromPoint(a, -this.a,this.b,this.c,b)},containsPoint:function(a){return ab.containsPoint(a,this.a,this.b,this.c)},closestPointToPoint:function(){var a=new Aa,b=[new fb,new fb,new fb],d=new n,c=new n;return function(e,h){h=h||new n;var k=Infinity;a.setFromCoplanarPoints(this.a,this.b,this.c);a.projectPoint(e,d);if(!0===this.containsPoint(d))h.copy(d);else for(b[0].set(this.a,this.b),b[1].set(this.b,this.c),b[2].set(this.c,this.a),e=0;eb.far?null:{distance:e,point:C.clone(),object:a}}function d(e,d,c,h,k,n,g,r){f.fromBufferAttribute(h,n);q.fromBufferAttribute(h,g);l.fromBufferAttribute(h,r);if(e=b(e,e.material,d,c,f,q,l,x))k&&(v.fromBufferAttribute(k,n),w.fromBufferAttribute(k, -g),y.fromBufferAttribute(k,r),e.uv=a(x,f,q,l,v,w,y)),e.face=new cb(n,g,r,ab.normal(f,q,l)),e.faceIndex=n;return e}var c=new p,h=new eb,k=new qa,f=new n,q=new n,l=new n,g=new n,t=new n,u=new n,v=new m,w=new m,y=new m,A=new n,x=new n,C=new n;return function(e,n){var r=this.geometry,p=this.material,m=this.matrixWorld;if(void 0!==p&&(null===r.boundingSphere&&r.computeBoundingSphere(),k.copy(r.boundingSphere),k.applyMatrix4(m),!1!==e.ray.intersectsSphere(k)&&(c.getInverse(m),h.copy(e.ray).applyMatrix4(c), -null===r.boundingBox||!1!==h.intersectsBox(r.boundingBox)))){var B;if(r.isBufferGeometry){var A,C,p=r.index,I=r.attributes.position,m=r.attributes.uv,z,E;if(null!==p)for(z=0,E=p.count;zb.far?null:{distance:f,point:C.clone(),object:a}}function d(f,d,c,h,k,n,l,r){g.fromBufferAttribute(h,n);q.fromBufferAttribute(h,l);e.fromBufferAttribute(h,r);if(f=b(f,f.material,d,c,g,q,e,x))k&&(v.fromBufferAttribute(k,n),w.fromBufferAttribute(k, +l),y.fromBufferAttribute(k,r),f.uv=a(x,g,q,e,v,w,y)),f.face=new cb(n,l,r,ab.normal(g,q,e)),f.faceIndex=n;return f}var c=new p,h=new eb,k=new qa,g=new n,q=new n,e=new n,l=new n,t=new n,u=new n,v=new m,w=new m,y=new m,A=new n,x=new n,C=new n;return function(f,n){var r=this.geometry,p=this.material,m=this.matrixWorld;if(void 0!==p&&(null===r.boundingSphere&&r.computeBoundingSphere(),k.copy(r.boundingSphere),k.applyMatrix4(m),!1!==f.ray.intersectsSphere(k)&&(c.getInverse(m),h.copy(f.ray).applyMatrix4(c), +null===r.boundingBox||!1!==h.intersectsBox(r.boundingBox)))){var B;if(r.isBufferGeometry){var A,C,p=r.index,I=r.attributes.position,m=r.attributes.uv,z,E;if(null!==p)for(z=0,E=p.count;zh||(h=e.ray.origin.distanceTo(a),he.far||c.push({distance:h,point:a.clone(),face:null,object:this}))}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});Kc.prototype=Object.assign(Object.create(ba.prototype),{constructor:Kc,copy:function(a){ba.prototype.copy.call(this, -a,!1);a=a.levels;for(var e=0,b=a.length;e=d[c].distance)d[c-1].object.visible=!1,d[c].object.visible=!0;else break;for(;ch||(h=f.ray.origin.distanceTo(a),hf.far||c.push({distance:h,point:a.clone(),face:null,object:this}))}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});Kc.prototype=Object.assign(Object.create(ba.prototype),{constructor:Kc,copy:function(a){ba.prototype.copy.call(this, +a,!1);a=a.levels;for(var f=0,b=a.length;f=d[c].distance)d[c-1].object.visible=!1,d[c].object.visible=!0;else break;for(;ch||(g.applyMatrix4(this.matrixWorld),u=e.ray.origin.distanceTo(g),ue.far||c.push({distance:u,point:f.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else for(k=0,m=t.length/3-1;kh||(g.applyMatrix4(this.matrixWorld), -u=e.ray.origin.distanceTo(g),ue.far||c.push({distance:u,point:f.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else if(k.isGeometry)for(q=k.vertices,l=q.length,k=0;kh||(g.applyMatrix4(this.matrixWorld),u=e.ray.origin.distanceTo(g),ue.far||c.push({distance:u,point:f.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry, +return this};Ta.prototype=Object.assign(Object.create(ba.prototype),{constructor:Ta,isLine:!0,raycast:function(){var a=new p,b=new eb,d=new qa;return function(f,c){var h=f.linePrecision,h=h*h,k=this.geometry,g=this.matrixWorld;null===k.boundingSphere&&k.computeBoundingSphere();d.copy(k.boundingSphere);d.applyMatrix4(g);if(!1!==f.ray.intersectsSphere(d)){a.getInverse(g);b.copy(f.ray).applyMatrix4(a);var q=new n,e=new n,g=new n,l=new n,p=this&&this.isLineSegments?2:1;if(k.isBufferGeometry){var r=k.index, +t=k.attributes.position.array;if(null!==r)for(var r=r.array,k=0,m=r.length-1;kh||(l.applyMatrix4(this.matrixWorld),u=f.ray.origin.distanceTo(l),uf.far||c.push({distance:u,point:g.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else for(k=0,m=t.length/3-1;kh||(l.applyMatrix4(this.matrixWorld), +u=f.ray.origin.distanceTo(l),uf.far||c.push({distance:u,point:g.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else if(k.isGeometry)for(q=k.vertices,e=q.length,k=0;kh||(l.applyMatrix4(this.matrixWorld),u=f.ray.origin.distanceTo(l),uf.far||c.push({distance:u,point:g.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry, this.material)).copy(this)}});sa.prototype=Object.assign(Object.create(Ta.prototype),{constructor:sa,isLineSegments:!0});yd.prototype=Object.assign(Object.create(Ta.prototype),{constructor:yd,isLineLoop:!0});gb.prototype=Object.create(ha.prototype);gb.prototype.constructor=gb;gb.prototype.isPointsMaterial=!0;gb.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;return this};ac.prototype=Object.assign(Object.create(ba.prototype), -{constructor:ac,isPoints:!0,raycast:function(){var a=new p,b=new eb,d=new qa;return function(e,c){function h(a,d){var h=b.distanceSqToPoint(a);if(he.far||c.push({distance:f,distanceToRay:Math.sqrt(h),point:a.clone(),index:d,face:null,object:k})}}var k=this,f=this.geometry,q=this.matrixWorld,l=e.params.Points.threshold;null===f.boundingSphere&&f.computeBoundingSphere();d.copy(f.boundingSphere);d.applyMatrix4(q); -d.radius+=l;if(!1!==e.ray.intersectsSphere(d)){a.getInverse(q);b.copy(e.ray).applyMatrix4(a);var l=l/((this.scale.x+this.scale.y+this.scale.z)/3),g=l*l,l=new n;if(f.isBufferGeometry){var p=f.index,f=f.attributes.position.array;if(null!==p)for(var r=p.array,p=0,t=r.length;pf.far||c.push({distance:g,distanceToRay:Math.sqrt(h),point:a.clone(),index:d,face:null,object:k})}}var k=this,g=this.geometry,q=this.matrixWorld,e=f.params.Points.threshold;null===g.boundingSphere&&g.computeBoundingSphere();d.copy(g.boundingSphere);d.applyMatrix4(q); +d.radius+=e;if(!1!==f.ray.intersectsSphere(d)){a.getInverse(q);b.copy(f.ray).applyMatrix4(a);var e=e/((this.scale.x+this.scale.y+this.scale.z)/3),l=e*e,e=new n;if(g.isBufferGeometry){var p=g.index,g=g.attributes.position.array;if(null!==p)for(var r=p.array,p=0,t=r.length;pe)return null;var d=[],c=[],h=[],k,f,n;if(0=q--){console.warn('THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()'); -break}k=f;e<=k&&(k=0);f=k+1;e<=f&&(f=0);n=f+1;e<=n&&(n=0);var l;a:{var g,p,r,t,m,u,v,w;g=a[c[k]].x;p=a[c[k]].y;r=a[c[f]].x;t=a[c[f]].y;m=a[c[n]].x;u=a[c[n]].y;if(0>=(r-g)*(u-p)-(t-p)*(m-g))l=!1;else{var y,A,x,C,z,E,F,D,L,U;y=m-r;A=u-t;x=g-m;C=p-u;z=r-g;E=t-p;for(l=0;l=-Number.EPSILON&&D>=-Number.EPSILON&&F>=-Number.EPSILON)){l=!1;break a}l=!0}}if(l){d.push([a[c[k]], -a[c[f]],a[c[n]]]);h.push([c[k],c[f],c[n]]);k=f;for(n=f+1;nNumber.EPSILON){if(0r||r>p)return[];n=q*l-n* -g;if(0>n||n>p)return[]}else{if(0b?[]:n===b?h?[]:[k]:a<=b?[k,f]:[k,q]}function h(a,e,b,d){var c=e.x-a.x,h=e.y-a.y;e=b.x-a.x;b=b.y-a.y;var k=d.x-a.x;d=d.y-a.y;a=c*b-h*e;c=c*d-h*k;return Math.abs(a)>Number.EPSILON?(e=k*b-d*e,0d&&(d=b);var c=a+1;c>b&&(c=0);b=h(f[a],f[d],f[c],n[e]);if(!b)return!1;b=n.length-1;d=e-1;0>d&&(d=b);c=e+1;c>b&&(c=0);return h(n[e],n[d],n[c],f[a])?!0:!1}function d(a,e){var b,d;for(b=0;by){console.log('Infinite Loop! Holes left:'+q.length+', Probably Hole outside Shape!');break}for(l=m;ln;n++)q=a[n].x+':'+a[n].y,q=l[q],void 0!==q&&(a[n]=q);return b.concat()},isClockWise:function(a){return 0>ib.area(a)}};Bb.prototype=Object.create(aa.prototype);Bb.prototype.constructor=Bb;hb.prototype=Object.create(da.prototype);hb.prototype.constructor=hb;hb.prototype.getArrays=function(){var a= -this.getAttribute('position'),a=a?Array.prototype.slice.call(a.array):[],b=this.getAttribute('uv'),b=b?Array.prototype.slice.call(b.array):[],d=this.index,d=d?Array.prototype.slice.call(d.array):[];return{position:a,uv:b,index:d}};hb.prototype.addShapeList=function(a,b){var e=a.length;b.arrays=this.getArrays();for(var d=0;dNumber.EPSILON){var n=Math.sqrt(f),q=Math.sqrt(d*d+k*k),f=e.x-h/n;e=e.y+c/n;k=((b.x-k/q-f)*k-(b.y+d/q-e)*d)/(c*k-h*d);d=f+c*k-a.x;c=e+h*k-a.y;h=d*d+c*c;if(2>=h)return new m(d,c);h=Math.sqrt(h/2)}else a=!1,c>Number.EPSILON?d>Number.EPSILON&&(a=!0):c<-Number.EPSILON? -d<-Number.EPSILON&&(a=!0):Math.sign(h)===Math.sign(k)&&(a=!0),a?(d=-h,h=Math.sqrt(f)):(d=c,c=h,h=Math.sqrt(f/2));return new m(d/h,c/h)}function c(a,e){var b,d;for(R=a.length;0<=--R;){b=R;d=R-1;0>d&&(d=a.length-1);var c,h=x+2*w;for(c=0;cf)return null;var d=[],c=[],h=[],k,g,n;if(0=q--){console.warn('THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()'); +break}k=g;f<=k&&(k=0);g=k+1;f<=g&&(g=0);n=g+1;f<=n&&(n=0);var e;a:{var l,p,r,t,m,u,v,w;l=a[c[k]].x;p=a[c[k]].y;r=a[c[g]].x;t=a[c[g]].y;m=a[c[n]].x;u=a[c[n]].y;if(0>=(r-l)*(u-p)-(t-p)*(m-l))e=!1;else{var y,A,x,C,z,E,F,D,L,U;y=m-r;A=u-t;x=l-m;C=p-u;z=r-l;E=t-p;for(e=0;e=-Number.EPSILON&&D>=-Number.EPSILON&&F>=-Number.EPSILON)){e=!1;break a}e=!0}}if(e){d.push([a[c[k]], +a[c[g]],a[c[n]]]);h.push([c[k],c[g],c[n]]);k=g;for(n=g+1;nNumber.EPSILON){if(0r||r>p)return[];n=q*e-n* +l;if(0>n||n>p)return[]}else{if(0b?[]:n===b?h?[]:[k]:a<=b?[k,g]:[k,q]}function h(a,f,b,d){var c=f.x-a.x,h=f.y-a.y;f=b.x-a.x;b=b.y-a.y;var k=d.x-a.x;d=d.y-a.y;a=c*b-h*f;c=c*d-h*k;return Math.abs(a)>Number.EPSILON?(f=k*b-d*f,0d&&(d=b);var c=a+1;c>b&&(c=0);b=h(g[a],g[d],g[c],n[f]);if(!b)return!1;b=n.length-1;d=f-1;0>d&&(d=b);c=f+1;c>b&&(c=0);return h(n[f],n[d],n[c],g[a])?!0:!1}function d(a,f){var b,d;for(b=0;by){console.log('Infinite Loop! Holes left:'+q.length+', Probably Hole outside Shape!');break}for(e=m;en;n++)q=a[n].x+':'+a[n].y,q=e[q],void 0!==q&&(a[n]=q);return b.concat()},isClockWise:function(a){return 0>ib.area(a)}};Bb.prototype=Object.create(aa.prototype);Bb.prototype.constructor=Bb;hb.prototype=Object.create(da.prototype);hb.prototype.constructor=hb;hb.prototype.getArrays=function(){var a= +this.getAttribute('position'),a=a?Array.prototype.slice.call(a.array):[],b=this.getAttribute('uv'),b=b?Array.prototype.slice.call(b.array):[],d=this.index,d=d?Array.prototype.slice.call(d.array):[];return{position:a,uv:b,index:d}};hb.prototype.addShapeList=function(a,b){var f=a.length;b.arrays=this.getArrays();for(var d=0;dNumber.EPSILON){var n=Math.sqrt(g),q=Math.sqrt(d*d+k*k),g=f.x-h/n;f=f.y+c/n;k=((b.x-k/q-g)*k-(b.y+d/q-f)*d)/(c*k-h*d);d=g+c*k-a.x;c=f+h*k-a.y;h=d*d+c*c;if(2>=h)return new m(d,c);h=Math.sqrt(h/2)}else a=!1,c>Number.EPSILON?d>Number.EPSILON&&(a=!0):c<-Number.EPSILON? +d<-Number.EPSILON&&(a=!0):Math.sign(h)===Math.sign(k)&&(a=!0),a?(d=-h,h=Math.sqrt(g)):(d=c,c=h,h=Math.sqrt(g/2));return new m(d/h,c/h)}function c(a,f){var b,d;for(R=a.length;0<=--R;){b=R;d=R-1;0>d&&(d=a.length-1);var c,h=x+2*w;for(c=0;cMath.abs(e-n)?[new m(a,1-d),new m(f,1-c),new m(q,1-h),new m(g,1-b)]:[new m(e,1-d),new m(n,1-c),new m(l,1-h),new m(p,1-b)]}};Xc.prototype=Object.create(aa.prototype);Xc.prototype.constructor=Xc;kc.prototype=Object.create(hb.prototype);kc.prototype.constructor=kc;Yc.prototype=Object.create(aa.prototype); +V[T],A=A.concat(G);var fa,N,O,X,P=A.length,S,pa=Z.length,C=[],R=0;N=J.length;a=N-1;for(fa=R+1;RMath.abs(f-n)?[new m(a,1-d),new m(g,1-c),new m(q,1-h),new m(l,1-b)]:[new m(f,1-d),new m(n,1-c),new m(e,1-h),new m(p,1-b)]}};Xc.prototype=Object.create(aa.prototype);Xc.prototype.constructor=Xc;kc.prototype=Object.create(hb.prototype);kc.prototype.constructor=kc;Yc.prototype=Object.create(aa.prototype); Yc.prototype.constructor=Yc;Fb.prototype=Object.create(da.prototype);Fb.prototype.constructor=Fb;Zc.prototype=Object.create(aa.prototype);Zc.prototype.constructor=Zc;lc.prototype=Object.create(da.prototype);lc.prototype.constructor=lc;$c.prototype=Object.create(aa.prototype);$c.prototype.constructor=$c;mc.prototype=Object.create(da.prototype);mc.prototype.constructor=mc;nc.prototype=Object.create(aa.prototype);nc.prototype.constructor=nc;oc.prototype=Object.create(da.prototype);oc.prototype.constructor= oc;pc.prototype=Object.create(da.prototype);pc.prototype.constructor=pc;Gb.prototype=Object.create(aa.prototype);Gb.prototype.constructor=Gb;vb.prototype=Object.create(da.prototype);vb.prototype.constructor=vb;ad.prototype=Object.create(Gb.prototype);ad.prototype.constructor=ad;bd.prototype=Object.create(vb.prototype);bd.prototype.constructor=bd;cd.prototype=Object.create(aa.prototype);cd.prototype.constructor=cd;qc.prototype=Object.create(da.prototype);qc.prototype.constructor=qc;var mb=Object.freeze({WireframeGeometry:cc, ParametricGeometry:Oc,ParametricBufferGeometry:dc,TetrahedronGeometry:Qc,TetrahedronBufferGeometry:ec,OctahedronGeometry:Rc,OctahedronBufferGeometry:Eb,IcosahedronGeometry:Sc,IcosahedronBufferGeometry:fc,DodecahedronGeometry:Tc,DodecahedronBufferGeometry:gc,PolyhedronGeometry:Pc,PolyhedronBufferGeometry:Ua,TubeGeometry:Uc,TubeBufferGeometry:hc,TorusKnotGeometry:Vc,TorusKnotBufferGeometry:ic,TorusGeometry:Wc,TorusBufferGeometry:jc,TextGeometry:Xc,TextBufferGeometry:kc,SphereGeometry:Yc,SphereBufferGeometry:Fb, @@ -630,191 +630,191 @@ a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLine Kb.prototype.constructor=Kb;Kb.prototype.isMeshLambertMaterial=!0;Kb.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity= a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Lb.prototype=Object.create(ha.prototype);Lb.prototype.constructor=Lb;Lb.prototype.isLineDashedMaterial=!0;Lb.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color); this.linewidth=a.linewidth;this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Gf=Object.freeze({ShadowMaterial:rc,SpriteMaterial:Ab,RawShaderMaterial:sc,ShaderMaterial:ua,PointsMaterial:gb,MeshPhysicalMaterial:Hb,MeshStandardMaterial:tb,MeshPhongMaterial:jb,MeshToonMaterial:Ib,MeshNormalMaterial:Jb,MeshLambertMaterial:Kb,MeshDepthMaterial:ea,MeshBasicMaterial:Ia,LineDashedMaterial:Lb,LineBasicMaterial:va,Material:ha}),sd={enabled:!1,files:{},add:function(a,b){!1!== -this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},Wa=new ee;Object.assign(kb.prototype,{load:function(a,b,d,c){void 0===a&&(a='');void 0!==this.path&&(a=this.path+a);var e=this,h=sd.get(a);if(void 0!==h)return e.manager.itemStart(a),setTimeout(function(){b&&b(h);e.manager.itemEnd(a)},0),h;var k=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(k){var f=k[1],n=!!k[2],k=k[3],k=window.decodeURIComponent(k); -n&&(k=window.atob(k));try{var q,l=(this.responseType||'').toLowerCase();switch(l){case 'arraybuffer':case 'blob':q=new ArrayBuffer(k.length);for(var g=new Uint8Array(q),n=0;n=c)break a;else{h=e[1];a=c)break b}d=b;b= -0}}for(;b>>1,ab;)--h;++h;if(0!==c||h!==d)c>=h&&(h=Math.max(h, -1),c=h-1),d=this.getValueSize(),this.times=Ka.arraySlice(e,c,h),this.values=Ka.arraySlice(this.values,c*d,h*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error('THREE.KeyframeTrackPrototype: Invalid value size in track.',this),a=!1);var d=this.times,b=this.values,c=d.length;0===c&&(console.error('THREE.KeyframeTrackPrototype: Track is empty.',this),a=!1);for(var h=null,k=0;k!==c;k++){var f=d[k];if('number'===typeof f&&isNaN(f)){console.error('THREE.KeyframeTrackPrototype: Time is not a valid number.', -this,k,f);a=!1;break}if(null!==h&&h>f){console.error('THREE.KeyframeTrackPrototype: Out of order keys.',this,k,f,h);a=!1;break}h=f}if(void 0!==b&&Ka.isTypedArray(b))for(k=0,d=b.length;k!==d;++k)if(c=b[k],isNaN(c)){console.error('THREE.KeyframeTrackPrototype: Value is not a valid number.',this,k,c);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,d=this.getValueSize(),c=2302===this.getInterpolation(),h=1,k=a.length-1,f=1;f=c)break a;else{h=f[1];a=c)break b}d=b;b= +0}}for(;b>>1,ab;)--h;++h;if(0!==c||h!==d)c>=h&&(h=Math.max(h, +1),c=h-1),d=this.getValueSize(),this.times=Ka.arraySlice(f,c,h),this.values=Ka.arraySlice(this.values,c*d,h*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error('THREE.KeyframeTrackPrototype: Invalid value size in track.',this),a=!1);var d=this.times,b=this.values,c=d.length;0===c&&(console.error('THREE.KeyframeTrackPrototype: Track is empty.',this),a=!1);for(var h=null,k=0;k!==c;k++){var g=d[k];if('number'===typeof g&&isNaN(g)){console.error('THREE.KeyframeTrackPrototype: Time is not a valid number.', +this,k,g);a=!1;break}if(null!==h&&h>g){console.error('THREE.KeyframeTrackPrototype: Out of order keys.',this,k,g,h);a=!1;break}h=g}if(void 0!==b&&Ka.isTypedArray(b))for(k=0,d=b.length;k!==d;++k)if(c=b[k],isNaN(c)){console.error('THREE.KeyframeTrackPrototype: Value is not a valid number.',this,k,c);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,d=this.getValueSize(),c=2302===this.getInterpolation(),h=1,k=a.length-1,g=1;gq.opacity&&(q.transparent=!0);c.setTextures(n);return c.parse(q)}}()});Object.assign(ie.prototype,{load:function(a,b,d,c){var e=this,h=this.texturePath&&'string'===typeof this.texturePath?this.texturePath:vc.prototype.extractUrlBase(a),k=new kb(this.manager); -k.setWithCredentials(this.withCredentials);k.load(a,function(d){d=JSON.parse(d);var c=d.metadata;if(void 0!==c&&(c=c.type,void 0!==c)){if('object'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.ObjectLoader instead.');return}if('scene'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.SceneLoader instead.');return}}d=e.parse(d,h);b(d.geometry,d.materials)},d,c)},setTexturePath:function(a){this.texturePath=a},parse:function(){return function(a, -b){void 0!==a.data&&(a=a.data);a.scale=void 0!==a.scale?1/a.scale:1;var e=new aa,d=a,c,h,k,f,q,g,p,r,t,u,v,w,y,A,x=d.faces;t=d.vertices;var C=d.normals,z=d.colors;g=d.scale;var E=0;if(void 0!==d.uvs){for(c=0;ch;h++)r=x[f++],A=y[2*r],r=y[2*r+1],A=new m(A,r),2!==h&&e.faceVertexUvs[c][k].push(A),0!==h&&e.faceVertexUvs[c][k+1].push(A);p&&(p=3*x[f++],u.normal.set(C[p++],C[p++],C[p]),w.normal.copy(u.normal));if(v)for(c=0;4>c;c++)p=3*x[f++],v=new n(C[p++],C[p++],C[p]),2!==c&&u.vertexNormals.push(v),0!==c&& -w.vertexNormals.push(v);g&&(g=x[f++],g=z[g],u.color.setHex(g),w.color.setHex(g));if(t)for(c=0;4>c;c++)g=x[f++],g=z[g],2!==c&&u.vertexColors.push(new Y(g)),0!==c&&w.vertexColors.push(new Y(g));e.faces.push(u);e.faces.push(w)}else{u=new cb;u.a=x[f++];u.b=x[f++];u.c=x[f++];k&&(k=x[f++],u.materialIndex=k);k=e.faces.length;if(c)for(c=0;ch;h++)r=x[f++],A=y[2*r],r=y[2*r+1],A=new m(A,r),e.faceVertexUvs[c][k].push(A);p&&(p=3*x[f++],u.normal.set(C[p++],C[p++], -C[p]));if(v)for(c=0;3>c;c++)p=3*x[f++],v=new n(C[p++],C[p++],C[p]),u.vertexNormals.push(v);g&&(g=x[f++],u.color.setHex(z[g]));if(t)for(c=0;3>c;c++)g=x[f++],u.vertexColors.push(new Y(z[g]));e.faces.push(u)}d=a;f=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(q=0,x=d.skinWeights.length;qf)b=d+1;else if(0e&&(e=0);1Number.EPSILON&&(f.normalize(),e=Math.acos(ka.clamp(d[q-1].dot(d[q]),-1,1)),c[q].applyMatrix4(k.makeRotationAxis(f,e))),h[q].crossVectors(d[q],c[q]);if(!0===b)for(e= -Math.acos(ka.clamp(c[0].dot(c[a]),-1,1)),e/=a,0=e)return e=b[a]-e,a=this.curves[a],b=a.getLength(),a.getPointAt(0=== -b?0:1-e/b);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,d=0,c=this.curves.length;db;)b+=e;for(;b>e;)b-=e;be.length-2?e.length-1:a+1],e=e[a>e.length-3?e.length- -1:a+2];return new m(Ne(b,d.x,c.x,h.x,e.x),Ne(b,d.y,c.y,h.y,e.y))};wc.prototype=Object.create(Pa.prototype);wc.prototype.constructor=wc;wc.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2,c=this.v3;return new m(Qb(a,e.x,b.x,d.x,c.x),Qb(a,e.y,b.y,d.y,c.y))};xc.prototype=Object.create(Pa.prototype);xc.prototype.constructor=xc;xc.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2;return new m(Pb(a,e.x,b.x,d.x),Pb(a,e.y,b.y,d.y))};var ze=Object.assign(Object.create(gd.prototype), -{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var e=1,b=a.length;eNumber.EPSILON){if(0>q&&(f=e[h],n=-n,k=e[c],q=-q),!(a.yk.y))if(a.y===f.y){if(a.x===f.x)return!0}else{c=q*(a.x-f.x)-n*(a.y-f.y);if(0===c)return!0;0>c||(d=!d)}}else if(a.y===f.y&&(k.x<=a.x&&a.x<=f.x||f.x<=a.x&&a.x<=k.x))return!0}return d}var c=ib.isClockWise,h=this.subPaths;if(0===h.length)return[];if(!0===b)return e(h);var f,k,n=[];if(1===h.length)return f= -h[0],k=new Sb,k.curves=f.curves,n.push(k),n;var q=!c(h[0].getPoints()),q=a?!q:q;k=[];var l=[],g=[],p=0,t;l[p]=void 0;g[p]=[];for(var u=0,m=h.length;uq.opacity&&(q.transparent=!0);c.setTextures(n);return c.parse(q)}}()});Object.assign(ie.prototype,{load:function(a,b,d,c){var f=this,h=this.texturePath&&'string'===typeof this.texturePath?this.texturePath:vc.prototype.extractUrlBase(a),k=new kb(this.manager); +k.setWithCredentials(this.withCredentials);k.load(a,function(d){d=JSON.parse(d);var c=d.metadata;if(void 0!==c&&(c=c.type,void 0!==c)){if('object'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.ObjectLoader instead.');return}if('scene'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.SceneLoader instead.');return}}d=f.parse(d,h);b(d.geometry,d.materials)},d,c)},setTexturePath:function(a){this.texturePath=a},parse:function(){return function(a, +b){void 0!==a.data&&(a=a.data);a.scale=void 0!==a.scale?1/a.scale:1;var f=new aa,d=a,c,h,k,g,q,e,p,r,t,u,v,w,y,A,x=d.faces;t=d.vertices;var C=d.normals,z=d.colors;e=d.scale;var E=0;if(void 0!==d.uvs){for(c=0;ch;h++)r=x[g++],A=y[2*r],r=y[2*r+1],A=new m(A,r),2!==h&&f.faceVertexUvs[c][k].push(A),0!==h&&f.faceVertexUvs[c][k+1].push(A);p&&(p=3*x[g++],u.normal.set(C[p++],C[p++],C[p]),w.normal.copy(u.normal));if(v)for(c=0;4>c;c++)p=3*x[g++],v=new n(C[p++],C[p++],C[p]),2!==c&&u.vertexNormals.push(v),0!==c&& +w.vertexNormals.push(v);e&&(e=x[g++],e=z[e],u.color.setHex(e),w.color.setHex(e));if(t)for(c=0;4>c;c++)e=x[g++],e=z[e],2!==c&&u.vertexColors.push(new Y(e)),0!==c&&w.vertexColors.push(new Y(e));f.faces.push(u);f.faces.push(w)}else{u=new cb;u.a=x[g++];u.b=x[g++];u.c=x[g++];k&&(k=x[g++],u.materialIndex=k);k=f.faces.length;if(c)for(c=0;ch;h++)r=x[g++],A=y[2*r],r=y[2*r+1],A=new m(A,r),f.faceVertexUvs[c][k].push(A);p&&(p=3*x[g++],u.normal.set(C[p++],C[p++], +C[p]));if(v)for(c=0;3>c;c++)p=3*x[g++],v=new n(C[p++],C[p++],C[p]),u.vertexNormals.push(v);e&&(e=x[g++],u.color.setHex(z[e]));if(t)for(c=0;3>c;c++)e=x[g++],u.vertexColors.push(new Y(z[e]));f.faces.push(u)}d=a;g=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(q=0,x=d.skinWeights.length;qg)b=d+1;else if(0f&&(f=0);1Number.EPSILON&&(g.normalize(),f=Math.acos(ka.clamp(d[q-1].dot(d[q]),-1,1)),c[q].applyMatrix4(k.makeRotationAxis(g,f))),h[q].crossVectors(d[q],c[q]);if(!0===b)for(f= +Math.acos(ka.clamp(c[0].dot(c[a]),-1,1)),f/=a,0=f)return f=b[a]-f,a=this.curves[a],b=a.getLength(),a.getPointAt(0=== +b?0:1-f/b);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,d=0,c=this.curves.length;db;)b+=f;for(;b>f;)b-=f;bf.length-2?f.length-1:a+1],f=f[a>f.length-3?f.length- +1:a+2];return new m(Ne(b,d.x,c.x,h.x,f.x),Ne(b,d.y,c.y,h.y,f.y))};wc.prototype=Object.create(Pa.prototype);wc.prototype.constructor=wc;wc.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2,c=this.v3;return new m(Qb(a,f.x,b.x,d.x,c.x),Qb(a,f.y,b.y,d.y,c.y))};xc.prototype=Object.create(Pa.prototype);xc.prototype.constructor=xc;xc.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2;return new m(Pb(a,f.x,b.x,d.x),Pb(a,f.y,b.y,d.y))};var ze=Object.assign(Object.create(gd.prototype), +{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var f=1,b=a.length;fNumber.EPSILON){if(0>q&&(g=f[h],n=-n,k=f[c],q=-q),!(a.yk.y))if(a.y===g.y){if(a.x===g.x)return!0}else{c=q*(a.x-g.x)-n*(a.y-g.y);if(0===c)return!0;0>c||(d=!d)}}else if(a.y===g.y&&(k.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=k.x))return!0}return d}var c=ib.isClockWise,h=this.subPaths;if(0===h.length)return[];if(!0===b)return f(h);var g,k,n=[];if(1===h.length)return g= +h[0],k=new Sb,k.curves=g.curves,n.push(k),n;var q=!c(h[0].getPoints()),q=a?!q:q;k=[];var e=[],l=[],p=0,t;e[p]=void 0;l[p]=[];for(var u=0,m=h.length;ud&&this._mixBufferRegion(b,a,3*e,1-d,e);for(var d=e,h=e+e;d!==h;++d)if(b[d]!==b[d+e]){c.setValue(b,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,d=3*b;this.binding.getValue(a,d);for(var c=b;c!==d;++c)a[c]=a[d+c%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, -b,d,c,h){if(.5<=c)for(c=0;c!==h;++c)a[b+c]=a[d+c]},_slerp:function(a,b,d,c){k.slerpFlat(a,b,a,b,a,d,c)},_lerp:function(a,b,d,c,h){for(var e=1-c,f=0;f!==h;++f){var k=b+f;a[k]=a[k]*e+a[d+f]*c}}});Object.assign(Qe.prototype,{getValue:function(a,b){this.bind();var e=this._bindings[this._targetGroup.nCachedObjects_];void 0!==e&&e.getValue(a,b)},setValue:function(a,b){for(var e=this._bindings,d=this._targetGroup.nCachedObjects_,c=e.length;d!==c;++d)e[d].setValue(a,b)},bind:function(){for(var a=this._bindings, +a},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(a){this.panner.rolloffFactor=a},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(a){this.panner.distanceModel=a},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(a){this.panner.maxDistance=a},updateMatrixWorld:function(){var a=new n;return function(f){ba.prototype.updateMatrixWorld.call(this,f);a.setFromMatrixPosition(this.matrixWorld); +this.panner.setPosition(a.x,a.y,a.z)}}()});Object.assign(pe.prototype,{getFrequencyData:function(){this.analyser.getByteFrequencyData(this.data);return this.data},getAverageFrequency:function(){for(var a=0,b=this.getFrequencyData(),d=0;dd&&this._mixBufferRegion(b,a,3*f,1-d,f);for(var d=f,h=f+f;d!==h;++d)if(b[d]!==b[d+f]){c.setValue(b,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,d=3*b;this.binding.getValue(a,d);for(var c=b;c!==d;++c)a[c]=a[d+c%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, +b,d,c,h){if(.5<=c)for(c=0;c!==h;++c)a[b+c]=a[d+c]},_slerp:function(a,b,d,c){k.slerpFlat(a,b,a,b,a,d,c)},_lerp:function(a,b,d,c,h){for(var f=1-c,g=0;g!==h;++g){var k=b+g;a[k]=a[k]*f+a[d+g]*c}}});Object.assign(Qe.prototype,{getValue:function(a,b){this.bind();var f=this._bindings[this._targetGroup.nCachedObjects_];void 0!==f&&f.getValue(a,b)},setValue:function(a,b){for(var f=this._bindings,d=this._targetGroup.nCachedObjects_,c=f.length;d!==c;++d)f[d].setValue(a,b)},bind:function(){for(var a=this._bindings, b=this._targetGroup.nCachedObjects_,d=a.length;b!==d;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,d=a.length;b!==d;++b)a[b].unbind()}});Object.assign(La,{Composite:Qe,create:function(a,b,d){return a&&a.isAnimationObjectGroup?new La.Composite(a,b,d):new La(a,b,d)},sanitizeNodeName:function(a){return a.replace(/\s/g,'_').replace(/[^\w-]/g,'')},parseTrackName:function(){var a=new RegExp('^'+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+ -/\.([\w-]+)(?:\[(.+)\])?/.source+'$'),b=['material','materials','bones'];return function(e){var d=a.exec(e);if(!d)throw Error('PropertyBinding: Cannot parse trackName: '+e);var d={nodeName:d[2],objectName:d[3],objectIndex:d[4],propertyName:d[5],propertyIndex:d[6]},c=d.nodeName&&d.nodeName.lastIndexOf('.');if(void 0!==c&&-1!==c){var h=d.nodeName.substring(c+1);-1!==b.indexOf(h)&&(d.nodeName=d.nodeName.substring(0,c),d.objectName=h)}if(null===d.propertyName||0===d.propertyName.length)throw Error('PropertyBinding: can not parse propertyName from trackName: '+ -e);return d}}(),findNode:function(a,b){if(!b||''===b||'root'===b||'.'===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var e=function(a){for(var e=0;e=b){var g=b++,p=e[g];d[p.uuid]=l;e[l]=p;d[q]=g;e[g]=n;n=0;for(q=h;n!==q;++n){var p=c[n], -t=p[l];p[l]=p[g];p[g]=t}}}this.nCachedObjects_=b},uncache:function(a){for(var e=this._objects,b=e.length,d=this.nCachedObjects_,c=this._indicesByUUID,h=this._bindings,f=h.length,k=0,n=arguments.length;k!==n;++k){var q=arguments[k].uuid,l=c[q];if(void 0!==l)if(delete c[q],l=b){var l=b++,p=f[l];d[p.uuid]=e;f[e]=p;d[q]=l;f[l]=n;n=0;for(q=h;n!==q;++n){var p=c[n], +t=p[e];p[e]=p[l];p[l]=t}}}this.nCachedObjects_=b},uncache:function(a){for(var f=this._objects,b=f.length,d=this.nCachedObjects_,c=this._indicesByUUID,h=this._bindings,g=h.length,k=0,n=arguments.length;k!==n;++k){var q=arguments[k].uuid,e=c[q];if(void 0!==e)if(delete c[q],eb||0===d)return;this._startTime=null;b*=d}b*=this._updateTimeScale(a);d=this._updateTime(b);a=this._updateWeight(a);if(0b.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(a){var e=0;if(!this.paused){var e=this.timeScale,b=this._timeScaleInterpolant;if(null!==b){var d=b.evaluate(a)[0], -e=e*d;a>b.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e},_updateTime:function(a){var e=this.time+a;if(0===a)return e;var b=this._clip.duration,d=this.loop,c=this._loopCount;if(2200===d)a:{if(-1===c&&(this._loopCount=0,this._setEndings(!0,!0,!1)),e>=b)e=b;else if(0>e)e=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:'finished',action:this,direction:0>a?-1:1})}else{d=2202===d; --1===c&&(0<=a?(c=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(e>=b||0>e){var h=Math.floor(e/b),e=e-b*h,c=c+Math.abs(h),f=this.repetitions-c;0>f?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=c,this._mixer.dispatchEvent({type:'loop',action:this,loopDelta:h}))}if(d&&1===(c&1))return this.time= -e,b-e}return this.time=e},_setEndings:function(a,b,d){var e=this._interpolantSettings;d?(e.endingStart=2401,e.endingEnd=2401):(e.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,e.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,d){var e=this._mixer,c=e.time,h=this._weightInterpolant;null===h&&(this._weightInterpolant=h=e._lendControlInterpolant());e=h.parameterPositions;h=h.sampleValues;e[0]=c;h[0]=b;e[1]=c+a;h[1]=d;return this}});Object.assign(Te.prototype,g.prototype, -{_bindAction:function(a,b){var e=a._localRoot||this._root,d=a._clip.tracks,c=d.length,h=a._propertyBindings;a=a._interpolants;var f=e.uuid,k=this._bindingsByRootAndName,n=k[f];void 0===n&&(n={},k[f]=n);for(k=0;k!==c;++k){var q=d[k],l=q.name,g=n[l];if(void 0===g){g=h[k];if(void 0!==g){null===g._cacheIndex&&(++g.referenceCount,this._addInactiveBinding(g,f,l));continue}g=new qe(La.create(e,l,b&&b._propertyBindings[k].binding.parsedPath),q.ValueTypeName,q.getValueSize());++g.referenceCount;this._addInactiveBinding(g, -f,l)}h[k]=g;a[k].resultBuffer=g.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var e=(a._localRoot||this._root).uuid,b=a._clip.uuid,d=this._actionsByClip[b];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,b,e)}e=a._propertyBindings;b=0;for(d=e.length;b!==d;++b){var c=e[b];0===c.useCount++&&(this._lendBinding(c),c.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var e=a._propertyBindings, -b=0,d=e.length;b!==d;++b){var c=e[b];0===--c.useCount&&(c.restoreOriginalState(),this._takeBackBinding(c))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length}, -get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&ab||0===d)return;this._startTime=null;b*=d}b*=this._updateTimeScale(a);d=this._updateTime(b);a=this._updateWeight(a);if(0b.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=f},_updateTimeScale:function(a){var f=0;if(!this.paused){var f=this.timeScale,b=this._timeScaleInterpolant;if(null!==b){var d=b.evaluate(a)[0], +f=f*d;a>b.parameterPositions[1]&&(this.stopWarping(),0===f?this.paused=!0:this.timeScale=f)}}return this._effectiveTimeScale=f},_updateTime:function(a){var f=this.time+a;if(0===a)return f;var b=this._clip.duration,d=this.loop,c=this._loopCount;if(2200===d)a:{if(-1===c&&(this._loopCount=0,this._setEndings(!0,!0,!1)),f>=b)f=b;else if(0>f)f=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:'finished',action:this,direction:0>a?-1:1})}else{d=2202===d; +-1===c&&(0<=a?(c=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(f>=b||0>f){var h=Math.floor(f/b),f=f-b*h,c=c+Math.abs(h),g=this.repetitions-c;0>g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,f=0a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=c,this._mixer.dispatchEvent({type:'loop',action:this,loopDelta:h}))}if(d&&1===(c&1))return this.time= +f,b-f}return this.time=f},_setEndings:function(a,b,d){var f=this._interpolantSettings;d?(f.endingStart=2401,f.endingEnd=2401):(f.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,f.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,d){var f=this._mixer,c=f.time,h=this._weightInterpolant;null===h&&(this._weightInterpolant=h=f._lendControlInterpolant());f=h.parameterPositions;h=h.sampleValues;f[0]=c;h[0]=b;f[1]=c+a;h[1]=d;return this}});Object.assign(Te.prototype,e.prototype, +{_bindAction:function(a,b){var f=a._localRoot||this._root,d=a._clip.tracks,c=d.length,h=a._propertyBindings;a=a._interpolants;var g=f.uuid,k=this._bindingsByRootAndName,n=k[g];void 0===n&&(n={},k[g]=n);for(k=0;k!==c;++k){var q=d[k],e=q.name,l=n[e];if(void 0===l){l=h[k];if(void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,g,e));continue}l=new qe(La.create(f,e,b&&b._propertyBindings[k].binding.parsedPath),q.ValueTypeName,q.getValueSize());++l.referenceCount;this._addInactiveBinding(l, +g,e)}h[k]=l;a[k].resultBuffer=l.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var f=(a._localRoot||this._root).uuid,b=a._clip.uuid,d=this._actionsByClip[b];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,b,f)}f=a._propertyBindings;b=0;for(d=f.length;b!==d;++b){var c=f[b];0===c.useCount++&&(this._lendBinding(c),c.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var f=a._propertyBindings, +b=0,d=f.length;b!==d;++b){var c=f[b];0===--c.useCount&&(c.restoreOriginalState(),this._takeBackBinding(c))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length}, +get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&ak.end&&(k.end=h);b||(b=n)}}for(n in d)k=d[n],this.createAnimation(n,k.start,k.end,a);this.firstAnimation=b};Ha.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};Ha.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};Ha.prototype.setAnimationFPS=function(a,b){(a=this.animationsMap[a])&&(a.fps=b,a.duration=(a.end-a.start)/a.fps)};Ha.prototype.setAnimationDuration= -function(a,b){(a=this.animationsMap[a])&&(a.duration=b,a.fps=(a.end-a.start)/a.duration)};Ha.prototype.setAnimationWeight=function(a,b){(a=this.animationsMap[a])&&(a.weight=b)};Ha.prototype.setAnimationTime=function(a,b){(a=this.animationsMap[a])&&(a.time=b)};Ha.prototype.getAnimationTime=function(a){var e=0;if(a=this.animationsMap[a])e=a.time;return e};Ha.prototype.getAnimationDuration=function(a){var e=-1;if(a=this.animationsMap[a])e=a.duration;return e};Ha.prototype.playAnimation=function(a){var e= -this.animationsMap[a];e?(e.time=0,e.active=!0):console.warn('THREE.MorphBlendMesh: animation['+a+'] undefined in .playAnimation()')};Ha.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};Ha.prototype.update=function(a){for(var e=0,b=this.animationsList.length;ed.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards= -!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var h=d.start+ka.clamp(Math.floor(d.time/c),0,d.length-1),f=d.weight;h!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*f,this.morphTargetInfluences[h]=0,d.lastFrame=d.currentFrame,d.currentFrame=h);c=d.time%c/c;d.directionBackwards&&(c=1-c);d.currentFrame!==d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=c*f,this.morphTargetInfluences[d.lastFrame]= -(1-c)*f):this.morphTargetInfluences[d.currentFrame]=f}}};id.prototype=Object.create(ba.prototype);id.prototype.constructor=id;id.prototype.isImmediateRenderObject=!0;jd.prototype=Object.create(sa.prototype);jd.prototype.constructor=jd;jd.prototype.update=function(){var a=new n,b=new n,d=new ra;return function(){var e=['a','b','c'];this.object.updateMatrixWorld(!0);d.getNormalMatrix(this.object.matrixWorld);var c=this.object.matrixWorld,h=this.geometry.attributes.position,f=this.object.geometry;if(f&& -f.isGeometry)for(var k=f.vertices,n=f.faces,q=f=0,l=n.length;qd.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards= +!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var h=d.start+ka.clamp(Math.floor(d.time/c),0,d.length-1),g=d.weight;h!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[h]=0,d.lastFrame=d.currentFrame,d.currentFrame=h);c=d.time%c/c;d.directionBackwards&&(c=1-c);d.currentFrame!==d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=c*g,this.morphTargetInfluences[d.lastFrame]= +(1-c)*g):this.morphTargetInfluences[d.currentFrame]=g}}};id.prototype=Object.create(ba.prototype);id.prototype.constructor=id;id.prototype.isImmediateRenderObject=!0;jd.prototype=Object.create(sa.prototype);jd.prototype.constructor=jd;jd.prototype.update=function(){var a=new n,b=new n,d=new ra;return function(){var f=['a','b','c'];this.object.updateMatrixWorld(!0);d.getNormalMatrix(this.object.matrixWorld);var c=this.object.matrixWorld,h=this.geometry.attributes.position,g=this.object.geometry;if(g&& +g.isGeometry)for(var k=g.vertices,n=g.faces,q=g=0,e=n.length;qMath.abs(a)&&(a=1E-8);this.scale.set(.5*this.size,.5*this.size,a);this.lookAt(this.plane.normal); -this.updateMatrixWorld()};var Td,we;Ub.prototype=Object.create(ba.prototype);Ub.prototype.constructor=Ub;Ub.prototype.setDirection=function(){var a=new n,b;return function(e){.99999e.y?this.quaternion.set(1,0,0,0):(a.set(e.z,0,-e.x).normalize(),b=Math.acos(e.y),this.quaternion.setFromAxisAngle(a,b))}}();Ub.prototype.setLength=function(a,b,d){void 0===b&&(b=.2*a);void 0===d&&(d=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(d, -b,d);this.cone.position.y=a;this.cone.updateMatrix()};Ub.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};Ud.prototype=Object.create(sa.prototype);Ud.prototype.constructor=Ud;var Xd=new n,Ae=new xe,Be=new xe,Ce=new xe;lb.prototype=Object.create(Pa.prototype);lb.prototype.constructor=lb;lb.prototype.getPoint=function(a){var e=this.points,b=e.length;a*=b-(this.closed?0:1);var d=Math.floor(a);a-=d;this.closed?d+=0d&&(d=1);1E-4>b&&(b=d);1E-4>k&&(k=d);Ae.initNonuniformCatmullRom(c.x, -h.x,f.x,e.x,b,d,k);Be.initNonuniformCatmullRom(c.y,h.y,f.y,e.y,b,d,k);Ce.initNonuniformCatmullRom(c.z,h.z,f.z,e.z,b,d,k)}else'catmullrom'===this.type&&(b=void 0!==this.tension?this.tension:.5,Ae.initCatmullRom(c.x,h.x,f.x,e.x,b),Be.initCatmullRom(c.y,h.y,f.y,e.y,b),Ce.initCatmullRom(c.z,h.z,f.z,e.z,b));return new n(Ae.calc(a),Be.calc(a),Ce.calc(a))};pd.prototype=Object.create(Pa.prototype);pd.prototype.constructor=pd;pd.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2,c=this.v3;return new n(Qb(a, -e.x,b.x,d.x,c.x),Qb(a,e.y,b.y,d.y,c.y),Qb(a,e.z,b.z,d.z,c.z))};qd.prototype=Object.create(Pa.prototype);qd.prototype.constructor=qd;qd.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2;return new n(Pb(a,e.x,b.x,d.x),Pb(a,e.y,b.y,d.y),Pb(a,e.z,b.z,d.z))};rd.prototype=Object.create(Pa.prototype);rd.prototype.constructor=rd;rd.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var e=new n;e.subVectors(this.v2,this.v1);e.multiplyScalar(a);e.add(this.v1);return e};Vd.prototype= +this.updateMatrixWorld()};var Td,we;Ub.prototype=Object.create(ba.prototype);Ub.prototype.constructor=Ub;Ub.prototype.setDirection=function(){var a=new n,b;return function(f){.99999f.y?this.quaternion.set(1,0,0,0):(a.set(f.z,0,-f.x).normalize(),b=Math.acos(f.y),this.quaternion.setFromAxisAngle(a,b))}}();Ub.prototype.setLength=function(a,b,d){void 0===b&&(b=.2*a);void 0===d&&(d=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(d, +b,d);this.cone.position.y=a;this.cone.updateMatrix()};Ub.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};Ud.prototype=Object.create(sa.prototype);Ud.prototype.constructor=Ud;var Xd=new n,Ae=new xe,Be=new xe,Ce=new xe;lb.prototype=Object.create(Pa.prototype);lb.prototype.constructor=lb;lb.prototype.getPoint=function(a){var f=this.points,b=f.length;a*=b-(this.closed?0:1);var d=Math.floor(a);a-=d;this.closed?d+=0d&&(d=1);1E-4>b&&(b=d);1E-4>k&&(k=d);Ae.initNonuniformCatmullRom(c.x, +h.x,g.x,f.x,b,d,k);Be.initNonuniformCatmullRom(c.y,h.y,g.y,f.y,b,d,k);Ce.initNonuniformCatmullRom(c.z,h.z,g.z,f.z,b,d,k)}else'catmullrom'===this.type&&(b=void 0!==this.tension?this.tension:.5,Ae.initCatmullRom(c.x,h.x,g.x,f.x,b),Be.initCatmullRom(c.y,h.y,g.y,f.y,b),Ce.initCatmullRom(c.z,h.z,g.z,f.z,b));return new n(Ae.calc(a),Be.calc(a),Ce.calc(a))};pd.prototype=Object.create(Pa.prototype);pd.prototype.constructor=pd;pd.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2,c=this.v3;return new n(Qb(a, +f.x,b.x,d.x,c.x),Qb(a,f.y,b.y,d.y,c.y),Qb(a,f.z,b.z,d.z,c.z))};qd.prototype=Object.create(Pa.prototype);qd.prototype.constructor=qd;qd.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2;return new n(Pb(a,f.x,b.x,d.x),Pb(a,f.y,b.y,d.y),Pb(a,f.z,b.z,d.z))};rd.prototype=Object.create(Pa.prototype);rd.prototype.constructor=rd;rd.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var f=new n;f.subVectors(this.v2,this.v1);f.multiplyScalar(a);f.add(this.v1);return f};Vd.prototype= Object.create(wb.prototype);Vd.prototype.constructor=Vd;Pa.create=function(a,b){console.log('THREE.Curve.create() has been deprecated');a.prototype=Object.create(Pa.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};$e.prototype=Object.create(lb.prototype);af.prototype=Object.create(lb.prototype);ye.prototype=Object.create(lb.prototype);Object.assign(ye.prototype,{initFromArray:function(a){console.error('THREE.Spline: .initFromArray() has been removed.')},getControlPointsArray:function(a){console.error('THREE.Spline: .getControlPointsArray() has been removed.')}, reparametrizeByArcLength:function(a){console.error('THREE.Spline: .reparametrizeByArcLength() has been removed.')}});kd.prototype.setColors=function(){console.error('THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.')};Bc.prototype.update=function(){console.error('THREE.SkeletonHelper: update() no longer needs to be called.')};Object.assign(na.prototype,{center:function(a){console.warn('THREE.Box2: .center() has been renamed to .getCenter().');return this.getCenter(a)}, empty:function(){console.warn('THREE.Box2: .empty() has been renamed to .isEmpty().');return this.isEmpty()},isIntersectionBox:function(a){console.warn('THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().');return this.intersectsBox(a)},size:function(a){console.warn('THREE.Box2: .size() has been renamed to .getSize().');return this.getSize(a)}});Object.assign(ia.prototype,{center:function(a){console.warn('THREE.Box3: .center() has been renamed to .getCenter().');return this.getCenter(a)}, @@ -825,7 +825,7 @@ return this.copyPosition(a)},flattenToArrayOffset:function(a,b){console.warn('TH return this.makeRotationFromQuaternion(a)},multiplyToArray:function(){console.warn('THREE.Matrix4: .multiplyToArray() has been removed.')},multiplyVector3:function(a){console.warn('THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.');return a.applyMatrix4(this)},multiplyVector4:function(a){console.warn('THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.');return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.error('THREE.Matrix4: .multiplyVector3Array() has been removed.')}, rotateAxis:function(a){console.warn('THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.');a.transformDirection(this)},crossVector:function(a){console.warn('THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.');return a.applyMatrix4(this)},translate:function(){console.error('THREE.Matrix4: .translate() has been removed.')},rotateX:function(){console.error('THREE.Matrix4: .rotateX() has been removed.')},rotateY:function(){console.error('THREE.Matrix4: .rotateY() has been removed.')}, rotateZ:function(){console.error('THREE.Matrix4: .rotateZ() has been removed.')},rotateByAxis:function(){console.error('THREE.Matrix4: .rotateByAxis() has been removed.')},applyToBuffer:function(a,b,d){console.warn('THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.');return this.applyToBufferAttribute(a)},applyToVector3Array:function(a,b,d){console.error('THREE.Matrix4: .applyToVector3Array() has been removed.')},makeFrustum:function(a,b,d,c, -h,f){console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.');return this.makePerspective(a,b,c,d,h,f)}});Aa.prototype.isIntersectionLine=function(a){console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().');return this.intersectsLine(a)};k.prototype.multiplyVector3=function(a){console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.'); +h,g){console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.');return this.makePerspective(a,b,c,d,h,g)}});Aa.prototype.isIntersectionLine=function(a){console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().');return this.intersectsLine(a)};k.prototype.multiplyVector3=function(a){console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.'); return a.applyQuaternion(this)};Object.assign(eb.prototype,{isIntersectionBox:function(a){console.warn('THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().');return this.intersectsBox(a)},isIntersectionPlane:function(a){console.warn('THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().');return this.intersectsPlane(a)},isIntersectionSphere:function(a){console.warn('THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().');return this.intersectsSphere(a)}}); Object.assign(Sb.prototype,{extrude:function(a){console.warn('THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.');return new Bb(this,a)},makeGeometry:function(a){console.warn('THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.');return new nc(this,a)}});Object.assign(m.prototype,{fromAttribute:function(a,b,d){console.error('THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().');return this.fromBufferAttribute(a,b,d)}});Object.assign(n.prototype, {setEulerFromRotationMatrix:function(){console.error('THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.')},setEulerFromQuaternion:function(){console.error('THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.')},getPositionFromMatrix:function(a){console.warn('THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().');return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn('THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().'); @@ -847,18 +847,18 @@ return this.extensions.get('OES_standard_derivatives')},supportsCompressedTextur supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get('EXT_blend_minmax')},supportsVertexTextures:function(){console.warn('THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.');return this.capabilities.vertexTextures},supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."); return this.extensions.get('ANGLE_instanced_arrays')},enableScissorTest:function(a){console.warn('THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().');this.setScissorTest(a)},initMaterial:function(){console.warn('THREE.WebGLRenderer: .initMaterial() has been removed.')},addPrePlugin:function(){console.warn('THREE.WebGLRenderer: .addPrePlugin() has been removed.')},addPostPlugin:function(){console.warn('THREE.WebGLRenderer: .addPostPlugin() has been removed.')},updateShadowMap:function(){console.warn('THREE.WebGLRenderer: .updateShadowMap() has been removed.')}}); Object.defineProperties(ce.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn('THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.');this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn('THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.');this.shadowMap.type=a}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(a){console.warn('THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.'); -this.shadowMap.cullFace=a}}});Object.defineProperties(td.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a;console.warn('WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to '+a+'.');this.renderReverseSided=a}}});Object.defineProperties(f.prototype,{wrapS:{get:function(){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');return this.texture.wrapS},set:function(a){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); +this.shadowMap.cullFace=a}}});Object.defineProperties(td.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a;console.warn('WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to '+a+'.');this.renderReverseSided=a}}});Object.defineProperties(g.prototype,{wrapS:{get:function(){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');return this.texture.wrapS},set:function(a){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); this.texture.wrapS=a}},wrapT:{get:function(){console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');return this.texture.wrapT},set:function(a){console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');this.texture.wrapT=a}},magFilter:{get:function(){console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');return this.texture.magFilter},set:function(a){console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');this.texture.magFilter= a}},minFilter:{get:function(){console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');return this.texture.minFilter},set:function(a){console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');this.texture.minFilter=a}},anisotropy:{get:function(){console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');return this.texture.anisotropy},set:function(a){console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');this.texture.anisotropy= a}},offset:{get:function(){console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');return this.texture.offset},set:function(a){console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');this.texture.offset=a}},repeat:{get:function(){console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');return this.texture.repeat},set:function(a){console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');this.texture.repeat=a}},format:{get:function(){console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'); return this.texture.format},set:function(a){console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.');this.texture.format=a}},type:{get:function(){console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');return this.texture.type},set:function(a){console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');this.texture.type=a}},generateMipmaps:{get:function(){console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');return this.texture.generateMipmaps}, set:function(a){console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');this.texture.generateMipmaps=a}}});yc.prototype.load=function(a){console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.');var b=this;(new le).load(a,function(a){b.setBuffer(a)});return this};pe.prototype.getData=function(){console.warn('THREE.AudioAnalyser: .getData() is now .getFrequencyData().');return this.getFrequencyData()};a.WebGLRenderTargetCube=c;a.WebGLRenderTarget= -f;a.WebGLRenderer=ce;a.ShaderLib=yb;a.UniformsLib=ja;a.UniformsUtils=Oa;a.ShaderChunk=ma;a.FogExp2=Zb;a.Fog=$b;a.Scene=vd;a.LensFlare=de;a.Sprite=Jc;a.LOD=Kc;a.SkinnedMesh=xd;a.Skeleton=Lc;a.Bone=wd;a.Mesh=ya;a.LineSegments=sa;a.LineLoop=yd;a.Line=Ta;a.Points=ac;a.Group=Mc;a.VideoTexture=zd;a.DataTexture=t;a.CompressedTexture=bc;a.CubeTexture=h;a.CanvasTexture=ca;a.DepthTexture=Nc;a.Texture=b;a.CompressedTextureLoader=Le;a.DataTextureLoader=fe;a.CubeTextureLoader=ge;a.TextureLoader=Ad;a.ObjectLoader= +g;a.WebGLRenderer=ce;a.ShaderLib=yb;a.UniformsLib=ja;a.UniformsUtils=Oa;a.ShaderChunk=ma;a.FogExp2=Zb;a.Fog=$b;a.Scene=vd;a.LensFlare=de;a.Sprite=Jc;a.LOD=Kc;a.SkinnedMesh=xd;a.Skeleton=Lc;a.Bone=wd;a.Mesh=ya;a.LineSegments=sa;a.LineLoop=yd;a.Line=Ta;a.Points=ac;a.Group=Mc;a.VideoTexture=zd;a.DataTexture=t;a.CompressedTexture=bc;a.CubeTexture=h;a.CanvasTexture=ca;a.DepthTexture=Nc;a.Texture=b;a.CompressedTextureLoader=Le;a.DataTextureLoader=fe;a.CubeTextureLoader=ge;a.TextureLoader=Ad;a.ObjectLoader= Me;a.MaterialLoader=Pd;a.BufferGeometryLoader=he;a.DefaultLoadingManager=Wa;a.LoadingManager=ee;a.JSONLoader=ie;a.ImageLoader=dd;a.FontLoader=Oe;a.FileLoader=kb;a.Loader=vc;a.Cache=sd;a.AudioLoader=le;a.SpotLightShadow=Cd;a.SpotLight=Dd;a.PointLight=Ed;a.RectAreaLight=Id;a.HemisphereLight=Bd;a.DirectionalLightShadow=Fd;a.DirectionalLight=Gd;a.AmbientLight=Hd;a.LightShadow=Mb;a.Light=za;a.StereoCamera=Pe;a.PerspectiveCamera=xa;a.OrthographicCamera=Qa;a.CubeCamera=Qd;a.ArrayCamera=ud;a.Camera=Ea;a.AudioListener= me;a.PositionalAudio=oe;a.AudioContext=ne;a.AudioAnalyser=pe;a.Audio=yc;a.VectorKeyframeTrack=tc;a.StringKeyframeTrack=Md;a.QuaternionKeyframeTrack=fd;a.NumberKeyframeTrack=uc;a.ColorKeyframeTrack=Od;a.BooleanKeyframeTrack=Nd;a.PropertyMixer=qe;a.PropertyBinding=La;a.KeyframeTrack=Ob;a.AnimationUtils=Ka;a.AnimationObjectGroup=Re;a.AnimationMixer=Te;a.AnimationClip=bb;a.Uniform=Rd;a.InstancedBufferGeometry=re;a.BufferGeometry=da;a.GeometryIdCount=function(){return $d++};a.Geometry=aa;a.InterleavedBufferAttribute= -se;a.InstancedInterleavedBuffer=te;a.InterleavedBuffer=zc;a.InstancedBufferAttribute=ue;a.Face3=cb;a.Object3D=ba;a.Raycaster=Ue;a.Layers=Gc;a.EventDispatcher=g;a.Clock=We;a.QuaternionLinearInterpolant=Ld;a.LinearInterpolant=ed;a.DiscreteInterpolant=Kd;a.CubicInterpolant=Jd;a.Interpolant=Xa;a.Triangle=ab;a.Math=ka;a.Spherical=Xe;a.Cylindrical=Ye;a.Plane=Aa;a.Frustum=Vb;a.Sphere=qa;a.Ray=eb;a.Matrix4=p;a.Matrix3=ra;a.Box3=ia;a.Box2=na;a.Line3=fb;a.Euler=nb;a.Vector4=l;a.Vector3=n;a.Vector2=m;a.Quaternion= +se;a.InstancedInterleavedBuffer=te;a.InterleavedBuffer=zc;a.InstancedBufferAttribute=ue;a.Face3=cb;a.Object3D=ba;a.Raycaster=Ue;a.Layers=Gc;a.EventDispatcher=e;a.Clock=We;a.QuaternionLinearInterpolant=Ld;a.LinearInterpolant=ed;a.DiscreteInterpolant=Kd;a.CubicInterpolant=Jd;a.Interpolant=Xa;a.Triangle=ab;a.Math=ka;a.Spherical=Xe;a.Cylindrical=Ye;a.Plane=Aa;a.Frustum=Vb;a.Sphere=qa;a.Ray=eb;a.Matrix4=p;a.Matrix3=ra;a.Box3=ia;a.Box2=na;a.Line3=fb;a.Euler=nb;a.Vector4=l;a.Vector3=n;a.Vector2=m;a.Quaternion= k;a.Color=Y;a.MorphBlendMesh=Ha;a.ImmediateRenderObject=id;a.VertexNormalsHelper=jd;a.SpotLightHelper=Ac;a.SkeletonHelper=Bc;a.PointLightHelper=Cc;a.RectAreaLightHelper=Dc;a.HemisphereLightHelper=Ec;a.GridHelper=kd;a.PolarGridHelper=Sd;a.FaceNormalsHelper=ld;a.DirectionalLightHelper=Fc;a.CameraHelper=md;a.BoxHelper=Tb;a.Box3Helper=nd;a.PlaneHelper=od;a.ArrowHelper=Ub;a.AxisHelper=Ud;a.CatmullRomCurve3=lb;a.CubicBezierCurve3=pd;a.QuadraticBezierCurve3=qd;a.LineCurve3=rd;a.ArcCurve=Vd;a.EllipseCurve= -wb;a.SplineCurve=Rb;a.CubicBezierCurve=wc;a.QuadraticBezierCurve=xc;a.LineCurve=ub;a.Shape=Sb;a.Path=hd;a.ShapePath=je;a.Font=ke;a.CurvePath=gd;a.Curve=Pa;a.ShapeUtils=ib;a.SceneUtils={createMultiMaterialObject:function(a,b){for(var e=new Mc,d=0,c=b.length;d=m[b])return b-1;if(g<=m[a])return a;for(var l=Math.floor((a+b)/2);g=m[l+1];)g=p&&(l[g][0]=l[a][0]/n[v+1][h],t=l[g][0]*n[h][v]);w=d-1<=v?p-1:m-d;for(c=-1<=h?1:-h;c<=w;++c)l[g][c]=(l[a][c]-l[a][c-1])/n[v+1][h+c],t+=l[g][c]*n[h+c][v];d<=v&&(l[g][p]=-l[a][p-1]/n[v+1][d],t+=l[g][p]*n[d][v]);k[p][d]=t;c=a;a=g;g=c}}d=m;for(p=1;p<=b;++p){for(c=0;c<=m;++c)k[p][c]*=d;d*=m-p}return k},calcBSplineDerivatives:function(a,g,m,b,l){var f=l (http://steffe.se)',keywords:['cannon.js','cannon','physics','engine','3d'],main:'./build/cannon.js',engines:{node:'*'},repository:{type:'git',url:'https://github.com/schteppe/cannon.js.git'}, -bugs:{url:'https://github.com/schteppe/cannon.js/issues'},licenses:[{type:'MIT'}],devDependencies:{jshint:'latest','uglify-js':'latest',nodeunit:'^0.9.0',grunt:'~0.4.0','grunt-contrib-jshint':'~0.1.1','grunt-contrib-nodeunit':'^0.4.1','grunt-contrib-concat':'~0.1.3','grunt-contrib-uglify':'^0.5.1','grunt-browserify':'^2.1.4','grunt-contrib-yuidoc':'^0.5.2',browserify:'*'},dependencies:{}}},{}],2:[function(g,m){m.exports={version:g('../package.json').version,AABB:g('./collision/AABB'),ArrayCollisionMatrix:g('./collision/ArrayCollisionMatrix'), -Body:g('./objects/Body'),Box:g('./shapes/Box'),Broadphase:g('./collision/Broadphase'),Constraint:g('./constraints/Constraint'),ContactEquation:g('./equations/ContactEquation'),Narrowphase:g('./world/Narrowphase'),ConeTwistConstraint:g('./constraints/ConeTwistConstraint'),ContactMaterial:g('./material/ContactMaterial'),ConvexPolyhedron:g('./shapes/ConvexPolyhedron'),Cylinder:g('./shapes/Cylinder'),DistanceConstraint:g('./constraints/DistanceConstraint'),Equation:g('./equations/Equation'),EventTarget:g('./utils/EventTarget'), -FrictionEquation:g('./equations/FrictionEquation'),GSSolver:g('./solver/GSSolver'),GridBroadphase:g('./collision/GridBroadphase'),Heightfield:g('./shapes/Heightfield'),HingeConstraint:g('./constraints/HingeConstraint'),LockConstraint:g('./constraints/LockConstraint'),Mat3:g('./math/Mat3'),Material:g('./material/Material'),NaiveBroadphase:g('./collision/NaiveBroadphase'),ObjectCollisionMatrix:g('./collision/ObjectCollisionMatrix'),Pool:g('./utils/Pool'),Particle:g('./shapes/Particle'),Plane:g('./shapes/Plane'), -PointToPointConstraint:g('./constraints/PointToPointConstraint'),Quaternion:g('./math/Quaternion'),Ray:g('./collision/Ray'),RaycastVehicle:g('./objects/RaycastVehicle'),RaycastResult:g('./collision/RaycastResult'),RigidVehicle:g('./objects/RigidVehicle'),RotationalEquation:g('./equations/RotationalEquation'),RotationalMotorEquation:g('./equations/RotationalMotorEquation'),SAPBroadphase:g('./collision/SAPBroadphase'),SPHSystem:g('./objects/SPHSystem'),Shape:g('./shapes/Shape'),Solver:g('./solver/Solver'), -Sphere:g('./shapes/Sphere'),SplitSolver:g('./solver/SplitSolver'),Spring:g('./objects/Spring'),Trimesh:g('./shapes/Trimesh'),Vec3:g('./math/Vec3'),Vec3Pool:g('./utils/Vec3Pool'),World:g('./world/World')}},{'../package.json':1,'./collision/AABB':3,'./collision/ArrayCollisionMatrix':4,'./collision/Broadphase':5,'./collision/GridBroadphase':6,'./collision/NaiveBroadphase':7,'./collision/ObjectCollisionMatrix':8,'./collision/Ray':9,'./collision/RaycastResult':10,'./collision/SAPBroadphase':11,'./constraints/ConeTwistConstraint':12, +THREE.NURBSSurface=function(a,e,m,b,l){this.degree1=a;this.degree2=e;this.knots1=m;this.knots2=b;this.controlPoints=[];a=m.length-a-1;e=b.length-e-1;for(b=0;b=m[b])return b-1;if(e<=m[a])return a;for(var l=Math.floor((a+b)/2);e=m[l+1];)e=p&&(l[e][0]=l[a][0]/n[v+1][h],t=l[e][0]*n[h][v]);w=d-1<=v?p-1:m-d;for(c=-1<=h?1:-h;c<=w;++c)l[e][c]=(l[a][c]-l[a][c-1])/n[v+1][h+c],t+=l[e][c]*n[h+c][v];d<=v&&(l[e][p]=-l[a][p-1]/n[v+1][d],t+=l[e][p]*n[d][v]);k[p][d]=t;c=a;a=e;e=c}}d=m;for(p=1;p<=b;++p){for(c=0;c<=m;++c)k[p][c]*=d;d*=m-p}return k},calcBSplineDerivatives:function(a,e,m,b,l){var g=l (http://steffe.se)',keywords:['cannon.js','cannon','physics','engine','3d'],main:'./build/cannon.js',engines:{node:'*'},repository:{type:'git',url:'https://github.com/schteppe/cannon.js.git'}, +bugs:{url:'https://github.com/schteppe/cannon.js/issues'},licenses:[{type:'MIT'}],devDependencies:{jshint:'latest','uglify-js':'latest',nodeunit:'^0.9.0',grunt:'~0.4.0','grunt-contrib-jshint':'~0.1.1','grunt-contrib-nodeunit':'^0.4.1','grunt-contrib-concat':'~0.1.3','grunt-contrib-uglify':'^0.5.1','grunt-browserify':'^2.1.4','grunt-contrib-yuidoc':'^0.5.2',browserify:'*'},dependencies:{}}},{}],2:[function(e,m){m.exports={version:e('../package.json').version,AABB:e('./collision/AABB'),ArrayCollisionMatrix:e('./collision/ArrayCollisionMatrix'), +Body:e('./objects/Body'),Box:e('./shapes/Box'),Broadphase:e('./collision/Broadphase'),Constraint:e('./constraints/Constraint'),ContactEquation:e('./equations/ContactEquation'),Narrowphase:e('./world/Narrowphase'),ConeTwistConstraint:e('./constraints/ConeTwistConstraint'),ContactMaterial:e('./material/ContactMaterial'),ConvexPolyhedron:e('./shapes/ConvexPolyhedron'),Cylinder:e('./shapes/Cylinder'),DistanceConstraint:e('./constraints/DistanceConstraint'),Equation:e('./equations/Equation'),EventTarget:e('./utils/EventTarget'), +FrictionEquation:e('./equations/FrictionEquation'),GSSolver:e('./solver/GSSolver'),GridBroadphase:e('./collision/GridBroadphase'),Heightfield:e('./shapes/Heightfield'),HingeConstraint:e('./constraints/HingeConstraint'),LockConstraint:e('./constraints/LockConstraint'),Mat3:e('./math/Mat3'),Material:e('./material/Material'),NaiveBroadphase:e('./collision/NaiveBroadphase'),ObjectCollisionMatrix:e('./collision/ObjectCollisionMatrix'),Pool:e('./utils/Pool'),Particle:e('./shapes/Particle'),Plane:e('./shapes/Plane'), +PointToPointConstraint:e('./constraints/PointToPointConstraint'),Quaternion:e('./math/Quaternion'),Ray:e('./collision/Ray'),RaycastVehicle:e('./objects/RaycastVehicle'),RaycastResult:e('./collision/RaycastResult'),RigidVehicle:e('./objects/RigidVehicle'),RotationalEquation:e('./equations/RotationalEquation'),RotationalMotorEquation:e('./equations/RotationalMotorEquation'),SAPBroadphase:e('./collision/SAPBroadphase'),SPHSystem:e('./objects/SPHSystem'),Shape:e('./shapes/Shape'),Solver:e('./solver/Solver'), +Sphere:e('./shapes/Sphere'),SplitSolver:e('./solver/SplitSolver'),Spring:e('./objects/Spring'),Trimesh:e('./shapes/Trimesh'),Vec3:e('./math/Vec3'),Vec3Pool:e('./utils/Vec3Pool'),World:e('./world/World')}},{'../package.json':1,'./collision/AABB':3,'./collision/ArrayCollisionMatrix':4,'./collision/Broadphase':5,'./collision/GridBroadphase':6,'./collision/NaiveBroadphase':7,'./collision/ObjectCollisionMatrix':8,'./collision/Ray':9,'./collision/RaycastResult':10,'./collision/SAPBroadphase':11,'./constraints/ConeTwistConstraint':12, './constraints/Constraint':13,'./constraints/DistanceConstraint':14,'./constraints/HingeConstraint':15,'./constraints/LockConstraint':16,'./constraints/PointToPointConstraint':17,'./equations/ContactEquation':19,'./equations/Equation':20,'./equations/FrictionEquation':21,'./equations/RotationalEquation':22,'./equations/RotationalMotorEquation':23,'./material/ContactMaterial':24,'./material/Material':25,'./math/Mat3':27,'./math/Quaternion':28,'./math/Vec3':30,'./objects/Body':31,'./objects/RaycastVehicle':32, -'./objects/RigidVehicle':33,'./objects/SPHSystem':34,'./objects/Spring':35,'./shapes/Box':37,'./shapes/ConvexPolyhedron':38,'./shapes/Cylinder':39,'./shapes/Heightfield':40,'./shapes/Particle':41,'./shapes/Plane':42,'./shapes/Shape':43,'./shapes/Sphere':44,'./shapes/Trimesh':45,'./solver/GSSolver':46,'./solver/Solver':47,'./solver/SplitSolver':48,'./utils/EventTarget':49,'./utils/Pool':51,'./utils/Vec3Pool':54,'./world/Narrowphase':55,'./world/World':56}],3:[function(g,m){function b(b){b=b||{};this.lowerBound= -new l;b.lowerBound&&this.lowerBound.copy(b.lowerBound);this.upperBound=new l;b.upperBound&&this.upperBound.copy(b.upperBound)}var l=g('../math/Vec3');g('../utils/Utils');m.exports=b;var f=new l;b.prototype.setFromPoints=function(b,c,l,g){var h=this.lowerBound,d=this.upperBound;h.copy(b[0]);l&&l.vmult(h,h);d.copy(h);for(var k=1;kd.x&&(d.x=n.x);n.xd.y&&(d.y=n.y);n.yd.z&&(d.z=n.z);n.zc&&(this.lowerBound.x=c);c=b.upperBound.x;this.upperBound.xc&&(this.lowerBound.y=c);c=b.upperBound.y;this.upperBound.yc&&(this.lowerBound.z=c);c=b.upperBound.z;this.upperBound.z=b.x&&c.y<=k.y&&f.y>= -b.y&&c.z<=k.z&&f.z>=b.z};b.prototype.getCorners=function(b,c,f,l,h,d,g,m){var k=this.lowerBound,n=this.upperBound;b.copy(k);c.set(n.x,k.y,k.z);f.set(n.x,n.y,k.z);l.set(k.x,n.y,n.z);h.set(n.x,k.y,k.z);d.set(k.x,n.y,k.z);g.set(k.x,k.y,n.z);m.copy(n)};var c=[new l,new l,new l,new l,new l,new l,new l,new l];b.prototype.toLocalFrame=function(b,f){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToLocal(n,n)}return f.setFromPoints(c)};b.prototype.toWorldFrame= -function(b,f){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToWorld(n,n)}return f.setFromPoints(c)}},{'../math/Vec3':30,'../utils/Utils':53}],4:[function(g,m){function b(){this.matrix=[]}m.exports=b;b.prototype.get=function(b,f){if(b=b.index,f=f.index,f>b)b=f=b;return this.matrix[(b*(b+1)>>1)+f-1]};b.prototype.set=function(b,f,c){if(b=b.index,f=f.index,f>b)b=f=b;this.matrix[(b*(b+1)>>1)+f-1]=c?1:0};b.prototype.reset=function(){for(var b=0,f=this.matrix.length;b!== -f;b++)this.matrix[b]=0};b.prototype.setNumObjects=function(b){this.matrix.length=b*(b-1)>>1}},{}],5:[function(g,m){function b(){this.world=null;this.useBoundingBoxes=!1;this.dirty=!0}var l=g('../objects/Body'),f=g('../math/Vec3'),c=g('../math/Quaternion');g('../shapes/Shape');g('../shapes/Plane');m.exports=b;b.prototype.collisionPairs=function(){throw Error('collisionPairs not implemented for this BroadPhase class!');};var k=l.STATIC|l.KINEMATIC;b.prototype.needBroadphaseCollision=function(b,d){return 0=== -(b.collisionFilterGroup&d.collisionFilterMask)||0===(d.collisionFilterGroup&b.collisionFilterMask)?!1:0===(b.type&k)&&b.sleepState!==l.SLEEPING||0===(d.type&k)&&d.sleepState!==l.SLEEPING?!0:!1};b.prototype.intersectionTest=function(b,d,c,h){this.useBoundingBoxes?this.doBoundingBoxBroadphase(b,d,c,h):this.doBoundingSphereBroadphase(b,d,c,h)};var n=new f;new f;new c;new f;b.prototype.doBoundingSphereBroadphase=function(b,d,c,h){d.position.vsub(b.position,n);var f=Math.pow(b.boundingRadius+d.boundingRadius, -2),k=n.norm2();f>k&&(c.push(b),h.push(d))};b.prototype.doBoundingBoxBroadphase=function(b,d,c,h){b.aabbNeedsUpdate&&b.computeAABB();d.aabbNeedsUpdate&&d.computeAABB();b.aabb.overlaps(d.aabb)&&(c.push(b),h.push(d))};var p={keys:[]},t=[],h=[];b.prototype.makePairsUnique=function(b,d){for(var c=b.length,f=0;f!==c;f++)t[f]=b[f],h[f]=d[f];b.length=0;for(f=d.length=0;f!==c;f++){var k=t[f].id,n=h[f].id,k=n>k?k+','+n:n+','+k;p[k]=f;p.keys.push(k)}for(f=0;f!==p.keys.length;f++)k=p.keys.pop(),c=p[k],b.push(t[c]), -d.push(h[c]),delete p[k]};b.prototype.setWorld=function(){};var d=new f;b.boundingSphereCheck=function(b,c){return b.position.vsub(c.position,d),Math.pow(b.shape.boundingSphereRadius+c.shape.boundingSphereRadius,2)>d.norm2()};b.prototype.aabbQuery=function(){return console.warn('.aabbQuery is not implemented in this Broadphase subclass.'),[]}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Plane':42,'../shapes/Shape':43}],6:[function(g,m){function b(b,c,k,h,d){l.apply(this); -this.nx=k||10;this.ny=h||10;this.nz=d||10;this.aabbMin=b||new f(100,100,100);this.aabbMax=c||new f(-100,-100,-100);b=this.nx*this.ny*this.nz;if(0>=b)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[];this.binLengths=[];this.bins.length=b;this.binLengths.length=b;for(c=0;b>c;c++)this.bins[c]=[],this.binLengths[c]=0}m.exports=b;var l=g('./Broadphase'),f=g('../math/Vec3'),c=g('../shapes/Shape');b.prototype=new l;b.prototype.constructor=b;var k=new f;new f;b.prototype.collisionPairs=function(b, -f,l){function h(b,d,c,h,f,k,n){b=(b-z)*O|0;d=(d-H)*M|0;c=(c-G)*J|0;h=Z((h-z)*O);f=Z((f-H)*M);k=Z((k-G)*J);0>b?b=0:b>=p&&(b=p-1);0>d?d=0:d>=t&&(d=t-1);0>c?c=0:c>=q&&(c=q-1);0>h?h=0:h>=p&&(h=p-1);0>f?f=0:f>=t&&(f=t-1);0>k?k=0:k>=q&&(k=q-1);b*=u;d*=m;c*=E;h*=u;f*=m;for(k*=E;h>=b;b+=u)for(var l=d;f>=l;l+=m)for(var g=c;k>=g;g+=E){var v=b+l+g;T[v][fa[v]++]=n}}var d=b.numObjects();b=b.bodies;for(var n=this.aabbMax,g=this.aabbMin,p=this.nx,t=this.ny,q=this.nz,u=t*q,m=q,E=1,D=n.x,C=n.y,F=n.z,z=g.x,H=g.y,G= -g.z,O=p/(D-z),M=t/(C-H),J=q/(F-G),D=(D-z)/p,P=(C-H)/t,F=(F-G)/q,N=.5*Math.sqrt(D*D+P*P+F*F),C=c.types,V=C.SPHERE,X=C.PLANE,T=(C.BOX,C.COMPOUND,C.CONVEXPOLYHEDRON,this.bins),fa=this.binLengths,C=this.bins.length,g=0;g!==C;g++)fa[g]=0;for(var Z=Math.ceil,g=Math.min,n=Math.max,g=0;g!==d;g++){var n=b[g],S=n.shape;switch(S.type){case V:var L=n.position.x,U=n.position.y,oa=n.position.z,S=S.radius;h(L-S,U-S,oa-S,L+S,U+S,oa+S,n);break;case X:S.worldNormalNeedsUpdate&&S.computeWorldNormal(n.quaternion);var oa= -S.worldNormal,S=H+.5*P-n.position.y,pa=G+.5*F-n.position.z,R=k;R.set(z+.5*D-n.position.x,S,pa);for(var Y=L=0;L!==p;L++,Y+=u,R.y=S,R.x+=D)for(var na=U=0;U!==t;U++,na+=m,R.z=pa,R.y+=P)for(var la=0,ca=0;la!==q;la++,ca+=E,R.z+=F)if(R.dot(oa)b)b=f=b;return b+'-'+f in this.matrix};b.prototype.set=function(b,f,c){if(b=b.id,f=f.id,f>b)b=f=b;c?this.matrix[b+'-'+f]=!0:delete this.matrix[b+'-'+f]};b.prototype.reset=function(){this.matrix= -{}};b.prototype.setNumObjects=function(){}},{}],9:[function(g,m){function b(d,c){this.from=d?d.clone():new f;this.to=c?c.clone():new f;this._direction=new f;this.precision=1E-4;this.checkCollisionResponse=!0;this.skipBackfaces=!1;this.collisionFilterGroup=this.collisionFilterMask=-1;this.mode=b.ANY;this.result=new k;this.hasHit=!1;this.callback=function(){}}function l(b,c,f,k){k.vsub(c,V);f.vsub(c,h);b.vsub(c,d);var n,q;b=V.dot(V);c=V.dot(h);f=V.dot(d);k=h.dot(h);var l=h.dot(d);return 0<=(n=k*f-c* -l)&&0<=(q=b*l-c*f)&&b*k-c*c>n+q}m.exports=b;var f=g('../math/Vec3');m=g('../math/Quaternion');var c=g('../math/Transform'),k=(g('../shapes/ConvexPolyhedron'),g('../shapes/Box'),g('../collision/RaycastResult')),n=g('../shapes/Shape');g=g('../collision/AABB');b.prototype.constructor=b;b.CLOSEST=1;b.ANY=2;b.ALL=4;var p=new g,t=[];b.prototype.intersectWorld=function(d,c){return this.mode=c.mode||b.ANY,this.result=c.result||new k,this.skipBackfaces=!!c.skipBackfaces,this.collisionFilterMask='undefined'!= -typeof c.collisionFilterMask?c.collisionFilterMask:-1,this.collisionFilterGroup='undefined'!=typeof c.collisionFilterGroup?c.collisionFilterGroup:-1,c.from&&this.from.copy(c.from),c.to&&this.to.copy(c.to),this.callback=c.callback||function(){},this.hasHit=!1,this.result.reset(),this._updateDirection(),this.getAABB(p),t.length=0,d.broadphase.aabbQuery(d,p,t),this.intersectBodies(t),this.hasHit};var h=new f,d=new f;b.pointInTriangle=l;var v=new f,w=new m;b.prototype.intersectBody=function(b,d){d&&(this.result= -d,this._updateDirection());d=this.checkCollisionResponse;if((!d||b.collisionResponse)&&0!==(this.collisionFilterGroup&b.collisionFilterMask)&&0!==(b.collisionFilterGroup&this.collisionFilterMask))for(var c=0,h=b.shapes.length;h>c;c++){var f=b.shapes[c];if((!d||f.collisionResponse)&&(b.quaternion.mult(b.shapeOrientations[c],w),b.quaternion.vmult(b.shapeOffsets[c],v),v.vadd(b.position,v),this.intersectShape(f,w,v,b),this.result._shouldStop))break}};b.prototype.intersectBodies=function(b,d){d&&(this.result= -d,this._updateDirection());d=0;for(var c=b.length;!this.result._shouldStop&&c>d;d++)this.intersectBody(b[d])};b.prototype._updateDirection=function(){this.to.vsub(this.from,this._direction);this._direction.normalize()};b.prototype.intersectShape=function(b,d,c,h){var f=this.from,k=this._direction;c.vsub(f,V);var n=V.dot(k);k.mult(n,X);X.vadd(f,X);c.distanceTo(X)>b.boundingSphereRadius||(f=this[b.type])&&f.call(this,b,d,c,h)};var y=(new f,new f,new f),x=new f,q=new f,u=new f;new f;new k;b.prototype.intersectBox= -function(b,d,c,h){return this.intersectConvex(b.convexPolyhedronRepresentation,d,c,h)};b.prototype[n.types.BOX]=b.prototype.intersectBox;b.prototype.intersectPlane=function(b,d,c,h){var k=this.from,n=this.to,q=this._direction,l=new f(0,0,1);d.vmult(l,l);var g=new f;k.vsub(c,g);d=g.dot(l);n.vsub(c,g);g=g.dot(l);if(!(0m)&&(m=g[0]),(null===t||g[1]u)&&(u=g[1])),null!==p)for(l=[],d.getRectMinMax(p,t,m,u,l),p=(l[0],l[1],p);m>=p;p++)for(l=t;u>=l;l++){if(this.result._shouldStop||(d.getConvexTrianglePillar(p,l,!1),c.pointToWorldFrame(k,h,d.pillarOffset,q),this.intersectConvex(d.pillarConvex, -h,q,n,A),this.result._shouldStop))return;d.getConvexTrianglePillar(p,l,!0);c.pointToWorldFrame(k,h,d.pillarOffset,q);this.intersectConvex(d.pillarConvex,h,q,n,A)}};b.prototype[n.types.HEIGHTFIELD]=b.prototype.intersectHeightfield;var E=new f,D=new f;b.prototype.intersectSphere=function(b,d,c,h){d=this.from;var f=this.to,k=Math.pow(f.x-d.x,2)+Math.pow(f.y-d.y,2)+Math.pow(f.z-d.z,2),n=2*((f.x-d.x)*(d.x-c.x)+(f.y-d.y)*(d.y-c.y)+(f.z-d.z)*(d.z-c.z)),q=Math.pow(n,2)-4*k*(Math.pow(d.x-c.x,2)+Math.pow(d.y- -c.y,2)+Math.pow(d.z-c.z,2)-Math.pow(b.radius,2));if(!(0>q))if(0===q)d.lerp(f,q,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1);else{var l=(-n-Math.sqrt(q))/(2*k),k=(-n+Math.sqrt(q))/(2*k);(0<=l&&1>=l&&(d.lerp(f,l,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1)),this.result._shouldStop)||0<=k&&1>=k&&(d.lerp(f,k,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1))}};b.prototype[n.types.SPHERE]=b.prototype.intersectSphere;var C=new f,F=(new f,new f,new f); -b.prototype.intersectConvex=function(b,d,c,h,f){f=f&&f.faceList||null;for(var k=b.faces,n=b.vertices,g=b.faceNormals,p=this._direction,t=this.from,m=t.distanceTo(this.to),v=f?f.length:k.length,w=this.result,A=0;!w._shouldStop&&v>A;A++){var z=f?f[A]:A,E=k[z],D=g[z],L=d,H=c;F.copy(n[E[0]]);L.vmult(F,F);F.vadd(H,F);F.vsub(t,F);L.vmult(D,C);D=p.dot(C);if(!(Math.abs(D)D)))for(p.mult(D,y),y.vadd(t,y),x.copy(n[E[0]]),L.vmult(x,x),H.vadd(x,x),D=1;!w._shouldStop&&Dm||this.reportIntersection(C,y,b,h,z)}}};b.prototype[n.types.CONVEXPOLYHEDRON]=b.prototype.intersectConvex;var z=new f,H=new f,G=new f,O=new f,M=new f,J=new f,P=(new g,[]),N=new c;b.prototype.intersectTrimesh=function(b,d,h,f,k){k=(k&&k.faceList||null,b.indices);var n=(b.vertices,b.faceNormals,this.from),g=this.to,p=this._direction;N.position.copy(h);N.quaternion.copy(d); -c.vectorToLocalFrame(h,d,p,H);c.pointToLocalFrame(h,d,n,G);c.pointToLocalFrame(h,d,g,O);n=G.distanceSquared(O);b.tree.rayQuery(this,N,P);g=0;for(p=P.length;!this.result._shouldStop&&g!==p;g++){var t=P[g];b.getNormal(t,z);b.getVertex(k[3*t],x);x.vsub(G,F);var m=H.dot(z),m=z.dot(F)/m;0>m||(H.scale(m,y),y.vadd(G,y),b.getVertex(k[3*t+1],q),b.getVertex(k[3*t+2],u),m=y.distanceSquared(G),!l(y,q,x,u)&&!l(y,x,q,u)||m>n||(c.vectorToWorldFrame(d,z,M),c.pointToWorldFrame(h,d,y,J),this.reportIntersection(M,J, -b,f,t)))}P.length=0};b.prototype[n.types.TRIMESH]=b.prototype.intersectTrimesh;b.prototype.reportIntersection=function(d,c,h,f,k){var n=this.from,q=this.to,l=n.distanceTo(c),g=this.result;if(!(this.skipBackfaces&&0c;c++){for(var n=b[c],l=c-1;0<=l&&!(b[l].aabb.lowerBound.x<=n.aabb.lowerBound.x);l--)b[l+1]=b[l];b[l+1]=n}return b};b.insertionSortY=function(b){for(var c=1,f=b.length;f>c;c++){for(var n=b[c],l=c-1;0<=l&&!(b[l].aabb.lowerBound.y<= -n.aabb.lowerBound.y);l--)b[l+1]=b[l];b[l+1]=n}return b};b.insertionSortZ=function(b){for(var c=1,f=b.length;f>c;c++){for(var n=b[c],l=c-1;0<=l&&!(b[l].aabb.lowerBound.z<=n.aabb.lowerBound.z);l--)b[l+1]=b[l];b[l+1]=n}return b};b.prototype.collisionPairs=function(f,c,k){var n,l=this.axisList,g=l.length,h=this.axisIndex;this.dirty&&(this.sortList(),this.dirty=!1);for(f=0;f!==g;f++){var d=l[f];for(n=f+1;g>n;n++){var m=l[n];if(this.needBroadphaseCollision(d,m)){if(!b.checkBounds(d,m,h))break;this.intersectionTest(d, -m,c,k)}}}};b.prototype.sortList=function(){for(var f=this.axisList,c=this.axisIndex,k=f.length,n=0;n!==k;n++){var l=f[n];l.aabbNeedsUpdate&&l.computeAABB()}0===c?b.insertionSortX(f):1===c?b.insertionSortY(f):2===c&&b.insertionSortZ(f)};b.checkBounds=function(b,c,k){var f,l;0===k?(f=b.position.x,l=c.position.x):1===k?(f=b.position.y,l=c.position.y):2===k&&(f=b.position.z,l=c.position.z);return f+b.boundingRadius>l-c.boundingRadius};b.prototype.autoDetectAxis=function(){for(var b=0,c=0,k=0,n=0,l=0, -g=0,h=this.axisList,d=h.length,m=1/d,w=0;w!==d;w++)var y=h[w],x=y.position.x,b=b+x,c=c+x*x,x=y.position.y,k=k+x,n=n+x*x,y=y.position.z,l=l+y,g=g+y*y;b=c-b*b*m;k=n-k*k*m;l=g-l*l*m;this.axisIndex=b>k?b>l?0:2:k>l?1:2};b.prototype.aabbQuery=function(b,c,k){k=k||[];this.dirty&&(this.sortList(),this.dirty=!1);b=this.axisIndex;var f='x';1===b&&(f='y');2===b&&(f='z');b=this.axisList;for(f=(c.lowerBound[f],c.upperBound[f],0);fk;k++)for(var n=0;3>n;n++){for(var l=0,g=0;3>g;g++)l+=f.elements[k+3*g]*this.elements[g+3*n];c.elements[k+3*n]=l}return c};b.prototype.scale=function(f,c){c=c||new b;for(var k=this.elements,n=c.elements,l=0;3!==l;l++)n[3*l+0]=f.x*k[3*l+0],n[3*l+1]=f.y*k[3*l+1],n[3*l+2]=f.z*k[3*l+2];return c};b.prototype.solve=function(b,c){c=c||new l;for(var f=[],n=0;12>n;n++)f.push(0);for(var g,n=0;3>n;n++)for(g=0;3>g;g++)f[n+4*g]=this.elements[n+3*g];f[3]=b.x;f[7]=b.y;f[11]=b.z;var t, -h,d=3,m=d;do{if(n=m-d,0===f[n+4*n])for(g=n+1;m>g;g++)if(0!==f[n+4*g]){t=4;do h=4-t,f[h+4*n]+=f[h+4*g];while(--t);break}if(0!==f[n+4*n])for(g=n+1;m>g;g++){var w=f[n+4*g]/f[n+4*n];t=4;do h=4-t,f[h+4*g]=n>=h?0:f[h+4*g]-f[h+4*n]*w;while(--t)}}while(--d);if(c.z=f[11]/f[10],c.y=(f[7]-f[6]*c.z)/f[5],c.x=(f[3]-f[2]*c.z-f[1]*c.y)/f[0],isNaN(c.x)||isNaN(c.y)||isNaN(c.z)||1/0===c.x||1/0===c.y||1/0===c.z)throw'Could not solve equation! Got x=['+c.toString()+'], b=['+b.toString()+'], A=['+this.toString()+']'; -return c};b.prototype.e=function(b,c,k){return void 0===k?this.elements[c+3*b]:void(this.elements[c+3*b]=k)};b.prototype.copy=function(b){for(var c=0;cc;c++)b+=this.elements[c]+',';return b};b.prototype.reverse=function(f){f=f||new b;for(var c=[],k=0;18>k;k++)c.push(0);for(var n,k=0;3>k;k++)for(n=0;3>n;n++)c[k+6*n]=this.elements[k+3*n];c[3]=1;c[9]=0;c[15]=0;c[4]=0;c[10]=1;c[16]=0; -c[5]=0;c[11]=0;c[17]=1;var l,g,h=3,d=h;do{if(k=d-h,0===c[k+6*k])for(n=k+1;d>n;n++)if(0!==c[k+6*n]){l=6;do g=6-l,c[g+6*k]+=c[g+6*n];while(--l);break}if(0!==c[k+6*k])for(n=k+1;d>n;n++){var m=c[k+6*n]/c[k+6*k];l=6;do g=6-l,c[g+6*n]=k>=g?0:c[g+6*n]-c[g+6*k]*m;while(--l)}}while(--h);k=2;do{n=k-1;do{m=c[k+6*n]/c[k+6*k];l=6;do g=6-l,c[g+6*n]-=c[g+6*k]*m;while(--l)}while(n--)}while(--k);k=2;do{m=1/c[k+6*k];l=6;do g=6-l,c[g+6*k]*=m;while(--l)}while(k--);k=2;do{n=2;do{if(g=c[3+n+6*k],isNaN(g)||1/0===g)throw'Could not reverse! A=['+ -this.toString()+']';f.e(k,n,g)}while(n--)}while(k--);return f};b.prototype.setRotationFromQuaternion=function(b){var c=b.x,f=b.y,n=b.z,l=b.w,g=c+c,h=f+f,d=n+n;b=c*g;var m=c*h,c=c*d,w=f*h,f=f*d,n=n*d,g=l*g,h=l*h,l=l*d,d=this.elements;return d[0]=1-(w+n),d[1]=m-l,d[2]=c+h,d[3]=m+l,d[4]=1-(b+n),d[5]=f-g,d[6]=c-h,d[7]=f+g,d[8]=1-(b+w),this};b.prototype.transpose=function(f){f=f||new b;for(var c=f.elements,k=this.elements,n=0;3!==n;n++)for(var l=0;3!==l;l++)c[3*n+l]=k[3*l+n];return f}},{'./Vec3':30}], -28:[function(g,m){function b(b,c,d,f){this.x=void 0!==b?b:0;this.y=void 0!==c?c:0;this.z=void 0!==d?d:0;this.w=void 0!==f?f:1}m.exports=b;var l=g('./Vec3');b.prototype.set=function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f};b.prototype.toString=function(){return this.x+','+this.y+','+this.z+','+this.w};b.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]};b.prototype.setFromAxisAngle=function(b,c){var d=Math.sin(.5*c);this.x=b.x*d;this.y=b.y*d;this.z=b.z*d;this.w=Math.cos(.5*c)}; -b.prototype.toAxisAngle=function(b){b=b||new l;this.normalize();var c=2*Math.acos(this.w),d=Math.sqrt(1-this.w*this.w);return.001>d?(b.x=this.x,b.y=this.y,b.z=this.z):(b.x=this.x/d,b.y=this.y/d,b.z=this.z/d),[b,c]};var f=new l,c=new l;b.prototype.setFromVectors=function(b,h){if(b.isAntiparallelTo(h))b.tangents(f,c),this.setFromAxisAngle(f,Math.PI);else{var d=b.cross(h);this.x=d.x;this.y=d.y;this.z=d.z;this.w=Math.sqrt(Math.pow(b.norm(),2)*Math.pow(h.norm(),2))+b.dot(h);this.normalize()}};var k=new l, -n=new l,p=new l;b.prototype.mult=function(c,h){h=h||new b;var d=this.w;return k.set(this.x,this.y,this.z),n.set(c.x,c.y,c.z),h.w=d*c.w-k.dot(n),k.cross(n,p),h.x=d*n.x+c.w*k.x+p.x,h.y=d*n.y+c.w*k.y+p.y,h.z=d*n.z+c.w*k.z+p.z,h};b.prototype.inverse=function(c){var h=this.x,d=this.y,f=this.z,k=this.w;c=c||new b;this.conjugate(c);h=1/(h*h+d*d+f*f+k*k);return c.x*=h,c.y*=h,c.z*=h,c.w*=h,c};b.prototype.conjugate=function(c){return c=c||new b,c.x=-this.x,c.y=-this.y,c.z=-this.z,c.w=this.w,c};b.prototype.normalize= -function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.normalizeFast=function(){var b=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.vmult=function(b,c){c=c||new l;var d=b.x,h=b.y,f=b.z;b=this.x;var k=this.y,n=this.z,q=this.w,g=q*d+k*f-n*h,p=q*h+n*d-b* -f,m=q*f+b*h-k*d,d=-b*d-k*h-n*f;return c.x=g*q+d*-b+p*-n-m*-k,c.y=p*q+d*-k+m*-b-g*-n,c.z=m*q+d*-n+g*-k-p*-b,c};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this.w=b.w,this};b.prototype.toEuler=function(b,c){c=c||'YZX';var d,h,f,k=this.x,n=this.y,q=this.z,l=this.w;switch(c){case 'YZX':c=k*n+q*l;if(.499c&&(d=-2*Math.atan2(k,l),h=-Math.PI/2,f=0),isNaN(d))f=q*q,d=Math.atan2(2*n*l-2*k*q,1-2*n*n-2*f),h=Math.asin(2*c),f=Math.atan2(2* -k*l-2*n*q,1-2*k*k-2*f);break;default:throw Error('Euler order '+c+' not supported yet.');}b.y=d;b.z=h;b.x=f};b.prototype.setFromEuler=function(b,c,d,f){f=f||'XYZ';var h=Math.cos(b/2),k=Math.cos(c/2),n=Math.cos(d/2);b=Math.sin(b/2);c=Math.sin(c/2);d=Math.sin(d/2);return'XYZ'===f?(this.x=b*k*n+h*c*d,this.y=h*c*n-b*k*d,this.z=h*k*d+b*c*n,this.w=h*k*n-b*c*d):'YXZ'===f?(this.x=b*k*n+h*c*d,this.y=h*c*n-b*k*d,this.z=h*k*d-b*c*n,this.w=h*k*n+b*c*d):'ZXY'===f?(this.x=b*k*n-h*c*d,this.y=h*c*n+b*k*d,this.z= -h*k*d+b*c*n,this.w=h*k*n-b*c*d):'ZYX'===f?(this.x=b*k*n-h*c*d,this.y=h*c*n+b*k*d,this.z=h*k*d-b*c*n,this.w=h*k*n+b*c*d):'YZX'===f?(this.x=b*k*n+h*c*d,this.y=h*c*n+b*k*d,this.z=h*k*d-b*c*n,this.w=h*k*n-b*c*d):'XZY'===f&&(this.x=b*k*n-h*c*d,this.y=h*c*n-b*k*d,this.z=h*k*d+b*c*n,this.w=h*k*n+b*c*d),this};b.prototype.clone=function(){return new b(this.x,this.y,this.z,this.w)}},{'./Vec3':30}],29:[function(g,m){function b(b){b=b||{};this.position=new l;b.position&&this.position.copy(b.position);this.quaternion= -new f;b.quaternion&&this.quaternion.copy(b.quaternion)}var l=g('./Vec3'),f=g('./Quaternion');m.exports=b;var c=new f;b.pointToLocalFrame=function(b,f,g,m){m=m||new l;return g.vsub(b,m),f.conjugate(c),c.vmult(m,m),m};b.prototype.pointToLocal=function(c,f){return b.pointToLocalFrame(this.position,this.quaternion,c,f)};b.pointToWorldFrame=function(b,c,f,g){g=g||new l;return c.vmult(f,g),g.vadd(b,g),g};b.prototype.pointToWorld=function(c,f){return b.pointToWorldFrame(this.position,this.quaternion,c,f)}; -b.prototype.vectorToWorldFrame=function(b,c){c=c||new l;return this.quaternion.vmult(b,c),c};b.vectorToWorldFrame=function(b,c,f){return b.vmult(c,f),f};b.vectorToLocalFrame=function(b,c,f,g){g=g||new l;return c.w*=-1,c.vmult(f,g),c.w*=-1,g}},{'./Quaternion':28,'./Vec3':30}],30:[function(g,m){function b(b,c,f){this.x=b||0;this.y=c||0;this.z=f||0}m.exports=b;var l=g('./Mat3');b.ZERO=new b(0,0,0);b.UNIT_X=new b(1,0,0);b.UNIT_Y=new b(0,1,0);b.UNIT_Z=new b(0,0,1);b.prototype.cross=function(c,f){var k= -c.x,h=c.y;c=c.z;var d=this.x,n=this.y,l=this.z;return f=f||new b,f.x=n*c-l*h,f.y=l*k-d*c,f.z=d*h-n*k,f};b.prototype.set=function(b,c,f){return this.x=b,this.y=c,this.z=f,this};b.prototype.setZero=function(){this.x=this.y=this.z=0};b.prototype.vadd=function(c,f){return f?(f.x=c.x+this.x,f.y=c.y+this.y,f.z=c.z+this.z,void 0):new b(this.x+c.x,this.y+c.y,this.z+c.z)};b.prototype.vsub=function(c,f){return f?(f.x=this.x-c.x,f.y=this.y-c.y,f.z=this.z-c.z,void 0):new b(this.x-c.x,this.y-c.y,this.z-c.z)}; -b.prototype.crossmat=function(){return new l([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])};b.prototype.normalize=function(){var b=this.x,c=this.y,f=this.z,b=Math.sqrt(b*b+c*c+f*f);0Math.abs(f.x)?(c.set(1,0,0),f.cross(c,b)):(c.set(0,1,0),f.cross(c,b)),f.cross(b,k)):(b.set(1,0,0),k.set(0, -1,0))};b.prototype.toString=function(){return this.x+','+this.y+','+this.z};b.prototype.toArray=function(){return[this.x,this.y,this.z]};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this};b.prototype.lerp=function(b,c,f){var h=this.x,d=this.y,k=this.z;f.x=h+(b.x-h)*c;f.y=d+(b.y-d)*c;f.z=k+(b.z-k)*c};b.prototype.almostEquals=function(b,c){return void 0===c&&(c=1E-6),Math.abs(this.x-b.x)>c||Math.abs(this.y-b.y)>c||Math.abs(this.z-b.z)>c?!1:!0};b.prototype.almostZero=function(b){return void 0=== -b&&(b=1E-6),Math.abs(this.x)>b||Math.abs(this.y)>b||Math.abs(this.z)>b?!1:!0};var k=new b;b.prototype.isAntiparallelTo=function(b,c){return this.negate(k),k.almostEquals(b,c)};b.prototype.clone=function(){return new b(this.x,this.y,this.z)}},{'./Mat3':27}],31:[function(g,m){function b(d){d=d||{};l.apply(this);this.id=b.idCounter++;this.postStep=this.preStep=this.world=null;this.vlambda=new f;this.collisionFilterGroup='number'==typeof d.collisionFilterGroup?d.collisionFilterGroup:1;this.collisionFilterMask= -'number'==typeof d.collisionFilterMask?d.collisionFilterMask:1;this.collisionResponse=!0;this.position=new f;d.position&&this.position.copy(d.position);this.previousPosition=new f;this.initPosition=new f;this.velocity=new f;d.velocity&&this.velocity.copy(d.velocity);this.initVelocity=new f;this.force=new f;var h='number'==typeof d.mass?d.mass:0;this.mass=h;this.invMass=0=h?b.STATIC: -b.DYNAMIC;typeof d.type==typeof b.STATIC&&(this.type=d.type);this.allowSleep='undefined'!=typeof d.allowSleep?d.allowSleep:!0;this.sleepState=0;this.sleepSpeedLimit='undefined'!=typeof d.sleepSpeedLimit?d.sleepSpeedLimit:.1;this.sleepTimeLimit='undefined'!=typeof d.sleepTimeLimit?d.sleepTimeLimit:1;this.timeLastSleepy=0;this._wakeUpAfterNarrowphase=!1;this.torque=new f;this.quaternion=new k;d.quaternion&&this.quaternion.copy(d.quaternion);this.initQuaternion=new k;this.angularVelocity=new f;d.angularVelocity&& -this.angularVelocity.copy(d.angularVelocity);this.initAngularVelocity=new f;this.interpolatedPosition=new f;this.interpolatedQuaternion=new k;this.shapes=[];this.shapeOffsets=[];this.shapeOrientations=[];this.inertia=new f;this.invInertia=new f;this.invInertiaWorld=new c;this.invMassSolve=0;this.invInertiaSolve=new f;this.invInertiaWorldSolve=new c;this.fixedRotation='undefined'!=typeof d.fixedRotation?d.fixedRotation:!1;this.angularDamping='undefined'!=typeof d.angularDamping?d.angularDamping:.01; -this.aabb=new n;this.aabbNeedsUpdate=!0;this.wlambda=new f;d.shape&&this.addShape(d.shape);this.updateMassProperties()}m.exports=b;var l=g('../utils/EventTarget'),f=(g('../shapes/Shape'),g('../math/Vec3')),c=g('../math/Mat3'),k=g('../math/Quaternion'),n=(g('../material/Material'),g('../collision/AABB')),p=g('../shapes/Box');b.prototype=new l;b.prototype.constructor=b;b.DYNAMIC=1;b.STATIC=2;b.KINEMATIC=4;b.AWAKE=0;b.SLEEPY=1;b.SLEEPING=2;b.idCounter=0;b.prototype.wakeUp=function(){var d=this.sleepState; -this.sleepState=0;d===b.SLEEPING&&this.dispatchEvent({type:'wakeup'})};b.prototype.sleep=function(){this.sleepState=b.SLEEPING;this.velocity.set(0,0,0);this.angularVelocity.set(0,0,0)};b.sleepyEvent={type:'sleepy'};b.sleepEvent={type:'sleep'};b.prototype.sleepTick=function(d){if(this.allowSleep){var c=this.sleepState,h=this.velocity.norm2()+this.angularVelocity.norm2(),f=Math.pow(this.sleepSpeedLimit,2);c===b.AWAKE&&f>h?(this.sleepState=b.SLEEPY,this.timeLastSleepy=d,this.dispatchEvent(b.sleepyEvent)): -c===b.SLEEPY&&h>f?this.wakeUp():c===b.SLEEPY&&d-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(b.sleepEvent))}};b.prototype.updateSolveMassProperties=function(){this.sleepState===b.SLEEPING||this.type===b.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))};b.prototype.pointToLocalFrame=function(b, -d){d=d||new f;return b.vsub(this.position,d),this.quaternion.conjugate().vmult(d,d),d};b.prototype.vectorToLocalFrame=function(b,d){d=d||new f;return this.quaternion.conjugate().vmult(b,d),d};b.prototype.pointToWorldFrame=function(b,d){d=d||new f;return this.quaternion.vmult(b,d),d.vadd(this.position,d),d};b.prototype.vectorToWorldFrame=function(b,d){d=d||new f;return this.quaternion.vmult(b,d),d};var t=new f,h=new k;b.prototype.addShape=function(b,d,c){var h=new f,l=new k;return d&&h.copy(d),c&& -l.copy(c),this.shapes.push(b),this.shapeOffsets.push(h),this.shapeOrientations.push(l),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,this};b.prototype.updateBoundingRadius=function(){for(var b=this.shapes,d=this.shapeOffsets,c=b.length,h=0,f=0;f!==c;f++){var k=b[f];k.updateBoundingSphereRadius();var l=d[f].norm(),k=k.boundingSphereRadius;l+k>h&&(h=l+k)}this.boundingRadius=h};var d=new n;b.prototype.computeAABB=function(){for(var b=this.shapes,c=this.shapeOffsets, -f=this.shapeOrientations,k=b.length,l=this.quaternion,q=this.aabb,g=0;g!==k;g++){var n=b[g];f[g].mult(l,h);h.vmult(c[g],t);t.vadd(this.position,t);n.calculateWorldAABB(t,h,d.lowerBound,d.upperBound);0===g?q.copy(d):q.extend(d)}this.aabbNeedsUpdate=!1};var v=new c,w=new c;new c;b.prototype.updateInertiaWorld=function(b){var d=this.invInertia;if(d.x!==d.y||d.y!==d.z||b)v.setRotationFromQuaternion(this.quaternion),v.transpose(w),v.scale(d,v),v.mmult(w,this.invInertiaWorld)};var y=new f,x=new f;b.prototype.applyForce= -function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,y),y.cross(d,x),this.force.vadd(d,this.force),this.torque.vadd(x,this.torque))};var q=new f,u=new f;b.prototype.applyLocalForce=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,q),this.pointToWorldFrame(c,u),this.applyForce(q,u))};var A=new f,E=new f,D=new f;b.prototype.applyImpulse=function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,A),E.copy(d),E.mult(this.invMass,E),this.velocity.vadd(E,this.velocity),A.cross(d,D), -this.invInertiaWorld.vmult(D,D),this.angularVelocity.vadd(D,this.angularVelocity))};var C=new f,F=new f;b.prototype.applyLocalImpulse=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,C),this.pointToWorldFrame(c,F),this.applyImpulse(C,F))};var z=new f;b.prototype.updateMassProperties=function(){this.invMass=0d.x&&(d.x=n.x);n.xd.y&&(d.y=n.y);n.yd.z&&(d.z=n.z);n.zc&&(this.lowerBound.x=c);c=b.upperBound.x;this.upperBound.xc&&(this.lowerBound.y=c);c=b.upperBound.y;this.upperBound.yc&&(this.lowerBound.z=c);c=b.upperBound.z;this.upperBound.z=b.x&&c.y<=k.y&&g.y>= +b.y&&c.z<=k.z&&g.z>=b.z};b.prototype.getCorners=function(b,c,g,e,h,d,l,m){var k=this.lowerBound,n=this.upperBound;b.copy(k);c.set(n.x,k.y,k.z);g.set(n.x,n.y,k.z);e.set(k.x,n.y,n.z);h.set(n.x,k.y,k.z);d.set(k.x,n.y,k.z);l.set(k.x,k.y,n.z);m.copy(n)};var c=[new l,new l,new l,new l,new l,new l,new l,new l];b.prototype.toLocalFrame=function(b,g){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToLocal(n,n)}return g.setFromPoints(c)};b.prototype.toWorldFrame= +function(b,g){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToWorld(n,n)}return g.setFromPoints(c)}},{'../math/Vec3':30,'../utils/Utils':53}],4:[function(e,m){function b(){this.matrix=[]}m.exports=b;b.prototype.get=function(b,g){if(b=b.index,g=g.index,g>b)b=g=b;return this.matrix[(b*(b+1)>>1)+g-1]};b.prototype.set=function(b,g,c){if(b=b.index,g=g.index,g>b)b=g=b;this.matrix[(b*(b+1)>>1)+g-1]=c?1:0};b.prototype.reset=function(){for(var b=0,g=this.matrix.length;b!== +g;b++)this.matrix[b]=0};b.prototype.setNumObjects=function(b){this.matrix.length=b*(b-1)>>1}},{}],5:[function(e,m){function b(){this.world=null;this.useBoundingBoxes=!1;this.dirty=!0}var l=e('../objects/Body'),g=e('../math/Vec3'),c=e('../math/Quaternion');e('../shapes/Shape');e('../shapes/Plane');m.exports=b;b.prototype.collisionPairs=function(){throw Error('collisionPairs not implemented for this BroadPhase class!');};var k=l.STATIC|l.KINEMATIC;b.prototype.needBroadphaseCollision=function(b,d){return 0=== +(b.collisionFilterGroup&d.collisionFilterMask)||0===(d.collisionFilterGroup&b.collisionFilterMask)?!1:0===(b.type&k)&&b.sleepState!==l.SLEEPING||0===(d.type&k)&&d.sleepState!==l.SLEEPING?!0:!1};b.prototype.intersectionTest=function(b,d,c,h){this.useBoundingBoxes?this.doBoundingBoxBroadphase(b,d,c,h):this.doBoundingSphereBroadphase(b,d,c,h)};var n=new g;new g;new c;new g;b.prototype.doBoundingSphereBroadphase=function(b,d,c,h){d.position.vsub(b.position,n);var g=Math.pow(b.boundingRadius+d.boundingRadius, +2),k=n.norm2();g>k&&(c.push(b),h.push(d))};b.prototype.doBoundingBoxBroadphase=function(b,d,c,h){b.aabbNeedsUpdate&&b.computeAABB();d.aabbNeedsUpdate&&d.computeAABB();b.aabb.overlaps(d.aabb)&&(c.push(b),h.push(d))};var p={keys:[]},t=[],h=[];b.prototype.makePairsUnique=function(b,d){for(var c=b.length,g=0;g!==c;g++)t[g]=b[g],h[g]=d[g];b.length=0;for(g=d.length=0;g!==c;g++){var k=t[g].id,n=h[g].id,k=n>k?k+','+n:n+','+k;p[k]=g;p.keys.push(k)}for(g=0;g!==p.keys.length;g++)k=p.keys.pop(),c=p[k],b.push(t[c]), +d.push(h[c]),delete p[k]};b.prototype.setWorld=function(){};var d=new g;b.boundingSphereCheck=function(b,c){return b.position.vsub(c.position,d),Math.pow(b.shape.boundingSphereRadius+c.shape.boundingSphereRadius,2)>d.norm2()};b.prototype.aabbQuery=function(){return console.warn('.aabbQuery is not implemented in this Broadphase subclass.'),[]}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Plane':42,'../shapes/Shape':43}],6:[function(e,m){function b(b,c,k,h,d){l.apply(this); +this.nx=k||10;this.ny=h||10;this.nz=d||10;this.aabbMin=b||new g(100,100,100);this.aabbMax=c||new g(-100,-100,-100);b=this.nx*this.ny*this.nz;if(0>=b)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[];this.binLengths=[];this.bins.length=b;this.binLengths.length=b;for(c=0;b>c;c++)this.bins[c]=[],this.binLengths[c]=0}m.exports=b;var l=e('./Broadphase'),g=e('../math/Vec3'),c=e('../shapes/Shape');b.prototype=new l;b.prototype.constructor=b;var k=new g;new g;b.prototype.collisionPairs=function(b, +g,e){function h(b,d,c,h,g,k,n){b=(b-z)*O|0;d=(d-H)*M|0;c=(c-G)*J|0;h=Z((h-z)*O);g=Z((g-H)*M);k=Z((k-G)*J);0>b?b=0:b>=p&&(b=p-1);0>d?d=0:d>=t&&(d=t-1);0>c?c=0:c>=q&&(c=q-1);0>h?h=0:h>=p&&(h=p-1);0>g?g=0:g>=t&&(g=t-1);0>k?k=0:k>=q&&(k=q-1);b*=u;d*=m;c*=E;h*=u;g*=m;for(k*=E;h>=b;b+=u)for(var e=d;g>=e;e+=m)for(var l=c;k>=l;l+=E){var v=b+e+l;T[v][fa[v]++]=n}}var d=b.numObjects();b=b.bodies;for(var n=this.aabbMax,l=this.aabbMin,p=this.nx,t=this.ny,q=this.nz,u=t*q,m=q,E=1,D=n.x,C=n.y,F=n.z,z=l.x,H=l.y,G= +l.z,O=p/(D-z),M=t/(C-H),J=q/(F-G),D=(D-z)/p,P=(C-H)/t,F=(F-G)/q,N=.5*Math.sqrt(D*D+P*P+F*F),C=c.types,V=C.SPHERE,X=C.PLANE,T=(C.BOX,C.COMPOUND,C.CONVEXPOLYHEDRON,this.bins),fa=this.binLengths,C=this.bins.length,l=0;l!==C;l++)fa[l]=0;for(var Z=Math.ceil,l=Math.min,n=Math.max,l=0;l!==d;l++){var n=b[l],S=n.shape;switch(S.type){case V:var L=n.position.x,U=n.position.y,oa=n.position.z,S=S.radius;h(L-S,U-S,oa-S,L+S,U+S,oa+S,n);break;case X:S.worldNormalNeedsUpdate&&S.computeWorldNormal(n.quaternion);var oa= +S.worldNormal,S=H+.5*P-n.position.y,pa=G+.5*F-n.position.z,R=k;R.set(z+.5*D-n.position.x,S,pa);for(var Y=L=0;L!==p;L++,Y+=u,R.y=S,R.x+=D)for(var na=U=0;U!==t;U++,na+=m,R.z=pa,R.y+=P)for(var la=0,ca=0;la!==q;la++,ca+=E,R.z+=F)if(R.dot(oa)b)b=g=b;return b+'-'+g in this.matrix};b.prototype.set=function(b,g,c){if(b=b.id,g=g.id,g>b)b=g=b;c?this.matrix[b+'-'+g]=!0:delete this.matrix[b+'-'+g]};b.prototype.reset=function(){this.matrix= +{}};b.prototype.setNumObjects=function(){}},{}],9:[function(e,m){function b(d,c){this.from=d?d.clone():new g;this.to=c?c.clone():new g;this._direction=new g;this.precision=1E-4;this.checkCollisionResponse=!0;this.skipBackfaces=!1;this.collisionFilterGroup=this.collisionFilterMask=-1;this.mode=b.ANY;this.result=new k;this.hasHit=!1;this.callback=function(){}}function l(b,c,g,k){k.vsub(c,V);g.vsub(c,h);b.vsub(c,d);var n,q;b=V.dot(V);c=V.dot(h);g=V.dot(d);k=h.dot(h);var e=h.dot(d);return 0<=(n=k*g-c* +e)&&0<=(q=b*e-c*g)&&b*k-c*c>n+q}m.exports=b;var g=e('../math/Vec3');m=e('../math/Quaternion');var c=e('../math/Transform'),k=(e('../shapes/ConvexPolyhedron'),e('../shapes/Box'),e('../collision/RaycastResult')),n=e('../shapes/Shape');e=e('../collision/AABB');b.prototype.constructor=b;b.CLOSEST=1;b.ANY=2;b.ALL=4;var p=new e,t=[];b.prototype.intersectWorld=function(d,c){return this.mode=c.mode||b.ANY,this.result=c.result||new k,this.skipBackfaces=!!c.skipBackfaces,this.collisionFilterMask='undefined'!= +typeof c.collisionFilterMask?c.collisionFilterMask:-1,this.collisionFilterGroup='undefined'!=typeof c.collisionFilterGroup?c.collisionFilterGroup:-1,c.from&&this.from.copy(c.from),c.to&&this.to.copy(c.to),this.callback=c.callback||function(){},this.hasHit=!1,this.result.reset(),this._updateDirection(),this.getAABB(p),t.length=0,d.broadphase.aabbQuery(d,p,t),this.intersectBodies(t),this.hasHit};var h=new g,d=new g;b.pointInTriangle=l;var v=new g,w=new m;b.prototype.intersectBody=function(b,d){d&&(this.result= +d,this._updateDirection());d=this.checkCollisionResponse;if((!d||b.collisionResponse)&&0!==(this.collisionFilterGroup&b.collisionFilterMask)&&0!==(b.collisionFilterGroup&this.collisionFilterMask))for(var c=0,h=b.shapes.length;h>c;c++){var g=b.shapes[c];if((!d||g.collisionResponse)&&(b.quaternion.mult(b.shapeOrientations[c],w),b.quaternion.vmult(b.shapeOffsets[c],v),v.vadd(b.position,v),this.intersectShape(g,w,v,b),this.result._shouldStop))break}};b.prototype.intersectBodies=function(b,d){d&&(this.result= +d,this._updateDirection());d=0;for(var c=b.length;!this.result._shouldStop&&c>d;d++)this.intersectBody(b[d])};b.prototype._updateDirection=function(){this.to.vsub(this.from,this._direction);this._direction.normalize()};b.prototype.intersectShape=function(b,d,c,h){var g=this.from,k=this._direction;c.vsub(g,V);var n=V.dot(k);k.mult(n,X);X.vadd(g,X);c.distanceTo(X)>b.boundingSphereRadius||(g=this[b.type])&&g.call(this,b,d,c,h)};var y=(new g,new g,new g),x=new g,q=new g,u=new g;new g;new k;b.prototype.intersectBox= +function(b,d,c,h){return this.intersectConvex(b.convexPolyhedronRepresentation,d,c,h)};b.prototype[n.types.BOX]=b.prototype.intersectBox;b.prototype.intersectPlane=function(b,d,c,h){var k=this.from,n=this.to,q=this._direction,e=new g(0,0,1);d.vmult(e,e);var l=new g;k.vsub(c,l);d=l.dot(e);n.vsub(c,l);l=l.dot(e);if(!(0m)&&(m=l[0]),(null===t||l[1]u)&&(u=l[1])),null!==p)for(e=[],d.getRectMinMax(p,t,m,u,e),p=(e[0],e[1],p);m>=p;p++)for(e=t;u>=e;e++){if(this.result._shouldStop||(d.getConvexTrianglePillar(p,e,!1),c.pointToWorldFrame(k,h,d.pillarOffset,q),this.intersectConvex(d.pillarConvex, +h,q,n,A),this.result._shouldStop))return;d.getConvexTrianglePillar(p,e,!0);c.pointToWorldFrame(k,h,d.pillarOffset,q);this.intersectConvex(d.pillarConvex,h,q,n,A)}};b.prototype[n.types.HEIGHTFIELD]=b.prototype.intersectHeightfield;var E=new g,D=new g;b.prototype.intersectSphere=function(b,d,c,h){d=this.from;var g=this.to,k=Math.pow(g.x-d.x,2)+Math.pow(g.y-d.y,2)+Math.pow(g.z-d.z,2),n=2*((g.x-d.x)*(d.x-c.x)+(g.y-d.y)*(d.y-c.y)+(g.z-d.z)*(d.z-c.z)),q=Math.pow(n,2)-4*k*(Math.pow(d.x-c.x,2)+Math.pow(d.y- +c.y,2)+Math.pow(d.z-c.z,2)-Math.pow(b.radius,2));if(!(0>q))if(0===q)d.lerp(g,q,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1);else{var e=(-n-Math.sqrt(q))/(2*k),k=(-n+Math.sqrt(q))/(2*k);(0<=e&&1>=e&&(d.lerp(g,e,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1)),this.result._shouldStop)||0<=k&&1>=k&&(d.lerp(g,k,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1))}};b.prototype[n.types.SPHERE]=b.prototype.intersectSphere;var C=new g,F=(new g,new g,new g); +b.prototype.intersectConvex=function(b,d,c,h,g){g=g&&g.faceList||null;for(var k=b.faces,n=b.vertices,e=b.faceNormals,p=this._direction,t=this.from,m=t.distanceTo(this.to),v=g?g.length:k.length,w=this.result,A=0;!w._shouldStop&&v>A;A++){var z=g?g[A]:A,E=k[z],D=e[z],L=d,H=c;F.copy(n[E[0]]);L.vmult(F,F);F.vadd(H,F);F.vsub(t,F);L.vmult(D,C);D=p.dot(C);if(!(Math.abs(D)D)))for(p.mult(D,y),y.vadd(t,y),x.copy(n[E[0]]),L.vmult(x,x),H.vadd(x,x),D=1;!w._shouldStop&&Dm||this.reportIntersection(C,y,b,h,z)}}};b.prototype[n.types.CONVEXPOLYHEDRON]=b.prototype.intersectConvex;var z=new g,H=new g,G=new g,O=new g,M=new g,J=new g,P=(new e,[]),N=new c;b.prototype.intersectTrimesh=function(b,d,h,g,k){k=(k&&k.faceList||null,b.indices);var n=(b.vertices,b.faceNormals,this.from),e=this.to,p=this._direction;N.position.copy(h);N.quaternion.copy(d); +c.vectorToLocalFrame(h,d,p,H);c.pointToLocalFrame(h,d,n,G);c.pointToLocalFrame(h,d,e,O);n=G.distanceSquared(O);b.tree.rayQuery(this,N,P);e=0;for(p=P.length;!this.result._shouldStop&&e!==p;e++){var t=P[e];b.getNormal(t,z);b.getVertex(k[3*t],x);x.vsub(G,F);var m=H.dot(z),m=z.dot(F)/m;0>m||(H.scale(m,y),y.vadd(G,y),b.getVertex(k[3*t+1],q),b.getVertex(k[3*t+2],u),m=y.distanceSquared(G),!l(y,q,x,u)&&!l(y,x,q,u)||m>n||(c.vectorToWorldFrame(d,z,M),c.pointToWorldFrame(h,d,y,J),this.reportIntersection(M,J, +b,g,t)))}P.length=0};b.prototype[n.types.TRIMESH]=b.prototype.intersectTrimesh;b.prototype.reportIntersection=function(d,c,h,g,k){var n=this.from,q=this.to,e=n.distanceTo(c),l=this.result;if(!(this.skipBackfaces&&0c;c++){for(var n=b[c],e=c-1;0<=e&&!(b[e].aabb.lowerBound.x<=n.aabb.lowerBound.x);e--)b[e+1]=b[e];b[e+1]=n}return b};b.insertionSortY=function(b){for(var c=1,g=b.length;g>c;c++){for(var n=b[c],e=c-1;0<=e&&!(b[e].aabb.lowerBound.y<= +n.aabb.lowerBound.y);e--)b[e+1]=b[e];b[e+1]=n}return b};b.insertionSortZ=function(b){for(var c=1,g=b.length;g>c;c++){for(var n=b[c],e=c-1;0<=e&&!(b[e].aabb.lowerBound.z<=n.aabb.lowerBound.z);e--)b[e+1]=b[e];b[e+1]=n}return b};b.prototype.collisionPairs=function(g,c,k){var n,e=this.axisList,l=e.length,h=this.axisIndex;this.dirty&&(this.sortList(),this.dirty=!1);for(g=0;g!==l;g++){var d=e[g];for(n=g+1;l>n;n++){var m=e[n];if(this.needBroadphaseCollision(d,m)){if(!b.checkBounds(d,m,h))break;this.intersectionTest(d, +m,c,k)}}}};b.prototype.sortList=function(){for(var g=this.axisList,c=this.axisIndex,k=g.length,n=0;n!==k;n++){var e=g[n];e.aabbNeedsUpdate&&e.computeAABB()}0===c?b.insertionSortX(g):1===c?b.insertionSortY(g):2===c&&b.insertionSortZ(g)};b.checkBounds=function(b,c,k){var g,e;0===k?(g=b.position.x,e=c.position.x):1===k?(g=b.position.y,e=c.position.y):2===k&&(g=b.position.z,e=c.position.z);return g+b.boundingRadius>e-c.boundingRadius};b.prototype.autoDetectAxis=function(){for(var b=0,c=0,k=0,n=0,e=0, +l=0,h=this.axisList,d=h.length,m=1/d,w=0;w!==d;w++)var y=h[w],x=y.position.x,b=b+x,c=c+x*x,x=y.position.y,k=k+x,n=n+x*x,y=y.position.z,e=e+y,l=l+y*y;b=c-b*b*m;k=n-k*k*m;e=l-e*e*m;this.axisIndex=b>k?b>e?0:2:k>e?1:2};b.prototype.aabbQuery=function(b,c,k){k=k||[];this.dirty&&(this.sortList(),this.dirty=!1);b=this.axisIndex;var g='x';1===b&&(g='y');2===b&&(g='z');b=this.axisList;for(g=(c.lowerBound[g],c.upperBound[g],0);gk;k++)for(var e=0;3>e;e++){for(var l=0,t=0;3>t;t++)l+=g.elements[k+3*t]*this.elements[t+3*e];c.elements[k+3*e]=l}return c};b.prototype.scale=function(g,c){c=c||new b;for(var k=this.elements,e=c.elements,l=0;3!==l;l++)e[3*l+0]=g.x*k[3*l+0],e[3*l+1]=g.y*k[3*l+1],e[3*l+2]=g.z*k[3*l+2];return c};b.prototype.solve=function(b,c){c=c||new l;for(var g=[],e=0;12>e;e++)g.push(0);for(var p,e=0;3>e;e++)for(p=0;3>p;p++)g[e+4*p]=this.elements[e+3*p];g[3]=b.x;g[7]=b.y;g[11]=b.z;var t, +h,d=3,m=d;do{if(e=m-d,0===g[e+4*e])for(p=e+1;m>p;p++)if(0!==g[e+4*p]){t=4;do h=4-t,g[h+4*e]+=g[h+4*p];while(--t);break}if(0!==g[e+4*e])for(p=e+1;m>p;p++){var w=g[e+4*p]/g[e+4*e];t=4;do h=4-t,g[h+4*p]=e>=h?0:g[h+4*p]-g[h+4*e]*w;while(--t)}}while(--d);if(c.z=g[11]/g[10],c.y=(g[7]-g[6]*c.z)/g[5],c.x=(g[3]-g[2]*c.z-g[1]*c.y)/g[0],isNaN(c.x)||isNaN(c.y)||isNaN(c.z)||1/0===c.x||1/0===c.y||1/0===c.z)throw'Could not solve equation! Got x=['+c.toString()+'], b=['+b.toString()+'], A=['+this.toString()+']'; +return c};b.prototype.e=function(b,c,k){return void 0===k?this.elements[c+3*b]:void(this.elements[c+3*b]=k)};b.prototype.copy=function(b){for(var c=0;cc;c++)b+=this.elements[c]+',';return b};b.prototype.reverse=function(g){g=g||new b;for(var c=[],k=0;18>k;k++)c.push(0);for(var e,k=0;3>k;k++)for(e=0;3>e;e++)c[k+6*e]=this.elements[k+3*e];c[3]=1;c[9]=0;c[15]=0;c[4]=0;c[10]=1;c[16]=0; +c[5]=0;c[11]=0;c[17]=1;var l,t,h=3,d=h;do{if(k=d-h,0===c[k+6*k])for(e=k+1;d>e;e++)if(0!==c[k+6*e]){l=6;do t=6-l,c[t+6*k]+=c[t+6*e];while(--l);break}if(0!==c[k+6*k])for(e=k+1;d>e;e++){var m=c[k+6*e]/c[k+6*k];l=6;do t=6-l,c[t+6*e]=k>=t?0:c[t+6*e]-c[t+6*k]*m;while(--l)}}while(--h);k=2;do{e=k-1;do{m=c[k+6*e]/c[k+6*k];l=6;do t=6-l,c[t+6*e]-=c[t+6*k]*m;while(--l)}while(e--)}while(--k);k=2;do{m=1/c[k+6*k];l=6;do t=6-l,c[t+6*k]*=m;while(--l)}while(k--);k=2;do{e=2;do{if(t=c[3+e+6*k],isNaN(t)||1/0===t)throw'Could not reverse! A=['+ +this.toString()+']';g.e(k,e,t)}while(e--)}while(k--);return g};b.prototype.setRotationFromQuaternion=function(b){var c=b.x,g=b.y,e=b.z,l=b.w,t=c+c,h=g+g,d=e+e;b=c*t;var m=c*h,c=c*d,w=g*h,g=g*d,e=e*d,t=l*t,h=l*h,l=l*d,d=this.elements;return d[0]=1-(w+e),d[1]=m-l,d[2]=c+h,d[3]=m+l,d[4]=1-(b+e),d[5]=g-t,d[6]=c-h,d[7]=g+t,d[8]=1-(b+w),this};b.prototype.transpose=function(g){g=g||new b;for(var c=g.elements,k=this.elements,e=0;3!==e;e++)for(var l=0;3!==l;l++)c[3*e+l]=k[3*l+e];return g}},{'./Vec3':30}], +28:[function(e,m){function b(b,c,d,g){this.x=void 0!==b?b:0;this.y=void 0!==c?c:0;this.z=void 0!==d?d:0;this.w=void 0!==g?g:1}m.exports=b;var l=e('./Vec3');b.prototype.set=function(b,c,d,g){this.x=b;this.y=c;this.z=d;this.w=g};b.prototype.toString=function(){return this.x+','+this.y+','+this.z+','+this.w};b.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]};b.prototype.setFromAxisAngle=function(b,c){var d=Math.sin(.5*c);this.x=b.x*d;this.y=b.y*d;this.z=b.z*d;this.w=Math.cos(.5*c)}; +b.prototype.toAxisAngle=function(b){b=b||new l;this.normalize();var c=2*Math.acos(this.w),d=Math.sqrt(1-this.w*this.w);return.001>d?(b.x=this.x,b.y=this.y,b.z=this.z):(b.x=this.x/d,b.y=this.y/d,b.z=this.z/d),[b,c]};var g=new l,c=new l;b.prototype.setFromVectors=function(b,h){if(b.isAntiparallelTo(h))b.tangents(g,c),this.setFromAxisAngle(g,Math.PI);else{var d=b.cross(h);this.x=d.x;this.y=d.y;this.z=d.z;this.w=Math.sqrt(Math.pow(b.norm(),2)*Math.pow(h.norm(),2))+b.dot(h);this.normalize()}};var k=new l, +n=new l,p=new l;b.prototype.mult=function(c,h){h=h||new b;var d=this.w;return k.set(this.x,this.y,this.z),n.set(c.x,c.y,c.z),h.w=d*c.w-k.dot(n),k.cross(n,p),h.x=d*n.x+c.w*k.x+p.x,h.y=d*n.y+c.w*k.y+p.y,h.z=d*n.z+c.w*k.z+p.z,h};b.prototype.inverse=function(c){var h=this.x,d=this.y,g=this.z,k=this.w;c=c||new b;this.conjugate(c);h=1/(h*h+d*d+g*g+k*k);return c.x*=h,c.y*=h,c.z*=h,c.w*=h,c};b.prototype.conjugate=function(c){return c=c||new b,c.x=-this.x,c.y=-this.y,c.z=-this.z,c.w=this.w,c};b.prototype.normalize= +function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.normalizeFast=function(){var b=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.vmult=function(b,c){c=c||new l;var d=b.x,h=b.y,g=b.z;b=this.x;var k=this.y,e=this.z,q=this.w,n=q*d+k*g-e*h,p=q*h+e*d-b* +g,m=q*g+b*h-k*d,d=-b*d-k*h-e*g;return c.x=n*q+d*-b+p*-e-m*-k,c.y=p*q+d*-k+m*-b-n*-e,c.z=m*q+d*-e+n*-k-p*-b,c};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this.w=b.w,this};b.prototype.toEuler=function(b,c){c=c||'YZX';var d,h,g,k=this.x,e=this.y,q=this.z,n=this.w;switch(c){case 'YZX':c=k*e+q*n;if(.499c&&(d=-2*Math.atan2(k,n),h=-Math.PI/2,g=0),isNaN(d))g=q*q,d=Math.atan2(2*e*n-2*k*q,1-2*e*e-2*g),h=Math.asin(2*c),g=Math.atan2(2* +k*n-2*e*q,1-2*k*k-2*g);break;default:throw Error('Euler order '+c+' not supported yet.');}b.y=d;b.z=h;b.x=g};b.prototype.setFromEuler=function(b,c,d,g){g=g||'XYZ';var h=Math.cos(b/2),k=Math.cos(c/2),e=Math.cos(d/2);b=Math.sin(b/2);c=Math.sin(c/2);d=Math.sin(d/2);return'XYZ'===g?(this.x=b*k*e+h*c*d,this.y=h*c*e-b*k*d,this.z=h*k*d+b*c*e,this.w=h*k*e-b*c*d):'YXZ'===g?(this.x=b*k*e+h*c*d,this.y=h*c*e-b*k*d,this.z=h*k*d-b*c*e,this.w=h*k*e+b*c*d):'ZXY'===g?(this.x=b*k*e-h*c*d,this.y=h*c*e+b*k*d,this.z= +h*k*d+b*c*e,this.w=h*k*e-b*c*d):'ZYX'===g?(this.x=b*k*e-h*c*d,this.y=h*c*e+b*k*d,this.z=h*k*d-b*c*e,this.w=h*k*e+b*c*d):'YZX'===g?(this.x=b*k*e+h*c*d,this.y=h*c*e+b*k*d,this.z=h*k*d-b*c*e,this.w=h*k*e-b*c*d):'XZY'===g&&(this.x=b*k*e-h*c*d,this.y=h*c*e-b*k*d,this.z=h*k*d+b*c*e,this.w=h*k*e+b*c*d),this};b.prototype.clone=function(){return new b(this.x,this.y,this.z,this.w)}},{'./Vec3':30}],29:[function(e,m){function b(b){b=b||{};this.position=new l;b.position&&this.position.copy(b.position);this.quaternion= +new g;b.quaternion&&this.quaternion.copy(b.quaternion)}var l=e('./Vec3'),g=e('./Quaternion');m.exports=b;var c=new g;b.pointToLocalFrame=function(b,g,e,m){m=m||new l;return e.vsub(b,m),g.conjugate(c),c.vmult(m,m),m};b.prototype.pointToLocal=function(c,g){return b.pointToLocalFrame(this.position,this.quaternion,c,g)};b.pointToWorldFrame=function(b,c,g,e){e=e||new l;return c.vmult(g,e),e.vadd(b,e),e};b.prototype.pointToWorld=function(c,g){return b.pointToWorldFrame(this.position,this.quaternion,c,g)}; +b.prototype.vectorToWorldFrame=function(b,c){c=c||new l;return this.quaternion.vmult(b,c),c};b.vectorToWorldFrame=function(b,c,g){return b.vmult(c,g),g};b.vectorToLocalFrame=function(b,c,g,e){e=e||new l;return c.w*=-1,c.vmult(g,e),c.w*=-1,e}},{'./Quaternion':28,'./Vec3':30}],30:[function(e,m){function b(b,c,g){this.x=b||0;this.y=c||0;this.z=g||0}m.exports=b;var l=e('./Mat3');b.ZERO=new b(0,0,0);b.UNIT_X=new b(1,0,0);b.UNIT_Y=new b(0,1,0);b.UNIT_Z=new b(0,0,1);b.prototype.cross=function(c,g){var k= +c.x,h=c.y;c=c.z;var d=this.x,e=this.y,n=this.z;return g=g||new b,g.x=e*c-n*h,g.y=n*k-d*c,g.z=d*h-e*k,g};b.prototype.set=function(b,c,g){return this.x=b,this.y=c,this.z=g,this};b.prototype.setZero=function(){this.x=this.y=this.z=0};b.prototype.vadd=function(c,g){return g?(g.x=c.x+this.x,g.y=c.y+this.y,g.z=c.z+this.z,void 0):new b(this.x+c.x,this.y+c.y,this.z+c.z)};b.prototype.vsub=function(c,g){return g?(g.x=this.x-c.x,g.y=this.y-c.y,g.z=this.z-c.z,void 0):new b(this.x-c.x,this.y-c.y,this.z-c.z)}; +b.prototype.crossmat=function(){return new l([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])};b.prototype.normalize=function(){var b=this.x,c=this.y,g=this.z,b=Math.sqrt(b*b+c*c+g*g);0Math.abs(g.x)?(c.set(1,0,0),g.cross(c,b)):(c.set(0,1,0),g.cross(c,b)),g.cross(b,k)):(b.set(1,0,0),k.set(0, +1,0))};b.prototype.toString=function(){return this.x+','+this.y+','+this.z};b.prototype.toArray=function(){return[this.x,this.y,this.z]};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this};b.prototype.lerp=function(b,c,g){var h=this.x,d=this.y,k=this.z;g.x=h+(b.x-h)*c;g.y=d+(b.y-d)*c;g.z=k+(b.z-k)*c};b.prototype.almostEquals=function(b,c){return void 0===c&&(c=1E-6),Math.abs(this.x-b.x)>c||Math.abs(this.y-b.y)>c||Math.abs(this.z-b.z)>c?!1:!0};b.prototype.almostZero=function(b){return void 0=== +b&&(b=1E-6),Math.abs(this.x)>b||Math.abs(this.y)>b||Math.abs(this.z)>b?!1:!0};var k=new b;b.prototype.isAntiparallelTo=function(b,c){return this.negate(k),k.almostEquals(b,c)};b.prototype.clone=function(){return new b(this.x,this.y,this.z)}},{'./Mat3':27}],31:[function(e,m){function b(d){d=d||{};l.apply(this);this.id=b.idCounter++;this.postStep=this.preStep=this.world=null;this.vlambda=new g;this.collisionFilterGroup='number'==typeof d.collisionFilterGroup?d.collisionFilterGroup:1;this.collisionFilterMask= +'number'==typeof d.collisionFilterMask?d.collisionFilterMask:1;this.collisionResponse=!0;this.position=new g;d.position&&this.position.copy(d.position);this.previousPosition=new g;this.initPosition=new g;this.velocity=new g;d.velocity&&this.velocity.copy(d.velocity);this.initVelocity=new g;this.force=new g;var h='number'==typeof d.mass?d.mass:0;this.mass=h;this.invMass=0=h?b.STATIC: +b.DYNAMIC;typeof d.type==typeof b.STATIC&&(this.type=d.type);this.allowSleep='undefined'!=typeof d.allowSleep?d.allowSleep:!0;this.sleepState=0;this.sleepSpeedLimit='undefined'!=typeof d.sleepSpeedLimit?d.sleepSpeedLimit:.1;this.sleepTimeLimit='undefined'!=typeof d.sleepTimeLimit?d.sleepTimeLimit:1;this.timeLastSleepy=0;this._wakeUpAfterNarrowphase=!1;this.torque=new g;this.quaternion=new k;d.quaternion&&this.quaternion.copy(d.quaternion);this.initQuaternion=new k;this.angularVelocity=new g;d.angularVelocity&& +this.angularVelocity.copy(d.angularVelocity);this.initAngularVelocity=new g;this.interpolatedPosition=new g;this.interpolatedQuaternion=new k;this.shapes=[];this.shapeOffsets=[];this.shapeOrientations=[];this.inertia=new g;this.invInertia=new g;this.invInertiaWorld=new c;this.invMassSolve=0;this.invInertiaSolve=new g;this.invInertiaWorldSolve=new c;this.fixedRotation='undefined'!=typeof d.fixedRotation?d.fixedRotation:!1;this.angularDamping='undefined'!=typeof d.angularDamping?d.angularDamping:.01; +this.aabb=new n;this.aabbNeedsUpdate=!0;this.wlambda=new g;d.shape&&this.addShape(d.shape);this.updateMassProperties()}m.exports=b;var l=e('../utils/EventTarget'),g=(e('../shapes/Shape'),e('../math/Vec3')),c=e('../math/Mat3'),k=e('../math/Quaternion'),n=(e('../material/Material'),e('../collision/AABB')),p=e('../shapes/Box');b.prototype=new l;b.prototype.constructor=b;b.DYNAMIC=1;b.STATIC=2;b.KINEMATIC=4;b.AWAKE=0;b.SLEEPY=1;b.SLEEPING=2;b.idCounter=0;b.prototype.wakeUp=function(){var d=this.sleepState; +this.sleepState=0;d===b.SLEEPING&&this.dispatchEvent({type:'wakeup'})};b.prototype.sleep=function(){this.sleepState=b.SLEEPING;this.velocity.set(0,0,0);this.angularVelocity.set(0,0,0)};b.sleepyEvent={type:'sleepy'};b.sleepEvent={type:'sleep'};b.prototype.sleepTick=function(d){if(this.allowSleep){var c=this.sleepState,h=this.velocity.norm2()+this.angularVelocity.norm2(),g=Math.pow(this.sleepSpeedLimit,2);c===b.AWAKE&&g>h?(this.sleepState=b.SLEEPY,this.timeLastSleepy=d,this.dispatchEvent(b.sleepyEvent)): +c===b.SLEEPY&&h>g?this.wakeUp():c===b.SLEEPY&&d-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(b.sleepEvent))}};b.prototype.updateSolveMassProperties=function(){this.sleepState===b.SLEEPING||this.type===b.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))};b.prototype.pointToLocalFrame=function(b, +d){d=d||new g;return b.vsub(this.position,d),this.quaternion.conjugate().vmult(d,d),d};b.prototype.vectorToLocalFrame=function(b,d){d=d||new g;return this.quaternion.conjugate().vmult(b,d),d};b.prototype.pointToWorldFrame=function(b,d){d=d||new g;return this.quaternion.vmult(b,d),d.vadd(this.position,d),d};b.prototype.vectorToWorldFrame=function(b,d){d=d||new g;return this.quaternion.vmult(b,d),d};var t=new g,h=new k;b.prototype.addShape=function(b,d,c){var h=new g,e=new k;return d&&h.copy(d),c&& +e.copy(c),this.shapes.push(b),this.shapeOffsets.push(h),this.shapeOrientations.push(e),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,this};b.prototype.updateBoundingRadius=function(){for(var b=this.shapes,d=this.shapeOffsets,c=b.length,h=0,g=0;g!==c;g++){var k=b[g];k.updateBoundingSphereRadius();var e=d[g].norm(),k=k.boundingSphereRadius;e+k>h&&(h=e+k)}this.boundingRadius=h};var d=new n;b.prototype.computeAABB=function(){for(var b=this.shapes,c=this.shapeOffsets, +g=this.shapeOrientations,k=b.length,e=this.quaternion,q=this.aabb,n=0;n!==k;n++){var l=b[n];g[n].mult(e,h);h.vmult(c[n],t);t.vadd(this.position,t);l.calculateWorldAABB(t,h,d.lowerBound,d.upperBound);0===n?q.copy(d):q.extend(d)}this.aabbNeedsUpdate=!1};var v=new c,w=new c;new c;b.prototype.updateInertiaWorld=function(b){var d=this.invInertia;if(d.x!==d.y||d.y!==d.z||b)v.setRotationFromQuaternion(this.quaternion),v.transpose(w),v.scale(d,v),v.mmult(w,this.invInertiaWorld)};var y=new g,x=new g;b.prototype.applyForce= +function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,y),y.cross(d,x),this.force.vadd(d,this.force),this.torque.vadd(x,this.torque))};var q=new g,u=new g;b.prototype.applyLocalForce=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,q),this.pointToWorldFrame(c,u),this.applyForce(q,u))};var A=new g,E=new g,D=new g;b.prototype.applyImpulse=function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,A),E.copy(d),E.mult(this.invMass,E),this.velocity.vadd(E,this.velocity),A.cross(d,D), +this.invInertiaWorld.vmult(D,D),this.angularVelocity.vadd(D,this.angularVelocity))};var C=new g,F=new g;b.prototype.applyLocalImpulse=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,C),this.pointToWorldFrame(c,F),this.applyImpulse(C,F))};var z=new g;b.prototype.updateMassProperties=function(){this.invMass=0k;k++)this.updateWheelTransform(k);this.currentVehicleSpeedKmHour= -3.6*h.velocity.norm();k=new f;this.getVehicleAxisWorld(this.indexForwardAxis,k);0>k.dot(h.velocity)&&(this.currentVehicleSpeedKmHour*=-1);for(k=0;c>k;k++)this.castRay(d[k]);this.updateSuspension(b);for(var l=new f,q=new f,k=0;c>k;k++){var g=d[k],n=g.suspensionForce;n>g.maxSuspensionForce&&(n=g.maxSuspensionForce);g.raycastResult.hitNormalWorld.scale(n*b,l);g.raycastResult.hitPointWorld.vsub(h.position,q);h.applyImpulse(l,g.raycastResult.hitPointWorld)}this.updateFriction(b);l=new f;q=new f;n=new f; -for(k=0;c>k;k++){g=d[k];h.getVelocityAtWorldPoint(g.chassisConnectionPointWorld,n);var p=1;switch(this.indexUpAxis){case 1:p=-1}if(g.isInContact){this.getVehicleAxisWorld(this.indexForwardAxis,q);var m=q.dot(g.raycastResult.hitNormalWorld);g.raycastResult.hitNormalWorld.scale(m,l);q.vsub(l,q);m=q.dot(n);g.deltaRotation=p*m*b/g.radius}!g.sliding&&g.isInContact||0===g.engineForce||!g.useCustomSlidingRotationalSpeed||(g.deltaRotation=(0 -Math.abs(g.engineForce)&&(g.deltaRotation=0);g.rotation+=g.deltaRotation;g.deltaRotation*=.99}};b.prototype.updateSuspension=function(){for(var b=this.chassisBody.mass,d=this.wheelInfos,c=d.length,h=0;c>h;h++){var f=d[h];if(f.isInContact){var k;k=f.suspensionStiffness*(f.suspensionRestLength-f.suspensionLength)*f.clippedInvContactDotSuspension;var l=f.suspensionRelativeVelocity;k-=(0>l?f.dampingCompression:f.dampingRelaxation)*l;f.suspensionForce=k*b;0>f.suspensionForce&&(f.suspensionForce=0)}else f.suspensionForce= -0}};b.prototype.removeFromWorld=function(b){this.constraints;b.remove(this.chassisBody);b.removeEventListener('preStep',this.preStepCallback);this.world=null};var d=new f,v=new f;b.prototype.castRay=function(b){this.updateWheelTransformWorld(b);var c=this.chassisBody,h=-1;b.directionWorld.scale(b.suspensionRestLength+b.radius,d);var k=b.chassisConnectionPointWorld;k.vadd(d,v);var l=b.raycastResult;l.reset();var g=c.collisionResponse;c.collisionResponse=!1;this.world.rayTest(k,v,l);c.collisionResponse= -g;k=l.body;(b.raycastResult.groundObject=0,k)?(h=l.distance,b.raycastResult.hitNormalWorld=l.hitNormalWorld,b.isInContact=!0,b.suspensionLength=l.distance-b.radius,l=b.suspensionRestLength-b.maxSuspensionTravel,k=b.suspensionRestLength+b.maxSuspensionTravel,b.suspensionLengthk&&(b.suspensionLength=k,b.raycastResult.reset()),l=b.raycastResult.hitNormalWorld.dot(b.directionWorld),k=new f,c.getVelocityAtWorldPoint(b.raycastResult.hitPointWorld,k),c=b.raycastResult.hitNormalWorld.dot(k), --.1<=l?(b.suspensionRelativeVelocity=0,b.clippedInvContactDotSuspension=10):(l=-1/l,b.suspensionRelativeVelocity=c*l,b.clippedInvContactDotSuspension=l)):(b.suspensionLength=b.suspensionRestLength+0*b.maxSuspensionTravel,b.suspensionRelativeVelocity=0,b.directionWorld.scale(-1,b.raycastResult.hitNormalWorld),b.clippedInvContactDotSuspension=1);return h};b.prototype.updateWheelTransformWorld=function(b){b.isInContact=!1;var d=this.chassisBody;d.pointToWorldFrame(b.chassisConnectionPointLocal,b.chassisConnectionPointWorld); -d.vectorToWorldFrame(b.directionLocal,b.directionWorld);d.vectorToWorldFrame(b.axleLocal,b.axleWorld)};b.prototype.updateWheelTransform=function(b){b=this.wheelInfos[b];this.updateWheelTransformWorld(b);b.directionLocal.scale(-1,p);t.copy(b.axleLocal);p.cross(t,h);h.normalize();t.normalize();var d=b.steering,f=new c;f.setFromAxisAngle(p,d);d=new c;d.setFromAxisAngle(t,b.rotation);var k=b.worldTransform.quaternion;this.chassisBody.quaternion.mult(f,k);k.mult(d,k);k.normalize();f=b.worldTransform.position; -f.copy(b.directionWorld);f.scale(b.suspensionLength,f);f.vadd(b.chassisConnectionPointWorld,f)};var w=[new f(1,0,0),new f(0,1,0),new f(0,0,1)];b.prototype.getWheelTransformWorld=function(b){return this.wheelInfos[b].worldTransform};var y=new f,x=[],q=[];b.prototype.updateFriction=function(b){for(var d=this.wheelInfos,c=d.length,h=this.chassisBody,k=0,g=0;c>g;g++){var n=d[g],p=n.raycastResult.body;p&&k++;n.sideImpulse=0;n.forwardImpulse=0;q[g]||(q[g]=new f);x[g]||(x[g]=new f)}for(g=0;c>g;g++)if(n= -d[g],p=n.raycastResult.body){var m=x[g];this.getWheelTransformWorld(g).vectorToWorldFrame(w[this.indexRightAxis],m);var k=n.raycastResult.hitNormalWorld,t=m.dot(k);k.scale(t,y);m.vsub(y,m);m.normalize();k.cross(m,q[g]);q[g].normalize();k=n;var t=h,v=n.raycastResult.hitPointWorld,C=n.raycastResult.hitPointWorld;if(1.1g;g++){n=d[g];p=n.raycastResult.body;v=0;if(n.slipInfo=1,p){var k=n.brake?n.brake:0,F=h,C=p,m=n.raycastResult.hitPointWorld,z=q[g],v=k,t=0,D=m,M=u,na=A,la=E;F.getVelocityAtWorldPoint(D,M);C.getVelocityAtWorldPoint(D,na);M.vsub(na,la);D=z.dot(la);F=l(F,m,z);C=l(C,m,z);v=(t=1/(F+C)*-D,t>v&&(t=v),-v>t&&(t=-v),t);v+=n.engineForce*b;k/=v;n.slipInfo*=k}if(n.forwardImpulse=0,n.skidInfo=1,p)if(n.skidInfo=1,p=n.suspensionForce*b*n.frictionSlip,k=p*p,n.forwardImpulse=v,t=.5*n.forwardImpulse,v= -1*n.sideImpulse,t=t*t+v*v,n.sliding=!1,t>k)this.sliding=!0,n.sliding=!0,k=p/Math.sqrt(t),n.skidInfo*=k}if(this.sliding)for(g=0;c>g;g++)n=d[g],0!==n.sideImpulse&&1>n.skidInfo&&(n.forwardImpulse*=n.skidInfo,n.sideImpulse*=n.skidInfo);for(g=0;c>g;g++){n=d[g];b=new f;if(b.copy(n.raycastResult.hitPointWorld),0!==n.forwardImpulse)p=new f,q[g].scale(n.forwardImpulse,p),h.applyImpulse(p,b);0!==n.sideImpulse&&(p=n.raycastResult.body,k=new f,k.copy(n.raycastResult.hitPointWorld),t=new f,x[g].scale(n.sideImpulse, -t),h.pointToLocalFrame(b,b),b['xyz'[this.indexUpAxis]]*=n.rollInfluence,h.pointToWorldFrame(b,b),h.applyImpulse(t,b),t.scale(-1,t),p.applyImpulse(t,k))}};var u=new f,A=new f,E=new f,D=new f,C=new f,F=new f,z=new f,H=new f,G=new f,O=new f},{'../collision/Ray':9,'../collision/RaycastResult':10,'../math/Quaternion':28,'../math/Vec3':30,'../objects/WheelInfo':36,'./Body':31}],33:[function(g,m){function b(b){(this.wheelBodies=[],this.coordinateSystem='undefined'==typeof b.coordinateSystem?new k(1,2,3): -b.coordinateSystem.clone(),this.chassisBody=b.chassisBody,this.chassisBody)||(b=new c(new k(5,2,.5)),this.chassisBody=new l(1,b));this.constraints=[];this.wheelAxes=[];this.wheelForces=[]}var l=g('./Body'),f=g('../shapes/Sphere'),c=g('../shapes/Box'),k=g('../math/Vec3'),n=g('../constraints/HingeConstraint');m.exports=b;b.prototype.addWheel=function(b){b=b||{};var d=b.body;d||(d=new l(1,new f(1.2)));this.wheelBodies.push(d);this.wheelForces.push(0);var c=(new k,'undefined'!=typeof b.position?b.position.clone(): -new k),h=new k;this.chassisBody.pointToWorldFrame(c,h);d.position.set(h.x,h.y,h.z);b='undefined'!=typeof b.axis?b.axis.clone():new k(0,1,0);this.wheelAxes.push(b);d=new n(this.chassisBody,d,{pivotA:c,axisA:b,pivotB:k.ZERO,axisB:b,collideConnected:!1});return this.constraints.push(d),this.wheelBodies.length-1};b.prototype.setSteeringValue=function(b,d){var c=this.wheelAxes[d],h=Math.cos(b);b=Math.sin(b);var f=c.x,c=c.y;this.constraints[d].axisA.set(h*f-b*c,b*f+h*c,0)};b.prototype.setMotorSpeed=function(b, +3.6*h.velocity.norm();k=new g;this.getVehicleAxisWorld(this.indexForwardAxis,k);0>k.dot(h.velocity)&&(this.currentVehicleSpeedKmHour*=-1);for(k=0;c>k;k++)this.castRay(d[k]);this.updateSuspension(b);for(var e=new g,q=new g,k=0;c>k;k++){var n=d[k],l=n.suspensionForce;l>n.maxSuspensionForce&&(l=n.maxSuspensionForce);n.raycastResult.hitNormalWorld.scale(l*b,e);n.raycastResult.hitPointWorld.vsub(h.position,q);h.applyImpulse(e,n.raycastResult.hitPointWorld)}this.updateFriction(b);e=new g;q=new g;l=new g; +for(k=0;c>k;k++){n=d[k];h.getVelocityAtWorldPoint(n.chassisConnectionPointWorld,l);var p=1;switch(this.indexUpAxis){case 1:p=-1}if(n.isInContact){this.getVehicleAxisWorld(this.indexForwardAxis,q);var m=q.dot(n.raycastResult.hitNormalWorld);n.raycastResult.hitNormalWorld.scale(m,e);q.vsub(e,q);m=q.dot(l);n.deltaRotation=p*m*b/n.radius}!n.sliding&&n.isInContact||0===n.engineForce||!n.useCustomSlidingRotationalSpeed||(n.deltaRotation=(0 +Math.abs(n.engineForce)&&(n.deltaRotation=0);n.rotation+=n.deltaRotation;n.deltaRotation*=.99}};b.prototype.updateSuspension=function(){for(var b=this.chassisBody.mass,d=this.wheelInfos,c=d.length,h=0;c>h;h++){var g=d[h];if(g.isInContact){var k;k=g.suspensionStiffness*(g.suspensionRestLength-g.suspensionLength)*g.clippedInvContactDotSuspension;var e=g.suspensionRelativeVelocity;k-=(0>e?g.dampingCompression:g.dampingRelaxation)*e;g.suspensionForce=k*b;0>g.suspensionForce&&(g.suspensionForce=0)}else g.suspensionForce= +0}};b.prototype.removeFromWorld=function(b){this.constraints;b.remove(this.chassisBody);b.removeEventListener('preStep',this.preStepCallback);this.world=null};var d=new g,v=new g;b.prototype.castRay=function(b){this.updateWheelTransformWorld(b);var c=this.chassisBody,h=-1;b.directionWorld.scale(b.suspensionRestLength+b.radius,d);var k=b.chassisConnectionPointWorld;k.vadd(d,v);var e=b.raycastResult;e.reset();var q=c.collisionResponse;c.collisionResponse=!1;this.world.rayTest(k,v,e);c.collisionResponse= +q;k=e.body;(b.raycastResult.groundObject=0,k)?(h=e.distance,b.raycastResult.hitNormalWorld=e.hitNormalWorld,b.isInContact=!0,b.suspensionLength=e.distance-b.radius,e=b.suspensionRestLength-b.maxSuspensionTravel,k=b.suspensionRestLength+b.maxSuspensionTravel,b.suspensionLengthk&&(b.suspensionLength=k,b.raycastResult.reset()),e=b.raycastResult.hitNormalWorld.dot(b.directionWorld),k=new g,c.getVelocityAtWorldPoint(b.raycastResult.hitPointWorld,k),c=b.raycastResult.hitNormalWorld.dot(k), +-.1<=e?(b.suspensionRelativeVelocity=0,b.clippedInvContactDotSuspension=10):(e=-1/e,b.suspensionRelativeVelocity=c*e,b.clippedInvContactDotSuspension=e)):(b.suspensionLength=b.suspensionRestLength+0*b.maxSuspensionTravel,b.suspensionRelativeVelocity=0,b.directionWorld.scale(-1,b.raycastResult.hitNormalWorld),b.clippedInvContactDotSuspension=1);return h};b.prototype.updateWheelTransformWorld=function(b){b.isInContact=!1;var d=this.chassisBody;d.pointToWorldFrame(b.chassisConnectionPointLocal,b.chassisConnectionPointWorld); +d.vectorToWorldFrame(b.directionLocal,b.directionWorld);d.vectorToWorldFrame(b.axleLocal,b.axleWorld)};b.prototype.updateWheelTransform=function(b){b=this.wheelInfos[b];this.updateWheelTransformWorld(b);b.directionLocal.scale(-1,p);t.copy(b.axleLocal);p.cross(t,h);h.normalize();t.normalize();var d=b.steering,g=new c;g.setFromAxisAngle(p,d);d=new c;d.setFromAxisAngle(t,b.rotation);var k=b.worldTransform.quaternion;this.chassisBody.quaternion.mult(g,k);k.mult(d,k);k.normalize();g=b.worldTransform.position; +g.copy(b.directionWorld);g.scale(b.suspensionLength,g);g.vadd(b.chassisConnectionPointWorld,g)};var w=[new g(1,0,0),new g(0,1,0),new g(0,0,1)];b.prototype.getWheelTransformWorld=function(b){return this.wheelInfos[b].worldTransform};var y=new g,x=[],q=[];b.prototype.updateFriction=function(b){for(var d=this.wheelInfos,c=d.length,h=this.chassisBody,k=0,e=0;c>e;e++){var n=d[e],p=n.raycastResult.body;p&&k++;n.sideImpulse=0;n.forwardImpulse=0;q[e]||(q[e]=new g);x[e]||(x[e]=new g)}for(e=0;c>e;e++)if(n= +d[e],p=n.raycastResult.body){var m=x[e];this.getWheelTransformWorld(e).vectorToWorldFrame(w[this.indexRightAxis],m);var k=n.raycastResult.hitNormalWorld,t=m.dot(k);k.scale(t,y);m.vsub(y,m);m.normalize();k.cross(m,q[e]);q[e].normalize();k=n;var t=h,v=n.raycastResult.hitPointWorld,C=n.raycastResult.hitPointWorld;if(1.1e;e++){n=d[e];p=n.raycastResult.body;v=0;if(n.slipInfo=1,p){var k=n.brake?n.brake:0,F=h,C=p,m=n.raycastResult.hitPointWorld,z=q[e],v=k,t=0,D=m,M=u,na=A,la=E;F.getVelocityAtWorldPoint(D,M);C.getVelocityAtWorldPoint(D,na);M.vsub(na,la);D=z.dot(la);F=l(F,m,z);C=l(C,m,z);v=(t=1/(F+C)*-D,t>v&&(t=v),-v>t&&(t=-v),t);v+=n.engineForce*b;k/=v;n.slipInfo*=k}if(n.forwardImpulse=0,n.skidInfo=1,p)if(n.skidInfo=1,p=n.suspensionForce*b*n.frictionSlip,k=p*p,n.forwardImpulse=v,t=.5*n.forwardImpulse,v= +1*n.sideImpulse,t=t*t+v*v,n.sliding=!1,t>k)this.sliding=!0,n.sliding=!0,k=p/Math.sqrt(t),n.skidInfo*=k}if(this.sliding)for(e=0;c>e;e++)n=d[e],0!==n.sideImpulse&&1>n.skidInfo&&(n.forwardImpulse*=n.skidInfo,n.sideImpulse*=n.skidInfo);for(e=0;c>e;e++){n=d[e];b=new g;if(b.copy(n.raycastResult.hitPointWorld),0!==n.forwardImpulse)p=new g,q[e].scale(n.forwardImpulse,p),h.applyImpulse(p,b);0!==n.sideImpulse&&(p=n.raycastResult.body,k=new g,k.copy(n.raycastResult.hitPointWorld),t=new g,x[e].scale(n.sideImpulse, +t),h.pointToLocalFrame(b,b),b['xyz'[this.indexUpAxis]]*=n.rollInfluence,h.pointToWorldFrame(b,b),h.applyImpulse(t,b),t.scale(-1,t),p.applyImpulse(t,k))}};var u=new g,A=new g,E=new g,D=new g,C=new g,F=new g,z=new g,H=new g,G=new g,O=new g},{'../collision/Ray':9,'../collision/RaycastResult':10,'../math/Quaternion':28,'../math/Vec3':30,'../objects/WheelInfo':36,'./Body':31}],33:[function(e,m){function b(b){(this.wheelBodies=[],this.coordinateSystem='undefined'==typeof b.coordinateSystem?new k(1,2,3): +b.coordinateSystem.clone(),this.chassisBody=b.chassisBody,this.chassisBody)||(b=new c(new k(5,2,.5)),this.chassisBody=new l(1,b));this.constraints=[];this.wheelAxes=[];this.wheelForces=[]}var l=e('./Body'),g=e('../shapes/Sphere'),c=e('../shapes/Box'),k=e('../math/Vec3'),n=e('../constraints/HingeConstraint');m.exports=b;b.prototype.addWheel=function(b){b=b||{};var d=b.body;d||(d=new l(1,new g(1.2)));this.wheelBodies.push(d);this.wheelForces.push(0);var c=(new k,'undefined'!=typeof b.position?b.position.clone(): +new k),h=new k;this.chassisBody.pointToWorldFrame(c,h);d.position.set(h.x,h.y,h.z);b='undefined'!=typeof b.axis?b.axis.clone():new k(0,1,0);this.wheelAxes.push(b);d=new n(this.chassisBody,d,{pivotA:c,axisA:b,pivotB:k.ZERO,axisB:b,collideConnected:!1});return this.constraints.push(d),this.wheelBodies.length-1};b.prototype.setSteeringValue=function(b,d){var c=this.wheelAxes[d],h=Math.cos(b);b=Math.sin(b);var g=c.x,c=c.y;this.constraints[d].axisA.set(h*g-b*c,b*g+h*c,0)};b.prototype.setMotorSpeed=function(b, d){d=this.constraints[d];d.enableMotor();d.motorTargetVelocity=b};b.prototype.disableMotor=function(b){this.constraints[b].disableMotor()};var p=new k;b.prototype.setWheelForce=function(b,d){this.wheelForces[d]=b};b.prototype.applyWheelForce=function(b,d){var c=this.wheelBodies[d],h=c.torque;this.wheelAxes[d].scale(b,p);c.vectorToWorldFrame(p,p);h.vadd(p,h)};b.prototype.addToWorld=function(b){for(var d=this.constraints,c=this.wheelBodies.concat([this.chassisBody]),h=0;hthis.particles.length&&this.neighbors.pop())};var l=new m;b.prototype.getNeighbors=function(b,d){for(var c=this.particles.length,h=b.id,f=this.smoothingRadius*this.smoothingRadius,k=0;k!==c;k++){var g=this.particles[k];g.position.vsub(b.position,l);h!==g.id&&l.norm2()this.particles.length&&this.neighbors.pop())};var l=new m;b.prototype.getNeighbors=function(b,d){for(var c=this.particles.length,h=b.id,g=this.smoothingRadius*this.smoothingRadius,k=0;k!==c;k++){var e=this.particles[k];e.position.vsub(b.position,l);h!==e.id&&l.norm2()f;f++){k=n[f];c.vmult(k,k);b.vadd(k,k);var l=k.x,g=k.y,k=k.z;l>d.x&&(d.x=l);g>d.y&&(d.y=g);k>d.z&&(d.z=k);ld.dot(this.vertices[this.faces[b][0]]))for(console.error('.faceNormals['+b+'] = Vec3('+d.toString()+') looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.'),d=0;dm&&(m=v,p=u)}for(var m=[],u=c.faces[p],v=u.length,w=0;v>w;w++){var A=c.vertices[u[w]],y=new f;y.copy(A);k.vmult(y,y);h.vadd(y,y);m.push(y)}0<=p&&this.clipFaceAgainstHull(l,b,d, -m,g,n,q)};var h=new f,d=new f,v=new f,w=new f,y=new f,x=new f;b.prototype.findSeparatingAxis=function(b,c,f,k,l,g,n,q){var p=Number.MAX_VALUE,m=0;if(this.uniqueAxes)for(var u=0;u!==this.uniqueAxes.length;u++){f.vmult(this.uniqueAxes[u],h);var t=this.testSepAxis(h,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(h))}else for(var A=n?n.length:this.faces.length,u=0;A>u;u++){t=n?n[u]:u;h.copy(this.faceNormals[t]);f.vmult(h,h);t=this.testSepAxis(h,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(h))}if(b.uniqueAxes)for(u= -0;u!==b.uniqueAxes.length;u++){l.vmult(b.uniqueAxes[u],d);m++;t=this.testSepAxis(d,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(d))}else for(n=q?q.length:b.faces.length,u=0;n>u;u++){t=q?q[u]:u;d.copy(b.faceNormals[t]);l.vmult(d,d);m++;t=this.testSepAxis(d,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(d))}for(q=0;q!==this.uniqueEdges.length;q++)for(f.vmult(this.uniqueEdges[q],w),m=0;m!==b.uniqueEdges.length;m++)if(l.vmult(b.uniqueEdges[m],y),w.cross(y,x),!x.almostZero()){x.normalize();u=this.testSepAxis(x, -b,c,f,k,l);if(!1===u)return!1;p>u&&(p=u,g.copy(x))}return k.vsub(c,v),0h||d>c)return!1;h-=f;d=c-d;return d>h?h:d};var A=new f,E=new f;b.prototype.calculateLocalInertia=function(b,d){this.computeLocalAABB(A,E);var c=E.x-A.x,h=E.y-A.y,f=E.z-A.z;d.x=1/12*b*(4*h*h+4*f*f);d.y=1/12*b*(4*c*c+4*f*f);d.z=1/12*b*(4*h*h+4*c*c)};b.prototype.getPlaneConstantOfFace= -function(b){return-this.faceNormals[b].dot(this.vertices[this.faces[b][0]])};var D=new f,C=new f,F=new f,z=new f,H=new f,G=new f,O=new f,M=new f;b.prototype.clipFaceAgainstHull=function(b,d,c,h,f,k,l){for(var g=[],n=-1,q=Number.MAX_VALUE,p=0;pm&&(q=m,n=p)}if(!(0>n)){b=this.faces[n];b.connectedFaces=[];for(q=0;qp;p++){m=this.vertices[b[p]];m.vsub(this.vertices[b[(p+1)%q]],C);F.copy(C);c.vmult(F,F);d.vadd(F,F);z.copy(this.faceNormals[n]);c.vmult(z,z);d.vadd(z,z);F.cross(z,H);H.negate(H);G.copy(m);c.vmult(G,G);d.vadd(G,G);m=(-G.dot(H),b.connectedFaces[p]);O.copy(this.faceNormals[m]);m=this.getPlaneConstantOfFace(m);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(this.clipFaceAgainstPlane(h,g,M,m);h.length;)h.shift();for(;g.length;)h.push(g.shift())}O.copy(this.faceNormals[n]); -m=this.getPlaneConstantOfFace(n);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(q=0;q=d&&(console.log('clamped: depth='+d+' to minDist='+(f+'')),d=f),k>=d)c=h[q],0>=d&&l.push({point:c,normal:M,depth:d})}};b.prototype.clipFaceAgainstPlane=function(b,d,c,h){var k,l,g=b.length;if(2>g)return d;var n=b[b.length-1],q=b[0];k=c.dot(n)+h;for(var p=0;g>p;p++){if(q=b[p],l=c.dot(q)+h,0>k){if(0>l){var m=new f;m.copy(q)}else m=new f,n.lerp(q,k/(k-l),m);d.push(m)}else 0>l&&(m=new f,n.lerp(q, -k/(k-l),m),d.push(m),d.push(q));n=q;k=l}return d};b.prototype.computeWorldVertices=function(b,d){for(var c=this.vertices.length;this.worldVertices.lengthf;f++){var k=h[f];k.xd.x&&(d.x=k.x);k.yd.y&&(d.y=k.y);k.zd.z&&(d.z=k.z)}};b.prototype.computeWorldFaceNormals=function(b){for(var d=this.faceNormals.length;this.worldFaceNormals.lengthb&&(b=f)}this.boundingSphereRadius=Math.sqrt(b)};var J=new f;b.prototype.calculateWorldAABB=function(b,d,c,h){for(var f,k,l,g,n,q,p=this.vertices.length,m=this.vertices,u=0;p>u;u++){J.copy(m[u]);d.vmult(J,J);b.vadd(J,J);var t=J;t.xg||void 0===g)&&(g=t.x);t.yn||void 0===n)&&(n=t.y);t.zq||void 0===q)&&(q=t.z)}c.set(f,k,l);h.set(g,n,q)};b.prototype.volume=function(){return 4*Math.PI* -this.boundingSphereRadius/3};b.prototype.getAveragePointLocal=function(b){b=b||new f;for(var d=this.vertices.length,c=this.vertices,h=0;d>h;h++)b.vadd(c[h],b);return b.mult(1/d,b),b};b.prototype.transformAllPoints=function(b,d){var c=this.vertices.length,h=this.vertices;if(d){for(var f=0;c>f;f++){var k=h[f];d.vmult(k,k)}for(f=0;ff;f++)k=h[f],k.vadd(b,k)};var P=new f,N=new f,V=new f;b.prototype.pointIsInside=function(b){var d, -c=this.vertices,h=this.faces,f=this.faceNormals,k=this.faces.length;this.getAveragePointLocal(P);for(var l=0;k>l;l++){d=(this.faces[l].length,f[l]);var g=c[h[l][0]],n=N;b.vsub(g,n);var n=d.dot(n),q=V;P.vsub(g,q);d=d.dot(q);if(0>n&&0d)return!1}return-1};var X=(new f,new f),T=new f;b.project=function(b,d,h,f,k){var l=b.vertices.length;b=b.vertices;T.setZero();c.vectorToLocalFrame(h,f,d,X);c.pointToLocalFrame(h,f,T,T);f=T.dot(X);h=d=b[0].dot(X);for(var g=1;l>g;g++){var n=b[g].dot(X);n>d&& -(d=n);h>n&&(h=n)}if(h-=f,d-=f,h>d)d=h=d;k[0]=d;k[1]=h}},{'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'./Shape':43}],39:[function(g,m){function b(b,g,p,m){var h=[],d=[],k=[],n=[],t=[],x=Math.cos,q=Math.sin;h.push(new f(g*x(0),g*q(0),.5*-p));n.push(0);h.push(new f(b*x(0),b*q(0),.5*p));t.push(1);for(var u=0;m>u;u++){var A=2*Math.PI/m*(u+1),E=2*Math.PI/m*(u+.5);m-1>u?(h.push(new f(g*x(A),g*q(A),.5*-p)),n.push(2*u+2),h.push(new f(b*x(A),b*q(A),.5*p)),t.push(2*u+3),k.push([2*u+2,2* -u+3,2*u+1,2*u])):k.push([0,1,2*u+1,2*u]);(1===m%2||m/2>u)&&d.push(new f(x(E),q(E),0))}k.push(t);d.push(new f(0,0,1));b=[];for(u=0;ud&&(c=d)}this.minValue=c};b.prototype.updateMaxValue=function(){for(var b=this.data,c=b[0][0],f=0;f!==b.length;f++)for(var h=0;h!==b[f].length;h++){var d=b[f][h];d>c&&(c=d)}this.maxValue=c};b.prototype.setHeightValueAtIndex=function(b,c,f){this.data[b][c]=f;this.clearCachedConvexTrianglePillar(b,c,!1);0=b;b++)for(var g=c;h>=g;g++){var n=k[b][g];n>l&&(l=n)}d[0]=this.minValue;d[1]=l};b.prototype.getIndexOfPosition=function(b,c,f,h){var d=this.elementSize,k=this.data;b=Math.floor(b/d);c=Math.floor(c/ -d);return f[0]=b,f[1]=c,h&&(0>b&&(b=0),0>c&&(c=0),b>=k.length-1&&(b=k.length-1),c>=k[0].length-1&&(c=k[0].length-1)),0>b||0>c||b>=k.length-1||c>=k[0].length-1?!1:!0};b.prototype.getHeightAt=function(b,c,f){var h=[];this.getIndexOfPosition(b,c,h,f);b=[];return this.getRectMinMax(h[0],h[1]+1,h[0],h[1]+1,b),(b[0]+b[1])/2};b.prototype.getCacheConvexTrianglePillarKey=function(b,c,f){return b+'_'+c+'_'+(f?1:0)};b.prototype.getCachedConvexTrianglePillar=function(b,c,f){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(b, -c,f)]};b.prototype.setCachedConvexTrianglePillar=function(b,c,f,h,d){this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,f)]={convex:h,offset:d}};b.prototype.clearCachedConvexTrianglePillar=function(b,c,f){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,f)]};b.prototype.getConvexTrianglePillar=function(b,k,l){var h=this.pillarConvex,d=this.pillarOffset;if(this.cacheEnabled){var g=this.getCachedConvexTrianglePillar(b,k,l);if(g)return this.pillarConvex=g.convex,void(this.pillarOffset= -g.offset);h=new f;d=new c;this.pillarConvex=h;this.pillarOffset=d}var g=this.data,n=this.elementSize,p=h.faces;h.vertices.length=6;for(var m=0;6>m;m++)h.vertices[m]||(h.vertices[m]=new c);p.length=5;for(m=0;5>m;m++)p[m]||(p[m]=[]);var m=h.vertices,q=(Math.min(g[b][k],g[b+1][k],g[b][k+1],g[b+1][k+1])-this.minValue)/2+this.minValue;l?(d.set((b+.75)*n,(k+.75)*n,q),m[0].set(.25*n,.25*n,g[b+1][k+1]-q),m[1].set(-.75*n,.25*n,g[b][k+1]-q),m[2].set(.25*n,-.75*n,g[b+1][k]-q),m[3].set(.25*n,.25*n,-q-1),m[4].set(-.75* -n,.25*n,-q-1),m[5].set(.25*n,-.75*n,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3,p[2][0]=2,p[2][1]=5,p[2][2]=3,p[2][3]=0,p[3][0]=3,p[3][1]=4,p[3][2]=1,p[3][3]=0,p[4][0]=1,p[4][1]=4,p[4][2]=5,p[4][3]=2):(d.set((b+.25)*n,(k+.25)*n,q),m[0].set(-.25*n,-.25*n,g[b][k]-q),m[1].set(.75*n,-.25*n,g[b+1][k]-q),m[2].set(-.25*n,.75*n,g[b][k+1]-q),m[3].set(-.25*n,-.25*n,-q-1),m[4].set(.75*n,-.25*n,-q-1),m[5].set(-.25*n,.75*n,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3, -p[2][0]=0,p[2][1]=2,p[2][2]=5,p[2][3]=3,p[3][0]=1,p[3][1]=0,p[3][2]=3,p[3][3]=4,p[4][0]=4,p[4][1]=5,p[4][2]=2,p[4][3]=1);h.computeNormals();h.computeEdges();h.updateBoundingSphereRadius();this.setCachedConvexTrianglePillar(b,k,l,h,d)};b.prototype.calculateLocalInertia=function(b,f){return f=f||new c,f.set(0,0,0),f};b.prototype.volume=function(){return Number.MAX_VALUE};b.prototype.calculateWorldAABB=function(b,c,f,h){f.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);h.set(Number.MAX_VALUE, -Number.MAX_VALUE,Number.MAX_VALUE)};b.prototype.updateBoundingSphereRadius=function(){var b=this.data,f=this.elementSize;this.boundingSphereRadius=(new c(b.length*f,b[0].length*f,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue)))).norm()}},{'../math/Vec3':30,'../utils/Utils':53,'./ConvexPolyhedron':38,'./Shape':43}],41:[function(g,m){function b(){l.call(this);this.type=l.types.PARTICLE}m.exports=b;var l=g('./Shape'),f=g('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia= -function(b,k){return k=k||new f,k.set(0,0,0),k};b.prototype.volume=function(){return 0};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=0};b.prototype.calculateWorldAABB=function(b,f,g,l){g.copy(b);l.copy(b)}},{'../math/Vec3':30,'./Shape':43}],42:[function(g,m){function b(){l.call(this);this.type=l.types.PLANE;this.worldNormal=new f;this.worldNormalNeedsUpdate=!0;this.boundingSphereRadius=Number.MAX_VALUE}m.exports=b;var l=g('./Shape'),f=g('../math/Vec3');b.prototype=new l; -b.prototype.constructor=b;b.prototype.computeWorldNormal=function(b){var c=this.worldNormal;c.set(0,0,1);b.vmult(c,c);this.worldNormalNeedsUpdate=!1};b.prototype.calculateLocalInertia=function(b,c){return c||new f};b.prototype.volume=function(){return Number.MAX_VALUE};var c=new f;b.prototype.calculateWorldAABB=function(b,f,g,l){c.set(0,0,1);f.vmult(c,c);f=Number.MAX_VALUE;g.set(-f,-f,-f);l.set(f,f,f);1===c.x&&(l.x=b.x);1===c.y&&(l.y=b.y);1===c.z&&(l.z=b.z);-1===c.x&&(g.x=b.x);-1===c.y&&(g.y=b.y); --1===c.z&&(g.z=b.z)};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=Number.MAX_VALUE}},{'../math/Vec3':30,'./Shape':43}],43:[function(g,m){function b(){this.id=b.idCounter++;this.boundingSphereRadius=this.type=0;this.collisionResponse=!0;this.material=null}m.exports=b;b=g('./Shape');g('../math/Vec3');g('../math/Quaternion');g('../material/Material');b.prototype.constructor=b;b.prototype.updateBoundingSphereRadius=function(){throw'computeBoundingSphereRadius() not implemented for shape type '+ -this.type;};b.prototype.volume=function(){throw'volume() not implemented for shape type '+this.type;};b.prototype.calculateLocalInertia=function(){throw'calculateLocalInertia() not implemented for shape type '+this.type;};b.idCounter=0;b.types={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256}},{'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'./Shape':43}],44:[function(g,m){function b(b){if(l.call(this),this.radius=void 0!== -b?Number(b):1,this.type=l.types.SPHERE,0>this.radius)throw Error('The sphere radius cannot be negative.');this.updateBoundingSphereRadius()}m.exports=b;var l=g('./Shape'),f=g('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia=function(b,k){k=k||new f;b=2*b*this.radius*this.radius/5;return k.x=b,k.y=b,k.z=b,k};b.prototype.volume=function(){return 4*Math.PI*this.radius/3};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.radius}; -b.prototype.calculateWorldAABB=function(b,f,g,l){f=this.radius;for(var c=['x','y','z'],h=0;hf?f+'_'+ -k:k+'_'+f]=!0},c=0;cb.x&&(b.x=h.x),h.yb.y&&(b.y=h.y),h.zb.z&&(b.z=h.z)};b.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)};b.prototype.updateBoundingSphereRadius=function(){for(var b=0,d=this.vertices,c=new f,h=0,d=d.length/3;h!==d;h++){this.getVertex(h, -c);var k=c.norm2();k>b&&(b=k)}this.boundingSphereRadius=Math.sqrt(b)};var E=(new f,new c),D=new k;b.prototype.calculateWorldAABB=function(b,d,c,h){E.position=b;E.quaternion=d;this.aabb.toWorldFrame(E,D);c.copy(D.lowerBound);h.copy(D.upperBound)};b.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};b.createTorus=function(d,c,h,f,k){d=d||1;c=c||.5;h=h||8;f=f||6;k=k||2*Math.PI;for(var g=[],l=[],q=0;h>=q;q++)for(var n=0;f>=n;n++){var p=n/f*k,m=q/h*Math.PI*2;g.push((d+c*Math.cos(m))* -Math.cos(p),(d+c*Math.cos(m))*Math.sin(p),c*Math.sin(m))}for(q=1;h>=q;q++)for(n=1;f>=n;n++)d=(f+1)*(q-1)+n-1,c=(f+1)*(q-1)+n,k=(f+1)*q+n,l.push((f+1)*q+n-1,d,k),l.push(d,c,k);return new b(g,l)}},{'../collision/AABB':3,'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'../utils/Octree':50,'./Shape':43}],46:[function(g,m){function b(){l.call(this);this.iterations=10;this.tolerance=1E-7}m.exports=b;var l=(g('../math/Vec3'),g('../math/Quaternion'),g('./Solver'));b.prototype=new l;var f= -[],c=[],k=[];b.prototype.solve=function(b,g){var l,h,d,n,p=0,m=this.iterations,x=this.tolerance*this.tolerance,q=this.equations,u=q.length;g=g.bodies;var A=g.length;if(0!==u)for(d=0;d!==A;d++)g[d].updateSolveMassProperties();c.length=u;k.length=u;f.length=u;for(d=0;d!==u;d++){var E=q[d];f[d]=0;k[d]=E.computeB(b);c[d]=1/E.computeC()}if(0!==u){for(d=0;d!==A;d++)E=g[d],p=E.wlambda,E.vlambda.set(0,0,0),p&&p.set(0,0,0);for(p=0;p!==m;p++){for(var D=d=0;D!==u;D++)E=q[D],l=k[D],h=c[D],b=f[D],n=E.computeGWlambda(), -l=h*(l-n-E.eps*b),b+lE.maxForce&&(l=E.maxForce-b),f[D]+=l,d+=0d*d)break}for(d=0;d!==A;d++)E=g[d],m=E.velocity,x=E.angularVelocity,m.vadd(E.vlambda,m),x&&x.vadd(E.wlambda,x)}return p}},{'../math/Quaternion':28,'../math/Vec3':30,'./Solver':47}],47:[function(g,m){function b(){this.equations=[]}m.exports=b;b.prototype.solve=function(){return 0};b.prototype.addEquation=function(b){b.enabled&&this.equations.push(b)};b.prototype.removeEquation= -function(b){var f=this.equations;b=f.indexOf(b);-1!==b&&f.splice(b,1)};b.prototype.removeAllEquations=function(){this.equations.length=0}},{}],48:[function(g,m){function b(b){k.call(this);this.iterations=10;this.tolerance=1E-7;this.subsolver=b;this.nodes=[];for(this.nodePool=[];128>this.nodePool.length;)this.nodePool.push(this.createNode())}function l(b){for(var d=b.length,c=0;c!==d;c++){var f=b[c];if(!(f.visited||f.body.type&h))return f}return!1}function f(b,d,c){d.push(b.body);d=b.eqs.length;for(var h= -0;h!==d;h++){var f=b.eqs[h];-1===c.indexOf(f)&&c.push(f)}}function c(b,d){return d.id-b.id}m.exports=b;var k=(g('../math/Vec3'),g('../math/Quaternion'),g('./Solver'));g=g('../objects/Body');b.prototype=new k;var n=[],p=[],t={bodies:[]},h=g.STATIC,d=[];b.prototype.createNode=function(){return{body:null,children:[],eqs:[],visited:!1}};b.prototype.solve=function(b,h){var k=this.nodePool,g=h.bodies,q=this.equations,m=q.length,v=g.length;for(h=this.subsolver;k.lengthw;w++)n[w]=k[w];for(w=0;w!==v;w++)k=n[w],k.body=g[w],k.children.length=0,k.eqs.length=0,k.visited=!1;for(k=0;k!==m;k++){var v=q[k],w=g.indexOf(v.bi),D=g.indexOf(v.bj),w=n[w],D=n[D];w.children.push(D);w.eqs.push(v);D.children.push(w);D.eqs.push(v)}g=0;q=p;h.tolerance=this.tolerance;for(h.iterations=this.iterations;w=l(n);){q.length=0;t.bodies.length=0;v=w;w=f;m=t.bodies;k=q;d.push(v);v.visited=!0;for(w(v,m,k);d.length;)for(D=d.pop();v=l(D.children);)v.visited=!0,w(v,m,k),d.push(v); -m=q.length;q=q.sort(c);for(w=0;w!==m;w++)h.addEquation(q[w]);h.solve(b,t);h.removeAllEquations();g++}return g}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'./Solver':47}],49:[function(g,m){g=function(){};m.exports=g;g.prototype={constructor:g,addEventListener:function(b,g){void 0===this._listeners&&(this._listeners={});var f=this._listeners;return void 0===f[b]&&(f[b]=[]),-1===f[b].indexOf(g)&&f[b].push(g),this},hasEventListener:function(b,g){if(void 0===this._listeners)return!1; -var f=this._listeners;return void 0!==f[b]&&-1!==f[b].indexOf(g)?!0:!1},removeEventListener:function(b,g){if(void 0===this._listeners)return this;var f=this._listeners;if(void 0===f[b])return this;g=f[b].indexOf(g);return-1!==g&&f[b].splice(g,1),this},dispatchEvent:function(b){if(void 0===this._listeners)return this;var g=this._listeners[b.type];if(void 0!==g){b.target=this;for(var f=0,c=g.length;c>f;f++)g[f].call(this,b)}return this}}},{}],50:[function(g,m){function b(b){b=b||{};this.root=b.root|| -null;this.aabb=b.aabb?b.aabb.clone():new f;this.data=[];this.children=[]}function l(c,f){f=f||{};f.root=null;f.aabb=c;b.call(this,f);this.maxDepth='undefined'!=typeof f.maxDepth?f.maxDepth:8}var f=g('../collision/AABB'),c=g('../math/Vec3');m.exports=l;l.prototype=new b;b.prototype.reset=function(){this.children.length=this.data.length=0};b.prototype.insert=function(b,c,h){var d=this.data;if(h=h||0,!this.aabb.contains(b))return!1;var f=this.children;if(h<(this.maxDepth||this.root.maxDepth)){var k= -!1;f.length||(this.subdivide(),k=!0);for(var g=0;8!==g;g++)if(f[g].insert(b,c,h+1))return!0;k&&(f.length=0)}return d.push(c),!0};var k=new c;b.prototype.subdivide=function(){var g=this.aabb,l=g.lowerBound,h=g.upperBound,g=this.children;g.push(new b({aabb:new f({lowerBound:new c(0,0,0)})}),new b({aabb:new f({lowerBound:new c(1,0,0)})}),new b({aabb:new f({lowerBound:new c(1,1,0)})}),new b({aabb:new f({lowerBound:new c(1,1,1)})}),new b({aabb:new f({lowerBound:new c(0,1,1)})}),new b({aabb:new f({lowerBound:new c(0, -0,1)})}),new b({aabb:new f({lowerBound:new c(1,0,1)})}),new b({aabb:new f({lowerBound:new c(0,1,0)})}));h.vsub(l,k);k.scale(.5,k);for(var h=this.root||this,d=0;8!==d;d++){var n=g[d];n.root=h;var m=n.aabb.lowerBound;m.x*=k.x;m.y*=k.y;m.z*=k.z;m.vadd(l,m);m.vadd(k,n.aabb.upperBound)}};b.prototype.aabbQuery=function(b,c){for(var h=(this.data,this.children,[this]);h.length;){var d=h.pop();d.aabb.overlaps(b)&&Array.prototype.push.apply(c,d.data);Array.prototype.push.apply(h,d.children)}return c};var n= -new f;b.prototype.rayQuery=function(b,c,h){return b.getAABB(n),n.toLocalFrame(c,n),this.aabbQuery(n,h),h};b.prototype.removeEmptyNodes=function(){for(var b=[this];b.length;){for(var c=b.pop(),h=c.children.length-1;0<=h;h--)c.children[h].data.length||c.children.splice(h,1);Array.prototype.push.apply(b,c.children)}}},{'../collision/AABB':3,'../math/Vec3':30}],51:[function(g,m){function b(){this.objects=[];this.type=Object}m.exports=b;b.prototype.release=function(){for(var b=arguments.length,f=0;f!== -b;f++)this.objects.push(arguments[f])};b.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()};b.prototype.constructObject=function(){throw Error('constructObject() not implemented in this Pool subclass yet!');}},{}],52:[function(g,m){function b(){this.data={keys:[]}}m.exports=b;b.prototype.get=function(b,f){b>f&&(b=f=b);return this.data[b+'-'+f]};b.prototype.set=function(b,f,c){b>f&&(b=f=b);var k=b+'-'+f;this.get(b,f)||this.data.keys.push(k);this.data[k]= -c};b.prototype.reset=function(){for(var b=this.data,f=b.keys;0p.boundingSphereRadius+t.boundingSphereRadius)){var v=null;p.material&&t.material&&(v=c.getContactMaterial(p.material,t.material)||null);this.currentContactMaterial=v||l||c.defaultContactMaterial;(v=this[p.type|t.type])&&(p.type=A.dot(m)){var u=this.createContactEquation(q,n,b,d);u.ni.copy(A);var t=D;A.scale(m.dot(A),t);p.vsub(t,t);u.ri.copy(t);u.ri.vsub(q.position,u.ri);u.rj.copy(p);u.rj.vsub(n.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}}};var C=new c,F=new c,z=(new c,new c),H=new c,G=new c,O=new c,M=new c,J=new c,P=new c,N=new c,V=new c,X=new c,T=new c,fa=new m,Z=[];b.prototype[l.types.SPHERE|l.types.TRIMESH]=b.prototype.sphereTrimesh=function(b, -d,c,h,g,l,q,n){k.pointToLocalFrame(h,l,c,P);g=b.radius;fa.lowerBound.set(P.x-g,P.y-g,P.z-g);fa.upperBound.set(P.x+g,P.y+g,P.z+g);d.getTrianglesInAABB(fa,Z);var p=b.radius*b.radius;for(g=0;gm;m++)if(d.getVertex(d.indices[3*Z[g]+m],z),z.vsub(P,F),F.norm2()<=p){H.copy(z);k.pointToWorldFrame(h,l,H,z);z.vsub(c,F);var u=this.createContactEquation(q,n,b,d);u.ni.copy(F);u.ni.normalize();u.ri.copy(u.ni);u.ri.scale(b.radius,u.ri);u.ri.vadd(c,u.ri);u.ri.vsub(q.position,u.ri);u.rj.copy(z); -u.rj.vsub(n.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}for(g=0;gm;m++)d.getVertex(d.indices[3*Z[g]+m],G),d.getVertex(d.indices[3*Z[g]+(m+1)%3],O),O.vsub(G,M),P.vsub(O,N),c=N.dot(M),P.vsub(G,N),u=N.dot(M),0c&&(P.vsub(G,N),J.copy(M),J.normalize(),u=N.dot(J),J.scale(u,N),N.vadd(G,N),c=N.distanceTo(P),cC&&0F&&F>-E&&D>L&&L>-D&&(C=Math.abs(C-y-k),(null===t||t>C)&&(t=C,m=F,u=L,n=y,ha.copy(A),ua.copy(x),ea.copy(z),p++))}}p&&(q=!0,p=this.createContactEquation(g,l,b,d),ha.mult(-k,p.ri),p.ni.copy(ha),p.ni.negate(p.ni),ha.mult(n,ha),ua.mult(m,ua),ha.vadd(ua,ha),ea.mult(u,ea),ha.vadd(ea, -p.rj),p.ri.vadd(c,p.ri),p.ri.vsub(g.position,p.ri),p.rj.vadd(h,p.rj),p.rj.vsub(l.position,p.rj),this.result.push(p),this.createFrictionEquationsFromContact(p,this.frictionResult));C=f.get();for(n=0;2!==n&&!q;n++)for(m=0;2!==m&&!q;m++)for(u=0;2!==u&&!q;u++)if(C.set(0,0,0),n?C.vadd(ca[0],C):C.vsub(ca[0],C),m?C.vadd(ca[1],C):C.vsub(ca[1],C),u?C.vadd(ca[2],C):C.vsub(ca[2],C),h.vadd(C,Ba),Ba.vsub(c,Ba),Ba.norm2()x&&(q=!0,u=this.createContactEquation(g,l,b,d),v.vadd(w,u.rj),u.rj.copy(u.rj),C.negate(u.ni),u.ni.normalize(),u.ri.copy(u.rj),u.ri.vadd(h,u.ri),u.ri.vsub(c,u.ri),u.ri.normalize(),u.ri.mult(k,u.ri),u.ri.vadd(c,u.ri),u.ri.vsub(g.position,u.ri),u.rj.vadd(h,u.rj),u.rj.vsub(l.position,u.rj),this.result.push(u),this.createFrictionEquationsFromContact(u,this.frictionResult))}f.release(t,v,p,w,C)};var ia=new c,qa=new c,ra=new c,Aa=new c,Vb= -new c,td=new c,Zd=new c,nb=new c,Gc=new c,ba=new c;b.prototype[l.types.SPHERE|l.types.CONVEXPOLYHEDRON]=b.prototype.sphereConvex=function(b,d,c,h,f,k,g,l){f=this.v3pool;c.vsub(h,ia);for(var q=d.faceNormals,n=d.faces,p=d.vertices,m=b.radius,u=0;u!==p.length;u++){var t=Vb;k.vmult(p[u],t);h.vadd(t,t);var v=Aa;if(t.vsub(c,v),v.norm2()y&&0=L&&!1===E)){C=!1;break a}null===E&&(E=0=Qa.dot(xa)){var n=this.createContactEquation(g,l,b,d),p=cb;Qa.mult(Qa.dot(xa), -p);Ea.vsub(p,p);p.vsub(c,n.ri);n.ni.copy(Qa);Ea.vsub(h,n.rj);n.ri.vadd(c,n.ri);n.ri.vsub(g.position,n.ri);n.rj.vadd(h,n.rj);n.rj.vsub(l.position,n.rj);this.result.push(n);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(n,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)};var aa=new c,ga=new c;b.prototype[l.types.CONVEXPOLYHEDRON]=b.prototype.convexConvex=function(b,d,c,h,f,k,g,l,q,n,p,m){if(!(c.distanceTo(h)>b.boundingSphereRadius+d.boundingSphereRadius)&& -b.findSeparatingAxis(d,c,f,h,k,aa,p,m)){p=[];b.clipAgainstHull(c,f,d,h,k,aa,-100,100,p);for(k=f=0;k!==p.length;k++){m=this.createContactEquation(g,l,b,d,q,n);var u=m.ri,t=m.rj;aa.negate(m.ni);p[k].normal.negate(ga);ga.mult(p[k].depth,ga);p[k].point.vadd(ga,u);t.copy(p[k].point);u.vsub(c,u);t.vsub(h,t);u.vadd(c,u);u.vsub(g.position,u);t.vadd(h,t);t.vsub(l.position,t);this.result.push(m);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(m,this.frictionResult)}this.enableFrictionReduction&& -f&&this.createFrictionFromAverage(f)}};var Va=new c,zb=new c,ob=new c;b.prototype[l.types.PLANE|l.types.PARTICLE]=b.prototype.planeParticle=function(b,d,c,h,f,k,g,l){Va.set(0,0,1);g.quaternion.vmult(Va,Va);h.vsub(g.position,zb);0>=Va.dot(zb)&&(b=this.createContactEquation(l,g,d,b),b.ni.copy(Va),b.ni.negate(b.ni),b.ri.set(0,0,0),Va.mult(Va.dot(h),ob),h.vsub(ob,ob),b.rj.copy(ob),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var Ya=new c;b.prototype[l.types.PARTICLE| -l.types.SPHERE]=b.prototype.sphereParticle=function(b,d,c,h,f,k,g,l){Ya.set(0,0,1);h.vsub(c,Ya);Ya.norm2()<=b.radius*b.radius&&(d=this.createContactEquation(l,g,d,b),Ya.normalize(),d.rj.copy(Ya),d.rj.mult(b.radius,d.rj),d.ni.copy(Ya),d.ni.negate(d.ni),d.ri.set(0,0,0),this.result.push(d),this.createFrictionEquationsFromContact(d,this.frictionResult))};var pb=new n,Za=new c,db=(new c,new c),W=new c,$a=new c;b.prototype[l.types.PARTICLE|l.types.CONVEXPOLYHEDRON]=b.prototype.convexParticle=function(b, -d,c,h,f,k,g,l){var q=-1;k=null;var n=0;if(Za.copy(h),Za.vsub(c,Za),f.conjugate(pb),pb.vmult(Za,Za),b.pointIsInside(Za)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(c,f);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(f);f=0;for(var p=b.faces.length;f!==p;f++){var m=b.worldFaceNormals[f];h.vsub(b.worldVertices[b.faces[f][0]],W);var u=-m.dot(W);(null===k||Math.abs(u)t||0>p||u>n.length||v>n[0].length)){0>u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>p&&(p=0);u>=n.length&& -(u=n.length-1);t>=n.length&&(t=n.length-1);p>=n[0].length&&(p=n[0].length-1);v>=n[0].length&&(v=n[0].length-1);n=[];d.getRectMinMax(u,v,t,p,n);var w=n[0];if(!(qb.z-m>n[1]||qb.z+mm;m++)for(u=v;p>u;u++)d.getConvexTrianglePillar(m,u,!1),k.pointToWorldFrame(h,g,d.pillarOffset,rb),c.distanceTo(rb)t||0>m||u>q.length||m>q[0].length)){0> -u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>m&&(m=0);u>=q.length&&(u=q.length-1);t>=q.length&&(t=q.length-1);m>=q[0].length&&(m=q[0].length-1);v>=q[0].length&&(v=q[0].length-1);q=[];d.getRectMinMax(u,v,t,m,q);var w=q[0];if(!(Ra.z-p>q[1]||Ra.z+pu;u++)for(q=v;m>q;q++)if(w=p.length,d.getConvexTrianglePillar(u,q,!1),k.pointToWorldFrame(h,g,d.pillarOffset,Sa),c.distanceTo(Sa)g;g++){k=n[g];c.vmult(k,k);b.vadd(k,k);var e=k.x,l=k.y,k=k.z;e>d.x&&(d.x=e);l>d.y&&(d.y=l);k>d.z&&(d.z=k);ed.dot(this.vertices[this.faces[b][0]]))for(console.error('.faceNormals['+b+'] = Vec3('+d.toString()+') looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.'),d=0;dm&&(m=v,p=u)}for(var m=[],u=c.faces[p],v=u.length,w=0;v>w;w++){var A=c.vertices[u[w]],y=new g;y.copy(A);k.vmult(y,y);h.vadd(y,y);m.push(y)}0<=p&&this.clipFaceAgainstHull(e,b,d, +m,q,n,l)};var h=new g,d=new g,v=new g,w=new g,y=new g,x=new g;b.prototype.findSeparatingAxis=function(b,c,g,k,e,q,n,l){var p=Number.MAX_VALUE,m=0;if(this.uniqueAxes)for(var u=0;u!==this.uniqueAxes.length;u++){g.vmult(this.uniqueAxes[u],h);var t=this.testSepAxis(h,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(h))}else for(var A=n?n.length:this.faces.length,u=0;A>u;u++){t=n?n[u]:u;h.copy(this.faceNormals[t]);g.vmult(h,h);t=this.testSepAxis(h,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(h))}if(b.uniqueAxes)for(u= +0;u!==b.uniqueAxes.length;u++){e.vmult(b.uniqueAxes[u],d);m++;t=this.testSepAxis(d,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(d))}else for(n=l?l.length:b.faces.length,u=0;n>u;u++){t=l?l[u]:u;d.copy(b.faceNormals[t]);e.vmult(d,d);m++;t=this.testSepAxis(d,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(d))}for(l=0;l!==this.uniqueEdges.length;l++)for(g.vmult(this.uniqueEdges[l],w),m=0;m!==b.uniqueEdges.length;m++)if(e.vmult(b.uniqueEdges[m],y),w.cross(y,x),!x.almostZero()){x.normalize();u=this.testSepAxis(x, +b,c,g,k,e);if(!1===u)return!1;p>u&&(p=u,q.copy(x))}return k.vsub(c,v),0h||d>c)return!1;h-=g;d=c-d;return d>h?h:d};var A=new g,E=new g;b.prototype.calculateLocalInertia=function(b,d){this.computeLocalAABB(A,E);var c=E.x-A.x,h=E.y-A.y,g=E.z-A.z;d.x=1/12*b*(4*h*h+4*g*g);d.y=1/12*b*(4*c*c+4*g*g);d.z=1/12*b*(4*h*h+4*c*c)};b.prototype.getPlaneConstantOfFace= +function(b){return-this.faceNormals[b].dot(this.vertices[this.faces[b][0]])};var D=new g,C=new g,F=new g,z=new g,H=new g,G=new g,O=new g,M=new g;b.prototype.clipFaceAgainstHull=function(b,d,c,h,g,k,e){for(var q=[],n=-1,l=Number.MAX_VALUE,p=0;pm&&(l=m,n=p)}if(!(0>n)){b=this.faces[n];b.connectedFaces=[];for(l=0;lp;p++){m=this.vertices[b[p]];m.vsub(this.vertices[b[(p+1)%l]],C);F.copy(C);c.vmult(F,F);d.vadd(F,F);z.copy(this.faceNormals[n]);c.vmult(z,z);d.vadd(z,z);F.cross(z,H);H.negate(H);G.copy(m);c.vmult(G,G);d.vadd(G,G);m=(-G.dot(H),b.connectedFaces[p]);O.copy(this.faceNormals[m]);m=this.getPlaneConstantOfFace(m);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(this.clipFaceAgainstPlane(h,q,M,m);h.length;)h.shift();for(;q.length;)h.push(q.shift())}O.copy(this.faceNormals[n]); +m=this.getPlaneConstantOfFace(n);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(l=0;l=d&&(console.log('clamped: depth='+d+' to minDist='+(g+'')),d=g),k>=d)c=h[l],0>=d&&e.push({point:c,normal:M,depth:d})}};b.prototype.clipFaceAgainstPlane=function(b,d,c,h){var k,e,q=b.length;if(2>q)return d;var n=b[b.length-1],l=b[0];k=c.dot(n)+h;for(var p=0;q>p;p++){if(l=b[p],e=c.dot(l)+h,0>k){if(0>e){var m=new g;m.copy(l)}else m=new g,n.lerp(l,k/(k-e),m);d.push(m)}else 0>e&&(m=new g,n.lerp(l, +k/(k-e),m),d.push(m),d.push(l));n=l;k=e}return d};b.prototype.computeWorldVertices=function(b,d){for(var c=this.vertices.length;this.worldVertices.lengthg;g++){var k=h[g];k.xd.x&&(d.x=k.x);k.yd.y&&(d.y=k.y);k.zd.z&&(d.z=k.z)}};b.prototype.computeWorldFaceNormals=function(b){for(var d=this.faceNormals.length;this.worldFaceNormals.lengthb&&(b=g)}this.boundingSphereRadius=Math.sqrt(b)};var J=new g;b.prototype.calculateWorldAABB=function(b,d,c,h){for(var g,k,e,q,n,l,p=this.vertices.length,m=this.vertices,u=0;p>u;u++){J.copy(m[u]);d.vmult(J,J);b.vadd(J,J);var t=J;t.xq||void 0===q)&&(q=t.x);t.yn||void 0===n)&&(n=t.y);t.zl||void 0===l)&&(l=t.z)}c.set(g,k,e);h.set(q,n,l)};b.prototype.volume=function(){return 4*Math.PI* +this.boundingSphereRadius/3};b.prototype.getAveragePointLocal=function(b){b=b||new g;for(var d=this.vertices.length,c=this.vertices,h=0;d>h;h++)b.vadd(c[h],b);return b.mult(1/d,b),b};b.prototype.transformAllPoints=function(b,d){var c=this.vertices.length,h=this.vertices;if(d){for(var g=0;c>g;g++){var k=h[g];d.vmult(k,k)}for(g=0;gg;g++)k=h[g],k.vadd(b,k)};var P=new g,N=new g,V=new g;b.prototype.pointIsInside=function(b){var d, +c=this.vertices,h=this.faces,g=this.faceNormals,k=this.faces.length;this.getAveragePointLocal(P);for(var e=0;k>e;e++){d=(this.faces[e].length,g[e]);var q=c[h[e][0]],n=N;b.vsub(q,n);var n=d.dot(n),l=V;P.vsub(q,l);d=d.dot(l);if(0>n&&0d)return!1}return-1};var X=(new g,new g),T=new g;b.project=function(b,d,h,g,k){var e=b.vertices.length;b=b.vertices;T.setZero();c.vectorToLocalFrame(h,g,d,X);c.pointToLocalFrame(h,g,T,T);g=T.dot(X);h=d=b[0].dot(X);for(var q=1;e>q;q++){var n=b[q].dot(X);n>d&& +(d=n);h>n&&(h=n)}if(h-=g,d-=g,h>d)d=h=d;k[0]=d;k[1]=h}},{'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'./Shape':43}],39:[function(e,m){function b(b,e,p,m){var h=[],d=[],k=[],n=[],t=[],x=Math.cos,q=Math.sin;h.push(new g(e*x(0),e*q(0),.5*-p));n.push(0);h.push(new g(b*x(0),b*q(0),.5*p));t.push(1);for(var u=0;m>u;u++){var A=2*Math.PI/m*(u+1),E=2*Math.PI/m*(u+.5);m-1>u?(h.push(new g(e*x(A),e*q(A),.5*-p)),n.push(2*u+2),h.push(new g(b*x(A),b*q(A),.5*p)),t.push(2*u+3),k.push([2*u+2,2* +u+3,2*u+1,2*u])):k.push([0,1,2*u+1,2*u]);(1===m%2||m/2>u)&&d.push(new g(x(E),q(E),0))}k.push(t);d.push(new g(0,0,1));b=[];for(u=0;ud&&(c=d)}this.minValue=c};b.prototype.updateMaxValue=function(){for(var b=this.data,c=b[0][0],g=0;g!==b.length;g++)for(var h=0;h!==b[g].length;h++){var d=b[g][h];d>c&&(c=d)}this.maxValue=c};b.prototype.setHeightValueAtIndex=function(b,c,g){this.data[b][c]=g;this.clearCachedConvexTrianglePillar(b,c,!1);0=b;b++)for(var n=c;h>=n;n++){var l=k[b][n];l>e&&(e=l)}d[0]=this.minValue;d[1]=e};b.prototype.getIndexOfPosition=function(b,c,g,h){var d=this.elementSize,k=this.data;b=Math.floor(b/d);c=Math.floor(c/ +d);return g[0]=b,g[1]=c,h&&(0>b&&(b=0),0>c&&(c=0),b>=k.length-1&&(b=k.length-1),c>=k[0].length-1&&(c=k[0].length-1)),0>b||0>c||b>=k.length-1||c>=k[0].length-1?!1:!0};b.prototype.getHeightAt=function(b,c,g){var h=[];this.getIndexOfPosition(b,c,h,g);b=[];return this.getRectMinMax(h[0],h[1]+1,h[0],h[1]+1,b),(b[0]+b[1])/2};b.prototype.getCacheConvexTrianglePillarKey=function(b,c,g){return b+'_'+c+'_'+(g?1:0)};b.prototype.getCachedConvexTrianglePillar=function(b,c,g){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(b, +c,g)]};b.prototype.setCachedConvexTrianglePillar=function(b,c,g,h,d){this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,g)]={convex:h,offset:d}};b.prototype.clearCachedConvexTrianglePillar=function(b,c,g){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,g)]};b.prototype.getConvexTrianglePillar=function(b,k,e){var h=this.pillarConvex,d=this.pillarOffset;if(this.cacheEnabled){var n=this.getCachedConvexTrianglePillar(b,k,e);if(n)return this.pillarConvex=n.convex,void(this.pillarOffset= +n.offset);h=new g;d=new c;this.pillarConvex=h;this.pillarOffset=d}var n=this.data,l=this.elementSize,p=h.faces;h.vertices.length=6;for(var m=0;6>m;m++)h.vertices[m]||(h.vertices[m]=new c);p.length=5;for(m=0;5>m;m++)p[m]||(p[m]=[]);var m=h.vertices,q=(Math.min(n[b][k],n[b+1][k],n[b][k+1],n[b+1][k+1])-this.minValue)/2+this.minValue;e?(d.set((b+.75)*l,(k+.75)*l,q),m[0].set(.25*l,.25*l,n[b+1][k+1]-q),m[1].set(-.75*l,.25*l,n[b][k+1]-q),m[2].set(.25*l,-.75*l,n[b+1][k]-q),m[3].set(.25*l,.25*l,-q-1),m[4].set(-.75* +l,.25*l,-q-1),m[5].set(.25*l,-.75*l,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3,p[2][0]=2,p[2][1]=5,p[2][2]=3,p[2][3]=0,p[3][0]=3,p[3][1]=4,p[3][2]=1,p[3][3]=0,p[4][0]=1,p[4][1]=4,p[4][2]=5,p[4][3]=2):(d.set((b+.25)*l,(k+.25)*l,q),m[0].set(-.25*l,-.25*l,n[b][k]-q),m[1].set(.75*l,-.25*l,n[b+1][k]-q),m[2].set(-.25*l,.75*l,n[b][k+1]-q),m[3].set(-.25*l,-.25*l,-q-1),m[4].set(.75*l,-.25*l,-q-1),m[5].set(-.25*l,.75*l,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3, +p[2][0]=0,p[2][1]=2,p[2][2]=5,p[2][3]=3,p[3][0]=1,p[3][1]=0,p[3][2]=3,p[3][3]=4,p[4][0]=4,p[4][1]=5,p[4][2]=2,p[4][3]=1);h.computeNormals();h.computeEdges();h.updateBoundingSphereRadius();this.setCachedConvexTrianglePillar(b,k,e,h,d)};b.prototype.calculateLocalInertia=function(b,g){return g=g||new c,g.set(0,0,0),g};b.prototype.volume=function(){return Number.MAX_VALUE};b.prototype.calculateWorldAABB=function(b,c,g,h){g.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);h.set(Number.MAX_VALUE, +Number.MAX_VALUE,Number.MAX_VALUE)};b.prototype.updateBoundingSphereRadius=function(){var b=this.data,g=this.elementSize;this.boundingSphereRadius=(new c(b.length*g,b[0].length*g,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue)))).norm()}},{'../math/Vec3':30,'../utils/Utils':53,'./ConvexPolyhedron':38,'./Shape':43}],41:[function(e,m){function b(){l.call(this);this.type=l.types.PARTICLE}m.exports=b;var l=e('./Shape'),g=e('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia= +function(b,k){return k=k||new g,k.set(0,0,0),k};b.prototype.volume=function(){return 0};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=0};b.prototype.calculateWorldAABB=function(b,g,e,l){e.copy(b);l.copy(b)}},{'../math/Vec3':30,'./Shape':43}],42:[function(e,m){function b(){l.call(this);this.type=l.types.PLANE;this.worldNormal=new g;this.worldNormalNeedsUpdate=!0;this.boundingSphereRadius=Number.MAX_VALUE}m.exports=b;var l=e('./Shape'),g=e('../math/Vec3');b.prototype=new l; +b.prototype.constructor=b;b.prototype.computeWorldNormal=function(b){var c=this.worldNormal;c.set(0,0,1);b.vmult(c,c);this.worldNormalNeedsUpdate=!1};b.prototype.calculateLocalInertia=function(b,c){return c||new g};b.prototype.volume=function(){return Number.MAX_VALUE};var c=new g;b.prototype.calculateWorldAABB=function(b,g,e,l){c.set(0,0,1);g.vmult(c,c);g=Number.MAX_VALUE;e.set(-g,-g,-g);l.set(g,g,g);1===c.x&&(l.x=b.x);1===c.y&&(l.y=b.y);1===c.z&&(l.z=b.z);-1===c.x&&(e.x=b.x);-1===c.y&&(e.y=b.y); +-1===c.z&&(e.z=b.z)};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=Number.MAX_VALUE}},{'../math/Vec3':30,'./Shape':43}],43:[function(e,m){function b(){this.id=b.idCounter++;this.boundingSphereRadius=this.type=0;this.collisionResponse=!0;this.material=null}m.exports=b;b=e('./Shape');e('../math/Vec3');e('../math/Quaternion');e('../material/Material');b.prototype.constructor=b;b.prototype.updateBoundingSphereRadius=function(){throw'computeBoundingSphereRadius() not implemented for shape type '+ +this.type;};b.prototype.volume=function(){throw'volume() not implemented for shape type '+this.type;};b.prototype.calculateLocalInertia=function(){throw'calculateLocalInertia() not implemented for shape type '+this.type;};b.idCounter=0;b.types={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256}},{'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'./Shape':43}],44:[function(e,m){function b(b){if(l.call(this),this.radius=void 0!== +b?Number(b):1,this.type=l.types.SPHERE,0>this.radius)throw Error('The sphere radius cannot be negative.');this.updateBoundingSphereRadius()}m.exports=b;var l=e('./Shape'),g=e('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia=function(b,k){k=k||new g;b=2*b*this.radius*this.radius/5;return k.x=b,k.y=b,k.z=b,k};b.prototype.volume=function(){return 4*Math.PI*this.radius/3};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.radius}; +b.prototype.calculateWorldAABB=function(b,g,e,l){g=this.radius;for(var c=['x','y','z'],h=0;hg?g+'_'+ +k:k+'_'+g]=!0},c=0;cb.x&&(b.x=h.x),h.yb.y&&(b.y=h.y),h.zb.z&&(b.z=h.z)};b.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)};b.prototype.updateBoundingSphereRadius=function(){for(var b=0,d=this.vertices,c=new g,h=0,d=d.length/3;h!==d;h++){this.getVertex(h, +c);var k=c.norm2();k>b&&(b=k)}this.boundingSphereRadius=Math.sqrt(b)};var E=(new g,new c),D=new k;b.prototype.calculateWorldAABB=function(b,d,c,h){E.position=b;E.quaternion=d;this.aabb.toWorldFrame(E,D);c.copy(D.lowerBound);h.copy(D.upperBound)};b.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};b.createTorus=function(d,c,h,g,k){d=d||1;c=c||.5;h=h||8;g=g||6;k=k||2*Math.PI;for(var e=[],q=[],l=0;h>=l;l++)for(var n=0;g>=n;n++){var p=n/g*k,m=l/h*Math.PI*2;e.push((d+c*Math.cos(m))* +Math.cos(p),(d+c*Math.cos(m))*Math.sin(p),c*Math.sin(m))}for(l=1;h>=l;l++)for(n=1;g>=n;n++)d=(g+1)*(l-1)+n-1,c=(g+1)*(l-1)+n,k=(g+1)*l+n,q.push((g+1)*l+n-1,d,k),q.push(d,c,k);return new b(e,q)}},{'../collision/AABB':3,'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'../utils/Octree':50,'./Shape':43}],46:[function(e,m){function b(){l.call(this);this.iterations=10;this.tolerance=1E-7}m.exports=b;var l=(e('../math/Vec3'),e('../math/Quaternion'),e('./Solver'));b.prototype=new l;var g= +[],c=[],k=[];b.prototype.solve=function(b,e){var l,h,d,n,p=0,m=this.iterations,x=this.tolerance*this.tolerance,q=this.equations,u=q.length;e=e.bodies;var A=e.length;if(0!==u)for(d=0;d!==A;d++)e[d].updateSolveMassProperties();c.length=u;k.length=u;g.length=u;for(d=0;d!==u;d++){var E=q[d];g[d]=0;k[d]=E.computeB(b);c[d]=1/E.computeC()}if(0!==u){for(d=0;d!==A;d++)E=e[d],p=E.wlambda,E.vlambda.set(0,0,0),p&&p.set(0,0,0);for(p=0;p!==m;p++){for(var D=d=0;D!==u;D++)E=q[D],l=k[D],h=c[D],b=g[D],n=E.computeGWlambda(), +l=h*(l-n-E.eps*b),b+lE.maxForce&&(l=E.maxForce-b),g[D]+=l,d+=0d*d)break}for(d=0;d!==A;d++)E=e[d],m=E.velocity,x=E.angularVelocity,m.vadd(E.vlambda,m),x&&x.vadd(E.wlambda,x)}return p}},{'../math/Quaternion':28,'../math/Vec3':30,'./Solver':47}],47:[function(e,m){function b(){this.equations=[]}m.exports=b;b.prototype.solve=function(){return 0};b.prototype.addEquation=function(b){b.enabled&&this.equations.push(b)};b.prototype.removeEquation= +function(b){var g=this.equations;b=g.indexOf(b);-1!==b&&g.splice(b,1)};b.prototype.removeAllEquations=function(){this.equations.length=0}},{}],48:[function(e,m){function b(b){k.call(this);this.iterations=10;this.tolerance=1E-7;this.subsolver=b;this.nodes=[];for(this.nodePool=[];128>this.nodePool.length;)this.nodePool.push(this.createNode())}function l(b){for(var d=b.length,c=0;c!==d;c++){var g=b[c];if(!(g.visited||g.body.type&h))return g}return!1}function g(b,d,c){d.push(b.body);d=b.eqs.length;for(var h= +0;h!==d;h++){var g=b.eqs[h];-1===c.indexOf(g)&&c.push(g)}}function c(b,d){return d.id-b.id}m.exports=b;var k=(e('../math/Vec3'),e('../math/Quaternion'),e('./Solver'));e=e('../objects/Body');b.prototype=new k;var n=[],p=[],t={bodies:[]},h=e.STATIC,d=[];b.prototype.createNode=function(){return{body:null,children:[],eqs:[],visited:!1}};b.prototype.solve=function(b,h){var k=this.nodePool,e=h.bodies,q=this.equations,m=q.length,v=e.length;for(h=this.subsolver;k.lengthw;w++)n[w]=k[w];for(w=0;w!==v;w++)k=n[w],k.body=e[w],k.children.length=0,k.eqs.length=0,k.visited=!1;for(k=0;k!==m;k++){var v=q[k],w=e.indexOf(v.bi),D=e.indexOf(v.bj),w=n[w],D=n[D];w.children.push(D);w.eqs.push(v);D.children.push(w);D.eqs.push(v)}e=0;q=p;h.tolerance=this.tolerance;for(h.iterations=this.iterations;w=l(n);){q.length=0;t.bodies.length=0;v=w;w=g;m=t.bodies;k=q;d.push(v);v.visited=!0;for(w(v,m,k);d.length;)for(D=d.pop();v=l(D.children);)v.visited=!0,w(v,m,k),d.push(v); +m=q.length;q=q.sort(c);for(w=0;w!==m;w++)h.addEquation(q[w]);h.solve(b,t);h.removeAllEquations();e++}return e}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'./Solver':47}],49:[function(e,m){e=function(){};m.exports=e;e.prototype={constructor:e,addEventListener:function(b,e){void 0===this._listeners&&(this._listeners={});var g=this._listeners;return void 0===g[b]&&(g[b]=[]),-1===g[b].indexOf(e)&&g[b].push(e),this},hasEventListener:function(b,e){if(void 0===this._listeners)return!1; +var g=this._listeners;return void 0!==g[b]&&-1!==g[b].indexOf(e)?!0:!1},removeEventListener:function(b,e){if(void 0===this._listeners)return this;var g=this._listeners;if(void 0===g[b])return this;e=g[b].indexOf(e);return-1!==e&&g[b].splice(e,1),this},dispatchEvent:function(b){if(void 0===this._listeners)return this;var e=this._listeners[b.type];if(void 0!==e){b.target=this;for(var g=0,c=e.length;c>g;g++)e[g].call(this,b)}return this}}},{}],50:[function(e,m){function b(b){b=b||{};this.root=b.root|| +null;this.aabb=b.aabb?b.aabb.clone():new g;this.data=[];this.children=[]}function l(c,g){g=g||{};g.root=null;g.aabb=c;b.call(this,g);this.maxDepth='undefined'!=typeof g.maxDepth?g.maxDepth:8}var g=e('../collision/AABB'),c=e('../math/Vec3');m.exports=l;l.prototype=new b;b.prototype.reset=function(){this.children.length=this.data.length=0};b.prototype.insert=function(b,c,h){var d=this.data;if(h=h||0,!this.aabb.contains(b))return!1;var g=this.children;if(h<(this.maxDepth||this.root.maxDepth)){var k= +!1;g.length||(this.subdivide(),k=!0);for(var e=0;8!==e;e++)if(g[e].insert(b,c,h+1))return!0;k&&(g.length=0)}return d.push(c),!0};var k=new c;b.prototype.subdivide=function(){var e=this.aabb,l=e.lowerBound,h=e.upperBound,e=this.children;e.push(new b({aabb:new g({lowerBound:new c(0,0,0)})}),new b({aabb:new g({lowerBound:new c(1,0,0)})}),new b({aabb:new g({lowerBound:new c(1,1,0)})}),new b({aabb:new g({lowerBound:new c(1,1,1)})}),new b({aabb:new g({lowerBound:new c(0,1,1)})}),new b({aabb:new g({lowerBound:new c(0, +0,1)})}),new b({aabb:new g({lowerBound:new c(1,0,1)})}),new b({aabb:new g({lowerBound:new c(0,1,0)})}));h.vsub(l,k);k.scale(.5,k);for(var h=this.root||this,d=0;8!==d;d++){var n=e[d];n.root=h;var m=n.aabb.lowerBound;m.x*=k.x;m.y*=k.y;m.z*=k.z;m.vadd(l,m);m.vadd(k,n.aabb.upperBound)}};b.prototype.aabbQuery=function(b,c){for(var h=(this.data,this.children,[this]);h.length;){var d=h.pop();d.aabb.overlaps(b)&&Array.prototype.push.apply(c,d.data);Array.prototype.push.apply(h,d.children)}return c};var n= +new g;b.prototype.rayQuery=function(b,c,h){return b.getAABB(n),n.toLocalFrame(c,n),this.aabbQuery(n,h),h};b.prototype.removeEmptyNodes=function(){for(var b=[this];b.length;){for(var c=b.pop(),h=c.children.length-1;0<=h;h--)c.children[h].data.length||c.children.splice(h,1);Array.prototype.push.apply(b,c.children)}}},{'../collision/AABB':3,'../math/Vec3':30}],51:[function(e,m){function b(){this.objects=[];this.type=Object}m.exports=b;b.prototype.release=function(){for(var b=arguments.length,g=0;g!== +b;g++)this.objects.push(arguments[g])};b.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()};b.prototype.constructObject=function(){throw Error('constructObject() not implemented in this Pool subclass yet!');}},{}],52:[function(e,m){function b(){this.data={keys:[]}}m.exports=b;b.prototype.get=function(b,g){b>g&&(b=g=b);return this.data[b+'-'+g]};b.prototype.set=function(b,g,c){b>g&&(b=g=b);var k=b+'-'+g;this.get(b,g)||this.data.keys.push(k);this.data[k]= +c};b.prototype.reset=function(){for(var b=this.data,g=b.keys;0p.boundingSphereRadius+t.boundingSphereRadius)){var v=null;p.material&&t.material&&(v=c.getContactMaterial(p.material,t.material)||null);this.currentContactMaterial=v||n||c.defaultContactMaterial;(v=this[p.type|t.type])&&(p.type=A.dot(m)){var u=this.createContactEquation(n,l,b,d);u.ni.copy(A);var t=D;A.scale(m.dot(A),t);p.vsub(t,t);u.ri.copy(t);u.ri.vsub(n.position,u.ri);u.rj.copy(p);u.rj.vsub(l.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}}};var C=new c,F=new c,z=(new c,new c),H=new c,G=new c,O=new c,M=new c,J=new c,P=new c,N=new c,V=new c,X=new c,T=new c,fa=new m,Z=[];b.prototype[l.types.SPHERE|l.types.TRIMESH]=b.prototype.sphereTrimesh=function(b, +d,c,h,e,q,n,l){k.pointToLocalFrame(h,q,c,P);e=b.radius;fa.lowerBound.set(P.x-e,P.y-e,P.z-e);fa.upperBound.set(P.x+e,P.y+e,P.z+e);d.getTrianglesInAABB(fa,Z);var p=b.radius*b.radius;for(e=0;em;m++)if(d.getVertex(d.indices[3*Z[e]+m],z),z.vsub(P,F),F.norm2()<=p){H.copy(z);k.pointToWorldFrame(h,q,H,z);z.vsub(c,F);var u=this.createContactEquation(n,l,b,d);u.ni.copy(F);u.ni.normalize();u.ri.copy(u.ni);u.ri.scale(b.radius,u.ri);u.ri.vadd(c,u.ri);u.ri.vsub(n.position,u.ri);u.rj.copy(z); +u.rj.vsub(l.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}for(e=0;em;m++)d.getVertex(d.indices[3*Z[e]+m],G),d.getVertex(d.indices[3*Z[e]+(m+1)%3],O),O.vsub(G,M),P.vsub(O,N),c=N.dot(M),P.vsub(G,N),u=N.dot(M),0c&&(P.vsub(G,N),J.copy(M),J.normalize(),u=N.dot(J),J.scale(u,N),N.vadd(G,N),c=N.distanceTo(P),cC&&0F&&F>-E&&D>L&&L>-D&&(C=Math.abs(C-y-k),(null===t||t>C)&&(t=C,m=F,u=L,l=y,ha.copy(A),ua.copy(x),ea.copy(z),p++))}}p&&(n=!0,p=this.createContactEquation(e,q,b,d),ha.mult(-k,p.ri),p.ni.copy(ha),p.ni.negate(p.ni),ha.mult(l,ha),ua.mult(m,ua),ha.vadd(ua,ha),ea.mult(u,ea),ha.vadd(ea, +p.rj),p.ri.vadd(c,p.ri),p.ri.vsub(e.position,p.ri),p.rj.vadd(h,p.rj),p.rj.vsub(q.position,p.rj),this.result.push(p),this.createFrictionEquationsFromContact(p,this.frictionResult));C=g.get();for(l=0;2!==l&&!n;l++)for(m=0;2!==m&&!n;m++)for(u=0;2!==u&&!n;u++)if(C.set(0,0,0),l?C.vadd(ca[0],C):C.vsub(ca[0],C),m?C.vadd(ca[1],C):C.vsub(ca[1],C),u?C.vadd(ca[2],C):C.vsub(ca[2],C),h.vadd(C,Ba),Ba.vsub(c,Ba),Ba.norm2()x&&(n=!0,u=this.createContactEquation(e,q,b,d),v.vadd(w,u.rj),u.rj.copy(u.rj),C.negate(u.ni),u.ni.normalize(),u.ri.copy(u.rj),u.ri.vadd(h,u.ri),u.ri.vsub(c,u.ri),u.ri.normalize(),u.ri.mult(k,u.ri),u.ri.vadd(c,u.ri),u.ri.vsub(e.position,u.ri),u.rj.vadd(h,u.rj),u.rj.vsub(q.position,u.rj),this.result.push(u),this.createFrictionEquationsFromContact(u,this.frictionResult))}g.release(t,v,p,w,C)};var ia=new c,qa=new c,ra=new c,Aa=new c,Vb= +new c,td=new c,Zd=new c,nb=new c,Gc=new c,ba=new c;b.prototype[l.types.SPHERE|l.types.CONVEXPOLYHEDRON]=b.prototype.sphereConvex=function(b,d,c,h,g,k,e,q){g=this.v3pool;c.vsub(h,ia);for(var l=d.faceNormals,n=d.faces,p=d.vertices,m=b.radius,u=0;u!==p.length;u++){var t=Vb;k.vmult(p[u],t);h.vadd(t,t);var v=Aa;if(t.vsub(c,v),v.norm2()y&&0=L&&!1===E)){C=!1;break a}null===E&&(E=0=Qa.dot(xa)){var n=this.createContactEquation(e,q,b,d),p=cb;Qa.mult(Qa.dot(xa), +p);Ea.vsub(p,p);p.vsub(c,n.ri);n.ni.copy(Qa);Ea.vsub(h,n.rj);n.ri.vadd(c,n.ri);n.ri.vsub(e.position,n.ri);n.rj.vadd(h,n.rj);n.rj.vsub(q.position,n.rj);this.result.push(n);g++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(n,this.frictionResult)}this.enableFrictionReduction&&g&&this.createFrictionFromAverage(g)};var aa=new c,ga=new c;b.prototype[l.types.CONVEXPOLYHEDRON]=b.prototype.convexConvex=function(b,d,c,h,g,k,e,q,n,l,p,m){if(!(c.distanceTo(h)>b.boundingSphereRadius+d.boundingSphereRadius)&& +b.findSeparatingAxis(d,c,g,h,k,aa,p,m)){p=[];b.clipAgainstHull(c,g,d,h,k,aa,-100,100,p);for(k=g=0;k!==p.length;k++){m=this.createContactEquation(e,q,b,d,n,l);var u=m.ri,t=m.rj;aa.negate(m.ni);p[k].normal.negate(ga);ga.mult(p[k].depth,ga);p[k].point.vadd(ga,u);t.copy(p[k].point);u.vsub(c,u);t.vsub(h,t);u.vadd(c,u);u.vsub(e.position,u);t.vadd(h,t);t.vsub(q.position,t);this.result.push(m);g++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(m,this.frictionResult)}this.enableFrictionReduction&& +g&&this.createFrictionFromAverage(g)}};var Va=new c,zb=new c,ob=new c;b.prototype[l.types.PLANE|l.types.PARTICLE]=b.prototype.planeParticle=function(b,d,c,h,g,k,e,q){Va.set(0,0,1);e.quaternion.vmult(Va,Va);h.vsub(e.position,zb);0>=Va.dot(zb)&&(b=this.createContactEquation(q,e,d,b),b.ni.copy(Va),b.ni.negate(b.ni),b.ri.set(0,0,0),Va.mult(Va.dot(h),ob),h.vsub(ob,ob),b.rj.copy(ob),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var Ya=new c;b.prototype[l.types.PARTICLE| +l.types.SPHERE]=b.prototype.sphereParticle=function(b,d,c,h,g,k,e,q){Ya.set(0,0,1);h.vsub(c,Ya);Ya.norm2()<=b.radius*b.radius&&(d=this.createContactEquation(q,e,d,b),Ya.normalize(),d.rj.copy(Ya),d.rj.mult(b.radius,d.rj),d.ni.copy(Ya),d.ni.negate(d.ni),d.ri.set(0,0,0),this.result.push(d),this.createFrictionEquationsFromContact(d,this.frictionResult))};var pb=new n,Za=new c,db=(new c,new c),W=new c,$a=new c;b.prototype[l.types.PARTICLE|l.types.CONVEXPOLYHEDRON]=b.prototype.convexParticle=function(b, +d,c,h,g,k,e,q){var n=-1;k=null;var l=0;if(Za.copy(h),Za.vsub(c,Za),g.conjugate(pb),pb.vmult(Za,Za),b.pointIsInside(Za)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(c,g);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(g);g=0;for(var p=b.faces.length;g!==p;g++){var m=b.worldFaceNormals[g];h.vsub(b.worldVertices[b.faces[g][0]],W);var u=-m.dot(W);(null===k||Math.abs(u)t||0>p||u>l.length||v>l[0].length)){0>u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>p&&(p=0);u>=l.length&& +(u=l.length-1);t>=l.length&&(t=l.length-1);p>=l[0].length&&(p=l[0].length-1);v>=l[0].length&&(v=l[0].length-1);l=[];d.getRectMinMax(u,v,t,p,l);var w=l[0];if(!(qb.z-m>l[1]||qb.z+mm;m++)for(u=v;p>u;u++)d.getConvexTrianglePillar(m,u,!1),k.pointToWorldFrame(h,e,d.pillarOffset,rb),c.distanceTo(rb)t||0>m||u>n.length||m>n[0].length)){0> +u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>m&&(m=0);u>=n.length&&(u=n.length-1);t>=n.length&&(t=n.length-1);m>=n[0].length&&(m=n[0].length-1);v>=n[0].length&&(v=n[0].length-1);n=[];d.getRectMinMax(u,v,t,m,n);var w=n[0];if(!(Ra.z-p>n[1]||Ra.z+pu;u++)for(n=v;m>n;n++)if(w=p.length,d.getConvexTrianglePillar(u,n,!1),k.pointToWorldFrame(h,e,d.pillarOffset,Sa),c.distanceTo(Sa)1E3*b));k++);this.time+=c;b=this.time%b/b;c=this.bodies;for(f=0;f!==c.length;f++)h=c[f],h.type!==d.STATIC&&h.sleepState!==d.SLEEPING?(h.position.vsub(h.previousPosition,E),E.scale(b,E),h.position.vadd(E,h.interpolatedPosition)):(h.interpolatedPosition.copy(h.position), -h.interpolatedQuaternion.copy(h.quaternion))}};var D={type:'postStep'},C={type:'preStep'},F={type:'collide',body:null,contact:null},z=[],H=[],G=[],O=[],M=(new f,new f,new f,new f,new f,new f,new f,new f,new f,new m,new m),J=new m,P=new f;b.prototype.internalStep=function(b){this.dt=b;var c,h=this.contacts,f=this.numObjects(),k=this.bodies,g=this.solver,q=this.gravity,n=this.doProfiling,p=this.profile,m=d.DYNAMIC,u=this.constraints,t=(q.norm(),q.x),v=q.y,w=q.z;n&&(c=performance.now());for(q=0;q!== -f;q++){var A=k[q];if(A.type&m){var y=A.force,A=A.mass;y.x+=A*t;y.y+=A*v;y.z+=A*w}}q=0;for(A=this.subsystems.length;q!==A;q++)this.subsystems[q].update();n&&(c=performance.now());G.length=0;O.length=0;this.broadphase.collisionPairs(this,G,O);n&&(p.broadphase=performance.now()-c);A=u.length;for(q=0;q!==A;q++)if(t=u[q],!t.collideConnected)for(v=G.length-1;0<=v;--v)(t.bodyA===G[v]&&t.bodyB===O[v]||t.bodyB===G[v]&&t.bodyA===O[v])&&(G.splice(v,1),O.splice(v,1));this.collisionMatrixTick();n&&(c=performance.now()); -A=h.length;for(q=0;q!==A;q++)z.push(h[q]);h.length=0;A=this.frictionEquations.length;for(q=0;q!==A;q++)H.push(this.frictionEquations[q]);this.frictionEquations.length=0;this.narrowphase.getContacts(G,O,this,h,z,this.frictionEquations,H);n&&(p.narrowphase=performance.now()-c);n&&(c=performance.now());for(q=0;q=2*Math.pow(w.sleepSpeedLimit,2)&&(A._wakeUpAfterNarrowphase=!0),w.allowSleep&&w.type===d.DYNAMIC&&w.sleepState===d.SLEEPING&&A.sleepState===d.AWAKE&&A.type!==d.STATIC&&A.velocity.norm2()+ -A.angularVelocity.norm2()>=2*Math.pow(A.sleepSpeedLimit,2)&&(w._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(A,w,!0),this.collisionMatrixPrevious.get(A,w)||(F.body=w,F.contact=t,A.dispatchEvent(F),F.body=A,w.dispatchEvent(F));n&&(p.makeContactConstraints=performance.now()-c,c=performance.now());for(q=0;q!==f;q++)A=k[q],A._wakeUpAfterNarrowphase&&(A.wakeUp(),A._wakeUpAfterNarrowphase=!1);A=u.length;for(q=0;q!==A;q++)for(t=u[q],t.update(),v=0,h=t.equations.length;v!==h;v++)g.addEquation(t.equations[v]); -g.solve(b,this);n&&(p.solve=performance.now()-c);g.removeAllEquations();g=Math.pow;for(q=0;q!==f;q++)if(A=k[q],A.type&m&&(u=g(1-A.linearDamping,b),h=A.velocity,h.mult(u,h),u=A.angularVelocity))h=g(1-A.angularDamping,b),u.mult(h,u);this.dispatchEvent(C);for(q=0;q!==f;q++)A=k[q],A.preStep&&A.preStep.call(A);n&&(c=performance.now());m=d.DYNAMIC|d.KINEMATIC;g=0===this.stepnumber%(this.quatNormalizeSkip+1);u=this.quatNormalizeFast;h=.5*b;l.types.PLANE;l.types.CONVEXPOLYHEDRON;for(q=0;q!==f;q++)if(A=k[q], -t=A.force,v=A.torque,A.type&m&&A.sleepState!==d.SLEEPING){var w=A.velocity,y=A.angularVelocity,x=A.position,E=A.quaternion,N=A.invMass,ea=A.invInertiaWorld;w.x+=t.x*N*b;w.y+=t.y*N*b;w.z+=t.z*N*b;A.angularVelocity&&(ea.vmult(v,P),P.mult(b,P),P.vadd(y,y));x.x+=w.x*b;x.y+=w.y*b;x.z+=w.z*b;A.angularVelocity&&(M.set(y.x,y.y,y.z,0),M.mult(E,J),E.x+=h*J.x,E.y+=h*J.y,E.z+=h*J.z,E.w+=h*J.w,g&&(u?E.normalizeFast():E.normalize()));A.aabb&&(A.aabbNeedsUpdate=!0);A.updateInertiaWorld&&A.updateInertiaWorld()}this.clearForces(); -this.broadphase.dirty=!0;n&&(p.integrate=performance.now()-c);this.time+=b;this.stepnumber+=1;this.dispatchEvent(D);for(q=0;q!==f;q++)A=k[q],(b=A.postStep)&&b.call(A);if(this.allowSleep)for(q=0;q!==f;q++)k[q].sleepTick(this.time)};b.prototype.clearForces=function(){for(var b=this.bodies,d=b.length,c=0;c!==d;c++){var h=b[c];h.force;h.torque;h.force.set(0,0,0);h.torque.set(0,0,0)}}},{'../collision/AABB':3,'../collision/ArrayCollisionMatrix':4,'../collision/NaiveBroadphase':7,'../collision/Ray':9,'../collision/RaycastResult':10, +A}}var E=new g;b.prototype.step=function(b,c,h){if(h=h||10,c=c||0,0===c)this.internalStep(b),this.time+=b;else{var g=Math.floor((this.time+c)/b)-Math.floor(this.time/b),g=Math.min(g,h);h=performance.now();for(var k=0;k!==g&&(this.internalStep(b),!(performance.now()-h>1E3*b));k++);this.time+=c;b=this.time%b/b;c=this.bodies;for(g=0;g!==c.length;g++)h=c[g],h.type!==d.STATIC&&h.sleepState!==d.SLEEPING?(h.position.vsub(h.previousPosition,E),E.scale(b,E),h.position.vadd(E,h.interpolatedPosition)):(h.interpolatedPosition.copy(h.position), +h.interpolatedQuaternion.copy(h.quaternion))}};var D={type:'postStep'},C={type:'preStep'},F={type:'collide',body:null,contact:null},z=[],H=[],G=[],O=[],M=(new g,new g,new g,new g,new g,new g,new g,new g,new g,new m,new m),J=new m,P=new g;b.prototype.internalStep=function(b){this.dt=b;var c,h=this.contacts,g=this.numObjects(),k=this.bodies,e=this.solver,q=this.gravity,n=this.doProfiling,p=this.profile,m=d.DYNAMIC,u=this.constraints,t=(q.norm(),q.x),v=q.y,w=q.z;n&&(c=performance.now());for(q=0;q!== +g;q++){var A=k[q];if(A.type&m){var y=A.force,A=A.mass;y.x+=A*t;y.y+=A*v;y.z+=A*w}}q=0;for(A=this.subsystems.length;q!==A;q++)this.subsystems[q].update();n&&(c=performance.now());G.length=0;O.length=0;this.broadphase.collisionPairs(this,G,O);n&&(p.broadphase=performance.now()-c);A=u.length;for(q=0;q!==A;q++)if(t=u[q],!t.collideConnected)for(v=G.length-1;0<=v;--v)(t.bodyA===G[v]&&t.bodyB===O[v]||t.bodyB===G[v]&&t.bodyA===O[v])&&(G.splice(v,1),O.splice(v,1));this.collisionMatrixTick();n&&(c=performance.now()); +A=h.length;for(q=0;q!==A;q++)z.push(h[q]);h.length=0;A=this.frictionEquations.length;for(q=0;q!==A;q++)H.push(this.frictionEquations[q]);this.frictionEquations.length=0;this.narrowphase.getContacts(G,O,this,h,z,this.frictionEquations,H);n&&(p.narrowphase=performance.now()-c);n&&(c=performance.now());for(q=0;q=2*Math.pow(w.sleepSpeedLimit,2)&&(A._wakeUpAfterNarrowphase=!0),w.allowSleep&&w.type===d.DYNAMIC&&w.sleepState===d.SLEEPING&&A.sleepState===d.AWAKE&&A.type!==d.STATIC&&A.velocity.norm2()+ +A.angularVelocity.norm2()>=2*Math.pow(A.sleepSpeedLimit,2)&&(w._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(A,w,!0),this.collisionMatrixPrevious.get(A,w)||(F.body=w,F.contact=t,A.dispatchEvent(F),F.body=A,w.dispatchEvent(F));n&&(p.makeContactConstraints=performance.now()-c,c=performance.now());for(q=0;q!==g;q++)A=k[q],A._wakeUpAfterNarrowphase&&(A.wakeUp(),A._wakeUpAfterNarrowphase=!1);A=u.length;for(q=0;q!==A;q++)for(t=u[q],t.update(),v=0,h=t.equations.length;v!==h;v++)e.addEquation(t.equations[v]); +e.solve(b,this);n&&(p.solve=performance.now()-c);e.removeAllEquations();e=Math.pow;for(q=0;q!==g;q++)if(A=k[q],A.type&m&&(u=e(1-A.linearDamping,b),h=A.velocity,h.mult(u,h),u=A.angularVelocity))h=e(1-A.angularDamping,b),u.mult(h,u);this.dispatchEvent(C);for(q=0;q!==g;q++)A=k[q],A.preStep&&A.preStep.call(A);n&&(c=performance.now());m=d.DYNAMIC|d.KINEMATIC;e=0===this.stepnumber%(this.quatNormalizeSkip+1);u=this.quatNormalizeFast;h=.5*b;l.types.PLANE;l.types.CONVEXPOLYHEDRON;for(q=0;q!==g;q++)if(A=k[q], +t=A.force,v=A.torque,A.type&m&&A.sleepState!==d.SLEEPING){var w=A.velocity,y=A.angularVelocity,x=A.position,E=A.quaternion,N=A.invMass,ea=A.invInertiaWorld;w.x+=t.x*N*b;w.y+=t.y*N*b;w.z+=t.z*N*b;A.angularVelocity&&(ea.vmult(v,P),P.mult(b,P),P.vadd(y,y));x.x+=w.x*b;x.y+=w.y*b;x.z+=w.z*b;A.angularVelocity&&(M.set(y.x,y.y,y.z,0),M.mult(E,J),E.x+=h*J.x,E.y+=h*J.y,E.z+=h*J.z,E.w+=h*J.w,e&&(u?E.normalizeFast():E.normalize()));A.aabb&&(A.aabbNeedsUpdate=!0);A.updateInertiaWorld&&A.updateInertiaWorld()}this.clearForces(); +this.broadphase.dirty=!0;n&&(p.integrate=performance.now()-c);this.time+=b;this.stepnumber+=1;this.dispatchEvent(D);for(q=0;q!==g;q++)A=k[q],(b=A.postStep)&&b.call(A);if(this.allowSleep)for(q=0;q!==g;q++)k[q].sleepTick(this.time)};b.prototype.clearForces=function(){for(var b=this.bodies,d=b.length,c=0;c!==d;c++){var h=b[c];h.force;h.torque;h.force.set(0,0,0);h.torque.set(0,0,0)}}},{'../collision/AABB':3,'../collision/ArrayCollisionMatrix':4,'../collision/NaiveBroadphase':7,'../collision/Ray':9,'../collision/RaycastResult':10, '../equations/ContactEquation':19,'../equations/FrictionEquation':21,'../material/ContactMaterial':24,'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Shape':43,'../solver/GSSolver':46,'../utils/EventTarget':49,'../utils/TupleDictionary':52,'../utils/Vec3Pool':54,'./Narrowphase':55}]},{},[2])(2)}); -!function(a,g,m){function b(c,f){if(!g[c]){if(!a[c]){var k='function'==typeof require&&require;if(!f&&k)return k(c,!0);if(l)return l(c,!0);throw Error("Cannot find module '"+c+"'");}f=g[c]={exports:{}};a[c][0].call(f.exports,function(f){var k=a[c][1][f];return b(k?k:f)},f,f.exports)}return g[c].exports}for(var l='function'==typeof require&&require,f=0;fl.determinant(this.basis[0].concat(this.basis[1]).concat(this.basis[2])),this._left)};a.prototype.matrix=function(){if(this._matrix)return this._matrix;var a=this.basis,b=this._matrix=f.create(); -return b[0]=a[0][0],b[1]=a[0][1],b[2]=a[0][2],b[4]=a[1][0],b[5]=a[1][1],b[6]=a[1][2],b[8]=a[2][0],b[9]=a[2][1],b[10]=a[2][2],b[3]=this.center()[0],b[7]=this.center()[1],b[11]=this.center()[2],this.left()&&(b[0]*=-1,b[1]*=-1,b[2]*=-1),this._matrix};a.prototype.lerp=function(a,f){b.lerp(a,this.prevJoint,this.nextJoint,f)};a.prototype.center=function(){if(this._center)return this._center;var a=b.create();return this.lerp(a,.5),this._center=a,a};a.prototype.direction=function(){return[-1*this.basis[2][0], --1*this.basis[2][1],-1*this.basis[2][2]]}},{'./pointable':14,'gl-matrix':23,underscore:24}],2:[function(a,g){a=g.exports=function(a){this.pos=0;this._buf=[];this.size=a};a.prototype.get=function(a){return void 0==a&&(a=0),a>=this.size?void 0:a>=this._buf.length?void 0:this._buf[(this.pos-a-1)%this.size]};a.prototype.push=function(a){return this._buf[this.pos%this.size]=a,this.pos++}},{}],3:[function(a,g){var m=a('../protocol').chooseProtocol,b=a('events').EventEmitter,l=a('underscore'),f=g.exports= -function(a){this.opts=l.defaults(a||{},{host:'127.0.0.1',enableGestures:!1,scheme:this.getScheme(),port:this.getPort(),background:!1,optimizeHMD:!1,requestProtocolVersion:f.defaultProtocolVersion});this.host=this.opts.host;this.port=this.opts.port;this.scheme=this.opts.scheme;this.protocolVersionVerified=!1;this.optimizeHMD=this.background=null;this.on('ready',function(){this.enableGestures(this.opts.enableGestures);this.setBackground(this.opts.background);this.setOptimizeHMD(this.opts.optimizeHMD); -console.log(this.opts.optimizeHMD?'Optimized for head mounted display usage.':'Optimized for desktop usage.')})};f.defaultProtocolVersion=6;f.prototype.getUrl=function(){return this.scheme+'//'+this.host+':'+this.port+'/v'+this.opts.requestProtocolVersion+'.json'};f.prototype.getScheme=function(){return'ws:'};f.prototype.getPort=function(){return 6437};f.prototype.setBackground=function(a){this.opts.background=a;this.protocol&&this.protocol.sendBackground&&this.background!==this.opts.background&& -(this.background=this.opts.background,this.protocol.sendBackground(this,this.opts.background))};f.prototype.setOptimizeHMD=function(a){this.opts.optimizeHMD=a;this.protocol&&this.protocol.sendOptimizeHMD&&this.optimizeHMD!==this.opts.optimizeHMD&&(this.optimizeHMD=this.opts.optimizeHMD,this.protocol.sendOptimizeHMD(this,this.opts.optimizeHMD))};f.prototype.handleOpen=function(){this.connected||(this.connected=!0,this.emit('connect'))};f.prototype.enableGestures=function(a){this.gesturesEnabled=a? -!0:!1;this.send(this.protocol.encode({enableGestures:this.gesturesEnabled}))};f.prototype.handleClose=function(a){this.connected&&(this.disconnect(),1001===a&&1l.determinant(this.basis[0].concat(this.basis[1]).concat(this.basis[2])),this._left)};a.prototype.matrix=function(){if(this._matrix)return this._matrix;var a=this.basis,b=this._matrix=g.create(); +return b[0]=a[0][0],b[1]=a[0][1],b[2]=a[0][2],b[4]=a[1][0],b[5]=a[1][1],b[6]=a[1][2],b[8]=a[2][0],b[9]=a[2][1],b[10]=a[2][2],b[3]=this.center()[0],b[7]=this.center()[1],b[11]=this.center()[2],this.left()&&(b[0]*=-1,b[1]*=-1,b[2]*=-1),this._matrix};a.prototype.lerp=function(a,g){b.lerp(a,this.prevJoint,this.nextJoint,g)};a.prototype.center=function(){if(this._center)return this._center;var a=b.create();return this.lerp(a,.5),this._center=a,a};a.prototype.direction=function(){return[-1*this.basis[2][0], +-1*this.basis[2][1],-1*this.basis[2][2]]}},{'./pointable':14,'gl-matrix':23,underscore:24}],2:[function(a,e){a=e.exports=function(a){this.pos=0;this._buf=[];this.size=a};a.prototype.get=function(a){return void 0==a&&(a=0),a>=this.size?void 0:a>=this._buf.length?void 0:this._buf[(this.pos-a-1)%this.size]};a.prototype.push=function(a){return this._buf[this.pos%this.size]=a,this.pos++}},{}],3:[function(a,e){var m=a('../protocol').chooseProtocol,b=a('events').EventEmitter,l=a('underscore'),g=e.exports= +function(a){this.opts=l.defaults(a||{},{host:'127.0.0.1',enableGestures:!1,scheme:this.getScheme(),port:this.getPort(),background:!1,optimizeHMD:!1,requestProtocolVersion:g.defaultProtocolVersion});this.host=this.opts.host;this.port=this.opts.port;this.scheme=this.opts.scheme;this.protocolVersionVerified=!1;this.optimizeHMD=this.background=null;this.on('ready',function(){this.enableGestures(this.opts.enableGestures);this.setBackground(this.opts.background);this.setOptimizeHMD(this.opts.optimizeHMD); +console.log(this.opts.optimizeHMD?'Optimized for head mounted display usage.':'Optimized for desktop usage.')})};g.defaultProtocolVersion=6;g.prototype.getUrl=function(){return this.scheme+'//'+this.host+':'+this.port+'/v'+this.opts.requestProtocolVersion+'.json'};g.prototype.getScheme=function(){return'ws:'};g.prototype.getPort=function(){return 6437};g.prototype.setBackground=function(a){this.opts.background=a;this.protocol&&this.protocol.sendBackground&&this.background!==this.opts.background&& +(this.background=this.opts.background,this.protocol.sendBackground(this,this.opts.background))};g.prototype.setOptimizeHMD=function(a){this.opts.optimizeHMD=a;this.protocol&&this.protocol.sendOptimizeHMD&&this.optimizeHMD!==this.opts.optimizeHMD&&(this.optimizeHMD=this.opts.optimizeHMD,this.protocol.sendOptimizeHMD(this,this.opts.optimizeHMD))};g.prototype.handleOpen=function(){this.connected||(this.connected=!0,this.emit('connect'))};g.prototype.enableGestures=function(a){this.gesturesEnabled=a? +!0:!1;this.send(this.protocol.encode({enableGestures:this.gesturesEnabled}))};g.prototype.handleClose=function(a){this.connected&&(this.disconnect(),1001===a&&1b?(console.warn('Your Protocol Version is v'+b+', this app was designed for v'+d),h.warnOutOfDate({sV:a,pV:b}),!0):!1};v._pluginFactories={};v.plugin=function(a,b){return this._pluginFactories[a]&&console.warn('Plugin "'+a+'" already registered'),this._pluginFactories[a]=b};v.plugins=function(){return d.keys(this._pluginFactories)};v.prototype.use=function(a,h){var k,g;if(k='function'==typeof a?a:v._pluginFactories[a],!k)throw'Leap Plugin '+a+' not found.';if(h||(h={}),this.plugins[a])return d.extend(this.plugins[a], -h),this;this.plugins[a]=h;h=k.call(this,h);for(g in h)if(k=h[g],'function'==typeof k){var p=a,m=g;-1!=['beforeFrameCreated','afterFrameCreated'].indexOf(m)?this.on(m,k):(this.pipeline||(this.pipeline=new n(this)),this._pluginPipelineSteps[p]||(this._pluginPipelineSteps[p]=[]),this._pluginPipelineSteps[p].push(this.pipeline.addWrappedStep(m,k)))}else{p=a;m=g;switch(this._pluginExtendedMethods[p]||(this._pluginExtendedMethods[p]=[]),m){case 'frame':m=b;break;case 'hand':m=l;break;case 'pointable':m= -f;d.extend(c.prototype,k);d.extend(c.Invalid,k);break;case 'finger':m=c;break;default:throw p+' specifies invalid object type "'+m+'" for prototypical extension';}d.extend(m.prototype,k);d.extend(m.Invalid,k);this._pluginExtendedMethods[p].push([m,k])}return this};v.prototype.stopUsing=function(a){var b,d;b=this._pluginPipelineSteps[a];var c=this._pluginExtendedMethods[a],h;if(this.plugins[a]){if(b)for(h=0;hb?(console.warn('Your Protocol Version is v'+b+', this app was designed for v'+d),h.warnOutOfDate({sV:a,pV:b}),!0):!1};v._pluginFactories={};v.plugin=function(a,b){return this._pluginFactories[a]&&console.warn('Plugin "'+a+'" already registered'),this._pluginFactories[a]=b};v.plugins=function(){return d.keys(this._pluginFactories)};v.prototype.use=function(a,h){var k,e;if(k='function'==typeof a?a:v._pluginFactories[a],!k)throw'Leap Plugin '+a+' not found.';if(h||(h={}),this.plugins[a])return d.extend(this.plugins[a], +h),this;this.plugins[a]=h;h=k.call(this,h);for(e in h)if(k=h[e],'function'==typeof k){var p=a,m=e;-1!=['beforeFrameCreated','afterFrameCreated'].indexOf(m)?this.on(m,k):(this.pipeline||(this.pipeline=new n(this)),this._pluginPipelineSteps[p]||(this._pluginPipelineSteps[p]=[]),this._pluginPipelineSteps[p].push(this.pipeline.addWrappedStep(m,k)))}else{p=a;m=e;switch(this._pluginExtendedMethods[p]||(this._pluginExtendedMethods[p]=[]),m){case 'frame':m=b;break;case 'hand':m=l;break;case 'pointable':m= +g;d.extend(c.prototype,k);d.extend(c.Invalid,k);break;case 'finger':m=c;break;default:throw p+' specifies invalid object type "'+m+'" for prototypical extension';}d.extend(m.prototype,k);d.extend(m.Invalid,k);this._pluginExtendedMethods[p].push([m,k])}return this};v.prototype.stopUsing=function(a){var b,d;b=this._pluginPipelineSteps[a];var c=this._pluginExtendedMethods[a],h;if(this.plugins[a]){if(b)for(h=0;hUpgrade", -{onclick:function(a){'leapjs-decline-upgrade'!=a.target.id&&(a=window.open(f,'_blank','height=800,width=1000,location=1,menubar=1,resizable=1,status=1,toolbar=1,scrollbars=1'),window.focus&&a.focus());return k.hide(),!0},onmousemove:function(a){a.target==document.getElementById('leapjs-decline-upgrade')?(document.getElementById('leapjs-decline-upgrade').style.color='#000',document.getElementById('leapjs-decline-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-accept-upgrade').style.color= +this.options.onmousemove&&a.addEventListener('mousemove',this.options.onmousemove)};b.prototype.show=function(){return document.body.appendChild(this.element),this};b.prototype.hide=function(){return document.body.removeChild(this.element),this};b.warnOutOfDate=function(a){a||(a={});var g='http://developer.leapmotion.com?';a.returnTo=window.location.href;for(var c in a)g+=c+'='+encodeURIComponent(a[c])+'&';var k;return k=new b("This site requires Leap Motion Tracking V2.", +{onclick:function(a){'leapjs-decline-upgrade'!=a.target.id&&(a=window.open(g,'_blank','height=800,width=1000,location=1,menubar=1,resizable=1,status=1,toolbar=1,scrollbars=1'),window.focus&&a.focus());return k.hide(),!0},onmousemove:function(a){a.target==document.getElementById('leapjs-decline-upgrade')?(document.getElementById('leapjs-decline-upgrade').style.color='#000',document.getElementById('leapjs-decline-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-accept-upgrade').style.color= '#444',document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'):(document.getElementById('leapjs-accept-upgrade').style.color='#000',document.getElementById('leapjs-accept-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-decline-upgrade').style.color='#444',document.getElementById('leapjs-decline-upgrade').style.boxShadow='none')},onmouseout:function(){document.getElementById('leapjs-decline-upgrade').style.color='#444';document.getElementById('leapjs-decline-upgrade').style.boxShadow= -'none';document.getElementById('leapjs-accept-upgrade').style.color='#444';document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'}}),k.show()};b.hasWarnedBones=!1;b.warnBones=function(){this.hasWarnedBones||(this.hasWarnedBones=!0,console.warn('Your Leap Service is out of date'),'undefined'!=typeof m&&m.versions&&m.versions.node||this.warnOutOfDate({reason:'bones'}))}},{__browserify_process:22}],7:[function(a,g){var m=a('./pointable'),b=a('./bone'),l=a('./dialog');a=a('underscore'); -g=g.exports=function(a){m.call(this,a);this.dipPosition=a.dipPosition;this.pipPosition=a.pipPosition;this.mcpPosition=a.mcpPosition;this.carpPosition=a.carpPosition;this.extended=a.extended;this.type=a.type;this.finger=!0;this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition];a.bases?this.addBones(a):l.warnBones()};a.extend(g.prototype,m.prototype);g.prototype.addBones=function(a){this.metacarpal=new b(this,{type:0,width:this.width,prevJoint:this.carpPosition, -nextJoint:this.mcpPosition,basis:a.bases[0]});this.proximal=new b(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:a.bases[1]});this.medial=new b(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:a.bases[2]});this.distal=new b(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:a.btipPosition,basis:a.bases[3]});this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]};g.prototype.toString=function(){return'Finger [ id:'+ -this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};g.Invalid={valid:!1}},{'./bone':1,'./dialog':6,'./pointable':14,underscore:24}],8:[function(a,g){var m=a('./hand'),b=a('./pointable'),l=a('./gesture').createGesture,f=a('gl-matrix'),c=f.mat3,k=f.vec3,n=a('./interaction_box'),p=a('./finger'),t=a('underscore');a=g.exports=function(a){if(this.valid=!0,this.id=a.id,this.timestamp=a.timestamp,this.hands=[],this.handsMap={},this.pointables=[],this.tools=[],this.fingers= +'none';document.getElementById('leapjs-accept-upgrade').style.color='#444';document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'}}),k.show()};b.hasWarnedBones=!1;b.warnBones=function(){this.hasWarnedBones||(this.hasWarnedBones=!0,console.warn('Your Leap Service is out of date'),'undefined'!=typeof m&&m.versions&&m.versions.node||this.warnOutOfDate({reason:'bones'}))}},{__browserify_process:22}],7:[function(a,e){var m=a('./pointable'),b=a('./bone'),l=a('./dialog');a=a('underscore'); +e=e.exports=function(a){m.call(this,a);this.dipPosition=a.dipPosition;this.pipPosition=a.pipPosition;this.mcpPosition=a.mcpPosition;this.carpPosition=a.carpPosition;this.extended=a.extended;this.type=a.type;this.finger=!0;this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition];a.bases?this.addBones(a):l.warnBones()};a.extend(e.prototype,m.prototype);e.prototype.addBones=function(a){this.metacarpal=new b(this,{type:0,width:this.width,prevJoint:this.carpPosition, +nextJoint:this.mcpPosition,basis:a.bases[0]});this.proximal=new b(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:a.bases[1]});this.medial=new b(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:a.bases[2]});this.distal=new b(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:a.btipPosition,basis:a.bases[3]});this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]};e.prototype.toString=function(){return'Finger [ id:'+ +this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};e.Invalid={valid:!1}},{'./bone':1,'./dialog':6,'./pointable':14,underscore:24}],8:[function(a,e){var m=a('./hand'),b=a('./pointable'),l=a('./gesture').createGesture,g=a('gl-matrix'),c=g.mat3,k=g.vec3,n=a('./interaction_box'),p=a('./finger'),t=a('underscore');a=e.exports=function(a){if(this.valid=!0,this.id=a.id,this.timestamp=a.timestamp,this.hands=[],this.handsMap={},this.pointables=[],this.tools=[],this.fingers= [],a.interactionBox&&(this.interactionBox=new n(a.interactionBox)),this.gestures=[],this.pointablesMap={},this._translation=a.t,this._rotation=t.flatten(a.r),this._scaleFactor=a.s,this.data=a,this.type='frame',this.currentFrameRate=a.currentFrameRate,a.gestures)for(var b=0,c=a.gestures.length;b!=c;b++)this.gestures.push(l(a.gestures[b]));this.postprocessData(a)};a.prototype.postprocessData=function(a){a||(a=this.data);for(var d=0,c=a.hands.length;d!=c;d++){var h=new m(a.hands[d]);h.frame=this;this.hands.push(h); this.handsMap[h.id]=h}a.pointables=t.sortBy(a.pointables,function(a){return a.id});d=0;for(c=a.pointables.length;d!=c;d++)h=a.pointables[d],h=h.dipPosition?new p(h):new b(h),h.frame=this,this.addPointable(h)};a.prototype.addPointable=function(a){if(this.pointables.push(a),this.pointablesMap[a.id]=a,(a.tool?this.tools:this.fingers).push(a),void 0!==a.handId&&this.handsMap.hasOwnProperty(a.handId)){var b=this.handsMap[a.handId];switch(b.pointables.push(a),(a.tool?b.tools:b.fingers).push(a),a.type){case 0:b.thumb= a;break;case 1:b.indexFinger=a;break;case 2:b.middleFinger=a;break;case 3:b.ringFinger=a;break;case 4:b.pinky=a}}};a.prototype.tool=function(a){a=this.pointable(a);return a.tool?a:b.Invalid};a.prototype.pointable=function(a){return this.pointablesMap[a]||b.Invalid};a.prototype.finger=function(a){a=this.pointable(a);return a.tool?b.Invalid:a};a.prototype.hand=function(a){return this.handsMap[a]||m.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid)return 0;var d=this.rotationMatrix(a), @@ -1197,131 +1197,131 @@ d=Math.acos(.5*(d[0]+d[4]+d[8]-1));if(d=isNaN(d)?0:d,void 0!==b)a=this.rotationA b)};a.prototype.scaleFactor=function(a){return this.valid&&a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){return this.valid&&a.valid?k.subtract(k.create(),this._translation,a._translation):k.create()};a.prototype.toString=function(){var a='Frame [ id:'+this.id+' | timestamp:'+this.timestamp+' | Hand count:('+this.hands.length+') | Pointable count:('+this.pointables.length+')';return this.gestures&&(a+=' | Gesture count:('+this.gestures.length+')'),a+' ]'}; a.prototype.dump=function(){var a;a='Frame Info:
'+this.toString();a+='

Hands:
';for(var b=0,c=this.hands.length;b!=c;b++)a+=' '+this.hands[b].toString()+'
';a+='

Pointables:
';b=0;for(c=this.pointables.length;b!=c;b++)a+=' '+this.pointables[b].toString()+'
';if(this.gestures)for(a+='

Gestures:
',b=0,c=this.gestures.length;b!=c;b++)a+=' '+this.gestures[b].toString()+'
';return a+='

Raw JSON:
',a+JSON.stringify(this.data)};a.Invalid= {valid:!1,hands:[],fingers:[],tools:[],gestures:[],pointables:[],pointable:function(){return b.Invalid},finger:function(){return b.Invalid},hand:function(){return m.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return c.create()},rotationAxis:function(){return k.create()},scaleFactor:function(){return 1},translation:function(){return k.create()}}},{'./finger':7,'./gesture':9,'./hand':10,'./interaction_box':12, -'./pointable':14,'gl-matrix':23,underscore:24}],9:[function(a,g,m){var b=a('gl-matrix').vec3;g=a('events').EventEmitter;var l=a('underscore'),f=(m.createGesture=function(a){var b;switch(a.type){case 'circle':b=new c(a);break;case 'swipe':b=new k(a);break;case 'screenTap':b=new n(a);break;case 'keyTap':b=new p(a);break;default:throw'unknown gesture type';}return b.id=a.id,b.handIds=a.handIds.slice(),b.pointableIds=a.pointableIds.slice(),b.duration=a.duration,b.state=a.state,b.type=a.type,b},m.gestureListener= -function(a,b){var d={},c={};a.on('gesture',function(a,h){if(a.type==b){if(('start'==a.state||'stop'==a.state)&&void 0===c[a.id]){var k=new f(a,h);c[a.id]=k;l.each(d,function(a,b){k.on(b,a)})}c[a.id].update(a,h);'stop'==a.state&&delete c[a.id]}});var h={start:function(a){return d.start=a,h},stop:function(a){return d.stop=a,h},complete:function(a){return d.stop=a,h},update:function(a){return d.update=a,h}};return h},m.Gesture=function(a,b){this.gestures=[a];this.frames=[b]});f.prototype.update=function(a, -b){this.lastGesture=a;this.lastFrame=b;this.gestures.push(a);this.frames.push(b);this.emit(a.state,this)};f.prototype.translation=function(){return b.subtract(b.create(),this.lastGesture.startPosition,this.lastGesture.position)};l.extend(f.prototype,g.prototype);var c=function(a){this.center=a.center;this.normal=a.normal;this.progress=a.progress;this.radius=a.radius};c.prototype.toString=function(){return'CircleGesture ['+JSON.stringify(this)+']'};var k=function(a){this.startPosition=a.startPosition; +'./pointable':14,'gl-matrix':23,underscore:24}],9:[function(a,e,m){var b=a('gl-matrix').vec3;e=a('events').EventEmitter;var l=a('underscore'),g=(m.createGesture=function(a){var b;switch(a.type){case 'circle':b=new c(a);break;case 'swipe':b=new k(a);break;case 'screenTap':b=new n(a);break;case 'keyTap':b=new p(a);break;default:throw'unknown gesture type';}return b.id=a.id,b.handIds=a.handIds.slice(),b.pointableIds=a.pointableIds.slice(),b.duration=a.duration,b.state=a.state,b.type=a.type,b},m.gestureListener= +function(a,b){var d={},c={};a.on('gesture',function(a,h){if(a.type==b){if(('start'==a.state||'stop'==a.state)&&void 0===c[a.id]){var k=new g(a,h);c[a.id]=k;l.each(d,function(a,b){k.on(b,a)})}c[a.id].update(a,h);'stop'==a.state&&delete c[a.id]}});var h={start:function(a){return d.start=a,h},stop:function(a){return d.stop=a,h},complete:function(a){return d.stop=a,h},update:function(a){return d.update=a,h}};return h},m.Gesture=function(a,b){this.gestures=[a];this.frames=[b]});g.prototype.update=function(a, +b){this.lastGesture=a;this.lastFrame=b;this.gestures.push(a);this.frames.push(b);this.emit(a.state,this)};g.prototype.translation=function(){return b.subtract(b.create(),this.lastGesture.startPosition,this.lastGesture.position)};l.extend(g.prototype,e.prototype);var c=function(a){this.center=a.center;this.normal=a.normal;this.progress=a.progress;this.radius=a.radius};c.prototype.toString=function(){return'CircleGesture ['+JSON.stringify(this)+']'};var k=function(a){this.startPosition=a.startPosition; this.position=a.position;this.direction=a.direction;this.speed=a.speed};k.prototype.toString=function(){return'SwipeGesture ['+JSON.stringify(this)+']'};var n=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};n.prototype.toString=function(){return'ScreenTapGesture ['+JSON.stringify(this)+']'};var p=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};p.prototype.toString=function(){return'KeyTapGesture ['+JSON.stringify(this)+ -']'}},{events:21,'gl-matrix':23,underscore:24}],10:[function(a,g){var m=a('./pointable'),b=a('./bone'),l=a('gl-matrix'),f=l.mat3,c=l.vec3,k=a('underscore');a=g.exports=function(a){this.id=a.id;this.palmPosition=a.palmPosition;this.direction=a.direction;this.palmVelocity=a.palmVelocity;this.palmNormal=a.palmNormal;this.sphereCenter=a.sphereCenter;this.sphereRadius=a.sphereRadius;this.valid=!0;this.pointables=[];this.fingers=[];this.arm=a.armBasis?new b(this,{type:4,width:a.armWidth,prevJoint:a.elbow, +']'}},{events:21,'gl-matrix':23,underscore:24}],10:[function(a,e){var m=a('./pointable'),b=a('./bone'),l=a('gl-matrix'),g=l.mat3,c=l.vec3,k=a('underscore');a=e.exports=function(a){this.id=a.id;this.palmPosition=a.palmPosition;this.direction=a.direction;this.palmVelocity=a.palmVelocity;this.palmNormal=a.palmNormal;this.sphereCenter=a.sphereCenter;this.sphereRadius=a.sphereRadius;this.valid=!0;this.pointables=[];this.fingers=[];this.arm=a.armBasis?new b(this,{type:4,width:a.armWidth,prevJoint:a.elbow, nextJoint:a.wrist,basis:a.armBasis}):null;this.tools=[];this._translation=a.t;this._rotation=k.flatten(a.r);this._scaleFactor=a.s;this.timeVisible=a.timeVisible;this.stabilizedPalmPosition=a.stabilizedPalmPosition;this.type=a.type;this.grabStrength=a.grabStrength;this.pinchStrength=a.pinchStrength;this.confidence=a.confidence};a.prototype.finger=function(a){return(a=this.frame.finger(a))&&a.handId==this.id?a:m.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid||!a.hand(this.id).valid)return 0; -var f=this.rotationMatrix(a),f=Math.acos(.5*(f[0]+f[4]+f[8]-1));if(f=isNaN(f)?0:f,void 0!==b)a=this.rotationAxis(a),f*=c.dot(a,c.normalize(c.create(),b));return f};a.prototype.rotationAxis=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?c.normalize(c.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):c.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return f.create();a=a.hand(this.id); -if(!a.valid)return f.create();var b=f.transpose(f.create(),this._rotation);return f.multiply(f.create(),a._rotation,b)};a.prototype.scaleFactor=function(a){if(!this.valid||!a.valid)return 1;a=a.hand(this.id);return a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?[this._translation[0]-a._translation[0],this._translation[1]-a._translation[1],this._translation[2]-a._translation[2]]:c.create()}; +var g=this.rotationMatrix(a),g=Math.acos(.5*(g[0]+g[4]+g[8]-1));if(g=isNaN(g)?0:g,void 0!==b)a=this.rotationAxis(a),g*=c.dot(a,c.normalize(c.create(),b));return g};a.prototype.rotationAxis=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?c.normalize(c.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):c.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return g.create();a=a.hand(this.id); +if(!a.valid)return g.create();var b=g.transpose(g.create(),this._rotation);return g.multiply(g.create(),a._rotation,b)};a.prototype.scaleFactor=function(a){if(!this.valid||!a.valid)return 1;a=a.hand(this.id);return a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?[this._translation[0]-a._translation[0],this._translation[1]-a._translation[1],this._translation[2]-a._translation[2]]:c.create()}; a.prototype.toString=function(){return'Hand ('+this.type+') [ id: '+this.id+' | palm velocity:'+this.palmVelocity+' | sphere center:'+this.sphereCenter+' ] '};a.prototype.pitch=function(){return Math.atan2(this.direction[1],-this.direction[2])};a.prototype.yaw=function(){return Math.atan2(this.direction[0],-this.direction[2])};a.prototype.roll=function(){return Math.atan2(this.palmNormal[0],-this.palmNormal[1])};a.Invalid={valid:!1,fingers:[],tools:[],pointables:[],left:!1,pointable:function(){return m.Invalid}, -finger:function(){return m.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return f.create()},rotationAxis:function(){return c.create()},scaleFactor:function(){return 1},translation:function(){return c.create()}}},{'./bone':1,'./pointable':14,'gl-matrix':23,underscore:24}],11:[function(a,g){g.exports={Controller:a('./controller'),Frame:a('./frame'),Gesture:a('./gesture'),Hand:a('./hand'),Pointable:a('./pointable'), +finger:function(){return m.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return g.create()},rotationAxis:function(){return c.create()},scaleFactor:function(){return 1},translation:function(){return c.create()}}},{'./bone':1,'./pointable':14,'gl-matrix':23,underscore:24}],11:[function(a,e){e.exports={Controller:a('./controller'),Frame:a('./frame'),Gesture:a('./gesture'),Hand:a('./hand'),Pointable:a('./pointable'), Finger:a('./finger'),InteractionBox:a('./interaction_box'),CircularBuffer:a('./circular_buffer'),UI:a('./ui'),JSONProtocol:a('./protocol').JSONProtocol,glMatrix:a('gl-matrix'),mat3:a('gl-matrix').mat3,vec3:a('gl-matrix').vec3,loopController:void 0,version:a('./version.js'),_:a('underscore'),EventEmitter:a('events').EventEmitter,loop:function(a,b){return a&&void 0===b&&'[object Function]'==={}.toString.call(a)&&(b=a,a={}),this.loopController?a&&this.loopController.setupFrameEvents(a):this.loopController= -new this.Controller(a),this.loopController.loop(b),this.loopController},plugin:function(a,b){this.Controller.plugin(a,b)}}},{'./circular_buffer':2,'./controller':5,'./finger':7,'./frame':8,'./gesture':9,'./hand':10,'./interaction_box':12,'./pointable':14,'./protocol':15,'./ui':16,'./version.js':19,events:21,'gl-matrix':23,underscore:24}],12:[function(a,g){var m=a('gl-matrix').vec3;a=g.exports=function(a){this.valid=!0;this.center=a.center;this.size=a.size;this.width=a.size[0];this.height=a.size[1]; -this.depth=a.size[2]};a.prototype.denormalizePoint=function(a){return m.fromValues((a[0]-.5)*this.size[0]+this.center[0],(a[1]-.5)*this.size[1]+this.center[1],(a[2]-.5)*this.size[2]+this.center[2])};a.prototype.normalizePoint=function(a,g){a=m.fromValues((a[0]-this.center[0])/this.size[0]+.5,(a[1]-this.center[1])/this.size[1]+.5,(a[2]-this.center[2])/this.size[2]+.5);return g&&(a[0]=Math.min(Math.max(a[0],0),1),a[1]=Math.min(Math.max(a[1],0),1),a[2]=Math.min(Math.max(a[2],0),1)),a};a.prototype.toString= -function(){return'InteractionBox [ width:'+this.width+' | height:'+this.height+' | depth:'+this.depth+' ]'};a.Invalid={valid:!1}},{'gl-matrix':23}],13:[function(a,g){a=g.exports=function(a){this.steps=[];this.controller=a};a.prototype.addStep=function(a){this.steps.push(a)};a.prototype.run=function(a){for(var b=this.steps.length,g=0;g!=b&&a;g++)a=this.steps[g](a);return a};a.prototype.removeStep=function(a){a=this.steps.indexOf(a);if(-1===a)throw'Step not found in pipeline';this.steps.splice(a,1)}; -a.prototype.addWrappedStep=function(a,b){var g=this.controller,f=function(c){var f,l,p;f='frame'==a?[c]:c[a+'s']||[];l=0;for(p=f.length;p>l;l++)b.call(g,f[l]);return c};return this.addStep(f),f}},{}],14:[function(a,g){a=a('gl-matrix');g=(a.vec3,g.exports=function(a){this.valid=!0;this.id=a.id;this.handId=a.handId;this.length=a.length;this.tool=a.tool;this.width=a.width;this.direction=a.direction;this.stabilizedTipPosition=a.stabilizedTipPosition;this.tipPosition=a.tipPosition;this.tipVelocity=a.tipVelocity; -this.touchZone=a.touchZone;this.touchDistance=a.touchDistance;this.timeVisible=a.timeVisible});g.prototype.toString=function(){return'Pointable [ id:'+this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};g.prototype.hand=function(){return this.frame.hand(this.handId)};g.Invalid={valid:!1}},{'gl-matrix':23}],15:[function(a,g,m){var b=a('./frame'),l=(a('./hand'),a('./pointable'),a('./finger'),a('underscore')),f=a('events').EventEmitter,c=function(a){this.type=a.type; +new this.Controller(a),this.loopController.loop(b),this.loopController},plugin:function(a,b){this.Controller.plugin(a,b)}}},{'./circular_buffer':2,'./controller':5,'./finger':7,'./frame':8,'./gesture':9,'./hand':10,'./interaction_box':12,'./pointable':14,'./protocol':15,'./ui':16,'./version.js':19,events:21,'gl-matrix':23,underscore:24}],12:[function(a,e){var m=a('gl-matrix').vec3;a=e.exports=function(a){this.valid=!0;this.center=a.center;this.size=a.size;this.width=a.size[0];this.height=a.size[1]; +this.depth=a.size[2]};a.prototype.denormalizePoint=function(a){return m.fromValues((a[0]-.5)*this.size[0]+this.center[0],(a[1]-.5)*this.size[1]+this.center[1],(a[2]-.5)*this.size[2]+this.center[2])};a.prototype.normalizePoint=function(a,e){a=m.fromValues((a[0]-this.center[0])/this.size[0]+.5,(a[1]-this.center[1])/this.size[1]+.5,(a[2]-this.center[2])/this.size[2]+.5);return e&&(a[0]=Math.min(Math.max(a[0],0),1),a[1]=Math.min(Math.max(a[1],0),1),a[2]=Math.min(Math.max(a[2],0),1)),a};a.prototype.toString= +function(){return'InteractionBox [ width:'+this.width+' | height:'+this.height+' | depth:'+this.depth+' ]'};a.Invalid={valid:!1}},{'gl-matrix':23}],13:[function(a,e){a=e.exports=function(a){this.steps=[];this.controller=a};a.prototype.addStep=function(a){this.steps.push(a)};a.prototype.run=function(a){for(var b=this.steps.length,e=0;e!=b&&a;e++)a=this.steps[e](a);return a};a.prototype.removeStep=function(a){a=this.steps.indexOf(a);if(-1===a)throw'Step not found in pipeline';this.steps.splice(a,1)}; +a.prototype.addWrappedStep=function(a,b){var e=this.controller,g=function(c){var g,n,l;g='frame'==a?[c]:c[a+'s']||[];n=0;for(l=g.length;l>n;n++)b.call(e,g[n]);return c};return this.addStep(g),g}},{}],14:[function(a,e){a=a('gl-matrix');e=(a.vec3,e.exports=function(a){this.valid=!0;this.id=a.id;this.handId=a.handId;this.length=a.length;this.tool=a.tool;this.width=a.width;this.direction=a.direction;this.stabilizedTipPosition=a.stabilizedTipPosition;this.tipPosition=a.tipPosition;this.tipVelocity=a.tipVelocity; +this.touchZone=a.touchZone;this.touchDistance=a.touchDistance;this.timeVisible=a.timeVisible});e.prototype.toString=function(){return'Pointable [ id:'+this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};e.prototype.hand=function(){return this.frame.hand(this.handId)};e.Invalid={valid:!1}},{'gl-matrix':23}],15:[function(a,e,m){var b=a('./frame'),l=(a('./hand'),a('./pointable'),a('./finger'),a('underscore')),g=a('events').EventEmitter,c=function(a){this.type=a.type; this.state=a.state};m.chooseProtocol=function(a){var b;switch(a.version){case 1:case 2:case 3:case 4:case 5:case 6:b=k(a);b.sendBackground=function(a,c){a.send(b.encode({background:c}))};b.sendFocused=function(a,c){a.send(b.encode({focused:c}))};b.sendOptimizeHMD=function(a,c){a.send(b.encode({optimizeHMD:c}))};break;default:throw'unrecognized version';}return b};var k=m.JSONProtocol=function(a){var k=function(a){if(a.event)return new c(a.event);k.emit('beforeFrameCreated',a);var h=new b(a);return k.emit('afterFrameCreated', -h,a),h};return k.encode=function(a){return JSON.stringify(a)},k.version=a.version,k.serviceVersion=a.serviceVersion,k.versionLong='Version '+a.version,k.type='protocol',l.extend(k,f.prototype),k}},{'./finger':7,'./frame':8,'./hand':10,'./pointable':14,events:21,underscore:24}],16:[function(a,g,m){m.UI={Region:a('./ui/region'),Cursor:a('./ui/cursor')}},{'./ui/cursor':17,'./ui/region':18}],17:[function(a,g){g.exports=function(){return function(a){var b=a.pointables.sort(function(a,b){return a.z-b.z})[0]; -return b&&b.valid&&(a.cursorPosition=b.tipPosition),a}}},{}],18:[function(a,g){var m=a('events').EventEmitter;a=a('underscore');var b=g.exports=function(a,b){this.start=new Vector(a);this.end=new Vector(b);this.enteredFrame=null};b.prototype.hasPointables=function(a){for(var b=0;b!=a.pointables.length;b++){var c=a.pointables[b].tipPosition;if(c.x>=this.start.x&&c.x<=this.end.x&&c.y>=this.start.y&&c.y<=this.end.y&&c.z>=this.start.z&&c.z<=this.end.z)return!0}return!1};b.prototype.listener=function(a){var b= -this;return a&&a.nearThreshold&&this.setupNearRegion(a.nearThreshold),function(a){return b.updatePosition(a)}};b.prototype.clipper=function(){var a=this;return function(b){return a.updatePosition(b),a.enteredFrame?b:null}};b.prototype.setupNearRegion=function(a){a=this.nearRegion=new b([this.start.x-a,this.start.y-a,this.start.z-a],[this.end.x+a,this.end.y+a,this.end.z+a]);var f=this;a.on('enter',function(a){f.emit('near',a)});a.on('exit',function(a){f.emit('far',a)});f.on('exit',function(a){f.emit('near', +h,a),h};return k.encode=function(a){return JSON.stringify(a)},k.version=a.version,k.serviceVersion=a.serviceVersion,k.versionLong='Version '+a.version,k.type='protocol',l.extend(k,g.prototype),k}},{'./finger':7,'./frame':8,'./hand':10,'./pointable':14,events:21,underscore:24}],16:[function(a,e,m){m.UI={Region:a('./ui/region'),Cursor:a('./ui/cursor')}},{'./ui/cursor':17,'./ui/region':18}],17:[function(a,e){e.exports=function(){return function(a){var b=a.pointables.sort(function(a,b){return a.z-b.z})[0]; +return b&&b.valid&&(a.cursorPosition=b.tipPosition),a}}},{}],18:[function(a,e){var m=a('events').EventEmitter;a=a('underscore');var b=e.exports=function(a,b){this.start=new Vector(a);this.end=new Vector(b);this.enteredFrame=null};b.prototype.hasPointables=function(a){for(var b=0;b!=a.pointables.length;b++){var c=a.pointables[b].tipPosition;if(c.x>=this.start.x&&c.x<=this.end.x&&c.y>=this.start.y&&c.y<=this.end.y&&c.z>=this.start.z&&c.z<=this.end.z)return!0}return!1};b.prototype.listener=function(a){var b= +this;return a&&a.nearThreshold&&this.setupNearRegion(a.nearThreshold),function(a){return b.updatePosition(a)}};b.prototype.clipper=function(){var a=this;return function(b){return a.updatePosition(b),a.enteredFrame?b:null}};b.prototype.setupNearRegion=function(a){a=this.nearRegion=new b([this.start.x-a,this.start.y-a,this.start.z-a],[this.end.x+a,this.end.y+a,this.end.z+a]);var g=this;a.on('enter',function(a){g.emit('near',a)});a.on('exit',function(a){g.emit('far',a)});g.on('exit',function(a){g.emit('near', a)})};b.prototype.updatePosition=function(a){return this.nearRegion&&this.nearRegion.updatePosition(a),this.hasPointables(a)&&null==this.enteredFrame?(this.enteredFrame=a,this.emit('enter',this.enteredFrame)):this.hasPointables(a)||null==this.enteredFrame||(this.enteredFrame=null,this.emit('exit',this.enteredFrame)),a};b.prototype.normalize=function(a){return new Vector([(a.x-this.start.x)/(this.end.x-this.start.x),(a.y-this.start.y)/(this.end.y-this.start.y),(a.z-this.start.z)/(this.end.z-this.start.z)])}; -b.prototype.mapToXY=function(a,b,c){a=this.normalize(a);var f=a.x,g=a.y;return 1f&&(f=-1),1g&&(g=-1),[(f+1)/2*b,(1-g)/2*c,a.z]};a.extend(b.prototype,m.prototype)},{events:21,underscore:24}],19:[function(a,g){g.exports={full:'0.6.4',major:0,minor:6,dot:4}},{}],20:[function(){},{}],21:[function(a,g,m){a=a('__browserify_process');a.EventEmitter||(a.EventEmitter=function(){});m=m.EventEmitter=a.EventEmitter;var b='function'==typeof Array.isArray?Array.isArray:function(a){return'[object Array]'=== -Object.prototype.toString.call(a)};m.prototype.setMaxListeners=function(a){this._events||(this._events={});this._events.maxListeners=a};m.prototype.emit=function(a){if('error'===a&&(!this._events||!this._events.error||b(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var f=this._events[a];if(!f)return!1;if('function'==typeof f){switch(arguments.length){case 1:f.call(this);break; -case 2:f.call(this,arguments[1]);break;case 3:f.call(this,arguments[1],arguments[2]);break;default:var c=Array.prototype.slice.call(arguments,1);f.apply(this,c)}return!0}if(b(f)){for(var c=Array.prototype.slice.call(arguments,1),f=f.slice(),k=0,g=f.length;g>k;k++)f[k].apply(this,c);return!0}return!1};m.prototype.addListener=function(a,f){if('function'!=typeof f)throw Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,f),this._events[a])if(b(this._events[a])){if(!this._events[a].warned){var c; -(c=void 0!==this._events.maxListeners?this._events.maxListeners:10)&&0c&&(this._events[a].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}this._events[a].push(f)}else this._events[a]=[this._events[a],f];else this._events[a]=f;return this};m.prototype.on=m.prototype.addListener;m.prototype.once=function(a,b){var c=this;return c.on(a, -function n(){c.removeListener(a,n);b.apply(this,arguments)}),this};m.prototype.removeListener=function(a,f){if('function'!=typeof f)throw Error('removeListener only takes instances of Function');if(!this._events||!this._events[a])return this;var c=this._events[a];if(b(c)){a:if(c.indexOf)f=c.indexOf(f);else{for(var k=0;kf)return this;c.splice(f,1);0==c.length&&delete this._events[a]}else this._events[a]===f&&delete this._events[a];return this};m.prototype.removeAllListeners= -function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)};m.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),b(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]};m.listenerCount=function(a,b){return a._events&&a._events[b]?'function'==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:22}],22:[function(a,g){a=g.exports={};a.nextTick= -function(){if('undefined'!=typeof window&&window.setImmediate)return function(a){return window.setImmediate(a)};if('undefined'!=typeof window&&window.postMessage&&window.addEventListener){var a=[];return window.addEventListener('message',function(b){var g=b.source;(g===window||null===g)&&'process-tick'===b.data&&(b.stopPropagation(),0g&&(g=-1),1e&&(e=-1),[(g+1)/2*b,(1-e)/2*c,a.z]};a.extend(b.prototype,m.prototype)},{events:21,underscore:24}],19:[function(a,e){e.exports={full:'0.6.4',major:0,minor:6,dot:4}},{}],20:[function(){},{}],21:[function(a,e,m){a=a('__browserify_process');a.EventEmitter||(a.EventEmitter=function(){});m=m.EventEmitter=a.EventEmitter;var b='function'==typeof Array.isArray?Array.isArray:function(a){return'[object Array]'=== +Object.prototype.toString.call(a)};m.prototype.setMaxListeners=function(a){this._events||(this._events={});this._events.maxListeners=a};m.prototype.emit=function(a){if('error'===a&&(!this._events||!this._events.error||b(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var g=this._events[a];if(!g)return!1;if('function'==typeof g){switch(arguments.length){case 1:g.call(this);break; +case 2:g.call(this,arguments[1]);break;case 3:g.call(this,arguments[1],arguments[2]);break;default:var c=Array.prototype.slice.call(arguments,1);g.apply(this,c)}return!0}if(b(g)){for(var c=Array.prototype.slice.call(arguments,1),g=g.slice(),k=0,e=g.length;e>k;k++)g[k].apply(this,c);return!0}return!1};m.prototype.addListener=function(a,g){if('function'!=typeof g)throw Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,g),this._events[a])if(b(this._events[a])){if(!this._events[a].warned){var c; +(c=void 0!==this._events.maxListeners?this._events.maxListeners:10)&&0c&&(this._events[a].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}this._events[a].push(g)}else this._events[a]=[this._events[a],g];else this._events[a]=g;return this};m.prototype.on=m.prototype.addListener;m.prototype.once=function(a,b){var c=this;return c.on(a, +function n(){c.removeListener(a,n);b.apply(this,arguments)}),this};m.prototype.removeListener=function(a,g){if('function'!=typeof g)throw Error('removeListener only takes instances of Function');if(!this._events||!this._events[a])return this;var c=this._events[a];if(b(c)){a:if(c.indexOf)g=c.indexOf(g);else{for(var k=0;kg)return this;c.splice(g,1);0==c.length&&delete this._events[a]}else this._events[a]===g&&delete this._events[a];return this};m.prototype.removeAllListeners= +function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)};m.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),b(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]};m.listenerCount=function(a,b){return a._events&&a._events[b]?'function'==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:22}],22:[function(a,e){a=e.exports={};a.nextTick= +function(){if('undefined'!=typeof window&&window.setImmediate)return function(a){return window.setImmediate(a)};if('undefined'!=typeof window&&window.postMessage&&window.addEventListener){var a=[];return window.addEventListener('message',function(b){var e=b.source;(e===window||null===e)&&'process-tick'===b.data&&(b.stopPropagation(),0c;c+=d)a[0]=b[c],a[1]=b[c+1],f(a,a,k),b[c]=a[0],b[c+1]=a[1];return b}}();h.str=function(a){return'vec2('+ -a[0]+', '+a[1]+')'};'undefined'!=typeof a&&(a.vec2=h);var d={create:function(){var a=new f(3);return a[0]=0,a[1]=0,a[2]=0,a},clone:function(a){var b=new f(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b},fromValues:function(a,b,d){var c=new f(3);return c[0]=a,c[1]=b,c[2]=d,c},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},set:function(a,b,d,c){return a[0]=b,a[1]=d,a[2]=c,a},add:function(a,b,d){return a[0]=b[0]+d[0],a[1]=b[1]+d[1],a[2]=b[2]+d[2],a},subtract:function(a,b,d){return a[0]=b[0]-d[0], +return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],g(a,a,k),b[c]=a[0],b[c+1]=a[1];return b}}();h.str=function(a){return'vec2('+ +a[0]+', '+a[1]+')'};'undefined'!=typeof a&&(a.vec2=h);var d={create:function(){var a=new g(3);return a[0]=0,a[1]=0,a[2]=0,a},clone:function(a){var b=new g(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b},fromValues:function(a,b,d){var c=new g(3);return c[0]=a,c[1]=b,c[2]=d,c},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},set:function(a,b,d,c){return a[0]=b,a[1]=d,a[2]=c,a},add:function(a,b,d){return a[0]=b[0]+d[0],a[1]=b[1]+d[1],a[2]=b[2]+d[2],a},subtract:function(a,b,d){return a[0]=b[0]-d[0], a[1]=b[1]-d[1],a[2]=b[2]-d[2],a}};d.sub=d.subtract;d.multiply=function(a,b,d){return a[0]=b[0]*d[0],a[1]=b[1]*d[1],a[2]=b[2]*d[2],a};d.mul=d.multiply;d.divide=function(a,b,d){return a[0]=b[0]/d[0],a[1]=b[1]/d[1],a[2]=b[2]/d[2],a};d.div=d.divide;d.min=function(a,b,d){return a[0]=Math.min(b[0],d[0]),a[1]=Math.min(b[1],d[1]),a[2]=Math.min(b[2],d[2]),a};d.max=function(a,b,d){return a[0]=Math.max(b[0],d[0]),a[1]=Math.max(b[1],d[1]),a[2]=Math.max(b[2],d[2]),a};d.scale=function(a,b,d){return a[0]=b[0]*d, a[1]=b[1]*d,a[2]=b[2]*d,a};d.scaleAndAdd=function(a,b,d,c){return a[0]=b[0]+d[0]*c,a[1]=b[1]+d[1]*c,a[2]=b[2]+d[2]*c,a};d.distance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(d*d+c*c+a*a)};d.dist=d.distance;d.squaredDistance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return d*d+c*c+a*a};d.sqrDist=d.squaredDistance;d.length=function(a){var b=a[0],d=a[1];a=a[2];return Math.sqrt(b*b+d*d+a*a)};d.len=d.length;d.squaredLength=function(a){var b=a[0],d=a[1];a=a[2];return b* -b+d*d+a*a};d.sqrLen=d.squaredLength;d.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a};d.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],d=d*d+c*c+h*h;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],f(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();d.str=function(a){return'vec3('+a[0]+', '+a[1]+', '+a[2]+')'};'undefined'!=typeof a&&(a.vec3=d);var v={create:function(){var a=new f(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a},clone:function(a){var b=new f(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},fromValues:function(a,b,d,c){var h=new f(4);return h[0]=a,h[1]=b,h[2]=d,h[3]=c,h},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2], +b+d*d+a*a};d.sqrLen=d.squaredLength;d.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a};d.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],d=d*d+c*c+h*h;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],g(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();d.str=function(a){return'vec3('+a[0]+', '+a[1]+', '+a[2]+')'};'undefined'!=typeof a&&(a.vec3=d);var v={create:function(){var a=new g(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a},clone:function(a){var b=new g(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},fromValues:function(a,b,d,c){var h=new g(4);return h[0]=a,h[1]=b,h[2]=d,h[3]=c,h},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2], a[3]=b[3],a},set:function(a,b,d,c,h){return a[0]=b,a[1]=d,a[2]=c,a[3]=h,a},add:function(a,b,d){return a[0]=b[0]+d[0],a[1]=b[1]+d[1],a[2]=b[2]+d[2],a[3]=b[3]+d[3],a},subtract:function(a,b,d){return a[0]=b[0]-d[0],a[1]=b[1]-d[1],a[2]=b[2]-d[2],a[3]=b[3]-d[3],a}};v.sub=v.subtract;v.multiply=function(a,b,d){return a[0]=b[0]*d[0],a[1]=b[1]*d[1],a[2]=b[2]*d[2],a[3]=b[3]*d[3],a};v.mul=v.multiply;v.divide=function(a,b,d){return a[0]=b[0]/d[0],a[1]=b[1]/d[1],a[2]=b[2]/d[2],a[3]=b[3]/d[3],a};v.div=v.divide; v.min=function(a,b,d){return a[0]=Math.min(b[0],d[0]),a[1]=Math.min(b[1],d[1]),a[2]=Math.min(b[2],d[2]),a[3]=Math.min(b[3],d[3]),a};v.max=function(a,b,d){return a[0]=Math.max(b[0],d[0]),a[1]=Math.max(b[1],d[1]),a[2]=Math.max(b[2],d[2]),a[3]=Math.max(b[3],d[3]),a};v.scale=function(a,b,d){return a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d,a[3]=b[3]*d,a};v.scaleAndAdd=function(a,b,d,c){return a[0]=b[0]+d[0]*c,a[1]=b[1]+d[1]*c,a[2]=b[2]+d[2]*c,a[3]=b[3]+d[3]*c,a};v.distance=function(a,b){var d=b[0]-a[0],c=b[1]- a[1],h=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(d*d+c*c+h*h+a*a)};v.dist=v.distance;v.squaredDistance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1],h=b[2]-a[2];a=b[3]-a[3];return d*d+c*c+h*h+a*a};v.sqrDist=v.squaredDistance;v.length=function(a){var b=a[0],d=a[1],c=a[2];a=a[3];return Math.sqrt(b*b+d*d+c*c+a*a)};v.len=v.length;v.squaredLength=function(a){var b=a[0],d=a[1],c=a[2];a=a[3];return b*b+d*d+c*c+a*a};v.sqrLen=v.squaredLength;v.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=-b[3], -a};v.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],d=d*d+c*c+h*h+f*f;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],a[3]=b[c+3],f(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2],b[c+3]=a[3];return b}}();v.str=function(a){return'vec4('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.vec4=v);l={create:function(){var a=new f(4);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},clone:function(a){var b=new f(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},identity:function(a){return a[0]= -1,a[1]=0,a[2]=0,a[3]=1,a},transpose:function(a,b){if(a===b){var d=b[1];a[1]=b[2];a[2]=d}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var f=d*b-h*c;return f?(f=1/f,a[0]=b*f,a[1]=-c*f,a[2]=-h*f,a[3]=d*f,a):null},adjoint:function(a,b){var d=b[0];return a[0]=b[3],a[1]=-b[1],a[2]=-b[2],a[3]=d,a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2];b=b[3];var k=d[0],g=d[1],l=d[2];d=d[3];return a[0]= -c*k+f*g,a[1]=h*k+b*g,a[2]=c*l+f*d,a[3]=h*l+b*d,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],f=b[2];b=b[3];var k=Math.sin(d);d=Math.cos(d);return a[0]=c*d+f*k,a[1]=h*d+b*k,a[2]=c*-k+f*d,a[3]=h*-k+b*d,a};l.scale=function(a,b,d){var c=b[1],h=b[2],f=b[3],k=d[0];d=d[1];return a[0]=b[0]*k,a[1]=c*k,a[2]=h*d,a[3]=f*d,a};l.str=function(a){return'mat2('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3], -2))};l.LDU=function(a,b,d,c){return a[2]=c[2]/c[0],d[0]=c[0],d[1]=c[1],d[3]=c[3]-a[2]*d[1],[a,b,d]};'undefined'!=typeof a&&(a.mat2=l);l={create:function(){var a=new f(6);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},clone:function(a){var b=new f(6);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},invert:function(a, -b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4];b=b[5];var g=d*f-c*h;return g?(g=1/g,a[0]=f*g,a[1]=-c*g,a[2]=-h*g,a[3]=d*g,a[4]=(h*b-f*k)*g,a[5]=(c*k-d*b)*g,a):null},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4];b=b[5];var l=d[0],n=d[1],q=d[2],p=d[3],m=d[4];d=d[5];return a[0]=c*l+f*n,a[1]=h*l+k*n,a[2]=c*q+f*p,a[3]=h*q+k*p,a[4]=c*m+f*d+g,a[5]=h*m+k*d+b,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4]; -b=b[5];var l=Math.sin(d);d=Math.cos(d);return a[0]=c*d+f*l,a[1]=h*d+k*l,a[2]=c*-l+f*d,a[3]=h*-l+k*d,a[4]=g,a[5]=b,a};l.scale=function(a,b,d){var c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=d[0];d=d[1];return a[0]=b[0]*l,a[1]=c*l,a[2]=h*d,a[3]=f*d,a[4]=k,a[5]=g,a};l.translate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4];b=b[5];var l=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=f,a[3]=k,a[4]=c*l+f*d+g,a[5]=h*l+k*d+b,a};l.str=function(a){return'mat2d('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+ -')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};'undefined'!=typeof a&&(a.mat2d=l);var w={create:function(){var a=new f(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},fromMat4:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},clone:function(a){var b=new f(9);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]= +a};v.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],d=d*d+c*c+h*h+g*g;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],a[3]=b[c+3],g(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2],b[c+3]=a[3];return b}}();v.str=function(a){return'vec4('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.vec4=v);l={create:function(){var a=new g(4);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},clone:function(a){var b=new g(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},identity:function(a){return a[0]= +1,a[1]=0,a[2]=0,a[3]=1,a},transpose:function(a,b){if(a===b){var d=b[1];a[1]=b[2];a[2]=d}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var g=d*b-h*c;return g?(g=1/g,a[0]=b*g,a[1]=-c*g,a[2]=-h*g,a[3]=d*g,a):null},adjoint:function(a,b){var d=b[0];return a[0]=b[3],a[1]=-b[1],a[2]=-b[2],a[3]=d,a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2];b=b[3];var k=d[0],e=d[1],n=d[2];d=d[3];return a[0]= +c*k+g*e,a[1]=h*k+b*e,a[2]=c*n+g*d,a[3]=h*n+b*d,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],g=b[2];b=b[3];var k=Math.sin(d);d=Math.cos(d);return a[0]=c*d+g*k,a[1]=h*d+b*k,a[2]=c*-k+g*d,a[3]=h*-k+b*d,a};l.scale=function(a,b,d){var c=b[1],h=b[2],g=b[3],k=d[0];d=d[1];return a[0]=b[0]*k,a[1]=c*k,a[2]=h*d,a[3]=g*d,a};l.str=function(a){return'mat2('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3], +2))};l.LDU=function(a,b,d,c){return a[2]=c[2]/c[0],d[0]=c[0],d[1]=c[1],d[3]=c[3]-a[2]*d[1],[a,b,d]};'undefined'!=typeof a&&(a.mat2=l);l={create:function(){var a=new g(6);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},clone:function(a){var b=new g(6);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},invert:function(a, +b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4];b=b[5];var e=d*g-c*h;return e?(e=1/e,a[0]=g*e,a[1]=-c*e,a[2]=-h*e,a[3]=d*e,a[4]=(h*b-g*k)*e,a[5]=(c*k-d*b)*e,a):null},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4];b=b[5];var n=d[0],l=d[1],q=d[2],p=d[3],m=d[4];d=d[5];return a[0]=c*n+g*l,a[1]=h*n+k*l,a[2]=c*q+g*p,a[3]=h*q+k*p,a[4]=c*m+g*d+e,a[5]=h*m+k*d+b,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4]; +b=b[5];var n=Math.sin(d);d=Math.cos(d);return a[0]=c*d+g*n,a[1]=h*d+k*n,a[2]=c*-n+g*d,a[3]=h*-n+k*d,a[4]=e,a[5]=b,a};l.scale=function(a,b,d){var c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=d[0];d=d[1];return a[0]=b[0]*n,a[1]=c*n,a[2]=h*d,a[3]=g*d,a[4]=k,a[5]=e,a};l.translate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4];b=b[5];var n=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=g,a[3]=k,a[4]=c*n+g*d+e,a[5]=h*n+k*d+b,a};l.str=function(a){return'mat2d('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+ +')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};'undefined'!=typeof a&&(a.mat2d=l);var w={create:function(){var a=new g(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},fromMat4:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},clone:function(a){var b=new g(9);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]= a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},transpose:function(a,b){if(a===b){var d=b[1],c=b[2],h=b[5];a[1]=b[3];a[2]=b[6];a[3]=d;a[5]=b[7];a[6]=c;a[7]=h}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a},invert:function(a,b){var d= -b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7];b=b[8];var q=b*k-g*n,p=-b*f+g*l,m=n*f-k*l,t=d*q+c*p+h*m;return t?(t=1/t,a[0]=q*t,a[1]=(-b*c+h*n)*t,a[2]=(g*c-h*k)*t,a[3]=p*t,a[4]=(b*d-h*l)*t,a[5]=(-g*d+h*f)*t,a[6]=m*t,a[7]=(-n*d+c*l)*t,a[8]=(k*d-c*f)*t,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7];b=b[8];return a[0]=k*b-g*n,a[1]=h*n-c*b,a[2]=c*g-h*k,a[3]=g*l-f*b,a[4]=d*b-h*l,a[5]=h*f-d*g,a[6]=f*n-k*l,a[7]=c*l-d*n,a[8]=d*k-c*f,a},determinant:function(a){var b= -a[3],d=a[4],c=a[5],h=a[6],f=a[7],k=a[8];return a[0]*(k*d-c*f)+a[1]*(-k*b+c*h)+a[2]*(f*b-d*h)},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7];b=b[8];var q=d[0],m=d[1],t=d[2],v=d[3],u=d[4],w=d[5],y=d[6],x=d[7];d=d[8];return a[0]=q*c+m*k+t*n,a[1]=q*h+m*g+t*p,a[2]=q*f+m*l+t*b,a[3]=v*c+u*k+w*n,a[4]=v*h+u*g+w*p,a[5]=v*f+u*l+w*b,a[6]=y*c+x*k+d*n,a[7]=y*h+x*g+d*p,a[8]=y*f+x*l+d*b,a}};w.mul=w.multiply;w.translate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4], -l=b[5],n=b[6],p=b[7];b=b[8];var q=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=f,a[3]=k,a[4]=g,a[5]=l,a[6]=q*c+d*k+n,a[7]=q*h+d*g+p,a[8]=q*f+d*l+b,a};w.rotate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7];b=b[8];var q=Math.sin(d);d=Math.cos(d);return a[0]=d*c+q*k,a[1]=d*h+q*g,a[2]=d*f+q*l,a[3]=d*k-q*c,a[4]=d*g-q*h,a[5]=d*l-q*f,a[6]=n,a[7]=p,a[8]=b,a};w.scale=function(a,b,d){var c=d[0];d=d[1];return a[0]=c*b[0],a[1]=c*b[1],a[2]=c*b[2],a[3]=d*b[3],a[4]=d*b[4],a[5]=d*b[5],a[6]= -b[6],a[7]=b[7],a[8]=b[8],a};w.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a};w.fromQuat=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var f=d+d,k=c+c,g=h+h,d=d*f,l=c*f,c=c*k,n=h*f,p=h*k,h=h*g,f=b*f,k=b*k;b*=g;return a[0]=1-c-h,a[3]=l-b,a[6]=n+k,a[1]=l+b,a[4]=1-d-h,a[7]=p-f,a[2]=n-k,a[5]=p+f,a[8]=1-d-c,a};w.normalFromMat4=function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7],p=b[8],q=b[9],m=b[10],t=b[11],v=b[12], -u=b[13],w=b[14];b=b[15];var y=d*g-c*k,x=d*l-h*k,Z=d*n-f*k,S=c*l-h*g,L=c*n-f*g,U=h*n-f*l,oa=p*u-q*v,pa=p*w-m*v,p=p*b-t*v,R=q*w-m*u,q=q*b-t*u,m=m*b-t*w;return(t=y*m-x*q+Z*R+S*p-L*pa+U*oa)?(t=1/t,a[0]=(g*m-l*q+n*R)*t,a[1]=(l*p-k*m-n*pa)*t,a[2]=(k*q-g*p+n*oa)*t,a[3]=(h*q-c*m-f*R)*t,a[4]=(d*m-h*p+f*pa)*t,a[5]=(c*p-d*q-f*oa)*t,a[6]=(u*U-w*L+b*S)*t,a[7]=(w*Z-v*U-b*x)*t,a[8]=(v*L-u*Z+b*y)*t,a):null};w.str=function(a){return'mat3('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+', '+a[6]+', '+a[7]+ -', '+a[8]+')'};w.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};'undefined'!=typeof a&&(a.mat3=w);var y={create:function(){var a=new f(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},clone:function(a){var b=new f(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]= +b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7];b=b[8];var p=b*k-e*l,q=-b*g+e*n,m=l*g-k*n,t=d*p+c*q+h*m;return t?(t=1/t,a[0]=p*t,a[1]=(-b*c+h*l)*t,a[2]=(e*c-h*k)*t,a[3]=q*t,a[4]=(b*d-h*n)*t,a[5]=(-e*d+h*g)*t,a[6]=m*t,a[7]=(-l*d+c*n)*t,a[8]=(k*d-c*g)*t,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7];b=b[8];return a[0]=k*b-e*l,a[1]=h*l-c*b,a[2]=c*e-h*k,a[3]=e*n-g*b,a[4]=d*b-h*n,a[5]=h*g-d*e,a[6]=g*l-k*n,a[7]=c*n-d*l,a[8]=d*k-c*g,a},determinant:function(a){var b= +a[3],d=a[4],c=a[5],h=a[6],g=a[7],k=a[8];return a[0]*(k*d-c*g)+a[1]*(-k*b+c*h)+a[2]*(g*b-d*h)},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7];b=b[8];var q=d[0],m=d[1],t=d[2],v=d[3],u=d[4],w=d[5],y=d[6],x=d[7];d=d[8];return a[0]=q*c+m*k+t*l,a[1]=q*h+m*e+t*p,a[2]=q*g+m*n+t*b,a[3]=v*c+u*k+w*l,a[4]=v*h+u*e+w*p,a[5]=v*g+u*n+w*b,a[6]=y*c+x*k+d*l,a[7]=y*h+x*e+d*p,a[8]=y*g+x*n+d*b,a}};w.mul=w.multiply;w.translate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4], +n=b[5],l=b[6],p=b[7];b=b[8];var q=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=g,a[3]=k,a[4]=e,a[5]=n,a[6]=q*c+d*k+l,a[7]=q*h+d*e+p,a[8]=q*g+d*n+b,a};w.rotate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7];b=b[8];var q=Math.sin(d);d=Math.cos(d);return a[0]=d*c+q*k,a[1]=d*h+q*e,a[2]=d*g+q*n,a[3]=d*k-q*c,a[4]=d*e-q*h,a[5]=d*n-q*g,a[6]=l,a[7]=p,a[8]=b,a};w.scale=function(a,b,d){var c=d[0];d=d[1];return a[0]=c*b[0],a[1]=c*b[1],a[2]=c*b[2],a[3]=d*b[3],a[4]=d*b[4],a[5]=d*b[5],a[6]= +b[6],a[7]=b[7],a[8]=b[8],a};w.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a};w.fromQuat=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var g=d+d,k=c+c,e=h+h,d=d*g,n=c*g,c=c*k,l=h*g,p=h*k,h=h*e,g=b*g,k=b*k;b*=e;return a[0]=1-c-h,a[3]=n-b,a[6]=l+k,a[1]=n+b,a[4]=1-d-h,a[7]=p-g,a[2]=l-k,a[5]=p+g,a[8]=1-d-c,a};w.normalFromMat4=function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7],p=b[8],q=b[9],m=b[10],t=b[11],v=b[12], +u=b[13],w=b[14];b=b[15];var y=d*e-c*k,x=d*n-h*k,Z=d*l-g*k,S=c*n-h*e,L=c*l-g*e,U=h*l-g*n,oa=p*u-q*v,pa=p*w-m*v,p=p*b-t*v,R=q*w-m*u,q=q*b-t*u,m=m*b-t*w;return(t=y*m-x*q+Z*R+S*p-L*pa+U*oa)?(t=1/t,a[0]=(e*m-n*q+l*R)*t,a[1]=(n*p-k*m-l*pa)*t,a[2]=(k*q-e*p+l*oa)*t,a[3]=(h*q-c*m-g*R)*t,a[4]=(d*m-h*p+g*pa)*t,a[5]=(c*p-d*q-g*oa)*t,a[6]=(u*U-w*L+b*S)*t,a[7]=(w*Z-v*U-b*x)*t,a[8]=(v*L-u*Z+b*y)*t,a):null};w.str=function(a){return'mat3('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+', '+a[6]+', '+a[7]+ +', '+a[8]+')'};w.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};'undefined'!=typeof a&&(a.mat3=w);var y={create:function(){var a=new g(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},clone:function(a){var b=new g(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]= a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},transpose:function(a,b){if(a=== -b){var d=b[1],c=b[2],h=b[3],f=b[6],k=b[7],g=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=d;a[6]=b[9];a[7]=b[13];a[8]=c;a[9]=f;a[11]=b[14];a[12]=h;a[13]=k;a[14]=g}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];var y=d*g-c* -k,x=d*l-h*k,Z=d*n-f*k,S=c*l-h*g,L=c*n-f*g,U=h*n-f*l,oa=p*w-m*v,pa=p*u-q*v,R=p*b-t*v,Y=m*u-q*w,na=m*b-t*w,la=q*b-t*u,ca=y*la-x*na+Z*Y+S*R-L*pa+U*oa;return ca?(ca=1/ca,a[0]=(g*la-l*na+n*Y)*ca,a[1]=(h*na-c*la-f*Y)*ca,a[2]=(w*U-u*L+b*S)*ca,a[3]=(q*L-m*U-t*S)*ca,a[4]=(l*R-k*la-n*pa)*ca,a[5]=(d*la-h*R+f*pa)*ca,a[6]=(u*Z-v*U-b*x)*ca,a[7]=(p*U-q*Z+t*x)*ca,a[8]=(k*na-g*R+n*oa)*ca,a[9]=(c*R-d*na-f*oa)*ca,a[10]=(v*L-w*Z+b*y)*ca,a[11]=(m*Z-p*L-t*y)*ca,a[12]=(g*pa-k*Y-l*oa)*ca,a[13]=(d*Y-c*pa+h*oa)*ca,a[14]=(w* -x-v*S-u*y)*ca,a[15]=(p*S-m*x+q*y)*ca,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];return a[0]=g*(q*b-t*u)-m*(l*b-n*u)+w*(l*t-n*q),a[1]=-(c*(q*b-t*u)-m*(h*b-f*u)+w*(h*t-f*q)),a[2]=c*(l*b-n*u)-g*(h*b-f*u)+w*(h*n-f*l),a[3]=-(c*(l*t-n*q)-g*(h*t-f*q)+m*(h*n-f*l)),a[4]=-(k*(q*b-t*u)-p*(l*b-n*u)+v*(l*t-n*q)),a[5]=d*(q*b-t*u)-p*(h*b-f*u)+v*(h*t-f*q),a[6]=-(d*(l*b-n*u)-k*(h*b-f*u)+v*(h*n-f*l)),a[7]= -d*(l*t-n*q)-k*(h*t-f*q)+p*(h*n-f*l),a[8]=k*(m*b-t*w)-p*(g*b-n*w)+v*(g*t-n*m),a[9]=-(d*(m*b-t*w)-p*(c*b-f*w)+v*(c*t-f*m)),a[10]=d*(g*b-n*w)-k*(c*b-f*w)+v*(c*n-f*g),a[11]=-(d*(g*t-n*m)-k*(c*t-f*m)+p*(c*n-f*g)),a[12]=-(k*(m*u-q*w)-p*(g*u-l*w)+v*(g*q-l*m)),a[13]=d*(m*u-q*w)-p*(c*u-h*w)+v*(c*q-h*m),a[14]=-(d*(g*u-l*w)-k*(c*u-h*w)+v*(c*l-h*g)),a[15]=d*(g*q-l*m)-k*(c*q-h*m)+p*(c*l-h*g),a},determinant:function(a){var b=a[0],d=a[1],c=a[2],h=a[3],f=a[4],k=a[5],g=a[6],l=a[7],n=a[8],p=a[9],m=a[10],q=a[11],t= -a[12],v=a[13],w=a[14];a=a[15];return(b*k-d*f)*(m*a-q*w)-(b*g-c*f)*(p*a-q*v)+(b*l-h*f)*(p*w-m*v)+(d*g-c*k)*(n*a-q*t)-(d*l-h*k)*(n*w-m*t)+(c*l-h*g)*(n*v-p*t)},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],w=b[12],u=b[13],y=b[14];b=b[15];var x=d[0],A=d[1],S=d[2],L=d[3];return a[0]=x*c+A*g+S*m+L*w,a[1]=x*h+A*l+S*q+L*u,a[2]=x*f+A*n+S*t+L*y,a[3]=x*k+A*p+S*v+L*b,x=d[4],A=d[5],S=d[6],L=d[7],a[4]=x*c+A*g+S*m+L*w,a[5]=x*h+A*l+S*q+L*u,a[6]= -x*f+A*n+S*t+L*y,a[7]=x*k+A*p+S*v+L*b,x=d[8],A=d[9],S=d[10],L=d[11],a[8]=x*c+A*g+S*m+L*w,a[9]=x*h+A*l+S*q+L*u,a[10]=x*f+A*n+S*t+L*y,a[11]=x*k+A*p+S*v+L*b,x=d[12],A=d[13],S=d[14],L=d[15],a[12]=x*c+A*g+S*m+L*w,a[13]=x*h+A*l+S*q+L*u,a[14]=x*f+A*n+S*t+L*y,a[15]=x*k+A*p+S*v+L*b,a}};y.mul=y.multiply;y.translate=function(a,b,d){var c,h,f,k,g,l,n,p,m,q,t,v,w=d[0],u=d[1];d=d[2];return b===a?(a[12]=b[0]*w+b[4]*u+b[8]*d+b[12],a[13]=b[1]*w+b[5]*u+b[9]*d+b[13],a[14]=b[2]*w+b[6]*u+b[10]*d+b[14],a[15]=b[3]*w+b[7]* -u+b[11]*d+b[15]):(c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],a[0]=c,a[1]=h,a[2]=f,a[3]=k,a[4]=g,a[5]=l,a[6]=n,a[7]=p,a[8]=m,a[9]=q,a[10]=t,a[11]=v,a[12]=c*w+g*u+m*d+b[12],a[13]=h*w+l*u+q*d+b[13],a[14]=f*w+n*u+t*d+b[14],a[15]=k*w+p*u+v*d+b[15]),a};y.scale=function(a,b,d){var c=d[0],h=d[1];d=d[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*h,a[5]=b[5]*h,a[6]=b[6]*h,a[7]=b[7]*h,a[8]=b[8]*d,a[9]=b[9]*d,a[10]=b[10]*d,a[11]=b[11]*d,a[12]=b[12], -a[13]=b[13],a[14]=b[14],a[15]=b[15],a};y.rotate=function(a,d,c,h){var f,k,g,l,n,p,m,q,t,v,w,u,y,x,A,E,S,L,U,oa,pa,R,Y,na,la=h[0],ca=h[1];h=h[2];var Ba=Math.sqrt(la*la+ca*ca+h*h);return Math.abs(Ba)g?(d.cross(a,b,f),1E-6>d.length(a)&&d.cross(a,c,f),d.normalize(a,a),x.setAxisAngle(h,a,Math.PI),h):.999999f&&(f=-f,t=-t,q=-q,v=-v,d=-d),1E-6<1-f?(h=Math.acos(f),k=Math.sin(h),g=Math.sin((1-c)*h)/k,l=Math.sin(c*h)/k):(g=1-c,l=c),a[0]=g*n+l*t,a[1]=g*p+l*q,a[2]=g*m+l*v,a[3]=g*b+l*d,a};x.invert=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var f=d*d+c*c+h*h+b*b,f=f?1/f:0;return a[0]=-d*f,a[1]=-c*f,a[2]=-h*f,a[3]=b*f,a};x.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a};x.length=v.length;x.len=x.length;x.squaredLength=v.squaredLength;x.sqrLen=x.squaredLength;x.normalize= -v.normalize;x.fromMat3=function(a,b){var d;d=b[0]+b[4]+b[8];if(0b[0]&&(c=1);b[8]>b[3*c+c]&&(c=2);var h=(c+1)%3,f=(c+2)%3;d=Math.sqrt(b[3*c+c]-b[3*h+h]-b[3*f+f]+1);a[c]=.5*d;d=.5/d;a[3]=(b[3*f+h]-b[3*h+f])*d;a[h]=(b[3*h+c]+b[3*c+h])*d;a[f]=(b[3*f+c]+b[3*c+f])*d}return a};x.str=function(a){return'quat('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.quat=x)})(b)}(this)}, -{}],24:[function(a,g,m){(function(){var a=this,l=a._,f={},c=Array.prototype,k=Object.prototype,n=c.push,p=c.slice,t=c.concat,h=k.toString,d=k.hasOwnProperty,v=c.forEach,w=c.map,y=c.reduce,x=c.reduceRight,q=c.filter,u=c.every,A=c.some,E=c.indexOf,D=c.lastIndexOf,k=Array.isArray,C=Object.keys,F=Function.prototype.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};'undefined'!=typeof m?('undefined'!=typeof g&&g.exports&&(m=g.exports=z),m._=z):a._=z;z.VERSION= -'1.4.4';var H=z.each=z.forEach=function(a,b,d){if(null!=a)if(v&&a.forEach===v)a.forEach(b,d);else if(a.length===+a.length)for(var c=0,h=a.length;h>c&&b.call(d,a[c],c,a)!==f;c++);else for(c in a)if(z.has(a,c)&&b.call(d,a[c],c,a)===f)break};z.map=z.collect=function(a,b,d){var c=[];return null==a?c:w&&a.map===w?a.map(b,d):(H(a,function(a,h,f){c[c.length]=b.call(d,a,h,f)}),c)};z.reduce=z.foldl=z.inject=function(a,b,d,c){var h=2a.length)return Math.max.apply(Math,a);if(!b&&z.isEmpty(a))return-1/0;var c={computed:-1/0,value:-1/0};return H(a,function(a,h,f){h=b?b.call(d,a,h,f):a;h>=c.computed&&(c={value:a,computed:h})}),c.value};z.min=function(a,b,d){if(!b&&z.isArray(a)&&a[0]=== -+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&z.isEmpty(a))return 1/0;var c={computed:1/0,value:1/0};return H(a,function(a,h,f){h=b?b.call(d,a,h,f):a;hc||void 0===d)return 1;if(c>d||void 0===c)return-1}return a.indexh;){var k=h+f>>>1;d.call(c,a[k])c;c++)d[c]= +b){var d=b[1],c=b[2],h=b[3],g=b[6],k=b[7],e=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=d;a[6]=b[9];a[7]=b[13];a[8]=c;a[9]=g;a[11]=b[14];a[12]=h;a[13]=k;a[14]=e}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];var y=d*e-c* +k,x=d*n-h*k,Z=d*l-g*k,S=c*n-h*e,L=c*l-g*e,U=h*l-g*n,oa=p*w-m*v,pa=p*u-q*v,R=p*b-t*v,Y=m*u-q*w,na=m*b-t*w,la=q*b-t*u,ca=y*la-x*na+Z*Y+S*R-L*pa+U*oa;return ca?(ca=1/ca,a[0]=(e*la-n*na+l*Y)*ca,a[1]=(h*na-c*la-g*Y)*ca,a[2]=(w*U-u*L+b*S)*ca,a[3]=(q*L-m*U-t*S)*ca,a[4]=(n*R-k*la-l*pa)*ca,a[5]=(d*la-h*R+g*pa)*ca,a[6]=(u*Z-v*U-b*x)*ca,a[7]=(p*U-q*Z+t*x)*ca,a[8]=(k*na-e*R+l*oa)*ca,a[9]=(c*R-d*na-g*oa)*ca,a[10]=(v*L-w*Z+b*y)*ca,a[11]=(m*Z-p*L-t*y)*ca,a[12]=(e*pa-k*Y-n*oa)*ca,a[13]=(d*Y-c*pa+h*oa)*ca,a[14]=(w* +x-v*S-u*y)*ca,a[15]=(p*S-m*x+q*y)*ca,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];return a[0]=e*(q*b-t*u)-m*(n*b-l*u)+w*(n*t-l*q),a[1]=-(c*(q*b-t*u)-m*(h*b-g*u)+w*(h*t-g*q)),a[2]=c*(n*b-l*u)-e*(h*b-g*u)+w*(h*l-g*n),a[3]=-(c*(n*t-l*q)-e*(h*t-g*q)+m*(h*l-g*n)),a[4]=-(k*(q*b-t*u)-p*(n*b-l*u)+v*(n*t-l*q)),a[5]=d*(q*b-t*u)-p*(h*b-g*u)+v*(h*t-g*q),a[6]=-(d*(n*b-l*u)-k*(h*b-g*u)+v*(h*l-g*n)),a[7]= +d*(n*t-l*q)-k*(h*t-g*q)+p*(h*l-g*n),a[8]=k*(m*b-t*w)-p*(e*b-l*w)+v*(e*t-l*m),a[9]=-(d*(m*b-t*w)-p*(c*b-g*w)+v*(c*t-g*m)),a[10]=d*(e*b-l*w)-k*(c*b-g*w)+v*(c*l-g*e),a[11]=-(d*(e*t-l*m)-k*(c*t-g*m)+p*(c*l-g*e)),a[12]=-(k*(m*u-q*w)-p*(e*u-n*w)+v*(e*q-n*m)),a[13]=d*(m*u-q*w)-p*(c*u-h*w)+v*(c*q-h*m),a[14]=-(d*(e*u-n*w)-k*(c*u-h*w)+v*(c*n-h*e)),a[15]=d*(e*q-n*m)-k*(c*q-h*m)+p*(c*n-h*e),a},determinant:function(a){var b=a[0],d=a[1],c=a[2],h=a[3],g=a[4],k=a[5],e=a[6],n=a[7],l=a[8],p=a[9],m=a[10],q=a[11],t= +a[12],v=a[13],w=a[14];a=a[15];return(b*k-d*g)*(m*a-q*w)-(b*e-c*g)*(p*a-q*v)+(b*n-h*g)*(p*w-m*v)+(d*e-c*k)*(l*a-q*t)-(d*n-h*k)*(l*w-m*t)+(c*n-h*e)*(l*v-p*t)},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],w=b[12],u=b[13],y=b[14];b=b[15];var x=d[0],A=d[1],S=d[2],L=d[3];return a[0]=x*c+A*e+S*m+L*w,a[1]=x*h+A*n+S*q+L*u,a[2]=x*g+A*l+S*t+L*y,a[3]=x*k+A*p+S*v+L*b,x=d[4],A=d[5],S=d[6],L=d[7],a[4]=x*c+A*e+S*m+L*w,a[5]=x*h+A*n+S*q+L*u,a[6]= +x*g+A*l+S*t+L*y,a[7]=x*k+A*p+S*v+L*b,x=d[8],A=d[9],S=d[10],L=d[11],a[8]=x*c+A*e+S*m+L*w,a[9]=x*h+A*n+S*q+L*u,a[10]=x*g+A*l+S*t+L*y,a[11]=x*k+A*p+S*v+L*b,x=d[12],A=d[13],S=d[14],L=d[15],a[12]=x*c+A*e+S*m+L*w,a[13]=x*h+A*n+S*q+L*u,a[14]=x*g+A*l+S*t+L*y,a[15]=x*k+A*p+S*v+L*b,a}};y.mul=y.multiply;y.translate=function(a,b,d){var c,h,g,k,e,n,l,p,m,q,t,v,w=d[0],u=d[1];d=d[2];return b===a?(a[12]=b[0]*w+b[4]*u+b[8]*d+b[12],a[13]=b[1]*w+b[5]*u+b[9]*d+b[13],a[14]=b[2]*w+b[6]*u+b[10]*d+b[14],a[15]=b[3]*w+b[7]* +u+b[11]*d+b[15]):(c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],a[0]=c,a[1]=h,a[2]=g,a[3]=k,a[4]=e,a[5]=n,a[6]=l,a[7]=p,a[8]=m,a[9]=q,a[10]=t,a[11]=v,a[12]=c*w+e*u+m*d+b[12],a[13]=h*w+n*u+q*d+b[13],a[14]=g*w+l*u+t*d+b[14],a[15]=k*w+p*u+v*d+b[15]),a};y.scale=function(a,b,d){var c=d[0],h=d[1];d=d[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*h,a[5]=b[5]*h,a[6]=b[6]*h,a[7]=b[7]*h,a[8]=b[8]*d,a[9]=b[9]*d,a[10]=b[10]*d,a[11]=b[11]*d,a[12]=b[12], +a[13]=b[13],a[14]=b[14],a[15]=b[15],a};y.rotate=function(a,d,c,h){var g,k,e,n,l,p,m,q,t,v,w,u,y,x,A,E,S,L,U,oa,pa,R,Y,na,la=h[0],ca=h[1];h=h[2];var Ba=Math.sqrt(la*la+ca*ca+h*h);return Math.abs(Ba)e?(d.cross(a,b,g),1E-6>d.length(a)&&d.cross(a,c,g),d.normalize(a,a),x.setAxisAngle(h,a,Math.PI),h):.999999g&&(g=-g,t=-t,q=-q,v=-v,d=-d),1E-6<1-g?(h=Math.acos(g),k=Math.sin(h),e=Math.sin((1-c)*h)/k,n=Math.sin(c*h)/k):(e=1-c,n=c),a[0]=e*l+n*t,a[1]=e*p+n*q,a[2]=e*m+n*v,a[3]=e*b+n*d,a};x.invert=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var g=d*d+c*c+h*h+b*b,g=g?1/g:0;return a[0]=-d*g,a[1]=-c*g,a[2]=-h*g,a[3]=b*g,a};x.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a};x.length=v.length;x.len=x.length;x.squaredLength=v.squaredLength;x.sqrLen=x.squaredLength;x.normalize= +v.normalize;x.fromMat3=function(a,b){var d;d=b[0]+b[4]+b[8];if(0b[0]&&(c=1);b[8]>b[3*c+c]&&(c=2);var h=(c+1)%3,g=(c+2)%3;d=Math.sqrt(b[3*c+c]-b[3*h+h]-b[3*g+g]+1);a[c]=.5*d;d=.5/d;a[3]=(b[3*g+h]-b[3*h+g])*d;a[h]=(b[3*h+c]+b[3*c+h])*d;a[g]=(b[3*g+c]+b[3*c+g])*d}return a};x.str=function(a){return'quat('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.quat=x)})(b)}(this)}, +{}],24:[function(a,e,m){(function(){var a=this,l=a._,g={},c=Array.prototype,k=Object.prototype,n=c.push,p=c.slice,t=c.concat,h=k.toString,d=k.hasOwnProperty,v=c.forEach,w=c.map,y=c.reduce,x=c.reduceRight,q=c.filter,u=c.every,A=c.some,E=c.indexOf,D=c.lastIndexOf,k=Array.isArray,C=Object.keys,F=Function.prototype.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};'undefined'!=typeof m?('undefined'!=typeof e&&e.exports&&(m=e.exports=z),m._=z):a._=z;z.VERSION= +'1.4.4';var H=z.each=z.forEach=function(a,b,d){if(null!=a)if(v&&a.forEach===v)a.forEach(b,d);else if(a.length===+a.length)for(var c=0,h=a.length;h>c&&b.call(d,a[c],c,a)!==g;c++);else for(c in a)if(z.has(a,c)&&b.call(d,a[c],c,a)===g)break};z.map=z.collect=function(a,b,d){var c=[];return null==a?c:w&&a.map===w?a.map(b,d):(H(a,function(a,h,g){c[c.length]=b.call(d,a,h,g)}),c)};z.reduce=z.foldl=z.inject=function(a,b,d,c){var h=2a.length)return Math.max.apply(Math,a);if(!b&&z.isEmpty(a))return-1/0;var c={computed:-1/0,value:-1/0};return H(a,function(a,h,g){h=b?b.call(d,a,h,g):a;h>=c.computed&&(c={value:a,computed:h})}),c.value};z.min=function(a,b,d){if(!b&&z.isArray(a)&&a[0]=== ++a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&z.isEmpty(a))return 1/0;var c={computed:1/0,value:1/0};return H(a,function(a,h,g){h=b?b.call(d,a,h,g):a;hc||void 0===d)return 1;if(c>d||void 0===c)return-1}return a.indexh;){var k=h+g>>>1;d.call(c,a[k])c;c++)d[c]= z.pluck(a,''+c);return d};z.object=function(a,b){if(null==a)return{};for(var d={},c=0,h=a.length;h>c;c++)b?d[a[c]]=b[c]:d[a[c][0]]=a[c][1];return d};z.indexOf=function(a,b,d){if(null==a)return-1;var c=0,h=a.length;if(d){if('number'!=typeof d)return c=z.sortedIndex(a,b),a[c]===b?c:-1;c=0>d?Math.max(0,h+d):d}if(E&&a.indexOf===E)return a.indexOf(b,d);for(;h>c;c++)if(a[c]===b)return c;return-1};z.lastIndexOf=function(a,b,d){if(null==a)return-1;var c=null!=d;if(D&&a.lastIndexOf===D)return c?a.lastIndexOf(b, -d):a.lastIndexOf(b);for(d=c?d:a.length;d--;)if(a[d]===b)return d;return-1};z.range=function(a,b,d){1>=arguments.length&&(b=a||0,a=0);d=arguments[2]||1;for(var c=Math.max(Math.ceil((b-a)/d),0),h=0,f=Array(c);c>h;)f[h++]=a,a+=d;return f};z.bind=function(a,b){if(a.bind===F&&F)return F.apply(a,p.call(arguments,1));var d=p.call(arguments,2);return function(){return a.apply(b,d.concat(p.call(arguments)))}};z.partial=function(a){var b=p.call(arguments,1);return function(){return a.apply(this,b.concat(p.call(arguments)))}}; +d):a.lastIndexOf(b);for(d=c?d:a.length;d--;)if(a[d]===b)return d;return-1};z.range=function(a,b,d){1>=arguments.length&&(b=a||0,a=0);d=arguments[2]||1;for(var c=Math.max(Math.ceil((b-a)/d),0),h=0,g=Array(c);c>h;)g[h++]=a,a+=d;return g};z.bind=function(a,b){if(a.bind===F&&F)return F.apply(a,p.call(arguments,1));var d=p.call(arguments,2);return function(){return a.apply(b,d.concat(p.call(arguments)))}};z.partial=function(a){var b=p.call(arguments,1);return function(){return a.apply(this,b.concat(p.call(arguments)))}}; z.bindAll=function(a){var b=p.call(arguments,1);return 0===b.length&&(b=z.functions(a)),H(b,function(b){a[b]=z.bind(a[b],a)}),a};z.memoize=function(a,b){var d={};return b||(b=z.identity),function(){var c=b.apply(this,arguments);return z.has(d,c)?d[c]:d[c]=a.apply(this,arguments)}};z.delay=function(a,b){var d=p.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};z.defer=function(a){return z.delay.apply(z,[a,1].concat(p.call(arguments,1)))};z.throttle=function(a,b){var d,c,h, -f,k=0,g=function(){k=new Date;h=null;f=a.apply(d,c)};return function(){var l=new Date,n=b-(l-k);return d=this,c=arguments,0>=n?(clearTimeout(h),h=null,k=l,f=a.apply(d,c)):h||(h=setTimeout(g,n)),f}};z.debounce=function(a,b,d){var c,h;return function(){var f=this,k=arguments,g=d&&!c;return clearTimeout(c),c=setTimeout(function(){c=null;d||(h=a.apply(f,k))},b),g&&(h=a.apply(f,k)),h}};z.once=function(a){var b,d=!1;return function(){return d?b:(d=!0,b=a.apply(this,arguments),a=null,b)}};z.wrap=function(a, +g,k=0,e=function(){k=new Date;h=null;g=a.apply(d,c)};return function(){var n=new Date,l=b-(n-k);return d=this,c=arguments,0>=l?(clearTimeout(h),h=null,k=n,g=a.apply(d,c)):h||(h=setTimeout(e,l)),g}};z.debounce=function(a,b,d){var c,h;return function(){var g=this,k=arguments,e=d&&!c;return clearTimeout(c),c=setTimeout(function(){c=null;d||(h=a.apply(g,k))},b),e&&(h=a.apply(g,k)),h}};z.once=function(a){var b,d=!1;return function(){return d?b:(d=!0,b=a.apply(this,arguments),a=null,b)}};z.wrap=function(a, b){return function(){var d=[a];return n.apply(d,arguments),b.apply(this,d)}};z.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;0<=d;d--)b=[a[d].apply(this,b)];return b[0]}};z.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}};z.keys=C||function(a){if(a!==Object(a))throw new TypeError('Invalid object');var b=[],d;for(d in a)z.has(a,d)&&(b[b.length]=d);return b};z.values=function(a){var b=[],d;for(d in a)z.has(a,d)&&b.push(a[d]); return b};z.pairs=function(a){var b=[],d;for(d in a)z.has(a,d)&&b.push([d,a[d]]);return b};z.invert=function(a){var b={},d;for(d in a)z.has(a,d)&&(b[a[d]]=d);return b};z.functions=z.methods=function(a){var b=[],d;for(d in a)z.isFunction(a[d])&&b.push(d);return b.sort()};z.extend=function(a){return H(p.call(arguments,1),function(b){if(b)for(var d in b)a[d]=b[d]}),a};z.pick=function(a){var b={},d=t.apply(c,p.call(arguments,1));return H(d,function(d){d in a&&(b[d]=a[d])}),b};z.omit=function(a){var b= -{},d=t.apply(c,p.call(arguments,1)),h;for(h in a)z.contains(d,h)||(b[h]=a[h]);return b};z.defaults=function(a){return H(p.call(arguments,1),function(b){if(b)for(var d in b)null==a[d]&&(a[d]=b[d])}),a};z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a};z.tap=function(a,b){return b(a),a};var P=function(a,b,d,c){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped);b instanceof z&&(b=b._wrapped);var f=h.call(a);if(f!=h.call(b))return!1; -switch(f){case '[object String]':return a==String(b);case '[object Number]':return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case '[object Date]':case '[object Boolean]':return+a==+b;case '[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if('object'!=typeof a||'object'!=typeof b)return!1;for(var k=d.length;k--;)if(d[k]==a)return c[k]==b;d.push(a);c.push(b);var k=0,g=!0;if('[object Array]'==f){if(k=a.length,g=k==b.length)for(;k--&&(g=P(a[k], -b[k],d,c)););}else{var f=a.constructor,l=b.constructor;if(f!==l&&!(z.isFunction(f)&&f instanceof f&&z.isFunction(l)&&l instanceof l))return!1;for(var n in a)if(z.has(a,n)&&(k++,!(g=z.has(b,n)&&P(a[n],b[n],d,c))))break;if(g){for(n in b)if(z.has(b,n)&&!k--)break;g=!k}}return d.pop(),c.pop(),g};z.isEqual=function(a,b){return P(a,b,[],[])};z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0};z.isElement=function(a){return!(!a|| +{},d=t.apply(c,p.call(arguments,1)),h;for(h in a)z.contains(d,h)||(b[h]=a[h]);return b};z.defaults=function(a){return H(p.call(arguments,1),function(b){if(b)for(var d in b)null==a[d]&&(a[d]=b[d])}),a};z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a};z.tap=function(a,b){return b(a),a};var P=function(a,b,d,c){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped);b instanceof z&&(b=b._wrapped);var g=h.call(a);if(g!=h.call(b))return!1; +switch(g){case '[object String]':return a==String(b);case '[object Number]':return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case '[object Date]':case '[object Boolean]':return+a==+b;case '[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if('object'!=typeof a||'object'!=typeof b)return!1;for(var k=d.length;k--;)if(d[k]==a)return c[k]==b;d.push(a);c.push(b);var k=0,e=!0;if('[object Array]'==g){if(k=a.length,e=k==b.length)for(;k--&&(e=P(a[k], +b[k],d,c)););}else{var g=a.constructor,n=b.constructor;if(g!==n&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(n)&&n instanceof n))return!1;for(var l in a)if(z.has(a,l)&&(k++,!(e=z.has(b,l)&&P(a[l],b[l],d,c))))break;if(e){for(l in b)if(z.has(b,l)&&!k--)break;e=!k}}return d.pop(),c.pop(),e};z.isEqual=function(a,b){return P(a,b,[],[])};z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0};z.isElement=function(a){return!(!a|| 1!==a.nodeType)};z.isArray=k||function(a){return'[object Array]'==h.call(a)};z.isObject=function(a){return a===Object(a)};H('Arguments Function String Number Date RegExp'.split(' '),function(a){z['is'+a]=function(b){return h.call(b)=='[object '+a+']'}});z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,'callee'))});'function'!=typeof/./&&(z.isFunction=function(a){return'function'==typeof a});z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))};z.isNaN=function(a){return z.isNumber(a)&& a!=+a};z.isBoolean=function(a){return!0===a||!1===a||'[object Boolean]'==h.call(a)};z.isNull=function(a){return null===a};z.isUndefined=function(a){return void 0===a};z.has=function(a,b){return d.call(a,b)};z.noConflict=function(){return a._=l,this};z.identity=function(a){return a};z.times=function(a,b,d){for(var c=Array(a),h=0;a>h;h++)c[h]=b.call(d,h);return c};z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var N={escape:{'&':'&','<':'<','>':'>','"':'"', "'":''','/':'/'}};N.unescape=z.invert(N.escape);var V={escape:new RegExp('['+z.keys(N.escape).join('')+']','g'),unescape:new RegExp('('+z.keys(N.unescape).join('|')+')','g')};z.each(['escape','unescape'],function(a){z[a]=function(b){return null==b?'':(''+b).replace(V[a],function(b){return N[a][b]})}});z.result=function(a,b){if(null==a)return null;b=a[b];return z.isFunction(b)?b.call(a):b};z.mixin=function(a){H(z.functions(a),function(b){var d=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped]; return n.apply(a,arguments),S.call(this,d.apply(z,a))}})};var X=0;z.uniqueId=function(a){var b=++X+'';return a?a+b:b};z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,fa={"'":"'",'\\':'\\','\r':'r','\n':'n','\t':'t','\u2028':'u2028','\u2029':'u2029'},Z=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,d){var c;d=z.defaults({},d,z.templateSettings);var h=new RegExp([(d.escape||T).source,(d.interpolate||T).source,(d.evaluate|| -T).source].join('|')+'|$','g'),f=0,k="__p+='";a.replace(h,function(b,d,c,h,g){return k+=a.slice(f,g).replace(Z,function(a){return'\\'+fa[a]}),d&&(k+="'+\n((__t=("+d+"))==null?'':_.escape(__t))+\n'"),c&&(k+="'+\n((__t=("+c+"))==null?'':__t)+\n'"),h&&(k+="';\n"+h+"\n__p+='"),f=g+b.length,b});k+="';\n";d.variable||(k='with(obj||{}){\n'+k+'}\n');k="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+k+'return __p;\n';try{c=new Function(d.variable||'obj','_',k)}catch(la){throw la.source= +T).source].join('|')+'|$','g'),g=0,k="__p+='";a.replace(h,function(b,d,c,h,e){return k+=a.slice(g,e).replace(Z,function(a){return'\\'+fa[a]}),d&&(k+="'+\n((__t=("+d+"))==null?'':_.escape(__t))+\n'"),c&&(k+="'+\n((__t=("+c+"))==null?'':__t)+\n'"),h&&(k+="';\n"+h+"\n__p+='"),g=e+b.length,b});k+="';\n";d.variable||(k='with(obj||{}){\n'+k+'}\n');k="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+k+'return __p;\n';try{c=new Function(d.variable||'obj','_',k)}catch(la){throw la.source= k,la;}if(b)return c(b,z);b=function(a){return c.call(this,a,z)};return b.source='function('+(d.variable||'obj')+'){\n'+k+'}',b};z.chain=function(a){return z(a).chain()};var S=function(a){return this._chain?z(a).chain():a};z.mixin(z);H('pop push reverse shift sort splice unshift'.split(' '),function(a){var b=c[a];z.prototype[a]=function(){var d=this._wrapped;return b.apply(d,arguments),'shift'!=a&&'splice'!=a||0!==d.length||delete d[0],S.call(this,d)}});H(['concat','join','slice'],function(a){var b= c[a];z.prototype[a]=function(){return S.call(this,b.apply(this._wrapped,arguments))}});z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],25:[function(a){'undefined'!=typeof window&&'function'!=typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,1E3/60)}); Leap=a('../lib/index')},{'../lib/index':11}]},{},[25]); -var Stats=function(){function a(a){b.appendChild(a.dom);return a}function g(a){for(var c=0;cf+1E3&&(k.update(1E3*c/(a-f),100),f=a,c=0,p)){var b=performance.memory;p.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return a},update:function(){l=this.end()},domElement:b,setMode:g}}; -Stats.Panel=function(a,g,m){var b=Infinity,l=0,f=Math.round,c=f(window.devicePixelRatio||1),k=80*c,n=48*c,p=3*c,t=2*c,h=3*c,d=15*c,v=74*c,w=30*c,y=document.createElement('canvas');y.width=k;y.height=n;y.style.cssText='width:80px;height:48px';var x=y.getContext('2d');x.font='bold '+9*c+'px Helvetica,Arial,sans-serif';x.textBaseline='top';x.fillStyle=m;x.fillRect(0,0,k,n);x.fillStyle=g;x.fillText(a,p,t);x.fillRect(h,d,v,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h,d,v,w);return{dom:y,update:function(n, -u){b=Math.min(b,n);l=Math.max(l,n);x.fillStyle=m;x.globalAlpha=1;x.fillRect(0,0,k,d);x.fillStyle=g;x.fillText(f(n)+' '+a+' ('+f(b)+'-'+f(l)+')',p,t);x.drawImage(y,h+c,d,v-c,w,h,d,v-c,w);x.fillRect(h+v-c,d,c,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h+v-c,d,c,f((1-n/u)*w))}}};'object'===typeof module&&(module.exports=Stats);var SPE={distributions:{BOX:1,SPHERE:2,DISC:3},valueOverLifetimeLength:4}; -'function'==typeof define&&define.amd?define('spe',SPE):'undefined'!=typeof exports&&'undefined'!=typeof module&&(module.exports=SPE);SPE.TypedArrayHelper=function(a,g,m,b){this.componentSize=m||1;this.size=g||1;this.TypedArrayConstructor=a||Float32Array;this.array=new a(g*this.componentSize);this.indexOffset=b||0};SPE.TypedArrayHelper.constructor=SPE.TypedArrayHelper; -SPE.TypedArrayHelper.prototype.setSize=function(a,g){var m=this.array.length;return g||(a*=this.componentSize),m>a?this.shrink(a):a>m?this.grow(a):void console.info('TypedArray is already of size:',a+'.','Will not resize.')};SPE.TypedArrayHelper.prototype.shrink=function(a){return this.array=this.array.subarray(0,a),this.size=a,this};SPE.TypedArrayHelper.prototype.grow=function(a){var g=this.array,m=new this.TypedArrayConstructor(a);return m.set(g),this.array=m,this.size=a,this}; -SPE.TypedArrayHelper.prototype.splice=function(a,g){a*=this.componentSize;g*=this.componentSize;for(var m=[],b=this.array,l=b.length,f=0;l>f;++f)(a>f||f>=g)&&m.push(b[f]);return this.setFromArray(0,m),this};SPE.TypedArrayHelper.prototype.setFromArray=function(a,g){var m=a+g.length;return m>this.array.length?this.grow(m):mg+1E3&&(k.update(1E3*c/(a-g),100),g=a,c=0,p)){var b=performance.memory;p.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return a},update:function(){l=this.end()},domElement:b,setMode:e}}; +Stats.Panel=function(a,e,m){var b=Infinity,l=0,g=Math.round,c=g(window.devicePixelRatio||1),k=80*c,n=48*c,p=3*c,t=2*c,h=3*c,d=15*c,v=74*c,w=30*c,y=document.createElement('canvas');y.width=k;y.height=n;y.style.cssText='width:80px;height:48px';var x=y.getContext('2d');x.font='bold '+9*c+'px Helvetica,Arial,sans-serif';x.textBaseline='top';x.fillStyle=m;x.fillRect(0,0,k,n);x.fillStyle=e;x.fillText(a,p,t);x.fillRect(h,d,v,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h,d,v,w);return{dom:y,update:function(n, +u){b=Math.min(b,n);l=Math.max(l,n);x.fillStyle=m;x.globalAlpha=1;x.fillRect(0,0,k,d);x.fillStyle=e;x.fillText(g(n)+' '+a+' ('+g(b)+'-'+g(l)+')',p,t);x.drawImage(y,h+c,d,v-c,w,h,d,v-c,w);x.fillRect(h+v-c,d,c,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h+v-c,d,c,g((1-n/u)*w))}}};'object'===typeof module&&(module.exports=Stats);var SPE={distributions:{BOX:1,SPHERE:2,DISC:3},valueOverLifetimeLength:4}; +'function'==typeof define&&define.amd?define('spe',SPE):'undefined'!=typeof exports&&'undefined'!=typeof module&&(module.exports=SPE);SPE.TypedArrayHelper=function(a,e,m,b){this.componentSize=m||1;this.size=e||1;this.TypedArrayConstructor=a||Float32Array;this.array=new a(e*this.componentSize);this.indexOffset=b||0};SPE.TypedArrayHelper.constructor=SPE.TypedArrayHelper; +SPE.TypedArrayHelper.prototype.setSize=function(a,e){var m=this.array.length;return e||(a*=this.componentSize),m>a?this.shrink(a):a>m?this.grow(a):void console.info('TypedArray is already of size:',a+'.','Will not resize.')};SPE.TypedArrayHelper.prototype.shrink=function(a){return this.array=this.array.subarray(0,a),this.size=a,this};SPE.TypedArrayHelper.prototype.grow=function(a){var e=this.array,m=new this.TypedArrayConstructor(a);return m.set(e),this.array=m,this.size=a,this}; +SPE.TypedArrayHelper.prototype.splice=function(a,e){a*=this.componentSize;e*=this.componentSize;for(var m=[],b=this.array,l=b.length,g=0;l>g;++g)(a>g||g>=e)&&m.push(b[g]);return this.setFromArray(0,m),this};SPE.TypedArrayHelper.prototype.setFromArray=function(a,e){var m=a+e.length;return m>this.array.length?this.grow(m):mf;++f){var c=f*l,k=Math.floor(c);b[f]=this.lerpTypeAgnostic(a[k],a[Math.ceil(c)],c-k)}return b.push('function'==typeof a[m-1].clone?a[m-1].clone():a[m-1]),b},clamp:function(a,g,m){return Math.max(g,Math.min(a,m))},zeroToEpsilon:function(a,g){var m=a;return m=g?1E-4*Math.random():1E-5,0>a&&-1E-5a?-(Math.abs(a)-m):a+g-m)},arrayValuesAreEqual:function(a){for(var g=0;gk;++k){var n=l[k];a.copy(b[k]);a.r+=Math.random()*n.x-.5*n.x;a.g+=Math.random()*n.y-.5*n.y;a.b+=Math.random()*n.z-.5*n.z;a.r=this.clamp(a.r,0,1);a.g=this.clamp(a.g,0,1);a.b=this.clamp(a.b,0,1);c.push(a.getHex())}g.typedArray.setVec4Components(m,c[0],c[1],c[2],c[3])}}(),randomVector3OnSphere:function(a,g,m,b,l,f,c,k){k=2*Math.random()-1;var n=6.2832*Math.random(),p=Math.sqrt(1-k*k);b=this.randomFloat(b,l);c&&(b=Math.round(b/c)*c);c=p*Math.cos(n)* -b;n=p*Math.sin(n)*b;c*=f.x;n*=f.y;f=k*b*f.z;c+=m.x;n+=m.y;f+=m.z;a.typedArray.setVec3Components(g,c,n,f)},seededRandom:function(a){a=1E4*Math.sin(a);return a-(0|a)},randomVector3OnDisc:function(a,g,m,b,l,f,c){var k=6.2832*Math.random();b=Math.abs(this.randomFloat(b,l));c&&(b=Math.round(b/c)*c);c=Math.cos(k)*b;k=Math.sin(k)*b;c*=f.x;k*=f.y;c+=m.x;k+=m.y;m=0+m.z;a.typedArray.setVec3Components(g,c,k,m)},randomDirectionVector3OnSphere:function(){var a=new THREE.Vector3;return function(g,m,b,l,f,c,k,n){a.copy(c); -a.x-=b;a.y-=l;a.z-=f;a.normalize().multiplyScalar(-this.randomFloat(k,n));g.typedArray.setVec3Components(m,a.x,a.y,a.z)}}(),randomDirectionVector3OnDisc:function(){var a=new THREE.Vector3;return function(g,m,b,l,f,c,k,n){a.copy(c);a.x-=b;a.y-=l;a.z-=f;a.normalize().multiplyScalar(-this.randomFloat(k,n));g.typedArray.setVec3Components(m,a.x,a.y,0)}}(),getPackedRotationAxis:function(){var a=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Color,b=new THREE.Vector3(1,1,1);return function(l,f){return a.copy(l).normalize(), -g.copy(f).normalize(),a.x+=.5*-f.x+Math.random()*f.x,a.y+=.5*-f.y+Math.random()*f.y,a.z+=.5*-f.z+Math.random()*f.z,a.normalize().add(b).multiplyScalar(.5),m.setRGB(a.x,a.y,a.z),m.getHex()}}()}; -SPE.Group=function(a){var g=SPE.utils,m=g.types;a=g.ensureTypedArg(a,m.OBJECT,{});a.texture=g.ensureTypedArg(a.texture,m.OBJECT,{});this.uuid=THREE.Math.generateUUID();this.fixedTimeStep=g.ensureTypedArg(a.fixedTimeStep,m.NUMBER,.016);this.texture=g.ensureInstanceOf(a.texture.value,THREE.Texture,null);this.textureFrames=g.ensureInstanceOf(a.texture.frames,THREE.Vector2,new THREE.Vector2(1,1));this.textureFrameCount=g.ensureTypedArg(a.texture.frameCount,m.NUMBER,this.textureFrames.x*this.textureFrames.y); -this.textureLoop=g.ensureTypedArg(a.texture.loop,m.NUMBER,1);this.textureFrames.max(new THREE.Vector2(1,1));this.hasPerspective=g.ensureTypedArg(a.hasPerspective,m.BOOLEAN,!0);this.colorize=g.ensureTypedArg(a.colorize,m.BOOLEAN,!0);this.maxParticleCount=g.ensureTypedArg(a.maxParticleCount,m.NUMBER,null);this.blending=g.ensureTypedArg(a.blending,m.NUMBER,THREE.AdditiveBlending);this.transparent=g.ensureTypedArg(a.transparent,m.BOOLEAN,!0);this.alphaTest=parseFloat(g.ensureTypedArg(a.alphaTest,m.NUMBER, -0));this.depthWrite=g.ensureTypedArg(a.depthWrite,m.BOOLEAN,!1);this.depthTest=g.ensureTypedArg(a.depthTest,m.BOOLEAN,!0);this.fog=g.ensureTypedArg(a.fog,m.BOOLEAN,!0);this.scale=g.ensureTypedArg(a.scale,m.NUMBER,300);this.emitters=[];this.emitterIDs=[];this._pool=[];this._poolCreationSettings=null;this._createNewWhenPoolEmpty=0;this._attributesNeedDynamicReset=this._attributesNeedRefresh=!1;this.particleCount=0;this.uniforms={texture:{type:'t',value:this.texture},textureAnimation:{type:'v4',value:new THREE.Vector4(this.textureFrames.x, +SPE.utils={types:{BOOLEAN:'boolean',STRING:'string',NUMBER:'number',OBJECT:'object'},ensureTypedArg:function(a,e,m){return typeof a===e?a:m},ensureArrayTypedArg:function(a,e,m){if(Array.isArray(a)){for(var b=a.length-1;0<=b;--b)if(typeof a[b]!==e)return m;return a}return this.ensureTypedArg(a,e,m)},ensureInstanceOf:function(a,e,m){return void 0!==e&&a instanceof e?a:m},ensureArrayInstanceOf:function(a,e,m){if(Array.isArray(a)){for(var b=a.length-1;0<=b;--b)if(void 0!==e&&0==a[b]instanceof e)return m; +return a}return this.ensureInstanceOf(a,e,m)},ensureValueOverLifetimeCompliance:function(a,e,m){e=e||3;m=m||3;!1===Array.isArray(a._value)&&(a._value=[a._value]);!1===Array.isArray(a._spread)&&(a._spread=[a._spread]);var b=this.clamp(a._value.length,e,m);e=this.clamp(a._spread.length,e,m);b=Math.max(b,e);a._value.length!==b&&(a._value=this.interpolateArray(a._value,b));a._spread.length!==b&&(a._spread=this.interpolateArray(a._spread,b))},interpolateArray:function(a,e){for(var m=a.length,b=['function'== +typeof a[0].clone?a[0].clone():a[0]],l=(m-1)/(e-1),g=1;e-1>g;++g){var c=g*l,k=Math.floor(c);b[g]=this.lerpTypeAgnostic(a[k],a[Math.ceil(c)],c-k)}return b.push('function'==typeof a[m-1].clone?a[m-1].clone():a[m-1]),b},clamp:function(a,e,m){return Math.max(e,Math.min(a,m))},zeroToEpsilon:function(a,e){var m=a;return m=e?1E-4*Math.random():1E-5,0>a&&-1E-5a?-(Math.abs(a)-m):a+e-m)},arrayValuesAreEqual:function(a){for(var e=0;ek;++k){var n=l[k];a.copy(b[k]);a.r+=Math.random()*n.x-.5*n.x;a.g+=Math.random()*n.y-.5*n.y;a.b+=Math.random()*n.z-.5*n.z;a.r=this.clamp(a.r,0,1);a.g=this.clamp(a.g,0,1);a.b=this.clamp(a.b,0,1);c.push(a.getHex())}e.typedArray.setVec4Components(m,c[0],c[1],c[2],c[3])}}(),randomVector3OnSphere:function(a,e,m,b,l,g,c,k){k=2*Math.random()-1;var n=6.2832*Math.random(),p=Math.sqrt(1-k*k);b=this.randomFloat(b,l);c&&(b=Math.round(b/c)*c);c=p*Math.cos(n)* +b;n=p*Math.sin(n)*b;c*=g.x;n*=g.y;g=k*b*g.z;c+=m.x;n+=m.y;g+=m.z;a.typedArray.setVec3Components(e,c,n,g)},seededRandom:function(a){a=1E4*Math.sin(a);return a-(0|a)},randomVector3OnDisc:function(a,e,m,b,l,g,c){var k=6.2832*Math.random();b=Math.abs(this.randomFloat(b,l));c&&(b=Math.round(b/c)*c);c=Math.cos(k)*b;k=Math.sin(k)*b;c*=g.x;k*=g.y;c+=m.x;k+=m.y;m=0+m.z;a.typedArray.setVec3Components(e,c,k,m)},randomDirectionVector3OnSphere:function(){var a=new THREE.Vector3;return function(e,m,b,l,g,c,k,n){a.copy(c); +a.x-=b;a.y-=l;a.z-=g;a.normalize().multiplyScalar(-this.randomFloat(k,n));e.typedArray.setVec3Components(m,a.x,a.y,a.z)}}(),randomDirectionVector3OnDisc:function(){var a=new THREE.Vector3;return function(e,m,b,l,g,c,k,n){a.copy(c);a.x-=b;a.y-=l;a.z-=g;a.normalize().multiplyScalar(-this.randomFloat(k,n));e.typedArray.setVec3Components(m,a.x,a.y,0)}}(),getPackedRotationAxis:function(){var a=new THREE.Vector3,e=new THREE.Vector3,m=new THREE.Color,b=new THREE.Vector3(1,1,1);return function(l,g){return a.copy(l).normalize(), +e.copy(g).normalize(),a.x+=.5*-g.x+Math.random()*g.x,a.y+=.5*-g.y+Math.random()*g.y,a.z+=.5*-g.z+Math.random()*g.z,a.normalize().add(b).multiplyScalar(.5),m.setRGB(a.x,a.y,a.z),m.getHex()}}()}; +SPE.Group=function(a){var e=SPE.utils,m=e.types;a=e.ensureTypedArg(a,m.OBJECT,{});a.texture=e.ensureTypedArg(a.texture,m.OBJECT,{});this.uuid=THREE.Math.generateUUID();this.fixedTimeStep=e.ensureTypedArg(a.fixedTimeStep,m.NUMBER,.016);this.texture=e.ensureInstanceOf(a.texture.value,THREE.Texture,null);this.textureFrames=e.ensureInstanceOf(a.texture.frames,THREE.Vector2,new THREE.Vector2(1,1));this.textureFrameCount=e.ensureTypedArg(a.texture.frameCount,m.NUMBER,this.textureFrames.x*this.textureFrames.y); +this.textureLoop=e.ensureTypedArg(a.texture.loop,m.NUMBER,1);this.textureFrames.max(new THREE.Vector2(1,1));this.hasPerspective=e.ensureTypedArg(a.hasPerspective,m.BOOLEAN,!0);this.colorize=e.ensureTypedArg(a.colorize,m.BOOLEAN,!0);this.maxParticleCount=e.ensureTypedArg(a.maxParticleCount,m.NUMBER,null);this.blending=e.ensureTypedArg(a.blending,m.NUMBER,THREE.AdditiveBlending);this.transparent=e.ensureTypedArg(a.transparent,m.BOOLEAN,!0);this.alphaTest=parseFloat(e.ensureTypedArg(a.alphaTest,m.NUMBER, +0));this.depthWrite=e.ensureTypedArg(a.depthWrite,m.BOOLEAN,!1);this.depthTest=e.ensureTypedArg(a.depthTest,m.BOOLEAN,!0);this.fog=e.ensureTypedArg(a.fog,m.BOOLEAN,!0);this.scale=e.ensureTypedArg(a.scale,m.NUMBER,300);this.emitters=[];this.emitterIDs=[];this._pool=[];this._poolCreationSettings=null;this._createNewWhenPoolEmpty=0;this._attributesNeedDynamicReset=this._attributesNeedRefresh=!1;this.particleCount=0;this.uniforms={texture:{type:'t',value:this.texture},textureAnimation:{type:'v4',value:new THREE.Vector4(this.textureFrames.x, this.textureFrames.y,this.textureFrameCount,Math.max(Math.abs(this.textureLoop),1))},fogColor:{type:'c',value:null},fogNear:{type:'f',value:10},fogFar:{type:'f',value:200},fogDensity:{type:'f',value:.5},deltaTime:{type:'f',value:0},runTime:{type:'f',value:0},scale:{type:'f',value:this.scale}};this.defines={HAS_PERSPECTIVE:this.hasPerspective,COLORIZE:this.colorize,VALUE_OVER_LIFETIME_LENGTH:SPE.valueOverLifetimeLength,SHOULD_ROTATE_TEXTURE:!1,SHOULD_ROTATE_PARTICLES:!1,SHOULD_WIGGLE_PARTICLES:!1, SHOULD_CALCULATE_SPRITE:1this.maxParticleCount&&console.warn('SPE.Group: maxParticleCount exceeded. Requesting',this.particleCount,'particles, can support only',this.maxParticleCount);a._calculatePPSValue(a.maxAge._value+a.maxAge._spread);a._setBufferUpdateRanges(this.attributeKeys);a._setAttributeOffset(m);a.group=this;a.attributes=this.attributes;for(var l in g)g.hasOwnProperty(l)&&g[l]._createBufferAttribute(null!==this.maxParticleCount?this.maxParticleCount:this.particleCount); -for(g=m;b>g;++g)a._assignPositionValue(g),a._assignForceValue(g,'velocity'),a._assignForceValue(g,'acceleration'),a._assignAbsLifetimeValue(g,'opacity'),a._assignAbsLifetimeValue(g,'size'),a._assignAngleValue(g),a._assignRotationValue(g),a._assignParamsValue(g),a._assignColorValue(g);return this._applyAttributesToGeometry(),this.emitters.push(a),this.emitterIDs.push(a.uuid),this._updateDefines(a),this.material.needsUpdate=!0,this.geometry.needsUpdate=!0,this._attributesNeedRefresh=!0,this}; -SPE.Group.prototype.removeEmitter=function(a){var g=this.emitterIDs.indexOf(a.uuid);if(0==a instanceof SPE.Emitter)return void console.error('`emitter` argument must be instance of SPE.Emitter. Was provided with:',a);if(-1===g)return void console.error('Emitter does not exist in this group. Will not remove.');for(var m=a.attributeOffset,b=m+a.particleCount,l=this.attributes.params.typedArray,f=m;b>f;++f)l.array[4*f]=0,l.array[4*f+1]=0;this.emitters.splice(g,1);this.emitterIDs.splice(g,1);for(var c in this.attributes)this.attributes.hasOwnProperty(c)&& -this.attributes[c].splice(m,b);this.particleCount-=a.particleCount;a._onRemove();this._attributesNeedRefresh=!0};SPE.Group.prototype.getFromPool=function(){var a=this._pool,g=this._createNewWhenPoolEmpty;return a.length?a.pop():g?(a=new SPE.Emitter(this._poolCreationSettings),this.addEmitter(a),a):null};SPE.Group.prototype.releaseIntoPool=function(a){return 0==a instanceof SPE.Emitter?void console.error('Argument is not instanceof SPE.Emitter:',a):(a.reset(),this._pool.unshift(a),this)}; -SPE.Group.prototype.getPool=function(){return this._pool};SPE.Group.prototype.addPool=function(a,g,m){this._poolCreationSettings=g;this._createNewWhenPoolEmpty=!!m;for(var b=0;a>b;++b)m=Array.isArray(g)?new SPE.Emitter(g[b]):new SPE.Emitter(g),this.addEmitter(m),this.releaseIntoPool(m);return this}; -SPE.Group.prototype._triggerSingleEmitter=function(a){var g=this.getFromPool(),m=this;return null===g?void console.log('SPE.Group pool ran out.'):(a instanceof THREE.Vector3&&(g.position.value.copy(a),g.position.value=g.position.value),g.enable(),setTimeout(function(){g.disable();m.releaseIntoPool(g)},1E3*Math.max(g.duration,g.maxAge.value+g.maxAge.spread)),this)}; -SPE.Group.prototype.triggerPoolEmitter=function(a,g){if('number'==typeof a&&1m;++m)this._triggerSingleEmitter(g);else this._triggerSingleEmitter(g);return this};SPE.Group.prototype._updateUniforms=function(a){this.uniforms.runTime.value+=a;this.uniforms.deltaTime.value=a};SPE.Group.prototype._resetBufferRanges=function(){var a=this.attributeKeys,g=this.attributeCount-1,m=this.attributes;for(g;0<=g;--g)m[a[g]].resetUpdateRange()}; -SPE.Group.prototype._updateBuffers=function(a){var g,m=this.attributeKeys,b=this.attributeCount-1,l=this.attributes,f=a.bufferUpdateRanges;for(b;0<=b;--b)g=m[b],a=f[g],g=l[g],g.setUpdateRange(a.min,a.max),g.flagUpdate()}; -SPE.Group.prototype.tick=function(a){var g=this.emitters,m=g.length,b=a||this.fixedTimeStep,l=this.attributeKeys,f=this.attributes;if(this._updateUniforms(b),this._resetBufferRanges(),0!==m||!1!==this._attributesNeedRefresh||!1!==this._attributesNeedDynamicReset){var c;for(a=0;m>a;++a)c=g[a],c.tick(b),this._updateBuffers(c);if(!0===this._attributesNeedDynamicReset){for(a=this.attributeCount-1;0<=a;--a)f[l[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(!0===this._attributesNeedRefresh){for(a= -this.attributeCount-1;0<=a;--a)f[l[a]].forceUpdateAll();this._attributesNeedRefresh=!1;this._attributesNeedDynamicReset=!0}}};SPE.Group.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this}; -SPE.Emitter=function(a){var g=SPE.utils,m=g.types,b=SPE.valueOverLifetimeLength;a=g.ensureTypedArg(a,m.OBJECT,{});a.position=g.ensureTypedArg(a.position,m.OBJECT,{});a.velocity=g.ensureTypedArg(a.velocity,m.OBJECT,{});a.acceleration=g.ensureTypedArg(a.acceleration,m.OBJECT,{});a.radius=g.ensureTypedArg(a.radius,m.OBJECT,{});a.drag=g.ensureTypedArg(a.drag,m.OBJECT,{});a.rotation=g.ensureTypedArg(a.rotation,m.OBJECT,{});a.color=g.ensureTypedArg(a.color,m.OBJECT,{});a.opacity=g.ensureTypedArg(a.opacity, -m.OBJECT,{});a.size=g.ensureTypedArg(a.size,m.OBJECT,{});a.angle=g.ensureTypedArg(a.angle,m.OBJECT,{});a.wiggle=g.ensureTypedArg(a.wiggle,m.OBJECT,{});a.maxAge=g.ensureTypedArg(a.maxAge,m.OBJECT,{});a.onParticleSpawn&&console.warn('onParticleSpawn has been removed. Please set properties directly to alter values at runtime.');this.uuid=THREE.Math.generateUUID();this.type=g.ensureTypedArg(a.type,m.NUMBER,SPE.distributions.BOX);this.position={_value:g.ensureInstanceOf(a.position.value,THREE.Vector3, -new THREE.Vector3),_spread:g.ensureInstanceOf(a.position.spread,THREE.Vector3,new THREE.Vector3),_spreadClamp:g.ensureInstanceOf(a.position.spreadClamp,THREE.Vector3,new THREE.Vector3),_distribution:g.ensureTypedArg(a.position.distribution,m.NUMBER,this.type),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1),_radius:g.ensureTypedArg(a.position.radius,m.NUMBER,10),_radiusScale:g.ensureInstanceOf(a.position.radiusScale,THREE.Vector3,new THREE.Vector3(1,1,1)),_distributionClamp:g.ensureTypedArg(a.position.distributionClamp, -m.NUMBER,0)};this.velocity={_value:g.ensureInstanceOf(a.velocity.value,THREE.Vector3,new THREE.Vector3),_spread:g.ensureInstanceOf(a.velocity.spread,THREE.Vector3,new THREE.Vector3),_distribution:g.ensureTypedArg(a.velocity.distribution,m.NUMBER,this.type),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.acceleration={_value:g.ensureInstanceOf(a.acceleration.value,THREE.Vector3,new THREE.Vector3),_spread:g.ensureInstanceOf(a.acceleration.spread,THREE.Vector3,new THREE.Vector3), -_distribution:g.ensureTypedArg(a.acceleration.distribution,m.NUMBER,this.type),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.drag={_value:g.ensureTypedArg(a.drag.value,m.NUMBER,0),_spread:g.ensureTypedArg(a.drag.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.wiggle={_value:g.ensureTypedArg(a.wiggle.value,m.NUMBER,0),_spread:g.ensureTypedArg(a.wiggle.spread,m.NUMBER,0)};this.rotation={_axis:g.ensureInstanceOf(a.rotation.axis,THREE.Vector3, -new THREE.Vector3(0,1,0)),_axisSpread:g.ensureInstanceOf(a.rotation.axisSpread,THREE.Vector3,new THREE.Vector3),_angle:g.ensureTypedArg(a.rotation.angle,m.NUMBER,0),_angleSpread:g.ensureTypedArg(a.rotation.angleSpread,m.NUMBER,0),_static:g.ensureTypedArg(a.rotation['static'],m.BOOLEAN,!1),_center:g.ensureInstanceOf(a.rotation.center,THREE.Vector3,this.position._value.clone()),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.maxAge={_value:g.ensureTypedArg(a.maxAge.value,m.NUMBER, -2),_spread:g.ensureTypedArg(a.maxAge.spread,m.NUMBER,0)};this.color={_value:g.ensureArrayInstanceOf(a.color.value,THREE.Color,new THREE.Color),_spread:g.ensureArrayInstanceOf(a.color.spread,THREE.Vector3,new THREE.Vector3),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.opacity={_value:g.ensureArrayTypedArg(a.opacity.value,m.NUMBER,1),_spread:g.ensureArrayTypedArg(a.opacity.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.size={_value:g.ensureArrayTypedArg(a.size.value, -m.NUMBER,1),_spread:g.ensureArrayTypedArg(a.size.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.angle={_value:g.ensureArrayTypedArg(a.angle.value,m.NUMBER,0),_spread:g.ensureArrayTypedArg(a.angle.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.particleCount=g.ensureTypedArg(a.particleCount,m.NUMBER,100);this.duration=g.ensureTypedArg(a.duration,m.NUMBER,null);this.isStatic=g.ensureTypedArg(a.isStatic,m.BOOLEAN,!1);this.activeMultiplier= -g.ensureTypedArg(a.activeMultiplier,m.NUMBER,1);this.direction=g.ensureTypedArg(a.direction,m.NUMBER,1);this.alive=g.ensureTypedArg(a.alive,m.BOOLEAN,!0);this.activeParticleCount=this.age=this.attributeEnd=this.attributeOffset=this.activationIndex=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.resetFlags={position:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)||g.ensureTypedArg(a.radius.randomise,m.BOOLEAN,!1),velocity:g.ensureTypedArg(a.velocity.randomise,m.BOOLEAN, -!1),acceleration:g.ensureTypedArg(a.acceleration.randomise,m.BOOLEAN,!1)||g.ensureTypedArg(a.drag.randomise,m.BOOLEAN,!1),rotation:g.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),rotationCenter:g.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),size:g.ensureTypedArg(a.size.randomise,m.BOOLEAN,!1),color:g.ensureTypedArg(a.color.randomise,m.BOOLEAN,!1),opacity:g.ensureTypedArg(a.opacity.randomise,m.BOOLEAN,!1),angle:g.ensureTypedArg(a.angle.randomise,m.BOOLEAN,!1)};this.updateFlags={};this.updateCounts= -{};this.updateMap={maxAge:'params',position:'position',velocity:'velocity',acceleration:'acceleration',drag:'acceleration',wiggle:'params',rotation:'rotation',size:'size',color:'color',opacity:'opacity',angle:'angle'};for(var l in this.updateMap)this.updateMap.hasOwnProperty(l)&&(this.updateCounts[this.updateMap[l]]=0,this.updateFlags[this.updateMap[l]]=!1,this._createGetterSetters(this[l],l));this.bufferUpdateRanges={};this.attributeKeys=null;this.attributeCount=0;g.ensureValueOverLifetimeCompliance(this.color, -b,b);g.ensureValueOverLifetimeCompliance(this.opacity,b,b);g.ensureValueOverLifetimeCompliance(this.size,b,b);g.ensureValueOverLifetimeCompliance(this.angle,b,b)};SPE.Emitter.constructor=SPE.Emitter; -SPE.Emitter.prototype._createGetterSetters=function(a,g){var m=this,b;for(b in a)if(a.hasOwnProperty(b)){var l=b.replace('_','');Object.defineProperty(a,l,{get:function(a){return function(){return this[a]}}(b),set:function(a){return function(b){var c=m.updateMap[g],f=this[a],l=SPE.valueOverLifetimeLength;'_rotationCenter'===a?(m.updateFlags.rotationCenter=!0,m.updateCounts.rotationCenter=0):'_randomise'===a?m.resetFlags[c]=b:(m.updateFlags[c]=!0,m.updateCounts[c]=0);m.group._updateDefines();this[a]= -b;Array.isArray(f)&&SPE.utils.ensureValueOverLifetimeCompliance(m[g],l,l)}}(b)})}};SPE.Emitter.prototype._setBufferUpdateRanges=function(a){this.attributeKeys=a;this.attributeCount=a.length;for(var g=this.attributeCount-1;0<=g;--g)this.bufferUpdateRanges[a[g]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}};SPE.Emitter.prototype._calculatePPSValue=function(a){var g=this.particleCount;this.duration?this.particlesPerSecond=g/(athis.maxParticleCount&&console.warn('SPE.Group: maxParticleCount exceeded. Requesting',this.particleCount,'particles, can support only',this.maxParticleCount);a._calculatePPSValue(a.maxAge._value+a.maxAge._spread);a._setBufferUpdateRanges(this.attributeKeys);a._setAttributeOffset(m);a.group=this;a.attributes=this.attributes;for(var l in e)e.hasOwnProperty(l)&&e[l]._createBufferAttribute(null!==this.maxParticleCount?this.maxParticleCount:this.particleCount); +for(e=m;b>e;++e)a._assignPositionValue(e),a._assignForceValue(e,'velocity'),a._assignForceValue(e,'acceleration'),a._assignAbsLifetimeValue(e,'opacity'),a._assignAbsLifetimeValue(e,'size'),a._assignAngleValue(e),a._assignRotationValue(e),a._assignParamsValue(e),a._assignColorValue(e);return this._applyAttributesToGeometry(),this.emitters.push(a),this.emitterIDs.push(a.uuid),this._updateDefines(a),this.material.needsUpdate=!0,this.geometry.needsUpdate=!0,this._attributesNeedRefresh=!0,this}; +SPE.Group.prototype.removeEmitter=function(a){var e=this.emitterIDs.indexOf(a.uuid);if(0==a instanceof SPE.Emitter)return void console.error('`emitter` argument must be instance of SPE.Emitter. Was provided with:',a);if(-1===e)return void console.error('Emitter does not exist in this group. Will not remove.');for(var m=a.attributeOffset,b=m+a.particleCount,l=this.attributes.params.typedArray,g=m;b>g;++g)l.array[4*g]=0,l.array[4*g+1]=0;this.emitters.splice(e,1);this.emitterIDs.splice(e,1);for(var c in this.attributes)this.attributes.hasOwnProperty(c)&& +this.attributes[c].splice(m,b);this.particleCount-=a.particleCount;a._onRemove();this._attributesNeedRefresh=!0};SPE.Group.prototype.getFromPool=function(){var a=this._pool,e=this._createNewWhenPoolEmpty;return a.length?a.pop():e?(a=new SPE.Emitter(this._poolCreationSettings),this.addEmitter(a),a):null};SPE.Group.prototype.releaseIntoPool=function(a){return 0==a instanceof SPE.Emitter?void console.error('Argument is not instanceof SPE.Emitter:',a):(a.reset(),this._pool.unshift(a),this)}; +SPE.Group.prototype.getPool=function(){return this._pool};SPE.Group.prototype.addPool=function(a,e,m){this._poolCreationSettings=e;this._createNewWhenPoolEmpty=!!m;for(var b=0;a>b;++b)m=Array.isArray(e)?new SPE.Emitter(e[b]):new SPE.Emitter(e),this.addEmitter(m),this.releaseIntoPool(m);return this}; +SPE.Group.prototype._triggerSingleEmitter=function(a){var e=this.getFromPool(),m=this;return null===e?void console.log('SPE.Group pool ran out.'):(a instanceof THREE.Vector3&&(e.position.value.copy(a),e.position.value=e.position.value),e.enable(),setTimeout(function(){e.disable();m.releaseIntoPool(e)},1E3*Math.max(e.duration,e.maxAge.value+e.maxAge.spread)),this)}; +SPE.Group.prototype.triggerPoolEmitter=function(a,e){if('number'==typeof a&&1m;++m)this._triggerSingleEmitter(e);else this._triggerSingleEmitter(e);return this};SPE.Group.prototype._updateUniforms=function(a){this.uniforms.runTime.value+=a;this.uniforms.deltaTime.value=a};SPE.Group.prototype._resetBufferRanges=function(){var a=this.attributeKeys,e=this.attributeCount-1,m=this.attributes;for(e;0<=e;--e)m[a[e]].resetUpdateRange()}; +SPE.Group.prototype._updateBuffers=function(a){var e,m=this.attributeKeys,b=this.attributeCount-1,l=this.attributes,g=a.bufferUpdateRanges;for(b;0<=b;--b)e=m[b],a=g[e],e=l[e],e.setUpdateRange(a.min,a.max),e.flagUpdate()}; +SPE.Group.prototype.tick=function(a){var e=this.emitters,m=e.length,b=a||this.fixedTimeStep,l=this.attributeKeys,g=this.attributes;if(this._updateUniforms(b),this._resetBufferRanges(),0!==m||!1!==this._attributesNeedRefresh||!1!==this._attributesNeedDynamicReset){var c;for(a=0;m>a;++a)c=e[a],c.tick(b),this._updateBuffers(c);if(!0===this._attributesNeedDynamicReset){for(a=this.attributeCount-1;0<=a;--a)g[l[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(!0===this._attributesNeedRefresh){for(a= +this.attributeCount-1;0<=a;--a)g[l[a]].forceUpdateAll();this._attributesNeedRefresh=!1;this._attributesNeedDynamicReset=!0}}};SPE.Group.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this}; +SPE.Emitter=function(a){var e=SPE.utils,m=e.types,b=SPE.valueOverLifetimeLength;a=e.ensureTypedArg(a,m.OBJECT,{});a.position=e.ensureTypedArg(a.position,m.OBJECT,{});a.velocity=e.ensureTypedArg(a.velocity,m.OBJECT,{});a.acceleration=e.ensureTypedArg(a.acceleration,m.OBJECT,{});a.radius=e.ensureTypedArg(a.radius,m.OBJECT,{});a.drag=e.ensureTypedArg(a.drag,m.OBJECT,{});a.rotation=e.ensureTypedArg(a.rotation,m.OBJECT,{});a.color=e.ensureTypedArg(a.color,m.OBJECT,{});a.opacity=e.ensureTypedArg(a.opacity, +m.OBJECT,{});a.size=e.ensureTypedArg(a.size,m.OBJECT,{});a.angle=e.ensureTypedArg(a.angle,m.OBJECT,{});a.wiggle=e.ensureTypedArg(a.wiggle,m.OBJECT,{});a.maxAge=e.ensureTypedArg(a.maxAge,m.OBJECT,{});a.onParticleSpawn&&console.warn('onParticleSpawn has been removed. Please set properties directly to alter values at runtime.');this.uuid=THREE.Math.generateUUID();this.type=e.ensureTypedArg(a.type,m.NUMBER,SPE.distributions.BOX);this.position={_value:e.ensureInstanceOf(a.position.value,THREE.Vector3, +new THREE.Vector3),_spread:e.ensureInstanceOf(a.position.spread,THREE.Vector3,new THREE.Vector3),_spreadClamp:e.ensureInstanceOf(a.position.spreadClamp,THREE.Vector3,new THREE.Vector3),_distribution:e.ensureTypedArg(a.position.distribution,m.NUMBER,this.type),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1),_radius:e.ensureTypedArg(a.position.radius,m.NUMBER,10),_radiusScale:e.ensureInstanceOf(a.position.radiusScale,THREE.Vector3,new THREE.Vector3(1,1,1)),_distributionClamp:e.ensureTypedArg(a.position.distributionClamp, +m.NUMBER,0)};this.velocity={_value:e.ensureInstanceOf(a.velocity.value,THREE.Vector3,new THREE.Vector3),_spread:e.ensureInstanceOf(a.velocity.spread,THREE.Vector3,new THREE.Vector3),_distribution:e.ensureTypedArg(a.velocity.distribution,m.NUMBER,this.type),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.acceleration={_value:e.ensureInstanceOf(a.acceleration.value,THREE.Vector3,new THREE.Vector3),_spread:e.ensureInstanceOf(a.acceleration.spread,THREE.Vector3,new THREE.Vector3), +_distribution:e.ensureTypedArg(a.acceleration.distribution,m.NUMBER,this.type),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.drag={_value:e.ensureTypedArg(a.drag.value,m.NUMBER,0),_spread:e.ensureTypedArg(a.drag.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.wiggle={_value:e.ensureTypedArg(a.wiggle.value,m.NUMBER,0),_spread:e.ensureTypedArg(a.wiggle.spread,m.NUMBER,0)};this.rotation={_axis:e.ensureInstanceOf(a.rotation.axis,THREE.Vector3, +new THREE.Vector3(0,1,0)),_axisSpread:e.ensureInstanceOf(a.rotation.axisSpread,THREE.Vector3,new THREE.Vector3),_angle:e.ensureTypedArg(a.rotation.angle,m.NUMBER,0),_angleSpread:e.ensureTypedArg(a.rotation.angleSpread,m.NUMBER,0),_static:e.ensureTypedArg(a.rotation['static'],m.BOOLEAN,!1),_center:e.ensureInstanceOf(a.rotation.center,THREE.Vector3,this.position._value.clone()),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.maxAge={_value:e.ensureTypedArg(a.maxAge.value,m.NUMBER, +2),_spread:e.ensureTypedArg(a.maxAge.spread,m.NUMBER,0)};this.color={_value:e.ensureArrayInstanceOf(a.color.value,THREE.Color,new THREE.Color),_spread:e.ensureArrayInstanceOf(a.color.spread,THREE.Vector3,new THREE.Vector3),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.opacity={_value:e.ensureArrayTypedArg(a.opacity.value,m.NUMBER,1),_spread:e.ensureArrayTypedArg(a.opacity.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.size={_value:e.ensureArrayTypedArg(a.size.value, +m.NUMBER,1),_spread:e.ensureArrayTypedArg(a.size.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.angle={_value:e.ensureArrayTypedArg(a.angle.value,m.NUMBER,0),_spread:e.ensureArrayTypedArg(a.angle.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.particleCount=e.ensureTypedArg(a.particleCount,m.NUMBER,100);this.duration=e.ensureTypedArg(a.duration,m.NUMBER,null);this.isStatic=e.ensureTypedArg(a.isStatic,m.BOOLEAN,!1);this.activeMultiplier= +e.ensureTypedArg(a.activeMultiplier,m.NUMBER,1);this.direction=e.ensureTypedArg(a.direction,m.NUMBER,1);this.alive=e.ensureTypedArg(a.alive,m.BOOLEAN,!0);this.activeParticleCount=this.age=this.attributeEnd=this.attributeOffset=this.activationIndex=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.resetFlags={position:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)||e.ensureTypedArg(a.radius.randomise,m.BOOLEAN,!1),velocity:e.ensureTypedArg(a.velocity.randomise,m.BOOLEAN, +!1),acceleration:e.ensureTypedArg(a.acceleration.randomise,m.BOOLEAN,!1)||e.ensureTypedArg(a.drag.randomise,m.BOOLEAN,!1),rotation:e.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),rotationCenter:e.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),size:e.ensureTypedArg(a.size.randomise,m.BOOLEAN,!1),color:e.ensureTypedArg(a.color.randomise,m.BOOLEAN,!1),opacity:e.ensureTypedArg(a.opacity.randomise,m.BOOLEAN,!1),angle:e.ensureTypedArg(a.angle.randomise,m.BOOLEAN,!1)};this.updateFlags={};this.updateCounts= +{};this.updateMap={maxAge:'params',position:'position',velocity:'velocity',acceleration:'acceleration',drag:'acceleration',wiggle:'params',rotation:'rotation',size:'size',color:'color',opacity:'opacity',angle:'angle'};for(var l in this.updateMap)this.updateMap.hasOwnProperty(l)&&(this.updateCounts[this.updateMap[l]]=0,this.updateFlags[this.updateMap[l]]=!1,this._createGetterSetters(this[l],l));this.bufferUpdateRanges={};this.attributeKeys=null;this.attributeCount=0;e.ensureValueOverLifetimeCompliance(this.color, +b,b);e.ensureValueOverLifetimeCompliance(this.opacity,b,b);e.ensureValueOverLifetimeCompliance(this.size,b,b);e.ensureValueOverLifetimeCompliance(this.angle,b,b)};SPE.Emitter.constructor=SPE.Emitter; +SPE.Emitter.prototype._createGetterSetters=function(a,e){var m=this,b;for(b in a)if(a.hasOwnProperty(b)){var l=b.replace('_','');Object.defineProperty(a,l,{get:function(a){return function(){return this[a]}}(b),set:function(a){return function(b){var c=m.updateMap[e],g=this[a],l=SPE.valueOverLifetimeLength;'_rotationCenter'===a?(m.updateFlags.rotationCenter=!0,m.updateCounts.rotationCenter=0):'_randomise'===a?m.resetFlags[c]=b:(m.updateFlags[c]=!0,m.updateCounts[c]=0);m.group._updateDefines();this[a]= +b;Array.isArray(g)&&SPE.utils.ensureValueOverLifetimeCompliance(m[e],l,l)}}(b)})}};SPE.Emitter.prototype._setBufferUpdateRanges=function(a){this.attributeKeys=a;this.attributeCount=a.length;for(var e=this.attributeCount-1;0<=e;--e)this.bufferUpdateRanges[a[e]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}};SPE.Emitter.prototype._calculatePPSValue=function(a){var e=this.particleCount;this.duration?this.particlesPerSecond=e/(a=a;--k)g=4*k,c=m[g],0!==c&&(f=m[g+1],l=m[g+2],1===this.direction?(f+=b,f>=l&&(f=0,c=0,this._decrementParticleCount())):(f-=b,0>=f&&(f=l,c=0,this._decrementParticleCount())),m[g]=c,m[g+1]=f,this._updateAttributeUpdateRange('params',k))}; -SPE.Emitter.prototype._activateParticles=function(a,g,m,b){for(var l,f,c=this.direction,k=a;g>k;++k)l=4*k,0!=m[l]&&1!==this.particleCount||(this._incrementParticleCount(),m[l]=1,this._resetParticle(k),f=b*(k-a),m[l+1]=-1===c?m[l+2]-f:f,this._updateAttributeUpdateRange('params',k))}; -SPE.Emitter.prototype.tick=function(a){if(!this.isStatic){null===this.paramsArray&&(this.paramsArray=this.attributes.params.typedArray.array);var g=this.attributeOffset,m=g+this.particleCount,b=this.paramsArray,l=this.particlesPerSecond*this.activeMultiplier*a,f=this.activationIndex;if(this._resetBufferRanges(),this._checkParticleAges(g,m,b,a),!1===this.alive)return void(this.age=0);if(null!==this.duration&&this.age>this.duration)return this.alive=!1,void(this.age=0);var f=1===this.particleCount? -f:0|f,c=Math.min(f+l,this.activationEnd),k=c-this.activationIndex|0;this._activateParticles(f,c,b,0m&&(this.activationIndex=g);this.age+=a}};SPE.Emitter.prototype.reset=function(a){if(this.age=0,this.alive=!1,!0===a){for(var g=this.attributeOffset,m=this.paramsArray,b=this.attributes.params.bufferAttribute,l=g+this.particleCount-1;l>=g;--l)a=4*l,m[a]=0,m[a+1]=0;b.updateRange.offset=0;b.updateRange.count=-1;b.needsUpdate=!0}return this}; +SPE.Emitter.prototype._resetParticle=function(a){for(var e,m,b=this.resetFlags,l=this.updateFlags,g=this.updateCounts,c=this.attributeKeys,k=this.attributeCount-1;0<=k;--k)e=c[k],m=l[e],!0!==b[e]&&!0!==m||(this._assignValue(e,a),this._updateAttributeUpdateRange(e,a),!0===m&&g[e]===this.particleCount?(l[e]=!1,g[e]=0):1==m&&++g[e])};SPE.Emitter.prototype._updateAttributeUpdateRange=function(a,e){a=this.bufferUpdateRanges[a];a.min=Math.min(e,a.min);a.max=Math.max(e,a.max)}; +SPE.Emitter.prototype._resetBufferRanges=function(){var a,e=this.bufferUpdateRanges,m=this.bufferUpdateKeys,b=this.bufferUpdateCount-1;for(b;0<=b;--b)a=m[b],e[a].min=Number.POSITIVE_INFINITY,e[a].max=Number.NEGATIVE_INFINITY};SPE.Emitter.prototype._onRemove=function(){this.activeParticleCount=this.activationIndex=this.attributeOffset=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.age=0};SPE.Emitter.prototype._decrementParticleCount=function(){--this.activeParticleCount}; +SPE.Emitter.prototype._incrementParticleCount=function(){++this.activeParticleCount};SPE.Emitter.prototype._checkParticleAges=function(a,e,m,b){for(var l,g,c,k=e-1;k>=a;--k)e=4*k,c=m[e],0!==c&&(g=m[e+1],l=m[e+2],1===this.direction?(g+=b,g>=l&&(g=0,c=0,this._decrementParticleCount())):(g-=b,0>=g&&(g=l,c=0,this._decrementParticleCount())),m[e]=c,m[e+1]=g,this._updateAttributeUpdateRange('params',k))}; +SPE.Emitter.prototype._activateParticles=function(a,e,m,b){for(var l,g,c=this.direction,k=a;e>k;++k)l=4*k,0!=m[l]&&1!==this.particleCount||(this._incrementParticleCount(),m[l]=1,this._resetParticle(k),g=b*(k-a),m[l+1]=-1===c?m[l+2]-g:g,this._updateAttributeUpdateRange('params',k))}; +SPE.Emitter.prototype.tick=function(a){if(!this.isStatic){null===this.paramsArray&&(this.paramsArray=this.attributes.params.typedArray.array);var e=this.attributeOffset,m=e+this.particleCount,b=this.paramsArray,l=this.particlesPerSecond*this.activeMultiplier*a,g=this.activationIndex;if(this._resetBufferRanges(),this._checkParticleAges(e,m,b,a),!1===this.alive)return void(this.age=0);if(null!==this.duration&&this.age>this.duration)return this.alive=!1,void(this.age=0);var g=1===this.particleCount? +g:0|g,c=Math.min(g+l,this.activationEnd),k=c-this.activationIndex|0;this._activateParticles(g,c,b,0m&&(this.activationIndex=e);this.age+=a}};SPE.Emitter.prototype.reset=function(a){if(this.age=0,this.alive=!1,!0===a){for(var e=this.attributeOffset,m=this.paramsArray,b=this.attributes.params.bufferAttribute,l=e+this.particleCount-1;l>=e;--l)a=4*l,m[a]=0,m[a+1]=0;b.updateRange.offset=0;b.updateRange.count=-1;b.needsUpdate=!0}return this}; SPE.Emitter.prototype.enable=function(){return this.alive=!0,this};SPE.Emitter.prototype.disable=function(){return this.alive=!1,this};SPE.Emitter.prototype.remove=function(){return null!==this.group?this.group.removeEmitter(this):console.error('Emitter does not belong to a group, cannot remove.'),this}; -var __extends=this&&this.__extends||function(a,g){function m(){this.constructor=a}for(var b in g)g.hasOwnProperty(b)&&(a[b]=g[b]);a.prototype=null===g?Object.create(g):(m.prototype=g.prototype,new m)},spine; -(function(a){var g=function(){function a(a,b,c){if(null==a)throw Error('name cannot be null.');if(null==b)throw Error('timelines cannot be null.');this.name=a;this.timelines=b;this.duration=c}a.prototype.apply=function(a,b,c,f,h,d,g,l){if(null==a)throw Error('skeleton cannot be null.');f&&0!=this.duration&&(c%=this.duration,0>>1;;){a[(d+1)*c]<=b?f=d+1:h=d;if(f==h)return(f+1)*c;d=f+h>>>1}};a.linearSearch=function(a,b,c){for(var f=0,h=a.length-c;f<=h;f+=c)if(a[f]>b)return f;return-1};return a}();a.Animation=g;(function(a){a[a.rotate=0]='rotate';a[a.translate=1]='translate';a[a.scale=2]='scale';a[a.shear=3]='shear';a[a.attachment=4]='attachment';a[a.color=5]='color';a[a.deform=6]='deform';a[a.event=7]='event';a[a.drawOrder=8]='drawOrder';a[a.ikConstraint=9]='ikConstraint';a[a.transformConstraint=10]= +var __extends=this&&this.__extends||function(a,e){function m(){this.constructor=a}for(var b in e)e.hasOwnProperty(b)&&(a[b]=e[b]);a.prototype=null===e?Object.create(e):(m.prototype=e.prototype,new m)},spine; +(function(a){var e=function(){function a(a,b,c){if(null==a)throw Error('name cannot be null.');if(null==b)throw Error('timelines cannot be null.');this.name=a;this.timelines=b;this.duration=c}a.prototype.apply=function(a,b,c,g,h,d,e,l){if(null==a)throw Error('skeleton cannot be null.');g&&0!=this.duration&&(c%=this.duration,0>>1;;){a[(d+1)*c]<=b?g=d+1:h=d;if(g==h)return(g+1)*c;d=g+h>>>1}};a.linearSearch=function(a,b,c){for(var g=0,h=a.length-c;g<=h;g+=c)if(a[g]>b)return g;return-1};return a}();a.Animation=e;(function(a){a[a.rotate=0]='rotate';a[a.translate=1]='translate';a[a.scale=2]='scale';a[a.shear=3]='shear';a[a.attachment=4]='attachment';a[a.color=5]='color';a[a.deform=6]='deform';a[a.event=7]='event';a[a.drawOrder=8]='drawOrder';a[a.ikConstraint=9]='ikConstraint';a[a.transformConstraint=10]= 'transformConstraint';a[a.pathConstraintPosition=11]='pathConstraintPosition';a[a.pathConstraintSpacing=12]='pathConstraintSpacing';a[a.pathConstraintMix=13]='pathConstraintMix'})(a.TimelineType||(a.TimelineType={}));var m=a.TimelineType,b=function(){function b(c){if(0>=c)throw Error('frameCount must be > 0: '+c);this.curves=a.Utils.newFloatArray((c-1)*b.BEZIER_SIZE)}b.prototype.getFrameCount=function(){return this.curves.length/b.BEZIER_SIZE+1};b.prototype.setLinear=function(a){this.curves[a*b.BEZIER_SIZE]= -b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a==b.STEPPED?b.STEPPED:b.BEZIER};b.prototype.setCurve=function(a,c,f,g,h){var d=.03*(2*-c+g),k=.03*(2*-f+h);g=.006*(3*(c-g)+1);h=.006*(3*(f-h)+1);var l=2*d+g,n=2*k+h;c=.3*c+d+.16666667*g;f=.3*f+k+.16666667*h;a*=b.BEZIER_SIZE;k=this.curves;k[a++]=b.BEZIER;for(var d=c,p=f,m=a+b.BEZIER_SIZE- -1;a=f)return c==h?d=h=0:(h=k[c-2],d=k[c-1]),d+(k[c+1]-d)*(f-h)/(g-h);k=k[c-1];return k+(1-k)*(f-g)/(1-g)};b.LINEAR=0;b.STEPPED=1;b.BEZIER=2;b.BEZIER_SIZE=19;return b}();a.CurveTimeline=b;var l=function(b){function c(c){b.call(this, -c);this.frames=a.Utils.newFloatArray(c<<1)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.rotate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,f){a<<=1;this.frames[a]=b;this.frames[a+c.ROTATION]=f};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(f=b[b.length-c.ENTRIES])k?a.rotation=a.data.rotation+b[b.length+c.PREV_ROTATION]*d:(k=a.data.rotation+b[b.length+c.PREV_ROTATION]-a.rotation,a.rotation+= -(k-360*(16384-(16384.499999999996-k/360|0)))*d);else{l=g.binarySearch(b,f,c.ENTRIES);h=b[l+c.PREV_ROTATION];var n=b[l];f=this.getCurvePercent((l>>1)-1,1-(f-n)/(b[l+c.PREV_TIME]-n));b=b[l+c.ROTATION]-h;b=h+(b-360*(16384-(16384.499999999996-b/360|0)))*f;k?a.rotation=a.data.rotation+(b-360*(16384-(16384.499999999996-b/360|0)))*d:(b=a.data.rotation+b-a.rotation,a.rotation+=(b-360*(16384-(16384.499999999996-b/360|0)))*d)}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_ROTATION=-1;c.ROTATION=1;return c}(b);a.RotateTimeline= -l;l=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.translate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,f,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.X]=f;this.frames[a+c.Y]=h};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(f=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_X],l=b[b.length+c.PREV_Y];else{var n= -g.binarySearch(b,f,c.ENTRIES);h=b[n+c.PREV_X];l=b[n+c.PREV_Y];var p=b[n];f=this.getCurvePercent(n/c.ENTRIES-1,1-(f-p)/(b[n+c.PREV_TIME]-p));h+=(b[n+c.X]-h)*f;l+=(b[n+c.Y]-l)*f}k?(a.x=a.data.x+h*d,a.y=a.data.y+l*d):(a.x+=(a.data.x+h-a.x)*d,a.y+=(a.data.y+l-a.y)*d)}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_X=-2;c.PREV_Y=-1;c.X=1;c.Y=2;return c}(b);a.TranslateTimeline=l;var f=function(b){function c(a){b.call(this,a)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.scale<<24)+this.boneIndex};c.prototype.apply= -function(b,f,k,h,d,l,m){var n=this.frames;b=b.bones[this.boneIndex];if(k=n[n.length-c.ENTRIES])f=n[n.length+c.PREV_X]*b.data.scaleX,h=n[n.length+c.PREV_Y]*b.data.scaleY;else{var p=g.binarySearch(n,k,c.ENTRIES);f=n[p+c.PREV_X];h=n[p+c.PREV_Y];var t=n[p];k=this.getCurvePercent(p/c.ENTRIES-1,1-(k-t)/(n[p+c.PREV_TIME]-t));f=(f+(n[p+c.X]-f)*k)*b.data.scaleX;h=(h+(n[p+c.Y]-h)*k)*b.data.scaleY}1==d?(b.scaleX=f,b.scaleY=h):(l?(l=b.data.scaleX, -k=b.data.scaleY):(l=b.scaleX,k=b.scaleY),m?(f=Math.abs(f)*a.MathUtils.signum(l),h=Math.abs(h)*a.MathUtils.signum(k)):(l=Math.abs(l)*a.MathUtils.signum(f),k=Math.abs(k)*a.MathUtils.signum(h)),b.scaleX=l+(f-l)*d,b.scaleY=k+(h-k)*d)}};return c}(l);a.ScaleTimeline=f;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.shear<<24)+this.boneIndex};b.prototype.apply=function(a,c,f,h,d,k,l){c=this.frames;a=a.bones[this.boneIndex];if(f=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_X],l=c[c.length+b.PREV_Y];else{var n=g.binarySearch(c,f,b.ENTRIES);h=c[n+b.PREV_X];l=c[n+b.PREV_Y];var p=c[n];f=this.getCurvePercent(n/b.ENTRIES-1,1-(f-p)/(c[n+b.PREV_TIME]-p));h+=(c[n+b.X]-h)*f;l+=(c[n+b.Y]-l)*f}k?(a.shearX=a.data.shearX+h*d,a.shearY=a.data.shearY+l*d):(a.shearX+=(a.data.shearX+h-a.shearX)*d,a.shearY+=(a.data.shearY+l-a.shearY)*d)}};return b}(l);a.ShearTimeline=l;l=function(b){function c(f){b.call(this, -f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.color<<24)+this.slotIndex};c.prototype.setFrame=function(a,b,f,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.R]=f;this.frames[a+c.G]=h;this.frames[a+c.B]=d;this.frames[a+c.A]=k};c.prototype.apply=function(a,b,f,h,d,k,l){a=a.slots[this.slotIndex];var n=this.frames;if(f=n[n.length-c.ENTRIES])f=n.length,b=n[f+c.PREV_R],h=n[f+ -c.PREV_G],l=n[f+c.PREV_B],p=n[f+c.PREV_A];else{var m=g.binarySearch(n,f,c.ENTRIES);b=n[m+c.PREV_R];h=n[m+c.PREV_G];l=n[m+c.PREV_B];p=n[m+c.PREV_A];var t=n[m];f=this.getCurvePercent(m/c.ENTRIES-1,1-(f-t)/(n[m+c.PREV_TIME]-t));b+=(n[m+c.R]-b)*f;h+=(n[m+c.G]-h)*f;l+=(n[m+c.B]-l)*f;p+=(n[m+c.A]-p)*f}1==d?a.color.set(b,h,l,p):(f=a.color,k&&f.setFromColor(a.data.color),f.add((b-f.r)*d,(h-f.g)*d,(l-f.b)*d,(p-f.a)*d))}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_R=-4;c.PREV_G=-3;c.PREV_B=-2;c.PREV_A=-1;c.R=1;c.G= -2;c.B=3;c.A=4;return c}(b);a.ColorTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}b.prototype.getPropertyId=function(){return(m.attachment<<24)+this.slotIndex};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};b.prototype.apply=function(a,b,c,f,h,d,l){b=a.slots[this.slotIndex];l&&d?(c=b.data.attachmentName,b.setAttachment(null==c?null:a.getAttachment(this.slotIndex, -c))):(l=this.frames,c=l[l.length-1]?l.length-1:g.binarySearch(l,c,1)-1,c=this.attachmentNames[c],a.slots[this.slotIndex].setAttachment(null==c?null:a.getAttachment(this.slotIndex,c))))};return b}();a.AttachmentTimeline=l;l=function(b){function c(c){b.call(this,c);this.frames=a.Utils.newFloatArray(c);this.frameVertices=Array(c)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.deform<< -24)+this.slotIndex};c.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};c.prototype.apply=function(b,c,f,h,d,k,l){b=b.slots[this.slotIndex];var n=b.getAttachment();if(n instanceof a.VertexAttachment&&n.applyDeform(this.attachment)){var p=this.frames;c=b.attachmentVertices;if(f=p[p.length-1])if(f=l[p.length-1],1==d)a.Utils.arrayCopy(f,0,c,0,b);else if(k)if(k= -n,null==k.bones)for(k=k.vertices,n=0;nc)this.apply(a,b,Number.MAX_VALUE,f,h,d,l),b=-1;else if(b>=k[n-1])return;if(!(c=k[a];a++)f.push(this.events[a])}}};return b}();a.EventTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}b.prototype.getPropertyId=function(){return m.drawOrder<<24};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};b.prototype.apply=function(b,c,f,l,h,d,m){c=b.drawOrder;l=b.slots; -if(m&&d)a.Utils.arrayCopy(b.slots,0,b.drawOrder,0,b.slots.length);else if(m=this.frames,f=m[m.length-1]?m.length-1:g.binarySearch(m,f)-1,b=this.drawOrders[b],null==b)a.Utils.arrayCopy(l,0,c,0,l.length);else for(f=0,d=b.length;f=b[b.length-c.ENTRIES])k?(a.mix=a.data.mix+(b[b.length+c.PREV_MIX]-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[b.length+c.PREV_BEND_DIRECTION]):(a.mix+=(b[b.length+ -c.PREV_MIX]-a.mix)*d,l||(a.bendDirection=b[b.length+c.PREV_BEND_DIRECTION]));else{h=g.binarySearch(b,f,c.ENTRIES);var n=b[h+c.PREV_MIX],m=b[h];f=this.getCurvePercent(h/c.ENTRIES-1,1-(f-m)/(b[h+c.PREV_TIME]-m));k?(a.mix=a.data.mix+(n+(b[h+c.MIX]-n)*f-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[h+c.PREV_BEND_DIRECTION]):(a.mix+=(n+(b[h+c.MIX]-n)*f-a.mix)*d,l||(a.bendDirection=b[h+c.PREV_BEND_DIRECTION]))}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_MIX=-2;c.PREV_BEND_DIRECTION=-1;c.MIX=1;c.BEND_DIRECTION= -2;return c}(b);a.IkConstraintTimeline=l;l=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.transformConstraint<<24)+this.transformConstraintIndex};c.prototype.setFrame=function(a,b,f,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=f;this.frames[a+c.TRANSLATE]=h;this.frames[a+c.SCALE]=d;this.frames[a+c.SHEAR]=k};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.transformConstraints[this.transformConstraintIndex]; -if(f=b[b.length-c.ENTRIES])f=b.length,h=b[f+c.PREV_ROTATE],l=b[f+c.PREV_TRANSLATE],n=b[f+c.PREV_SCALE],m=b[f+c.PREV_SHEAR];else{var p=g.binarySearch(b,f,c.ENTRIES);h=b[p+c.PREV_ROTATE];l=b[p+c.PREV_TRANSLATE];n=b[p+c.PREV_SCALE];m=b[p+c.PREV_SHEAR];var t=b[p];f=this.getCurvePercent(p/c.ENTRIES-1,1-(f-t)/(b[p+c.PREV_TIME]-t));h+=(b[p+c.ROTATE]-h)*f;l+=(b[p+c.TRANSLATE]- -l)*f;n+=(b[p+c.SCALE]-n)*f;m+=(b[p+c.SHEAR]-m)*f}k?(k=a.data,a.rotateMix=k.rotateMix+(h-k.rotateMix)*d,a.translateMix=k.translateMix+(l-k.translateMix)*d,a.scaleMix=k.scaleMix+(n-k.scaleMix)*d,a.shearMix=k.shearMix+(m-k.shearMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d,a.scaleMix+=(n-a.scaleMix)*d,a.shearMix+=(m-a.shearMix)*d)}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_ROTATE=-4;c.PREV_TRANSLATE=-3;c.PREV_SCALE=-2;c.PREV_SHEAR=-1;c.ROTATE=1;c.TRANSLATE=2;c.SCALE=3;c.SHEAR= -4;return c}(b);a.TransformConstraintTimeline=l;l=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintPosition<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,f){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.VALUE]=f};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f=b[b.length- -c.ENTRIES])h=b[b.length+c.PREV_VALUE];else{l=g.binarySearch(b,f,c.ENTRIES);h=b[l+c.PREV_VALUE];var n=b[l];f=this.getCurvePercent(l/c.ENTRIES-1,1-(f-n)/(b[l+c.PREV_TIME]-n));h+=(b[l+c.VALUE]-h)*f}a.position=k?a.data.position+(h-a.data.position)*d:a.position+(h-a.position)*d}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_VALUE=-1;c.VALUE=1;return c}(b);a.PathConstraintPositionTimeline=l;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.pathConstraintSpacing<< -24)+this.pathConstraintIndex};b.prototype.apply=function(a,c,f,h,d,k,l){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_VALUE];else{l=g.binarySearch(c,f,b.ENTRIES);h=c[l+b.PREV_VALUE];var n=c[l];f=this.getCurvePercent(l/b.ENTRIES-1,1-(f-n)/(c[l+b.PREV_TIME]-n));h+=(c[l+b.VALUE]-h)*f}a.spacing=k?a.data.spacing+(h-a.data.spacing)*d:a.spacing+(h-a.spacing)*d}};return b}(l);a.PathConstraintSpacingTimeline= -l;b=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintMix<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,f,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=f;this.frames[a+c.TRANSLATE]=h};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_ROTATE],l=b[b.length+c.PREV_TRANSLATE];else{var n=g.binarySearch(b,f,c.ENTRIES);h=b[n+c.PREV_ROTATE];l=b[n+c.PREV_TRANSLATE];var m=b[n];f=this.getCurvePercent(n/c.ENTRIES-1,1-(f-m)/(b[n+c.PREV_TIME]-m));h+=(b[n+c.ROTATE]-h)*f;l+=(b[n+c.TRANSLATE]-l)*f}k?(a.rotateMix=a.data.rotateMix+(h-a.data.rotateMix)*d,a.translateMix=a.data.translateMix+(l-a.data.translateMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d)}};c.ENTRIES= +b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a==b.STEPPED?b.STEPPED:b.BEZIER};b.prototype.setCurve=function(a,c,g,e,h){var d=.03*(2*-c+e),k=.03*(2*-g+h);e=.006*(3*(c-e)+1);h=.006*(3*(g-h)+1);var n=2*d+e,l=2*k+h;c=.3*c+d+.16666667*e;g=.3*g+k+.16666667*h;a*=b.BEZIER_SIZE;k=this.curves;k[a++]=b.BEZIER;for(var d=c,p=g,m=a+b.BEZIER_SIZE- +1;a=g)return c==h?d=h=0:(h=k[c-2],d=k[c-1]),d+(k[c+1]-d)*(g-h)/(e-h);k=k[c-1];return k+(1-k)*(g-e)/(1-e)};b.LINEAR=0;b.STEPPED=1;b.BEZIER=2;b.BEZIER_SIZE=19;return b}();a.CurveTimeline=b;var l=function(b){function c(c){b.call(this, +c);this.frames=a.Utils.newFloatArray(c<<1)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.rotate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,g){a<<=1;this.frames[a]=b;this.frames[a+c.ROTATION]=g};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(g=b[b.length-c.ENTRIES])k?a.rotation=a.data.rotation+b[b.length+c.PREV_ROTATION]*d:(k=a.data.rotation+b[b.length+c.PREV_ROTATION]-a.rotation,a.rotation+= +(k-360*(16384-(16384.499999999996-k/360|0)))*d);else{l=e.binarySearch(b,g,c.ENTRIES);h=b[l+c.PREV_ROTATION];var n=b[l];g=this.getCurvePercent((l>>1)-1,1-(g-n)/(b[l+c.PREV_TIME]-n));b=b[l+c.ROTATION]-h;b=h+(b-360*(16384-(16384.499999999996-b/360|0)))*g;k?a.rotation=a.data.rotation+(b-360*(16384-(16384.499999999996-b/360|0)))*d:(b=a.data.rotation+b-a.rotation,a.rotation+=(b-360*(16384-(16384.499999999996-b/360|0)))*d)}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_ROTATION=-1;c.ROTATION=1;return c}(b);a.RotateTimeline= +l;l=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.translate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,g,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.X]=g;this.frames[a+c.Y]=h};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(g=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_X],l=b[b.length+c.PREV_Y];else{var n= +e.binarySearch(b,g,c.ENTRIES);h=b[n+c.PREV_X];l=b[n+c.PREV_Y];var p=b[n];g=this.getCurvePercent(n/c.ENTRIES-1,1-(g-p)/(b[n+c.PREV_TIME]-p));h+=(b[n+c.X]-h)*g;l+=(b[n+c.Y]-l)*g}k?(a.x=a.data.x+h*d,a.y=a.data.y+l*d):(a.x+=(a.data.x+h-a.x)*d,a.y+=(a.data.y+l-a.y)*d)}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_X=-2;c.PREV_Y=-1;c.X=1;c.Y=2;return c}(b);a.TranslateTimeline=l;var g=function(b){function c(a){b.call(this,a)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.scale<<24)+this.boneIndex};c.prototype.apply= +function(b,g,k,h,d,l,m){var n=this.frames;b=b.bones[this.boneIndex];if(k=n[n.length-c.ENTRIES])g=n[n.length+c.PREV_X]*b.data.scaleX,h=n[n.length+c.PREV_Y]*b.data.scaleY;else{var p=e.binarySearch(n,k,c.ENTRIES);g=n[p+c.PREV_X];h=n[p+c.PREV_Y];var t=n[p];k=this.getCurvePercent(p/c.ENTRIES-1,1-(k-t)/(n[p+c.PREV_TIME]-t));g=(g+(n[p+c.X]-g)*k)*b.data.scaleX;h=(h+(n[p+c.Y]-h)*k)*b.data.scaleY}1==d?(b.scaleX=g,b.scaleY=h):(l?(l=b.data.scaleX, +k=b.data.scaleY):(l=b.scaleX,k=b.scaleY),m?(g=Math.abs(g)*a.MathUtils.signum(l),h=Math.abs(h)*a.MathUtils.signum(k)):(l=Math.abs(l)*a.MathUtils.signum(g),k=Math.abs(k)*a.MathUtils.signum(h)),b.scaleX=l+(g-l)*d,b.scaleY=k+(h-k)*d)}};return c}(l);a.ScaleTimeline=g;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.shear<<24)+this.boneIndex};b.prototype.apply=function(a,c,g,h,d,k,l){c=this.frames;a=a.bones[this.boneIndex];if(g=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_X],l=c[c.length+b.PREV_Y];else{var n=e.binarySearch(c,g,b.ENTRIES);h=c[n+b.PREV_X];l=c[n+b.PREV_Y];var p=c[n];g=this.getCurvePercent(n/b.ENTRIES-1,1-(g-p)/(c[n+b.PREV_TIME]-p));h+=(c[n+b.X]-h)*g;l+=(c[n+b.Y]-l)*g}k?(a.shearX=a.data.shearX+h*d,a.shearY=a.data.shearY+l*d):(a.shearX+=(a.data.shearX+h-a.shearX)*d,a.shearY+=(a.data.shearY+l-a.shearY)*d)}};return b}(l);a.ShearTimeline=l;l=function(b){function c(g){b.call(this, +g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.color<<24)+this.slotIndex};c.prototype.setFrame=function(a,b,g,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.R]=g;this.frames[a+c.G]=h;this.frames[a+c.B]=d;this.frames[a+c.A]=k};c.prototype.apply=function(a,b,g,h,d,k,l){a=a.slots[this.slotIndex];var n=this.frames;if(g=n[n.length-c.ENTRIES])g=n.length,b=n[g+c.PREV_R],h=n[g+ +c.PREV_G],l=n[g+c.PREV_B],p=n[g+c.PREV_A];else{var m=e.binarySearch(n,g,c.ENTRIES);b=n[m+c.PREV_R];h=n[m+c.PREV_G];l=n[m+c.PREV_B];p=n[m+c.PREV_A];var t=n[m];g=this.getCurvePercent(m/c.ENTRIES-1,1-(g-t)/(n[m+c.PREV_TIME]-t));b+=(n[m+c.R]-b)*g;h+=(n[m+c.G]-h)*g;l+=(n[m+c.B]-l)*g;p+=(n[m+c.A]-p)*g}1==d?a.color.set(b,h,l,p):(g=a.color,k&&g.setFromColor(a.data.color),g.add((b-g.r)*d,(h-g.g)*d,(l-g.b)*d,(p-g.a)*d))}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_R=-4;c.PREV_G=-3;c.PREV_B=-2;c.PREV_A=-1;c.R=1;c.G= +2;c.B=3;c.A=4;return c}(b);a.ColorTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}b.prototype.getPropertyId=function(){return(m.attachment<<24)+this.slotIndex};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};b.prototype.apply=function(a,b,c,g,h,d,l){b=a.slots[this.slotIndex];l&&d?(c=b.data.attachmentName,b.setAttachment(null==c?null:a.getAttachment(this.slotIndex, +c))):(l=this.frames,c=l[l.length-1]?l.length-1:e.binarySearch(l,c,1)-1,c=this.attachmentNames[c],a.slots[this.slotIndex].setAttachment(null==c?null:a.getAttachment(this.slotIndex,c))))};return b}();a.AttachmentTimeline=l;l=function(b){function c(c){b.call(this,c);this.frames=a.Utils.newFloatArray(c);this.frameVertices=Array(c)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.deform<< +24)+this.slotIndex};c.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};c.prototype.apply=function(b,c,g,h,d,k,l){b=b.slots[this.slotIndex];var n=b.getAttachment();if(n instanceof a.VertexAttachment&&n.applyDeform(this.attachment)){var p=this.frames;c=b.attachmentVertices;if(g=p[p.length-1])if(g=l[p.length-1],1==d)a.Utils.arrayCopy(g,0,c,0,b);else if(k)if(k= +n,null==k.bones)for(k=k.vertices,n=0;nc)this.apply(a,b,Number.MAX_VALUE,g,h,d,l),b=-1;else if(b>=k[n-1])return;if(!(c=k[a];a++)g.push(this.events[a])}}};return b}();a.EventTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}b.prototype.getPropertyId=function(){return m.drawOrder<<24};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};b.prototype.apply=function(b,c,g,l,h,d,m){c=b.drawOrder;l=b.slots; +if(m&&d)a.Utils.arrayCopy(b.slots,0,b.drawOrder,0,b.slots.length);else if(m=this.frames,g=m[m.length-1]?m.length-1:e.binarySearch(m,g)-1,b=this.drawOrders[b],null==b)a.Utils.arrayCopy(l,0,c,0,l.length);else for(g=0,d=b.length;g=b[b.length-c.ENTRIES])k?(a.mix=a.data.mix+(b[b.length+c.PREV_MIX]-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[b.length+c.PREV_BEND_DIRECTION]):(a.mix+=(b[b.length+ +c.PREV_MIX]-a.mix)*d,l||(a.bendDirection=b[b.length+c.PREV_BEND_DIRECTION]));else{h=e.binarySearch(b,g,c.ENTRIES);var n=b[h+c.PREV_MIX],m=b[h];g=this.getCurvePercent(h/c.ENTRIES-1,1-(g-m)/(b[h+c.PREV_TIME]-m));k?(a.mix=a.data.mix+(n+(b[h+c.MIX]-n)*g-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[h+c.PREV_BEND_DIRECTION]):(a.mix+=(n+(b[h+c.MIX]-n)*g-a.mix)*d,l||(a.bendDirection=b[h+c.PREV_BEND_DIRECTION]))}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_MIX=-2;c.PREV_BEND_DIRECTION=-1;c.MIX=1;c.BEND_DIRECTION= +2;return c}(b);a.IkConstraintTimeline=l;l=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.transformConstraint<<24)+this.transformConstraintIndex};c.prototype.setFrame=function(a,b,g,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=g;this.frames[a+c.TRANSLATE]=h;this.frames[a+c.SCALE]=d;this.frames[a+c.SHEAR]=k};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.transformConstraints[this.transformConstraintIndex]; +if(g=b[b.length-c.ENTRIES])g=b.length,h=b[g+c.PREV_ROTATE],l=b[g+c.PREV_TRANSLATE],n=b[g+c.PREV_SCALE],m=b[g+c.PREV_SHEAR];else{var p=e.binarySearch(b,g,c.ENTRIES);h=b[p+c.PREV_ROTATE];l=b[p+c.PREV_TRANSLATE];n=b[p+c.PREV_SCALE];m=b[p+c.PREV_SHEAR];var t=b[p];g=this.getCurvePercent(p/c.ENTRIES-1,1-(g-t)/(b[p+c.PREV_TIME]-t));h+=(b[p+c.ROTATE]-h)*g;l+=(b[p+c.TRANSLATE]- +l)*g;n+=(b[p+c.SCALE]-n)*g;m+=(b[p+c.SHEAR]-m)*g}k?(k=a.data,a.rotateMix=k.rotateMix+(h-k.rotateMix)*d,a.translateMix=k.translateMix+(l-k.translateMix)*d,a.scaleMix=k.scaleMix+(n-k.scaleMix)*d,a.shearMix=k.shearMix+(m-k.shearMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d,a.scaleMix+=(n-a.scaleMix)*d,a.shearMix+=(m-a.shearMix)*d)}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_ROTATE=-4;c.PREV_TRANSLATE=-3;c.PREV_SCALE=-2;c.PREV_SHEAR=-1;c.ROTATE=1;c.TRANSLATE=2;c.SCALE=3;c.SHEAR= +4;return c}(b);a.TransformConstraintTimeline=l;l=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintPosition<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,g){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.VALUE]=g};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=b[b.length- +c.ENTRIES])h=b[b.length+c.PREV_VALUE];else{l=e.binarySearch(b,g,c.ENTRIES);h=b[l+c.PREV_VALUE];var n=b[l];g=this.getCurvePercent(l/c.ENTRIES-1,1-(g-n)/(b[l+c.PREV_TIME]-n));h+=(b[l+c.VALUE]-h)*g}a.position=k?a.data.position+(h-a.data.position)*d:a.position+(h-a.position)*d}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_VALUE=-1;c.VALUE=1;return c}(b);a.PathConstraintPositionTimeline=l;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.pathConstraintSpacing<< +24)+this.pathConstraintIndex};b.prototype.apply=function(a,c,g,h,d,k,l){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_VALUE];else{l=e.binarySearch(c,g,b.ENTRIES);h=c[l+b.PREV_VALUE];var n=c[l];g=this.getCurvePercent(l/b.ENTRIES-1,1-(g-n)/(c[l+b.PREV_TIME]-n));h+=(c[l+b.VALUE]-h)*g}a.spacing=k?a.data.spacing+(h-a.data.spacing)*d:a.spacing+(h-a.spacing)*d}};return b}(l);a.PathConstraintSpacingTimeline= +l;b=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintMix<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,g,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=g;this.frames[a+c.TRANSLATE]=h};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_ROTATE],l=b[b.length+c.PREV_TRANSLATE];else{var n=e.binarySearch(b,g,c.ENTRIES);h=b[n+c.PREV_ROTATE];l=b[n+c.PREV_TRANSLATE];var m=b[n];g=this.getCurvePercent(n/c.ENTRIES-1,1-(g-m)/(b[n+c.PREV_TIME]-m));h+=(b[n+c.ROTATE]-h)*g;l+=(b[n+c.TRANSLATE]-l)*g}k?(a.rotateMix=a.data.rotateMix+(h-a.data.rotateMix)*d,a.translateMix=a.data.translateMix+(l-a.data.translateMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d)}};c.ENTRIES= 3;c.PREV_TIME=-3;c.PREV_ROTATE=-2;c.PREV_TRANSLATE=-1;c.ROTATE=1;c.TRANSLATE=2;return c}(b);a.PathConstraintMixTimeline=b})(spine||(spine={})); -(function(a){var g=function(){function f(c){this.tracks=[];this.events=[];this.listeners=[];this.queue=new b(this);this.propertyIDs=new a.IntSet;this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new m});this.data=c}f.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,f=b.length;c=g.trackEnd&&null==g.mixingFrom){b[c]=null;this.queue.end(g);this.disposeNext(g);continue}this.updateMixingFrom(g,a);g.trackTime+=h}}this.queue.drain()};f.prototype.updateMixingFrom=function(a,b){var c=a.mixingFrom;null!=c&&(this.updateMixingFrom(c,b),a.mixTime>= -a.mixDuration&&null!=c.mixingFrom&&0= +(function(a){var e=function(){function g(c){this.tracks=[];this.events=[];this.listeners=[];this.queue=new b(this);this.propertyIDs=new a.IntSet;this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new m});this.data=c}g.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,g=b.length;c=e.trackEnd&&null==e.mixingFrom){b[c]=null;this.queue.end(e);this.disposeNext(e);continue}this.updateMixingFrom(e,a);e.trackTime+=h}}this.queue.drain()};g.prototype.updateMixingFrom=function(a,b){var c=a.mixingFrom;null!=c&&(this.updateMixingFrom(c,b),a.mixTime>= +a.mixDuration&&null!=c.mixingFrom&&0= h.trackEnd&&(d=0);var m=h.animationLast,w=h.getAnimationTime(),y=h.animation.timelines.length,x=h.animation.timelines;if(1==d)for(var q=0;q=c[c.length-a.RotateTimeline.ENTRIES])c=f.data.rotation+c[c.length+a.RotateTimeline.PREV_ROTATION];else{var k=a.Animation.binarySearch(c,g,a.RotateTimeline.ENTRIES),n=c[k+a.RotateTimeline.PREV_ROTATION],p=c[k];b=b.getCurvePercent((k>>1)-1,1-(g-p)/(c[k+a.RotateTimeline.PREV_TIME]-p));c=c[k+a.RotateTimeline.ROTATION]-n;c=n+(c-360*(16384-(16384.499999999996-c/360|0)))*b+f.data.rotation;c-=360*(16384- -(16384.499999999996-c/360|0))}m=m?f.data.rotation:f.rotation;c-=m;0==c?g=h[d]:(c-=360*(16384-(16384.499999999996-c/360|0)),v?(v=0,g=c):(v=h[d],g=h[d+1]),n=0=Math.abs(g)&&(180f||this.queue.event(a,m)}for((a.loop?h>a.trackTime%k:b>=f&&a.animationLast= -this.tracks.length)&&(a=this.tracks[a],null!=a)){this.queue.end(a);this.disposeNext(a);for(var b=a;;){var c=b.mixingFrom;if(null==c)break;this.queue.end(c);b.mixingFrom=null;b=c}this.tracks[a.trackIndex]=null;this.queue.drain()}};f.prototype.setCurrent=function(a,b,f){var c=this.expandToIndex(a);this.tracks[a]=b;null!=c&&(f&&this.queue.interrupt(c),b.mixingFrom=c,b.mixTime=0,c.timelinesRotation.length=0,null!=c.mixingFrom&&0=g&&(a=c.animationEnd-c.animationStart, -g=0!=a?g+(a*(1+(c.trackTime/a|0))-this.data.getMix(c.animation,b)):0));f.delay=g;return f};f.prototype.setEmptyAnimation=function(a,b){a=this.setAnimationWith(a,f.emptyAnimation,!1);a.mixDuration=b;a.trackEnd=b;return a};f.prototype.addEmptyAnimation=function(a,b,g){0>=g&&(g-=b);a=this.addAnimationWith(a,f.emptyAnimation,!1,g);a.mixDuration=b;a.trackEnd=b;return a};f.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,f=this.tracks.length;c< -f;c++){var g=this.tracks[c];null!=g&&this.setEmptyAnimation(g.trackIndex,a)}this.queue.drainDisabled=b;this.queue.drain()};f.prototype.expandToIndex=function(b){if(b=this.tracks.length?null:this.tracks[a]};f.prototype.addListener=function(a){if(null==a)throw Error('listener cannot be null.');this.listeners.push(a)};f.prototype.removeListener= -function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};f.prototype.clearListeners=function(){this.listeners.length=0};f.prototype.clearListenerNotifications=function(){this.queue.clear()};f.emptyAnimation=new a.Animation('',[],0);return f}();a.AnimationState=g;var m=function(){function a(){this.timelinesFirst=[];this.timelinesRotation=[]}a.prototype.reset=function(){this.listener=this.animation=this.mixingFrom=this.next=null;this.timelinesFirst.length=0;this.timelinesRotation.length= +w;h.nextTrackLast=h.trackTime}}this.queue.drain()};g.prototype.applyMixingFrom=function(b,g){var c=b.mixingFrom;null!=c.mixingFrom&&this.applyMixingFrom(c,g);var e;0==b.mixDuration?e=1:(e=b.mixTime/b.mixDuration,1=c[c.length-a.RotateTimeline.ENTRIES])c=g.data.rotation+c[c.length+a.RotateTimeline.PREV_ROTATION];else{var k=a.Animation.binarySearch(c,e,a.RotateTimeline.ENTRIES),n=c[k+a.RotateTimeline.PREV_ROTATION],p=c[k];b=b.getCurvePercent((k>>1)-1,1-(e-p)/(c[k+a.RotateTimeline.PREV_TIME]-p));c=c[k+a.RotateTimeline.ROTATION]-n;c=n+(c-360*(16384-(16384.499999999996-c/360|0)))*b+g.data.rotation;c-=360*(16384- +(16384.499999999996-c/360|0))}m=m?g.data.rotation:g.rotation;c-=m;0==c?e=h[d]:(c-=360*(16384-(16384.499999999996-c/360|0)),v?(v=0,e=c):(v=h[d],e=h[d+1]),n=0=Math.abs(e)&&(180g||this.queue.event(a,m)}for((a.loop?h>a.trackTime%e:b>=g&&a.animationLast= +this.tracks.length)&&(a=this.tracks[a],null!=a)){this.queue.end(a);this.disposeNext(a);for(var b=a;;){var c=b.mixingFrom;if(null==c)break;this.queue.end(c);b.mixingFrom=null;b=c}this.tracks[a.trackIndex]=null;this.queue.drain()}};g.prototype.setCurrent=function(a,b,g){var c=this.expandToIndex(a);this.tracks[a]=b;null!=c&&(g&&this.queue.interrupt(c),b.mixingFrom=c,b.mixTime=0,c.timelinesRotation.length=0,null!=c.mixingFrom&&0=e&&(a=c.animationEnd-c.animationStart, +e=0!=a?e+(a*(1+(c.trackTime/a|0))-this.data.getMix(c.animation,b)):0));g.delay=e;return g};g.prototype.setEmptyAnimation=function(a,b){a=this.setAnimationWith(a,g.emptyAnimation,!1);a.mixDuration=b;a.trackEnd=b;return a};g.prototype.addEmptyAnimation=function(a,b,e){0>=e&&(e-=b);a=this.addAnimationWith(a,g.emptyAnimation,!1,e);a.mixDuration=b;a.trackEnd=b;return a};g.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,g=this.tracks.length;c< +g;c++){var e=this.tracks[c];null!=e&&this.setEmptyAnimation(e.trackIndex,a)}this.queue.drainDisabled=b;this.queue.drain()};g.prototype.expandToIndex=function(b){if(b=this.tracks.length?null:this.tracks[a]};g.prototype.addListener=function(a){if(null==a)throw Error('listener cannot be null.');this.listeners.push(a)};g.prototype.removeListener= +function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};g.prototype.clearListeners=function(){this.listeners.length=0};g.prototype.clearListenerNotifications=function(){this.queue.clear()};g.emptyAnimation=new a.Animation('',[],0);return g}();a.AnimationState=e;var m=function(){function a(){this.timelinesFirst=[];this.timelinesRotation=[]}a.prototype.reset=function(){this.listener=this.animation=this.mixingFrom=this.next=null;this.timelinesFirst.length=0;this.timelinesRotation.length= 0};a.prototype.getAnimationTime=function(){if(this.loop){var a=this.animationEnd-this.animationStart;return 0==a?this.animationStart:this.trackTime%a+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)};a.prototype.setAnimationLast=function(a){this.nextAnimationLast=this.animationLast=a};a.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart};a.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0}; return a}();a.TrackEntry=m;var b=function(){function a(a){this.objects=[];this.drainDisabled=!1;this.animState=a}a.prototype.start=function(a){this.objects.push(l.start);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.interrupt=function(a){this.objects.push(l.interrupt);this.objects.push(a)};a.prototype.end=function(a){this.objects.push(l.end);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.dispose=function(a){this.objects.push(l.dispose);this.objects.push(a)}; -a.prototype.complete=function(a){this.objects.push(l.complete);this.objects.push(a)};a.prototype.event=function(a,b){this.objects.push(l.event);this.objects.push(a);this.objects.push(b)};a.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var a=this.objects,b=this.animState.listeners,f=0;fk.status?(b.assets[a]=k.responseText,g&&g(a,k.responseText)):(b.errors[a]="Couldn't load text "+a+': status '+ -k.status+', '+k.responseText,f&&f(a,"Couldn't load text "+a+': status '+k.status+', '+k.responseText)),b.toLoad--,b.loaded++)};k.open('GET',a,!0);k.send()};a.prototype.loadTexture=function(a,g,f){var b=this;void 0===g&&(g=null);void 0===f&&(f=null);a=this.pathPrefix+a;this.toLoad++;var k=new Image;k.crossOrigin='anonymous';k.src=a;k.onload=function(c){c=b.textureLoader(k);b.assets[a]=c;b.toLoad--;b.loaded++;g&&g(a,k)};k.onerror=function(c){b.errors[a]="Couldn't load image "+a;b.toLoad--;b.loaded++; -f&&f(a,"Couldn't load image "+a)}};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a=this.pathPrefix+a;var b=this.assets[a];b.dispose&&b.dispose();this.assets[a]=null};a.prototype.removeAll=function(){for(var a in this.assets){var g=this.assets[a];g.dispose&&g.dispose()}this.assets={}};a.prototype.isLoadingComplete=function(){return 0==this.toLoad};a.prototype.getToLoad=function(){return this.toLoad};a.prototype.getLoaded=function(){return this.loaded}; -a.prototype.dispose=function(){this.removeAll()};a.prototype.hasErrors=function(){return 0>1);if(null==this.worldVertices||this.worldVertices.length!=c)this.worldVertices=a.Utils.newFloatArray(c);var g,n,m;null==this.region?(c=g=0,n=m=1):(c=this.region.u,g=this.region.v,n=this.region.u2-c,m=this.region.v2-g);if(this.region.rotate)for(var t=0,h=6;td*y-p*w:this.skeleton.flipX!=this.skeleton.flipY)this.b=-this.b,this.d=-this.d;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};g.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};g.prototype.getWorldRotationX=function(){return Math.atan2(this.c, -this.a)*a.MathUtils.radDeg};g.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};g.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};g.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};g.prototype.worldToLocalRotationX=function(){var b=this.parent;if(null==b)return this.arotation;var g=this.a,f=this.c;return Math.atan2(b.a*f-b.c*g,b.d*g-b.b*f)*a.MathUtils.radDeg};g.prototype.worldToLocalRotationY= -function(){var b=this.parent;if(null==b)return this.arotation;var g=this.b,f=this.d;return Math.atan2(b.a*f-b.c*g,b.d*g-b.b*f)*a.MathUtils.radDeg};g.prototype.rotateWorld=function(b){var g=this.a,f=this.b,c=this.c,k=this.d,n=a.MathUtils.cosDeg(b);b=a.MathUtils.sinDeg(b);this.a=n*g-b*c;this.b=n*f-b*k;this.c=b*g+n*c;this.d=b*f+n*k;this.appliedValid=!1};g.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var b=this.parent;if(null==b)this.ax=this.worldX,this.ay=this.worldY,this.arotation= -Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var g=b.a,f=b.b,c=b.c,k=b.d,n=1/(g*k-f*c),m=this.worldX-b.worldX,b=this.worldY-b.worldY;this.ax=m*k*n-b*f*n;this.ay=b*g*n-m*c*n;k*=n;g*=n;f*=n;n*=c;c=k*this.a-f*this.c;f=k*this.b-f*this.d;k=g*this.c-n*this.a;n=g*this.d-n*this.b;this.ashearX= -0;this.ascaleX=Math.sqrt(c*c+k*k);1E-4a)throw Error('index must be >= 0.');if(null==g)throw Error('name cannot be null.');this.index=a;this.name=g;this.parent=f}}();a.BoneData=g;(function(a){a[a.Normal=0]='Normal';a[a.OnlyTranslation=1]='OnlyTranslation';a[a.NoRotationOrReflection=2]='NoRotationOrReflection';a[a.NoScale=3]='NoScale';a[a.NoScaleOrReflection=4]='NoScaleOrReflection'})(a.TransformMode|| -(a.TransformMode={}));var m=a.TransformMode})(spine||(spine={}));(function(a){var g=function(){return function(a,b){if(null==b)throw Error('data cannot be null.');this.time=a;this.data=b}}();a.Event=g})(spine||(spine={}));(function(a){var g=function(){return function(a){this.name=a}}();a.EventData=g})(spine||(spine={})); -(function(a){var g=function(){function g(a,g){this.mix=1;this.bendDirection=0;if(null==a)throw Error('data cannot be null.');if(null==g)throw Error('skeleton cannot be null.');this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var b=0;bb.ascaleX&&(k+=180);180k&&(k+=360);b.updateWorldTransformWith(b.ax,b.ay, -b.arotation+k*c,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};g.prototype.apply2=function(b,g,f,c,k,n){if(0==n)g.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();g.appliedValid||g.updateAppliedTransform();var l=b.ax,m=b.ay,h=b.ascaleX,d=b.ascaleY,v=g.ascaleX,w,y,x;0>h?(h=-h,w=180,x=-1):(w=0,x=1);0>d&&(d=-d,x=-x);0>v?(v=-v,y=180):y=0;var q=g.ax,u,A,E,D=b.a,C=b.b,F=b.c,z=b.d,H=1E-4>=Math.abs(h-d);H?(u=g.ay,A=D*q+C*u+b.worldX,E=F*q+z*u+b.worldY):(u=0,A=D*q+b.worldX,E=F*q+b.worldY); -var G=b.parent,D=G.a,C=G.b,F=G.c,z=G.d,O=1/(D*z-C*F);f-=G.worldX;c-=G.worldY;var M=(f*z-c*C)*O-l,J=(c*D-f*F)*O-m;f=A-G.worldX;c=E-G.worldY;C=(f*z-c*C)*O-l;D=(c*D-f*F)*O-m;O=Math.sqrt(C*C+D*D);C=g.data.length*v;a:if(H)C*=h,D=(M*M+J*J-O*O-C*C)/(2*O*C),-1>D?D=-1:1f&&(z=-z),z=-(f+z)/2,f=z/J,z=F/z,z= -Math.abs(f)E&&(d=0,E=z,G=f);f=O-D;z=f*f;zE&&(d=v,E=z,G=f,P=c);H<=(F+E)/2?(D=M-Math.atan2(A*k,J),k*=h):(D=M-Math.atan2(P*k,G),k*=d)}C=Math.atan2(u,q)*x;O=b.arotation;D=(D-C)*a.MathUtils.radDeg+w-O;180D&&(D+= -360);b.updateWorldTransformWith(l,m,O+D*n,b.ascaleX,b.ascaleY,0,0);O=g.arotation;k=((k+C)*a.MathUtils.radDeg-g.ashearX)*x+y-O;180k&&(k+=360);g.updateWorldTransformWith(q,u,O+k*n,g.ascaleX,g.ascaleY,g.ashearX,g.ashearY)}};return g}();a.IkConstraint=g})(spine||(spine={}));(function(a){var g=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=g})(spine||(spine={})); -(function(a){var g=function(){function g(a,g){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==a)throw Error('data cannot be null.');if(null==g)throw Error('skeleton cannot be null.');this.data=a;this.bones=[];for(var b=0,c=a.bones.length;ba.MathUtils.PI?G-=a.MathUtils.PI2:G<-a.MathUtils.PI&&(G+=a.MathUtils.PI2);G*=g;O=Math.cos(G);M=Math.sin(G);D.a=O*F-M*z;D.b=O*C-M*H;D.c=M*F+O*z;D.d=M*C+O*H}D.appliedValid=!1}}}};g.prototype.computeWorldPositions= -function(b,l,f,c,k){var n=this.target,m=this.position,t=this.spaces,h=a.Utils.setArraySize(this.positions,3*l+2),d,v=b.closed,w=b.worldVerticesLength,y=w/6,x=g.NONE;if(!b.constantSpeed){var q=b.lengths,y=y-(v?1:2),u=q[y];c&&(m*=u);if(k)for(var A=0;AD&&(D+=u),k=0;else if(0>D){x!=g.BEFORE&&(x=g.BEFORE,b.computeWorldVerticesWith(n,2,4,d,0));this.addBeforePosition(D,d,0,h,c);continue}else if(D> -u){x!=g.AFTER&&(x=g.AFTER,b.computeWorldVerticesWith(n,w-6,4,d,0));this.addAfterPosition(D-u,d,0,h,c);continue}for(;;k++){var C=q[k];if(!(D>C)){if(0==k)D/=C;else var F=q[k-1],D=(D-F)/(C-F);break}}k!=x&&(x=k,v&&k==y?(b.computeWorldVerticesWith(n,w-4,4,d,0),b.computeWorldVerticesWith(n,0,4,d,4)):b.computeWorldVerticesWith(n,6*k+2,8,d,0));this.addCurvePosition(D,d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],h,c,f||0k.status?(b.assets[a]=k.responseText,e&&e(a,k.responseText)):(b.errors[a]="Couldn't load text "+a+': status '+ +k.status+', '+k.responseText,g&&g(a,"Couldn't load text "+a+': status '+k.status+', '+k.responseText)),b.toLoad--,b.loaded++)};k.open('GET',a,!0);k.send()};a.prototype.loadTexture=function(a,e,g){var b=this;void 0===e&&(e=null);void 0===g&&(g=null);a=this.pathPrefix+a;this.toLoad++;var k=new Image;k.crossOrigin='anonymous';k.src=a;k.onload=function(c){c=b.textureLoader(k);b.assets[a]=c;b.toLoad--;b.loaded++;e&&e(a,k)};k.onerror=function(c){b.errors[a]="Couldn't load image "+a;b.toLoad--;b.loaded++; +g&&g(a,"Couldn't load image "+a)}};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a=this.pathPrefix+a;var b=this.assets[a];b.dispose&&b.dispose();this.assets[a]=null};a.prototype.removeAll=function(){for(var a in this.assets){var e=this.assets[a];e.dispose&&e.dispose()}this.assets={}};a.prototype.isLoadingComplete=function(){return 0==this.toLoad};a.prototype.getToLoad=function(){return this.toLoad};a.prototype.getLoaded=function(){return this.loaded}; +a.prototype.dispose=function(){this.removeAll()};a.prototype.hasErrors=function(){return 0>1);if(null==this.worldVertices||this.worldVertices.length!=c)this.worldVertices=a.Utils.newFloatArray(c);var e,n,m;null==this.region?(c=e=0,n=m=1):(c=this.region.u,e=this.region.v,n=this.region.u2-c,m=this.region.v2-e);if(this.region.rotate)for(var t=0,h=6;td*y-p*w:this.skeleton.flipX!=this.skeleton.flipY)this.b=-this.b,this.d=-this.d;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};e.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};e.prototype.getWorldRotationX=function(){return Math.atan2(this.c, +this.a)*a.MathUtils.radDeg};e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};e.prototype.worldToLocalRotationX=function(){var b=this.parent;if(null==b)return this.arotation;var e=this.a,g=this.c;return Math.atan2(b.a*g-b.c*e,b.d*e-b.b*g)*a.MathUtils.radDeg};e.prototype.worldToLocalRotationY= +function(){var b=this.parent;if(null==b)return this.arotation;var e=this.b,g=this.d;return Math.atan2(b.a*g-b.c*e,b.d*e-b.b*g)*a.MathUtils.radDeg};e.prototype.rotateWorld=function(b){var e=this.a,g=this.b,c=this.c,k=this.d,n=a.MathUtils.cosDeg(b);b=a.MathUtils.sinDeg(b);this.a=n*e-b*c;this.b=n*g-b*k;this.c=b*e+n*c;this.d=b*g+n*k;this.appliedValid=!1};e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var b=this.parent;if(null==b)this.ax=this.worldX,this.ay=this.worldY,this.arotation= +Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var e=b.a,g=b.b,c=b.c,k=b.d,n=1/(e*k-g*c),m=this.worldX-b.worldX,b=this.worldY-b.worldY;this.ax=m*k*n-b*g*n;this.ay=b*e*n-m*c*n;k*=n;e*=n;g*=n;n*=c;c=k*this.a-g*this.c;g=k*this.b-g*this.d;k=e*this.c-n*this.a;n=e*this.d-n*this.b;this.ashearX= +0;this.ascaleX=Math.sqrt(c*c+k*k);1E-4a)throw Error('index must be >= 0.');if(null==e)throw Error('name cannot be null.');this.index=a;this.name=e;this.parent=g}}();a.BoneData=e;(function(a){a[a.Normal=0]='Normal';a[a.OnlyTranslation=1]='OnlyTranslation';a[a.NoRotationOrReflection=2]='NoRotationOrReflection';a[a.NoScale=3]='NoScale';a[a.NoScaleOrReflection=4]='NoScaleOrReflection'})(a.TransformMode|| +(a.TransformMode={}));var m=a.TransformMode})(spine||(spine={}));(function(a){var e=function(){return function(a,b){if(null==b)throw Error('data cannot be null.');this.time=a;this.data=b}}();a.Event=e})(spine||(spine={}));(function(a){var e=function(){return function(a){this.name=a}}();a.EventData=e})(spine||(spine={})); +(function(a){var e=function(){function e(a,e){this.mix=1;this.bendDirection=0;if(null==a)throw Error('data cannot be null.');if(null==e)throw Error('skeleton cannot be null.');this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var b=0;bb.ascaleX&&(k+=180);180k&&(k+=360);b.updateWorldTransformWith(b.ax,b.ay, +b.arotation+k*c,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};e.prototype.apply2=function(b,e,g,c,k,n){if(0==n)e.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();e.appliedValid||e.updateAppliedTransform();var l=b.ax,m=b.ay,h=b.ascaleX,d=b.ascaleY,v=e.ascaleX,w,y,x;0>h?(h=-h,w=180,x=-1):(w=0,x=1);0>d&&(d=-d,x=-x);0>v?(v=-v,y=180):y=0;var q=e.ax,u,A,E,D=b.a,C=b.b,F=b.c,z=b.d,H=1E-4>=Math.abs(h-d);H?(u=e.ay,A=D*q+C*u+b.worldX,E=F*q+z*u+b.worldY):(u=0,A=D*q+b.worldX,E=F*q+b.worldY); +var G=b.parent,D=G.a,C=G.b,F=G.c,z=G.d,O=1/(D*z-C*F);g-=G.worldX;c-=G.worldY;var M=(g*z-c*C)*O-l,J=(c*D-g*F)*O-m;g=A-G.worldX;c=E-G.worldY;C=(g*z-c*C)*O-l;D=(c*D-g*F)*O-m;O=Math.sqrt(C*C+D*D);C=e.data.length*v;a:if(H)C*=h,D=(M*M+J*J-O*O-C*C)/(2*O*C),-1>D?D=-1:1g&&(z=-z),z=-(g+z)/2,g=z/J,z=F/z,z= +Math.abs(g)E&&(d=0,E=z,G=g);g=O-D;z=g*g;zE&&(d=v,E=z,G=g,P=c);H<=(F+E)/2?(D=M-Math.atan2(A*k,J),k*=h):(D=M-Math.atan2(P*k,G),k*=d)}C=Math.atan2(u,q)*x;O=b.arotation;D=(D-C)*a.MathUtils.radDeg+w-O;180D&&(D+= +360);b.updateWorldTransformWith(l,m,O+D*n,b.ascaleX,b.ascaleY,0,0);O=e.arotation;k=((k+C)*a.MathUtils.radDeg-e.ashearX)*x+y-O;180k&&(k+=360);e.updateWorldTransformWith(q,u,O+k*n,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};return e}();a.IkConstraint=e})(spine||(spine={}));(function(a){var e=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=e})(spine||(spine={})); +(function(a){var e=function(){function e(a,e){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==a)throw Error('data cannot be null.');if(null==e)throw Error('skeleton cannot be null.');this.data=a;this.bones=[];for(var b=0,c=a.bones.length;ba.MathUtils.PI?G-=a.MathUtils.PI2:G<-a.MathUtils.PI&&(G+=a.MathUtils.PI2);G*=e;O=Math.cos(G);M=Math.sin(G);D.a=O*F-M*z;D.b=O*C-M*H;D.c=M*F+O*z;D.d=M*C+O*H}D.appliedValid=!1}}}};e.prototype.computeWorldPositions= +function(b,l,g,c,k){var n=this.target,m=this.position,t=this.spaces,h=a.Utils.setArraySize(this.positions,3*l+2),d,v=b.closed,w=b.worldVerticesLength,y=w/6,x=e.NONE;if(!b.constantSpeed){var q=b.lengths,y=y-(v?1:2),u=q[y];c&&(m*=u);if(k)for(var A=0;AD&&(D+=u),k=0;else if(0>D){x!=e.BEFORE&&(x=e.BEFORE,b.computeWorldVerticesWith(n,2,4,d,0));this.addBeforePosition(D,d,0,h,c);continue}else if(D> +u){x!=e.AFTER&&(x=e.AFTER,b.computeWorldVerticesWith(n,w-6,4,d,0));this.addAfterPosition(D-u,d,0,h,c);continue}for(;;k++){var C=q[k];if(!(D>C)){if(0==k)D/=C;else var F=q[k-1],D=(D-F)/(C-F);break}}k!=x&&(x=k,v&&k==y?(b.computeWorldVerticesWith(n,w-4,4,d,0),b.computeWorldVerticesWith(n,0,4,d,4)):b.computeWorldVerticesWith(n,6*k+2,8,d,0));this.addCurvePosition(D,d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],h,c,g||0D&&(D+=n),k=0;else if(0>D){this.addBeforePosition(D,d,0,h,c);continue}else if(D>n){this.addAfterPosition(D-n,d,w-4,h,c);continue}for(;;k++)if(V=b[k],!(D>V)){0==k?D/=V:(F=b[k-1],D=(D-F)/(V-F));break}if(k!=x){var x=k,fa=6*k,q=d[fa],u=d[fa+1],C=d[fa+2],z=d[fa+3], -H=d[fa+4],G=d[fa+5],O=d[fa+6],M=d[fa+7];J=.03*(q-2*C+H);P=.03*(u-2*z+G);F=.006*(3*(C-H)-q+O);N=.006*(3*(z-G)-u+M);V=2*J+F;X=2*P+N;J=.3*(C-q)+J+.16666667*F;P=.3*(z-u)+P+.16666667*N;T=Math.sqrt(J*J+P*P);y[0]=T;for(fa=1;8>fa;fa++)J+=V,P+=X,V+=F,X+=N,T+=Math.sqrt(J*J+P*P),y[fa]=T;J+=V;P+=X;T+=Math.sqrt(J*J+P*P);y[8]=T;J+=V+F;P+=X+N;T+=Math.sqrt(J*J+P*P);y[9]=T;N=0}for(D*=T;;N++)if(V=y[N],!(D>V)){0==N?D/=V:(F=y[N-1],D=N+(D-F)/(V-F));break}this.addCurvePosition(.1*D,q,u,C,z,H,G,O,M,h,c,f||0f.status?c.rawAssets[b]=f.responseText:c.errors[b]="Couldn't load text "+b+': status '+f.status+', '+f.responseText)};f.open('GET',b,!0);f.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var f= -new XMLHttpRequest;f.onreadystatechange=function(){f.readyState==XMLHttpRequest.DONE&&(200<=f.status&&300>f.status?c.rawAssets[b]=JSON.parse(f.responseText):c.errors[b]="Couldn't load text "+b+': status '+f.status+', '+f.responseText)};f.open('GET',b,!0);f.send()}};a.prototype.loadTexture=function(a,b,c){var f=this;c=this.pathPrefix+c;if(this.queueAsset(a,b,c)){var g=new Image;g.src=c;g.crossOrigin='anonymous';g.onload=function(a){f.rawAssets[c]=g};g.onerror=function(a){f.errors[c]="Couldn't load image "+ -c}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;a=this.clientAssets[a];return null===a||void 0===a?!0:a.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;bfa;fa++)J+=V,P+=X,V+=F,X+=N,T+=Math.sqrt(J*J+P*P),y[fa]=T;J+=V;P+=X;T+=Math.sqrt(J*J+P*P);y[8]=T;J+=V+F;P+=X+N;T+=Math.sqrt(J*J+P*P);y[9]=T;N=0}for(D*=T;;N++)if(V=y[N],!(D>V)){0==N?D/=V:(F=y[N-1],D=N+(D-F)/(V-F));break}this.addCurvePosition(.1*D,q,u,C,z,H,G,O,M,h,c,g||0g.status?c.rawAssets[b]=g.responseText:c.errors[b]="Couldn't load text "+b+': status '+g.status+', '+g.responseText)};g.open('GET',b,!0);g.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var g= +new XMLHttpRequest;g.onreadystatechange=function(){g.readyState==XMLHttpRequest.DONE&&(200<=g.status&&300>g.status?c.rawAssets[b]=JSON.parse(g.responseText):c.errors[b]="Couldn't load text "+b+': status '+g.status+', '+g.responseText)};g.open('GET',b,!0);g.send()}};a.prototype.loadTexture=function(a,b,c){var g=this;c=this.pathPrefix+c;if(this.queueAsset(a,b,c)){var e=new Image;e.src=c;e.crossOrigin='anonymous';e.onload=function(a){g.rawAssets[c]=e};e.onerror=function(a){g.errors[c]="Couldn't load image "+ +c}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;a=this.clientAssets[a];return null===a||void 0===a?!0:a.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;b=this.minX&&a<=this.maxX&&g>=this.minY&&g<=this.maxY};g.prototype.aabbIntersectsSegment=function(a,g,f,c){var b=this.minX,l=this.minY,m=this.maxX,t=this.maxY;if(a<=b&&f<=b||g<=l&&c<=l||a>=m&&f>=m||g>=t&&c>=t)return!1;f=(c-g)/(f-a);c=f*(b-a)+g;if(c>l&&cl&&cb&&lb&&la.minX&&this.minYa.minY};g.prototype.containsPoint=function(a,g){for(var b=this.polygons,c=0,k=b.length;c=f||h=f){var d=a[m];d+(f-t)/(h-t)*(a[k]-d)< -g&&(l=!l)}k=m}return l};g.prototype.intersectsSegment=function(a,g,f,c){for(var b=this.polygons,l=0,m=b.length;l=d&&u<=y||u>=y&&u<=d)&&(u>=g&&u<=c||u>=c&&u<=g)&&(d=(h*A-m*q)/E,(d>=v&&d<=x||d>=x&&d<=v)&&(d>= -f&&d<=k||d>=k&&d<=f)))return!0;d=y;v=x}return!1};g.prototype.getPolygon=function(a){if(null==a)throw Error('boundingBox cannot be null.');a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};g.prototype.getWidth=function(){return this.maxX-this.minX};g.prototype.getHeight=function(){return this.maxY-this.minY};return g}();a.SkeletonBounds=g})(spine||(spine={})); -(function(a){var g=function(){function a(){this.bones=[];this.slots=[];this.skins=[];this.events=[];this.animations=[];this.ikConstraints=[];this.transformConstraints=[];this.pathConstraints=[];this.fps=0}a.prototype.findBone=function(a){if(null==a)throw Error('boneName cannot be null.');for(var b=this.bones,f=0,c=b.length;f=this.minX&&a<=this.maxX&&e>=this.minY&&e<=this.maxY};e.prototype.aabbIntersectsSegment=function(a,e,g,c){var b=this.minX,l=this.minY,m=this.maxX,t=this.maxY;if(a<=b&&g<=b||e<=l&&c<=l||a>=m&&g>=m||e>=t&&c>=t)return!1;g=(c-e)/(g-a);c=g*(b-a)+e;if(c>l&&cl&&cb&&lb&&la.minX&&this.minYa.minY};e.prototype.containsPoint=function(a,e){for(var b=this.polygons,c=0,k=b.length;c=g||h=g){var d=a[m];d+(g-t)/(h-t)*(a[k]-d)< +e&&(l=!l)}k=m}return l};e.prototype.intersectsSegment=function(a,e,g,c){for(var b=this.polygons,l=0,m=b.length;l=d&&u<=y||u>=y&&u<=d)&&(u>=e&&u<=c||u>=c&&u<=e)&&(d=(h*A-m*q)/E,(d>=v&&d<=x||d>=x&&d<=v)&&(d>= +g&&d<=k||d>=k&&d<=g)))return!0;d=y;v=x}return!1};e.prototype.getPolygon=function(a){if(null==a)throw Error('boundingBox cannot be null.');a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};e.prototype.getWidth=function(){return this.maxX-this.minX};e.prototype.getHeight=function(){return this.maxY-this.minY};return e}();a.SkeletonBounds=e})(spine||(spine={})); +(function(a){var e=function(){function a(){this.bones=[];this.slots=[];this.skins=[];this.events=[];this.animations=[];this.ikConstraints=[];this.transformConstraints=[];this.pathConstraints=[];this.fps=0}a.prototype.findBone=function(a){if(null==a)throw Error('boneName cannot be null.');for(var b=this.bones,g=0,c=b.length;g=b.length&&(b.length=a+1);b[a]||(b[a]={});b[a][g]=f};a.prototype.getAttachment=function(a,g){return(a=this.attachments[a])?a[g]:null};a.prototype.attachAll=function(a,g){for(var b=0,c=0;cg)throw Error('index must be >= 0.');if(null==b)throw Error('name cannot be null.');if(null==l)throw Error('boneData cannot be null.');this.index=g;this.name=b;this.boneData=l}}();a.SlotData=g})(spine||(spine={})); -(function(a){var g=function(){function a(a){this._image=a}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case 'nearest':return m.Nearest;case 'linear':return m.Linear;case 'mipmap':return m.MipMap;case 'mipmapnearestnearest':return m.MipMapNearestNearest;case 'mipmaplinearnearest':return m.MipMapLinearNearest;case 'mipmapnearestlinear':return m.MipMapNearestLinear;case 'mipmaplinearlinear':return m.MipMapLinearLinear;default:throw Error('Unknown texture filter '+ -a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case 'mirroredtepeat':return b.MirroredRepeat;case 'clamptoedge':return b.ClampToEdge;case 'repeat':return b.Repeat;default:throw Error('Unknown texture wrap '+a);}};return a}();a.Texture=g;(function(a){a[a.Nearest=9728]='Nearest';a[a.Linear=9729]='Linear';a[a.MipMap=9987]='MipMap';a[a.MipMapNearestNearest=9984]='MipMapNearestNearest';a[a.MipMapLinearNearest=9985]='MipMapLinearNearest';a[a.MipMapNearestLinear=9986]='MipMapNearestLinear';a[a.MipMapLinearLinear= -9987]='MipMapLinearLinear'})(a.TextureFilter||(a.TextureFilter={}));var m=a.TextureFilter;(function(a){a[a.MirroredRepeat=33648]='MirroredRepeat';a[a.ClampToEdge=33071]='ClampToEdge';a[a.Repeat=10497]='Repeat'})(a.TextureWrap||(a.TextureWrap={}));var b=a.TextureWrap,g=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=g})(spine||(spine={})); -(function(a){var g=function(){function f(a,b){this.pages=[];this.regions=[];this.load(a,b)}f.prototype.load=function(c,f){if(null==f)throw Error('textureLoader cannot be null.');c=new m(c);for(var g=Array(4),k=null;;){var t=c.readLine();if(null==t)break;t=t.trim();if(0==t.length)k=null;else if(k){var h=new l;h.name=t;h.page=k;h.rotate='true'==c.readValue();c.readTuple(g);var t=parseInt(g[0]),d=parseInt(g[1]);c.readTuple(g);var v=parseInt(g[0]),w=parseInt(g[1]);h.u=t/k.width;h.v=d/k.height;h.rotate? -(h.u2=(t+w)/k.width,h.v2=(d+v)/k.height):(h.u2=(t+v)/k.width,h.v2=(d+w)/k.height);h.x=t;h.y=d;h.width=Math.abs(v);h.height=Math.abs(w);4==c.readTuple(g)&&4==c.readTuple(g)&&c.readTuple(g);h.originalWidth=parseInt(g[0]);h.originalHeight=parseInt(g[1]);c.readTuple(g);h.offsetX=parseInt(g[0]);h.offsetY=parseInt(g[1]);h.index=parseInt(c.readValue());h.texture=k.texture;this.regions.push(h)}else k=new b,k.name=t,2==c.readTuple(g)&&(k.width=parseInt(g[0]),k.height=parseInt(g[1]),c.readTuple(g)),c.readTuple(g), -k.minFilter=a.Texture.filterFromString(g[0]),k.magFilter=a.Texture.filterFromString(g[1]),h=c.readValue(),k.uWrap=a.TextureWrap.ClampToEdge,k.vWrap=a.TextureWrap.ClampToEdge,'x'==h?k.uWrap=a.TextureWrap.Repeat:'y'==h?k.vWrap=a.TextureWrap.Repeat:'xy'==h&&(k.uWrap=k.vWrap=a.TextureWrap.Repeat),k.texture=f(t),k.texture.setFilters(k.minFilter,k.magFilter),k.texture.setWraps(k.uWrap,k.vWrap),k.width=k.texture.getImage().width,k.height=k.texture.getImage().height,this.pages.push(k)}};f.prototype.findRegion= -function(a){for(var b=0;b=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(':');if(-1==b)throw Error('Invalid line: '+ -a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(':');if(-1==c)throw Error('Invalid line: '+b);for(var f=0,c=c+1;3>f;f++){var g=b.indexOf(',',c);if(-1==g)break;a[f]=b.substr(c,g-c).trim();c=g+1}a[f]=b.substring(c).trim();return f+1};return a}(),b=function(){return function(){}}();a.TextureAtlasPage=b;var l=function(a){function b(){a.apply(this,arguments)}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=l})(spine||(spine={})); -(function(a){var g=function(){function g(b,g){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==b)throw Error('data cannot be null.');if(null==g)throw Error('skeleton cannot be null.');this.data=b;this.rotateMix=b.rotateMix;this.translateMix=b.translateMix;this.scaleMix=b.scaleMix;this.shearMix=b.shearMix;this.bones=[];for(var f=0;fa.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2);var C=C*b,F=Math.cos(C), -C=Math.sin(C);q.a=F*A-C*E;q.b=F*u-C*D;q.c=C*A+F*E;q.d=C*u+F*D;u=!0}0!=g&&(u=this.temp,k.localToWorld(u.set(this.data.offsetX,this.data.offsetY)),q.worldX+=(u.x-q.worldX)*g,q.worldY+=(u.y-q.worldY)*g,u=!0);0a.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2),C=A+(C+d)*c,u=Math.sqrt(u*u+D*D),q.b=Math.cos(C)*u,q.d=Math.sin(C)*u,u=!0);u&&(q.appliedValid=!1)}};g.prototype.getOrder=function(){return this.data.order};return g}();a.TransformConstraint=g})(spine||(spine={})); -(function(a){var g=function(){return function(a){this.order=0;this.bones=[];this.offsetShearY=this.offsetScaleY=this.offsetScaleX=this.offsetY=this.offsetX=this.offsetRotation=this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;if(null==a)throw Error('name cannot be null.');this.name=a}}();a.TransformConstraintData=g})(spine||(spine={})); -(function(a){var g=function(){function a(){this.array=[]}a.prototype.add=function(a){var b=this.contains(a);this.array[a|0]=a|0;return!b};a.prototype.contains=function(a){return void 0!=this.array[a|0]};a.prototype.remove=function(a){this.array[a|0]=void 0};a.prototype.clear=function(){this.array.length=0};return a}();a.IntSet=g;g=function(){function a(a,g,f,c){void 0===a&&(a=0);void 0===g&&(g=0);void 0===f&&(f=0);void 0===c&&(c=0);this.r=a;this.g=g;this.b=f;this.a=c}a.prototype.set=function(a,g, -f,c){this.r=a;this.g=g;this.b=f;this.a=c;this.clamp();return this};a.prototype.setFromColor=function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a;return this};a.prototype.setFromString=function(a){a='#'==a.charAt(0)?a.substr(1):a;this.r=parseInt(a.substr(0,2),16)/255;this.g=parseInt(a.substr(2,2),16)/255;this.b=parseInt(a.substr(4,2),16)/255;this.a=(8!=a.length?255:parseInt(a.substr(6,2),16))/255;return this};a.prototype.add=function(a,g,f,c){this.r+=a;this.g+=g;this.b+=f;this.a+=c;this.clamp(); -return this};a.prototype.clamp=function(){0>this.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1f?f:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b* -a.degRad)};a.signum=function(a){return 0a?-1:0};a.toInt=function(a){return 0a?-b:b};a.PI=3.1415927;a.PI2=2*a.PI;a.radiansToDegrees=180/a.PI;a.radDeg=a.radiansToDegrees;a.degreesToRadians=a.PI/180;a.degRad=a.degreesToRadians;return a}();a.MathUtils=g;g=function(){function a(){}a.arrayCopy=function(a,g,f,c,k){for(var b=g;b=g?b:a.setArraySize(b,g,f)};a.newArray=function(a,g){for(var b=Array(a),c=0;cthis.maxDelta&&(this.delta=this.maxDelta);this.lastTime=a;this.frameCount++;1h;++h)b[h]=0;for(h=0;30-c>h;++h)b[h+c]=h/c| -0;c=f;for(h=0;30>h;++h)d[h]=c,c+=1<h;++h)b.table[h]=0;for(h=0;f>h;++h)b.table[d[c+h]]++;for(h=g=b.table[0]=0;16>h;++h)D[h]=g,g+=b.table[h];for(h=0;f>h;++h)d[c+h]&&(b.trans[D[d[c+h]]++]=h)}function n(b,d,c){if(!d)return c;for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>16-d;return b.tag>>>=d,b.bitcount-=d,f+c}function p(b,d){for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>=1,++h,c+=d.table[h],f-=d.table[h];while(0<=f);return b.tag=g,b.bitcount-=h,d.trans[c+f]}function t(b,d,c){for(;;){var f=p(b,d);if(256===f)return h;if(256>f)b.dest[b.destLen++]=f;else{var g,k,f=f-257,f=n(b,w[f],y[f]);g=p(b,c);for(k=g=b.destLen-n(b,x[g],q[g]);g+f>k;++k)b.dest[b.destLen++]=b.dest[k]}}}var h=0,d=new l,v=new l,w=new Uint8Array(30),y=new Uint16Array(30),x=new Uint8Array(30),q=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4, -12,3,13,2,14,1,15]),A=new l,E=new Uint8Array(320),D=new Uint16Array(16);(function(b,d){var c;for(c=0;7>c;++c)b.table[c]=0;b.table[7]=24;b.table[8]=152;b.table[9]=112;for(c=0;24>c;++c)b.trans[c]=256+c;for(c=0;144>c;++c)b.trans[24+c]=c;for(c=0;8>c;++c)b.trans[168+c]=280+c;for(c=0;112>c;++c)b.trans[176+c]=144+c;for(c=0;5>c;++c)d.table[c]=0;d.table[5]=32;for(c=0;32>c;++c)d.trans[c]=c})(d,v);c(w,y,4,3);c(x,q,2,1);w[28]=0;y[28]=258;m.exports=function(b,c){var g;b=new f(b,c);do{c=b;c.bitcount--||(c.tag= -c.source[c.sourceIndex++],c.bitcount=7);g=1&c.tag;switch(c=(c.tag>>>=1,g),n(b,2,0)){case 0:var l,m=l=void 0;for(g=b;8w;++w)E[w]=0;for(w=0;q>w;++w){var C=n(m,3,0);E[u[w]]=C}k(A,E,0,19);for(w=0;l+g>w;)switch(q=p(m,A),q){case 16:C=E[w-1];for(q=n(m,2,3);q;--q)E[w++]=C;break;case 17:for(q=n(m,3,3);q;--q)E[w++]=0;break;case 18:for(q=n(m,7,11);q;--q)E[w++]=0;break;default:E[w++]=q}k(x,E,0,l);k(y,E,l,g);g=t(b,b.ltree,b.dtree);break;default:g=-3}if(g!==h)throw Error('Data error');}while(!c);return b.destLen=b.length&&(b.length=a+1);b[a]||(b[a]={});b[a][e]=g};a.prototype.getAttachment=function(a,e){return(a=this.attachments[a])?a[e]:null};a.prototype.attachAll=function(a,e){for(var b=0,c=0;ce)throw Error('index must be >= 0.');if(null==b)throw Error('name cannot be null.');if(null==l)throw Error('boneData cannot be null.');this.index=e;this.name=b;this.boneData=l}}();a.SlotData=e})(spine||(spine={})); +(function(a){var e=function(){function a(a){this._image=a}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case 'nearest':return m.Nearest;case 'linear':return m.Linear;case 'mipmap':return m.MipMap;case 'mipmapnearestnearest':return m.MipMapNearestNearest;case 'mipmaplinearnearest':return m.MipMapLinearNearest;case 'mipmapnearestlinear':return m.MipMapNearestLinear;case 'mipmaplinearlinear':return m.MipMapLinearLinear;default:throw Error('Unknown texture filter '+ +a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case 'mirroredtepeat':return b.MirroredRepeat;case 'clamptoedge':return b.ClampToEdge;case 'repeat':return b.Repeat;default:throw Error('Unknown texture wrap '+a);}};return a}();a.Texture=e;(function(a){a[a.Nearest=9728]='Nearest';a[a.Linear=9729]='Linear';a[a.MipMap=9987]='MipMap';a[a.MipMapNearestNearest=9984]='MipMapNearestNearest';a[a.MipMapLinearNearest=9985]='MipMapLinearNearest';a[a.MipMapNearestLinear=9986]='MipMapNearestLinear';a[a.MipMapLinearLinear= +9987]='MipMapLinearLinear'})(a.TextureFilter||(a.TextureFilter={}));var m=a.TextureFilter;(function(a){a[a.MirroredRepeat=33648]='MirroredRepeat';a[a.ClampToEdge=33071]='ClampToEdge';a[a.Repeat=10497]='Repeat'})(a.TextureWrap||(a.TextureWrap={}));var b=a.TextureWrap,e=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=e})(spine||(spine={})); +(function(a){var e=function(){function g(a,b){this.pages=[];this.regions=[];this.load(a,b)}g.prototype.load=function(c,g){if(null==g)throw Error('textureLoader cannot be null.');c=new m(c);for(var e=Array(4),k=null;;){var t=c.readLine();if(null==t)break;t=t.trim();if(0==t.length)k=null;else if(k){var h=new l;h.name=t;h.page=k;h.rotate='true'==c.readValue();c.readTuple(e);var t=parseInt(e[0]),d=parseInt(e[1]);c.readTuple(e);var v=parseInt(e[0]),w=parseInt(e[1]);h.u=t/k.width;h.v=d/k.height;h.rotate? +(h.u2=(t+w)/k.width,h.v2=(d+v)/k.height):(h.u2=(t+v)/k.width,h.v2=(d+w)/k.height);h.x=t;h.y=d;h.width=Math.abs(v);h.height=Math.abs(w);4==c.readTuple(e)&&4==c.readTuple(e)&&c.readTuple(e);h.originalWidth=parseInt(e[0]);h.originalHeight=parseInt(e[1]);c.readTuple(e);h.offsetX=parseInt(e[0]);h.offsetY=parseInt(e[1]);h.index=parseInt(c.readValue());h.texture=k.texture;this.regions.push(h)}else k=new b,k.name=t,2==c.readTuple(e)&&(k.width=parseInt(e[0]),k.height=parseInt(e[1]),c.readTuple(e)),c.readTuple(e), +k.minFilter=a.Texture.filterFromString(e[0]),k.magFilter=a.Texture.filterFromString(e[1]),h=c.readValue(),k.uWrap=a.TextureWrap.ClampToEdge,k.vWrap=a.TextureWrap.ClampToEdge,'x'==h?k.uWrap=a.TextureWrap.Repeat:'y'==h?k.vWrap=a.TextureWrap.Repeat:'xy'==h&&(k.uWrap=k.vWrap=a.TextureWrap.Repeat),k.texture=g(t),k.texture.setFilters(k.minFilter,k.magFilter),k.texture.setWraps(k.uWrap,k.vWrap),k.width=k.texture.getImage().width,k.height=k.texture.getImage().height,this.pages.push(k)}};g.prototype.findRegion= +function(a){for(var b=0;b=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(':');if(-1==b)throw Error('Invalid line: '+ +a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(':');if(-1==c)throw Error('Invalid line: '+b);for(var g=0,c=c+1;3>g;g++){var e=b.indexOf(',',c);if(-1==e)break;a[g]=b.substr(c,e-c).trim();c=e+1}a[g]=b.substring(c).trim();return g+1};return a}(),b=function(){return function(){}}();a.TextureAtlasPage=b;var l=function(a){function b(){a.apply(this,arguments)}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=l})(spine||(spine={})); +(function(a){var e=function(){function e(b,e){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==b)throw Error('data cannot be null.');if(null==e)throw Error('skeleton cannot be null.');this.data=b;this.rotateMix=b.rotateMix;this.translateMix=b.translateMix;this.scaleMix=b.scaleMix;this.shearMix=b.shearMix;this.bones=[];for(var g=0;ga.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2);var C=C*b,F=Math.cos(C), +C=Math.sin(C);q.a=F*A-C*E;q.b=F*u-C*D;q.c=C*A+F*E;q.d=C*u+F*D;u=!0}0!=e&&(u=this.temp,k.localToWorld(u.set(this.data.offsetX,this.data.offsetY)),q.worldX+=(u.x-q.worldX)*e,q.worldY+=(u.y-q.worldY)*e,u=!0);0a.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2),C=A+(C+d)*c,u=Math.sqrt(u*u+D*D),q.b=Math.cos(C)*u,q.d=Math.sin(C)*u,u=!0);u&&(q.appliedValid=!1)}};e.prototype.getOrder=function(){return this.data.order};return e}();a.TransformConstraint=e})(spine||(spine={})); +(function(a){var e=function(){return function(a){this.order=0;this.bones=[];this.offsetShearY=this.offsetScaleY=this.offsetScaleX=this.offsetY=this.offsetX=this.offsetRotation=this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;if(null==a)throw Error('name cannot be null.');this.name=a}}();a.TransformConstraintData=e})(spine||(spine={})); +(function(a){var e=function(){function a(){this.array=[]}a.prototype.add=function(a){var b=this.contains(a);this.array[a|0]=a|0;return!b};a.prototype.contains=function(a){return void 0!=this.array[a|0]};a.prototype.remove=function(a){this.array[a|0]=void 0};a.prototype.clear=function(){this.array.length=0};return a}();a.IntSet=e;e=function(){function a(a,e,g,c){void 0===a&&(a=0);void 0===e&&(e=0);void 0===g&&(g=0);void 0===c&&(c=0);this.r=a;this.g=e;this.b=g;this.a=c}a.prototype.set=function(a,e, +g,c){this.r=a;this.g=e;this.b=g;this.a=c;this.clamp();return this};a.prototype.setFromColor=function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a;return this};a.prototype.setFromString=function(a){a='#'==a.charAt(0)?a.substr(1):a;this.r=parseInt(a.substr(0,2),16)/255;this.g=parseInt(a.substr(2,2),16)/255;this.b=parseInt(a.substr(4,2),16)/255;this.a=(8!=a.length?255:parseInt(a.substr(6,2),16))/255;return this};a.prototype.add=function(a,e,g,c){this.r+=a;this.g+=e;this.b+=g;this.a+=c;this.clamp(); +return this};a.prototype.clamp=function(){0>this.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1g?g:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b* +a.degRad)};a.signum=function(a){return 0a?-1:0};a.toInt=function(a){return 0a?-b:b};a.PI=3.1415927;a.PI2=2*a.PI;a.radiansToDegrees=180/a.PI;a.radDeg=a.radiansToDegrees;a.degreesToRadians=a.PI/180;a.degRad=a.degreesToRadians;return a}();a.MathUtils=e;e=function(){function a(){}a.arrayCopy=function(a,e,g,c,k){for(var b=e;b=e?b:a.setArraySize(b,e,g)};a.newArray=function(a,e){for(var b=Array(a),c=0;cthis.maxDelta&&(this.delta=this.maxDelta);this.lastTime=a;this.frameCount++;1g;++g)b[g]=0;for(g=0;30-c>g;++g)b[g+c]=g/c| +0;c=e;for(g=0;30>g;++g)d[g]=c,c+=1<g;++g)b.table[g]=0;for(g=0;e>g;++g)b.table[d[c+g]]++;for(g=h=b.table[0]=0;16>g;++g)D[g]=h,h+=b.table[g];for(g=0;e>g;++g)d[c+g]&&(b.trans[D[d[c+g]]++]=g)}function n(b,d,c){if(!d)return c;for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>16-d;return b.tag>>>=d,b.bitcount-=d,e+c}function p(b,d){for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>=1,++g,c+=d.table[g],e-=d.table[g];while(0<=e);return b.tag=h,b.bitcount-=g,d.trans[c+e]}function t(b,d,c){for(;;){var e=p(b,d);if(256===e)return h;if(256>e)b.dest[b.destLen++]=e;else{var g,k,e=e-257,e=n(b,w[e],y[e]);g=p(b,c);for(k=g=b.destLen-n(b,x[g],q[g]);g+e>k;++k)b.dest[b.destLen++]=b.dest[k]}}}var h=0,d=new l,v=new l,w=new Uint8Array(30),y=new Uint16Array(30),x=new Uint8Array(30),q=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4, +12,3,13,2,14,1,15]),A=new l,E=new Uint8Array(320),D=new Uint16Array(16);(function(b,d){var c;for(c=0;7>c;++c)b.table[c]=0;b.table[7]=24;b.table[8]=152;b.table[9]=112;for(c=0;24>c;++c)b.trans[c]=256+c;for(c=0;144>c;++c)b.trans[24+c]=c;for(c=0;8>c;++c)b.trans[168+c]=280+c;for(c=0;112>c;++c)b.trans[176+c]=144+c;for(c=0;5>c;++c)d.table[c]=0;d.table[5]=32;for(c=0;32>c;++c)d.trans[c]=c})(d,v);c(w,y,4,3);c(x,q,2,1);w[28]=0;y[28]=258;m.exports=function(b,c){var e;b=new g(b,c);do{c=b;c.bitcount--||(c.tag= +c.source[c.sourceIndex++],c.bitcount=7);e=1&c.tag;switch(c=(c.tag>>>=1,e),n(b,2,0)){case 0:var l,m=l=void 0;for(e=b;8w;++w)E[w]=0;for(w=0;q>w;++w){var C=n(m,3,0);E[u[w]]=C}k(A,E,0,19);for(w=0;l+e>w;)switch(q=p(m,A),q){case 16:C=E[w-1];for(q=n(m,2,3);q;--q)E[w++]=C;break;case 17:for(q=n(m,3,3);q;--q)E[w++]=0;break;case 18:for(q=n(m,7,11);q;--q)E[w++]=0;break;default:E[w++]=q}k(x,E,0,l);k(y,E,l,e);e=t(b,b.ltree,b.dtree);break;default:e=-3}if(e!==h)throw Error('Data error');}while(!c);return b.destLenb.descender,'Descender should be negative (e.g. -512).'),this.names={fontFamily:{en:b.familyName||' '},fontSubfamily:{en:b.styleName||' '}, fullName:{en:b.fullName||b.familyName+' '+b.styleName},postScriptName:{en:b.postScriptName||b.familyName+b.styleName},designer:{en:b.designer||' '},designerURL:{en:b.designerURL||' '},manufacturer:{en:b.manufacturer||' '},manufacturerURL:{en:b.manufacturerURL||' '},license:{en:b.license||' '},licenseURL:{en:b.licenseURL||' '},version:{en:b.version||'Version 0.1'},description:{en:b.description||' '},copyright:{en:b.copyright||' '},trademark:{en:b.trademark||' '}},this.unitsPerEm=b.unitsPerEm||1E3, -this.ascender=b.ascender,this.descender=b.descender,this.createdTimestamp=b.createdTimestamp,this.tables={os2:{usWeightClass:b.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:b.widthClass||this.usWidthClasses.MEDIUM,fsSelection:b.fsSelection||this.fsSelectionValues.REGULAR}});this.supported=!0;this.glyphs=new n.GlyphSet(this,b.glyphs||[]);this.encoding=new k.DefaultEncoding(this);this.substitution=new p(this);this.tables=this.tables||{}}var f=g('./path'),c=g('./tables/sfnt'),k=g('./encoding'), -n=g('./glyphset'),p=g('./substitution'),t=g('./util');l.prototype.hasChar=function(b){return null!==this.encoding.charToGlyphIndex(b)};l.prototype.charToGlyphIndex=function(b){return this.encoding.charToGlyphIndex(b)};l.prototype.charToGlyph=function(b){b=this.charToGlyphIndex(b);b=this.glyphs.get(b);return b||(b=this.glyphs.get(0)),b};l.prototype.stringToGlyphs=function(b){for(var d=[],c=0;c=c;){var k=c+g>>>1,h=b[k].tag;if(h===f)return k;f>h?c=k+1:g=k-1}return-c-1}var f=g('./check');m.exports={searchTag:l,binSearch:function(b,f){for(var c=0,g=b.length-1;g>=c;){var k=c+g>>>1,h=b[k];if(h===f)return k;f>h?c=k+1:g=k-1}return-c-1},getScriptNames:function(){var b=this.getGsubTable();return b?b.scripts.map(function(b){return b.tag}):[]},getScriptTable:function(b,f){var c=this.getGsubTable(f);if(c){f=c.scripts;c=l(c.scripts,b);if(0<=c)return f[c].script;b={tag:b,script:{defaultLangSys:{reserved:0, -reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return f.splice(-1-c,0,b.script),b}},getLangSysTable:function(b,f,g){if(b=this.getScriptTable(b,g)){if('DFLT'===f)return b.defaultLangSys;var c=l(b.langSysRecords,f);if(0<=c)return b.langSysRecords[c].langSys;if(g)return f={tag:f,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}},b.langSysRecords.splice(-1-c,0,f),f.langSys}},getFeatureTable:function(b,g,l,m){if(b=this.getLangSysTable(b,g,m)){var c;b=b.featureIndexes;g=this.font.tables.gsub.features; -for(var h=0;h=g[m-1].tag,'Features must be added in alphabetical order.'),c={tag:l,feature:{params:0,lookupListIndexes:[]}},g.push(c),b.push(m),c.feature}},getLookupTable:function(b,f,g,l,m){if(b=this.getFeatureTable(b,f,g,m)){var c;b=b.lookupListIndexes;f=this.font.tables.gsub.lookups;for(g=0;gf;f++)for(var g=b[f],l=g.end,g=g.start;l>=g;g++)c.push(g);return c}}},{'./check':2}],9:[function(g,m,b){function l(b,d){g('fs').readFile(b,function(b,c){return b?d(b.message):void d(null,w.nodeBufferToArrayBuffer(c))})}function f(b,d){var c=new XMLHttpRequest;c.open('get',b,!0);c.responseType='arraybuffer';c.onload=function(){return 200!==c.status?d('Font could not be loaded: '+ -c.statusText):d(null,c.response)};c.send()}function c(b,c){for(var f=[],g=12,h=0;c>h;h+=1){var k=d.getTag(b,g),l=d.getULong(b,g+4),n=d.getULong(b,g+8),m=d.getULong(b,g+12);f.push({tag:k,checksum:l,offset:n,length:m,compression:!1});g+=16}return f}function k(b,d){if('WOFF'===d.compression){b=new Uint8Array(b.buffer,d.offset+2,d.compressedLength-2);var c=new Uint8Array(d.originalLength);if(p(b,c),c.byteLength!==d.originalLength)throw Error('Decompression error: '+d.tag+" decompressed length doesn't match recorded length"); -return{data:new DataView(c.buffer,0),offset:0}}return{data:b,offset:d.offset}}function n(b){var f,g,l,n=new h.Font({empty:!0});b=new DataView(b,0);var m;l=d.getTag(b,0);if(l===String.fromCharCode(0,1,0,0))n.outlinesFormat='truetype',l=d.getUShort(b,4),m=c(b,l);else if('OTTO'===l)n.outlinesFormat='cff',l=d.getUShort(b,4),m=c(b,l);else{if('wOFF'!==l)throw Error('Unsupported OpenType signature '+l);m=d.getTag(b,4);if(m===String.fromCharCode(0,1,0,0))n.outlinesFormat='truetype';else{if('OTTO'!==m)throw Error('Unsupported OpenType flavor '+ -l);n.outlinesFormat='cff'}m=l=d.getUShort(b,12);for(var p=[],v=44,w=0;m>w;w+=1){var V=d.getTag(b,v),R=d.getULong(b,v+4),Y=d.getULong(b,v+8),na=d.getULong(b,v+12);p.push({tag:V,offset:R,compression:na>Y?'WOFF':!1,compressedLength:Y,originalLength:na});v+=20}m=p}for(var la,ca,Ba,ha,ua,ea,ia,qa,ra,Aa,p=0;l>p;p+=1)switch(v=m[p],v.tag){case 'cmap':v=k(b,v);n.tables.cmap=y.parse(v.data,v.offset);n.encoding=new t.CmapEncoding(n.tables.cmap);break;case 'fvar':ca=v;break;case 'head':v=k(b,v);n.tables.head= -D.parse(v.data,v.offset);n.unitsPerEm=n.tables.head.unitsPerEm;f=n.tables.head.indexToLocFormat;break;case 'hhea':v=k(b,v);n.tables.hhea=C.parse(v.data,v.offset);n.ascender=n.tables.hhea.ascender;n.descender=n.tables.hhea.descender;n.numberOfHMetrics=n.tables.hhea.numberOfHMetrics;break;case 'hmtx':ea=v;break;case 'ltag':v=k(b,v);g=H.parse(v.data,v.offset);break;case 'maxp':v=k(b,v);n.tables.maxp=O.parse(v.data,v.offset);n.numGlyphs=n.tables.maxp.numGlyphs;break;case 'name':ra=v;break;case 'OS/2':v= -k(b,v);n.tables.os2=J.parse(v.data,v.offset);break;case 'post':v=k(b,v);n.tables.post=P.parse(v.data,v.offset);n.glyphNames=new t.GlyphNames(n.tables.post);break;case 'glyf':Ba=v;break;case 'loca':qa=v;break;case 'CFF ':la=v;break;case 'kern':ia=v;break;case 'GPOS':ha=v;break;case 'GSUB':ua=v;break;case 'meta':Aa=v}ra=k(b,ra);if(n.tables.name=M.parse(ra.data,ra.offset,g),n.names=n.tables.name,Ba&&qa)f=0===f,qa=k(b,qa),qa=G.parse(qa.data,qa.offset,n.numGlyphs,f),Ba=k(b,Ba),n.glyphs=u.parse(Ba.data, -Ba.offset,qa,n);else{if(!la)throw Error("Font doesn't contain TrueType or CFF outlines.");Ba=k(b,la);x.parse(Ba.data,Ba.offset,n)}ea=k(b,ea);(F.parse(ea.data,ea.offset,n.numberOfHMetrics,n.numGlyphs,n.glyphs),t.addGlyphNames(n),ia)?(ia=k(b,ia),n.kerningPairs=z.parse(ia.data,ia.offset)):n.kerningPairs={};ha&&(ha=k(b,ha),A.parse(ha.data,ha.offset,n));ua&&(ua=k(b,ua),n.tables.gsub=E.parse(ua.data,ua.offset));ca&&(ca=k(b,ca),n.tables.fvar=q.parse(ca.data,ca.offset,n.names));Aa&&(Aa=k(b,Aa),n.tables.meta= -N.parse(Aa.data,Aa.offset),n.metas=n.tables.meta);return n}var p=g('tiny-inflate'),t=g('./encoding'),h=g('./font');m=g('./glyph');var d=g('./parse'),v=g('./path'),w=g('./util'),y=g('./tables/cmap'),x=g('./tables/cff'),q=g('./tables/fvar'),u=g('./tables/glyf'),A=g('./tables/gpos'),E=g('./tables/gsub'),D=g('./tables/head'),C=g('./tables/hhea'),F=g('./tables/hmtx'),z=g('./tables/kern'),H=g('./tables/ltag'),G=g('./tables/loca'),O=g('./tables/maxp'),M=g('./tables/name'),J=g('./tables/os2'),P=g('./tables/post'), -N=g('./tables/meta');b._parse=d;b.Font=h.Font;b.Glyph=m.Glyph;b.Path=v.Path;b.parse=n;b.load=function(b,d){('undefined'==typeof window?l:f)(b,function(b,c){if(b)return d(b);var f;try{f=n(c)}catch(S){return d(S,null)}return d(null,f)})};b.loadSync=function(b){b=g('fs').readFileSync(b);return n(w.nodeBufferToArrayBuffer(b))}},{'./encoding':4,'./font':5,'./glyph':6,'./parse':10,'./path':11,'./tables/cff':14,'./tables/cmap':15,'./tables/fvar':16,'./tables/glyf':17,'./tables/gpos':18,'./tables/gsub':19, -'./tables/head':20,'./tables/hhea':21,'./tables/hmtx':22,'./tables/kern':23,'./tables/loca':24,'./tables/ltag':25,'./tables/maxp':26,'./tables/meta':27,'./tables/name':28,'./tables/os2':29,'./tables/post':30,'./util':33,fs:void 0,'tiny-inflate':1}],10:[function(g,m,b){function l(b,c){return b.getUint16(c,!1)}function f(b,c){this.data=b;this.offset=c;this.relativeOffset=0}var c=g('./check');b.getByte=function(b,c){return b.getUint8(c)};b.getCard8=b.getByte;b.getUShort=b.getCard16=l;b.getShort=function(b, -c){return b.getInt16(c,!1)};b.getULong=function(b,c){return b.getUint32(c,!1)};b.getFixed=function(b,c){var f=b.getInt16(c,!1);b=b.getUint16(c+2,!1);return f+b/65535};b.getTag=function(b,c){for(var f='',d=c;c+4>d;d+=1)f+=String.fromCharCode(b.getInt8(d));return f};b.getOffset=function(b,c,f){for(var d=0,g=0;f>g;g+=1)d<<=8,d+=b.getUint8(c+g);return d};b.getBytes=function(b,c,f){for(var d=[];f>c;c+=1)d.push(b.getUint8(c));return d};b.bytesToString=function(b){for(var c='',f=0;fg;g++)d+=String.fromCharCode(c.getUint8(f+g));return d};f.prototype.parseTag=function(){return this.parseString(4)};f.prototype.parseLongDateTime=function(){var c=b.getULong(this.data,this.offset+this.relativeOffset+4);return c-=2082844800,this.relativeOffset+= -8,c};f.prototype.parseVersion=function(){var b=l(this.data,this.offset+this.relativeOffset),c=l(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,b+c/4096/10};f.prototype.skip=function(b,c){void 0===c&&(c=1);this.relativeOffset+=k[b]*c};f.prototype.parseOffset16List=f.prototype.parseUShortList=function(b){void 0===b&&(b=this.parseUShort());for(var c=Array(b),f=this.data,d=this.offset+this.relativeOffset,g=0;b>g;g++)c[g]=f.getUint16(d),d+=2;return this.relativeOffset+=2*b, -c};f.prototype.parseList=function(b,c){c||(c=b,b=this.parseUShort());for(var f=Array(b),d=0;b>d;d++)f[d]=c.call(this);return f};f.prototype.parseRecordList=function(b,c){c||(c=b,b=this.parseUShort());for(var f=Array(b),d=Object.keys(c),g=0;b>g;g++){for(var k={},l=0;lk;k++){var l=c[k];if(0!==l)if(this.relativeOffset=l,b){for(var n=this.parseOffset16List(),m=Array(n.length),p=0;pf;f++)b[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:b}}c.assert(!1,'0x'+b.toString(16)+': Coverage format must be 1 or 2.')};f.prototype.parseClassDef=function(){var b=this.offset+this.relativeOffset,g=this.parseUShort();return 1===g? -{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===g?{format:2,ranges:this.parseRecordList({start:f.uShort,end:f.uShort,classId:f.uShort})}:void c.assert(!1,'0x'+b.toString(16)+': ClassDef format must be 1 or 2.')};f.list=function(b,c){return function(){return this.parseList(b,c)}};f.recordList=function(b,c){return function(){return this.parseRecordList(b,c)}};f.pointer=function(b){return function(){return this.parsePointer(b)}};f.tag=f.prototype.parseTag;f.byte=f.prototype.parseByte; -f.uShort=f.offset16=f.prototype.parseUShort;f.uShortList=f.prototype.parseUShortList;f.struct=f.prototype.parseStruct;f.coverage=f.prototype.parseCoverage;f.classDef=f.prototype.parseClassDef;var n={reserved:f.uShort,reqFeatureIndex:f.uShort,featureIndexes:f.uShortList};f.prototype.parseScriptList=function(){return this.parsePointer(f.recordList({tag:f.tag,script:f.pointer({defaultLangSys:f.pointer(n),langSysRecords:f.recordList({tag:f.tag,langSys:f.pointer(n)})})}))};f.prototype.parseFeatureList= -function(){return this.parsePointer(f.recordList({tag:f.tag,feature:f.pointer({featureParams:f.offset16,lookupListIndexes:f.uShortList})}))};f.prototype.parseLookupList=function(b){return this.parsePointer(f.list(f.pointer(function(){var g=this.parseUShort();c.argument(1<=g&&8>=g,'GSUB lookup type '+g+' unknown.');var h=this.parseUShort(),d=16&h;return{lookupType:g,lookupFlag:h,subtables:this.parseList(f.pointer(b[g])),markFilteringSet:d?this.parseUShort():void 0}})))};b.Parser=f},{'./check':2}], -11:[function(g,m,b){function l(){this.commands=[];this.fill='black';this.stroke=null;this.strokeWidth=1}l.prototype.moveTo=function(b,c){this.commands.push({type:'M',x:b,y:c})};l.prototype.lineTo=function(b,c){this.commands.push({type:'L',x:b,y:c})};l.prototype.curveTo=l.prototype.bezierCurveTo=function(b,c,g,l,m,t){this.commands.push({type:'C',x1:b,y1:c,x2:g,y2:l,x:m,y:t})};l.prototype.quadTo=l.prototype.quadraticCurveTo=function(b,c,g,l){this.commands.push({type:'Q',x1:b,y1:c,x:g,y:l})};l.prototype.close= -l.prototype.closePath=function(){this.commands.push({type:'Z'})};l.prototype.extend=function(b){b.commands&&(b=b.commands);Array.prototype.push.apply(this.commands,b)};l.prototype.draw=function(b){b.beginPath();for(var c=0;c'};b.Path=l},{}],12:[function(g,m,b){function l(b,f,g){b=b.subtables;for(var c=0;cm&&(m=-1-m,b.coverage.glyphs.splice(m,0,n),b.substitute.splice(m,0,0));b.substitute[m]=g.by};b.prototype.addAlternate=function(b,g,n,m){b=this.getLookupTable(n,m,b,3,!0);b=l(b,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});f.assert(1===b.coverage.format,'Ligature: unable to modify coverage table format '+b.coverage.format);n=g.sub;m=this.binSearch(b.coverage.glyphs,n);0>m&&(m=-1-m,b.coverage.glyphs.splice(m,0,n),b.alternateSets.splice(m,0,0));b.alternateSets[m]=g.by};b.prototype.addLigature= -function(b,g,l,m){b=this.getLookupTable(l||'DFLT',m||'DFLT',b,4,!0);(l=b.subtables[0])||(l={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},b.subtables[0]=l);f.assert(1===l.coverage.format,'Ligature: unable to modify coverage table format '+l.coverage.format);m=g.sub[0];b=g.sub.slice(1);g={ligGlyph:g.by,components:b};var c=this.binSearch(l.coverage.glyphs,m);if(0<=c){l=l.ligatureSets[c];for(m=0;m -d;d++)if(c[d]!==b[d]){c=!1;break a}c=!0}}if(c)return}l.push(g)}else c=-1-c,l.coverage.glyphs.splice(c,0,m),l.ligatureSets.splice(c,0,[g])};b.prototype.getFeature=function(b,f,g){if(f=f||'DFLT',g=g||'DFLT',/ss\d\d/.test(b))return this.getSingle(b,f,g);switch(b){case 'aalt':case 'salt':return this.getSingle(b,f,g).concat(this.getAlternates(b,f,g));case 'dlig':case 'liga':case 'rlig':return this.getLigatures(b,f,g)}};b.prototype.add=function(b,f,g,l){if(g=g||'DFLT',l=l||'DFLT',/ss\d\d/.test(b))return this.addSingle(b, -f,g,l);switch(b){case 'aalt':case 'salt':return'number'==typeof f.by?this.addSingle(b,f,g,l):this.addAlternate(b,f,g,l);case 'dlig':case 'liga':case 'rlig':return this.addLigature(b,f,g,l)}};m.exports=b},{'./check':2,'./layout':8}],13:[function(g,m,b){function l(b,d,c){var f;for(f=0;fh;h++)g[h+1]={name:b+h,type:'TABLE',value:c(d[h],h)};return g}function k(b,d,c){var f=d.length,g=[];g[0]={name:b+'Count',type:'USHORT',value:f};for(b=0;f>b;b++)g=g.concat(c(d[b],b));return g}function n(b){1===b.format?l.call(this,'coverageTable',[{name:'coverageFormat', -type:'USHORT',value:1}].concat(f('glyph',b.glyphs))):d.assert(!1,"Can't create coverage table format 2 yet.")}function p(b){l.call(this,'scriptListTable',k('scriptRecord',b,function(b,c){var g=b.script,h=g.defaultLangSys;return d.assert(!!h,'Unable to write GSUB: script '+b.tag+' has no default language system.'),[{name:'scriptTag'+c,type:'TAG',value:b.tag},{name:'script'+c,type:'TABLE',value:new l('scriptTable',[{name:'defaultLangSys',type:'TABLE',value:new l('defaultLangSys',[{name:'lookupOrder', -type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:h.reqFeatureIndex}].concat(f('featureIndex',h.featureIndexes)))}].concat(k('langSys',g.langSysRecords,function(b,d){var c=b.langSys;return[{name:'langSysTag'+d,type:'TAG',value:b.tag},{name:'langSys'+d,type:'TABLE',value:new l('langSys',[{name:'lookupOrder',type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:c.reqFeatureIndex}].concat(f('featureIndex',c.featureIndexes)))}]})))}]}))}function t(b){l.call(this,'featureListTable', -k('featureRecord',b,function(b,d){var c=b.feature;return[{name:'featureTag'+d,type:'TAG',value:b.tag},{name:'feature'+d,type:'TABLE',value:new l('featureTable',[{name:'featureParams',type:'USHORT',value:c.featureParams}].concat(f('lookupListIndex',c.lookupListIndexes)))}]}))}function h(b,f){l.call(this,'lookupListTable',c('lookup',b,function(b){var g=f[b.lookupType];return d.assert(!!g,'Unable to write GSUB lookup type '+b.lookupType+' tables.'),new l('lookupTable',[{name:'lookupType',type:'USHORT', -value:b.lookupType},{name:'lookupFlag',type:'USHORT',value:b.lookupFlag}].concat(c('subtable',b.subtables,g)))}))}var d=g('./check'),v=g('./types').encode,w=g('./types').sizeOf;l.prototype.encode=function(){return v.TABLE(this)};l.prototype.sizeOf=function(){return w.TABLE(this)};n.prototype=Object.create(l.prototype);n.prototype.constructor=n;p.prototype=Object.create(l.prototype);p.prototype.constructor=p;t.prototype=Object.create(l.prototype);t.prototype.constructor=t;h.prototype=Object.create(l.prototype); -h.prototype.constructor=h;b.Record=b.Table=l;b.Coverage=n;b.ScriptList=p;b.FeatureList=t;b.LookupList=h;b.ushortList=f;b.tableList=c;b.recordList=k},{'./check':2,'./types':32}],14:[function(g,m,b){function l(b,d){if(b===d)return!0;if(Array.isArray(b)&&Array.isArray(d)){if(b.length!==d.length)return!1;for(var c=0;cf;f+= -1)k.push(u.getOffset(b,m,n)),m+=n;h=g+k[h]}else h=d+2;for(f=0;f>4;g&=15;if(15===f)break;if(d+= -c[f],15===g)break;d+=c[g]}return parseFloat(d)}if(32<=d&&246>=d)return d-139;if(247<=d&&250>=d)return c=b.parseByte(),256*(d-247)+c+108;if(251<=d&&254>=d)return c=b.parseByte(),256*-(d-251)-c-108;throw Error('Invalid b0 '+d);}function k(b,d,f){var g=new u.Parser(b,void 0!==d?d:0);d=[];var h=[];for(f=void 0!==f?f:b.length;g.relativeOffset=b?(12===b&&(b=1200+g.parseByte()),d.push([b,h]),h=[]):h.push(c(g,b));f={};for(b=0;b=d?x.cffStandardStrings[d]:b[d-391]}function p(b,d,c){for(var f={},g=0;g>1;p.length=0;t=!0}function h(c){for(var C, -z,A,D,F,E,G,H,M,J,O=0;OMath.abs(J-y)?x=M+p.shift():y=J+p.shift();q.curveTo(k,l,n,m,F, -E);q.curveTo(G,H,M,J,x,y);break;default:console.log('Glyph '+d.index+': unknown operator 1200'+F),p.length=0}break;case 14:0>3;break;case 21:2>16);O+=2;break;case 29:F=p.pop()+b.gsubrsBias;(F=b.gsubrs[F])&&h(F);break;case 30:for(;0F?console.log('Glyph '+d.index+': unknown operator '+F):247>F?p.push(F-139):251>F?(C=c[O],O+=1,p.push(256*(F-247)+C+108)):255>F?(C=c[O],O+=1,p.push(256*-(F-251)-C-108)):(C=c[O],z=c[O+1],A=c[O+2],D=c[O+3],O+=4,p.push((C<<24|z<<16|A<<8|D)/65536))}} -var k,l,n,m,q=new A.Path,p=[],v=0,t=!1,w=b.defaultWidthX,u=!1,x=0,y=0;return h(c),d.advanceWidth=w,q}function h(b){return 1240>b.length?107:33900>b.length?1131:32768}function d(b,d){var c,f=x.cffStandardStrings.indexOf(b);return f=d.indexOf(b),0<=f?c=f+x.cffStandardStrings.length:(c=x.cffStandardStrings.length+d.length,d.push(b)),c}function v(b,c,f){for(var g={},h=0;h=c;){var k=c+g>>>1,h=b[k].tag;if(h===e)return k;e>h?c=k+1:g=k-1}return-c-1}var g=e('./check');m.exports={searchTag:l,binSearch:function(b,e){for(var c=0,g=b.length-1;g>=c;){var k=c+g>>>1,h=b[k];if(h===e)return k;e>h?c=k+1:g=k-1}return-c-1},getScriptNames:function(){var b=this.getGsubTable();return b?b.scripts.map(function(b){return b.tag}):[]},getScriptTable:function(b,e){var c=this.getGsubTable(e);if(c){e=c.scripts;c=l(c.scripts,b);if(0<=c)return e[c].script;b={tag:b,script:{defaultLangSys:{reserved:0, +reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return e.splice(-1-c,0,b.script),b}},getLangSysTable:function(b,e,g){if(b=this.getScriptTable(b,g)){if('DFLT'===e)return b.defaultLangSys;var c=l(b.langSysRecords,e);if(0<=c)return b.langSysRecords[c].langSys;if(g)return e={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}},b.langSysRecords.splice(-1-c,0,e),e.langSys}},getFeatureTable:function(b,e,l,m){if(b=this.getLangSysTable(b,e,m)){var c;b=b.featureIndexes;e=this.font.tables.gsub.features; +for(var h=0;h=e[m-1].tag,'Features must be added in alphabetical order.'),c={tag:l,feature:{params:0,lookupListIndexes:[]}},e.push(c),b.push(m),c.feature}},getLookupTable:function(b,e,g,l,m){if(b=this.getFeatureTable(b,e,g,m)){var c;b=b.lookupListIndexes;e=this.font.tables.gsub.lookups;for(g=0;ge;e++)for(var g=b[e],l=g.end,g=g.start;l>=g;g++)c.push(g);return c}}},{'./check':2}],9:[function(e,m,b){function l(b,d){e('fs').readFile(b,function(b,c){return b?d(b.message):void d(null,w.nodeBufferToArrayBuffer(c))})}function g(b,d){var c=new XMLHttpRequest;c.open('get',b,!0);c.responseType='arraybuffer';c.onload=function(){return 200!==c.status?d('Font could not be loaded: '+ +c.statusText):d(null,c.response)};c.send()}function c(b,c){for(var e=[],g=12,h=0;c>h;h+=1){var k=d.getTag(b,g),l=d.getULong(b,g+4),m=d.getULong(b,g+8),n=d.getULong(b,g+12);e.push({tag:k,checksum:l,offset:m,length:n,compression:!1});g+=16}return e}function k(b,d){if('WOFF'===d.compression){b=new Uint8Array(b.buffer,d.offset+2,d.compressedLength-2);var c=new Uint8Array(d.originalLength);if(p(b,c),c.byteLength!==d.originalLength)throw Error('Decompression error: '+d.tag+" decompressed length doesn't match recorded length"); +return{data:new DataView(c.buffer,0),offset:0}}return{data:b,offset:d.offset}}function n(b){var e,g,l,m=new h.Font({empty:!0});b=new DataView(b,0);var n;l=d.getTag(b,0);if(l===String.fromCharCode(0,1,0,0))m.outlinesFormat='truetype',l=d.getUShort(b,4),n=c(b,l);else if('OTTO'===l)m.outlinesFormat='cff',l=d.getUShort(b,4),n=c(b,l);else{if('wOFF'!==l)throw Error('Unsupported OpenType signature '+l);n=d.getTag(b,4);if(n===String.fromCharCode(0,1,0,0))m.outlinesFormat='truetype';else{if('OTTO'!==n)throw Error('Unsupported OpenType flavor '+ +l);m.outlinesFormat='cff'}n=l=d.getUShort(b,12);for(var p=[],v=44,w=0;n>w;w+=1){var V=d.getTag(b,v),R=d.getULong(b,v+4),Y=d.getULong(b,v+8),na=d.getULong(b,v+12);p.push({tag:V,offset:R,compression:na>Y?'WOFF':!1,compressedLength:Y,originalLength:na});v+=20}n=p}for(var la,ca,Ba,ha,ua,ea,ia,qa,ra,Aa,p=0;l>p;p+=1)switch(v=n[p],v.tag){case 'cmap':v=k(b,v);m.tables.cmap=y.parse(v.data,v.offset);m.encoding=new t.CmapEncoding(m.tables.cmap);break;case 'fvar':ca=v;break;case 'head':v=k(b,v);m.tables.head= +D.parse(v.data,v.offset);m.unitsPerEm=m.tables.head.unitsPerEm;e=m.tables.head.indexToLocFormat;break;case 'hhea':v=k(b,v);m.tables.hhea=C.parse(v.data,v.offset);m.ascender=m.tables.hhea.ascender;m.descender=m.tables.hhea.descender;m.numberOfHMetrics=m.tables.hhea.numberOfHMetrics;break;case 'hmtx':ea=v;break;case 'ltag':v=k(b,v);g=H.parse(v.data,v.offset);break;case 'maxp':v=k(b,v);m.tables.maxp=O.parse(v.data,v.offset);m.numGlyphs=m.tables.maxp.numGlyphs;break;case 'name':ra=v;break;case 'OS/2':v= +k(b,v);m.tables.os2=J.parse(v.data,v.offset);break;case 'post':v=k(b,v);m.tables.post=P.parse(v.data,v.offset);m.glyphNames=new t.GlyphNames(m.tables.post);break;case 'glyf':Ba=v;break;case 'loca':qa=v;break;case 'CFF ':la=v;break;case 'kern':ia=v;break;case 'GPOS':ha=v;break;case 'GSUB':ua=v;break;case 'meta':Aa=v}ra=k(b,ra);if(m.tables.name=M.parse(ra.data,ra.offset,g),m.names=m.tables.name,Ba&&qa)e=0===e,qa=k(b,qa),qa=G.parse(qa.data,qa.offset,m.numGlyphs,e),Ba=k(b,Ba),m.glyphs=u.parse(Ba.data, +Ba.offset,qa,m);else{if(!la)throw Error("Font doesn't contain TrueType or CFF outlines.");Ba=k(b,la);x.parse(Ba.data,Ba.offset,m)}ea=k(b,ea);(F.parse(ea.data,ea.offset,m.numberOfHMetrics,m.numGlyphs,m.glyphs),t.addGlyphNames(m),ia)?(ia=k(b,ia),m.kerningPairs=z.parse(ia.data,ia.offset)):m.kerningPairs={};ha&&(ha=k(b,ha),A.parse(ha.data,ha.offset,m));ua&&(ua=k(b,ua),m.tables.gsub=E.parse(ua.data,ua.offset));ca&&(ca=k(b,ca),m.tables.fvar=q.parse(ca.data,ca.offset,m.names));Aa&&(Aa=k(b,Aa),m.tables.meta= +N.parse(Aa.data,Aa.offset),m.metas=m.tables.meta);return m}var p=e('tiny-inflate'),t=e('./encoding'),h=e('./font');m=e('./glyph');var d=e('./parse'),v=e('./path'),w=e('./util'),y=e('./tables/cmap'),x=e('./tables/cff'),q=e('./tables/fvar'),u=e('./tables/glyf'),A=e('./tables/gpos'),E=e('./tables/gsub'),D=e('./tables/head'),C=e('./tables/hhea'),F=e('./tables/hmtx'),z=e('./tables/kern'),H=e('./tables/ltag'),G=e('./tables/loca'),O=e('./tables/maxp'),M=e('./tables/name'),J=e('./tables/os2'),P=e('./tables/post'), +N=e('./tables/meta');b._parse=d;b.Font=h.Font;b.Glyph=m.Glyph;b.Path=v.Path;b.parse=n;b.load=function(b,d){('undefined'==typeof window?l:g)(b,function(b,c){if(b)return d(b);var e;try{e=n(c)}catch(S){return d(S,null)}return d(null,e)})};b.loadSync=function(b){b=e('fs').readFileSync(b);return n(w.nodeBufferToArrayBuffer(b))}},{'./encoding':4,'./font':5,'./glyph':6,'./parse':10,'./path':11,'./tables/cff':14,'./tables/cmap':15,'./tables/fvar':16,'./tables/glyf':17,'./tables/gpos':18,'./tables/gsub':19, +'./tables/head':20,'./tables/hhea':21,'./tables/hmtx':22,'./tables/kern':23,'./tables/loca':24,'./tables/ltag':25,'./tables/maxp':26,'./tables/meta':27,'./tables/name':28,'./tables/os2':29,'./tables/post':30,'./util':33,fs:void 0,'tiny-inflate':1}],10:[function(e,m,b){function l(b,c){return b.getUint16(c,!1)}function g(b,c){this.data=b;this.offset=c;this.relativeOffset=0}var c=e('./check');b.getByte=function(b,c){return b.getUint8(c)};b.getCard8=b.getByte;b.getUShort=b.getCard16=l;b.getShort=function(b, +c){return b.getInt16(c,!1)};b.getULong=function(b,c){return b.getUint32(c,!1)};b.getFixed=function(b,c){var e=b.getInt16(c,!1);b=b.getUint16(c+2,!1);return e+b/65535};b.getTag=function(b,c){for(var e='',d=c;c+4>d;d+=1)e+=String.fromCharCode(b.getInt8(d));return e};b.getOffset=function(b,c,e){for(var d=0,g=0;e>g;g+=1)d<<=8,d+=b.getUint8(c+g);return d};b.getBytes=function(b,c,e){for(var d=[];e>c;c+=1)d.push(b.getUint8(c));return d};b.bytesToString=function(b){for(var c='',e=0;eg;g++)d+=String.fromCharCode(c.getUint8(e+g));return d};g.prototype.parseTag=function(){return this.parseString(4)};g.prototype.parseLongDateTime=function(){var c=b.getULong(this.data,this.offset+this.relativeOffset+4);return c-=2082844800,this.relativeOffset+= +8,c};g.prototype.parseVersion=function(){var b=l(this.data,this.offset+this.relativeOffset),c=l(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,b+c/4096/10};g.prototype.skip=function(b,c){void 0===c&&(c=1);this.relativeOffset+=k[b]*c};g.prototype.parseOffset16List=g.prototype.parseUShortList=function(b){void 0===b&&(b=this.parseUShort());for(var c=Array(b),e=this.data,d=this.offset+this.relativeOffset,g=0;b>g;g++)c[g]=e.getUint16(d),d+=2;return this.relativeOffset+=2*b, +c};g.prototype.parseList=function(b,c){c||(c=b,b=this.parseUShort());for(var e=Array(b),d=0;b>d;d++)e[d]=c.call(this);return e};g.prototype.parseRecordList=function(b,c){c||(c=b,b=this.parseUShort());for(var e=Array(b),d=Object.keys(c),g=0;b>g;g++){for(var k={},l=0;lk;k++){var l=c[k];if(0!==l)if(this.relativeOffset=l,b){for(var m=this.parseOffset16List(),n=Array(m.length),p=0;pe;e++)b[e]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:b}}c.assert(!1,'0x'+b.toString(16)+': Coverage format must be 1 or 2.')};g.prototype.parseClassDef=function(){var b=this.offset+this.relativeOffset,e=this.parseUShort();return 1===e? +{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===e?{format:2,ranges:this.parseRecordList({start:g.uShort,end:g.uShort,classId:g.uShort})}:void c.assert(!1,'0x'+b.toString(16)+': ClassDef format must be 1 or 2.')};g.list=function(b,c){return function(){return this.parseList(b,c)}};g.recordList=function(b,c){return function(){return this.parseRecordList(b,c)}};g.pointer=function(b){return function(){return this.parsePointer(b)}};g.tag=g.prototype.parseTag;g.byte=g.prototype.parseByte; +g.uShort=g.offset16=g.prototype.parseUShort;g.uShortList=g.prototype.parseUShortList;g.struct=g.prototype.parseStruct;g.coverage=g.prototype.parseCoverage;g.classDef=g.prototype.parseClassDef;var n={reserved:g.uShort,reqFeatureIndex:g.uShort,featureIndexes:g.uShortList};g.prototype.parseScriptList=function(){return this.parsePointer(g.recordList({tag:g.tag,script:g.pointer({defaultLangSys:g.pointer(n),langSysRecords:g.recordList({tag:g.tag,langSys:g.pointer(n)})})}))};g.prototype.parseFeatureList= +function(){return this.parsePointer(g.recordList({tag:g.tag,feature:g.pointer({featureParams:g.offset16,lookupListIndexes:g.uShortList})}))};g.prototype.parseLookupList=function(b){return this.parsePointer(g.list(g.pointer(function(){var e=this.parseUShort();c.argument(1<=e&&8>=e,'GSUB lookup type '+e+' unknown.');var h=this.parseUShort(),d=16&h;return{lookupType:e,lookupFlag:h,subtables:this.parseList(g.pointer(b[e])),markFilteringSet:d?this.parseUShort():void 0}})))};b.Parser=g},{'./check':2}], +11:[function(e,m,b){function l(){this.commands=[];this.fill='black';this.stroke=null;this.strokeWidth=1}l.prototype.moveTo=function(b,c){this.commands.push({type:'M',x:b,y:c})};l.prototype.lineTo=function(b,c){this.commands.push({type:'L',x:b,y:c})};l.prototype.curveTo=l.prototype.bezierCurveTo=function(b,c,e,l,m,t){this.commands.push({type:'C',x1:b,y1:c,x2:e,y2:l,x:m,y:t})};l.prototype.quadTo=l.prototype.quadraticCurveTo=function(b,c,e,l){this.commands.push({type:'Q',x1:b,y1:c,x:e,y:l})};l.prototype.close= +l.prototype.closePath=function(){this.commands.push({type:'Z'})};l.prototype.extend=function(b){b.commands&&(b=b.commands);Array.prototype.push.apply(this.commands,b)};l.prototype.draw=function(b){b.beginPath();for(var c=0;c'};b.Path=l},{}],12:[function(e,m,b){function l(b,e,g){b=b.subtables;for(var c=0;cp&&(p=-1-p,b.coverage.glyphs.splice(p,0,m),b.substitute.splice(p,0,0));b.substitute[p]=e.by};b.prototype.addAlternate=function(b,e,m,p){b=this.getLookupTable(m,p,b,3,!0);b=l(b,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});g.assert(1===b.coverage.format,'Ligature: unable to modify coverage table format '+b.coverage.format);m=e.sub;p=this.binSearch(b.coverage.glyphs,m);0>p&&(p=-1-p,b.coverage.glyphs.splice(p,0,m),b.alternateSets.splice(p,0,0));b.alternateSets[p]=e.by};b.prototype.addLigature= +function(b,e,l,m){b=this.getLookupTable(l||'DFLT',m||'DFLT',b,4,!0);(l=b.subtables[0])||(l={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},b.subtables[0]=l);g.assert(1===l.coverage.format,'Ligature: unable to modify coverage table format '+l.coverage.format);m=e.sub[0];b=e.sub.slice(1);e={ligGlyph:e.by,components:b};var c=this.binSearch(l.coverage.glyphs,m);if(0<=c){l=l.ligatureSets[c];for(m=0;m +d;d++)if(c[d]!==b[d]){c=!1;break a}c=!0}}if(c)return}l.push(e)}else c=-1-c,l.coverage.glyphs.splice(c,0,m),l.ligatureSets.splice(c,0,[e])};b.prototype.getFeature=function(b,e,g){if(e=e||'DFLT',g=g||'DFLT',/ss\d\d/.test(b))return this.getSingle(b,e,g);switch(b){case 'aalt':case 'salt':return this.getSingle(b,e,g).concat(this.getAlternates(b,e,g));case 'dlig':case 'liga':case 'rlig':return this.getLigatures(b,e,g)}};b.prototype.add=function(b,e,g,l){if(g=g||'DFLT',l=l||'DFLT',/ss\d\d/.test(b))return this.addSingle(b, +e,g,l);switch(b){case 'aalt':case 'salt':return'number'==typeof e.by?this.addSingle(b,e,g,l):this.addAlternate(b,e,g,l);case 'dlig':case 'liga':case 'rlig':return this.addLigature(b,e,g,l)}};m.exports=b},{'./check':2,'./layout':8}],13:[function(e,m,b){function l(b,d,c){var e;for(e=0;eh;h++)g[h+1]={name:b+h,type:'TABLE',value:c(d[h],h)};return g}function k(b,d,c){var e=d.length,g=[];g[0]={name:b+'Count',type:'USHORT',value:e};for(b=0;e>b;b++)g=g.concat(c(d[b],b));return g}function n(b){1===b.format?l.call(this,'coverageTable',[{name:'coverageFormat', +type:'USHORT',value:1}].concat(g('glyph',b.glyphs))):d.assert(!1,"Can't create coverage table format 2 yet.")}function p(b){l.call(this,'scriptListTable',k('scriptRecord',b,function(b,c){var e=b.script,h=e.defaultLangSys;return d.assert(!!h,'Unable to write GSUB: script '+b.tag+' has no default language system.'),[{name:'scriptTag'+c,type:'TAG',value:b.tag},{name:'script'+c,type:'TABLE',value:new l('scriptTable',[{name:'defaultLangSys',type:'TABLE',value:new l('defaultLangSys',[{name:'lookupOrder', +type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:h.reqFeatureIndex}].concat(g('featureIndex',h.featureIndexes)))}].concat(k('langSys',e.langSysRecords,function(b,d){var c=b.langSys;return[{name:'langSysTag'+d,type:'TAG',value:b.tag},{name:'langSys'+d,type:'TABLE',value:new l('langSys',[{name:'lookupOrder',type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:c.reqFeatureIndex}].concat(g('featureIndex',c.featureIndexes)))}]})))}]}))}function t(b){l.call(this,'featureListTable', +k('featureRecord',b,function(b,d){var c=b.feature;return[{name:'featureTag'+d,type:'TAG',value:b.tag},{name:'feature'+d,type:'TABLE',value:new l('featureTable',[{name:'featureParams',type:'USHORT',value:c.featureParams}].concat(g('lookupListIndex',c.lookupListIndexes)))}]}))}function h(b,e){l.call(this,'lookupListTable',c('lookup',b,function(b){var g=e[b.lookupType];return d.assert(!!g,'Unable to write GSUB lookup type '+b.lookupType+' tables.'),new l('lookupTable',[{name:'lookupType',type:'USHORT', +value:b.lookupType},{name:'lookupFlag',type:'USHORT',value:b.lookupFlag}].concat(c('subtable',b.subtables,g)))}))}var d=e('./check'),v=e('./types').encode,w=e('./types').sizeOf;l.prototype.encode=function(){return v.TABLE(this)};l.prototype.sizeOf=function(){return w.TABLE(this)};n.prototype=Object.create(l.prototype);n.prototype.constructor=n;p.prototype=Object.create(l.prototype);p.prototype.constructor=p;t.prototype=Object.create(l.prototype);t.prototype.constructor=t;h.prototype=Object.create(l.prototype); +h.prototype.constructor=h;b.Record=b.Table=l;b.Coverage=n;b.ScriptList=p;b.FeatureList=t;b.LookupList=h;b.ushortList=g;b.tableList=c;b.recordList=k},{'./check':2,'./types':32}],14:[function(e,m,b){function l(b,d){if(b===d)return!0;if(Array.isArray(b)&&Array.isArray(d)){if(b.length!==d.length)return!1;for(var c=0;ce;e+= +1)k.push(u.getOffset(b,n,m)),n+=m;h=g+k[h]}else h=d+2;for(e=0;e>4;g&=15;if(15===e)break;if(d+= +c[e],15===g)break;d+=c[g]}return parseFloat(d)}if(32<=d&&246>=d)return d-139;if(247<=d&&250>=d)return c=b.parseByte(),256*(d-247)+c+108;if(251<=d&&254>=d)return c=b.parseByte(),256*-(d-251)-c-108;throw Error('Invalid b0 '+d);}function k(b,d,e){var g=new u.Parser(b,void 0!==d?d:0);d=[];var h=[];for(e=void 0!==e?e:b.length;g.relativeOffset=b?(12===b&&(b=1200+g.parseByte()),d.push([b,h]),h=[]):h.push(c(g,b));e={};for(b=0;b=d?x.cffStandardStrings[d]:b[d-391]}function p(b,d,c){for(var e={},g=0;g>1;p.length=0;t=!0}function h(c){for(var C, +z,A,D,F,E,G,H,M,J,O=0;OMath.abs(J-y)?x=M+p.shift():y=J+p.shift();q.curveTo(k,l,m,n,F, +E);q.curveTo(G,H,M,J,x,y);break;default:console.log('Glyph '+d.index+': unknown operator 1200'+F),p.length=0}break;case 14:0>3;break;case 21:2>16);O+=2;break;case 29:F=p.pop()+b.gsubrsBias;(F=b.gsubrs[F])&&h(F);break;case 30:for(;0F?console.log('Glyph '+d.index+': unknown operator '+F):247>F?p.push(F-139):251>F?(C=c[O],O+=1,p.push(256*(F-247)+C+108)):255>F?(C=c[O],O+=1,p.push(256*-(F-251)-C-108)):(C=c[O],z=c[O+1],A=c[O+2],D=c[O+3],O+=4,p.push((C<<24|z<<16|A<<8|D)/65536))}} +var k,l,m,n,q=new A.Path,p=[],v=0,t=!1,w=b.defaultWidthX,u=!1,x=0,y=0;return h(c),d.advanceWidth=w,q}function h(b){return 1240>b.length?107:33900>b.length?1131:32768}function d(b,d){var c,e=x.cffStandardStrings.indexOf(b);return e=d.indexOf(b),0<=e?c=e+x.cffStandardStrings.length:(c=x.cffStandardStrings.length+d.length,d.push(b)),c}function v(b,c,e){for(var g={},h=0;hy;y+=1)A=E.parseSID(),l.push(n(w,A));else if(1===y)for(;l.length<=v;)for(A=E.parseSID(),z=E.parseCard8(),y=0;z>= +value:0}];b.parse=function(b,d,c){c.tables.cff={};var e;e={};e=(e.formatMajor=u.getCard8(b,d),e.formatMinor=u.getCard8(b,d+1),e.size=u.getCard8(b,d+2),e.offsetSize=u.getCard8(b,d+3),e.startOffset=d,e.endOffset=d+4,e);e=g(b,e.endOffset,u.bytesToString);e=g(b,e.endOffset);var l=g(b,e.endOffset,u.bytesToString),m=g(b,l.endOffset);c.gsubrs=m.objects;c.gsubrsBias=h(c.gsubrs);m=new DataView((new Uint8Array(e.objects[0])).buffer);e=l.objects;m=k(m,0,m.byteLength);m=p(m,D,e);c.tables.cff.topDict=m;e=d+m['private'][1]; +var v;v=l.objects;var w=k(b,e,m['private'][0]);v=p(w,C,v);(c.defaultWidthX=v.defaultWidthX,c.nominalWidthX=v.nominalWidthX,0!==v.subrs)?(e=g(b,e+v.subrs),c.subrs=e.objects,c.subrsBias=h(c.subrs)):(c.subrs=[],c.subrsBias=0);e=g(b,d+m.charStrings);c.nGlyphs=e.objects.length;v=c.nGlyphs;var w=l.objects,y,A,z,E=new u.Parser(b,d+m.charset);--v;l=['.notdef'];y=E.parseCard8();if(0===y)for(y=0;v>y;y+=1)A=E.parseSID(),l.push(n(w,A));else if(1===y)for(;l.length<=v;)for(A=E.parseSID(),z=E.parseCard8(),y=0;z>= y;y+=1)l.push(n(w,A)),A+=1;else{if(2!==y)throw Error('Unknown charset format '+y);for(;l.length<=v;)for(A=E.parseSID(),z=E.parseCard16(),y=0;z>=y;y+=1)l.push(n(w,A)),A+=1}if(0===m.encoding)b=new x.CffEncoding(x.cffStandardEncoding,l);else if(1===m.encoding)b=new x.CffEncoding(x.cffExpertEncoding,l);else{v={};b=new u.Parser(b,d+m.encoding);d=b.parseCard8();if(0===d)for(w=b.parseCard8(),d=0;w>d;d+=1)m=b.parseCard8(),v[m]=d;else{if(1!==d)throw Error('Unknown encoding format '+d);w=b.parseCard8();m=1; -for(d=0;w>d;d+=1)for(E=b.parseCard8(),y=b.parseCard8(),A=E;E+y>=A;A+=1)v[A]=m,m+=1}b=new x.CffEncoding(v,l)}c.cffEncoding=b;c.encoding=c.encoding||c.cffEncoding;c.glyphs=new q.GlyphSet(c);for(b=0;bb;b+=1)for(m=k.parseULong(),d=k.parseULong(),l=k.parseULong();d>=m;m+=1)h.glyphIndexMap[m]=l,l++}else{if(4!==h.format)throw Error('Only format 4 and 12 cmap tables are supported.');var p=d;h.length=k.parseUShort();h.language=k.parseUShort(); -h.segCount=d=k.parseUShort()>>1;k.skip('uShort',3);h.glyphIndexMap={};k=new c.Parser(b,g+p+14);var l=new c.Parser(b,g+p+16+2*d),m=new c.Parser(b,g+p+16+4*d),q=new c.Parser(b,g+p+16+6*d),p=g+p+16+8*d;for(g=0;d-1>g;g+=1)for(var u=k.parseUShort(),A=l.parseUShort(),E=m.parseShort(),D=q.parseUShort(),C=A;u>=C;C+=1)0!==D?(p=q.offset+q.relativeOffset-2,p+=D,p+=2*(C-A),n=c.getUShort(b,p),0!==n&&(n=n+E&65535)):n=C+E&65535,h.glyphIndexMap[C]=n}return h};b.make=function(b){var c,f=new k.Table('cmap',[{name:'version', -type:'USHORT',value:0},{name:'numTables',type:'USHORT',value:1},{name:'platformID',type:'USHORT',value:3},{name:'encodingID',type:'USHORT',value:1},{name:'offset',type:'ULONG',value:12},{name:'format',type:'USHORT',value:4},{name:'length',type:'USHORT',value:0},{name:'language',type:'USHORT',value:0},{name:'segCountX2',type:'USHORT',value:0},{name:'searchRange',type:'USHORT',value:0},{name:'entrySelector',type:'USHORT',value:0},{name:'rangeShift',type:'USHORT',value:0}]);f.segments=[];for(c=0;cc;c+=1){var x=f.segments[c],g=g.concat({name:'end_'+c,type:'USHORT',value:x.end}), -d=d.concat({name:'start_'+c,type:'USHORT',value:x.start}),m=m.concat({name:'idDelta_'+c,type:'SHORT',value:x.delta}),n=n.concat({name:'idRangeOffset_'+c,type:'USHORT',value:x.offset});void 0!==x.glyphId&&(y=y.concat({name:'glyph_'+c,type:'USHORT',value:x.glyphId}))}return f.fields=f.fields.concat(g),f.fields.push({name:'reservedPad',type:'USHORT',value:0}),f.fields=f.fields.concat(d),f.fields=f.fields.concat(m),f.fields=f.fields.concat(n),f.fields=f.fields.concat(y),f.length=2*g.length+16+2*d.length+ -2*m.length+2*n.length+2*y.length,f}},{'../check':2,'../parse':10,'../table':13}],16:[function(g,m,b){function l(b,c){var d=JSON.stringify(b),f=256,g;for(g in c){var h=parseInt(g);if(h&&!(256>h)){if(JSON.stringify(c[g])===d)return h;h>=f&&(f=h+1)}}return c[f]=b,f}function f(b,c,f){f=l(c.name,f);return[{name:'tag_'+b,type:'TAG',value:c.tag},{name:'minValue_'+b,type:'FIXED',value:c.minValue<<16},{name:'defaultValue_'+b,type:'FIXED',value:c.defaultValue<<16},{name:'maxValue_'+b,type:'FIXED',value:c.maxValue<< -16},{name:'flags_'+b,type:'USHORT',value:0},{name:'nameID_'+b,type:'USHORT',value:f}]}function c(b,c,f){var d={};b=new t.Parser(b,c);return d.tag=b.parseTag(),d.minValue=b.parseFixed(),d.defaultValue=b.parseFixed(),d.maxValue=b.parseFixed(),b.skip('uShort',1),d.name=f[b.parseUShort()]||{},d}function k(b,c,f,g){g=l(c.name,g);g=[{name:'nameID_'+b,type:'USHORT',value:g},{name:'flags_'+b,type:'USHORT',value:0}];for(var d=0;dw;w++)v.push(c(b,f+k+w*m,g));w=[];f=f+k+l*m;for(k=0;h>k;k++)w.push(n(b,f+k*d,v,g));return{axes:v,instances:w}}},{'../check':2,'../parse':10,'../table':13}],17:[function(g,m,b){function l(b,c,f,g,h){var d;return 0<(c&g)?(d=b.parseByte(),0===(c&h)&&(d=-d),d=f+d):d=0<(c&h)?f:f+b.parseShort(),d}function f(b,c,f){c=new t.Parser(c,f);b.numberOfContours=c.parseShort();b._xMin=c.parseShort();b._yMin=c.parseShort(); -b._xMax=c.parseShort();b._yMax=c.parseShort();var d;if(0g;g+=1)if(d=c.parseByte(),f.push(d),0<(8&d))for(var m=c.parseByte(),p=0;m>p;p+=1)f.push(d),g+=1;if(n.argument(f.length===k,'Bad flags.'),0g;g+= -1)d=f[g],m={},m.onCurve=!!(1&d),m.lastPointOfContour=0<=h.indexOf(g),p.push(m);for(g=h=0;k>g;g+=1)d=f[g],m=p[g],m.x=l(c,d,h,2,16),h=m.x;for(g=h=0;k>g;g+=1)d=f[g],m=p[g],m.y=l(c,d,h,4,32),h=m.y}b.points=p}else b.points=[]}else if(0===b.numberOfContours)b.points=[];else for(b.isComposite=!0,b.points=[],b.components=[],d=!0;d;)f=c.parseUShort(),d={glyphIndex:c.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0},0<(1&f)?0<(2&f)?(d.dx=c.parseShort(),d.dy=c.parseShort()):d.matchedPoints=[c.parseUShort(), -c.parseUShort()]:0<(2&f)?(d.dx=c.parseChar(),d.dy=c.parseChar()):d.matchedPoints=[c.parseByte(),c.parseByte()],0<(8&f)?d.xScale=d.yScale=c.parseF2Dot14():0<(64&f)?(d.xScale=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()):0<(128&f)&&(d.xScale=c.parseF2Dot14(),d.scale01=c.parseF2Dot14(),d.scale10=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()),b.components.push(d),d=!!(32&f)}function c(b,c){for(var d=[],f=0;ff.points.length-1||g.matchedPoints[1]>k.points.length-1)throw Error('Matched points out of range in '+f.name);var l=f.points[g.matchedPoints[0]],m=k.points[g.matchedPoints[1]],g={xScale:g.xScale,scale01:g.scale01,scale10:g.scale10,yScale:g.yScale, -dx:0,dy:0},m=c([m],g)[0];g.dx=l.x-m.x;g.dy=l.y-m.y}k=c(k.points,g);f.points=f.points.concat(k)}}var p;f=f.points;b=new h.Path;if(f){d=[];k=[];for(l=0;lf;f++)c[b.parseTag()]={offset:b.parseUShort()};return c}function f(b,d){b=new t.Parser(b,d);var c=b.parseUShort();d=b.parseUShort();if(1===c)return b.parseUShortList(d);if(2===c){for(c=[];d--;)for(var f=b.parseUShort(), -g=b.parseUShort(),h=b.parseUShort();g>=f;f++)c[h++]=f;return c}}function c(b,d){b=new t.Parser(b,d);d=b.parseUShort();if(1===d){var c=b.parseUShort();d=b.parseUShort();var f=b.parseUShortList(d);return function(b){return f[b-c]||0}}if(2===d){d=b.parseUShort();for(var g=[],h=[],k=[],l=0;d>l;l++)g[l]=b.parseUShort(),h[l]=b.parseUShort(),k[l]=b.parseUShort();return function(b){for(var d=0,c=g.length-1;c>d;){var f=d+c+1>>1;bk;k++){var D=d[k],C=p[D];if(!C)for(C={},h.relativeOffset=D,D=h.parseUShort();D--;){var F=h.parseUShort();m&&(g=h.parseShort());n&&h.parseShort();C[F]=g}E[l[k]]=C}return function(b,d){return(b=E[b])?b[d]:void 0}}if(2===k){var C=h.parseUShort(),D=h.parseUShort(),p=h.parseUShort(),k=h.parseUShort(),z=c(b,d+C),H=c(b,d+D), -G=[];for(b=0;p>b;b++)for(d=G[b]=[],C=0;k>C;C++)m&&(g=h.parseShort()),n&&h.parseShort(),d[C]=g;var O={};for(b=0;bf;f++)n.push(k(b,d+m[f]));c.getKerningValue=function(b,d){for(var c= -n.length;c--;){var f=n[c](b,d);if(void 0!==f)return f}return 0}}return c}var p=g('../check'),t=g('../parse');b.parse=function(b,d,c){var f=new t.Parser(b,d),g=f.parseFixed();p.argument(1===g,'Unsupported GPOS table version.');l(b,d+f.parseUShort());l(b,d+f.parseUShort());var h=f.parseUShort();f.relativeOffset=h;g=f.parseUShort();f=f.parseOffset16List(g);d+=h;for(h=0;g>h;h++){var k=n(b,d+f[h]);2!==k.lookupType||c.getGposKerningValue||(c.getGposKerningValue=k.getKerningValue)}}},{'../check':2,'../parse':10}], -19:[function(g,m,b){var l=g('../check'),f=g('../parse').Parser,c=Array(9),k=g('../table');c[1]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(f.coverage),deltaGlyphId:this.parseUShort()}:2===c?{substFormat:2,coverage:this.parsePointer(f.coverage),substitute:this.parseOffset16List()}:void l.assert(!1,'0x'+b.toString(16)+': lookup type 1 format must be 1 or 2.')};c[2]=function(){var b=this.parseUShort();return l.argument(1=== -b,'GSUB Multiple Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(f.coverage),sequences:this.parseListOfLists()}};c[3]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Alternate Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(f.coverage),alternateSets:this.parseListOfLists()}};c[4]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB ligature table identifier-format must be 1'), -{substFormat:b,coverage:this.parsePointer(f.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var n={sequenceIndex:f.uShort,lookupListIndex:f.uShort};c[5]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();if(1===c)return{substFormat:c,coverage:this.parsePointer(f.coverage),ruleSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(b- -1),lookupRecords:this.parseRecordList(d,n)}})};if(2===c)return{substFormat:c,coverage:this.parsePointer(f.coverage),classDef:this.parsePointer(f.classDef),classSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(b-1),lookupRecords:this.parseRecordList(d,n)}})};if(3===c){var b=this.parseUShort(),d=this.parseUShort();return{substFormat:c,coverages:this.parseList(b,f.pointer(f.coverage)),lookupRecords:this.parseRecordList(d,n)}}l.assert(!1, -'0x'+b.toString(16)+': lookup type 5 format must be 1, 2 or 3.')};c[6]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(f.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:2===c?{substFormat:2,coverage:this.parsePointer(f.coverage),backtrackClassDef:this.parsePointer(f.classDef), -inputClassDef:this.parsePointer(f.classDef),lookaheadClassDef:this.parsePointer(f.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:3===c?{substFormat:3,backtrackCoverage:this.parseList(f.pointer(f.coverage)),inputCoverage:this.parseList(f.pointer(f.coverage)),lookaheadCoverage:this.parseList(f.pointer(f.coverage)),lookupRecords:this.parseRecordList(n)}: -void l.assert(!1,'0x'+b.toString(16)+': lookup type 6 format must be 1, 2 or 3.')};c[7]=function(){var b=this.parseUShort();l.argument(1===b,'GSUB Extension Substitution subtable identifier-format must be 1');var b=this.parseUShort(),g=new f(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:b,extension:c[b].call(g)}};c[8]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1'),{substFormat:b, -coverage:this.parsePointer(f.coverage),backtrackCoverage:this.parseList(f.pointer(f.coverage)),lookaheadCoverage:this.parseList(f.pointer(f.coverage)),substitutes:this.parseUShortList()}};var p=Array(9);p[1]=function(b){return 1===b.substFormat?new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)},{name:'deltaGlyphID',type:'USHORT',value:b.deltaGlyphId}]):new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT', +for(d=0;w>d;d+=1)for(E=b.parseCard8(),y=b.parseCard8(),A=E;E+y>=A;A+=1)v[A]=m,m+=1}b=new x.CffEncoding(v,l)}c.cffEncoding=b;c.encoding=c.encoding||c.cffEncoding;c.glyphs=new q.GlyphSet(c);for(b=0;bb;b+=1)for(m=k.parseULong(),d=k.parseULong(),l=k.parseULong();d>=m;m+=1)h.glyphIndexMap[m]=l,l++}else{if(4!==h.format)throw Error('Only format 4 and 12 cmap tables are supported.');var p=d;h.length=k.parseUShort();h.language=k.parseUShort(); +h.segCount=d=k.parseUShort()>>1;k.skip('uShort',3);h.glyphIndexMap={};k=new c.Parser(b,e+p+14);var l=new c.Parser(b,e+p+16+2*d),m=new c.Parser(b,e+p+16+4*d),q=new c.Parser(b,e+p+16+6*d),p=e+p+16+8*d;for(e=0;d-1>e;e+=1)for(var u=k.parseUShort(),A=l.parseUShort(),E=m.parseShort(),D=q.parseUShort(),C=A;u>=C;C+=1)0!==D?(p=q.offset+q.relativeOffset-2,p+=D,p+=2*(C-A),n=c.getUShort(b,p),0!==n&&(n=n+E&65535)):n=C+E&65535,h.glyphIndexMap[C]=n}return h};b.make=function(b){var c,e=new k.Table('cmap',[{name:'version', +type:'USHORT',value:0},{name:'numTables',type:'USHORT',value:1},{name:'platformID',type:'USHORT',value:3},{name:'encodingID',type:'USHORT',value:1},{name:'offset',type:'ULONG',value:12},{name:'format',type:'USHORT',value:4},{name:'length',type:'USHORT',value:0},{name:'language',type:'USHORT',value:0},{name:'segCountX2',type:'USHORT',value:0},{name:'searchRange',type:'USHORT',value:0},{name:'entrySelector',type:'USHORT',value:0},{name:'rangeShift',type:'USHORT',value:0}]);e.segments=[];for(c=0;cc;c+=1){var x=e.segments[c],g=g.concat({name:'end_'+c,type:'USHORT',value:x.end}), +d=d.concat({name:'start_'+c,type:'USHORT',value:x.start}),m=m.concat({name:'idDelta_'+c,type:'SHORT',value:x.delta}),n=n.concat({name:'idRangeOffset_'+c,type:'USHORT',value:x.offset});void 0!==x.glyphId&&(y=y.concat({name:'glyph_'+c,type:'USHORT',value:x.glyphId}))}return e.fields=e.fields.concat(g),e.fields.push({name:'reservedPad',type:'USHORT',value:0}),e.fields=e.fields.concat(d),e.fields=e.fields.concat(m),e.fields=e.fields.concat(n),e.fields=e.fields.concat(y),e.length=2*g.length+16+2*d.length+ +2*m.length+2*n.length+2*y.length,e}},{'../check':2,'../parse':10,'../table':13}],16:[function(e,m,b){function l(b,c){var d=JSON.stringify(b),e=256,g;for(g in c){var h=parseInt(g);if(h&&!(256>h)){if(JSON.stringify(c[g])===d)return h;h>=e&&(e=h+1)}}return c[e]=b,e}function g(b,c,e){e=l(c.name,e);return[{name:'tag_'+b,type:'TAG',value:c.tag},{name:'minValue_'+b,type:'FIXED',value:c.minValue<<16},{name:'defaultValue_'+b,type:'FIXED',value:c.defaultValue<<16},{name:'maxValue_'+b,type:'FIXED',value:c.maxValue<< +16},{name:'flags_'+b,type:'USHORT',value:0},{name:'nameID_'+b,type:'USHORT',value:e}]}function c(b,c,e){var d={};b=new t.Parser(b,c);return d.tag=b.parseTag(),d.minValue=b.parseFixed(),d.defaultValue=b.parseFixed(),d.maxValue=b.parseFixed(),b.skip('uShort',1),d.name=e[b.parseUShort()]||{},d}function k(b,c,e,g){g=l(c.name,g);g=[{name:'nameID_'+b,type:'USHORT',value:g},{name:'flags_'+b,type:'USHORT',value:0}];for(var d=0;dw;w++)v.push(c(b,e+k+w*m,g));w=[];e=e+k+l*m;for(k=0;h>k;k++)w.push(n(b,e+k*d,v,g));return{axes:v,instances:w}}},{'../check':2,'../parse':10,'../table':13}],17:[function(e,m,b){function l(b,c,e,g,h){var d;return 0<(c&g)?(d=b.parseByte(),0===(c&h)&&(d=-d),d=e+d):d=0<(c&h)?e:e+b.parseShort(),d}function g(b,c,e){c=new t.Parser(c,e);b.numberOfContours=c.parseShort();b._xMin=c.parseShort();b._yMin=c.parseShort(); +b._xMax=c.parseShort();b._yMax=c.parseShort();var d;if(0g;g+=1)if(d=c.parseByte(),e.push(d),0<(8&d))for(var m=c.parseByte(),p=0;m>p;p+=1)e.push(d),g+=1;if(n.argument(e.length===k,'Bad flags.'),0g;g+= +1)d=e[g],m={},m.onCurve=!!(1&d),m.lastPointOfContour=0<=h.indexOf(g),p.push(m);for(g=h=0;k>g;g+=1)d=e[g],m=p[g],m.x=l(c,d,h,2,16),h=m.x;for(g=h=0;k>g;g+=1)d=e[g],m=p[g],m.y=l(c,d,h,4,32),h=m.y}b.points=p}else b.points=[]}else if(0===b.numberOfContours)b.points=[];else for(b.isComposite=!0,b.points=[],b.components=[],d=!0;d;)e=c.parseUShort(),d={glyphIndex:c.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0},0<(1&e)?0<(2&e)?(d.dx=c.parseShort(),d.dy=c.parseShort()):d.matchedPoints=[c.parseUShort(), +c.parseUShort()]:0<(2&e)?(d.dx=c.parseChar(),d.dy=c.parseChar()):d.matchedPoints=[c.parseByte(),c.parseByte()],0<(8&e)?d.xScale=d.yScale=c.parseF2Dot14():0<(64&e)?(d.xScale=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()):0<(128&e)&&(d.xScale=c.parseF2Dot14(),d.scale01=c.parseF2Dot14(),d.scale10=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()),b.components.push(d),d=!!(32&e)}function c(b,c){for(var d=[],e=0;ee.points.length-1||g.matchedPoints[1]>k.points.length-1)throw Error('Matched points out of range in '+e.name);var l=e.points[g.matchedPoints[0]],m=k.points[g.matchedPoints[1]],g={xScale:g.xScale,scale01:g.scale01,scale10:g.scale10,yScale:g.yScale, +dx:0,dy:0},m=c([m],g)[0];g.dx=l.x-m.x;g.dy=l.y-m.y}k=c(k.points,g);e.points=e.points.concat(k)}}var p;e=e.points;b=new h.Path;if(e){d=[];k=[];for(l=0;le;e++)c[b.parseTag()]={offset:b.parseUShort()};return c}function g(b,d){b=new t.Parser(b,d);var c=b.parseUShort();d=b.parseUShort();if(1===c)return b.parseUShortList(d);if(2===c){for(c=[];d--;)for(var e=b.parseUShort(), +g=b.parseUShort(),h=b.parseUShort();g>=e;e++)c[h++]=e;return c}}function c(b,d){b=new t.Parser(b,d);d=b.parseUShort();if(1===d){var c=b.parseUShort();d=b.parseUShort();var e=b.parseUShortList(d);return function(b){return e[b-c]||0}}if(2===d){d=b.parseUShort();for(var g=[],h=[],k=[],l=0;d>l;l++)g[l]=b.parseUShort(),h[l]=b.parseUShort(),k[l]=b.parseUShort();return function(b){for(var d=0,c=g.length-1;c>d;){var e=d+c+1>>1;bk;k++){var D=d[k],C=p[D];if(!C)for(C={},h.relativeOffset=D,D=h.parseUShort();D--;){var F=h.parseUShort();m&&(e=h.parseShort());n&&h.parseShort();C[F]=e}E[l[k]]=C}return function(b,d){return(b=E[b])?b[d]:void 0}}if(2===k){var C=h.parseUShort(),D=h.parseUShort(),p=h.parseUShort(),k=h.parseUShort(),z=c(b,d+C),H=c(b,d+D), +G=[];for(b=0;p>b;b++)for(d=G[b]=[],C=0;k>C;C++)m&&(e=h.parseShort()),n&&h.parseShort(),d[C]=e;var O={};for(b=0;be;e++)n.push(k(b,d+m[e]));c.getKerningValue=function(b,d){for(var c= +n.length;c--;){var e=n[c](b,d);if(void 0!==e)return e}return 0}}return c}var p=e('../check'),t=e('../parse');b.parse=function(b,d,c){var e=new t.Parser(b,d),g=e.parseFixed();p.argument(1===g,'Unsupported GPOS table version.');l(b,d+e.parseUShort());l(b,d+e.parseUShort());var h=e.parseUShort();e.relativeOffset=h;g=e.parseUShort();e=e.parseOffset16List(g);d+=h;for(h=0;g>h;h++){var k=n(b,d+e[h]);2!==k.lookupType||c.getGposKerningValue||(c.getGposKerningValue=k.getKerningValue)}}},{'../check':2,'../parse':10}], +19:[function(e,m,b){var l=e('../check'),g=e('../parse').Parser,c=Array(9),k=e('../table');c[1]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(g.coverage),deltaGlyphId:this.parseUShort()}:2===c?{substFormat:2,coverage:this.parsePointer(g.coverage),substitute:this.parseOffset16List()}:void l.assert(!1,'0x'+b.toString(16)+': lookup type 1 format must be 1 or 2.')};c[2]=function(){var b=this.parseUShort();return l.argument(1=== +b,'GSUB Multiple Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(g.coverage),sequences:this.parseListOfLists()}};c[3]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Alternate Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(g.coverage),alternateSets:this.parseListOfLists()}};c[4]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB ligature table identifier-format must be 1'), +{substFormat:b,coverage:this.parsePointer(g.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var n={sequenceIndex:g.uShort,lookupListIndex:g.uShort};c[5]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();if(1===c)return{substFormat:c,coverage:this.parsePointer(g.coverage),ruleSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(b- +1),lookupRecords:this.parseRecordList(d,n)}})};if(2===c)return{substFormat:c,coverage:this.parsePointer(g.coverage),classDef:this.parsePointer(g.classDef),classSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(b-1),lookupRecords:this.parseRecordList(d,n)}})};if(3===c){var b=this.parseUShort(),d=this.parseUShort();return{substFormat:c,coverages:this.parseList(b,g.pointer(g.coverage)),lookupRecords:this.parseRecordList(d,n)}}l.assert(!1, +'0x'+b.toString(16)+': lookup type 5 format must be 1, 2 or 3.')};c[6]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(g.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:2===c?{substFormat:2,coverage:this.parsePointer(g.coverage),backtrackClassDef:this.parsePointer(g.classDef), +inputClassDef:this.parsePointer(g.classDef),lookaheadClassDef:this.parsePointer(g.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:3===c?{substFormat:3,backtrackCoverage:this.parseList(g.pointer(g.coverage)),inputCoverage:this.parseList(g.pointer(g.coverage)),lookaheadCoverage:this.parseList(g.pointer(g.coverage)),lookupRecords:this.parseRecordList(n)}: +void l.assert(!1,'0x'+b.toString(16)+': lookup type 6 format must be 1, 2 or 3.')};c[7]=function(){var b=this.parseUShort();l.argument(1===b,'GSUB Extension Substitution subtable identifier-format must be 1');var b=this.parseUShort(),e=new g(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:b,extension:c[b].call(e)}};c[8]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1'),{substFormat:b, +coverage:this.parsePointer(g.coverage),backtrackCoverage:this.parseList(g.pointer(g.coverage)),lookaheadCoverage:this.parseList(g.pointer(g.coverage)),substitutes:this.parseUShortList()}};var p=Array(9);p[1]=function(b){return 1===b.substFormat?new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)},{name:'deltaGlyphID',type:'USHORT',value:b.deltaGlyphId}]):new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT', value:2},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)}].concat(k.ushortList('substitute',b.substitute)))};p[3]=function(b){return l.assert(1===b.substFormat,'Lookup type 3 substFormat must be 1.'),new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)}].concat(k.tableList('altSet',b.alternateSets,function(b){return new k.Table('alternateSetTable',k.ushortList('alternate',b))})))};p[4]=function(b){return l.assert(1=== b.substFormat,'Lookup type 4 substFormat must be 1.'),new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)}].concat(k.tableList('ligSet',b.ligatureSets,function(b){return new k.Table('ligatureSetTable',k.tableList('ligature',b,function(b){return new k.Table('ligatureTable',[{name:'ligGlyph',type:'USHORT',value:b.ligGlyph}].concat(k.ushortList('component',b.components,b.components.length+1)))}))})))};b.parse=function(b, -g){b=new f(b,g||0);g=b.parseVersion();return l.argument(1===g,'Unsupported GSUB table version.'),{version:g,scripts:b.parseScriptList(),features:b.parseFeatureList(),lookups:b.parseLookupList(c)}};b.make=function(b){return new k.Table('GSUB',[{name:'version',type:'ULONG',value:65536},{name:'scripts',type:'TABLE',value:new k.ScriptList(b.scripts)},{name:'features',type:'TABLE',value:new k.FeatureList(b.features)},{name:'lookups',type:'TABLE',value:new k.LookupList(b.lookups,p)}])}},{'../check':2,'../parse':10, -'../table':13}],20:[function(g,m,b){var l=g('../check'),f=g('../parse'),c=g('../table');b.parse=function(b,c){var g={};b=new f.Parser(b,c);return g.version=b.parseVersion(),g.fontRevision=Math.round(1E3*b.parseFixed())/1E3,g.checkSumAdjustment=b.parseULong(),g.magicNumber=b.parseULong(),l.argument(1594834165===g.magicNumber,'Font header has wrong magic number.'),g.flags=b.parseUShort(),g.unitsPerEm=b.parseUShort(),g.created=b.parseLongDateTime(),g.modified=b.parseLongDateTime(),g.xMin=b.parseShort(), -g.yMin=b.parseShort(),g.xMax=b.parseShort(),g.yMax=b.parseShort(),g.macStyle=b.parseUShort(),g.lowestRecPPEM=b.parseUShort(),g.fontDirectionHint=b.parseShort(),g.indexToLocFormat=b.parseShort(),g.glyphDataFormat=b.parseShort(),g};b.make=function(b){var f=Math.round((new Date).getTime()/1E3)+2082844800,g=f;return b.createdTimestamp&&(g=b.createdTimestamp+2082844800),new c.Table('head',[{name:'version',type:'FIXED',value:65536},{name:'fontRevision',type:'FIXED',value:65536},{name:'checkSumAdjustment', -type:'ULONG',value:0},{name:'magicNumber',type:'ULONG',value:1594834165},{name:'flags',type:'USHORT',value:0},{name:'unitsPerEm',type:'USHORT',value:1E3},{name:'created',type:'LONGDATETIME',value:g},{name:'modified',type:'LONGDATETIME',value:f},{name:'xMin',type:'SHORT',value:0},{name:'yMin',type:'SHORT',value:0},{name:'xMax',type:'SHORT',value:0},{name:'yMax',type:'SHORT',value:0},{name:'macStyle',type:'USHORT',value:0},{name:'lowestRecPPEM',type:'USHORT',value:0},{name:'fontDirectionHint',type:'SHORT', -value:2},{name:'indexToLocFormat',type:'SHORT',value:0},{name:'glyphDataFormat',type:'SHORT',value:0}],b)}},{'../check':2,'../parse':10,'../table':13}],21:[function(g,m,b){var l=g('../parse'),f=g('../table');b.parse=function(b,f){var c={};b=new l.Parser(b,f);return c.version=b.parseVersion(),c.ascender=b.parseShort(),c.descender=b.parseShort(),c.lineGap=b.parseShort(),c.advanceWidthMax=b.parseUShort(),c.minLeftSideBearing=b.parseShort(),c.minRightSideBearing=b.parseShort(),c.xMaxExtent=b.parseShort(), -c.caretSlopeRise=b.parseShort(),c.caretSlopeRun=b.parseShort(),c.caretOffset=b.parseShort(),b.relativeOffset+=8,c.metricDataFormat=b.parseShort(),c.numberOfHMetrics=b.parseUShort(),c};b.make=function(b){return new f.Table('hhea',[{name:'version',type:'FIXED',value:65536},{name:'ascender',type:'FWORD',value:0},{name:'descender',type:'FWORD',value:0},{name:'lineGap',type:'FWORD',value:0},{name:'advanceWidthMax',type:'UFWORD',value:0},{name:'minLeftSideBearing',type:'FWORD',value:0},{name:'minRightSideBearing', -type:'FWORD',value:0},{name:'xMaxExtent',type:'FWORD',value:0},{name:'caretSlopeRise',type:'SHORT',value:1},{name:'caretSlopeRun',type:'SHORT',value:0},{name:'caretOffset',type:'SHORT',value:0},{name:'reserved1',type:'SHORT',value:0},{name:'reserved2',type:'SHORT',value:0},{name:'reserved3',type:'SHORT',value:0},{name:'reserved4',type:'SHORT',value:0},{name:'metricDataFormat',type:'SHORT',value:0},{name:'numberOfHMetrics',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],22:[function(g, -m,b){var l=g('../parse'),f=g('../table');b.parse=function(b,f,g,m,t){var c,d;b=new l.Parser(b,f);for(f=0;m>f;f+=1){g>f&&(c=b.parseUShort(),d=b.parseShort());var k=t.get(f);k.advanceWidth=c;k.leftSideBearing=d}};b.make=function(b){for(var c=new f.Table('hmtx',[]),g=0;gk;k+=1){var m=b.parseUShort(),h=b.parseUShort(),d=b.parseShort();c[m+','+h]=d}return c}},{'../check':2,'../parse':10}],24:[function(g,m,b){var l=g('../parse');b.parse= -function(b,c,g,m){b=new l.Parser(b,c);c=m?b.parseUShort:b.parseULong;for(var f=[],k=0;g+1>k;k+=1){var h=c.call(b);m&&(h*=2);f.push(h)}return f}},{'../parse':10}],25:[function(g,m,b){var l=g('../check'),f=g('../parse'),c=g('../table');b.make=function(b){for(var f=new c.Table('ltag',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'numTags',type:'ULONG',value:b.length}]),g='',k=12+4*b.length,h=0;hd&&(d=g.length,g+=b[h]);f.fields.push({name:'offset '+ -h,type:'USHORT',value:k+d});f.fields.push({name:'length '+h,type:'USHORT',value:b[h].length})}return f.fields.push({name:'stringPool',type:'CHARARRAY',value:g}),f};b.parse=function(b,c){var g=new f.Parser(b,c),k=g.parseULong();l.argument(1===k,'Unsupported ltag table version.');g.skip('uLong',1);for(var k=g.parseULong(),h=[],d=0;k>d;d++){for(var m='',n=c+g.parseUShort(),y=g.parseUShort(),x=n;n+y>x;++x)m+=String.fromCharCode(b.getInt8(x));h.push(m)}return h}},{'../check':2,'../parse':10,'../table':13}], -26:[function(g,m,b){var l=g('../parse'),f=g('../table');b.parse=function(b,f){var c={};b=new l.Parser(b,f);return c.version=b.parseVersion(),c.numGlyphs=b.parseUShort(),1===c.version&&(c.maxPoints=b.parseUShort(),c.maxContours=b.parseUShort(),c.maxCompositePoints=b.parseUShort(),c.maxCompositeContours=b.parseUShort(),c.maxZones=b.parseUShort(),c.maxTwilightPoints=b.parseUShort(),c.maxStorage=b.parseUShort(),c.maxFunctionDefs=b.parseUShort(),c.maxInstructionDefs=b.parseUShort(),c.maxStackElements= -b.parseUShort(),c.maxSizeOfInstructions=b.parseUShort(),c.maxComponentElements=b.parseUShort(),c.maxComponentDepth=b.parseUShort()),c};b.make=function(b){return new f.Table('maxp',[{name:'version',type:'FIXED',value:20480},{name:'numGlyphs',type:'USHORT',value:b}])}},{'../parse':10,'../table':13}],27:[function(g,m,b){var l=g('../types').decode,f=g('../check'),c=g('../parse'),k=g('../table');b.parse=function(b,g){var k=new c.Parser(b,g),h=k.parseULong();f.argument(1===h,'Unsupported META table version.'); -k.parseULong();k.parseULong();for(var h=k.parseULong(),d={},m=0;h>m;m++){var n=k.parseTag(),p=k.parseULong(),x=k.parseULong(),p=l.UTF8(b,g+p,x);d[n]=p}return d};b.make=function(b){var c=Object.keys(b).length,f='',g=16+12*c,c=new k.Table('meta',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'offset',type:'ULONG',value:g},{name:'numTags',type:'ULONG',value:c}]),d;for(d in b){var l=f.length,f=f+b[d];c.fields.push({name:'tag '+d,type:'TAG',value:d});c.fields.push({name:'offset '+ -d,type:'ULONG',value:g+l});c.fields.push({name:'length '+d,type:'ULONG',value:b[d].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:f}),c}},{'../check':2,'../parse':10,'../table':13,'../types':32}],28:[function(g,m,b){function l(b,d,c){switch(b){case 0:return x;case 1:return u[c]||q[d];case 3:if(1===d||10===d)return x}}function f(b){var d={},c;for(c in b)d[b[c]]=parseInt(c);return d}function c(b,d,c,f,g,k){return new h.Record('NameRecord',[{name:'platformID',type:'USHORT',value:b}, -{name:'encodingID',type:'USHORT',value:d},{name:'languageID',type:'USHORT',value:c},{name:'nameID',type:'USHORT',value:f},{name:'length',type:'USHORT',value:g},{name:'offset',type:'USHORT',value:k}])}function k(b,d){var c;a:{c=b.length;var f=d.length-c+1,g=0;b:for(;f>g;g++)for(;f>g;){for(var h=0;c>h;h++)if(d[g+h]!==b[h])continue b;c=g;break a}c=-1}if(0>c)for(c=d.length,f=0,g=b.length;g>f;++f)d.push(b[f]);return c}m=g('../types');var n=m.decode,p=m.encode,t=g('../parse'),h=g('../table'),d='copyright fontFamily fontSubfamily uniqueID fullName version postScriptName trademark manufacturer designer description manufacturerURL designerURL license licenseURL reserved preferredFamily preferredSubfamily compatibleFullName sampleText postScriptFindFontName wwsFamily wwsSubfamily'.split(' '), +e){b=new g(b,e||0);e=b.parseVersion();return l.argument(1===e,'Unsupported GSUB table version.'),{version:e,scripts:b.parseScriptList(),features:b.parseFeatureList(),lookups:b.parseLookupList(c)}};b.make=function(b){return new k.Table('GSUB',[{name:'version',type:'ULONG',value:65536},{name:'scripts',type:'TABLE',value:new k.ScriptList(b.scripts)},{name:'features',type:'TABLE',value:new k.FeatureList(b.features)},{name:'lookups',type:'TABLE',value:new k.LookupList(b.lookups,p)}])}},{'../check':2,'../parse':10, +'../table':13}],20:[function(e,m,b){var l=e('../check'),g=e('../parse'),c=e('../table');b.parse=function(b,c){var e={};b=new g.Parser(b,c);return e.version=b.parseVersion(),e.fontRevision=Math.round(1E3*b.parseFixed())/1E3,e.checkSumAdjustment=b.parseULong(),e.magicNumber=b.parseULong(),l.argument(1594834165===e.magicNumber,'Font header has wrong magic number.'),e.flags=b.parseUShort(),e.unitsPerEm=b.parseUShort(),e.created=b.parseLongDateTime(),e.modified=b.parseLongDateTime(),e.xMin=b.parseShort(), +e.yMin=b.parseShort(),e.xMax=b.parseShort(),e.yMax=b.parseShort(),e.macStyle=b.parseUShort(),e.lowestRecPPEM=b.parseUShort(),e.fontDirectionHint=b.parseShort(),e.indexToLocFormat=b.parseShort(),e.glyphDataFormat=b.parseShort(),e};b.make=function(b){var e=Math.round((new Date).getTime()/1E3)+2082844800,g=e;return b.createdTimestamp&&(g=b.createdTimestamp+2082844800),new c.Table('head',[{name:'version',type:'FIXED',value:65536},{name:'fontRevision',type:'FIXED',value:65536},{name:'checkSumAdjustment', +type:'ULONG',value:0},{name:'magicNumber',type:'ULONG',value:1594834165},{name:'flags',type:'USHORT',value:0},{name:'unitsPerEm',type:'USHORT',value:1E3},{name:'created',type:'LONGDATETIME',value:g},{name:'modified',type:'LONGDATETIME',value:e},{name:'xMin',type:'SHORT',value:0},{name:'yMin',type:'SHORT',value:0},{name:'xMax',type:'SHORT',value:0},{name:'yMax',type:'SHORT',value:0},{name:'macStyle',type:'USHORT',value:0},{name:'lowestRecPPEM',type:'USHORT',value:0},{name:'fontDirectionHint',type:'SHORT', +value:2},{name:'indexToLocFormat',type:'SHORT',value:0},{name:'glyphDataFormat',type:'SHORT',value:0}],b)}},{'../check':2,'../parse':10,'../table':13}],21:[function(e,m,b){var l=e('../parse'),g=e('../table');b.parse=function(b,e){var c={};b=new l.Parser(b,e);return c.version=b.parseVersion(),c.ascender=b.parseShort(),c.descender=b.parseShort(),c.lineGap=b.parseShort(),c.advanceWidthMax=b.parseUShort(),c.minLeftSideBearing=b.parseShort(),c.minRightSideBearing=b.parseShort(),c.xMaxExtent=b.parseShort(), +c.caretSlopeRise=b.parseShort(),c.caretSlopeRun=b.parseShort(),c.caretOffset=b.parseShort(),b.relativeOffset+=8,c.metricDataFormat=b.parseShort(),c.numberOfHMetrics=b.parseUShort(),c};b.make=function(b){return new g.Table('hhea',[{name:'version',type:'FIXED',value:65536},{name:'ascender',type:'FWORD',value:0},{name:'descender',type:'FWORD',value:0},{name:'lineGap',type:'FWORD',value:0},{name:'advanceWidthMax',type:'UFWORD',value:0},{name:'minLeftSideBearing',type:'FWORD',value:0},{name:'minRightSideBearing', +type:'FWORD',value:0},{name:'xMaxExtent',type:'FWORD',value:0},{name:'caretSlopeRise',type:'SHORT',value:1},{name:'caretSlopeRun',type:'SHORT',value:0},{name:'caretOffset',type:'SHORT',value:0},{name:'reserved1',type:'SHORT',value:0},{name:'reserved2',type:'SHORT',value:0},{name:'reserved3',type:'SHORT',value:0},{name:'reserved4',type:'SHORT',value:0},{name:'metricDataFormat',type:'SHORT',value:0},{name:'numberOfHMetrics',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],22:[function(e, +m,b){var l=e('../parse'),g=e('../table');b.parse=function(b,e,g,m,t){var c,d;b=new l.Parser(b,e);for(e=0;m>e;e+=1){g>e&&(c=b.parseUShort(),d=b.parseShort());var k=t.get(e);k.advanceWidth=c;k.leftSideBearing=d}};b.make=function(b){for(var c=new g.Table('hmtx',[]),e=0;ek;k+=1){var m=b.parseUShort(),h=b.parseUShort(),d=b.parseShort();c[m+','+h]=d}return c}},{'../check':2,'../parse':10}],24:[function(e,m,b){var l=e('../parse');b.parse= +function(b,c,e,m){b=new l.Parser(b,c);c=m?b.parseUShort:b.parseULong;for(var g=[],k=0;e+1>k;k+=1){var h=c.call(b);m&&(h*=2);g.push(h)}return g}},{'../parse':10}],25:[function(e,m,b){var l=e('../check'),g=e('../parse'),c=e('../table');b.make=function(b){for(var e=new c.Table('ltag',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'numTags',type:'ULONG',value:b.length}]),g='',k=12+4*b.length,h=0;hd&&(d=g.length,g+=b[h]);e.fields.push({name:'offset '+ +h,type:'USHORT',value:k+d});e.fields.push({name:'length '+h,type:'USHORT',value:b[h].length})}return e.fields.push({name:'stringPool',type:'CHARARRAY',value:g}),e};b.parse=function(b,c){var e=new g.Parser(b,c),k=e.parseULong();l.argument(1===k,'Unsupported ltag table version.');e.skip('uLong',1);for(var k=e.parseULong(),h=[],d=0;k>d;d++){for(var m='',n=c+e.parseUShort(),y=e.parseUShort(),x=n;n+y>x;++x)m+=String.fromCharCode(b.getInt8(x));h.push(m)}return h}},{'../check':2,'../parse':10,'../table':13}], +26:[function(e,m,b){var l=e('../parse'),g=e('../table');b.parse=function(b,e){var c={};b=new l.Parser(b,e);return c.version=b.parseVersion(),c.numGlyphs=b.parseUShort(),1===c.version&&(c.maxPoints=b.parseUShort(),c.maxContours=b.parseUShort(),c.maxCompositePoints=b.parseUShort(),c.maxCompositeContours=b.parseUShort(),c.maxZones=b.parseUShort(),c.maxTwilightPoints=b.parseUShort(),c.maxStorage=b.parseUShort(),c.maxFunctionDefs=b.parseUShort(),c.maxInstructionDefs=b.parseUShort(),c.maxStackElements= +b.parseUShort(),c.maxSizeOfInstructions=b.parseUShort(),c.maxComponentElements=b.parseUShort(),c.maxComponentDepth=b.parseUShort()),c};b.make=function(b){return new g.Table('maxp',[{name:'version',type:'FIXED',value:20480},{name:'numGlyphs',type:'USHORT',value:b}])}},{'../parse':10,'../table':13}],27:[function(e,m,b){var l=e('../types').decode,g=e('../check'),c=e('../parse'),k=e('../table');b.parse=function(b,e){var k=new c.Parser(b,e),h=k.parseULong();g.argument(1===h,'Unsupported META table version.'); +k.parseULong();k.parseULong();for(var h=k.parseULong(),d={},m=0;h>m;m++){var n=k.parseTag(),p=k.parseULong(),x=k.parseULong(),p=l.UTF8(b,e+p,x);d[n]=p}return d};b.make=function(b){var c=Object.keys(b).length,e='',g=16+12*c,c=new k.Table('meta',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'offset',type:'ULONG',value:g},{name:'numTags',type:'ULONG',value:c}]),d;for(d in b){var l=e.length,e=e+b[d];c.fields.push({name:'tag '+d,type:'TAG',value:d});c.fields.push({name:'offset '+ +d,type:'ULONG',value:g+l});c.fields.push({name:'length '+d,type:'ULONG',value:b[d].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:e}),c}},{'../check':2,'../parse':10,'../table':13,'../types':32}],28:[function(e,m,b){function l(b,d,c){switch(b){case 0:return x;case 1:return u[c]||q[d];case 3:if(1===d||10===d)return x}}function g(b){var d={},c;for(c in b)d[b[c]]=parseInt(c);return d}function c(b,d,c,e,g,k){return new h.Record('NameRecord',[{name:'platformID',type:'USHORT',value:b}, +{name:'encodingID',type:'USHORT',value:d},{name:'languageID',type:'USHORT',value:c},{name:'nameID',type:'USHORT',value:e},{name:'length',type:'USHORT',value:g},{name:'offset',type:'USHORT',value:k}])}function k(b,d){var c;a:{c=b.length;var e=d.length-c+1,g=0;b:for(;e>g;g++)for(;e>g;){for(var h=0;c>h;h++)if(d[g+h]!==b[h])continue b;c=g;break a}c=-1}if(0>c)for(c=d.length,e=0,g=b.length;g>e;++e)d.push(b[e]);return c}m=e('../types');var n=m.decode,p=m.encode,t=e('../parse'),h=e('../table'),d='copyright fontFamily fontSubfamily uniqueID fullName version postScriptName trademark manufacturer designer description manufacturerURL designerURL license licenseURL reserved preferredFamily preferredSubfamily compatibleFullName sampleText postScriptFindFontName wwsFamily wwsSubfamily'.split(' '), v={0:'en',1:'fr',2:'de',3:'it',4:'nl',5:'sv',6:'es',7:'da',8:'pt',9:'no',10:'he',11:'ja',12:'ar',13:'fi',14:'el',15:'is',16:'mt',17:'tr',18:'hr',19:'zh-Hant',20:'ur',21:'hi',22:'th',23:'ko',24:'lt',25:'pl',26:'hu',27:'es',28:'lv',29:'se',30:'fo',31:'fa',32:'ru',33:'zh',34:'nl-BE',35:'ga',36:'sq',37:'ro',38:'cz',39:'sk',40:'si',41:'yi',42:'sr',43:'mk',44:'bg',45:'uk',46:'be',47:'uz',48:'kk',49:'az-Cyrl',50:'az-Arab',51:'hy',52:'ka',53:'mo',54:'ky',55:'tg',56:'tk',57:'mn-CN',58:'mn',59:'ps',60:'ks', 61:'ku',62:'sd',63:'bo',64:'ne',65:'sa',66:'mr',67:'bn',68:'as',69:'gu',70:'pa',71:'or',72:'ml',73:'kn',74:'ta',75:'te',76:'si',77:'my',78:'km',79:'lo',80:'vi',81:'id',82:'tl',83:'ms',84:'ms-Arab',85:'am',86:'ti',87:'om',88:'so',89:'sw',90:'rw',91:'rn',92:'ny',93:'mg',94:'eo',128:'cy',129:'eu',130:'ca',131:'la',132:'qu',133:'gn',134:'ay',135:'tt',136:'ug',137:'dz',138:'jv',139:'su',140:'gl',141:'af',142:'br',143:'iu',144:'gd',145:'gv',146:'ga',147:'to',148:'el-polyton',149:'kl',150:'az',151:'nn'}, w={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0, @@ -1758,41 +1758,41 @@ w={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17 1153:'mi',1146:'arn',1102:'mr',1148:'moh',1104:'mn',2128:'mn-CN',1121:'ne',1044:'nb',2068:'nn',1154:'oc',1096:'or',1123:'ps',1045:'pl',1046:'pt',2070:'pt-PT',1094:'pa',1131:'qu-BO',2155:'qu-EC',3179:'qu',1048:'ro',1047:'rm',1049:'ru',9275:'smn',4155:'smj-NO',5179:'smj',3131:'se-FI',1083:'se',2107:'se-SE',8251:'sms',6203:'sma-NO',7227:'sms',1103:'sa',7194:'sr-Cyrl-BA',3098:'sr',6170:'sr-Latn-BA',2074:'sr-Latn',1132:'nso',1074:'tn',1115:'si',1051:'sk',1060:'sl',11274:'es-AR',16394:'es-BO',13322:'es-CL', 9226:'es-CO',5130:'es-CR',7178:'es-DO',12298:'es-EC',17418:'es-SV',4106:'es-GT',18442:'es-HN',2058:'es-MX',19466:'es-NI',6154:'es-PA',15370:'es-PY',10250:'es-PE',20490:'es-PR',3082:'es',1034:'es',21514:'es-US',14346:'es-UY',8202:'es-VE',2077:'sv-FI',1053:'sv',1114:'syr',1064:'tg',2143:'tzm',1097:'ta',1092:'tt',1098:'te',1054:'th',1105:'bo',1055:'tr',1090:'tk',1152:'ug',1058:'uk',1070:'hsb',1056:'ur',2115:'uz-Cyrl',1091:'uz',1066:'vi',1106:'cy',1160:'wo',1157:'sah',1144:'ii',1130:'yo'},x='utf-16', q={0:'macintosh',1:'x-mac-japanese',2:'x-mac-chinesetrad',3:'x-mac-korean',6:'x-mac-greek',7:'x-mac-cyrillic',9:'x-mac-devanagai',10:'x-mac-gurmukhi',11:'x-mac-gujarati',12:'x-mac-oriya',13:'x-mac-bengali',14:'x-mac-tamil',15:'x-mac-telugu',16:'x-mac-kannada',17:'x-mac-malayalam',18:'x-mac-sinhalese',19:'x-mac-burmese',20:'x-mac-khmer',21:'x-mac-thai',22:'x-mac-lao',23:'x-mac-georgian',24:'x-mac-armenian',25:'x-mac-chinesesimp',26:'x-mac-tibetan',27:'x-mac-mongolian',28:'x-mac-ethiopic',29:'x-mac-ce', -30:'x-mac-vietnamese',31:'x-mac-extarabic'},u={15:'x-mac-icelandic',17:'x-mac-turkish',18:'x-mac-croatian',24:'x-mac-ce',25:'x-mac-ce',26:'x-mac-ce',27:'x-mac-ce',28:'x-mac-ce',30:'x-mac-icelandic',37:'x-mac-romanian',38:'x-mac-ce',39:'x-mac-ce',40:'x-mac-ce',143:'x-mac-inuit',146:'x-mac-gaelic'};b.parse=function(b,c,f){var g={};c=new t.Parser(b,c);for(var h=c.parseUShort(),k=c.parseUShort(),m=c.offset+c.parseUShort(),q=0;k>q;q++){var p=c.parseUShort(),w=c.parseUShort(),u=c.parseUShort(),A=c.parseUShort(), -A=d[A]||A,D=c.parseUShort(),E=c.parseUShort(),X;a:{switch(p){case 0:if(65535===u){X='und';break a}if(f){X=f[u];break a}break;case 1:X=v[u];break a;case 3:X=y[u];break a}X=void 0}p=l(p,w,u);void 0!==p&&void 0!==X&&(p=p===x?n.UTF16(b,m+E,D):n.MACSTRING(b,m+E,D,p))&&(w=g[A],void 0===w&&(w=g[A]={}),w[X]=p)}return 1===h&&c.parseUShort(),g};b.make=function(b,g){var m,n=[],q={},t=f(d),u;for(u in b){var x=t[u];if(void 0===x&&(x=u),m=parseInt(x),isNaN(m))throw Error('Name table entry "'+u+'" does not exist, see nameTableNames for complete list.'); -q[m]=b[u];n.push(m)}u=f(v);x=f(y);b=[];for(var t=[],A=0;AV&&(V=g.length,g.push(J)),X=4,T=p.UTF16(P));var fa=k(T,t);b.push(c(N,X,V,m,T.length,fa));N=x[J];void 0!==N&&(P=p.UTF16(P),V=k(P,t),b.push(c(3,1,N,m,P.length,V)))}}b.sort(function(b,d){return b.platformID-d.platformID||b.encodingID-d.encodingID||b.languageID-d.languageID||b.nameID-d.nameID});g=new h.Table('name', -[{name:'format',type:'USHORT',value:0},{name:'count',type:'USHORT',value:b.length},{name:'stringOffset',type:'USHORT',value:6+12*b.length}]);for(m=0;mp;p++){var q=c.parseUShort(),w=c.parseUShort(),u=c.parseUShort(),A=c.parseUShort(), +A=d[A]||A,D=c.parseUShort(),E=c.parseUShort(),X;a:{switch(q){case 0:if(65535===u){X='und';break a}if(e){X=e[u];break a}break;case 1:X=v[u];break a;case 3:X=y[u];break a}X=void 0}q=l(q,w,u);void 0!==q&&void 0!==X&&(q=q===x?n.UTF16(b,m+E,D):n.MACSTRING(b,m+E,D,q))&&(w=g[A],void 0===w&&(w=g[A]={}),w[X]=q)}return 1===h&&c.parseUShort(),g};b.make=function(b,e){var m,n=[],q={},t=g(d),u;for(u in b){var x=t[u];if(void 0===x&&(x=u),m=parseInt(x),isNaN(m))throw Error('Name table entry "'+u+'" does not exist, see nameTableNames for complete list.'); +q[m]=b[u];n.push(m)}u=g(v);x=g(y);b=[];for(var t=[],A=0;AV&&(V=e.length,e.push(J)),X=4,T=p.UTF16(P));var fa=k(T,t);b.push(c(N,X,V,m,T.length,fa));N=x[J];void 0!==N&&(P=p.UTF16(P),V=k(P,t),b.push(c(3,1,N,m,P.length,V)))}}b.sort(function(b,d){return b.platformID-d.platformID||b.encodingID-d.encodingID||b.languageID-d.languageID||b.nameID-d.nameID});e=new h.Table('name', +[{name:'format',type:'USHORT',value:0},{name:'count',type:'USHORT',value:b.length},{name:'stringOffset',type:'USHORT',value:6+12*b.length}]);for(m=0;m=g.begin&&bc;c++)f.panose[c]=b.parseByte();return f.ulUnicodeRange1=b.parseULong(),f.ulUnicodeRange2=b.parseULong(), -f.ulUnicodeRange3=b.parseULong(),f.ulUnicodeRange4=b.parseULong(),f.achVendID=String.fromCharCode(b.parseByte(),b.parseByte(),b.parseByte(),b.parseByte()),f.fsSelection=b.parseUShort(),f.usFirstCharIndex=b.parseUShort(),f.usLastCharIndex=b.parseUShort(),f.sTypoAscender=b.parseShort(),f.sTypoDescender=b.parseShort(),f.sTypoLineGap=b.parseShort(),f.usWinAscent=b.parseUShort(),f.usWinDescent=b.parseUShort(),1<=f.version&&(f.ulCodePageRange1=b.parseULong(),f.ulCodePageRange2=b.parseULong()),2<=f.version&& -(f.sxHeight=b.parseShort(),f.sCapHeight=b.parseShort(),f.usDefaultChar=b.parseUShort(),f.usBreakChar=b.parseUShort(),f.usMaxContent=b.parseUShort()),f};b.make=function(b){return new f.Table('OS/2',[{name:'version',type:'USHORT',value:3},{name:'xAvgCharWidth',type:'SHORT',value:0},{name:'usWeightClass',type:'USHORT',value:0},{name:'usWidthClass',type:'USHORT',value:0},{name:'fsType',type:'USHORT',value:0},{name:'ySubscriptXSize',type:'SHORT',value:650},{name:'ySubscriptYSize',type:'SHORT',value:699}, +end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66E3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];b.unicodeRanges=c;b.getUnicodeRange=function(b){for(var e=0;e=g.begin&&bc;c++)e.panose[c]=b.parseByte();return e.ulUnicodeRange1=b.parseULong(),e.ulUnicodeRange2=b.parseULong(), +e.ulUnicodeRange3=b.parseULong(),e.ulUnicodeRange4=b.parseULong(),e.achVendID=String.fromCharCode(b.parseByte(),b.parseByte(),b.parseByte(),b.parseByte()),e.fsSelection=b.parseUShort(),e.usFirstCharIndex=b.parseUShort(),e.usLastCharIndex=b.parseUShort(),e.sTypoAscender=b.parseShort(),e.sTypoDescender=b.parseShort(),e.sTypoLineGap=b.parseShort(),e.usWinAscent=b.parseUShort(),e.usWinDescent=b.parseUShort(),1<=e.version&&(e.ulCodePageRange1=b.parseULong(),e.ulCodePageRange2=b.parseULong()),2<=e.version&& +(e.sxHeight=b.parseShort(),e.sCapHeight=b.parseShort(),e.usDefaultChar=b.parseUShort(),e.usBreakChar=b.parseUShort(),e.usMaxContent=b.parseUShort()),e};b.make=function(b){return new g.Table('OS/2',[{name:'version',type:'USHORT',value:3},{name:'xAvgCharWidth',type:'SHORT',value:0},{name:'usWeightClass',type:'USHORT',value:0},{name:'usWidthClass',type:'USHORT',value:0},{name:'fsType',type:'USHORT',value:0},{name:'ySubscriptXSize',type:'SHORT',value:650},{name:'ySubscriptYSize',type:'SHORT',value:699}, {name:'ySubscriptXOffset',type:'SHORT',value:0},{name:'ySubscriptYOffset',type:'SHORT',value:140},{name:'ySuperscriptXSize',type:'SHORT',value:650},{name:'ySuperscriptYSize',type:'SHORT',value:699},{name:'ySuperscriptXOffset',type:'SHORT',value:0},{name:'ySuperscriptYOffset',type:'SHORT',value:479},{name:'yStrikeoutSize',type:'SHORT',value:49},{name:'yStrikeoutPosition',type:'SHORT',value:258},{name:'sFamilyClass',type:'SHORT',value:0},{name:'bFamilyType',type:'BYTE',value:0},{name:'bSerifStyle', type:'BYTE',value:0},{name:'bWeight',type:'BYTE',value:0},{name:'bProportion',type:'BYTE',value:0},{name:'bContrast',type:'BYTE',value:0},{name:'bStrokeVariation',type:'BYTE',value:0},{name:'bArmStyle',type:'BYTE',value:0},{name:'bLetterform',type:'BYTE',value:0},{name:'bMidline',type:'BYTE',value:0},{name:'bXHeight',type:'BYTE',value:0},{name:'ulUnicodeRange1',type:'ULONG',value:0},{name:'ulUnicodeRange2',type:'ULONG',value:0},{name:'ulUnicodeRange3',type:'ULONG',value:0},{name:'ulUnicodeRange4', type:'ULONG',value:0},{name:'achVendID',type:'CHARARRAY',value:'XXXX'},{name:'fsSelection',type:'USHORT',value:0},{name:'usFirstCharIndex',type:'USHORT',value:0},{name:'usLastCharIndex',type:'USHORT',value:0},{name:'sTypoAscender',type:'SHORT',value:0},{name:'sTypoDescender',type:'SHORT',value:0},{name:'sTypoLineGap',type:'SHORT',value:0},{name:'usWinAscent',type:'USHORT',value:0},{name:'usWinDescent',type:'USHORT',value:0},{name:'ulCodePageRange1',type:'ULONG',value:0},{name:'ulCodePageRange2',type:'ULONG', -value:0},{name:'sxHeight',type:'SHORT',value:0},{name:'sCapHeight',type:'SHORT',value:0},{name:'usDefaultChar',type:'USHORT',value:0},{name:'usBreakChar',type:'USHORT',value:0},{name:'usMaxContext',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],30:[function(g,m,b){var l=g('../encoding'),f=g('../parse'),c=g('../table');b.parse=function(b,c){var g={};c=new f.Parser(b,c);switch(g.version=c.parseVersion(),g.italicAngle=c.parseFixed(),g.underlinePosition=c.parseShort(),g.underlineThickness= -c.parseShort(),g.isFixedPitch=c.parseULong(),g.minMemType42=c.parseULong(),g.maxMemType42=c.parseULong(),g.minMemType1=c.parseULong(),g.maxMemType1=c.parseULong(),g.version){case 1:g.names=l.standardNames.slice();break;case 2:g.numberOfGlyphs=c.parseUShort();g.glyphNameIndex=Array(g.numberOfGlyphs);for(b=0;b=l.standardNames.length){var k=c.parseChar();g.names.push(c.parseString(k))}break; -case 2.5:for(g.numberOfGlyphs=c.parseUShort(),g.offset=Array(g.numberOfGlyphs),b=0;bd.value.tag?1:-1}),d.fields=d.fields.concat(c),d.fields=d.fields.concat(g),d}function k(b,d,c){for(var f=0;fL||void 0===f)&&0N&&(N=L);L=u.getUnicodeRange(L);if(32>L)V|=1<L)X|=1<L)T|=1<L))throw Error('Unicode ranges bits > 123 are reserved for internal usage');fa|=1<=l.standardNames.length){var k=c.parseChar();e.names.push(c.parseString(k))}break; +case 2.5:for(e.numberOfGlyphs=c.parseUShort(),e.offset=Array(e.numberOfGlyphs),b=0;bd.value.tag?1:-1}),d.fields=d.fields.concat(c),d.fields=d.fields.concat(e),d}function k(b,d,c){for(var e=0;eL||void 0===e)&&0N&&(N=L);L=u.getUnicodeRange(L);if(32>L)V|=1<L)X|=1<L)T|=1<L))throw Error('Unicode ranges bits > 123 are reserved for internal usage');fa|=1<=b,'Byte value should be between 0 and 255.'),[b]};k.BYTE=l(1);c.CHAR=function(b){return[b.charCodeAt(0)]};k.CHAR=l(1);c.CHARARRAY=function(b){for(var d=[],c=0;c=b,'Byte value should be between 0 and 255.'),[b]};k.BYTE=l(1);c.CHAR=function(b){return[b.charCodeAt(0)]};k.CHAR=l(1);c.CHARARRAY=function(b){for(var d=[],c=0;c>8&255,255&b]};k.USHORT=l(2);c.SHORT=function(b){return 32768<=b&&(b=-(65536-b)),[b>>8&255,255&b]};k.SHORT=l(2);c.UINT24=function(b){return[b>>16&255,b>>8&255,255&b]};k.UINT24=l(3);c.ULONG=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]};k.ULONG=l(4);c.LONG=function(b){return 2147483648<=b&&(b=-(4294967296-b)),[b>>24&255,b>>16&255,b>>8&255,255&b]};k.LONG=l(4);c.FIXED=c.ULONG;k.FIXED=k.ULONG; -c.FWORD=c.SHORT;k.FWORD=k.SHORT;c.UFWORD=c.USHORT;k.UFWORD=k.USHORT;c.LONGDATETIME=function(b){return[0,0,0,0,b>>24&255,b>>16&255,b>>8&255,255&b]};k.LONGDATETIME=l(8);c.TAG=function(b){return f.argument(4===b.length,'Tag should be exactly 4 ASCII characters.'),[b.charCodeAt(0),b.charCodeAt(1),b.charCodeAt(2),b.charCodeAt(3)]};k.TAG=l(4);c.Card8=c.BYTE;k.Card8=k.BYTE;c.Card16=c.USHORT;k.Card16=k.USHORT;c.OffSize=c.BYTE;k.OffSize=k.BYTE;c.SID=c.USHORT;k.SID=k.USHORT;c.NUMBER=function(b){return-107<= +c.FWORD=c.SHORT;k.FWORD=k.SHORT;c.UFWORD=c.USHORT;k.UFWORD=k.USHORT;c.LONGDATETIME=function(b){return[0,0,0,0,b>>24&255,b>>16&255,b>>8&255,255&b]};k.LONGDATETIME=l(8);c.TAG=function(b){return g.argument(4===b.length,'Tag should be exactly 4 ASCII characters.'),[b.charCodeAt(0),b.charCodeAt(1),b.charCodeAt(2),b.charCodeAt(3)]};k.TAG=l(4);c.Card8=c.BYTE;k.Card8=k.BYTE;c.Card16=c.USHORT;k.Card16=k.USHORT;c.OffSize=c.BYTE;k.OffSize=k.BYTE;c.SID=c.USHORT;k.SID=k.USHORT;c.NUMBER=function(b){return-107<= b&&107>=b?[b+139]:108<=b&&1131>=b?(b-=108,[(b>>8)+247,255&b]):-1131<=b&&-108>=b?(b=-b-108,[(b>>8)+251,255&b]):-32768<=b&&32767>=b?c.NUMBER16(b):c.NUMBER32(b)};k.NUMBER=function(b){return c.NUMBER(b).length};c.NUMBER16=function(b){return[28,b>>8&255,255&b]};k.NUMBER16=l(3);c.NUMBER32=function(b){return[29,b>>24&255,b>>16&255,b>>8&255,255&b]};k.NUMBER32=l(5);c.REAL=function(b){var d=b.toString(),c=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(d);c&&(d=parseFloat('1e'+((c[2]?+c[2]:0)+c[1].length)), -d=(Math.round(b*d)/d).toString());var f='';b=0;for(c=d.length;c>b;b+=1)var g=d[b],f=f+('e'===g?'-'===d[++b]?'c':'b':'.'===g?'a':'-'===g?'e':g);f+=1&f.length?'f':'ff';d=[30];b=0;for(c=f.length;c>b;b+=2)d.push(parseInt(f.substr(b,2),16));return d};k.REAL=function(b){return c.REAL(b).length};c.NAME=c.CHARARRAY;k.NAME=k.CHARARRAY;c.STRING=c.CHARARRAY;k.STRING=k.CHARARRAY;g.UTF8=function(b,c,f){for(var d=[],g=0;f>g;g++,c+=1)d[g]=b.getUint8(c);return String.fromCharCode.apply(null,d)};g.UTF16=function(b, -c,f){var d=[];f/=2;for(var g=0;f>g;g++,c+=2)d[g]=b.getUint16(c);return String.fromCharCode.apply(null,d)};c.UTF16=function(b){for(var d=[],c=0;c>8&255;d[d.length]=255&f}return d};k.UTF16=function(b){return 2*b.length};var n={'x-mac-croatian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7', +d=(Math.round(b*d)/d).toString());var e='';b=0;for(c=d.length;c>b;b+=1)var g=d[b],e=e+('e'===g?'-'===d[++b]?'c':'b':'.'===g?'a':'-'===g?'e':g);e+=1&e.length?'f':'ff';d=[30];b=0;for(c=e.length;c>b;b+=2)d.push(parseInt(e.substr(b,2),16));return d};k.REAL=function(b){return c.REAL(b).length};c.NAME=c.CHARARRAY;k.NAME=k.CHARARRAY;c.STRING=c.CHARARRAY;k.STRING=k.CHARARRAY;e.UTF8=function(b,c,e){for(var d=[],g=0;e>g;g++,c+=1)d[g]=b.getUint8(c);return String.fromCharCode.apply(null,d)};e.UTF16=function(b, +c,e){var d=[];e/=2;for(var g=0;e>g;g++,c+=2)d[g]=b.getUint16(c);return String.fromCharCode.apply(null,d)};c.UTF16=function(b){for(var d=[],c=0;c>8&255;d[d.length]=255&e}return d};k.UTF16=function(b){return 2*b.length};var n={'x-mac-croatian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7', 'x-mac-cyrillic':'\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\u00b0\u0490\u00a3\u00a7\u2022\u00b6\u0406\u00ae\u00a9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\u00b1\u2264\u2265\u0456\u00b5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e', 'x-mac-gaelic':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u1e02\u00b1\u2264\u2265\u1e03\u010a\u010b\u1e0a\u1e0b\u1e1e\u1e1f\u0120\u0121\u1e40\u00e6\u00f8\u1e41\u1e56\u1e57\u027c\u0192\u017f\u1e60\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u1e61\u1e9b\u00ff\u0178\u1e6a\u20ac\u2039\u203a\u0176\u0177\u1e6b\u00b7\u1ef2\u1ef3\u204a\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u2663\u00d2\u00da\u00db\u00d9\u0131\u00dd\u00fd\u0174\u0175\u1e84\u1e85\u1e80\u1e81\u1e82\u1e83', 'x-mac-greek':'\u00c4\u00b9\u00b2\u00c9\u00b3\u00d6\u00dc\u0385\u00e0\u00e2\u00e4\u0384\u00a8\u00e7\u00e9\u00e8\u00ea\u00eb\u00a3\u2122\u00ee\u00ef\u2022\u00bd\u2030\u00f4\u00f6\u00a6\u20ac\u00f9\u00fb\u00fc\u2020\u0393\u0394\u0398\u039b\u039e\u03a0\u00df\u00ae\u00a9\u03a3\u03aa\u00a7\u2260\u00b0\u00b7\u0391\u00b1\u2264\u2265\u00a5\u0392\u0395\u0396\u0397\u0399\u039a\u039c\u03a6\u03ab\u03a8\u03a9\u03ac\u039d\u00ac\u039f\u03a1\u2248\u03a4\u00ab\u00bb\u2026\u00a0\u03a5\u03a7\u0386\u0388\u0153\u2013\u2015\u201c\u201d\u2018\u2019\u00f7\u0389\u038a\u038c\u038e\u03ad\u03ae\u03af\u03cc\u038f\u03cd\u03b1\u03b2\u03c8\u03b4\u03b5\u03c6\u03b3\u03b7\u03b9\u03be\u03ba\u03bb\u03bc\u03bd\u03bf\u03c0\u03ce\u03c1\u03c3\u03c4\u03b8\u03c9\u03c2\u03c7\u03c5\u03b6\u03ca\u03cb\u0390\u03b0\u00ad', @@ -1802,24 +1802,24 @@ c,f){var d=[];f/=2;for(var g=0;f>g;g++,c+=2)d[g]=b.getUint16(c);return String.fr macintosh:'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\ufb01\ufb02\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7', 'x-mac-romanian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u0102\u0218\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u0103\u0219\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\u021a\u021b\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7', 'x-mac-turkish':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u011e\u011f\u0130\u0131\u015e\u015f\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\uf8a0\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7'}; -g.MACSTRING=function(b,c,f,g){g=n[g];if(void 0!==g){for(var d='',h=0;f>h;h++)var k=b.getUint8(c+h),d=d+(127>=k?String.fromCharCode(k):g[127&k]);return d}};var p='function'==typeof WeakMap&&new WeakMap,t;c.MACSTRING=function(b,c){var d;a:{if(!t)for(d in t={},n)t[d]=new String(d);d=t[c];if(void 0!==d){if(p){var f=p.get(d);if(void 0!==f){d=f;break a}}c=n[c];if(void 0!==c){for(var f={},g=0;gh;h+=1)var k=parseInt(f[h],0),l=b[k],d=d.concat(c.OPERAND(l.value,l.type)),d=d.concat(c.OPERATOR(k));return d};k.DICT=function(b){return c.DICT(b).length};c.OPERATOR=function(b){return 1200>b?[b]:[12,b-1200]};c.OPERAND=function(b,g){var d=[];if(Array.isArray(g))for(var h=0;hg;g+=1)var k=b[g],d=d.concat(c[k.type](k.value));return h&&h.set(b,d),d};k.CHARSTRING=function(b){return c.CHARSTRING(b).length}; -c.OBJECT=function(b){var d=c[b.type];return f.argument(void 0!==d,'No encoding function for type '+b.type),d(b.value)};k.OBJECT=function(b){var d=k[b.type];return f.argument(void 0!==d,'No sizeOf function for type '+b.type),d(b.value)};c.TABLE=function(b){var d,g=[],h=b.fields.length,k=[],l=[];for(d=0;h>d;d+=1){var m=b.fields[d],n=c[m.type];f.argument(void 0!==n,'No encoding function for field type '+m.type+' ('+m.name+')');var p=b[m.name];void 0===p&&(p=m.value);n=n(p);'TABLE'===m.type?(l.push(g.length), -g=g.concat([0,0]),k.push(n)):g=g.concat(n)}for(d=0;dm,'Table '+b.tableName+' too big.'),g[h]=m>>8,g[h+1]=255&m,g=g.concat(k[d]);return g};k.TABLE=function(b){for(var d=0,c=b.fields.length,g=0;c>g;g+=1){var h=b.fields[g],l=k[h.type];f.argument(void 0!==l,'No sizeOf function for field type '+h.type+' ('+h.name+')');var m=b[h.name];void 0===m&&(m=h.value);d+=l(m);'TABLE'===h.type&&(d+=2)}return d};c.RECORD=c.TABLE;k.RECORD=k.TABLE;c.LITERAL=function(b){return b}; -k.LITERAL=function(b){return b.length};b.decode=g;b.encode=c;b.sizeOf=k},{'./check':2}],33:[function(g,m,b){b.isBrowser=function(){return'undefined'!=typeof window};b.isNode=function(){return'undefined'==typeof window};b.nodeBufferToArrayBuffer=function(b){for(var f=new ArrayBuffer(b.length),c=new Uint8Array(f),g=0;g>1,l=-7;g=c?g-1:0;var m=c?-1:1,n=a[b+g];g+=m;c=n&(1<<-l)-1;n>>=-l;for(l+=d;0>=-l;for(l+=f;0>1,n=23===g? -Math.pow(2,-24)-Math.pow(2,-77):0;k=f?0:k-1;var p=f?1:-1,t=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);for(isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,f=l):(f=Math.floor(Math.log(b)/Math.LN2),1>b*(d=Math.pow(2,-f))&&(f--,d*=2),b=1<=f+m?b+n/d:b+n*Math.pow(2,1-m),2<=b*d&&(f++,d/=2),f+m>=l?(b=0,f=l):1<=f+m?(b=(b*d-1)*Math.pow(2,g),f+=m):(b=b*Math.pow(2,m-1)*Math.pow(2,g),f=0));8<=g;a[c+k]=b&255,k+=p,b/=256,g-=8);f=f<a)throw RangeError('Illegal capacity');b=!!b;c=!!c}this.buffer=0===a?k:new ArrayBuffer(a);this.view=0===a?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};f.VERSION='5.0.1';f.LITTLE_ENDIAN=!0;f.BIG_ENDIAN=!1;f.DEFAULT_CAPACITY=16;f.DEFAULT_ENDIAN=f.BIG_ENDIAN;f.DEFAULT_NOASSERT=!1;f.Long=a|| -null;var c=f.prototype;Object.defineProperty(c,'__isByteBuffer__',{value:!0,enumerable:!1,configurable:!1});var k=new ArrayBuffer(0),n=String.fromCharCode;f.accessor=function(){return Uint8Array};f.allocate=function(a,b,c){return new f(a,b,c)};f.concat=function(a,b,c,g){if('boolean'===typeof b||'string'!==typeof b)g=c,c=b,b=void 0;for(var d=0,h=0,k=a.length,l;h=l||(b.view.set(c.view.subarray(c.offset,c.limit),b.offset),b.offset+=l);b.limit=b.offset;b.offset=0;return b};f.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};f.type=function(){return ArrayBuffer};f.wrap=function(a,b,g,k){'string'!==typeof b&&(k=g,g=b,b=void 0);if('string'===typeof a)switch('undefined'===typeof b&&(b='utf8'),b){case 'base64':return f.fromBase64(a,g);case 'hex':return f.fromHex(a,g);case 'binary':return f.fromBinary(a,g);case 'utf8':return f.fromUTF8(a, -g);case 'debug':return f.fromDebug(a,g);default:throw Error('Unsupported encoding: '+b);}if(null===a||'object'!==typeof a)throw TypeError('Illegal buffer');if(f.isByteBuffer(a))return b=c.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new f(0,g,k),0>>=0;if(0>b||b+0> -this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=b,f=a.length,g=f>>3,h=0,k;for(b+=this.writeVarint32(f,b);g--;)k=!!a[h++]&1|(!!a[h++]&1)<<1|(!!a[h++]&1)<<2|(!!a[h++]&1)<<3|(!!a[h++]&1)<<4|(!!a[h++]&1)<<5|(!!a[h++]&1)<<6|(!!a[h++]&1)<<7,this.writeByte(k,b++);if(h>3,h=0,k=[];for(a+=c.length;g--;)c=this.readByte(a++),k[h++]=!!(c&1),k[h++]=!!(c&2),k[h++]=!!(c&4),k[h++]=!!(c&8),k[h++]=!!(c&16),k[h++]=!!(c&32),k[h++]=!!(c&64),k[h++]=!!(c&128);if(h>g++&1);b&&(this.offset=a);return k};c.readBytes=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +e.MACSTRING=function(b,c,e,g){g=n[g];if(void 0!==g){for(var d='',h=0;e>h;h++)var k=b.getUint8(c+h),d=d+(127>=k?String.fromCharCode(k):g[127&k]);return d}};var p='function'==typeof WeakMap&&new WeakMap,t;c.MACSTRING=function(b,c){var d;a:{if(!t)for(d in t={},n)t[d]=new String(d);d=t[c];if(void 0!==d){if(p){var e=p.get(d);if(void 0!==e){d=e;break a}}c=n[c];if(void 0!==c){for(var e={},g=0;gh;h+=1)var k=parseInt(e[h],0),l=b[k],d=d.concat(c.OPERAND(l.value,l.type)),d=d.concat(c.OPERATOR(k));return d};k.DICT=function(b){return c.DICT(b).length};c.OPERATOR=function(b){return 1200>b?[b]:[12,b-1200]};c.OPERAND=function(b,e){var d=[];if(Array.isArray(e))for(var h=0;hg;g+=1)var k=b[g],d=d.concat(c[k.type](k.value));return h&&h.set(b,d),d};k.CHARSTRING=function(b){return c.CHARSTRING(b).length}; +c.OBJECT=function(b){var d=c[b.type];return g.argument(void 0!==d,'No encoding function for type '+b.type),d(b.value)};k.OBJECT=function(b){var d=k[b.type];return g.argument(void 0!==d,'No sizeOf function for type '+b.type),d(b.value)};c.TABLE=function(b){var d,e=[],h=b.fields.length,k=[],l=[];for(d=0;h>d;d+=1){var m=b.fields[d],n=c[m.type];g.argument(void 0!==n,'No encoding function for field type '+m.type+' ('+m.name+')');var p=b[m.name];void 0===p&&(p=m.value);n=n(p);'TABLE'===m.type?(l.push(e.length), +e=e.concat([0,0]),k.push(n)):e=e.concat(n)}for(d=0;dm,'Table '+b.tableName+' too big.'),e[h]=m>>8,e[h+1]=255&m,e=e.concat(k[d]);return e};k.TABLE=function(b){for(var d=0,c=b.fields.length,e=0;c>e;e+=1){var h=b.fields[e],l=k[h.type];g.argument(void 0!==l,'No sizeOf function for field type '+h.type+' ('+h.name+')');var m=b[h.name];void 0===m&&(m=h.value);d+=l(m);'TABLE'===h.type&&(d+=2)}return d};c.RECORD=c.TABLE;k.RECORD=k.TABLE;c.LITERAL=function(b){return b}; +k.LITERAL=function(b){return b.length};b.decode=e;b.encode=c;b.sizeOf=k},{'./check':2}],33:[function(e,m,b){b.isBrowser=function(){return'undefined'!=typeof window};b.isNode=function(){return'undefined'==typeof window};b.nodeBufferToArrayBuffer=function(b){for(var e=new ArrayBuffer(b.length),c=new Uint8Array(e),k=0;k>1,l=-7;g=c?g-1:0;var m=c?-1:1,n=a[b+g];g+=m;c=n&(1<<-l)-1;n>>=-l;for(l+=d;0>=-l;for(l+=e;0>1,n=23===g? +Math.pow(2,-24)-Math.pow(2,-77):0;k=e?0:k-1;var p=e?1:-1,t=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);for(isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,e=l):(e=Math.floor(Math.log(b)/Math.LN2),1>b*(d=Math.pow(2,-e))&&(e--,d*=2),b=1<=e+m?b+n/d:b+n*Math.pow(2,1-m),2<=b*d&&(e++,d/=2),e+m>=l?(b=0,e=l):1<=e+m?(b=(b*d-1)*Math.pow(2,g),e+=m):(b=b*Math.pow(2,m-1)*Math.pow(2,g),e=0));8<=g;a[c+k]=b&255,k+=p,b/=256,g-=8);e=e<a)throw RangeError('Illegal capacity');b=!!b;c=!!c}this.buffer=0===a?k:new ArrayBuffer(a);this.view=0===a?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};g.VERSION='5.0.1';g.LITTLE_ENDIAN=!0;g.BIG_ENDIAN=!1;g.DEFAULT_CAPACITY=16;g.DEFAULT_ENDIAN=g.BIG_ENDIAN;g.DEFAULT_NOASSERT=!1;g.Long=a|| +null;var c=g.prototype;Object.defineProperty(c,'__isByteBuffer__',{value:!0,enumerable:!1,configurable:!1});var k=new ArrayBuffer(0),n=String.fromCharCode;g.accessor=function(){return Uint8Array};g.allocate=function(a,b,c){return new g(a,b,c)};g.concat=function(a,b,c,e){if('boolean'===typeof b||'string'!==typeof b)e=c,c=b,b=void 0;for(var d=0,h=0,k=a.length,l;h=l||(b.view.set(c.view.subarray(c.offset,c.limit),b.offset),b.offset+=l);b.limit=b.offset;b.offset=0;return b};g.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};g.type=function(){return ArrayBuffer};g.wrap=function(a,b,e,k){'string'!==typeof b&&(k=e,e=b,b=void 0);if('string'===typeof a)switch('undefined'===typeof b&&(b='utf8'),b){case 'base64':return g.fromBase64(a,e);case 'hex':return g.fromHex(a,e);case 'binary':return g.fromBinary(a,e);case 'utf8':return g.fromUTF8(a, +e);case 'debug':return g.fromDebug(a,e);default:throw Error('Unsupported encoding: '+b);}if(null===a||'object'!==typeof a)throw TypeError('Illegal buffer');if(g.isByteBuffer(a))return b=c.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new g(0,e,k),0>>=0;if(0>b||b+0> +this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=b,e=a.length,g=e>>3,h=0,k;for(b+=this.writeVarint32(e,b);g--;)k=!!a[h++]&1|(!!a[h++]&1)<<1|(!!a[h++]&1)<<2|(!!a[h++]&1)<<3|(!!a[h++]&1)<<4|(!!a[h++]&1)<<5|(!!a[h++]&1)<<6|(!!a[h++]&1)<<7,this.writeByte(k,b++);if(h>3,h=0,k=[];for(a+=c.length;g--;)c=this.readByte(a++),k[h++]=!!(c&1),k[h++]=!!(c&2),k[h++]=!!(c&4),k[h++]=!!(c&8),k[h++]=!!(c&16),k[h++]=!!(c&32),k[h++]=!!(c&64),k[h++]=!!(c&128);if(h>g++&1);b&&(this.offset=a);return k};c.readBytes=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ b+' (+'+a+') <= '+this.buffer.byteLength);}b=this.slice(b,b+a);d&&(this.offset+=a);return b};c.writeBytes=c.append;c.writeInt8=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength); }b+=1;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);this.view[b-1]=a;d&&(this.offset+=1);return this};c.writeByte=c.writeInt8;c.readInt8=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}a=this.view[a];128===(a&128)&&(a=-(255-a+1));b&&(this.offset+= 1);return a};c.readByte=c.readInt8;c.writeUint8=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=1;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b); @@ -1834,239 +1834,229 @@ b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&th if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=4;this.littleEndian?(this.view[b+3]=a>>>24&255,this.view[b+2]=a>>>16&255,this.view[b+1]=a>>>8&255,this.view[b]= a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);d&&(this.offset+=4);return this};c.writeUInt32=c.writeUint32;c.readUint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var c=0;this.littleEndian?(c=this.view[a+ 2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0);b&&(this.offset+=4);return c};c.readUInt32=c.readUint32;a&&(c.writeInt64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!== -typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var f=this.buffer.byteLength;c>f&&this.resize((f*=2)>c?f:c);c-=8;f=b.low;b=b.high;this.littleEndian?(this.view[c+3]=f>>>24&255,this.view[c+2]=f>>>16&255,this.view[c+1]=f>>>8&255,this.view[c]=f&255,c+=4,this.view[c+3]=b>>> -24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+3]=b&255,c+=4,this.view[c]=f>>>24&255,this.view[c+1]=f>>>16&255,this.view[c+2]=f>>>8&255,this.view[c+3]=f&255);d&&(this.offset+=8);return this},c.writeLong=c.writeInt64,c.readInt64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)'); -b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var f=0,g=0;this.littleEndian?(f=this.view[b+2]<<16,f|=this.view[b+1]<<8,f|=this.view[b],f+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,f=this.view[b+1]<<16,f|=this.view[b+2]<<8,f|=this.view[b+3],f+=this.view[b]<<24>>>0); -b=new a(f,g,!1);c&&(this.offset+=8);return b},c.readLong=c.readInt64,c.writeUint64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var f=this.buffer.byteLength;c>f&&this.resize((f*=2)>c?f:c);c-=8;f=b.low;b=b.high;this.littleEndian?(this.view[c+3]=f>>>24&255,this.view[c+2]=f>>>16&255,this.view[c+1]=f>>>8&255,this.view[c]=f&255,c+=4,this.view[c+3]=b>>>24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+ -3]=b&255,c+=4,this.view[c]=f>>>24&255,this.view[c+1]=f>>>16&255,this.view[c+2]=f>>>8&255,this.view[c+3]=f&255);d&&(this.offset+=8);return this},c.writeUInt64=c.writeUint64,c.readUint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var f=0,g=0;this.littleEndian? -(f=this.view[b+2]<<16,f|=this.view[b+1]<<8,f|=this.view[b],f+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,f=this.view[b+1]<<16,f|=this.view[b+2]<<8,f|=this.view[b+3],f+=this.view[b]<<24>>>0);b=new a(f,g,!0);c&&(this.offset+=8);return b},c.readUInt64=c.readUint64);c.writeFloat32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== +typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var e=this.buffer.byteLength;c>e&&this.resize((e*=2)>c?e:c);c-=8;e=b.low;b=b.high;this.littleEndian?(this.view[c+3]=e>>>24&255,this.view[c+2]=e>>>16&255,this.view[c+1]=e>>>8&255,this.view[c]=e&255,c+=4,this.view[c+3]=b>>> +24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+3]=b&255,c+=4,this.view[c]=e>>>24&255,this.view[c+1]=e>>>16&255,this.view[c+2]=e>>>8&255,this.view[c+3]=e&255);d&&(this.offset+=8);return this},c.writeLong=c.writeInt64,c.readInt64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)'); +b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var e=0,g=0;this.littleEndian?(e=this.view[b+2]<<16,e|=this.view[b+1]<<8,e|=this.view[b],e+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,e=this.view[b+1]<<16,e|=this.view[b+2]<<8,e|=this.view[b+3],e+=this.view[b]<<24>>>0); +b=new a(e,g,!1);c&&(this.offset+=8);return b},c.readLong=c.readInt64,c.writeUint64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var e=this.buffer.byteLength;c>e&&this.resize((e*=2)>c?e:c);c-=8;e=b.low;b=b.high;this.littleEndian?(this.view[c+3]=e>>>24&255,this.view[c+2]=e>>>16&255,this.view[c+1]=e>>>8&255,this.view[c]=e&255,c+=4,this.view[c+3]=b>>>24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+ +3]=b&255,c+=4,this.view[c]=e>>>24&255,this.view[c+1]=e>>>16&255,this.view[c+2]=e>>>8&255,this.view[c+3]=e&255);d&&(this.offset+=8);return this},c.writeUInt64=c.writeUint64,c.readUint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var e=0,g=0;this.littleEndian? +(e=this.view[b+2]<<16,e|=this.view[b+1]<<8,e|=this.view[b],e+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,e=this.view[b+1]<<16,e|=this.view[b+2]<<8,e|=this.view[b+3],e+=this.view[b]<<24>>>0);b=new a(e,g,!0);c&&(this.offset+=8);return b},c.readUInt64=c.readUint64);c.writeFloat32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== typeof a)throw TypeError('Illegal value: '+a+' (not a number)');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=4;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);l(this.view,a,b-4,this.littleEndian,23,4);c&&(this.offset+=4);return this};c.writeFloat=c.writeFloat32;c.readFloat32=function(a){var c='undefined'===typeof a;c&& (a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}a=b(this.view,a,this.littleEndian,23,4);c&&(this.offset+=4);return a};c.readFloat=c.readFloat32;c.writeFloat64=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a)throw TypeError('Illegal value: '+a+' (not a number)'); if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=8;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);l(this.view,a,b-8,this.littleEndian,52,8);c&&(this.offset+=8);return this};c.writeDouble=c.writeFloat64;c.readFloat64=function(a){var c='undefined'===typeof a;c&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!== -a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+8) <= '+this.buffer.byteLength);}a=b(this.view,a,this.littleEndian,52,8);c&&(this.offset+=8);return a};c.readDouble=c.readFloat64;f.MAX_VARINT32_BYTES=5;f.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};f.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};f.zigZagDecode32=function(a){return a>>>1^-(a& -1)|0};c.writeVarint32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=f.calculateVarint32(a),g;b+=d;g=this.buffer.byteLength;b>g&&this.resize((g*=2)>b?g:b); -b-=d;for(a>>>=0;128<=a;)g=a&127|128,this.view[b++]=g,a>>>=7;this.view[b++]=a;return c?(this.offset=b,this):d};c.writeVarint32ZigZag=function(a,b){return this.writeVarint32(f.zigZagEncode32(a),b)};c.readVarint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength); -}var c=0,f=0,g;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;g=this.view[a++];5>c&&(f|=(g&127)<<7*c);++c}while(0!==(g&128));f|=0;return b?(this.offset=a,f):{value:f,length:c}};c.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=f.zigZagDecode32(a.value):a=f.zigZagDecode32(a);return a};a&&(f.MAX_VARINT64_BYTES=10,f.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var c=b.toInt()>>> -0,f=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==f?16384>c?128>c?1:2:2097152>c?3:4:16384>f?128>f?5:6:2097152>f?7:8:128>b?9:10},f.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},f.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& +a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+8) <= '+this.buffer.byteLength);}a=b(this.view,a,this.littleEndian,52,8);c&&(this.offset+=8);return a};c.readDouble=c.readFloat64;g.MAX_VARINT32_BYTES=5;g.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};g.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};g.zigZagDecode32=function(a){return a>>>1^-(a& +1)|0};c.writeVarint32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=g.calculateVarint32(a),e;b+=d;e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b); +b-=d;for(a>>>=0;128<=a;)e=a&127|128,this.view[b++]=e,a>>>=7;this.view[b++]=a;return c?(this.offset=b,this):d};c.writeVarint32ZigZag=function(a,b){return this.writeVarint32(g.zigZagEncode32(a),b)};c.readVarint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength); +}var c=0,e=0,g;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;g=this.view[a++];5>c&&(e|=(g&127)<<7*c);++c}while(0!==(g&128));e|=0;return b?(this.offset=a,e):{value:e,length:c}};c.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=g.zigZagDecode32(a.value):a=g.zigZagDecode32(a);return a};a&&(g.MAX_VARINT64_BYTES=10,g.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var c=b.toInt()>>> +0,e=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==e?16384>c?128>c?1:2:2097152>c?3:4:16384>e?128>e?5:6:2097152>e?7:8:128>b?9:10},g.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},g.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& (b=b.toSigned());return b.shiftRightUnsigned(1).xor(b.and(a.ONE).toSigned().negate()).toSigned()},c.writeVarint64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var g=f.calculateVarint64(b),h=b.toInt()>>>0,k=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;c+=g;var l=this.buffer.byteLength;c>l&&this.resize((l*=2)>c?l:c);c-=g;switch(g){case 10:this.view[c+9]=b>>>7&1;case 9:this.view[c+8]=9!==g?b|128:b&127;case 8:this.view[c+7]=8!==g?k>>>21|128:k>>>21&127;case 7:this.view[c+6]= -7!==g?k>>>14|128:k>>>14&127;case 6:this.view[c+5]=6!==g?k>>>7|128:k>>>7&127;case 5:this.view[c+4]=5!==g?k|128:k&127;case 4:this.view[c+3]=4!==g?h>>>21|128:h>>>21&127;case 3:this.view[c+2]=3!==g?h>>>14|128:h>>>14&127;case 2:this.view[c+1]=2!==g?h>>>7|128:h>>>7&127;case 1:this.view[c]=1!==g?h|128:h&127}return d?(this.offset+=g,this):g},c.writeVarint64ZigZag=function(a,b){return this.writeVarint64(f.zigZagEncode64(a),b)},c.readVarint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== -typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var f=b,g,h=0,k=0,l;l=this.view[b++];g=l&127;if(l&128&&(l=this.view[b++],g|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<14,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<21,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++], +c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var e=g.calculateVarint64(b),h=b.toInt()>>>0,k=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;c+=e;var l=this.buffer.byteLength;c>l&&this.resize((l*=2)>c?l:c);c-=e;switch(e){case 10:this.view[c+9]=b>>>7&1;case 9:this.view[c+8]=9!==e?b|128:b&127;case 8:this.view[c+7]=8!==e?k>>>21|128:k>>>21&127;case 7:this.view[c+6]= +7!==e?k>>>14|128:k>>>14&127;case 6:this.view[c+5]=6!==e?k>>>7|128:k>>>7&127;case 5:this.view[c+4]=5!==e?k|128:k&127;case 4:this.view[c+3]=4!==e?h>>>21|128:h>>>21&127;case 3:this.view[c+2]=3!==e?h>>>14|128:h>>>14&127;case 2:this.view[c+1]=2!==e?h>>>7|128:h>>>7&127;case 1:this.view[c]=1!==e?h|128:h&127}return d?(this.offset+=e,this):e},c.writeVarint64ZigZag=function(a,b){return this.writeVarint64(g.zigZagEncode64(a),b)},c.readVarint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== +typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var e=b,g,h=0,k=0,l;l=this.view[b++];g=l&127;if(l&128&&(l=this.view[b++],g|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<14,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<21,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++], h=l&127,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],h|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],h|=(l&127)<<14,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],h|=(l&127)<<21,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],k=l&127,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],k|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l))throw Error('Buffer overrun');g=a.fromBits(g|h<<28,h>>>4| -k<<24,!1);return c?(this.offset=b,g):{value:g,length:b-f}},c.readVarint64ZigZag=function(b){(b=this.readVarint64(b))&&b.value instanceof a?b.value=f.zigZagDecode64(b.value):b=f.zigZagDecode64(b);return b});c.writeCString=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);var d,f=a.length;if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');for(d=0;d>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}f=t.calculateUTF16asUTF8(g(a))[1];b+=f+1;d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=f+1;t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));this.view[b++]=0;return c?(this.offset=b,this):f};c.readCString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!== -typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,f,g=-1;t.decodeUTF8toUTF16(function(){if(0===g)return null;if(a>=this.limit)throw RangeError('Illegal range: Truncated data, '+a+' < '+this.limit);g=this.view[a++];return 0===g?null:g}.bind(this),f=m(),!0);return b?(this.offset=a,f()):{string:f(),length:a-c}};c.writeIString=function(a,b){var c= -'undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,f;f=t.calculateUTF16asUTF8(g(a),this.noAssert)[1];b+=4+f;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=4+f;this.littleEndian?(this.view[b+ -3]=f>>>24&255,this.view[b+2]=f>>>16&255,this.view[b+1]=f>>>8&255,this.view[b]=f&255):(this.view[b]=f>>>24&255,this.view[b+1]=f>>>16&255,this.view[b+2]=f>>>8&255,this.view[b+3]=f&255);b+=4;t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+4+f)throw RangeError('Illegal range: Truncated data, '+b+' == '+(b+4+f));return c?(this.offset=b,this):b-d};c.readIString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+ -a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var c=a,g=this.readUint32(a),g=this.readUTF8String(g,f.METRICS_BYTES,a+=4);a+=g.length;return b?(this.offset=a,g.string):{string:g.string,length:a-c}};f.METRICS_CHARS='c';f.METRICS_BYTES='b';c.writeUTF8String=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+ -b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d,f=b;d=t.calculateUTF16asUTF8(g(a))[1];b+=d;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=d;t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));return c?(this.offset=b,this):b-f};c.writeString=c.writeUTF8String;f.calculateUTF8Chars=function(a){return t.calculateUTF16asUTF8(g(a))[0]};f.calculateUTF8Bytes=function(a){return t.calculateUTF16asUTF8(g(a))[1]}; -f.calculateString=f.calculateUTF8Bytes;c.readUTF8String=function(a,b,c){'number'===typeof b&&(c=b,b=void 0);var d='undefined'===typeof c;d&&(c=this.offset);'undefined'===typeof b&&(b=f.METRICS_CHARS);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+ -this.buffer.byteLength);}var g=0,h=c,k;if(b===f.METRICS_CHARS){k=m();t.decodeUTF8(function(){return g>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +k<<24,!1);return c?(this.offset=b,g):{value:g,length:b-e}},c.readVarint64ZigZag=function(b){(b=this.readVarint64(b))&&b.value instanceof a?b.value=g.zigZagDecode64(b.value):b=g.zigZagDecode64(b);return b});c.writeCString=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);var d,g=a.length;if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');for(d=0;d>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}g=t.calculateUTF16asUTF8(e(a))[1];b+=g+1;d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=g+1;t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));this.view[b++]=0;return c?(this.offset=b,this):g};c.readCString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!== +typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,e,g=-1;t.decodeUTF8toUTF16(function(){if(0===g)return null;if(a>=this.limit)throw RangeError('Illegal range: Truncated data, '+a+' < '+this.limit);g=this.view[a++];return 0===g?null:g}.bind(this),e=m(),!0);return b?(this.offset=a,e()):{string:e(),length:a-c}};c.writeIString=function(a,b){var c= +'undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,g;g=t.calculateUTF16asUTF8(e(a),this.noAssert)[1];b+=4+g;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=4+g;this.littleEndian?(this.view[b+ +3]=g>>>24&255,this.view[b+2]=g>>>16&255,this.view[b+1]=g>>>8&255,this.view[b]=g&255):(this.view[b]=g>>>24&255,this.view[b+1]=g>>>16&255,this.view[b+2]=g>>>8&255,this.view[b+3]=g&255);b+=4;t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+4+g)throw RangeError('Illegal range: Truncated data, '+b+' == '+(b+4+g));return c?(this.offset=b,this):b-d};c.readIString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+ +a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var c=a,e=this.readUint32(a),e=this.readUTF8String(e,g.METRICS_BYTES,a+=4);a+=e.length;return b?(this.offset=a,e.string):{string:e.string,length:a-c}};g.METRICS_CHARS='c';g.METRICS_BYTES='b';c.writeUTF8String=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+ +b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d,g=b;d=t.calculateUTF16asUTF8(e(a))[1];b+=d;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=d;t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));return c?(this.offset=b,this):b-g};c.writeString=c.writeUTF8String;g.calculateUTF8Chars=function(a){return t.calculateUTF16asUTF8(e(a))[0]};g.calculateUTF8Bytes=function(a){return t.calculateUTF16asUTF8(e(a))[1]}; +g.calculateString=g.calculateUTF8Bytes;c.readUTF8String=function(a,b,c){'number'===typeof b&&(c=b,b=void 0);var d='undefined'===typeof c;d&&(c=this.offset);'undefined'===typeof b&&(b=g.METRICS_CHARS);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+ +this.buffer.byteLength);}var e=0,h=c,k;if(b===g.METRICS_CHARS){k=m();t.decodeUTF8(function(){return e>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ c+' (+'+a+') <= '+this.buffer.byteLength);}var l=c+a;t.decodeUTF8toUTF16(function(){return c>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,h,k;h=t.calculateUTF16asUTF8(g(a),this.noAssert)[1];k=f.calculateVarint32(h);b+=k+h;var l=this.buffer.byteLength;b>l&&this.resize((l*=2)>b?l:b);b-=k+h;b+=this.writeVarint32(h,b);t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+h+k)throw RangeError('Illegal range: Truncated data, '+ -b+' == '+(b+h+k));return c?(this.offset=b,this):b-d};c.readVString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,g=this.readVarint32(a),g=this.readUTF8String(g.value,f.METRICS_BYTES,a+=g.length);a+=g.length;return b?(this.offset=a,g.string):{string:g.string, -length:a-c}};c.append=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof f||(a=f.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var g=this.buffer.byteLength;c>g&&this.resize((g*=2)> -c?g:c);c-=b;this.view.set(a.view.subarray(a.offset,a.limit),c);a.offset+=b;d&&(this.offset+=b);return this};c.appendTo=function(a,b){a.append(this,b);return this};c.assert=function(a){this.noAssert=!a;return this};c.capacity=function(){return this.buffer.byteLength};c.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};c.clone=function(a){var b=new f(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),b.view=new Uint8Array(b.buffer)): +if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,h,k;h=t.calculateUTF16asUTF8(e(a),this.noAssert)[1];k=g.calculateVarint32(h);b+=k+h;var l=this.buffer.byteLength;b>l&&this.resize((l*=2)>b?l:b);b-=k+h;b+=this.writeVarint32(h,b);t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+h+k)throw RangeError('Illegal range: Truncated data, '+ +b+' == '+(b+h+k));return c?(this.offset=b,this):b-d};c.readVString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,e=this.readVarint32(a),e=this.readUTF8String(e.value,g.METRICS_BYTES,a+=e.length);a+=e.length;return b?(this.offset=a,e.string):{string:e.string, +length:a-c}};c.append=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof g||(a=g.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var e=this.buffer.byteLength;c>e&&this.resize((e*=2)> +c?e:c);c-=b;this.view.set(a.view.subarray(a.offset,a.limit),c);a.offset+=b;d&&(this.offset+=b);return this};c.appendTo=function(a,b){a.append(this,b);return this};c.assert=function(a){this.noAssert=!a;return this};c.capacity=function(){return this.buffer.byteLength};c.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};c.clone=function(a){var b=new g(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),b.view=new Uint8Array(b.buffer)): (b.buffer=this.buffer,b.view=this.view);b.offset=this.offset;b.markedOffset=this.markedOffset;b.limit=this.limit;return b};c.compact=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+ -b+' <= '+this.buffer.byteLength);}if(0===a&&b===this.buffer.byteLength)return this;var c=b-a;if(0===c)return this.buffer=k,this.view=null,0<=this.markedOffset&&(this.markedOffset-=a),this.limit=this.offset=0,this;var d=new ArrayBuffer(c),f=new Uint8Array(d);f.set(this.view.subarray(a,b));this.buffer=d;this.view=f;0<=this.markedOffset&&(this.markedOffset-=a);this.offset=0;this.limit=c;return this};c.copy=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!== -typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return new f(0,this.littleEndian,this.noAssert);var c=b-a,d=new f(c,this.littleEndian,this.noAssert);d.offset=0;d.limit=c;0<=d.markedOffset&&(d.markedOffset-=a);this.copyTo(d,0,a,b);return d};c.copyTo=function(a, -b,c,g){var d,h;if(!this.noAssert&&!f.isByteBuffer(a))throw TypeError('Illegal target: Not a ByteBuffer');b=(h='undefined'===typeof b)?a.offset:b|0;c=(d='undefined'===typeof c)?this.offset:c|0;g='undefined'===typeof g?this.limit:g|0;if(0>b||b>a.buffer.byteLength)throw RangeError('Illegal target range: 0 <= '+b+' <= '+a.buffer.byteLength);if(0>c||g>this.buffer.byteLength)throw RangeError('Illegal source range: 0 <= '+c+' <= '+this.buffer.byteLength);var k=g-c;if(0===k)return a;a.ensureCapacity(b+k); -a.view.set(this.view.subarray(c,g),b);d&&(this.offset+=k);h&&(a.offset+=k);return this};c.ensureCapacity=function(a){var b=this.buffer.byteLength;return ba?b:a):this};c.fill=function(a,b,c){var d='undefined'===typeof b;d&&(b=this.offset);'string'===typeof a&&0>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return new g(0,this.littleEndian,this.noAssert);var c=b-a,d=new g(c,this.littleEndian,this.noAssert);d.offset=0;d.limit=c;0<=d.markedOffset&&(d.markedOffset-=a);this.copyTo(d,0,a,b);return d};c.copyTo=function(a, +b,c,e){var d,h;if(!this.noAssert&&!g.isByteBuffer(a))throw TypeError('Illegal target: Not a ByteBuffer');b=(h='undefined'===typeof b)?a.offset:b|0;c=(d='undefined'===typeof c)?this.offset:c|0;e='undefined'===typeof e?this.limit:e|0;if(0>b||b>a.buffer.byteLength)throw RangeError('Illegal target range: 0 <= '+b+' <= '+a.buffer.byteLength);if(0>c||e>this.buffer.byteLength)throw RangeError('Illegal source range: 0 <= '+c+' <= '+this.buffer.byteLength);var k=e-c;if(0===k)return a;a.ensureCapacity(b+k); +a.view.set(this.view.subarray(c,e),b);d&&(this.offset+=k);h&&(a.offset+=k);return this};c.ensureCapacity=function(a){var b=this.buffer.byteLength;return ba?b:a):this};c.fill=function(a,b,c){var d='undefined'===typeof b;d&&(b=this.offset);'string'===typeof a&&0>>=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal end: Not an integer');c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+c+' <= '+this.buffer.byteLength);}if(b>=c)return this;for(;b>>=0;if(0>a||a+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+0) <= '+this.buffer.byteLength);}this.markedOffset=a;return this};c.order=function(a){if(!this.noAssert&&'boolean'!==typeof a)throw TypeError('Illegal littleEndian: Not a boolean');this.littleEndian=!!a;return this};c.LE=function(a){this.littleEndian='undefined'!==typeof a?!!a:!0;return this};c.BE=function(a){this.littleEndian= -'undefined'!==typeof a?!a:!1;return this};c.prepend=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof f||(a=f.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var g=b-c;if(0>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof g||(a=g.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var e=b-c;if(0a)throw RangeError('Illegal capacity: 0 <= '+a);}if(this.buffer.byteLength>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return this;Array.prototype.reverse.call(this.view.subarray(a,b));return this}; c.skip=function(a){if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0}var b=this.offset+a;if(!this.noAssert&&(0>b||b>this.buffer.byteLength))throw RangeError('Illegal length: 0 <= '+this.offset+' + '+a+' <= '+this.buffer.byteLength);this.offset=b;return this};c.slice=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer'); a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}var c=this.clone();c.offset=a;c.limit=b;return c};c.toBuffer=function(a){var b=this.offset,c=this.limit;if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: Not an integer');b>>>=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal limit: Not an integer'); c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+c+' <= '+this.buffer.byteLength);}if(!a&&0===b&&c===this.buffer.byteLength)return this.buffer;if(b===c)return k;a=new ArrayBuffer(c-b);(new Uint8Array(a)).set((new Uint8Array(this.buffer)).subarray(b,c),0);return a};c.toArrayBuffer=c.toBuffer;c.toString=function(a,b,c){if('undefined'===typeof a)return'ByteBufferAB(offset='+this.offset+',markedOffset='+this.markedOffset+',limit='+this.limit+',capacity='+this.capacity()+ ')';'number'===typeof a&&(c=b=a='utf8');switch(a){case 'utf8':return this.toUTF8(b,c);case 'base64':return this.toBase64(b,c);case 'hex':return this.toHex(b,c);case 'binary':return this.toBinary(b,c);case 'debug':return this.toDebug();case 'columns':return this.toColumns();default:throw Error('Unsupported encoding: '+a);}};var p=function(){for(var a={},b=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113, -114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],c=[],f=0,g=b.length;f>2&63]),f=(d&3)<<4,null!==(d=a())?(f|=d>>4&15,c(b[(f|d>>4&15)&63]),f=(d&15)<<2,null!==(d=a())?(c(b[(f|d>>6&3)&63]),c(b[d&63])):(c(b[f&63]),c(61))):(c(b[f&63]),c(61),c(61))};a.decode=function(a,b){function d(a){throw Error('Illegal character code: '+a);}for(var f,g,h;null!==(f=a());)if(g=c[f],'undefined'===typeof g&&d(f),null!==(f=a())&& -(h=c[f],'undefined'===typeof h&&d(f),b(g<<2>>>0|(h&48)>>4),null!==(f=a()))){g=c[f];if('undefined'===typeof g)if(61===f)break;else d(f);b((h&15)<<4>>>0|(g&60)>>2);if(null!==(f=a())){h=c[f];if('undefined'===typeof h)if(61===f)break;else d(f);b((g&3)<<6>>>0|h)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();c.toBase64=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity|| -a>b)throw RangeError('begin, end');var c;p.encode(function(){return aa||b>this.capacity()||a>b)throw RangeError('begin, end');if(a===b)return'';for(var c=[],d=[];af?g+('0'+f.toString(16).toUpperCase()):g+f.toString(16).toUpperCase(),a&&(h+=32f?String.fromCharCode(f):'.'));++b;if(a&&0g.length;)g+=' ';k+=g+h+'\n';g=h=''}g=b===this.offset&&b===this.limit?g+(b===this.markedOffset?'!':'|'):b===this.offset?g+(b===this.markedOffset?'[':'<'):b===this.limit?g+(b===this.markedOffset?']':'>'):g+(b===this.markedOffset?"'":a||0!==b&&b!==c?' ':'')}if(a&&' '!== -g){for(;51>g.length;)g+=' ';k+=g+h+'\n'}return a?k:g};f.fromDebug=function(a,b,c){var d=a.length;b=new f((d+1)/3|0,b,c);for(var g=0,h=0,k,l=!1,m=!1,n=!1,p=!1,t=!1;g':if(!c){if(p){t=!0;break}p=!0}b.limit=h;l=!1;break;case "'":if(!c){if(n){t=!0;break}n=!0}b.markedOffset=h;l=!1;break;case ' ':l=!1;break;default:if(!c&&l)t=!0;else{k=parseInt(k+a.charAt(g++),16);if(!c&&(isNaN(k)||0>k||255>2&63]),e=(d&3)<<4,null!==(d=a())?(e|=d>>4&15,c(b[(e|d>>4&15)&63]),e=(d&15)<<2,null!==(d=a())?(c(b[(e|d>>6&3)&63]),c(b[d&63])):(c(b[e&63]),c(61))):(c(b[e&63]),c(61),c(61))};a.decode=function(a,b){function d(a){throw Error('Illegal character code: '+a);}for(var e,g,h;null!==(e=a());)if(g=c[e],'undefined'===typeof g&&d(e),null!==(e=a())&& +(h=c[e],'undefined'===typeof h&&d(e),b(g<<2>>>0|(h&48)>>4),null!==(e=a()))){g=c[e];if('undefined'===typeof g)if(61===e)break;else d(e);b((h&15)<<4>>>0|(g&60)>>2);if(null!==(e=a())){h=c[e];if('undefined'===typeof h)if(61===e)break;else d(e);b((g&3)<<6>>>0|h)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();c.toBase64=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity|| +a>b)throw RangeError('begin, end');var c;p.encode(function(){return aa||b>this.capacity()||a>b)throw RangeError('begin, end');if(a===b)return'';for(var c=[],d=[];ae?g+('0'+e.toString(16).toUpperCase()):g+e.toString(16).toUpperCase(),a&&(h+=32e?String.fromCharCode(e):'.'));++b;if(a&&0g.length;)g+=' ';k+=g+h+'\n';g=h=''}g=b===this.offset&&b===this.limit?g+(b===this.markedOffset?'!':'|'):b===this.offset?g+(b===this.markedOffset?'[':'<'):b===this.limit?g+(b===this.markedOffset?']':'>'):g+(b===this.markedOffset?"'":a||0!==b&&b!==c?' ':'')}if(a&&' '!== +g){for(;51>g.length;)g+=' ';k+=g+h+'\n'}return a?k:g};g.fromDebug=function(a,b,c){var d=a.length;b=new g((d+1)/3|0,b,c);for(var e=0,h=0,k,l=!1,m=!1,n=!1,p=!1,t=!1;e':if(!c){if(p){t=!0;break}p=!0}b.limit=h;l=!1;break;case "'":if(!c){if(n){t=!0;break}n=!0}b.markedOffset=h;l=!1;break;case ' ':l=!1;break;default:if(!c&&l)t=!0;else{k=parseInt(k+a.charAt(e++),16);if(!c&&(isNaN(k)||0>k||255>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+ -this.buffer.byteLength);}for(var c=Array(b-a),d;ad?c.push('0',d.toString(16)):c.push(d.toString(16));return c.join('')};f.fromHex=function(a,b,c){if(!c){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if(0!==a.length%2)throw TypeError('Illegal str: Length not a multiple of 2');}var d=a.length;b=new f(d/2|0,b);for(var g,h=0,k=0;hg||255c?b(c&127):(2048>c?b(c>>6&31|192):(65536>c?b(c>>12&15|224):(b(c>>18&7|240),b(c>>12&63|128)),b(c>>6&63|128)),b(c&63|128)),c=null},decodeUTF8:function(a,b){for(var c,d,f,g,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name='TruncatedError';b.bytes=a;throw b;};null!==(c=a());)if(0=== -(c&128))b(c);else if(192===(c&224))null===(d=a())&&h([c,d]),b((c&31)<<6|d&63);else if(224===(c&240))null!==(d=a())&&null!==(f=a())||h([c,d,f]),b((c&15)<<12|(d&63)<<6|f&63);else if(240===(c&248))null!==(d=a())&&null!==(f=a())&&null!==(g=a())||h([c,d,f,g]),b((c&7)<<18|(d&63)<<12|(f&63)<<6|g&63);else throw RangeError('Illegal starting byte: '+c);},UTF16toUTF8:function(a,b){for(var c,d=null;null!==(c=null!==d?d:a());)55296<=c&&57343>=c&&null!==(d=a())&&56320<=d&&57343>=d?(b(1024*(c-55296)+d-56320+65536), +this.buffer.byteLength);}for(var c=Array(b-a),d;ad?c.push('0',d.toString(16)):c.push(d.toString(16));return c.join('')};g.fromHex=function(a,b,c){if(!c){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if(0!==a.length%2)throw TypeError('Illegal str: Length not a multiple of 2');}var d=a.length;b=new g(d/2|0,b);for(var e,h=0,k=0;he||255c?b(c&127):(2048>c?b(c>>6&31|192):(65536>c?b(c>>12&15|224):(b(c>>18&7|240),b(c>>12&63|128)),b(c>>6&63|128)),b(c&63|128)),c=null},decodeUTF8:function(a,b){for(var c,d,e,g,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name='TruncatedError';b.bytes=a;throw b;};null!==(c=a());)if(0=== +(c&128))b(c);else if(192===(c&224))null===(d=a())&&h([c,d]),b((c&31)<<6|d&63);else if(224===(c&240))null!==(d=a())&&null!==(e=a())||h([c,d,e]),b((c&15)<<12|(d&63)<<6|e&63);else if(240===(c&248))null!==(d=a())&&null!==(e=a())&&null!==(g=a())||h([c,d,e,g]),b((c&7)<<18|(d&63)<<12|(e&63)<<6|g&63);else throw RangeError('Illegal starting byte: '+c);},UTF16toUTF8:function(a,b){for(var c,d=null;null!==(c=null!==d?d:a());)55296<=c&&57343>=c&&null!==(d=a())&&56320<=d&&57343>=d?(b(1024*(c-55296)+d-56320+65536), d=null):b(c);null!==d&&b(d)},UTF8toUTF16:function(a,b){var c=null;for('number'===typeof a&&(c=a,a=function(){return null});null!==c||null!==(c=a());)65535>=c?b(c):(c-=65536,b((c>>10)+55296),b(c%1024+56320)),c=null},encodeUTF16toUTF8:function(b,c){a.UTF16toUTF8(b,function(b){a.encodeUTF8(b,c)})},decodeUTF8toUTF16:function(b,c){a.decodeUTF8(b,function(b){a.UTF8toUTF16(b,c)})},calculateCodePoint:function(a){return 128>a?1:2048>a?2:65536>a?3:4},calculateUTF8:function(a){for(var b,c=0;null!==(b=a());)c+= 128>b?1:2048>b?2:65536>b?3:4;return c},calculateUTF16asUTF8:function(b){var c=0,d=0;a.UTF16toUTF8(b,function(a){++c;d+=128>a?1:2048>a?2:65536>a?3:4});return[c,d]}};return a}();c.toUTF8=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+ -a+' <= '+b+' <= '+this.buffer.byteLength);}var c;try{t.decodeUTF8toUTF16(function(){return a>>=0;if(c=0<=a&&256>a)if(b=n[a])return b;b=l(a,0>(a|0)?-1:0,!0);c&&(n[a]=b)}else{a|=0;if(c=-128<=a&&128>a)if(b=k[a])return b;b=l(a,0>a?-1:0,!1);c&&(k[a]= -b)}return b}function b(a,c){if(isNaN(a)||!isFinite(a))return c?w:v;if(c){if(0>a)return w;if(a>=t)return A}else{if(a<=-h)return E;if(a+1>=h)return u}return 0>a?b(-a,c).neg():l(a%4294967296|0,a/4294967296|0,c)}function l(b,c,d){return new a(b,c,d)}function f(a,c,d){if(0===a.length)throw Error('empty string');if('NaN'===a||'Infinity'===a||'+Infinity'===a||'-Infinity'===a)return v;'number'===typeof c?(d=c,c=!1):c=!!c;d=d||10;if(2>d||36l?(l=b(p(d,l)),h=h.mul(l).add(b(m))):(h=h.mul(g),h=h.add(b(m)))}h.unsigned=c;return h}function c(c){return c instanceof a?c:'number'===typeof c?b(c):'string'===typeof c?f(c):l(c.low,c.high,c.unsigned)}Object.defineProperty(a.prototype,'__isLong__',{value:!0,enumerable:!1,configurable:!1});a.isLong=g;var k={},n={};a.fromInt=m;a.fromNumber=b;a.fromBits= -l;var p=Math.pow;a.fromString=f;a.fromValue=c;var t=4294967296*4294967296,h=t/2,d=m(16777216),v=m(0);a.ZERO=v;var w=m(0,!0);a.UZERO=w;var y=m(1);a.ONE=y;var x=m(1,!0);a.UONE=x;var q=m(-1);a.NEG_ONE=q;var u=l(-1,2147483647,!1);a.MAX_VALUE=u;var A=l(-1,-1,!0);a.MAX_UNSIGNED_VALUE=A;var E=l(0,-2147483648,!1);a.MIN_VALUE=E;var D=a.prototype;D.toInt=function(){return this.unsigned?this.low>>>0:this.low};D.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+ -(this.low>>>0)};D.toString=function(a){a=a||10;if(2>a||36>>0).toString(a),c=g;if(c.isZero())return h+f;for(;6>h.length;)h='0'+h;f=''+h+f}};D.getHighBits=function(){return this.high};D.getHighBitsUnsigned= +a+' <= '+b+' <= '+this.buffer.byteLength);}var c;try{t.decodeUTF8toUTF16(function(){return a>>=0;if(c=0<=a&&256>a)if(b=n[a])return b;b=l(a,0>(a|0)?-1:0,!0);c&&(n[a]=b)}else{a|=0;if(c=-128<=a&&128>a)if(b=k[a])return b;b=l(a,0>a?-1:0,!1);c&&(k[a]= +b)}return b}function b(a,c){if(isNaN(a)||!isFinite(a))return c?w:v;if(c){if(0>a)return w;if(a>=t)return A}else{if(a<=-h)return E;if(a+1>=h)return u}return 0>a?b(-a,c).neg():l(a%4294967296|0,a/4294967296|0,c)}function l(b,c,d){return new a(b,c,d)}function g(a,c,d){if(0===a.length)throw Error('empty string');if('NaN'===a||'Infinity'===a||'+Infinity'===a||'-Infinity'===a)return v;'number'===typeof c?(d=c,c=!1):c=!!c;d=d||10;if(2>d||36l?(l=b(p(d,l)),h=h.mul(l).add(b(m))):(h=h.mul(e),h=h.add(b(m)))}h.unsigned=c;return h}function c(c){return c instanceof a?c:'number'===typeof c?b(c):'string'===typeof c?g(c):l(c.low,c.high,c.unsigned)}Object.defineProperty(a.prototype,'__isLong__',{value:!0,enumerable:!1,configurable:!1});a.isLong=e;var k={},n={};a.fromInt=m;a.fromNumber=b;a.fromBits= +l;var p=Math.pow;a.fromString=g;a.fromValue=c;var t=4294967296*4294967296,h=t/2,d=m(16777216),v=m(0);a.ZERO=v;var w=m(0,!0);a.UZERO=w;var y=m(1);a.ONE=y;var x=m(1,!0);a.UONE=x;var q=m(-1);a.NEG_ONE=q;var u=l(-1,2147483647,!1);a.MAX_VALUE=u;var A=l(-1,-1,!0);a.MAX_UNSIGNED_VALUE=A;var E=l(0,-2147483648,!1);a.MIN_VALUE=E;var D=a.prototype;D.toInt=function(){return this.unsigned?this.low>>>0:this.low};D.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+ +(this.low>>>0)};D.toString=function(a){a=a||10;if(2>a||36>>0).toString(a),c=g;if(c.isZero())return h+e;for(;6>h.length;)h='0'+h;e=''+h+e}};D.getHighBits=function(){return this.high};D.getHighBitsUnsigned= function(){return this.high>>>0};D.getLowBits=function(){return this.low};D.getLowBitsUnsigned=function(){return this.low>>>0};D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(E)?64:this.neg().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,b=31;0this.high};D.isPositive=function(){return this.unsigned||0<=this.high};D.isOdd= -function(){return 1===(this.low&1)};D.isEven=function(){return 0===(this.low&1)};D.equals=function(a){g(a)||(a=c(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};D.eq=D.equals;D.notEquals=function(a){return!this.eq(a)};D.neq=D.notEquals;D.lessThan=function(a){return 0>this.comp(a)};D.lt=D.lessThan;D.lessThanOrEqual=function(a){return 0>=this.comp(a)};D.lte=D.lessThanOrEqual;D.greaterThan=function(a){return 0>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1};D.comp=D.compare;D.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(y)};D.neg=D.negate;D.add=function(a){g(a)||(a=c(a));var b=this.high>>>16,d=this.high&65535, -f=this.low>>>16,h=a.high>>>16,k=a.high&65535,m=a.low>>>16,n;n=0+((this.low&65535)+(a.low&65535));a=0+(n>>>16)+(f+m);f=0+(a>>>16)+(d+k);d=0+(f>>>16)+(b+h)&65535;return l((a&65535)<<16|n&65535,d<<16|f&65535,this.unsigned)};D.subtract=function(a){g(a)||(a=c(a));return this.add(a.neg())};D.sub=D.subtract;D.multiply=function(a){if(this.isZero())return v;g(a)||(a=c(a));if(a.isZero())return v;if(this.eq(E))return a.isOdd()?E:v;if(a.eq(E))return this.isOdd()?E:v;if(this.isNegative())return a.isNegative()? -this.neg().mul(a.neg()):this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(d)&&a.lt(d))return b(this.toNumber()*a.toNumber(),this.unsigned);var f=this.high>>>16,h=this.high&65535,k=this.low>>>16,m=this.low&65535,n=a.high>>>16,p=a.high&65535,q=a.low>>>16;a=a.low&65535;var t,u,w,x;x=0+m*a;w=0+(x>>>16)+k*a;u=0+(w>>>16);w=(w&65535)+m*q;u+=w>>>16;u+=h*a;t=0+(u>>>16);u=(u&65535)+k*q;t+=u>>>16;u=(u&65535)+m*p;return l((w&65535)<<16|x&65535,(t+(u>>>16)+(f*a+h*q+k*p+m*n)&65535)<< -16|u&65535,this.unsigned)};D.mul=D.multiply;D.divide=function(a){g(a)||(a=c(a));if(a.isZero())throw Error('division by zero');if(this.isZero())return this.unsigned?w:v;var d,f,h;if(this.unsigned){a.unsigned||(a=a.toUnsigned());if(a.gt(this))return w;if(a.gt(this.shru(1)))return x;h=w}else{if(this.eq(E)){if(a.eq(y)||a.eq(q))return E;if(a.eq(E))return y;d=this.shr(1).div(a).shl(1);if(d.eq(v))return a.isNegative()?y:q;f=this.sub(a.mul(d));return d.add(f.div(a))}if(a.eq(E))return this.unsigned?w:v;if(this.isNegative())return a.isNegative()? -this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();h=v}for(f=this;f.gte(a);){d=Math.max(1,Math.floor(f.toNumber()/a.toNumber()));for(var k=Math.ceil(Math.log(d)/Math.LN2),k=48>=k?1:p(2,k-48),l=b(d),m=l.mul(a);m.isNegative()||m.gt(f);)d-=k,l=b(d,this.unsigned),m=l.mul(a);l.isZero()&&(l=y);h=h.add(l);f=f.sub(m)}return h};D.div=D.divide;D.modulo=function(a){g(a)||(a=c(a));return this.sub(this.div(a).mul(a))};D.mod=D.modulo;D.not=function(){return l(~this.low, -~this.high,this.unsigned)};D.and=function(a){g(a)||(a=c(a));return l(this.low&a.low,this.high&a.high,this.unsigned)};D.or=function(a){g(a)||(a=c(a));return l(this.low|a.low,this.high|a.high,this.unsigned)};D.xor=function(a){g(a)||(a=c(a));return l(this.low^a.low,this.high^a.high,this.unsigned)};D.shiftLeft=function(a){g(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?l(this.low<>>32-a,this.unsigned):l(0,this.low<a?l(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):l(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};D.shr=D.shiftRight;D.shiftRightUnsigned=function(a){g(a)&&(a=a.toInt());a&=63;if(0===a)return this;var b=this.high;return 32>a?l(this.low>>>a|b<<32-a,b>>>a,this.unsigned):32===a?l(b,0,this.unsigned):l(b>>>a-32,0,this.unsigned)};D.shru=D.shiftRightUnsigned;D.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this};D.toUnsigned=function(){return this.unsigned? +function(){return 1===(this.low&1)};D.isEven=function(){return 0===(this.low&1)};D.equals=function(a){e(a)||(a=c(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};D.eq=D.equals;D.notEquals=function(a){return!this.eq(a)};D.neq=D.notEquals;D.lessThan=function(a){return 0>this.comp(a)};D.lt=D.lessThan;D.lessThanOrEqual=function(a){return 0>=this.comp(a)};D.lte=D.lessThanOrEqual;D.greaterThan=function(a){return 0>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1};D.comp=D.compare;D.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(y)};D.neg=D.negate;D.add=function(a){e(a)||(a=c(a));var b=this.high>>>16,d=this.high&65535, +g=this.low>>>16,h=a.high>>>16,k=a.high&65535,m=a.low>>>16,n;n=0+((this.low&65535)+(a.low&65535));a=0+(n>>>16)+(g+m);g=0+(a>>>16)+(d+k);d=0+(g>>>16)+(b+h)&65535;return l((a&65535)<<16|n&65535,d<<16|g&65535,this.unsigned)};D.subtract=function(a){e(a)||(a=c(a));return this.add(a.neg())};D.sub=D.subtract;D.multiply=function(a){if(this.isZero())return v;e(a)||(a=c(a));if(a.isZero())return v;if(this.eq(E))return a.isOdd()?E:v;if(a.eq(E))return this.isOdd()?E:v;if(this.isNegative())return a.isNegative()? +this.neg().mul(a.neg()):this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(d)&&a.lt(d))return b(this.toNumber()*a.toNumber(),this.unsigned);var g=this.high>>>16,h=this.high&65535,k=this.low>>>16,m=this.low&65535,n=a.high>>>16,p=a.high&65535,q=a.low>>>16;a=a.low&65535;var t,u,w,x;x=0+m*a;w=0+(x>>>16)+k*a;u=0+(w>>>16);w=(w&65535)+m*q;u+=w>>>16;u+=h*a;t=0+(u>>>16);u=(u&65535)+k*q;t+=u>>>16;u=(u&65535)+m*p;return l((w&65535)<<16|x&65535,(t+(u>>>16)+(g*a+h*q+k*p+m*n)&65535)<< +16|u&65535,this.unsigned)};D.mul=D.multiply;D.divide=function(a){e(a)||(a=c(a));if(a.isZero())throw Error('division by zero');if(this.isZero())return this.unsigned?w:v;var d,g,h;if(this.unsigned){a.unsigned||(a=a.toUnsigned());if(a.gt(this))return w;if(a.gt(this.shru(1)))return x;h=w}else{if(this.eq(E)){if(a.eq(y)||a.eq(q))return E;if(a.eq(E))return y;d=this.shr(1).div(a).shl(1);if(d.eq(v))return a.isNegative()?y:q;g=this.sub(a.mul(d));return d.add(g.div(a))}if(a.eq(E))return this.unsigned?w:v;if(this.isNegative())return a.isNegative()? +this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();h=v}for(g=this;g.gte(a);){d=Math.max(1,Math.floor(g.toNumber()/a.toNumber()));for(var k=Math.ceil(Math.log(d)/Math.LN2),k=48>=k?1:p(2,k-48),l=b(d),m=l.mul(a);m.isNegative()||m.gt(g);)d-=k,l=b(d,this.unsigned),m=l.mul(a);l.isZero()&&(l=y);h=h.add(l);g=g.sub(m)}return h};D.div=D.divide;D.modulo=function(a){e(a)||(a=c(a));return this.sub(this.div(a).mul(a))};D.mod=D.modulo;D.not=function(){return l(~this.low, +~this.high,this.unsigned)};D.and=function(a){e(a)||(a=c(a));return l(this.low&a.low,this.high&a.high,this.unsigned)};D.or=function(a){e(a)||(a=c(a));return l(this.low|a.low,this.high|a.high,this.unsigned)};D.xor=function(a){e(a)||(a=c(a));return l(this.low^a.low,this.high^a.high,this.unsigned)};D.shiftLeft=function(a){e(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?l(this.low<>>32-a,this.unsigned):l(0,this.low<a?l(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):l(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};D.shr=D.shiftRight;D.shiftRightUnsigned=function(a){e(a)&&(a=a.toInt());a&=63;if(0===a)return this;var b=this.high;return 32>a?l(this.low>>>a|b<<32-a,b>>>a,this.unsigned):32===a?l(b,0,this.unsigned):l(b>>>a-32,0,this.unsigned)};D.shru=D.shiftRightUnsigned;D.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this};D.toUnsigned=function(){return this.unsigned? this:l(this.low,this.high,!0)};D.toBytes=function(a){return a?this.toBytesLE():this.toBytesBE()};D.toBytesLE=function(){var a=this.high,b=this.low;return[b&255,b>>>8&255,b>>>16&255,b>>>24&255,a&255,a>>>8&255,a>>>16&255,a>>>24&255]};D.toBytesBE=function(){var a=this.high,b=this.low;return[a>>>24&255,a>>>16&255,a>>>8&255,a&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255]};return a}); -(function(a){function g(a){if(!a)throw Error('PSON requires ByteBuffer.js: Get it at https://github.com/dcodeIO/ByteBuffer.js');var b={T:{ZERO:0,MAX:239,NULL:240,TRUE:241,FALSE:242,EOBJECT:243,EARRAY:244,ESTRING:245,OBJECT:246,ARRAY:247,INTEGER:248,LONG:249,FLOAT:250,DOUBLE:251,STRING:252,STRING_ADD:253,STRING_GET:254,BINARY:255}};b.Encoder=function(a,b){var c=new a(4);c.length=4;var f=a.Long,g=function(a,b,c){this.dict={};this.next=0;if(a&&Array.isArray(a))for(;this.nextm?g+1:m+1,a.lastIndexOf('.'))}return''};FileSystem.getNameWithoutExtension=function(a){return void 0!==a?a.substring(0,a.lastIndexOf('.')):''}; -FileSystem.getFilePath=function(a){if(void 0!==a){var g=a.lastIndexOf('\\'),m=a.lastIndexOf('/');return a.substring(0,g>m?g+1:m+1)}return''};FileSystem.getFileExtension=function(a){return void 0!==a?a.substring(a.lastIndexOf('.')+1,a.length).toLowerCase():''};THREE.Object3D.prototype.folded=!1;THREE.Object3D.prototype.hidden=!1;THREE.Object3D.prototype.initialize=function(){for(var a=0;am?e+1:m+1,a.lastIndexOf('.'))}return''};FileSystem.getNameWithoutExtension=function(a){return void 0!==a?a.substring(0,a.lastIndexOf('.')):''}; +FileSystem.getFilePath=function(a){if(void 0!==a){var e=a.lastIndexOf('\\'),m=a.lastIndexOf('/');return a.substring(0,e>m?e+1:m+1)}return''};FileSystem.getFileExtension=function(a){return void 0!==a?a.substring(a.lastIndexOf('.')+1,a.length).toLowerCase():''};THREE.Object3D.prototype.folded=!1;THREE.Object3D.prototype.hidden=!1;THREE.Object3D.prototype.initialize=function(){for(var a=0;athis.opacity&&(m.opacity=this.opacity);!0===this.transparent&&(m.transparent=this.transparent);0a;a++)this.keys.push(new Key);this.events=new EventManager;var g=this.actions,m=this;this.events.add(window,'keydown',function(a){g.push(a.keyCode);g.push(Key.DOWN)});this.events.add(window,'keyup',function(a){g.push(a.keyCode);g.push(Key.UP)});this.events.add(window,'focus',function(a){m.reset()});this.events.create()}Keyboard.prototype=Keyboard; -Keyboard.update=function(){for(var a=0;this.actions.length>a;){var g=this.actions.shift(),m=this.actions.shift();this.keys[g].update(m);if(this.keys[g].justReleased||this.keys[g].justPressed)this.actions.push(g),this.actions.push(Key.RESET),a+=2}};Keyboard.reset=function(){for(var a=0;aa;a++)this.keys.push(new Key);this.events=new EventManager;var e=this.actions,m=this;this.events.add(window,'keydown',function(a){e.push(a.keyCode);e.push(Key.DOWN)});this.events.add(window,'keyup',function(a){e.push(a.keyCode);e.push(Key.UP)});this.events.add(window,'focus',function(a){m.reset()});this.events.create()}Keyboard.prototype=Keyboard; +Keyboard.update=function(){for(var a=0;this.actions.length>a;){var e=this.actions.shift(),m=this.actions.shift();this.keys[e].update(m);if(this.keys[e].justReleased||this.keys[e].justPressed)this.actions.push(e),this.actions.push(Key.RESET),a+=2}};Keyboard.reset=function(){for(var a=0;aa;a++)this._keys.push(new Key),this.keys.push(new Key);var g=this;void 0!==window.onmousewheel?this.events.add(window,'mousewheel',function(a){g._wheel=a.deltaY; -g._wheelUpdated=!0}):void 0!==window.addEventListener?this.events.add(window,'DOMMouseScroll',function(a){g._wheel=30*a.detail;g._wheelUpdated=!0}):this.events.add(window,'wheel',function(a){g._wheel=a.deltaY;g._wheelUpdated=!0});if('ontouchstart'in window||0a;a++)this._keys.push(new Key),this.keys.push(new Key);var e=this;void 0!==window.onmousewheel?this.events.add(window,'mousewheel',function(a){e._wheel=a.deltaY; +e._wheelUpdated=!0}):void 0!==window.addEventListener?this.events.add(window,'DOMMouseScroll',function(a){e._wheel=30*a.detail;e._wheelUpdated=!0}):this.events.add(window,'wheel',function(a){e._wheel=a.deltaY;e._wheelUpdated=!0});if('ontouchstart'in window||0this.buttons.length||0>a?0:this.gamepad.buttons[a].value};Gamepad.prototype.getAxis=function(a){return a>this.gamepad.axes.length||0>a?0:this.gamepad.axes[a]};Gamepad.prototype.buttonExists=function(a){return 0<=a&&a=a.HAVE_CURRENT_DATA&&(k.needsUpdate=!0),requestAnimationFrame(c))}'string'===typeof a?this.video=new Video(a):a instanceof Video&&(this.video=a);THREE.Texture.call(this,document.createElement('video'),g,m,b,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,l,f);this.disposed=this.generateMipmaps=!1;this.name='video';this.category='Video';this.loop=this.autoplay=!0;this.volume=this.playbackRate=1;this.image.src=this.video.data; +function VideoTexture(a,e,m,b,l,g){function c(){k.disposed||(a.readyState>=a.HAVE_CURRENT_DATA&&(k.needsUpdate=!0),requestAnimationFrame(c))}'string'===typeof a?this.video=new Video(a):a instanceof Video&&(this.video=a);THREE.Texture.call(this,document.createElement('video'),e,m,b,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,l,g);this.disposed=this.generateMipmaps=!1;this.name='video';this.category='Video';this.loop=this.autoplay=!0;this.volume=this.playbackRate=1;this.image.src=this.video.data; this.image.autoplay=this.autoplay;this.image.playbackRate=this.playbackRate;this.image.loop=this.loop;this.image.volume=this.volume;var k=this;a=this.image;c()}VideoTexture.prototype=Object.create(THREE.Texture.prototype);VideoTexture.prototype.setTime=function(a){this.image.currentTime=a};VideoTexture.prototype.setLoop=function(a){this.loop=a;this.image.loop=a};VideoTexture.prototype.setVolume=function(a){this.volume=0<=a&&1>=a?a:0<=a?1:0;this.image.volume=this.volume}; VideoTexture.prototype.setAutoPlay=function(a){this.autoplay=a;this.image.autoplay=this.autoplay};VideoTexture.prototype.setPlaybackRate=function(a){this.playbackRate=a;this.image.playbackRate=a};VideoTexture.prototype.pause=function(){this.image.paused||this.image.pause()};VideoTexture.prototype.play=function(){this.image.paused&&this.image.play()};VideoTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0;this.image.pause();this.image.src='';this.image.load()}; -VideoTexture.prototype.toJSON=function(a){var g=THREE.Texture.prototype.toJSON.call(this,a);a=this.video.toJSON(a);g.video=a.uuid;g.loop=this.loop;g.autoplay=this.autoplay;g.playbackRate=this.playbackRate;g.volume=this.volume;return g}; -function WebcamTexture(a,g,m,b,l){function f(){c.readyState>=c.HAVE_CURRENT_DATA&&(k.needsUpdate=!0);k.disposed||requestAnimationFrame(f)}var c=document.createElement('video');c.autoplay=!0;c.loop=!0;navigator.webkitGetUserMedia?navigator.webkitGetUserMedia({video:!0},function(a){c.src=URL.createObjectURL(a)},function(a){console.warn('nunuStudio: No webcam available')}):navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.getUserMedia({video:!0}).then(function(a){c.src=URL.createObjectURL(a)}).catch(function(a){console.warn('nunuStudio: No webcam available')}); -THREE.Texture.call(this,c,a,g,m,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,b,l);this.disposed=this.generateMipmaps=!1;this.name='webcam';this.category='Webcam';var k=this;f()}WebcamTexture.prototype=Object.create(THREE.Texture.prototype);WebcamTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0;this.image.paused||this.image.pause()}; -function CubeTexture(a,g,m,b,l,f,c,k,n,p){void 0===g&&(g=THREE.CubeReflectionMapping);for(var t=[],h=0;6>h;h++)t.push(document.createElement('canvas'));THREE.Texture.call(this,t,g,m,b,l,f,c,k,n,p);this.images=void 0!==a?a:[];this.size=512;this.flipY=!1;this.mode=6===this.images.length?CubeTexture.CUBE:CubeTexture.CROSS;0g;g++){var f=CubeTexture.renderEquirectFace(b,g,Math.PI,a.size);a.image[g].getContext('2d').putImageData(f,0,0)}a.needsUpdate=!0}}}; -CubeTexture.resampleBilinear=function(a,g,m,b,l){var f=a.width,c=a.height;a=a.data;var k=THREE.Math.clamp(Math.floor(m),0,f-1),n=THREE.Math.clamp(Math.ceil(m),0,f-1);m-=k;var p=THREE.Math.clamp(Math.floor(b),0,c-1),t=THREE.Math.clamp(Math.ceil(b),0,c-1);b-=p;c=4*(p*f+k);p=4*(p*f+n);k=4*(t*f+k);f=4*(t*f+n);for(n=0;3>n;n++)g.data[l+n]=Math.ceil((a[c+n]*(1-m)+a[p+n]*m)*(1-b)+(a[k+n]*(1-m)+a[f+n]*m)*b)}; -CubeTexture.renderEquirectFace=function(a,g,m,b){var l=new ImageData(b,b);g=CubeTexture.faces[g];for(var f=0;f=n._endFrame&&(n.currentFrame=n._beginFrame);n.offset.x=n.currentFrame%n.framesHorizontal/n.framesHorizontal;n.offset.y=1-n.repeat.y-Math.floor(n.currentFrame/n.framesHorizontal)/n.framesVertical;n.disposed||setTimeout(k,1E3*n.animationSpeed)}'string'===typeof a?this.img=new Image(a):a instanceof Image&&(this.img=a);THREE.Texture.call(this,document.createElement('img'),l,THREE.RepeatWrapping,THREE.RepeatWrapping, -THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,f,c);this.name='animation';this.category='SpriteSheet';this.disposed=!1;this.format=this.img.hasTransparency()?THREE.RGBAFormat:THREE.RGBFormat;this.repeat.set(1/g,1/m);this.loop=!0;this.animationSpeed=.1;this._totalFrames=b;this._endFrame=this._beginFrame=0;this._framesHorizontal=g;this._framesVertical=m;var n=this;Object.defineProperties(this,{framesHorizontal:{get:function(){return n._framesHorizontal},set:function(a){n._framesHorizontal=a; +VideoTexture.prototype.toJSON=function(a){var e=THREE.Texture.prototype.toJSON.call(this,a);a=this.video.toJSON(a);e.video=a.uuid;e.loop=this.loop;e.autoplay=this.autoplay;e.playbackRate=this.playbackRate;e.volume=this.volume;return e}; +function WebcamTexture(a,e,m,b,l){function g(){c.readyState>=c.HAVE_CURRENT_DATA&&(k.needsUpdate=!0);k.disposed||requestAnimationFrame(g)}var c=document.createElement('video');c.autoplay=!0;c.loop=!0;navigator.webkitGetUserMedia?navigator.webkitGetUserMedia({video:!0},function(a){c.src=URL.createObjectURL(a)},function(a){console.warn('nunuStudio: No webcam available')}):navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.getUserMedia({video:!0}).then(function(a){c.src=URL.createObjectURL(a)}).catch(function(a){console.warn('nunuStudio: No webcam available')}); +THREE.Texture.call(this,c,a,e,m,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,b,l);this.disposed=this.generateMipmaps=!1;this.name='webcam';this.category='Webcam';var k=this;g()}WebcamTexture.prototype=Object.create(THREE.Texture.prototype);WebcamTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0;this.image.paused||this.image.pause()}; +function CubeTexture(a,e,m,b,l,g,c,k,n,p){void 0===e&&(e=THREE.CubeReflectionMapping);for(var t=[],h=0;6>h;h++)t.push(document.createElement('canvas'));THREE.Texture.call(this,t,e,m,b,l,g,c,k,n,p);this.images=void 0!==a?a:[];this.size=512;this.flipY=!1;this.mode=6===this.images.length?CubeTexture.CUBE:CubeTexture.CROSS;0e;e++){var g=CubeTexture.renderEquirectFace(b,e,Math.PI,a.size);a.image[e].getContext('2d').putImageData(g,0,0)}a.needsUpdate=!0}}}; +CubeTexture.resampleBilinear=function(a,e,m,b,l){var g=a.width,c=a.height;a=a.data;var k=THREE.Math.clamp(Math.floor(m),0,g-1),n=THREE.Math.clamp(Math.ceil(m),0,g-1);m-=k;var p=THREE.Math.clamp(Math.floor(b),0,c-1),t=THREE.Math.clamp(Math.ceil(b),0,c-1);b-=p;c=4*(p*g+k);p=4*(p*g+n);k=4*(t*g+k);g=4*(t*g+n);for(n=0;3>n;n++)e.data[l+n]=Math.ceil((a[c+n]*(1-m)+a[p+n]*m)*(1-b)+(a[k+n]*(1-m)+a[g+n]*m)*b)}; +CubeTexture.renderEquirectFace=function(a,e,m,b){var l=new ImageData(b,b);e=CubeTexture.faces[e];for(var g=0;g=n._endFrame&&(n.currentFrame=n._beginFrame);n.offset.x=n.currentFrame%n.framesHorizontal/n.framesHorizontal;n.offset.y=1-n.repeat.y-Math.floor(n.currentFrame/n.framesHorizontal)/n.framesVertical;n.disposed||setTimeout(k,1E3*n.animationSpeed)}'string'===typeof a?this.img=new Image(a):a instanceof Image&&(this.img=a);THREE.Texture.call(this,document.createElement('img'),l,THREE.RepeatWrapping,THREE.RepeatWrapping, +THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,g,c);this.name='animation';this.category='SpriteSheet';this.disposed=!1;this.format=this.img.hasTransparency()?THREE.RGBAFormat:THREE.RGBFormat;this.repeat.set(1/e,1/m);this.loop=!0;this.animationSpeed=.1;this._totalFrames=b;this._endFrame=this._beginFrame=0;this._framesHorizontal=e;this._framesVertical=m;var n=this;Object.defineProperties(this,{framesHorizontal:{get:function(){return n._framesHorizontal},set:function(a){n._framesHorizontal=a; n.repeat.x=1/a;n.totalFrames=n._framesHorizontal*n._framesVertical}},framesVertical:{get:function(){return n._framesVertical},set:function(a){n._framesVertical=a;n.repeat.y=1/a;n.totalFrames=n._framesHorizontal*n._framesVertical}},endFrame:{get:function(){return n._endFrame},set:function(a){a>n._totalFrames&&(a=n._totalFrames);n._endFrame=a}},beginFrame:{get:function(){return n._beginFrame},set:function(a){0>a&&(a=0);n.currentFrame=a;n._beginFrame=a}},totalFrames:{get:function(){return n._totalFrames}, -set:function(a){n._beginFrame=0;n._endFrame=a;n._totalFrames=a}}});this.image.src=this.img.data;this.image.onload=function(){n.needsUpdate=!0};this.currentFrame=0;k()}SpriteSheetTexture.prototype=Object.create(THREE.Texture.prototype);SpriteSheetTexture.prototype.setAnimationSpeed=function(a){this.animationSpeed=a};SpriteSheetTexture.prototype.setFrameGrid=function(a,g){this._framesHorizontal=a;this._framesVertical=g;this._totalFrames=a*g;this.repeat.set(1/a,1/g)}; -SpriteSheetTexture.prototype.setAnimationFrames=function(a,g){this.beginFrame=a;this.endFrame=g};SpriteSheetTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0}; -SpriteSheetTexture.prototype.toJSON=function(a){var g=THREE.Texture.prototype.toJSON.call(this,a);a=this.img.toJSON(a);g.image=a.uuid;g.loop=this.loop;g.animationSpeed=this.animationSpeed;g.framesHorizontal=this._framesHorizontal;g.framesVertical=this._framesVertical;g.totalFrames=this._totalFrames;g.beginFrame=this._beginFrame;g.endFrame=this._endFrame;return g};function FontLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} -FontLoader.prototype.load=function(a,g,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){g(new Font(JSON.parse(a)))},m,b)};FontLoader.prototype.parse=function(a){if(void 0!==a.data){var g=new Font;g.name=a.name;g.uuid=a.uuid;g.encoding=a.encoding;void 0!==a.reversed&&(g.reversed=a.reversed);'base64'===a.format?(g.format='arraybuffer',g.data=ArraybufferUtils.fromBase64(a.data),g.loadTTF()):(g.format=a.format,g.data=a.data,g.font=a.data);return g}return new Font(a)}; -function ImageLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}ImageLoader.prototype.loadJSON=function(a,g,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){g(l.parse(JSON.parse(a)))},m,b)};ImageLoader.prototype.parse=function(a){var g=new Image;g.name=a.name;g.uuid=a.uuid;g.format=a.format;g.encoding=a.encoding;g.data=a.data;return g};function VideoLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} -VideoLoader.prototype.load=function(a,g,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){g(l.parse(JSON.parse(a)))},m,b)};VideoLoader.prototype.parse=function(a){var g=new Video;g.name=a.name;g.uuid=a.uuid;g.format=a.format;g.encoding=a.encoding;g.data=a.data;return g};function AudioLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} -AudioLoader.prototype.load=function(a,g,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){g(self.parse(JSON.parse(a)))},m,b)};AudioLoader.prototype.parse=function(a){var g=new Audio;g.name=a.name;g.uuid=a.uuid;g.encoding=a.encoding;g.format='arraybuffer';g.data=ArraybufferUtils.fromBase64(a.data);return g};function MaterialLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.textures={}} -MaterialLoader.prototype.load=function(a,g,m,b){var l=this;(new FileLoader(l.manager)).load(a,function(a){g(l.parse(JSON.parse(a)))},m,b)};MaterialLoader.prototype.setTextures=function(a){this.textures=a}; -MaterialLoader.prototype.parse=function(a){function g(a){void 0===m[a]&&console.warn('THREE.MaterialLoader: Undefined texture',a);return m[a]}var m=this.textures,b=new window[a.type];void 0!==a.uuid&&(b.uuid=a.uuid);void 0!==a.name&&(b.name=a.name);void 0!==a.color&&(void 0===b.color&&(b.color=new THREE.Color),b.color.setHex(a.color));void 0!==a.roughness&&(b.roughness=a.roughness);void 0!==a.metalness&&(b.metalness=a.metalness);void 0!==a.emissive&&(void 0===b.emissive&&(b.emissive=new THREE.Color), +set:function(a){n._beginFrame=0;n._endFrame=a;n._totalFrames=a}}});this.image.src=this.img.data;this.image.onload=function(){n.needsUpdate=!0};this.currentFrame=0;k()}SpriteSheetTexture.prototype=Object.create(THREE.Texture.prototype);SpriteSheetTexture.prototype.setAnimationSpeed=function(a){this.animationSpeed=a};SpriteSheetTexture.prototype.setFrameGrid=function(a,e){this._framesHorizontal=a;this._framesVertical=e;this._totalFrames=a*e;this.repeat.set(1/a,1/e)}; +SpriteSheetTexture.prototype.setAnimationFrames=function(a,e){this.beginFrame=a;this.endFrame=e};SpriteSheetTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0}; +SpriteSheetTexture.prototype.toJSON=function(a){var e=THREE.Texture.prototype.toJSON.call(this,a);a=this.img.toJSON(a);e.image=a.uuid;e.loop=this.loop;e.animationSpeed=this.animationSpeed;e.framesHorizontal=this._framesHorizontal;e.framesVertical=this._framesVertical;e.totalFrames=this._totalFrames;e.beginFrame=this._beginFrame;e.endFrame=this._endFrame;return e};function FontLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} +FontLoader.prototype.load=function(a,e,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){e(new Font(JSON.parse(a)))},m,b)};FontLoader.prototype.parse=function(a){if(void 0!==a.data){var e=new Font;e.name=a.name;e.uuid=a.uuid;e.encoding=a.encoding;void 0!==a.reversed&&(e.reversed=a.reversed);'base64'===a.format?(e.format='arraybuffer',e.data=ArraybufferUtils.fromBase64(a.data),e.loadTTF()):(e.format=a.format,e.data=a.data,e.font=a.data);return e}return new Font(a)}; +function ImageLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}ImageLoader.prototype.loadJSON=function(a,e,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){e(l.parse(JSON.parse(a)))},m,b)};ImageLoader.prototype.parse=function(a){var e=new Image;e.name=a.name;e.uuid=a.uuid;e.format=a.format;e.encoding=a.encoding;e.data=a.data;return e};function VideoLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} +VideoLoader.prototype.load=function(a,e,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){e(l.parse(JSON.parse(a)))},m,b)};VideoLoader.prototype.parse=function(a){var e=new Video;e.name=a.name;e.uuid=a.uuid;e.format=a.format;e.encoding=a.encoding;e.data=a.data;return e};function AudioLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} +AudioLoader.prototype.load=function(a,e,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){e(self.parse(JSON.parse(a)))},m,b)};AudioLoader.prototype.parse=function(a){var e=new Audio;e.name=a.name;e.uuid=a.uuid;e.encoding=a.encoding;e.format='arraybuffer';e.data=ArraybufferUtils.fromBase64(a.data);return e};function MaterialLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.textures={}} +MaterialLoader.prototype.load=function(a,e,m,b){var l=this;(new FileLoader(l.manager)).load(a,function(a){e(l.parse(JSON.parse(a)))},m,b)};MaterialLoader.prototype.setTextures=function(a){this.textures=a}; +MaterialLoader.prototype.parse=function(a){function e(a){void 0===m[a]&&console.warn('THREE.MaterialLoader: Undefined texture',a);return m[a]}var m=this.textures,b=new window[a.type];void 0!==a.uuid&&(b.uuid=a.uuid);void 0!==a.name&&(b.name=a.name);void 0!==a.color&&(void 0===b.color&&(b.color=new THREE.Color),b.color.setHex(a.color));void 0!==a.roughness&&(b.roughness=a.roughness);void 0!==a.metalness&&(b.metalness=a.metalness);void 0!==a.emissive&&(void 0===b.emissive&&(b.emissive=new THREE.Color), b.emissive.setHex(a.emissive));void 0!==a.specular&&(void 0===b.specular&&(b.specular=new THREE.Color),b.specular.setHex(a.specular));void 0!==a.shininess&&(b.shininess=a.shininess);void 0!==a.clearCoat&&(b.clearCoat=a.clearCoat);void 0!==a.clearCoatRoughness&&(b.clearCoatRoughness=a.clearCoatRoughness);void 0!==a.uniforms&&(b.uniforms=a.uniforms);void 0!==a.vertexShader&&(b.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(b.fragmentShader=a.fragmentShader);void 0!==a.vertexColors&&(b.vertexColors= a.vertexColors);void 0!==a.fog&&(b.fog=a.fog);void 0!==a.shading&&(b.shading=a.shading);void 0!==a.blending&&(b.blending=a.blending);void 0!==a.side&&(b.side=a.side);void 0!==a.opacity&&(b.opacity=a.opacity);void 0!==a.transparent&&(b.transparent=a.transparent);void 0!==a.alphaTest&&(b.alphaTest=a.alphaTest);void 0!==a.depthTest&&(b.depthTest=a.depthTest);void 0!==a.depthWrite&&(b.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(b.colorWrite=a.colorWrite);void 0!==a.wireframe&&(b.wireframe=a.wireframe); -void 0!==a.wireframeLinewidth&&(b.wireframeLinewidth=a.wireframeLinewidth);void 0!==a.wireframeLinecap&&(b.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(b.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.morphTargets&&(b.morphTargets=a.morphTargets);void 0!==a.morphNormals&&(b.morphNormals=a.morphNormals);void 0!==a.skinning&&(b.skinning=a.skinning);void 0!==a.size&&(b.size=a.size);void 0!==a.sizeAttenuation&&(b.sizeAttenuation=a.sizeAttenuation);void 0!==a.map&&(b.map=g(a.map)); -void 0!==a.alphaMap&&(b.alphaMap=g(a.alphaMap),b.transparent=!0);void 0!==a.bumpMap&&(b.bumpMap=g(a.bumpMap));void 0!==a.bumpScale&&(b.bumpScale=a.bumpScale);void 0!==a.normalMap&&(b.normalMap=g(a.normalMap));if(void 0!==a.normalScale){var l=a.normalScale;!1===Array.isArray(l)&&(l=[l,l]);b.normalScale=(new Vector2).fromArray(l)}void 0!==a.displacementMap&&(b.displacementMap=g(a.displacementMap));void 0!==a.displacementScale&&(b.displacementScale=a.displacementScale);void 0!==a.displacementBias&&(b.displacementBias= -a.displacementBias);void 0!==a.roughnessMap&&(b.roughnessMap=g(a.roughnessMap));void 0!==a.metalnessMap&&(b.metalnessMap=g(a.metalnessMap));void 0!==a.emissiveMap&&(b.emissiveMap=g(a.emissiveMap));void 0!==a.emissiveIntensity&&(b.emissiveIntensity=a.emissiveIntensity);void 0!==a.specularMap&&(b.specularMap=g(a.specularMap));void 0!==a.envMap&&(b.envMap=g(a.envMap));void 0!==a.reflectivity&&(b.reflectivity=a.reflectivity);void 0!==a.envMapIntensity&&(b.envMapIntensity=a.envMapIntensity);void 0!==a.combine&& -(b.combine=a.combine);void 0!==a.refractionRatio&&(b.refractionRatio=a.refractionRatio);void 0!==a.lightMap&&(b.lightMap=g(a.lightMap));void 0!==a.lightMapIntensity&&(b.lightMapIntensity=a.lightMapIntensity);void 0!==a.aoMap&&(b.aoMap=g(a.aoMap));void 0!==a.aoMapIntensity&&(b.aoMapIntensity=a.aoMapIntensity);void 0!==a.gradientMap&&(b.gradientMap=g(a.gradientMap));if(void 0!==a.materials)for(var l=0,f=a.materials.length;la;a++)this.gesture[a]=!1;this.pose=[];for(a=0;3>a;a++)this.pose[a]=!1;this.data=null}LeapMotion.prototype=Object.create(THREE.Object3D.prototype); -LeapMotion.DESK=0;LeapMotion.HDM=1;LeapMotion.SWIPE=0;LeapMotion.SWIPE_LEFT=1;LeapMotion.SWIPE_RIGHT=2;LeapMotion.SWIPE_FRONT=3;LeapMotion.SWIPE_BACK=4;LeapMotion.SWIPE_UP=5;LeapMotion.SWIPE_DOWN=6;LeapMotion.CIRCLE=7;LeapMotion.SCREEN_TAP=8;LeapMotion.KEY_TAP=9;LeapMotion.CLOSED=0;LeapMotion.OPEN=1;LeapMotion.POINTING=2;LeapMotion.prototype.initialize=function(){var a=this;Leap.loop({background:!0},function(g){a.data=g}).connect();for(var g=0;gk[a][2]&&(this.pose[LeapMotion.CLOSED]=!1),-.5< -k[a][2]&&(this.pose[LeapMotion.OPEN]=!1),1===a?f=l[1]:f<2*l[a]-15&&(this.pose[LeapMotion.POINTING]=!1));f<2*l[0]-15&&(this.pose[LeapMotion.POINTING]=!1)}}; -LeapMotion.prototype.updateGestures=function(){for(var a=0;ak[a][2]&&(this.pose[LeapMotion.CLOSED]=!1),-.5< +k[a][2]&&(this.pose[LeapMotion.OPEN]=!1),1===a?g=l[1]:g<2*l[a]-15&&(this.pose[LeapMotion.POINTING]=!1));g<2*l[0]-15&&(this.pose[LeapMotion.POINTING]=!1)}}; +LeapMotion.prototype.updateGestures=function(){for(var a=0;athis.dayTime&&(this.time-=this.dayTime),this.updateSky());for(var a=0;athis.dayTime&&(this.time-=this.dayTime),this.updateSky());for(var a=0;a=this.children.length}; -Sky.prototype.updateSky=function(){var a=this.time/this.dayTime;if(.25>a)this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r,this.colorBottom[3].g,this.colorBottom[3].b);else if(.292>a){var g=23.81*(a-.25),m=1-g;this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[3].r+g*this.colorTop[0].r,m*this.colorTop[3].g+g*this.colorTop[0].g,m*this.colorTop[3].b+g*this.colorTop[0].b); -this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[3].r+g*this.colorBottom[0].r,m*this.colorBottom[3].g+g*this.colorBottom[0].g,m*this.colorBottom[3].b+g*this.colorBottom[0].b)}else.4167>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[0].r,this.colorTop[0].g,this.colorTop[0].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[0].r,this.colorBottom[0].g,this.colorBottom[0].b)):.5>a?(g=12*(a-.4167),m=1-g,this.sky.material.uniforms.topColor.value.setRGB(m* -this.colorTop[0].r+g*this.colorTop[1].r,m*this.colorTop[0].g+g*this.colorTop[1].g,m*this.colorTop[0].b+g*this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[0].r+g*this.colorBottom[1].r,m*this.colorBottom[0].g+g*this.colorBottom[1].g,m*this.colorBottom[0].b+g*this.colorBottom[1].b)):.708>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[1].r,this.colorTop[1].g,this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[1].r, -this.colorBottom[1].g,this.colorBottom[1].b)):.75>a?(g=23.81*(a-.708),m=1-g,this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[1].r+g*this.colorTop[2].r,m*this.colorTop[1].g+g*this.colorTop[2].g,m*this.colorTop[1].b+g*this.colorTop[2].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[1].r+g*this.colorBottom[2].r,m*this.colorBottom[1].g+g*this.colorBottom[2].g,m*this.colorBottom[1].b+g*this.colorBottom[2].b)):.8333>a?(g=12.048*(a-.75),m=1-g,this.sky.material.uniforms.topColor.value.setRGB(m* -this.colorTop[2].r+g*this.colorTop[3].r,m*this.colorTop[2].g+g*this.colorTop[3].g,m*this.colorTop[2].b+g*this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[2].r+g*this.colorBottom[3].r,m*this.colorBottom[2].g+g*this.colorBottom[3].g,m*this.colorBottom[2].b+g*this.colorBottom[3].b)):(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r, -this.colorBottom[3].g,this.colorBottom[3].b));.2>a?this.sun.color.setHex(this.moonColor):.3>a?(g=10*(a-.2),.5>g?(this.sun.intensity=.3*(2-2*g),this.sun.color.setHex(this.moonColor)):(this.sun.intensity=.6*g,this.sun.color.setHex(this.sunColor))):.7>a?this.sun.color.setHex(this.sunColor):.8>a?(g=10*(a-.7),.5>g?(this.sun.intensity=.3*(2-2*g),this.sun.color.setHex(this.sunColor)):(this.sun.intensity=.6*g,this.sun.color.setHex(this.moonColor))):this.sun.color.setHex(this.moonColor);g=MathUtils.pi2*a- -MathUtils.pid2;.25a?(this.sun.position.x=this.sunDistance*Math.cos(g),this.sun.position.y=this.sunDistance*Math.sin(g)):(this.sun.position.x=this.sunDistance*Math.cos(g+Math.PI),this.sun.position.y=this.sunDistance*Math.sin(g+Math.PI))}; -Sky.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.colorTop=[];for(var g=0;ga)this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r,this.colorBottom[3].g,this.colorBottom[3].b);else if(.292>a){var e=23.81*(a-.25),m=1-e;this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[3].r+e*this.colorTop[0].r,m*this.colorTop[3].g+e*this.colorTop[0].g,m*this.colorTop[3].b+e*this.colorTop[0].b); +this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[3].r+e*this.colorBottom[0].r,m*this.colorBottom[3].g+e*this.colorBottom[0].g,m*this.colorBottom[3].b+e*this.colorBottom[0].b)}else.4167>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[0].r,this.colorTop[0].g,this.colorTop[0].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[0].r,this.colorBottom[0].g,this.colorBottom[0].b)):.5>a?(e=12*(a-.4167),m=1-e,this.sky.material.uniforms.topColor.value.setRGB(m* +this.colorTop[0].r+e*this.colorTop[1].r,m*this.colorTop[0].g+e*this.colorTop[1].g,m*this.colorTop[0].b+e*this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[0].r+e*this.colorBottom[1].r,m*this.colorBottom[0].g+e*this.colorBottom[1].g,m*this.colorBottom[0].b+e*this.colorBottom[1].b)):.708>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[1].r,this.colorTop[1].g,this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[1].r, +this.colorBottom[1].g,this.colorBottom[1].b)):.75>a?(e=23.81*(a-.708),m=1-e,this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[1].r+e*this.colorTop[2].r,m*this.colorTop[1].g+e*this.colorTop[2].g,m*this.colorTop[1].b+e*this.colorTop[2].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[1].r+e*this.colorBottom[2].r,m*this.colorBottom[1].g+e*this.colorBottom[2].g,m*this.colorBottom[1].b+e*this.colorBottom[2].b)):.8333>a?(e=12.048*(a-.75),m=1-e,this.sky.material.uniforms.topColor.value.setRGB(m* +this.colorTop[2].r+e*this.colorTop[3].r,m*this.colorTop[2].g+e*this.colorTop[3].g,m*this.colorTop[2].b+e*this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[2].r+e*this.colorBottom[3].r,m*this.colorBottom[2].g+e*this.colorBottom[3].g,m*this.colorBottom[2].b+e*this.colorBottom[3].b)):(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r, +this.colorBottom[3].g,this.colorBottom[3].b));.2>a?this.sun.color.setHex(this.moonColor):.3>a?(e=10*(a-.2),.5>e?(this.sun.intensity=.3*(2-2*e),this.sun.color.setHex(this.moonColor)):(this.sun.intensity=.6*e,this.sun.color.setHex(this.sunColor))):.7>a?this.sun.color.setHex(this.sunColor):.8>a?(e=10*(a-.7),.5>e?(this.sun.intensity=.3*(2-2*e),this.sun.color.setHex(this.sunColor)):(this.sun.intensity=.6*e,this.sun.color.setHex(this.moonColor))):this.sun.color.setHex(this.moonColor);e=MathUtils.pi2*a- +MathUtils.pid2;.25a?(this.sun.position.x=this.sunDistance*Math.cos(e),this.sun.position.y=this.sunDistance*Math.sin(e)):(this.sun.position.x=this.sunDistance*Math.cos(e+Math.PI),this.sun.position.y=this.sunDistance*Math.sin(e+Math.PI))}; +Sky.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.colorTop=[];for(var e=0;e\n}\n\nfunction update()\n{\n\t//TODO \n}\n'; Script.METHODS='initialize update dispose onMouseOver onResize onAppData'.split(' ');Script.prototype.initialize=function(){for(var a=this;null!==a.parent;)a=a.parent,a instanceof Scene?this.scene=a:a instanceof Program&&(this.program=a);this.setCode(this.code);for(a=0;aa;a++)g=new THREE.PerspectiveCamera(90,1,this.near,this.far),g.parent=this,this.cameras.push(g);this.cameras[0].up.set(0,-1,0);this.cameras[0].lookAt(new THREE.Vector3(1,0,0));this.cameras[1].up.set(0,-1,0);this.cameras[1].lookAt(new THREE.Vector3(-1,0,0)); +{};a.object.emitter.color.value=[];for(e=0;ea;a++)e=new THREE.PerspectiveCamera(90,1,this.near,this.far),e.parent=this,this.cameras.push(e);this.cameras[0].up.set(0,-1,0);this.cameras[0].lookAt(new THREE.Vector3(1,0,0));this.cameras[1].up.set(0,-1,0);this.cameras[1].lookAt(new THREE.Vector3(-1,0,0)); this.cameras[2].up.set(0,0,1);this.cameras[2].lookAt(new THREE.Vector3(0,1,0));this.cameras[3].up.set(0,0,-1);this.cameras[3].lookAt(new THREE.Vector3(0,-1,0));this.cameras[4].up.set(0,-1,0);this.cameras[4].lookAt(new THREE.Vector3(0,0,1));this.cameras[5].up.set(0,-1,0);this.cameras[5].lookAt(new THREE.Vector3(0,0,-1));this.target=new THREE.WebGLRenderTargetCube(this.resolution,this.resolution,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.cube=this.target.texture; this.cube.generateMipmaps=!1;this.cube.name='cube';this.renderer=this.scene=null}CubeCamera.prototype=Object.create(THREE.Object3D.prototype);CubeCamera.prototype.initialize=function(){for(var a=this;null!==a.parent;)a=a.parent,a instanceof Scene?this.scene=a:a instanceof Program&&(this.renderer=a.renderer);for(a=0;ab;b++)this.cameras[b].updateMatrixWorld(),this.target.activeCubeFace=b,a.render(g,this.cameras[b],this.target);a.autoClear=m};CubeCamera.prototype.dispose=function(){for(var a=0;ab;b++)this.cameras[b].updateMatrixWorld(),this.target.activeCubeFace=b,a.render(e,this.cameras[b],this.target);a.autoClear=m};CubeCamera.prototype.dispose=function(){for(var a=0;aa?a:.05);for(a=0;a>18,f=(k&258048)>>12,c=(k&4032)>>6,k&=63,g+=Base64Utils.encoding[l]+Base64Utils.encoding[f]+Base64Utils.encoding[c]+Base64Utils.encoding[k];1===m?(k=a[b],g+=Base64Utils.encoding[(k&252)>>2]+Base64Utils.encoding[(k&3)<<4]+'=='):2===m&&(k=a[b]<<8|a[b+1],g+=Base64Utils.encoding[(k&64512)>>10]+Base64Utils.encoding[(k&1008)>>4]+Base64Utils.encoding[(k& -15)<<2]+'=');return g}; -Base64Utils.fromBinaryString=function(a){for(var g='',m=a.length%3,b=a.length-m,l,f,c,k=0;k>2),g+=Base64Utils.encoding.charAt((l&3)<<4|(f&240)>>4),g+=Base64Utils.encoding.charAt((f&15)<<2|(c&192)>>6),g+=Base64Utils.encoding.charAt(c&63);1===m?(l=a.charCodeAt(k)&255,g+=Base64Utils.encoding.charAt(l>>2),g+=Base64Utils.encoding.charAt((l&3)<<4),g+='=='):2===m&&(l=a.charCodeAt(k)&255,f=a.charCodeAt(k+ -1),g+=Base64Utils.encoding.charAt(l>>2),g+=Base64Utils.encoding.charAt((l&3)<<4|(f&240)>>4),g+=Base64Utils.encoding.charAt((f&15)<<2),g+='=');return g};function ArraybufferUtils(){}ArraybufferUtils.fromBinaryString=function(a){for(var g=a.length,m=new ArrayBuffer(g),b=new Uint8Array(m),l=0;l>4,64!==c&&(b[n+1]=(f&15)<<4|c>>2),64!==k&&(b[n+2]=(c&3)<<6|k);return m};ArraybufferUtils.fromBuffer=function(a){for(var g=new ArrayBuffer(a.length),m=new Uint8Array(g),b=0;b>18,g=(k&258048)>>12,c=(k&4032)>>6,k&=63,e+=Base64Utils.encoding[l]+Base64Utils.encoding[g]+Base64Utils.encoding[c]+Base64Utils.encoding[k];1===m?(k=a[b],e+=Base64Utils.encoding[(k&252)>>2]+Base64Utils.encoding[(k&3)<<4]+'=='):2===m&&(k=a[b]<<8|a[b+1],e+=Base64Utils.encoding[(k&64512)>>10]+Base64Utils.encoding[(k&1008)>>4]+Base64Utils.encoding[(k& +15)<<2]+'=');return e}; +Base64Utils.fromBinaryString=function(a){for(var e='',m=a.length%3,b=a.length-m,l,g,c,k=0;k>2),e+=Base64Utils.encoding.charAt((l&3)<<4|(g&240)>>4),e+=Base64Utils.encoding.charAt((g&15)<<2|(c&192)>>6),e+=Base64Utils.encoding.charAt(c&63);1===m?(l=a.charCodeAt(k)&255,e+=Base64Utils.encoding.charAt(l>>2),e+=Base64Utils.encoding.charAt((l&3)<<4),e+='=='):2===m&&(l=a.charCodeAt(k)&255,g=a.charCodeAt(k+ +1),e+=Base64Utils.encoding.charAt(l>>2),e+=Base64Utils.encoding.charAt((l&3)<<4|(g&240)>>4),e+=Base64Utils.encoding.charAt((g&15)<<2),e+='=');return e};function ArraybufferUtils(){}ArraybufferUtils.fromBinaryString=function(a){for(var e=a.length,m=new ArrayBuffer(e),b=new Uint8Array(m),l=0;l>4,64!==c&&(b[n+1]=(g&15)<<4|c>>2),64!==k&&(b[n+2]=(c&3)<<6|k);return m};ArraybufferUtils.fromBuffer=function(a){for(var e=new ArrayBuffer(a.length),m=new Uint8Array(e),b=0;bm.boundingSphereRadius+q.boundingSphereRadius)){var t=null;m.material&&q.material&&(t=d.getContactMaterial(m.material,q.material)||null);this.currentContactMaterial=t||n||d.defaultContactMaterial;(t=this[m.type|q.type])&&(m.type=A.dot(p)){var q=this.createContactEquation(r,n,b,e);q.ni.copy(A);var x=C;A.scale(p.dot(A),x);l.vsub(x,x);q.ri.copy(x);q.ri.vsub(r.position,q.ri);q.rj.copy(l);q.rj.vsub(n.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}}};var E=new h,B=new h,z=(new h,new h),J=new h,H=new h,L=new h,K=new h,M=new h,I=new h,G=new h,W=new h,O=new h,S=new h,R=new f,N=[];d.prototype[g.types.SPHERE|g.types.TRIMESH]=d.prototype.sphereTrimesh=function(b, -e,d,g,f,h,r,l){m.pointToLocalFrame(g,h,d,I);f=b.radius;R.lowerBound.set(I.x-f,I.y-f,I.z-f);R.upperBound.set(I.x+f,I.y+f,I.z+f);e.getTrianglesInAABB(R,N);var n=b.radius*b.radius;for(f=0;fp;p++)if(e.getVertex(e.indices[3*N[f]+p],z),z.vsub(I,B),B.norm2()<=n){J.copy(z);m.pointToWorldFrame(g,h,J,z);z.vsub(d,B);var q=this.createContactEquation(r,l,b,e);q.ni.copy(B);q.ni.normalize();q.ri.copy(q.ni);q.ri.scale(b.radius,q.ri);q.ri.vadd(d,q.ri);q.ri.vsub(r.position,q.ri);q.rj.copy(z); -q.rj.vsub(l.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}for(f=0;fp;p++)e.getVertex(e.indices[3*N[f]+p],H),e.getVertex(e.indices[3*N[f]+(p+1)%3],L),L.vsub(H,K),I.vsub(L,G),d=G.dot(K),I.vsub(H,G),q=G.dot(K),0d&&(I.vsub(H,G),M.copy(K),M.normalize(),q=G.dot(M),M.scale(q,G),G.vadd(H,G),d=G.distanceTo(I),d=A.dot(p)){var q=this.createContactEquation(r,l,b,e);q.ni.copy(A);var x=C;A.scale(p.dot(A),x);n.vsub(x,x);q.ri.copy(x);q.ri.vsub(r.position,q.ri);q.rj.copy(n);q.rj.vsub(l.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}}};var E=new h,B=new h,z=(new h,new h),J=new h,H=new h,L=new h,K=new h,M=new h,I=new h,G=new h,W=new h,O=new h,S=new h,R=new f,N=[];d.prototype[g.types.SPHERE|g.types.TRIMESH]=d.prototype.sphereTrimesh=function(b, +e,d,g,f,h,r,n){m.pointToLocalFrame(g,h,d,I);f=b.radius;R.lowerBound.set(I.x-f,I.y-f,I.z-f);R.upperBound.set(I.x+f,I.y+f,I.z+f);e.getTrianglesInAABB(R,N);var l=b.radius*b.radius;for(f=0;fp;p++)if(e.getVertex(e.indices[3*N[f]+p],z),z.vsub(I,B),B.norm2()<=l){J.copy(z);m.pointToWorldFrame(g,h,J,z);z.vsub(d,B);var q=this.createContactEquation(r,n,b,e);q.ni.copy(B);q.ni.normalize();q.ri.copy(q.ni);q.ri.scale(b.radius,q.ri);q.ri.vadd(d,q.ri);q.ri.vsub(r.position,q.ri);q.rj.copy(z); +q.rj.vsub(n.position,q.rj);this.result.push(q);this.createFrictionEquationsFromContact(q,this.frictionResult)}for(f=0;fp;p++)e.getVertex(e.indices[3*N[f]+p],H),e.getVertex(e.indices[3*N[f]+(p+1)%3],L),L.vsub(H,K),I.vsub(L,G),d=G.dot(K),I.vsub(H,G),q=G.dot(K),0d&&(I.vsub(H,G),M.copy(K),M.normalize(),q=G.dot(M),M.scale(q,G),G.vadd(H,G),d=G.distanceTo(I),dw&&0C&&C>-E&&B>ia&&ia>-B&&(w=Math.abs(w-y-h),(null===x||x>w)&&(x=w,p=C,q=ia,n=y,U.copy(A),F.copy(D),ha.copy(z),m++))}}m&&(l=!0,m=this.createContactEquation(k,r,b,e),U.mult(-h,m.ri),m.ni.copy(U),m.ni.negate(m.ni),U.mult(n,U),F.mult(p,F),U.vadd(F,U),ha.mult(q,ha),U.vadd(ha, -m.rj),m.ri.vadd(d,m.ri),m.ri.vsub(k.position,m.ri),m.rj.vadd(g,m.rj),m.rj.vsub(r.position,m.rj),this.result.push(m),this.createFrictionEquationsFromContact(m,this.frictionResult));w=f.get();for(n=0;2!==n&&!l;n++)for(p=0;2!==p&&!l;p++)for(q=0;2!==q&&!l;q++)if(w.set(0,0,0),n?w.vadd(ba[0],w):w.vsub(ba[0],w),p?w.vadd(ba[1],w):w.vsub(ba[1],w),q?w.vadd(ba[2],w):w.vsub(ba[2],w),g.vadd(w,ca),ca.vsub(d,ca),ca.norm2()D&&(l=!0,q=this.createContactEquation(k,r,b,e),t.vadd(u,q.rj),q.rj.copy(q.rj),w.negate(q.ni),q.ni.normalize(),q.ri.copy(q.rj),q.ri.vadd(g,q.ri),q.ri.vsub(d,q.ri),q.ri.normalize(),q.ri.mult(h,q.ri),q.ri.vadd(d,q.ri),q.ri.vsub(k.position,q.ri),q.rj.vadd(g,q.rj),q.rj.vsub(r.position,q.rj),this.result.push(q),this.createFrictionEquationsFromContact(q,this.frictionResult))}f.release(x,t,m,u,w)};var ia=new h,qa=new h,ua=new h,ta=new h,La= -new h,va=new h,Wa=new h,xa=new h,Vb=new h,fa=new h;d.prototype[g.types.SPHERE|g.types.CONVEXPOLYHEDRON]=d.prototype.sphereConvex=function(b,e,d,g,f,h,k,r){f=this.v3pool;d.vsub(g,ia);for(var l=e.faceNormals,n=e.faces,m=e.vertices,p=b.radius,q=0;q!==m.length;q++){var x=La;h.vmult(m[q],x);g.vadd(x,x);var t=ta;if(x.vsub(d,t),t.norm2()y&&0w&&0C&&C>-E&&B>ia&&ia>-B&&(w=Math.abs(w-y-h),(null===x||x>w)&&(x=w,p=C,q=ia,l=y,U.copy(A),F.copy(D),ha.copy(z),m++))}}m&&(n=!0,m=this.createContactEquation(k,r,b,e),U.mult(-h,m.ri),m.ni.copy(U),m.ni.negate(m.ni),U.mult(l,U),F.mult(p,F),U.vadd(F,U),ha.mult(q,ha),U.vadd(ha, +m.rj),m.ri.vadd(d,m.ri),m.ri.vsub(k.position,m.ri),m.rj.vadd(g,m.rj),m.rj.vsub(r.position,m.rj),this.result.push(m),this.createFrictionEquationsFromContact(m,this.frictionResult));w=f.get();for(l=0;2!==l&&!n;l++)for(p=0;2!==p&&!n;p++)for(q=0;2!==q&&!n;q++)if(w.set(0,0,0),l?w.vadd(ba[0],w):w.vsub(ba[0],w),p?w.vadd(ba[1],w):w.vsub(ba[1],w),q?w.vadd(ba[2],w):w.vsub(ba[2],w),g.vadd(w,ca),ca.vsub(d,ca),ca.norm2()D&&(n=!0,q=this.createContactEquation(k,r,b,e),t.vadd(u,q.rj),q.rj.copy(q.rj),w.negate(q.ni),q.ni.normalize(),q.ri.copy(q.rj),q.ri.vadd(g,q.ri),q.ri.vsub(d,q.ri),q.ri.normalize(),q.ri.mult(h,q.ri),q.ri.vadd(d,q.ri),q.ri.vsub(k.position,q.ri),q.rj.vadd(g,q.rj),q.rj.vsub(r.position,q.rj),this.result.push(q),this.createFrictionEquationsFromContact(q,this.frictionResult))}f.release(x,t,m,u,w)};var ia=new h,qa=new h,ua=new h,ta=new h,La= +new h,va=new h,Wa=new h,xa=new h,Vb=new h,fa=new h;d.prototype[g.types.SPHERE|g.types.CONVEXPOLYHEDRON]=d.prototype.sphereConvex=function(b,e,d,g,f,h,k,r){f=this.v3pool;d.vsub(g,ia);for(var n=e.faceNormals,l=e.faces,m=e.vertices,p=b.radius,q=0;q!==m.length;q++){var x=La;h.vmult(m[q],x);g.vadd(x,x);var t=ta;if(x.vsub(d,t),t.norm2()y&&0=C&&!1===z)){F=!1;break a}null===z&&(z=0=Pa.dot(Ba)){var n=this.createContactEquation(k,r,b,e),m=Za;Pa.mult(Pa.dot(Ba), -m);Aa.vsub(m,m);m.vsub(d,n.ri);n.ni.copy(Pa);Aa.vsub(g,n.rj);n.ri.vadd(d,n.ri);n.ri.vsub(k.position,n.ri);n.rj.vadd(g,n.rj);n.rj.vsub(r.position,n.rj);this.result.push(n);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(n,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)};var ra=new h,ma=new h;d.prototype[g.types.CONVEXPOLYHEDRON]=d.prototype.convexConvex=function(b,e,d,g,f,h,k,r,n,l,m,p){if(!(d.distanceTo(g)>b.boundingSphereRadius+e.boundingSphereRadius)&& -b.findSeparatingAxis(e,d,f,g,h,ra,m,p)){m=[];b.clipAgainstHull(d,f,e,g,h,ra,-100,100,m);for(h=f=0;h!==m.length;h++){p=this.createContactEquation(k,r,b,e,n,l);var q=p.ri,x=p.rj;ra.negate(p.ni);m[h].normal.negate(ma);ma.mult(m[h].depth,ma);m[h].point.vadd(ma,q);x.copy(m[h].point);q.vsub(d,q);x.vsub(g,x);q.vadd(d,q);q.vsub(k.position,q);x.vadd(g,x);x.vsub(r.position,x);this.result.push(p);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(p,this.frictionResult)}this.enableFrictionReduction&& +e.material;e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse;this.planeConvex(b,e.convexPolyhedronRepresentation,d,g,f,h,k,r)};var Aa=new h,Pa=new h,Ba=new h,Za=new h;d.prototype[g.types.PLANE|g.types.CONVEXPOLYHEDRON]=d.prototype.planeConvex=function(b,e,d,g,f,h,k,r){Pa.set(0,0,1);f.vmult(Pa,Pa);for(var n=f=0;n!==e.vertices.length;n++)if(Aa.copy(e.vertices[n]),h.vmult(Aa,Aa),g.vadd(Aa,Aa),Aa.vsub(d,Ba),0>=Pa.dot(Ba)){var l=this.createContactEquation(k,r,b,e),m=Za;Pa.mult(Pa.dot(Ba), +m);Aa.vsub(m,m);m.vsub(d,l.ri);l.ni.copy(Pa);Aa.vsub(g,l.rj);l.ri.vadd(d,l.ri);l.ri.vsub(k.position,l.ri);l.rj.vadd(g,l.rj);l.rj.vsub(r.position,l.rj);this.result.push(l);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(l,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)};var ra=new h,ma=new h;d.prototype[g.types.CONVEXPOLYHEDRON]=d.prototype.convexConvex=function(b,e,d,g,f,h,k,r,l,n,m,p){if(!(d.distanceTo(g)>b.boundingSphereRadius+e.boundingSphereRadius)&& +b.findSeparatingAxis(e,d,f,g,h,ra,m,p)){m=[];b.clipAgainstHull(d,f,e,g,h,ra,-100,100,m);for(h=f=0;h!==m.length;h++){p=this.createContactEquation(k,r,b,e,l,n);var q=p.ri,x=p.rj;ra.negate(p.ni);m[h].normal.negate(ma);ma.mult(m[h].depth,ma);m[h].point.vadd(ma,q);x.copy(m[h].point);q.vsub(d,q);x.vsub(g,x);q.vadd(d,q);q.vsub(k.position,q);x.vadd(g,x);x.vsub(r.position,x);this.result.push(p);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(p,this.frictionResult)}this.enableFrictionReduction&& f&&this.createFrictionFromAverage(f)}};var Ja=new h,Ea=new h,V=new h;d.prototype[g.types.PLANE|g.types.PARTICLE]=d.prototype.planeParticle=function(b,e,d,g,f,h,k,r){Ja.set(0,0,1);k.quaternion.vmult(Ja,Ja);g.vsub(k.position,Ea);0>=Ja.dot(Ea)&&(b=this.createContactEquation(r,k,e,b),b.ni.copy(Ja),b.ni.negate(b.ni),b.ri.set(0,0,0),Ja.mult(Ja.dot(g),V),g.vsub(V,V),b.rj.copy(V),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var Ha=new h;d.prototype[g.types.PARTICLE| g.types.SPHERE]=d.prototype.sphereParticle=function(b,e,d,g,f,h,k,r){Ha.set(0,0,1);g.vsub(d,Ha);Ha.norm2()<=b.radius*b.radius&&(e=this.createContactEquation(r,k,e,b),Ha.normalize(),e.rj.copy(Ha),e.rj.mult(b.radius,e.rj),e.ni.copy(Ha),e.ni.negate(e.ni),e.ri.set(0,0,0),this.result.push(e),this.createFrictionEquationsFromContact(e,this.frictionResult))};var aa=new l,Xa=new h,zb=(new h,new h),na=new h,Na=new h;d.prototype[g.types.PARTICLE|g.types.CONVEXPOLYHEDRON]=d.prototype.convexParticle=function(b, -e,d,g,f,h,k,r){var n=-1;h=null;var l=0;if(Xa.copy(g),Xa.vsub(d,Xa),f.conjugate(aa),aa.vmult(Xa,Xa),b.pointIsInside(Xa)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(d,f);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(f);f=0;for(var m=b.faces.length;f!==m;f++){var p=b.worldFaceNormals[f];g.vsub(b.worldVertices[b.faces[f][0]],na);var q=-p.dot(na);(null===h||Math.abs(q)x||0>l||q>n.length||t>n[0].length)){0>q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>l&&(l=0);q>=n.length&& -(q=n.length-1);x>=n.length&&(x=n.length-1);l>=n[0].length&&(l=n[0].length-1);t>=n[0].length&&(t=n[0].length-1);n=[];e.getRectMinMax(q,t,x,l,n);var u=n[0];if(!(Lb.z-p>n[1]||Lb.z+pp;p++)for(q=t;l>q;q++)e.getConvexTrianglePillar(p,q,!1),m.pointToWorldFrame(g,h,e.pillarOffset,Oa),d.distanceTo(Oa)x||0>p||q>n.length||p>n[0].length)){0> -q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>p&&(p=0);q>=n.length&&(q=n.length-1);x>=n.length&&(x=n.length-1);p>=n[0].length&&(p=n[0].length-1);t>=n[0].length&&(t=n[0].length-1);n=[];e.getRectMinMax(q,t,x,p,n);var u=n[0];if(!(Fa.z-l>n[1]||Fa.z+lq;q++)for(n=t;p>n;n++)if(u=l.length,e.getConvexTrianglePillar(q,n,!1),m.pointToWorldFrame(g,h,e.pillarOffset,wb),d.distanceTo(wb)x||0>n||q>l.length||t>l[0].length)){0>q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>n&&(n=0);q>=l.length&& +(q=l.length-1);x>=l.length&&(x=l.length-1);n>=l[0].length&&(n=l[0].length-1);t>=l[0].length&&(t=l[0].length-1);l=[];e.getRectMinMax(q,t,x,n,l);var u=l[0];if(!(Lb.z-p>l[1]||Lb.z+pp;p++)for(q=t;n>q;q++)e.getConvexTrianglePillar(p,q,!1),m.pointToWorldFrame(g,h,e.pillarOffset,Oa),d.distanceTo(Oa)x||0>p||q>l.length||p>l[0].length)){0> +q&&(q=0);0>x&&(x=0);0>t&&(t=0);0>p&&(p=0);q>=l.length&&(q=l.length-1);x>=l.length&&(x=l.length-1);p>=l[0].length&&(p=l[0].length-1);t>=l[0].length&&(t=l[0].length-1);l=[];e.getRectMinMax(q,t,x,p,l);var u=l[0];if(!(Fa.z-n>l[1]||Fa.z+nq;q++)for(l=t;p>l;l++)if(u=n.length,e.getConvexTrianglePillar(q,l,!1),m.pointToWorldFrame(g,h,e.pillarOffset,wb),d.distanceTo(wb)>>=0;128<=a;)f=a&127|128,this.view[b++]=f,a>>>=7;this.view[b++]=a;ret }var d=0,e=0,f;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;f=this.view[a++];5>d&&(e|=(f&127)<<7*d);++d}while(0!==(f&128));e|=0;return b?(this.offset=a,e):{value:e,length:d}};h.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=k.zigZagDecode32(a.value):a=k.zigZagDecode32(a);return a};a&&(k.MAX_VARINT64_BYTES=10,k.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var d=b.toInt()>>> 0,e=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==e?16384>d?128>d?1:2:2097152>d?3:4:16384>e?128>e?5:6:2097152>e?7:8:128>b?9:10},k.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},k.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& (b=b.toSigned());return b.shiftRightUnsigned(1).xor(b.and(a.ONE).toSigned().negate()).toSigned()},h.writeVarint64=function(b,d){var e='undefined'===typeof d;e&&(d=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof d||0!==d%1)throw TypeError('Illegal offset: '+d+' (not an integer)');d>>>=0;if(0>d||d+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -d+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var f=k.calculateVarint64(b),g=b.toInt()>>>0,h=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;d+=f;var n=this.buffer.byteLength;d>n&&this.resize((n*=2)>d?n:d);d-=f;switch(f){case 10:this.view[d+9]=b>>>7&1;case 9:this.view[d+8]=9!==f?b|128:b&127;case 8:this.view[d+7]=8!==f?h>>>21|128:h>>>21&127;case 7:this.view[d+6]= +d+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var f=k.calculateVarint64(b),g=b.toInt()>>>0,h=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;d+=f;var l=this.buffer.byteLength;d>l&&this.resize((l*=2)>d?l:d);d-=f;switch(f){case 10:this.view[d+9]=b>>>7&1;case 9:this.view[d+8]=9!==f?b|128:b&127;case 8:this.view[d+7]=8!==f?h>>>21|128:h>>>21&127;case 7:this.view[d+6]= 7!==f?h>>>14|128:h>>>14&127;case 6:this.view[d+5]=6!==f?h>>>7|128:h>>>7&127;case 5:this.view[d+4]=5!==f?h|128:h&127;case 4:this.view[d+3]=4!==f?g>>>21|128:g>>>21&127;case 3:this.view[d+2]=3!==f?g>>>14|128:g>>>14&127;case 2:this.view[d+1]=2!==f?g>>>7|128:g>>>7&127;case 1:this.view[d]=1!==f?g|128:g&127}return e?(this.offset+=f,this):f},h.writeVarint64ZigZag=function(a,b){return this.writeVarint64(k.zigZagEncode64(a),b)},h.readVarint64=function(b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!== typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var e=b,f,g=0,h=0,k;k=this.view[b++];f=k&127;if(k&128&&(k=this.view[b++],f|=(k&127)<<7,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],f|=(k&127)<<14,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],f|=(k&127)<<21,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++], g=k&127,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],g|=(k&127)<<7,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],g|=(k&127)<<14,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],g|=(k&127)<<21,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],h=k&127,k&128||this.noAssert&&'undefined'===typeof k)&&(k=this.view[b++],h|=(k&127)<<7,k&128||this.noAssert&&'undefined'===typeof k))throw Error('Buffer overrun');f=a.fromBits(f|g<<28,g>>>4| @@ -1921,17 +1921,7 @@ d;return f}catch(e){throw b.littleEndian=d,e;}};f.prototype._decodeValue=functio case b.LONG:return d?f.readVarint64ZigZag():f.readVarint32ZigZag();case b.FLOAT:return f.readFloat32();case b.DOUBLE:return f.readFloat64();case b.STRING:return f.readVString();case b.STRING_ADD:return f=f.readVString(),this.dict.push(f),f;case b.STRING_GET:return this.dict[f.readVarint32()];case b.BINARY:return g=f.readVarint32(),h=f.slice(f.offset,f.offset+g),f.offset+=g,h;default:throw Error('Illegal type at '+f.offset+': '+g);}};return f}(a,b.T);b.Pair=function(){var a=function(){};a.prototype.encode= function(a){return this.encoder.encode(a)};a.prototype.toArrayBuffer=function(a){return this.encoder.encode(a).toArrayBuffer()};a.prototype.toBuffer=function(a){return this.encoder.encode(a).toBuffer()};a.prototype.decode=function(a){return this.decoder.decode(a)};return a}();b.StaticPair=function(a,b,d){var f=function(f,g){a.call(this);this.encoder=new b(f,!1,g);this.decoder=new d(f,!1,g)};f.prototype=Object.create(a.prototype);return f}(b.Pair,b.Encoder,b.Decoder);b.ProgressivePair=function(a,d, f){var g=function(b,g){a.call(this);this.encoder=new d(b,!0,g);this.decoder=new f(b,!0,g)};g.prototype=Object.create(a.prototype);g.prototype.exclude=function(a){b.exclude(a)};g.prototype.include=function(a){b.include(a)};return g}(b.Pair,b.Encoder,b.Decoder);b.exclude=function(a){'object'===typeof a&&Object.defineProperty(a,'_PSON_EXCL_',{value:!0,enumerable:!1,configurable:!0})};b.include=function(a){'object'===typeof a&&delete a._PSON_EXCL_};return b}'undefined'!=typeof module&&module.exports? -module.exports=b(require('bytebuffer')):'undefined'!=typeof define&&define.amd?define('PSON',['ByteBuffer'],b):(a.dcodeIO||(a.dcodeIO={}),a.dcodeIO.PSON=b(a.dcodeIO.ByteBuffer))})(this); -var BufferAttribute=THREE.BufferAttribute,BufferGeometry=THREE.BufferGeometry,Clock=THREE.Clock,Face3=THREE.Face3,Geometry=THREE.Geometry,Object3D=THREE.Object3D,Raycaster=THREE.Raycaster,Material=THREE.Material,LineBasicMaterial=THREE.LineBasicMaterial,LineDashedMaterial=THREE.LineDashedMaterial,MeshBasicMaterial=THREE.MeshBasicMaterial,MeshDepthMaterial=THREE.MeshDepthMaterial,MeshLambertMaterial=THREE.MeshLambertMaterial,MeshNormalMaterial=THREE.MeshNormalMaterial,MeshPhongMaterial=THREE.MeshPhongMaterial, -MeshPhysicalMaterial=THREE.MeshPhysicalMaterial,MeshStandardMaterial=THREE.MeshStandardMaterial,MeshToonMaterial=THREE.MeshToonMaterial,MultiMaterial=THREE.MultiMaterial,PointsMaterial=THREE.PointsMaterial,RawShaderMaterial=THREE.RawShaderMaterial,ShaderMaterial=THREE.ShaderMaterial,SpriteMaterial=THREE.SpriteMaterial,BoxBufferGeometry=THREE.BoxBufferGeometry,BoxGeometry=THREE.BoxGeometry,CircleBufferGeometry=THREE.CircleBufferGeometry,CircleGeometry=THREE.CircleGeometry,ConeBufferGeometry=THREE.ConeBufferGeometry, -ConeGeometry=THREE.ConeGeometry,CylinderBufferGeometry=THREE.CylinderBufferGeometry,CylinderGeometry=THREE.CylinderGeometry,DodecahedronBufferGeometry=THREE.DodecahedronBufferGeometry,DodecahedronGeometry=THREE.DodecahedronGeometry,ExtrudeGeometry=THREE.ExtrudeGeometry,IcosahedronBufferGeometry=THREE.IcosahedronBufferGeometry,IcosahedronGeometry=THREE.IcosahedronGeometry,LatheBufferGeometry=THREE.LatheBufferGeometry,LatheGeometry=THREE.LatheGeometry,OctahedronBufferGeometry=THREE.OctahedronBufferGeometry, -OctahedronGeometry=THREE.OctahedronGeometry,ParametricBufferGeometry=THREE.ParametricBufferGeometry,ParametricGeometry=THREE.ParametricGeometry,PlaneBufferGeometry=THREE.PlaneBufferGeometry,PlaneGeometry=THREE.PlaneGeometry,PolyhedronBufferGeometry=THREE.PolyhedronBufferGeometry,PolyhedronGeometry=THREE.PolyhedronGeometry,RingBufferGeometry=THREE.RingBufferGeometry,RingGeometry=THREE.RingGeometry,ShapeGeometry=THREE.ShapeGeometry,SphereBufferGeometry=THREE.SphereBufferGeometry,SphereGeometry=THREE.SphereGeometry, -TetrahedronBufferGeometry=THREE.TetrahedronBufferGeometry,TetrahedronGeometry=THREE.TetrahedronGeometry,TextGeometry=THREE.TextGeometry,TorusBufferGeometry=THREE.TorusBufferGeometry,TorusGeometry=THREE.TorusGeometry,TorusKnotBufferGeometry=THREE.TorusKnotBufferGeometry,TorusKnotGeometry=THREE.TorusKnotGeometry,TubeGeometry=THREE.TubeGeometry,TubeBufferGeometry=THREE.TubeBufferGeometry,WireframeGeometry=THREE.WireframeGeometry,TrianglesDrawMode=THREE.TrianglesDrawMode,TriangleStripDrawMode=THREE.TriangleStripDrawMode, -TriangleFanDrawMode=THREE.TriangleFanDrawMode,Box2=THREE.Box2,Box3=THREE.Box3,Color=THREE.Color,Euler=THREE.Euler,Line3=THREE.Line3,Frustum=THREE.Frustum,Matrix3=THREE.Matrix3,Matrix4=THREE.Matrix4,Plane=THREE.Plane,Quarternion=THREE.Quarternion,Ray=THREE.Ray,Sphere=THREE.Sphere,Spline=THREE.Spline,Triangle=THREE.Triangle,Vector2=THREE.Vector2,Vector3=THREE.Vector3,Vector4=THREE.Vector4,LOD=THREE.LOD,LensFlare=THREE.LensFlare,Line=THREE.Line,LineSegments=THREE.LineSegments,AABB=CANNON.AABB,ArrayCollisionMatrix= -CANNON.ArrayCollisionMatrix,Body=CANNON.Body,Box=CANNON.Box,Broadphase=CANNON.Broadphase,ConeEquation=CANNON.ConeEquation,ConeTwistConstraint=CANNON.ConeTwistConstraint,Constraint=CANNON.Constraint,ContactEquation=CANNON.ContactEquation,ContactMaterial=CANNON.ContactMaterial,ConvexPolyhedron=CANNON.ConvexPolyhedron,Cylinder=CANNON.Cylinder,DistanceConstraint=CANNON.DistanceConstraint,Equation=CANNON.Equation,EventTarget=CANNON.EventTarget,FrictionEquation=CANNON.FrictionEquation,GridBroadphase=CANNON.GridBroadphase, -GSSolver=CANNON.GSSolver,Heightfield=CANNON.Heightfield,HingeConstraint=CANNON.HingeConstraint,JacobianElement=CANNON.JacobianElement,LockConstraint=CANNON.LockConstraint,Mat3=CANNON.Mat3,PhysicsMaterial=CANNON.Material,NaiveBroadphase=CANNON.NaiveBroadphase,Narrowphase=CANNON.Narrowphase,ObjectCollisionMatrix=CANNON.ObjectCollisionMatrix,Octree=CANNON.Octree,OctreeNode=CANNON.OctreeNode,Particle=CANNON.Particle,PointToPointConstraint=CANNON.PointToPointConstraint,Pool=CANNON.Pool,PhysicsRay=CANNON.Ray, -RaycastResult=CANNON.RaycastResult,RaycastVehicle=CANNON.RaycastVehicle,RigidVehicle=CANNON.RigidVehicle,RotationalEquation=CANNON.RotationalEquation,RotationalMotorEquation=CANNON.RotationalMotorEquation,SAPBroadphase=CANNON.SAPBroadphase,Shape=CANNON.Shape,Solver=CANNON.Solver,SPHSystem=CANNON.SPHSystem,SplitSolver=CANNON.SplitSolver,Spring=CANNON.Spring,Transform=CANNON.Transform,Trimesh=CANNON.Trimesh,TupleDictionary=CANNON.TupleDictionary,Vec3=CANNON.Vec3,Vec3Pool=CANNON.Vec3Pool,WheelInfo=CANNON.WheelInfo, -World=CANNON.World;function FileSystem(){}try{FileSystem.fs=require('fs')}catch(a){} +module.exports=b(require('bytebuffer')):'undefined'!=typeof define&&define.amd?define('PSON',['ByteBuffer'],b):(a.dcodeIO||(a.dcodeIO={}),a.dcodeIO.PSON=b(a.dcodeIO.ByteBuffer))})(this);function importFrom(a){for(var b in a)b in window||(window[b]=a[b])}importFrom(THREE);importFrom(CANNON);importFrom(SPE);function FileSystem(){}try{FileSystem.fs=require('fs')}catch(a){} FileSystem.readFile=function(a,b,f,d){void 0===b&&(b=!0);if(void 0!==FileSystem.fs&&FileSystem.fs.existsSync(g)){if(b)return a=FileSystem.fs.readFileSync(a,'utf8'),void 0!==f&&f(a),a;FileSystem.fs.readFile(a,'utf8',function(a,b){void 0!==f&&f(b)});return null}var g=new XMLHttpRequest;g.overrideMimeType('text/plain');g.open('GET',a,!b);g.onload=function(){200!==g.status&&0!==g.status||void 0===f||f(g.response)};void 0!==d&&(g.onprogress=function(a){d(a)});g.send(null);return g.response}; FileSystem.readFileArrayBuffer=function(a,b,f,d){void 0===b&&(b=!0);if(void 0!==FileSystem.fs){if(b){a=FileSystem.fs.readFileSync(a);b=a.length;for(var g=new ArrayBuffer(b),k=new Uint8Array(g),h=0;ha?a:.05);for(a=0;a>18,k=(m&258048)>>12,h=(m&4032)>>6,m&=63,b+=Base64Utils.encoding[g]+Base64Utils.encoding[k]+Base64Utils.encoding[h]+Base64Utils.encoding[m];1===f?(m=a[d],b+=Base64Utils.encoding[(m&252)>>2]+Base64Utils.encoding[(m&3)<<4]+'=='):2===f&&(m=a[d]<<8|a[d+1],b+=Base64Utils.encoding[(m&64512)>>10]+Base64Utils.encoding[(m&1008)>>4]+Base64Utils.encoding[(m& 15)<<2]+'=');return b}; Base64Utils.fromBinaryString=function(a){for(var b='',f=a.length%3,d=a.length-f,g,k,h,m=0;m>2),b+=Base64Utils.encoding.charAt((g&3)<<4|(k&240)>>4),b+=Base64Utils.encoding.charAt((k&15)<<2|(h&192)>>6),b+=Base64Utils.encoding.charAt(h&63);1===f?(g=a.charCodeAt(m)&255,b+=Base64Utils.encoding.charAt(g>>2),b+=Base64Utils.encoding.charAt((g&3)<<4),b+='=='):2===f&&(g=a.charCodeAt(m)&255,k=a.charCodeAt(m+ @@ -5028,8 +5018,8 @@ function Settings(){}Settings.RADIANS=0;Settings.DEGREES=1;Settings.FREE=10;Sett Settings.loadDefault=function(){Settings.general={};Settings.general.theme='dark';Settings.general.filePreviewSize=70;Settings.general.showStats=!1;Settings.general.showUUID=!1;Settings.editor={};Settings.editor.angleFormat=Settings.RADIANS;Settings.editor.snap=!1;Settings.editor.snapAngle=.1;Settings.editor.gridSize=500;Settings.editor.gridSpacing=5;Settings.editor.gridEnabled=!0;Settings.editor.axisEnabled=!0;Settings.editor.cameraPreviewEnabled=!0;Settings.editor.cameraPreviewPercentage=.35;Settings.editor.cameraPreviewPosition= Settings.BOTTOM_RIGHT;Settings.editor.lockMouse=!0;Settings.editor.transformationSpace='world';Settings.editor.navigation=Settings.FREE;Settings.editor.invertNavigation=!1;Settings.editor.keyboardNavigation=!0;Settings.render={};Settings.render.followProject=!0;Settings.render.toneMapping=THREE.LinearToneMapping;Settings.render.toneMappingExposure=1;Settings.render.toneMappingWhitePoint=1;Settings.render.antialiasing=!0;Settings.render.shadows=!0;Settings.render.shadowsType=THREE.PCFSoftShadowMap; Settings.code={};Settings.code.theme='monokai';Settings.code.keymap='sublime';Settings.code.fontSize=14;Settings.code.lineNumbers=!0;Settings.code.lineWrapping=!1;Settings.code.autoCloseBrackets=!0;Settings.code.highlightActiveLine=!1;Settings.code.showMatchesOnScrollbar=!0;Settings.code.dragFiles=!0}; -Settings.store=function(){var a=JSON.stringify({general:Settings.general,editor:Settings.editor,render:Settings.render,code:Settings.code},null,'\t');a.replace(/[\n\t]+([\d\.e\-\[\]]+)/g,'$1');Nunu.runningOnDesktop()?FileSystem.writeFile('config',a):Cookies.set('config',a)}; -Settings.load=function(){try{var a=Nunu.runningOnDesktop()?JSON.parse(FileSystem.readFile('config')):JSON.parse(Cookies.get('config'));Settings.general=a.general;Settings.editor=a.editor;Settings.render=a.render;Settings.code=a.code}catch(b){Settings.loadDefault()}};function Editor(){}Editor.filePath='editor/files/';Editor.runtimePath='runtime/';Editor.NWJSPath='../nwjs/';Editor.SELECT=0;Editor.MOVE=1;Editor.SCALE=2;Editor.ROTATE=3; +Settings.store=function(){var a=JSON.stringify({general:Settings.general,editor:Settings.editor,render:Settings.render,code:Settings.code},null,'\t');a.replace(/[\n\t]+([\d\.e\-\[\]]+)/g,'$1');Nunu.runningOnDesktop()?FileSystem.writeFile('config',a):Cookies.set('config',a)};Settings.load=function(){try{var a=Nunu.runningOnDesktop()?JSON.parse(FileSystem.readFile('config')):JSON.parse(Cookies.get('config')),b;for(b in a)Settings[b]=a[b]}catch(f){Settings.loadDefault()}};function Editor(){} +Editor.filePath='editor/files/';Editor.runtimePath='runtime/';Editor.NWJSPath='../nwjs/';Editor.SELECT=0;Editor.MOVE=1;Editor.SCALE=2;Editor.ROTATE=3; Editor.initialize=function(){try{Editor.gui=require('nw.gui'),Editor.clipboard=Editor.gui.Clipboard.get(),Editor.args=Editor.gui.App.argv}catch(g){Editor.clipboard=new Clipboard;Editor.args=[];for(var a=location.search.substring(1).split('&'),b=0;ba.keyCode||!a.altKey&&a.ctrlKey&&-1===d.indexOf(a.keyCode))&&a.preventDefault()};window.onbeforeunload=function(a){Settings.store();return a.returnValue='All unsaved changes to the project will be lost! Do you really wanna exit?'}}document.body.ondrop=function(a){0=r||0 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}'].join('\n')); -x.compileShader(I);x.compileShader(Q);x.attachShader(k,I);x.attachShader(k,Q);x.linkProgram(k);F=k;A=x.getAttribLocation(F,'position');C=x.getAttribLocation(F,'uv');b=x.getUniformLocation(F,'uvOffset');d=x.getUniformLocation(F,'uvScale');c=x.getUniformLocation(F,'rotation');h=x.getUniformLocation(F,'scale');f=x.getUniformLocation(F,'color');q=x.getUniformLocation(F,'map');g=x.getUniformLocation(F,'opacity');l=x.getUniformLocation(F,'modelViewMatrix');p=x.getUniformLocation(F,'projectionMatrix');t= +function Nunu(){}Nunu.NAME='nunuStudio';Nunu.VERSION='V0.9.0 Beta';Nunu.TIMESTAMP='201706291910';Nunu.webvrAvailable=function(){return void 0!==navigator.getVRDisplays};Nunu.getVRDisplays=function(a){void 0===navigator.getVRDisplays?console.warn('nunuStudio: WebVR is not supported.'):navigator.getVRDisplays().then(function(e){0=r||0 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}'].join('\n')); +x.compileShader(I);x.compileShader(Q);x.attachShader(k,I);x.attachShader(k,Q);x.linkProgram(k);F=k;A=x.getAttribLocation(F,'position');C=x.getAttribLocation(F,'uv');b=x.getUniformLocation(F,'uvOffset');d=x.getUniformLocation(F,'uvScale');c=x.getUniformLocation(F,'rotation');h=x.getUniformLocation(F,'scale');g=x.getUniformLocation(F,'color');q=x.getUniformLocation(F,'map');e=x.getUniformLocation(F,'opacity');l=x.getUniformLocation(F,'modelViewMatrix');p=x.getUniformLocation(F,'projectionMatrix');t= x.getUniformLocation(F,'fogType');m=x.getUniformLocation(F,'fogDensity');u=x.getUniformLocation(F,'fogNear');v=x.getUniformLocation(F,'fogFar');w=x.getUniformLocation(F,'fogColor');y=x.getUniformLocation(F,'alphaTest');k=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');k.width=8;k.height=8;I=k.getContext('2d');I.fillStyle='white';I.fillRect(0,0,8,8);L=new ca(k)}z.useProgram(F);z.initAttributes();z.enableAttribute(A);z.enableAttribute(C);z.disableUnusedAttributes();z.disable(x.CULL_FACE); z.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,E);x.vertexAttribPointer(A,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(C,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,D);x.uniformMatrix4fv(p,!1,n.projectionMatrix.elements);z.activeTexture(x.TEXTURE0);x.uniform1i(q,0);I=k=0;(Q=B.fog)?(x.uniform3f(w,Q.color.r,Q.color.g,Q.color.b),Q.isFog?(x.uniform1f(u,Q.near),x.uniform1f(v,Q.far),x.uniform1i(t,1),I=k=1):Q.isFogExp2&&(x.uniform1f(m,Q.density),x.uniform1i(t,2),I=k=2)):(x.uniform1i(t,0),I=k=0);for(var Q= -0,wa=a.length;Qa&&(a=e[B]);return a}function da(){Object.defineProperty(this,'id',{value:$d++});this.uuid=ka.generateUUID();this.name='';this.type='BufferGeometry';this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function Ra(e,a,B,b,d,c){aa.call(this);this.type='BoxGeometry';this.parameters={width:e,height:a,depth:B,widthSegments:b,heightSegments:d,depthSegments:c}; -this.fromBufferGeometry(new Sa(e,a,B,b,d,c));this.mergeVertices()}function Sa(e,a,B,b,d,c){function r(e,a,r,B,b,d,c,p,Q,t,m){var u=d/Q,v=c/t,w=d/2,wa=c/2,y=p/2;c=Q+1;var Ca=t+1,A=d=0,Da,x,C=new n;for(x=0;xa&&(a=f[B]);return a}function da(){Object.defineProperty(this,'id',{value:$d++});this.uuid=ka.generateUUID();this.name='';this.type='BufferGeometry';this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function Ra(f,a,B,b,d,c){aa.call(this);this.type='BoxGeometry';this.parameters={width:f,height:a,depth:B,widthSegments:b,heightSegments:d,depthSegments:c}; +this.fromBufferGeometry(new Sa(f,a,B,b,d,c));this.mergeVertices()}function Sa(f,a,B,b,d,c){function r(f,a,r,B,b,d,c,p,Q,t,m){var u=d/Q,v=c/t,w=d/2,wa=c/2,y=p/2;c=Q+1;var Ca=t+1,A=d=0,Da,x,C=new n;for(x=0;x/gm,function(e,a){e=ma[a]; -if(void 0===e)throw Error('Can not resolve #include <'+a+'>');return ae(e)})}function Ke(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,a,b,c){e='';for(a=parseInt(a);a/gm,function(f,a){f=ma[a]; +if(void 0===f)throw Error('Can not resolve #include <'+a+'>');return ae(f)})}function Ke(f){return f.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(f,a,b,c){f='';for(a=parseInt(a);aa||e.height>a){a/=Math.max(e.width,e.height);var r=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');r.width=Math.floor(e.width*a);r.height=Math.floor(e.height*a);r.getContext('2d').drawImage(e, -0,0,e.width,e.height,0,0,r.width,r.height);console.warn('THREE.WebGLRenderer: image is too big ('+e.width+'x'+e.height+'). Resized to '+r.width+'x'+r.height,e);return r}return e}function B(e){return ka.isPowerOfTwo(e.width)&&ka.isPowerOfTwo(e.height)}function k(e,a){return e.generateMipmaps&&a&&1003!==e.minFilter&&1006!==e.minFilter}function f(a){return 1003===a||1004===a||1005===a?e.NEAREST:e.LINEAR}function q(a){a=a.target;a.removeEventListener('dispose',q);a:{var r=d.get(a);if(a.image&&r.__image__webglTextureCube)e.deleteTexture(r.__image__webglTextureCube); -else{if(void 0===r.__webglInit)break a;e.deleteTexture(r.__webglTexture)}d.remove(a)}n.textures--}function l(a){a=a.target;a.removeEventListener('dispose',l);var r=d.get(a),b=d.get(a.texture);if(a){void 0!==b.__webglTexture&&e.deleteTexture(b.__webglTexture);a.depthTexture&&a.depthTexture.dispose();if(a.isWebGLRenderTargetCube)for(b=0;6>b;b++)e.deleteFramebuffer(r.__webglFramebuffer[b]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[b]);else e.deleteFramebuffer(r.__webglFramebuffer), -r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer);d.remove(a.texture);d.remove(a)}n.textures--}function g(a,f){var l=d.get(a);if(0t;t++)I[t]=f||l?l?a.image[t].image:a.image[t]:r(a.image[t],c.maxCubemapSize);var m=B(I[0]),u=h(a.format),Q=h(a.type);p(e.TEXTURE_CUBE_MAP,a,m);for(t= -0;6>t;t++)if(f)for(var v,w=I[t].mipmaps,y=0,wa=w.length;yq;q++)r.__webglFramebuffer[q]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(h){b.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture);p(e.TEXTURE_CUBE_MAP,a.texture,f);for(q=0;6>q;q++)I(r.__webglFramebuffer[q],a,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+q);k(a.texture,f)&&e.generateMipmap(e.TEXTURE_CUBE_MAP);b.bindTexture(e.TEXTURE_CUBE_MAP,null)}else b.bindTexture(e.TEXTURE_2D, -c.__webglTexture),p(e.TEXTURE_2D,a.texture,f),I(r.__webglFramebuffer,a,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),k(a.texture,f)&&e.generateMipmap(e.TEXTURE_2D),b.bindTexture(e.TEXTURE_2D,null);if(a.depthBuffer){r=d.get(a);c=!0===a.isWebGLRenderTargetCube;if(a.depthTexture){if(c)throw Error('target.depthTexture not supported in Cube render targets');if(a&&a.isWebGLRenderTargetCube)throw Error('Depth Texture with cube render targets is not supported!');e.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer); -if(!a.depthTexture||!a.depthTexture.isDepthTexture)throw Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');d.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0);g(a.depthTexture,0);r=d.get(a.depthTexture).__webglTexture;if(1026===a.depthTexture.format)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT, -e.TEXTURE_2D,r,0);else if(1027===a.depthTexture.format)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,r,0);else throw Error('Unknown depthTexture format');}else if(c)for(r.__webglDepthbuffer=[],c=0;6>c;c++)e.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[c]),r.__webglDepthbuffer[c]=e.createRenderbuffer(),t(r.__webglDepthbuffer[c],a);else e.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),t(r.__webglDepthbuffer,a);e.bindFramebuffer(e.FRAMEBUFFER, -null)}};this.updateRenderTargetMipmap=function(a){var r=a.texture,c=B(a);k(r,c)&&(a=a.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,r=d.get(r).__webglTexture,b.bindTexture(a,r),e.generateMipmap(a),b.bindTexture(a,null))}}function yf(){var e={};return{get:function(a){a=a.uuid;var r=e[a];void 0===r&&(r={},e[a]=r);return r},remove:function(a){delete e[a.uuid]},clear:function(){e={}}}}function zf(e,a,b){function r(a,r,b){var d=new Uint8Array(4),B=e.createTexture();e.bindTexture(a,B);e.texParameteri(a, -e.TEXTURE_MIN_FILTER,e.NEAREST);e.texParameteri(a,e.TEXTURE_MAG_FILTER,e.NEAREST);for(a=0;aa||f.height>a){a/=Math.max(f.width,f.height);var r=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');r.width=Math.floor(f.width*a);r.height=Math.floor(f.height*a);r.getContext('2d').drawImage(f, +0,0,f.width,f.height,0,0,r.width,r.height);console.warn('THREE.WebGLRenderer: image is too big ('+f.width+'x'+f.height+'). Resized to '+r.width+'x'+r.height,f);return r}return f}function B(f){return ka.isPowerOfTwo(f.width)&&ka.isPowerOfTwo(f.height)}function k(f,a){return f.generateMipmaps&&a&&1003!==f.minFilter&&1006!==f.minFilter}function g(a){return 1003===a||1004===a||1005===a?f.NEAREST:f.LINEAR}function q(a){a=a.target;a.removeEventListener('dispose',q);a:{var r=d.get(a);if(a.image&&r.__image__webglTextureCube)f.deleteTexture(r.__image__webglTextureCube); +else{if(void 0===r.__webglInit)break a;f.deleteTexture(r.__webglTexture)}d.remove(a)}n.textures--}function e(a){a=a.target;a.removeEventListener('dispose',e);var r=d.get(a),b=d.get(a.texture);if(a){void 0!==b.__webglTexture&&f.deleteTexture(b.__webglTexture);a.depthTexture&&a.depthTexture.dispose();if(a.isWebGLRenderTargetCube)for(b=0;6>b;b++)f.deleteFramebuffer(r.__webglFramebuffer[b]),r.__webglDepthbuffer&&f.deleteRenderbuffer(r.__webglDepthbuffer[b]);else f.deleteFramebuffer(r.__webglFramebuffer), +r.__webglDepthbuffer&&f.deleteRenderbuffer(r.__webglDepthbuffer);d.remove(a.texture);d.remove(a)}n.textures--}function l(a,g){var e=d.get(a);if(0t;t++)I[t]=g||e?e?a.image[t].image:a.image[t]:r(a.image[t],c.maxCubemapSize);var m=B(I[0]),u=h(a.format),Q=h(a.type);p(f.TEXTURE_CUBE_MAP,a,m);for(t= +0;6>t;t++)if(g)for(var v,w=I[t].mipmaps,y=0,wa=w.length;yq;q++)r.__webglFramebuffer[q]=f.createFramebuffer()}else r.__webglFramebuffer=f.createFramebuffer();if(h){b.bindTexture(f.TEXTURE_CUBE_MAP,c.__webglTexture);p(f.TEXTURE_CUBE_MAP,a.texture,g);for(q=0;6>q;q++)I(r.__webglFramebuffer[q],a,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+q);k(a.texture,g)&&f.generateMipmap(f.TEXTURE_CUBE_MAP);b.bindTexture(f.TEXTURE_CUBE_MAP,null)}else b.bindTexture(f.TEXTURE_2D, +c.__webglTexture),p(f.TEXTURE_2D,a.texture,g),I(r.__webglFramebuffer,a,f.COLOR_ATTACHMENT0,f.TEXTURE_2D),k(a.texture,g)&&f.generateMipmap(f.TEXTURE_2D),b.bindTexture(f.TEXTURE_2D,null);if(a.depthBuffer){r=d.get(a);c=!0===a.isWebGLRenderTargetCube;if(a.depthTexture){if(c)throw Error('target.depthTexture not supported in Cube render targets');if(a&&a.isWebGLRenderTargetCube)throw Error('Depth Texture with cube render targets is not supported!');f.bindFramebuffer(f.FRAMEBUFFER,r.__webglFramebuffer); +if(!a.depthTexture||!a.depthTexture.isDepthTexture)throw Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');d.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0);l(a.depthTexture,0);r=d.get(a.depthTexture).__webglTexture;if(1026===a.depthTexture.format)f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT, +f.TEXTURE_2D,r,0);else if(1027===a.depthTexture.format)f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,r,0);else throw Error('Unknown depthTexture format');}else if(c)for(r.__webglDepthbuffer=[],c=0;6>c;c++)f.bindFramebuffer(f.FRAMEBUFFER,r.__webglFramebuffer[c]),r.__webglDepthbuffer[c]=f.createRenderbuffer(),t(r.__webglDepthbuffer[c],a);else f.bindFramebuffer(f.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=f.createRenderbuffer(),t(r.__webglDepthbuffer,a);f.bindFramebuffer(f.FRAMEBUFFER, +null)}};this.updateRenderTargetMipmap=function(a){var r=a.texture,c=B(a);k(r,c)&&(a=a.isWebGLRenderTargetCube?f.TEXTURE_CUBE_MAP:f.TEXTURE_2D,r=d.get(r).__webglTexture,b.bindTexture(a,r),f.generateMipmap(a),b.bindTexture(a,null))}}function yf(){var f={};return{get:function(a){a=a.uuid;var r=f[a];void 0===r&&(r={},f[a]=r);return r},remove:function(a){delete f[a.uuid]},clear:function(){f={}}}}function zf(f,a,b){function r(a,r,b){var d=new Uint8Array(4),B=f.createTexture();f.bindTexture(a,B);f.texParameteri(a, +f.TEXTURE_MIN_FILTER,f.NEAREST);f.texParameteri(a,f.TEXTURE_MAG_FILTER,f.NEAREST);for(a=0;a=ga.maxTextures&&console.warn('THREE.WebGLRenderer: Trying to use '+e+' texture units while this GPU supports only '+ga.maxTextures);ca+=1;return e};this.setTexture2D=function(){var e=!1;return function(a,r){a&&a.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), -e=!0),a=a.texture);ma.setTexture2D(a,r)}}();this.setTexture=function(){var e=!1;return function(a,r){e||(console.warn('THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead.'),e=!0);ma.setTexture2D(a,r)}}();this.setTextureCube=function(){var e=!1;return function(a,r){a&&a.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&& -6===a.image.length?ma.setTextureCube(a,r):ma.setTextureCubeDynamic(a,r)}}();this.getRenderTarget=function(){return fa};this.setRenderTarget=function(e){(fa=e)&&void 0===ra.get(e).__webglFramebuffer&&ma.setupRenderTarget(e);var a=e&&e.isWebGLRenderTargetCube,r;e?(r=ra.get(e),r=a?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,pa.copy(e.scissor),Y=e.scissorTest,Fa.copy(e.viewport)):(r=null,pa.copy(fb).multiplyScalar(Ja),Y=ab,Fa.copy(Ia).multiplyScalar(Ja));N!==r&&(K.bindFramebuffer(K.FRAMEBUFFER, -r),N=r);ia.scissor(pa);ia.setScissorTest(Y);ia.viewport(Fa);a&&(a=ra.get(e.texture),K.framebufferTexture2D(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,a.__webglTexture,e.activeMipMapLevel))};this.readRenderTargetPixels=function(e,a,r,b,d,B){if(e&&e.isWebGLRenderTarget){var c=ra.get(e).__webglFramebuffer;if(c){var h=!1;c!==N&&(K.bindFramebuffer(K.FRAMEBUFFER,c),h=!0);try{var n=e.texture,k=n.format,f=n.type;1023!==k&&x(k)!==K.getParameter(K.IMPLEMENTATION_COLOR_READ_FORMAT)? -console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.'):1009===f||x(f)===K.getParameter(K.IMPLEMENTATION_COLOR_READ_TYPE)||1015===f&&(aa.get('OES_texture_float')||aa.get('WEBGL_color_buffer_float'))||1016===f&&aa.get('EXT_color_buffer_half_float')?K.checkFramebufferStatus(K.FRAMEBUFFER)===K.FRAMEBUFFER_COMPLETE?0<=a&&a<=e.width-b&&0<=r&&r<=e.height-d&&K.readPixels(a,r,b,d,x(k),x(f),B):console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.'): -console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.')}finally{h&&K.bindFramebuffer(K.FRAMEBUFFER,N)}}}else console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.')}}function Zb(e,a){this.name='';this.color=new Y(e);this.density=void 0!==a?a:2.5E-4}function $b(e,a,b){this.name='';this.color=new Y(e);this.near=void 0!==a?a:1;this.far=void 0!==b?b:1E3}function vd(){ba.call(this); -this.type='Scene';this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function de(e,a,b,d,c){ba.call(this);this.lensFlares=[];this.positionScreen=new n;this.customUpdateCallback=void 0;void 0!==e&&this.add(e,a,b,d,c)}function Ab(e){ha.call(this);this.type='SpriteMaterial';this.color=new Y(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(e)}function Jc(e){ba.call(this);this.type='Sprite';this.material=void 0!==e?e:new Ab}function Kc(){ba.call(this); -this.type='LOD';Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Lc(e,a){e=e||[];this.bones=e.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===a)this.calculateInverses();else if(this.bones.length===a.length)this.boneInverses=a.slice(0);else for(console.warn('THREE.Skeleton boneInverses is the wrong length.'),this.boneInverses=[],e=0,a=this.bones.length;e=e.HAVE_CURRENT_DATA&&(B.needsUpdate=!0)}b.call(this,e,a,d,c,h,n,k,f,q);this.generateMipmaps=!1;var B=this;r()}function bc(e,a,d,c,h,n,k,f,q,g,l,p){b.call(this,null,n,k,f,q,g,c,h,l,p);this.image={width:a,height:d};this.mipmaps=e;this.generateMipmaps=this.flipY=!1}function Nc(e,a,d,c,h,n,k,f,q,g){g=void 0!== -g?g:1026;if(1026!==g&&1027!==g)throw Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');void 0===d&&1026===g&&(d=1012);void 0===d&&1027===g&&(d=1020);b.call(this,null,c,h,n,k,f,g,d,q);this.image={width:e,height:a};this.magFilter=void 0!==k?k:1003;this.minFilter=void 0!==f?f:1003;this.generateMipmaps=this.flipY=!1}function cc(e){da.call(this);this.type='WireframeGeometry';var a=[],b,d,c,h,k=[0,0],f={},q,g,l=['a','b','c'];if(e&&e.isGeometry){var p=e.faces;b=0; -for(c=p.length;bd;d++)q=t[l[d]],g=t[l[(d+1)%3]],k[0]=Math.min(q,g),k[1]=Math.max(q,g),q=k[0]+','+k[1],void 0===f[q]&&(f[q]={index1:k[0],index2:k[1]})}for(q in f)b=f[q],l=e.vertices[b.index1],a.push(l.x,l.y,l.z),l=e.vertices[b.index2],a.push(l.x,l.y,l.z)}else if(e&&e.isBufferGeometry){var m,l=new n;if(null!==e.index){p=e.attributes.position;t=e.index;m=e.groups;0===m.length&&(m=[{start:0,count:t.count,materialIndex:0}]);e=0;for(h=m.length;ed;d++)q=t.getX(b+d),g=t.getX(b+(d+1)%3),k[0]=Math.min(q,g),k[1]=Math.max(q,g),q=k[0]+','+k[1],void 0===f[q]&&(f[q]={index1:k[0],index2:k[1]});for(q in f)b=f[q],l.fromBufferAttribute(p,b.index1),a.push(l.x,l.y,l.z),l.fromBufferAttribute(p,b.index2),a.push(l.x,l.y,l.z)}else for(p=e.attributes.position,b=0,c=p.count/3;bd;d++)f=3*b+d,l.fromBufferAttribute(p,f),a.push(l.x,l.y,l.z),f=3*b+(d+1)%3,l.fromBufferAttribute(p,f),a.push(l.x,l.y,l.z)}this.addAttribute('position', -new W(a,3))}function Oc(e,a,b){aa.call(this);this.type='ParametricGeometry';this.parameters={func:e,slices:a,stacks:b};this.fromBufferGeometry(new dc(e,a,b));this.mergeVertices()}function dc(e,a,b){da.call(this);this.type='ParametricBufferGeometry';this.parameters={func:e,slices:a,stacks:b};var r=[],d=[],c=[],B=[],h=new n,k=new n,f=new n,q=new n,l=new n,g,p,t=a+1;for(g=0;g<=b;g++){var m=g/b;for(p=0;p<=a;p++){var u=p/a,k=e(u,m,k);d.push(k.x,k.y,k.z);0<=u-1E-5?(f=e(u-1E-5,m,f),q.subVectors(k,f)):(f= -e(u+1E-5,m,f),q.subVectors(f,k));0<=m-1E-5?(f=e(u,m-1E-5,f),l.subVectors(k,f)):(f=e(u,m+1E-5,f),l.subVectors(f,k));h.crossVectors(q,l).normalize();c.push(h.x,h.y,h.z);B.push(u,m)}}for(g=0;gb&&1===e.x&&(k[a]=e.x-1);0===r.x&&0===r.z&&(k[a]=b/2/Math.PI+.5)}da.call(this);this.type='PolyhedronBufferGeometry';this.parameters={vertices:e,indices:a,radius:b,detail:d};b=b||1;d=d||0;var h=[],k=[];(function(e){for(var b=new n,d=new n,B=new n,h=0;hd&&(.2>a&&(k[e+0]+=1),.2>r&&(k[e+2]+=1),.2>b&&(k[e+4]+=1))})();this.addAttribute('position',new W(h,3));this.addAttribute('normal',new W(h.slice(),3));this.addAttribute('uv',new W(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Qc(e,a){aa.call(this);this.type='TetrahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new ec(e, -a));this.mergeVertices()}function ec(e,a){Ua.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,a);this.type='TetrahedronBufferGeometry';this.parameters={radius:e,detail:a}}function Rc(e,a){aa.call(this);this.type='OctahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new Eb(e,a));this.mergeVertices()}function Eb(e,a){Ua.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,a);this.type='OctahedronBufferGeometry'; -this.parameters={radius:e,detail:a}}function Sc(e,a){aa.call(this);this.type='IcosahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new fc(e,a));this.mergeVertices()}function fc(e,a){var r=(1+Math.sqrt(5))/2;Ua.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,a);this.type='IcosahedronBufferGeometry'; -this.parameters={radius:e,detail:a}}function Tc(e,a){aa.call(this);this.type='DodecahedronGeometry';this.parameters={radius:e,detail:a};this.fromBufferGeometry(new gc(e,a));this.mergeVertices()}function gc(e,a){var r=(1+Math.sqrt(5))/2,b=1/r;Ua.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-b,-r,0,-b,r,0,b,-r,0,b,r,-b,-r,0,-b,r,0,b,-r,0,b,r,0,-r,0,-b,r,0,-b,-r,0,b,r,0,b],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1, -18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,a);this.type='DodecahedronBufferGeometry';this.parameters={radius:e,detail:a}}function Uc(e,a,b,d,c,h){aa.call(this);this.type='TubeGeometry';this.parameters={path:e,tubularSegments:a,radius:b,radialSegments:d,closed:c};void 0!==h&&console.warn('THREE.TubeGeometry: taper has been removed.');e=new hc(e,a,b,d,c);this.tangents=e.tangents; -this.normals=e.normals;this.binormals=e.binormals;this.fromBufferGeometry(e);this.mergeVertices()}function hc(e,a,b,d,c){function r(r){var c=e.getPointAt(r/a),n=B.normals[r];r=B.binormals[r];for(g=0;g<=d;g++){var f=g/d*Math.PI*2,q=Math.sin(f),f=-Math.cos(f);k.x=f*n.x+q*r.x;k.y=f*n.y+q*r.y;k.z=f*n.z+q*r.z;k.normalize();p.push(k.x,k.y,k.z);h.x=c.x+b*k.x;h.y=c.y+b*k.y;h.z=c.z+b*k.z;l.push(h.x,h.y,h.z)}}da.call(this);this.type='TubeBufferGeometry';this.parameters={path:e,tubularSegments:a,radius:b,radialSegments:d, -closed:c};a=a||64;b=b||1;d=d||8;c=c||!1;var B=e.computeFrenetFrames(a,c);this.tangents=B.tangents;this.normals=B.normals;this.binormals=B.binormals;var h=new n,k=new n,f=new m,q,g,l=[],p=[],I=[],t=[];for(q=0;qg;g++)c=l[h[g]],e=l[h[(g+1)%3]],b[0]=Math.min(c,e), -b[1]=Math.max(c,e),c=b[0]+','+b[1],void 0===d[c]?d[c]={index1:b[0],index2:b[1],face1:f,face2:void 0}:d[c].face2=f;for(c in d)if(b=d[c],void 0===b.face2||k[b.face1].normal.dot(k[b.face2].normal)<=a)h=n[b.index1],r.push(h.x,h.y,h.z),h=n[b.index2],r.push(h.x,h.y,h.z);this.addAttribute('position',new W(r,3))}function Gb(e,a,b,d,c,h,k,n){aa.call(this);this.type='CylinderGeometry';this.parameters={radiusTop:e,radiusBottom:a,height:b,radialSegments:d,heightSegments:c,openEnded:h,thetaStart:k,thetaLength:n}; -this.fromBufferGeometry(new vb(e,a,b,d,c,h,k,n));this.mergeVertices()}function vb(e,a,b,d,c,h,k,f){function r(r){var b,c,h,I=new m,w=new n,Q=0,y=!0===r?e:a,A=!0===r?1:-1;c=t;for(b=1;b<=d;b++)l.push(0,u*A,0),g.push(0,A,0),p.push(.5,.5),t++;h=t;for(b=0;b<=d;b++){var wa=b/d*f+k,x=Math.cos(wa),wa=Math.sin(wa);w.x=y*wa;w.y=u*A;w.z=y*x;l.push(w.x,w.y,w.z);g.push(0,A,0);I.x=.5*x+.5;I.y=.5*wa*A+.5;p.push(I.x,I.y);t++}for(b=0;b=ga.maxTextures&&console.warn('THREE.WebGLRenderer: Trying to use '+f+' texture units while this GPU supports only '+ga.maxTextures);ca+=1;return f};this.setTexture2D=function(){var f=!1;return function(a,r){a&&a.isWebGLRenderTarget&&(f||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), +f=!0),a=a.texture);ma.setTexture2D(a,r)}}();this.setTexture=function(){var f=!1;return function(a,r){f||(console.warn('THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead.'),f=!0);ma.setTexture2D(a,r)}}();this.setTextureCube=function(){var f=!1;return function(a,r){a&&a.isWebGLRenderTargetCube&&(f||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),f=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&& +6===a.image.length?ma.setTextureCube(a,r):ma.setTextureCubeDynamic(a,r)}}();this.getRenderTarget=function(){return fa};this.setRenderTarget=function(f){(fa=f)&&void 0===ra.get(f).__webglFramebuffer&&ma.setupRenderTarget(f);var a=f&&f.isWebGLRenderTargetCube,r;f?(r=ra.get(f),r=a?r.__webglFramebuffer[f.activeCubeFace]:r.__webglFramebuffer,pa.copy(f.scissor),Y=f.scissorTest,Fa.copy(f.viewport)):(r=null,pa.copy(fb).multiplyScalar(Ja),Y=ab,Fa.copy(Ia).multiplyScalar(Ja));N!==r&&(K.bindFramebuffer(K.FRAMEBUFFER, +r),N=r);ia.scissor(pa);ia.setScissorTest(Y);ia.viewport(Fa);a&&(a=ra.get(f.texture),K.framebufferTexture2D(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_CUBE_MAP_POSITIVE_X+f.activeCubeFace,a.__webglTexture,f.activeMipMapLevel))};this.readRenderTargetPixels=function(f,a,r,b,d,B){if(f&&f.isWebGLRenderTarget){var c=ra.get(f).__webglFramebuffer;if(c){var h=!1;c!==N&&(K.bindFramebuffer(K.FRAMEBUFFER,c),h=!0);try{var n=f.texture,k=n.format,g=n.type;1023!==k&&x(k)!==K.getParameter(K.IMPLEMENTATION_COLOR_READ_FORMAT)? +console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.'):1009===g||x(g)===K.getParameter(K.IMPLEMENTATION_COLOR_READ_TYPE)||1015===g&&(aa.get('OES_texture_float')||aa.get('WEBGL_color_buffer_float'))||1016===g&&aa.get('EXT_color_buffer_half_float')?K.checkFramebufferStatus(K.FRAMEBUFFER)===K.FRAMEBUFFER_COMPLETE?0<=a&&a<=f.width-b&&0<=r&&r<=f.height-d&&K.readPixels(a,r,b,d,x(k),x(g),B):console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.'): +console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.')}finally{h&&K.bindFramebuffer(K.FRAMEBUFFER,N)}}}else console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.')}}function Zb(f,a){this.name='';this.color=new Y(f);this.density=void 0!==a?a:2.5E-4}function $b(f,a,b){this.name='';this.color=new Y(f);this.near=void 0!==a?a:1;this.far=void 0!==b?b:1E3}function vd(){ba.call(this); +this.type='Scene';this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function de(f,a,b,d,c){ba.call(this);this.lensFlares=[];this.positionScreen=new n;this.customUpdateCallback=void 0;void 0!==f&&this.add(f,a,b,d,c)}function Ab(f){ha.call(this);this.type='SpriteMaterial';this.color=new Y(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(f)}function Jc(f){ba.call(this);this.type='Sprite';this.material=void 0!==f?f:new Ab}function Kc(){ba.call(this); +this.type='LOD';Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Lc(f,a){f=f||[];this.bones=f.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===a)this.calculateInverses();else if(this.bones.length===a.length)this.boneInverses=a.slice(0);else for(console.warn('THREE.Skeleton boneInverses is the wrong length.'),this.boneInverses=[],f=0,a=this.bones.length;f=f.HAVE_CURRENT_DATA&&(B.needsUpdate=!0)}b.call(this,f,a,d,c,h,n,k,g,q);this.generateMipmaps=!1;var B=this;r()}function bc(f,a,d,c,h,n,k,g,q,l,e,p){b.call(this,null,n,k,g,q,l,c,h,e,p);this.image={width:a,height:d};this.mipmaps=f;this.generateMipmaps=this.flipY=!1}function Nc(f,a,d,c,h,n,k,g,q,l){l=void 0!== +l?l:1026;if(1026!==l&&1027!==l)throw Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');void 0===d&&1026===l&&(d=1012);void 0===d&&1027===l&&(d=1020);b.call(this,null,c,h,n,k,g,l,d,q);this.image={width:f,height:a};this.magFilter=void 0!==k?k:1003;this.minFilter=void 0!==g?g:1003;this.generateMipmaps=this.flipY=!1}function cc(f){da.call(this);this.type='WireframeGeometry';var a=[],b,d,c,h,k=[0,0],g={},q,l,e=['a','b','c'];if(f&&f.isGeometry){var p=f.faces;b=0; +for(c=p.length;bd;d++)q=t[e[d]],l=t[e[(d+1)%3]],k[0]=Math.min(q,l),k[1]=Math.max(q,l),q=k[0]+','+k[1],void 0===g[q]&&(g[q]={index1:k[0],index2:k[1]})}for(q in g)b=g[q],e=f.vertices[b.index1],a.push(e.x,e.y,e.z),e=f.vertices[b.index2],a.push(e.x,e.y,e.z)}else if(f&&f.isBufferGeometry){var m,e=new n;if(null!==f.index){p=f.attributes.position;t=f.index;m=f.groups;0===m.length&&(m=[{start:0,count:t.count,materialIndex:0}]);f=0;for(h=m.length;fd;d++)q=t.getX(b+d),l=t.getX(b+(d+1)%3),k[0]=Math.min(q,l),k[1]=Math.max(q,l),q=k[0]+','+k[1],void 0===g[q]&&(g[q]={index1:k[0],index2:k[1]});for(q in g)b=g[q],e.fromBufferAttribute(p,b.index1),a.push(e.x,e.y,e.z),e.fromBufferAttribute(p,b.index2),a.push(e.x,e.y,e.z)}else for(p=f.attributes.position,b=0,c=p.count/3;bd;d++)g=3*b+d,e.fromBufferAttribute(p,g),a.push(e.x,e.y,e.z),g=3*b+(d+1)%3,e.fromBufferAttribute(p,g),a.push(e.x,e.y,e.z)}this.addAttribute('position', +new W(a,3))}function Oc(f,a,b){aa.call(this);this.type='ParametricGeometry';this.parameters={func:f,slices:a,stacks:b};this.fromBufferGeometry(new dc(f,a,b));this.mergeVertices()}function dc(f,a,b){da.call(this);this.type='ParametricBufferGeometry';this.parameters={func:f,slices:a,stacks:b};var r=[],d=[],c=[],B=[],h=new n,k=new n,g=new n,q=new n,l=new n,e,p,t=a+1;for(e=0;e<=b;e++){var m=e/b;for(p=0;p<=a;p++){var u=p/a,k=f(u,m,k);d.push(k.x,k.y,k.z);0<=u-1E-5?(g=f(u-1E-5,m,g),q.subVectors(k,g)):(g= +f(u+1E-5,m,g),q.subVectors(g,k));0<=m-1E-5?(g=f(u,m-1E-5,g),l.subVectors(k,g)):(g=f(u,m+1E-5,g),l.subVectors(g,k));h.crossVectors(q,l).normalize();c.push(h.x,h.y,h.z);B.push(u,m)}}for(e=0;eb&&1===f.x&&(k[a]=f.x-1);0===r.x&&0===r.z&&(k[a]=b/2/Math.PI+.5)}da.call(this);this.type='PolyhedronBufferGeometry';this.parameters={vertices:f,indices:a,radius:b,detail:d};b=b||1;d=d||0;var h=[],k=[];(function(f){for(var b=new n,d=new n,B=new n,h=0;hd&&(.2>a&&(k[f+0]+=1),.2>r&&(k[f+2]+=1),.2>b&&(k[f+4]+=1))})();this.addAttribute('position',new W(h,3));this.addAttribute('normal',new W(h.slice(),3));this.addAttribute('uv',new W(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Qc(f,a){aa.call(this);this.type='TetrahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new ec(f, +a));this.mergeVertices()}function ec(f,a){Ua.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],f,a);this.type='TetrahedronBufferGeometry';this.parameters={radius:f,detail:a}}function Rc(f,a){aa.call(this);this.type='OctahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new Eb(f,a));this.mergeVertices()}function Eb(f,a){Ua.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],f,a);this.type='OctahedronBufferGeometry'; +this.parameters={radius:f,detail:a}}function Sc(f,a){aa.call(this);this.type='IcosahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new fc(f,a));this.mergeVertices()}function fc(f,a){var r=(1+Math.sqrt(5))/2;Ua.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],f,a);this.type='IcosahedronBufferGeometry'; +this.parameters={radius:f,detail:a}}function Tc(f,a){aa.call(this);this.type='DodecahedronGeometry';this.parameters={radius:f,detail:a};this.fromBufferGeometry(new gc(f,a));this.mergeVertices()}function gc(f,a){var r=(1+Math.sqrt(5))/2,b=1/r;Ua.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-b,-r,0,-b,r,0,b,-r,0,b,r,-b,-r,0,-b,r,0,b,-r,0,b,r,0,-r,0,-b,r,0,-b,-r,0,b,r,0,b],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1, +18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],f,a);this.type='DodecahedronBufferGeometry';this.parameters={radius:f,detail:a}}function Uc(f,a,b,d,c,h){aa.call(this);this.type='TubeGeometry';this.parameters={path:f,tubularSegments:a,radius:b,radialSegments:d,closed:c};void 0!==h&&console.warn('THREE.TubeGeometry: taper has been removed.');f=new hc(f,a,b,d,c);this.tangents=f.tangents; +this.normals=f.normals;this.binormals=f.binormals;this.fromBufferGeometry(f);this.mergeVertices()}function hc(f,a,b,d,c){function r(r){var c=f.getPointAt(r/a),n=B.normals[r];r=B.binormals[r];for(e=0;e<=d;e++){var g=e/d*Math.PI*2,q=Math.sin(g),g=-Math.cos(g);k.x=g*n.x+q*r.x;k.y=g*n.y+q*r.y;k.z=g*n.z+q*r.z;k.normalize();p.push(k.x,k.y,k.z);h.x=c.x+b*k.x;h.y=c.y+b*k.y;h.z=c.z+b*k.z;l.push(h.x,h.y,h.z)}}da.call(this);this.type='TubeBufferGeometry';this.parameters={path:f,tubularSegments:a,radius:b,radialSegments:d, +closed:c};a=a||64;b=b||1;d=d||8;c=c||!1;var B=f.computeFrenetFrames(a,c);this.tangents=B.tangents;this.normals=B.normals;this.binormals=B.binormals;var h=new n,k=new n,g=new m,q,e,l=[],p=[],I=[],t=[];for(q=0;ql;l++)c=e[h[l]],f=e[h[(l+1)%3]],b[0]=Math.min(c,f), +b[1]=Math.max(c,f),c=b[0]+','+b[1],void 0===d[c]?d[c]={index1:b[0],index2:b[1],face1:g,face2:void 0}:d[c].face2=g;for(c in d)if(b=d[c],void 0===b.face2||k[b.face1].normal.dot(k[b.face2].normal)<=a)h=n[b.index1],r.push(h.x,h.y,h.z),h=n[b.index2],r.push(h.x,h.y,h.z);this.addAttribute('position',new W(r,3))}function Gb(f,a,b,d,c,h,k,n){aa.call(this);this.type='CylinderGeometry';this.parameters={radiusTop:f,radiusBottom:a,height:b,radialSegments:d,heightSegments:c,openEnded:h,thetaStart:k,thetaLength:n}; +this.fromBufferGeometry(new vb(f,a,b,d,c,h,k,n));this.mergeVertices()}function vb(f,a,b,d,c,h,k,g){function r(r){var b,c,h,I=new m,w=new n,Q=0,y=!0===r?f:a,A=!0===r?1:-1;c=t;for(b=1;b<=d;b++)e.push(0,u*A,0),l.push(0,A,0),p.push(.5,.5),t++;h=t;for(b=0;b<=d;b++){var wa=b/d*g+k,x=Math.cos(wa),wa=Math.sin(wa);w.x=y*wa;w.y=u*A;w.z=y*x;e.push(w.x,w.y,w.z);l.push(0,A,0);I.x=.5*x+.5;I.y=.5*wa*A+.5;p.push(I.x,I.y);t++}for(b=0;bthis.duration&&this.resetDuration();this.optimize()}function Pd(e){this.manager=void 0!==e?e:Wa;this.textures={}}function he(e){this.manager=void 0!==e?e:Wa}function vc(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}function ie(e){'boolean'=== -typeof e&&(console.warn('THREE.JSONLoader: showStatus parameter has been removed from constructor.'),e=void 0);this.manager=void 0!==e?e:Wa;this.withCredentials=!1}function Me(e){this.manager=void 0!==e?e:Wa;this.texturePath=''}function Ne(e,a,b,d,c){a=.5*(d-a);c=.5*(c-b);var r=e*e;return(2*b-2*d+a+c)*e*r+(-3*b+3*d-2*a-c)*r+a*e+b}function Pb(e,a,b,d){var r=1-e;return r*r*a+2*(1-e)*e*b+e*e*d}function Qb(e,a,b,d,c){var r=1-e,h=1-e;return r*r*r*a+3*h*h*e*b+3*(1-e)*e*e*d+e*e*e*c}function Pa(){this.arcLengthDivisions= -200}function ub(e,a){this.arcLengthDivisions=200;this.v1=e;this.v2=a}function gd(){this.arcLengthDivisions=200;this.curves=[];this.autoClose=!1}function wb(e,a,b,d,c,h,k,n){this.arcLengthDivisions=200;this.aX=e;this.aY=a;this.xRadius=b;this.yRadius=d;this.aStartAngle=c;this.aEndAngle=h;this.aClockwise=k;this.aRotation=n||0}function Rb(e){this.arcLengthDivisions=200;this.points=void 0===e?[]:e}function wc(e,a,b,d){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b;this.v3=d}function xc(e,a, -b){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b}function hd(e){gd.call(this);this.currentPoint=new m;e&&this.fromPoints(e)}function Sb(){hd.apply(this,arguments);this.holes=[]}function je(){this.subPaths=[];this.currentPath=null}function ke(e){this.data=e}function Oe(e){this.manager=void 0!==e?e:Wa}function le(e){this.manager=void 0!==e?e:Wa}function Pe(){this.type='StereoCamera';this.aspect=1;this.eyeSep=.064;this.cameraL=new xa;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate= -!1;this.cameraR=new xa;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function Qd(e,a,b){ba.call(this);this.type='CubeCamera';var r=new xa(90,1,e,a);r.up.set(0,-1,0);r.lookAt(new n(1,0,0));this.add(r);var d=new xa(90,1,e,a);d.up.set(0,-1,0);d.lookAt(new n(-1,0,0));this.add(d);var h=new xa(90,1,e,a);h.up.set(0,0,1);h.lookAt(new n(0,1,0));this.add(h);var k=new xa(90,1,e,a);k.up.set(0,0,-1);k.lookAt(new n(0,-1,0));this.add(k);var B=new xa(90,1,e,a);B.up.set(0,-1,0);B.lookAt(new n(0,0, -1));this.add(B);var f=new xa(90,1,e,a);f.up.set(0,-1,0);f.lookAt(new n(0,0,-1));this.add(f);this.renderTarget=new c(b,b,{format:1022,magFilter:1006,minFilter:1006});this.renderTarget.texture.name='CubeCamera';this.updateCubeMap=function(e,a){null===this.parent&&this.updateMatrixWorld();var b=this.renderTarget,c=b.texture.generateMipmaps;b.texture.generateMipmaps=!1;b.activeCubeFace=0;e.render(a,r,b);b.activeCubeFace=1;e.render(a,d,b);b.activeCubeFace=2;e.render(a,h,b);b.activeCubeFace=3;e.render(a, -k,b);b.activeCubeFace=4;e.render(a,B,b);b.texture.generateMipmaps=c;b.activeCubeFace=5;e.render(a,f,b);e.setRenderTarget(null)}}function me(){ba.call(this);this.type='AudioListener';this.context=ne.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function yc(e){ba.call(this);this.type='Audio';this.context=e.context;this.gain=this.context.createGain();this.gain.connect(e.getInput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.startTime= -0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType='empty';this.filters=[]}function oe(e){yc.call(this,e);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function pe(e,a){this.analyser=e.context.createAnalyser();this.analyser.fftSize=void 0!==a?a:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);e.getOutput().connect(this.analyser)}function qe(e,a,b){this.binding=e;this.valueSize=b;e=Float64Array;switch(a){case 'quaternion':a=this._slerp; -break;case 'string':case 'bool':e=Array;a=this._select;break;default:a=this._lerp}this.buffer=new e(4*b);this._mixBufferRegion=a;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Qe(e,a,b){b=b||La.parseTrackName(a);this._targetGroup=e;this._bindings=e.subscribe_(a,b)}function La(e,a,b){this.path=a;this.parsedPath=b||La.parseTrackName(a);this.node=La.findNode(e,this.parsedPath.nodeName)||e;this.rootNode=e}function Re(e){this.uuid=ka.generateUUID();this._objects=Array.prototype.slice.call(arguments); -this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,d=arguments.length;b!==d;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var c=this;this.stats={objects:{get total(){return c._objects.length},get inUse(){return this.total-c.nCachedObjects_}},get bindingsPerObject(){return c._bindings.length}}}function Se(e,a,b){this._mixer=e;this._clip=a;this._localRoot=b||null;e=a.tracks;a=e.length;b=Array(a);for(var r={endingStart:2400, -endingEnd:2400},d=0;d!==a;++d){var c=e[d].createInterpolant(null);b[d]=c;c.settings=r}this._interpolantSettings=r;this._interpolants=b;this._propertyBindings=Array(a);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd= -this.zeroSlopeAtStart=!0}function Te(e){this._root=e;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Rd(e,a){'string'===typeof e&&(console.warn('THREE.Uniform: Type parameter is no longer needed.'),e=a);this.value=e}function re(){da.call(this);this.type='InstancedBufferGeometry';this.maxInstancedCount=void 0}function se(e,a,b,d){this.uuid=ka.generateUUID();this.data=e;this.itemSize=a;this.offset=b;this.normalized=!0===d}function zc(e,a){this.uuid=ka.generateUUID(); -this.array=e;this.stride=a;this.count=void 0!==e?e.length/a:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};this.version=0}function te(e,a,b){zc.call(this,e,a);this.meshPerAttribute=b||1}function ue(e,a,b){ga.call(this,e,a);this.meshPerAttribute=b||1}function Ue(e,a,b,d){this.ray=new eb(e,a);this.near=b||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'); -return this.Points}}})}function Ve(e,a){return e.distance-a.distance}function ve(e,a,b,d){if(!1!==e.visible&&(e.raycast(a,b),!0===d)){e=e.children;d=0;for(var r=e.length;dr;r++,b++){var d=r/32*Math.PI*2,c=b/32*Math.PI*2;a.push(Math.cos(d),Math.sin(d),1,Math.cos(c),Math.sin(c),1)}e.addAttribute('position', -new W(a,3));a=new va({fog:!1});this.cone=new sa(e,a);this.add(this.cone);this.update()}function Ze(e){var a=[];e&&e.isBone&&a.push(e);for(var b=0;be.length&&console.warn('THREE.CatmullRomCurve3: Points array needs at least two entries.');this.points=e||[];this.closed=!1}function pd(e,a,b,d){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b;this.v3=d}function qd(e,a,b){this.arcLengthDivisions=200;this.v0=e;this.v1=a;this.v2=b}function rd(e,a){this.arcLengthDivisions=200;this.v1=e;this.v2=a}function Vd(e,a,b,d,c,h){wb.call(this,e,a, -b,b,d,c,h)}function $e(e){console.warn('THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,e);this.type='catmullrom';this.closed=!0}function af(e){console.warn('THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,e);this.type='catmullrom'}function ye(e){console.warn('THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.');lb.call(this,e);this.type='catmullrom'}void 0===Number.EPSILON&&(Number.EPSILON= -Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(e){return'number'===typeof e&&isFinite(e)&&Math.floor(e)===e});void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:0r;r++)8===r|| -13===r||18===r||23===r?a[r]='-':14===r?a[r]='4':(2>=b&&(b=33554432+16777216*Math.random()|0),d=b&15,b>>=4,a[r]=e[19===r?d&3|8:d]);return a.join('')}}(),clamp:function(e,a,b){return Math.max(a,Math.min(b,e))},euclideanModulo:function(e,a){return(e%a+a)%a},mapLinear:function(e,a,b,d,c){return d+(e-a)*(c-d)/(b-a)},lerp:function(e,a,b){return(1-b)*e+b*a},smoothstep:function(e,a,b){if(e<=a)return 0;if(e>=b)return 1;e=(e-a)/(b-a);return e*e*(3-2*e)},smootherstep:function(e,a,b){if(e<=a)return 0;if(e>=b)return 1; -e=(e-a)/(b-a);return e*e*e*(e*(6*e-15)+10)},randInt:function(e,a){return e+Math.floor(Math.random()*(a-e+1))},randFloat:function(e,a){return e+Math.random()*(a-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*ka.DEG2RAD},radToDeg:function(e){return e*ka.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){e--;e|=e>>1;e|=e>>2;e|=e>>4;e|=e>> -8;e|=e>>16;e++;return e}};Object.defineProperties(m.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}});Object.assign(m.prototype,{isVector2:!0,set:function(e,a){this.x=e;this.y=a;return this},setScalar:function(e){this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setComponent:function(e,a){switch(e){case 0:this.x=a;break;case 1:this.y=a;break;default:throw Error('index is out of range: '+ -e);}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){this.x=e.x;this.y=e.y;return this},add:function(e,a){if(void 0!==a)return console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,a);this.x+=e.x;this.y+=e.y;return this},addScalar:function(e){this.x+=e;this.y+=e;return this}, -addVectors:function(e,a){this.x=e.x+a.x;this.y=e.y+a.y;return this},addScaledVector:function(e,a){this.x+=e.x*a;this.y+=e.y*a;return this},sub:function(e,a){if(void 0!==a)return console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,a);this.x-=e.x;this.y-=e.y;return this},subScalar:function(e){this.x-=e;this.y-=e;return this},subVectors:function(e,a){this.x=e.x-a.x;this.y=e.y-a.y;return this},multiply:function(e){this.x*=e.x;this.y*= -e.y;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;return this},divide:function(e){this.x/=e.x;this.y/=e.y;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);return this},max:function(e){this.x=Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);return this},clamp:function(e,a){this.x=Math.max(e.x,Math.min(a.x,this.x));this.y=Math.max(e.y,Math.min(a.y,this.y));return this},clampScalar:function(){var e= -new m,a=new m;return function(r,b){e.set(r,r);a.set(b,b);return this.clamp(e,a)}}(),clampLength:function(e,a){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(a,r)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x): -Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);0>e&& -(e+=2*Math.PI);return e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var a=this.x-e.x;e=this.y-e.y;return a*a+e*e},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,a){this.x+=(e.x-this.x)*a;this.y+=(e.y-this.y)*a;return this},lerpVectors:function(e,a,b){return this.subVectors(a,e).multiplyScalar(b).add(e)},equals:function(e){return e.x=== -this.x&&e.y===this.y},fromArray:function(e,a){void 0===a&&(a=0);this.x=e[a];this.y=e[a+1];return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this.x;e[a+1]=this.y;return e},fromBufferAttribute:function(e,a,b){void 0!==b&&console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');this.x=e.getX(a);this.y=e.getY(a);return this},rotateAround:function(e,a){var r=Math.cos(a);a=Math.sin(a);var b=this.x-e.x,d=this.y-e.y;this.x=b*r-d*a+e.x;this.y=b*a+d*r+e.y; -return this}});var ef=0;b.DEFAULT_IMAGE=void 0;b.DEFAULT_MAPPING=300;Object.defineProperty(b.prototype,'needsUpdate',{set:function(e){!0===e&&this.version++}});Object.assign(b.prototype,g.prototype,{constructor:b,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name;this.image=e.image;this.mipmaps=e.mipmaps.slice(0);this.mapping=e.mapping;this.wrapS=e.wrapS;this.wrapT=e.wrapT;this.magFilter=e.magFilter;this.minFilter=e.minFilter;this.anisotropy=e.anisotropy; -this.format=e.format;this.type=e.type;this.offset.copy(e.offset);this.repeat.copy(e.repeat);this.generateMipmaps=e.generateMipmaps;this.premultiplyAlpha=e.premultiplyAlpha;this.flipY=e.flipY;this.unpackAlignment=e.unpackAlignment;this.encoding=e.encoding;return this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var a={metadata:{version:4.5,type:'Texture',generator:'Texture.toJSON'},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y], -offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var b=this.image;void 0===b.uuid&&(b.uuid=ka.generateUUID());if(void 0===e.images[b.uuid]){var d=e.images,c=b.uuid,h=b.uuid,k;void 0!==b.toDataURL?k=b:(k=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'),k.width=b.width,k.height=b.height,k.getContext('2d').drawImage(b,0,0,b.width,b.height));k=2048e.x||1e.x?0:1;break;case 1002:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(0>e.y||1e.y?0:1;break;case 1002:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}});Object.assign(l.prototype,{isVector4:!0,set:function(e,a,b,d){this.x=e;this.y=a;this.z=b;this.w=d;return this},setScalar:function(e){this.w=this.z=this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setW:function(e){this.w=e;return this},setComponent:function(e, -a){switch(e){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;case 3:this.w=a;break;default:throw Error('index is out of range: '+e);}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;this.w=void 0!==e.w?e.w:1;return this},add:function(e, -a){if(void 0!==a)return console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,a);this.x+=e.x;this.y+=e.y;this.z+=e.z;this.w+=e.w;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;this.w+=e;return this},addVectors:function(e,a){this.x=e.x+a.x;this.y=e.y+a.y;this.z=e.z+a.z;this.w=e.w+a.w;return this},addScaledVector:function(e,a){this.x+=e.x*a;this.y+=e.y*a;this.z+=e.z*a;this.w+=e.w*a;return this},sub:function(e,a){if(void 0!== -a)return console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,a);this.x-=e.x;this.y-=e.y;this.z-=e.z;this.w-=e.w;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;this.w-=e;return this},subVectors:function(e,a){this.x=e.x-a.x;this.y=e.y-a.y;this.z=e.z-a.z;this.w=e.w-a.w;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;this.w*=e;return this},applyMatrix4:function(e){var a=this.x,b=this.y,d=this.z, -c=this.w;e=e.elements;this.x=e[0]*a+e[4]*b+e[8]*d+e[12]*c;this.y=e[1]*a+e[5]*b+e[9]*d+e[13]*c;this.z=e[2]*a+e[6]*b+e[10]*d+e[14]*c;this.w=e[3]*a+e[7]*b+e[11]*d+e[15]*c;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var a=Math.sqrt(1-e.w*e.w);1E-4>a?(this.x=1,this.z=this.y=0):(this.x=e.x/a,this.y=e.y/a,this.z=e.z/a);return this},setAxisAngleFromRotationMatrix:function(e){var a,b,d;e=e.elements;var c=e[0];d=e[4]; -var h=e[8],k=e[1],n=e[5],f=e[9];b=e[2];a=e[6];var q=e[10];if(.01>Math.abs(d-k)&&.01>Math.abs(h-b)&&.01>Math.abs(f-a)){if(.1>Math.abs(d+k)&&.1>Math.abs(h+b)&&.1>Math.abs(f+a)&&.1>Math.abs(c+n+q-3))return this.set(1,0,0,0),this;e=Math.PI;c=(c+1)/2;n=(n+1)/2;q=(q+1)/2;d=(d+k)/4;h=(h+b)/4;f=(f+a)/4;c>n&&c>q?.01>c?(a=0,d=b=.707106781):(a=Math.sqrt(c),b=d/a,d=h/a):n>q?.01>n?(a=.707106781,b=0,d=.707106781):(b=Math.sqrt(n),a=d/b,d=f/b):.01>q?(b=a=.707106781,d=0):(d=Math.sqrt(q),a=h/d,b=f/d);this.set(a,b, -d,e);return this}e=Math.sqrt((a-f)*(a-f)+(h-b)*(h-b)+(k-d)*(k-d));.001>Math.abs(e)&&(e=1);this.x=(a-f)/e;this.y=(h-b)/e;this.z=(k-d)/e;this.w=Math.acos((c+n+q-1)/2);return this},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);this.z=Math.min(this.z,e.z);this.w=Math.min(this.w,e.w);return this},max:function(e){this.x=Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);this.z=Math.max(this.z,e.z);this.w=Math.max(this.w,e.w);return this},clamp:function(e,a){this.x=Math.max(e.x,Math.min(a.x, -this.x));this.y=Math.max(e.y,Math.min(a.y,this.y));this.z=Math.max(e.z,Math.min(a.z,this.z));this.w=Math.max(e.w,Math.min(a.w,this.w));return this},clampScalar:function(){var e,a;return function(b,r){void 0===e&&(e=new l,a=new l);e.set(b,b,b,b);a.set(r,r,r,r);return this.clamp(e,a)}}(),clampLength:function(e,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(e,Math.min(a,b)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z); +this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap='round';this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(f)}function Ib(f){jb.call(this);this.defines={TOON:''};this.type='MeshToonMaterial';this.gradientMap=null;this.setValues(f)}function Jb(f){ha.call(this);this.type='MeshNormalMaterial';this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new m(1,1);this.displacementMap=null;this.displacementScale= +1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.lights=this.fog=!1;this.setValues(f)}function Kb(f){ha.call(this);this.type='MeshLambertMaterial';this.color=new Y(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new Y(0);this.emissiveIntensity=1;this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio= +.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap='round';this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(f)}function Lb(f){ha.call(this);this.type='LineDashedMaterial';this.color=new Y(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.lights=!1;this.setValues(f)}function ee(f,a,b){var r=this,d=!1,c=0,h=0;this.onStart=void 0;this.onLoad=f;this.onProgress=a;this.onError=b;this.itemStart=function(f){h++;if(!1===d&& +void 0!==r.onStart)r.onStart(f,c,h);d=!0};this.itemEnd=function(f){c++;if(void 0!==r.onProgress)r.onProgress(f,c,h);if(c===h&&(d=!1,void 0!==r.onLoad))r.onLoad()};this.itemError=function(f){if(void 0!==r.onError)r.onError(f)}}function kb(f){this.manager=void 0!==f?f:Wa}function Le(f){this.manager=void 0!==f?f:Wa;this._parser=null}function fe(f){this.manager=void 0!==f?f:Wa;this._parser=null}function dd(f){this.manager=void 0!==f?f:Wa}function ge(f){this.manager=void 0!==f?f:Wa}function Ad(f){this.manager= +void 0!==f?f:Wa}function za(f,a){ba.call(this);this.type='Light';this.color=new Y(f);this.intensity=void 0!==a?a:1;this.receiveShadow=void 0}function Bd(f,a,b){za.call(this,f,b);this.type='HemisphereLight';this.castShadow=void 0;this.position.copy(ba.DefaultUp);this.updateMatrix();this.groundColor=new Y(a)}function Mb(f){this.camera=f;this.bias=0;this.radius=1;this.mapSize=new m(512,512);this.map=null;this.matrix=new p}function Cd(){Mb.call(this,new xa(50,1,.5,500))}function Dd(f,a,b,d,c,h){za.call(this, +f,a);this.type='SpotLight';this.position.copy(ba.DefaultUp);this.updateMatrix();this.target=new ba;Object.defineProperty(this,'power',{get:function(){return this.intensity*Math.PI},set:function(f){this.intensity=f/Math.PI}});this.distance=void 0!==b?b:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==c?c:0;this.decay=void 0!==h?h:1;this.shadow=new Cd}function Ed(f,a,b,d){za.call(this,f,a);this.type='PointLight';Object.defineProperty(this,'power',{get:function(){return 4*this.intensity*Math.PI}, +set:function(f){this.intensity=f/(4*Math.PI)}});this.distance=void 0!==b?b:0;this.decay=void 0!==d?d:1;this.shadow=new Mb(new xa(90,1,.5,500))}function Fd(){Mb.call(this,new Qa(-5,5,5,-5,.5,500))}function Gd(f,a){za.call(this,f,a);this.type='DirectionalLight';this.position.copy(ba.DefaultUp);this.updateMatrix();this.target=new ba;this.shadow=new Fd}function Hd(f,a){za.call(this,f,a);this.type='AmbientLight';this.castShadow=void 0}function Id(f,a,b,d){za.call(this,f,a);this.type='RectAreaLight';this.position.set(0, +1,0);this.updateMatrix();this.width=void 0!==b?b:10;this.height=void 0!==d?d:10}function Xa(f,a,b,d){this.parameterPositions=f;this._cachedIndex=0;this.resultBuffer=void 0!==d?d:new a.constructor(b);this.sampleValues=a;this.valueSize=b}function Jd(f,a,b,d){Xa.call(this,f,a,b,d);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function ed(f,a,b,d){Xa.call(this,f,a,b,d)}function Kd(f,a,b,d){Xa.call(this,f,a,b,d)}function Nb(f,a,b,d){if(void 0===f)throw Error('track name is undefined'); +if(void 0===a||0===a.length)throw Error('no keyframes in track named '+f);this.name=f;this.times=Ka.convertArray(a,this.TimeBufferType);this.values=Ka.convertArray(b,this.ValueBufferType);this.setInterpolation(d||this.DefaultInterpolation);this.validate();this.optimize()}function tc(f,a,b,d){Nb.call(this,f,a,b,d)}function Ld(f,a,b,d){Xa.call(this,f,a,b,d)}function fd(f,a,b,d){Nb.call(this,f,a,b,d)}function uc(f,a,b,d){Nb.call(this,f,a,b,d)}function Md(f,a,b,d){Nb.call(this,f,a,b,d)}function Nd(f, +a,b){Nb.call(this,f,a,b)}function Od(f,a,b,d){Nb.call(this,f,a,b,d)}function Ob(f,a,b,d){Nb.apply(this,arguments)}function bb(f,a,b){this.name=f;this.tracks=b;this.duration=void 0!==a?a:-1;this.uuid=ka.generateUUID();0>this.duration&&this.resetDuration();this.optimize()}function Pd(f){this.manager=void 0!==f?f:Wa;this.textures={}}function he(f){this.manager=void 0!==f?f:Wa}function vc(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}function ie(f){'boolean'=== +typeof f&&(console.warn('THREE.JSONLoader: showStatus parameter has been removed from constructor.'),f=void 0);this.manager=void 0!==f?f:Wa;this.withCredentials=!1}function Me(f){this.manager=void 0!==f?f:Wa;this.texturePath=''}function Ne(f,a,b,d,c){a=.5*(d-a);c=.5*(c-b);var r=f*f;return(2*b-2*d+a+c)*f*r+(-3*b+3*d-2*a-c)*r+a*f+b}function Pb(f,a,b,d){var r=1-f;return r*r*a+2*(1-f)*f*b+f*f*d}function Qb(f,a,b,d,c){var r=1-f,h=1-f;return r*r*r*a+3*h*h*f*b+3*(1-f)*f*f*d+f*f*f*c}function Pa(){this.arcLengthDivisions= +200}function ub(f,a){this.arcLengthDivisions=200;this.v1=f;this.v2=a}function gd(){this.arcLengthDivisions=200;this.curves=[];this.autoClose=!1}function wb(f,a,b,d,c,h,k,n){this.arcLengthDivisions=200;this.aX=f;this.aY=a;this.xRadius=b;this.yRadius=d;this.aStartAngle=c;this.aEndAngle=h;this.aClockwise=k;this.aRotation=n||0}function Rb(f){this.arcLengthDivisions=200;this.points=void 0===f?[]:f}function wc(f,a,b,d){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b;this.v3=d}function xc(f,a, +b){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b}function hd(f){gd.call(this);this.currentPoint=new m;f&&this.fromPoints(f)}function Sb(){hd.apply(this,arguments);this.holes=[]}function je(){this.subPaths=[];this.currentPath=null}function ke(f){this.data=f}function Oe(f){this.manager=void 0!==f?f:Wa}function le(f){this.manager=void 0!==f?f:Wa}function Pe(){this.type='StereoCamera';this.aspect=1;this.eyeSep=.064;this.cameraL=new xa;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate= +!1;this.cameraR=new xa;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function Qd(f,a,b){ba.call(this);this.type='CubeCamera';var r=new xa(90,1,f,a);r.up.set(0,-1,0);r.lookAt(new n(1,0,0));this.add(r);var d=new xa(90,1,f,a);d.up.set(0,-1,0);d.lookAt(new n(-1,0,0));this.add(d);var h=new xa(90,1,f,a);h.up.set(0,0,1);h.lookAt(new n(0,1,0));this.add(h);var k=new xa(90,1,f,a);k.up.set(0,0,-1);k.lookAt(new n(0,-1,0));this.add(k);var B=new xa(90,1,f,a);B.up.set(0,-1,0);B.lookAt(new n(0,0, +1));this.add(B);var g=new xa(90,1,f,a);g.up.set(0,-1,0);g.lookAt(new n(0,0,-1));this.add(g);this.renderTarget=new c(b,b,{format:1022,magFilter:1006,minFilter:1006});this.renderTarget.texture.name='CubeCamera';this.updateCubeMap=function(f,a){null===this.parent&&this.updateMatrixWorld();var b=this.renderTarget,c=b.texture.generateMipmaps;b.texture.generateMipmaps=!1;b.activeCubeFace=0;f.render(a,r,b);b.activeCubeFace=1;f.render(a,d,b);b.activeCubeFace=2;f.render(a,h,b);b.activeCubeFace=3;f.render(a, +k,b);b.activeCubeFace=4;f.render(a,B,b);b.texture.generateMipmaps=c;b.activeCubeFace=5;f.render(a,g,b);f.setRenderTarget(null)}}function me(){ba.call(this);this.type='AudioListener';this.context=ne.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function yc(f){ba.call(this);this.type='Audio';this.context=f.context;this.gain=this.context.createGain();this.gain.connect(f.getInput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.startTime= +0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType='empty';this.filters=[]}function oe(f){yc.call(this,f);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function pe(f,a){this.analyser=f.context.createAnalyser();this.analyser.fftSize=void 0!==a?a:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);f.getOutput().connect(this.analyser)}function qe(f,a,b){this.binding=f;this.valueSize=b;f=Float64Array;switch(a){case 'quaternion':a=this._slerp; +break;case 'string':case 'bool':f=Array;a=this._select;break;default:a=this._lerp}this.buffer=new f(4*b);this._mixBufferRegion=a;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Qe(f,a,b){b=b||La.parseTrackName(a);this._targetGroup=f;this._bindings=f.subscribe_(a,b)}function La(f,a,b){this.path=a;this.parsedPath=b||La.parseTrackName(a);this.node=La.findNode(f,this.parsedPath.nodeName)||f;this.rootNode=f}function Re(f){this.uuid=ka.generateUUID();this._objects=Array.prototype.slice.call(arguments); +this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,d=arguments.length;b!==d;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var c=this;this.stats={objects:{get total(){return c._objects.length},get inUse(){return this.total-c.nCachedObjects_}},get bindingsPerObject(){return c._bindings.length}}}function Se(f,a,b){this._mixer=f;this._clip=a;this._localRoot=b||null;f=a.tracks;a=f.length;b=Array(a);for(var r={endingStart:2400, +endingEnd:2400},d=0;d!==a;++d){var c=f[d].createInterpolant(null);b[d]=c;c.settings=r}this._interpolantSettings=r;this._interpolants=b;this._propertyBindings=Array(a);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd= +this.zeroSlopeAtStart=!0}function Te(f){this._root=f;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Rd(f,a){'string'===typeof f&&(console.warn('THREE.Uniform: Type parameter is no longer needed.'),f=a);this.value=f}function re(){da.call(this);this.type='InstancedBufferGeometry';this.maxInstancedCount=void 0}function se(f,a,b,d){this.uuid=ka.generateUUID();this.data=f;this.itemSize=a;this.offset=b;this.normalized=!0===d}function zc(f,a){this.uuid=ka.generateUUID(); +this.array=f;this.stride=a;this.count=void 0!==f?f.length/a:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};this.version=0}function te(f,a,b){zc.call(this,f,a);this.meshPerAttribute=b||1}function ue(f,a,b){ga.call(this,f,a);this.meshPerAttribute=b||1}function Ue(f,a,b,d){this.ray=new eb(f,a);this.near=b||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'); +return this.Points}}})}function Ve(f,a){return f.distance-a.distance}function ve(f,a,b,d){if(!1!==f.visible&&(f.raycast(a,b),!0===d)){f=f.children;d=0;for(var r=f.length;dr;r++,b++){var d=r/32*Math.PI*2,c=b/32*Math.PI*2;a.push(Math.cos(d),Math.sin(d),1,Math.cos(c),Math.sin(c),1)}f.addAttribute('position', +new W(a,3));a=new va({fog:!1});this.cone=new sa(f,a);this.add(this.cone);this.update()}function Ze(f){var a=[];f&&f.isBone&&a.push(f);for(var b=0;bf.length&&console.warn('THREE.CatmullRomCurve3: Points array needs at least two entries.');this.points=f||[];this.closed=!1}function pd(f,a,b,d){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b;this.v3=d}function qd(f,a,b){this.arcLengthDivisions=200;this.v0=f;this.v1=a;this.v2=b}function rd(f,a){this.arcLengthDivisions=200;this.v1=f;this.v2=a}function Vd(f,a,b,d,c,h){wb.call(this,f,a, +b,b,d,c,h)}function $e(f){console.warn('THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,f);this.type='catmullrom';this.closed=!0}function af(f){console.warn('THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.');lb.call(this,f);this.type='catmullrom'}function ye(f){console.warn('THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.');lb.call(this,f);this.type='catmullrom'}void 0===Number.EPSILON&&(Number.EPSILON= +Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(f){return'number'===typeof f&&isFinite(f)&&Math.floor(f)===f});void 0===Math.sign&&(Math.sign=function(f){return 0>f?-1:0r;r++)8===r|| +13===r||18===r||23===r?a[r]='-':14===r?a[r]='4':(2>=b&&(b=33554432+16777216*Math.random()|0),d=b&15,b>>=4,a[r]=f[19===r?d&3|8:d]);return a.join('')}}(),clamp:function(f,a,b){return Math.max(a,Math.min(b,f))},euclideanModulo:function(f,a){return(f%a+a)%a},mapLinear:function(f,a,b,d,c){return d+(f-a)*(c-d)/(b-a)},lerp:function(f,a,b){return(1-b)*f+b*a},smoothstep:function(f,a,b){if(f<=a)return 0;if(f>=b)return 1;f=(f-a)/(b-a);return f*f*(3-2*f)},smootherstep:function(f,a,b){if(f<=a)return 0;if(f>=b)return 1; +f=(f-a)/(b-a);return f*f*f*(f*(6*f-15)+10)},randInt:function(f,a){return f+Math.floor(Math.random()*(a-f+1))},randFloat:function(f,a){return f+Math.random()*(a-f)},randFloatSpread:function(f){return f*(.5-Math.random())},degToRad:function(f){return f*ka.DEG2RAD},radToDeg:function(f){return f*ka.RAD2DEG},isPowerOfTwo:function(f){return 0===(f&f-1)&&0!==f},nearestPowerOfTwo:function(f){return Math.pow(2,Math.round(Math.log(f)/Math.LN2))},nextPowerOfTwo:function(f){f--;f|=f>>1;f|=f>>2;f|=f>>4;f|=f>> +8;f|=f>>16;f++;return f}};Object.defineProperties(m.prototype,{width:{get:function(){return this.x},set:function(f){this.x=f}},height:{get:function(){return this.y},set:function(f){this.y=f}}});Object.assign(m.prototype,{isVector2:!0,set:function(f,a){this.x=f;this.y=a;return this},setScalar:function(f){this.y=this.x=f;return this},setX:function(f){this.x=f;return this},setY:function(f){this.y=f;return this},setComponent:function(f,a){switch(f){case 0:this.x=a;break;case 1:this.y=a;break;default:throw Error('index is out of range: '+ +f);}return this},getComponent:function(f){switch(f){case 0:return this.x;case 1:return this.y;default:throw Error('index is out of range: '+f);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(f){this.x=f.x;this.y=f.y;return this},add:function(f,a){if(void 0!==a)return console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(f,a);this.x+=f.x;this.y+=f.y;return this},addScalar:function(f){this.x+=f;this.y+=f;return this}, +addVectors:function(f,a){this.x=f.x+a.x;this.y=f.y+a.y;return this},addScaledVector:function(f,a){this.x+=f.x*a;this.y+=f.y*a;return this},sub:function(f,a){if(void 0!==a)return console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(f,a);this.x-=f.x;this.y-=f.y;return this},subScalar:function(f){this.x-=f;this.y-=f;return this},subVectors:function(f,a){this.x=f.x-a.x;this.y=f.y-a.y;return this},multiply:function(f){this.x*=f.x;this.y*= +f.y;return this},multiplyScalar:function(f){this.x*=f;this.y*=f;return this},divide:function(f){this.x/=f.x;this.y/=f.y;return this},divideScalar:function(f){return this.multiplyScalar(1/f)},min:function(f){this.x=Math.min(this.x,f.x);this.y=Math.min(this.y,f.y);return this},max:function(f){this.x=Math.max(this.x,f.x);this.y=Math.max(this.y,f.y);return this},clamp:function(f,a){this.x=Math.max(f.x,Math.min(a.x,this.x));this.y=Math.max(f.y,Math.min(a.y,this.y));return this},clampScalar:function(){var f= +new m,a=new m;return function(r,b){f.set(r,r);a.set(b,b);return this.clamp(f,a)}}(),clampLength:function(f,a){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(f,Math.min(a,r)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x): +Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(f){return this.x*f.x+this.y*f.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var f=Math.atan2(this.y,this.x);0>f&& +(f+=2*Math.PI);return f},distanceTo:function(f){return Math.sqrt(this.distanceToSquared(f))},distanceToSquared:function(f){var a=this.x-f.x;f=this.y-f.y;return a*a+f*f},distanceToManhattan:function(f){return Math.abs(this.x-f.x)+Math.abs(this.y-f.y)},setLength:function(f){return this.normalize().multiplyScalar(f)},lerp:function(f,a){this.x+=(f.x-this.x)*a;this.y+=(f.y-this.y)*a;return this},lerpVectors:function(f,a,b){return this.subVectors(a,f).multiplyScalar(b).add(f)},equals:function(f){return f.x=== +this.x&&f.y===this.y},fromArray:function(f,a){void 0===a&&(a=0);this.x=f[a];this.y=f[a+1];return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this.x;f[a+1]=this.y;return f},fromBufferAttribute:function(f,a,b){void 0!==b&&console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');this.x=f.getX(a);this.y=f.getY(a);return this},rotateAround:function(f,a){var r=Math.cos(a);a=Math.sin(a);var b=this.x-f.x,d=this.y-f.y;this.x=b*r-d*a+f.x;this.y=b*a+d*r+f.y; +return this}});var ef=0;b.DEFAULT_IMAGE=void 0;b.DEFAULT_MAPPING=300;Object.defineProperty(b.prototype,'needsUpdate',{set:function(f){!0===f&&this.version++}});Object.assign(b.prototype,e.prototype,{constructor:b,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(f){this.name=f.name;this.image=f.image;this.mipmaps=f.mipmaps.slice(0);this.mapping=f.mapping;this.wrapS=f.wrapS;this.wrapT=f.wrapT;this.magFilter=f.magFilter;this.minFilter=f.minFilter;this.anisotropy=f.anisotropy; +this.format=f.format;this.type=f.type;this.offset.copy(f.offset);this.repeat.copy(f.repeat);this.generateMipmaps=f.generateMipmaps;this.premultiplyAlpha=f.premultiplyAlpha;this.flipY=f.flipY;this.unpackAlignment=f.unpackAlignment;this.encoding=f.encoding;return this},toJSON:function(f){if(void 0!==f.textures[this.uuid])return f.textures[this.uuid];var a={metadata:{version:4.5,type:'Texture',generator:'Texture.toJSON'},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y], +offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var b=this.image;void 0===b.uuid&&(b.uuid=ka.generateUUID());if(void 0===f.images[b.uuid]){var d=f.images,c=b.uuid,h=b.uuid,k;void 0!==b.toDataURL?k=b:(k=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'),k.width=b.width,k.height=b.height,k.getContext('2d').drawImage(b,0,0,b.width,b.height));k=2048f.x||1f.x?0:1;break;case 1002:f.x=1===Math.abs(Math.floor(f.x)%2)?Math.ceil(f.x)-f.x:f.x-Math.floor(f.x)}if(0>f.y||1f.y?0:1;break;case 1002:f.y=1===Math.abs(Math.floor(f.y)%2)?Math.ceil(f.y)-f.y:f.y-Math.floor(f.y)}this.flipY&&(f.y=1-f.y)}}});Object.assign(l.prototype,{isVector4:!0,set:function(f,a,b,d){this.x=f;this.y=a;this.z=b;this.w=d;return this},setScalar:function(f){this.w=this.z=this.y=this.x=f;return this},setX:function(f){this.x=f;return this},setY:function(f){this.y=f;return this},setZ:function(f){this.z=f;return this},setW:function(f){this.w=f;return this},setComponent:function(f, +a){switch(f){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;case 3:this.w=a;break;default:throw Error('index is out of range: '+f);}return this},getComponent:function(f){switch(f){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error('index is out of range: '+f);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(f){this.x=f.x;this.y=f.y;this.z=f.z;this.w=void 0!==f.w?f.w:1;return this},add:function(f, +a){if(void 0!==a)return console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(f,a);this.x+=f.x;this.y+=f.y;this.z+=f.z;this.w+=f.w;return this},addScalar:function(f){this.x+=f;this.y+=f;this.z+=f;this.w+=f;return this},addVectors:function(f,a){this.x=f.x+a.x;this.y=f.y+a.y;this.z=f.z+a.z;this.w=f.w+a.w;return this},addScaledVector:function(f,a){this.x+=f.x*a;this.y+=f.y*a;this.z+=f.z*a;this.w+=f.w*a;return this},sub:function(f,a){if(void 0!== +a)return console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(f,a);this.x-=f.x;this.y-=f.y;this.z-=f.z;this.w-=f.w;return this},subScalar:function(f){this.x-=f;this.y-=f;this.z-=f;this.w-=f;return this},subVectors:function(f,a){this.x=f.x-a.x;this.y=f.y-a.y;this.z=f.z-a.z;this.w=f.w-a.w;return this},multiplyScalar:function(f){this.x*=f;this.y*=f;this.z*=f;this.w*=f;return this},applyMatrix4:function(f){var a=this.x,b=this.y,d=this.z, +c=this.w;f=f.elements;this.x=f[0]*a+f[4]*b+f[8]*d+f[12]*c;this.y=f[1]*a+f[5]*b+f[9]*d+f[13]*c;this.z=f[2]*a+f[6]*b+f[10]*d+f[14]*c;this.w=f[3]*a+f[7]*b+f[11]*d+f[15]*c;return this},divideScalar:function(f){return this.multiplyScalar(1/f)},setAxisAngleFromQuaternion:function(f){this.w=2*Math.acos(f.w);var a=Math.sqrt(1-f.w*f.w);1E-4>a?(this.x=1,this.z=this.y=0):(this.x=f.x/a,this.y=f.y/a,this.z=f.z/a);return this},setAxisAngleFromRotationMatrix:function(f){var a,b,d;f=f.elements;var c=f[0];d=f[4]; +var h=f[8],k=f[1],n=f[5],g=f[9];b=f[2];a=f[6];var q=f[10];if(.01>Math.abs(d-k)&&.01>Math.abs(h-b)&&.01>Math.abs(g-a)){if(.1>Math.abs(d+k)&&.1>Math.abs(h+b)&&.1>Math.abs(g+a)&&.1>Math.abs(c+n+q-3))return this.set(1,0,0,0),this;f=Math.PI;c=(c+1)/2;n=(n+1)/2;q=(q+1)/2;d=(d+k)/4;h=(h+b)/4;g=(g+a)/4;c>n&&c>q?.01>c?(a=0,d=b=.707106781):(a=Math.sqrt(c),b=d/a,d=h/a):n>q?.01>n?(a=.707106781,b=0,d=.707106781):(b=Math.sqrt(n),a=d/b,d=g/b):.01>q?(b=a=.707106781,d=0):(d=Math.sqrt(q),a=h/d,b=g/d);this.set(a,b, +d,f);return this}f=Math.sqrt((a-g)*(a-g)+(h-b)*(h-b)+(k-d)*(k-d));.001>Math.abs(f)&&(f=1);this.x=(a-g)/f;this.y=(h-b)/f;this.z=(k-d)/f;this.w=Math.acos((c+n+q-1)/2);return this},min:function(f){this.x=Math.min(this.x,f.x);this.y=Math.min(this.y,f.y);this.z=Math.min(this.z,f.z);this.w=Math.min(this.w,f.w);return this},max:function(f){this.x=Math.max(this.x,f.x);this.y=Math.max(this.y,f.y);this.z=Math.max(this.z,f.z);this.w=Math.max(this.w,f.w);return this},clamp:function(f,a){this.x=Math.max(f.x,Math.min(a.x, +this.x));this.y=Math.max(f.y,Math.min(a.y,this.y));this.z=Math.max(f.z,Math.min(a.z,this.z));this.w=Math.max(f.w,Math.min(a.w,this.w));return this},clampScalar:function(){var f,a;return function(b,r){void 0===f&&(f=new l,a=new l);f.set(b,b,b,b);a.set(r,r,r,r);return this.clamp(f,a)}}(),clampLength:function(f,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(f,Math.min(a,b)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z); this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w): -Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()|| -1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,a){this.x+=(e.x-this.x)*a;this.y+=(e.y-this.y)*a;this.z+=(e.z-this.z)*a;this.w+=(e.w-this.w)*a;return this},lerpVectors:function(e,a,b){return this.subVectors(a,e).multiplyScalar(b).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,a){void 0===a&&(a=0);this.x=e[a];this.y=e[a+1];this.z=e[a+2];this.w=e[a+3];return this},toArray:function(e,a){void 0===e&&(e= -[]);void 0===a&&(a=0);e[a]=this.x;e[a+1]=this.y;e[a+2]=this.z;e[a+3]=this.w;return e},fromBufferAttribute:function(e,a,b){void 0!==b&&console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');this.x=e.getX(a);this.y=e.getY(a);this.z=e.getZ(a);this.w=e.getW(a);return this}});Object.assign(f.prototype,g.prototype,{isWebGLRenderTarget:!0,setSize:function(e,a){if(this.width!==e||this.height!==a)this.width=e,this.height=a,this.dispose();this.viewport.set(0,0,e,a);this.scissor.set(0, -0,e,a)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.width=e.width;this.height=e.height;this.viewport.copy(e.viewport);this.texture=e.texture.clone();this.depthBuffer=e.depthBuffer;this.stencilBuffer=e.stencilBuffer;this.depthTexture=e.depthTexture;return this},dispose:function(){this.dispatchEvent({type:'dispose'})}});c.prototype=Object.create(f.prototype);c.prototype.constructor=c;c.prototype.isWebGLRenderTargetCube=!0;Object.assign(k,{slerp:function(e,a,b,d){return b.copy(e).slerp(a, -d)},slerpFlat:function(e,a,b,d,c,h,k){var r=b[d+0],f=b[d+1],n=b[d+2];b=b[d+3];d=c[h+0];var q=c[h+1],l=c[h+2];c=c[h+3];if(b!==c||r!==d||f!==q||n!==l){h=1-k;var g=r*d+f*q+n*l+b*c,B=0<=g?1:-1,p=1-g*g;p>Number.EPSILON&&(p=Math.sqrt(p),g=Math.atan2(p,g*B),h=Math.sin(h*g)/p,k=Math.sin(k*g)/p);B*=k;r=r*h+d*B;f=f*h+q*B;n=n*h+l*B;b=b*h+c*B;h===1-k&&(k=1/Math.sqrt(r*r+f*f+n*n+b*b),r*=k,f*=k,n*=k,b*=k)}e[a]=r;e[a+1]=f;e[a+2]=n;e[a+3]=b}});Object.defineProperties(k.prototype,{x:{get:function(){return this._x}, -set:function(e){this._x=e;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e;this.onChangeCallback()}}});Object.assign(k.prototype,{set:function(e,a,b,d){this._x=e;this._y=a;this._z=b;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z, -this._w)},copy:function(e){this._x=e.x;this._y=e.y;this._z=e.z;this._w=e.w;this.onChangeCallback();return this},setFromEuler:function(e,a){if(!e||!e.isEuler)throw Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var b=e._x,r=e._y,d=e._z;e=e.order;var c=Math.cos,h=Math.sin,k=c(b/2),f=c(r/2),c=c(d/2),b=h(b/2),r=h(r/2),d=h(d/2);'XYZ'===e?(this._x=b*f*c+k*r*d,this._y=k*r*c-b*f*d,this._z=k*f*d+b*r*c,this._w=k*f*c-b*r*d):'YXZ'===e?(this._x=b*f*c+ -k*r*d,this._y=k*r*c-b*f*d,this._z=k*f*d-b*r*c,this._w=k*f*c+b*r*d):'ZXY'===e?(this._x=b*f*c-k*r*d,this._y=k*r*c+b*f*d,this._z=k*f*d+b*r*c,this._w=k*f*c-b*r*d):'ZYX'===e?(this._x=b*f*c-k*r*d,this._y=k*r*c+b*f*d,this._z=k*f*d-b*r*c,this._w=k*f*c+b*r*d):'YZX'===e?(this._x=b*f*c+k*r*d,this._y=k*r*c+b*f*d,this._z=k*f*d-b*r*c,this._w=k*f*c-b*r*d):'XZY'===e&&(this._x=b*f*c-k*r*d,this._y=k*r*c-b*f*d,this._z=k*f*d+b*r*c,this._w=k*f*c+b*r*d);if(!1!==a)this.onChangeCallback();return this},setFromAxisAngle:function(e, -a){a/=2;var b=Math.sin(a);this._x=e.x*b;this._y=e.y*b;this._z=e.z*b;this._w=Math.cos(a);this.onChangeCallback();return this},setFromRotationMatrix:function(e){var a=e.elements,b=a[0];e=a[4];var d=a[8],c=a[1],h=a[5],k=a[9],f=a[2],n=a[6],a=a[10],q=b+h+a;0h&&b>a?(b=2*Math.sqrt(1+b-h-a),this._w=(n-k)/b,this._x=.25*b,this._y=(e+c)/b,this._z=(d+f)/b):h>a?(b=2*Math.sqrt(1+h-b-a),this._w=(d-f)/b,this._x=(e+c)/b,this._y= -.25*b,this._z=(k+n)/b):(b=2*Math.sqrt(1+a-b-h),this._w=(c-e)/b,this._x=(d+f)/b,this._y=(k+n)/b,this._z=.25*b);this.onChangeCallback();return this},setFromUnitVectors:function(){var e=new n,a;return function(b,r){void 0===e&&(e=new n);a=b.dot(r)+1;1E-6>a?(a=0,Math.abs(b.x)>Math.abs(b.z)?e.set(-b.y,b.x,0):e.set(0,-b.z,b.y)):e.crossVectors(b,r);this._x=e.x;this._y=e.y;this._z=e.z;this._w=a;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*= --1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e);this.onChangeCallback();return this}, -multiply:function(e,a){return void 0!==a?(console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'),this.multiplyQuaternions(e,a)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,a){var b=e._x,r=e._y,d=e._z;e=e._w;var c=a._x,h=a._y,k=a._z;a=a._w;this._x=b*a+e*c+r*k-d*h;this._y=r*a+e*h+d*c-b*k;this._z=d*a+e*k+b*h-r*c;this._w=e*a-b*c-r*h-d*k;this.onChangeCallback(); -return this},slerp:function(e,a){if(0===a)return this;if(1===a)return this.copy(e);var b=this._x,r=this._y,d=this._z,c=this._w,h=c*e._w+b*e._x+r*e._y+d*e._z;0>h?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,h=-h):this.copy(e);if(1<=h)return this._w=c,this._x=b,this._y=r,this._z=d,this;e=Math.sqrt(1-h*h);if(.001>Math.abs(e))return this._w=.5*(c+this._w),this._x=.5*(b+this._x),this._y=.5*(r+this._y),this._z=.5*(d+this._z),this;var k=Math.atan2(e,h),h=Math.sin((1-a)*k)/e;e=Math.sin(a*k)/e; -this._w=c*h+this._w*e;this._x=b*h+this._x*e;this._y=r*h+this._y*e;this._z=d*h+this._z*e;this.onChangeCallback();return this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,a){void 0===a&&(a=0);this._x=e[a];this._y=e[a+1];this._z=e[a+2];this._w=e[a+3];this.onChangeCallback();return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this._x;e[a+1]=this._y;e[a+2]=this._z;e[a+3]=this._w;return e},onChange:function(e){this.onChangeCallback= -e;return this},onChangeCallback:function(){}});Object.assign(n.prototype,{isVector3:!0,set:function(e,a,b){this.x=e;this.y=a;this.z=b;return this},setScalar:function(e){this.z=this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setComponent:function(e,a){switch(e){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;default:throw Error('index is out of range: '+e);}return this},getComponent:function(e){switch(e){case 0:return this.x; -case 1:return this.y;case 2:return this.z;default:throw Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;return this},add:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,a);this.x+=e.x;this.y+=e.y;this.z+=e.z;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;return this}, -addVectors:function(e,a){this.x=e.x+a.x;this.y=e.y+a.y;this.z=e.z+a.z;return this},addScaledVector:function(e,a){this.x+=e.x*a;this.y+=e.y*a;this.z+=e.z*a;return this},sub:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,a);this.x-=e.x;this.y-=e.y;this.z-=e.z;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;return this},subVectors:function(e,a){this.x=e.x-a.x;this.y=e.y-a.y;this.z= -e.z-a.z;return this},multiply:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'),this.multiplyVectors(e,a);this.x*=e.x;this.y*=e.y;this.z*=e.z;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;return this},multiplyVectors:function(e,a){this.x=e.x*a.x;this.y=e.y*a.y;this.z=e.z*a.z;return this},applyEuler:function(){var e=new k;return function(a){a&&a.isEuler||console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.'); -return this.applyQuaternion(e.setFromEuler(a))}}(),applyAxisAngle:function(){var e=new k;return function(a,b){return this.applyQuaternion(e.setFromAxisAngle(a,b))}}(),applyMatrix3:function(e){var a=this.x,b=this.y,d=this.z;e=e.elements;this.x=e[0]*a+e[3]*b+e[6]*d;this.y=e[1]*a+e[4]*b+e[7]*d;this.z=e[2]*a+e[5]*b+e[8]*d;return this},applyMatrix4:function(e){var a=this.x,b=this.y,d=this.z;e=e.elements;var c=1/(e[3]*a+e[7]*b+e[11]*d+e[15]);this.x=(e[0]*a+e[4]*b+e[8]*d+e[12])*c;this.y=(e[1]*a+e[5]*b+e[9]* -d+e[13])*c;this.z=(e[2]*a+e[6]*b+e[10]*d+e[14])*c;return this},applyQuaternion:function(e){var a=this.x,b=this.y,d=this.z,c=e.x,h=e.y,k=e.z;e=e.w;var f=e*a+h*d-k*b,n=e*b+k*a-c*d,q=e*d+c*b-h*a,a=-c*a-h*b-k*d;this.x=f*e+a*-c+n*-k-q*-h;this.y=n*e+a*-h+q*-c-f*-k;this.z=q*e+a*-k+f*-h-n*-c;return this},project:function(){var e=new p;return function(a){e.multiplyMatrices(a.projectionMatrix,e.getInverse(a.matrixWorld));return this.applyMatrix4(e)}}(),unproject:function(){var e=new p;return function(a){e.multiplyMatrices(a.matrixWorld, -e.getInverse(a.projectionMatrix));return this.applyMatrix4(e)}}(),transformDirection:function(e){var a=this.x,b=this.y,d=this.z;e=e.elements;this.x=e[0]*a+e[4]*b+e[8]*d;this.y=e[1]*a+e[5]*b+e[9]*d;this.z=e[2]*a+e[6]*b+e[10]*d;return this.normalize()},divide:function(e){this.x/=e.x;this.y/=e.y;this.z/=e.z;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);this.z=Math.min(this.z,e.z);return this},max:function(e){this.x= -Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);this.z=Math.max(this.z,e.z);return this},clamp:function(e,a){this.x=Math.max(e.x,Math.min(a.x,this.x));this.y=Math.max(e.y,Math.min(a.y,this.y));this.z=Math.max(e.z,Math.min(a.z,this.z));return this},clampScalar:function(){var e=new n,a=new n;return function(b,r){e.set(b,b,b);a.set(r,r,r);return this.clamp(e,a)}}(),clampLength:function(e,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(e,Math.min(a,b)))},floor:function(){this.x= +Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(f){return this.x*f.x+this.y*f.y+this.z*f.z+this.w*f.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()|| +1)},setLength:function(f){return this.normalize().multiplyScalar(f)},lerp:function(f,a){this.x+=(f.x-this.x)*a;this.y+=(f.y-this.y)*a;this.z+=(f.z-this.z)*a;this.w+=(f.w-this.w)*a;return this},lerpVectors:function(f,a,b){return this.subVectors(a,f).multiplyScalar(b).add(f)},equals:function(f){return f.x===this.x&&f.y===this.y&&f.z===this.z&&f.w===this.w},fromArray:function(f,a){void 0===a&&(a=0);this.x=f[a];this.y=f[a+1];this.z=f[a+2];this.w=f[a+3];return this},toArray:function(f,a){void 0===f&&(f= +[]);void 0===a&&(a=0);f[a]=this.x;f[a+1]=this.y;f[a+2]=this.z;f[a+3]=this.w;return f},fromBufferAttribute:function(f,a,b){void 0!==b&&console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');this.x=f.getX(a);this.y=f.getY(a);this.z=f.getZ(a);this.w=f.getW(a);return this}});Object.assign(g.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(f,a){if(this.width!==f||this.height!==a)this.width=f,this.height=a,this.dispose();this.viewport.set(0,0,f,a);this.scissor.set(0, +0,f,a)},clone:function(){return(new this.constructor).copy(this)},copy:function(f){this.width=f.width;this.height=f.height;this.viewport.copy(f.viewport);this.texture=f.texture.clone();this.depthBuffer=f.depthBuffer;this.stencilBuffer=f.stencilBuffer;this.depthTexture=f.depthTexture;return this},dispose:function(){this.dispatchEvent({type:'dispose'})}});c.prototype=Object.create(g.prototype);c.prototype.constructor=c;c.prototype.isWebGLRenderTargetCube=!0;Object.assign(k,{slerp:function(f,a,b,d){return b.copy(f).slerp(a, +d)},slerpFlat:function(f,a,b,d,c,h,k){var r=b[d+0],g=b[d+1],n=b[d+2];b=b[d+3];d=c[h+0];var q=c[h+1],e=c[h+2];c=c[h+3];if(b!==c||r!==d||g!==q||n!==e){h=1-k;var l=r*d+g*q+n*e+b*c,B=0<=l?1:-1,p=1-l*l;p>Number.EPSILON&&(p=Math.sqrt(p),l=Math.atan2(p,l*B),h=Math.sin(h*l)/p,k=Math.sin(k*l)/p);B*=k;r=r*h+d*B;g=g*h+q*B;n=n*h+e*B;b=b*h+c*B;h===1-k&&(k=1/Math.sqrt(r*r+g*g+n*n+b*b),r*=k,g*=k,n*=k,b*=k)}f[a]=r;f[a+1]=g;f[a+2]=n;f[a+3]=b}});Object.defineProperties(k.prototype,{x:{get:function(){return this._x}, +set:function(f){this._x=f;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(f){this._y=f;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(f){this._z=f;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(f){this._w=f;this.onChangeCallback()}}});Object.assign(k.prototype,{set:function(f,a,b,d){this._x=f;this._y=a;this._z=b;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z, +this._w)},copy:function(f){this._x=f.x;this._y=f.y;this._z=f.z;this._w=f.w;this.onChangeCallback();return this},setFromEuler:function(f,a){if(!f||!f.isEuler)throw Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var b=f._x,r=f._y,d=f._z;f=f.order;var c=Math.cos,h=Math.sin,k=c(b/2),g=c(r/2),c=c(d/2),b=h(b/2),r=h(r/2),d=h(d/2);'XYZ'===f?(this._x=b*g*c+k*r*d,this._y=k*r*c-b*g*d,this._z=k*g*d+b*r*c,this._w=k*g*c-b*r*d):'YXZ'===f?(this._x=b*g*c+ +k*r*d,this._y=k*r*c-b*g*d,this._z=k*g*d-b*r*c,this._w=k*g*c+b*r*d):'ZXY'===f?(this._x=b*g*c-k*r*d,this._y=k*r*c+b*g*d,this._z=k*g*d+b*r*c,this._w=k*g*c-b*r*d):'ZYX'===f?(this._x=b*g*c-k*r*d,this._y=k*r*c+b*g*d,this._z=k*g*d-b*r*c,this._w=k*g*c+b*r*d):'YZX'===f?(this._x=b*g*c+k*r*d,this._y=k*r*c+b*g*d,this._z=k*g*d-b*r*c,this._w=k*g*c-b*r*d):'XZY'===f&&(this._x=b*g*c-k*r*d,this._y=k*r*c-b*g*d,this._z=k*g*d+b*r*c,this._w=k*g*c+b*r*d);if(!1!==a)this.onChangeCallback();return this},setFromAxisAngle:function(f, +a){a/=2;var b=Math.sin(a);this._x=f.x*b;this._y=f.y*b;this._z=f.z*b;this._w=Math.cos(a);this.onChangeCallback();return this},setFromRotationMatrix:function(f){var a=f.elements,b=a[0];f=a[4];var d=a[8],c=a[1],h=a[5],k=a[9],g=a[2],n=a[6],a=a[10],q=b+h+a;0h&&b>a?(b=2*Math.sqrt(1+b-h-a),this._w=(n-k)/b,this._x=.25*b,this._y=(f+c)/b,this._z=(d+g)/b):h>a?(b=2*Math.sqrt(1+h-b-a),this._w=(d-g)/b,this._x=(f+c)/b,this._y= +.25*b,this._z=(k+n)/b):(b=2*Math.sqrt(1+a-b-h),this._w=(c-f)/b,this._x=(d+g)/b,this._y=(k+n)/b,this._z=.25*b);this.onChangeCallback();return this},setFromUnitVectors:function(){var f=new n,a;return function(b,r){void 0===f&&(f=new n);a=b.dot(r)+1;1E-6>a?(a=0,Math.abs(b.x)>Math.abs(b.z)?f.set(-b.y,b.x,0):f.set(0,-b.z,b.y)):f.crossVectors(b,r);this._x=f.x;this._y=f.y;this._z=f.z;this._w=a;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*= +-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(f){return this._x*f._x+this._y*f._y+this._z*f._z+this._w*f._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var f=this.length();0===f?(this._z=this._y=this._x=0,this._w=1):(f=1/f,this._x*=f,this._y*=f,this._z*=f,this._w*=f);this.onChangeCallback();return this}, +multiply:function(f,a){return void 0!==a?(console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'),this.multiplyQuaternions(f,a)):this.multiplyQuaternions(this,f)},premultiply:function(f){return this.multiplyQuaternions(f,this)},multiplyQuaternions:function(f,a){var b=f._x,r=f._y,d=f._z;f=f._w;var c=a._x,h=a._y,k=a._z;a=a._w;this._x=b*a+f*c+r*k-d*h;this._y=r*a+f*h+d*c-b*k;this._z=d*a+f*k+b*h-r*c;this._w=f*a-b*c-r*h-d*k;this.onChangeCallback(); +return this},slerp:function(f,a){if(0===a)return this;if(1===a)return this.copy(f);var b=this._x,r=this._y,d=this._z,c=this._w,h=c*f._w+b*f._x+r*f._y+d*f._z;0>h?(this._w=-f._w,this._x=-f._x,this._y=-f._y,this._z=-f._z,h=-h):this.copy(f);if(1<=h)return this._w=c,this._x=b,this._y=r,this._z=d,this;f=Math.sqrt(1-h*h);if(.001>Math.abs(f))return this._w=.5*(c+this._w),this._x=.5*(b+this._x),this._y=.5*(r+this._y),this._z=.5*(d+this._z),this;var k=Math.atan2(f,h),h=Math.sin((1-a)*k)/f;f=Math.sin(a*k)/f; +this._w=c*h+this._w*f;this._x=b*h+this._x*f;this._y=r*h+this._y*f;this._z=d*h+this._z*f;this.onChangeCallback();return this},equals:function(f){return f._x===this._x&&f._y===this._y&&f._z===this._z&&f._w===this._w},fromArray:function(f,a){void 0===a&&(a=0);this._x=f[a];this._y=f[a+1];this._z=f[a+2];this._w=f[a+3];this.onChangeCallback();return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this._x;f[a+1]=this._y;f[a+2]=this._z;f[a+3]=this._w;return f},onChange:function(f){this.onChangeCallback= +f;return this},onChangeCallback:function(){}});Object.assign(n.prototype,{isVector3:!0,set:function(f,a,b){this.x=f;this.y=a;this.z=b;return this},setScalar:function(f){this.z=this.y=this.x=f;return this},setX:function(f){this.x=f;return this},setY:function(f){this.y=f;return this},setZ:function(f){this.z=f;return this},setComponent:function(f,a){switch(f){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;default:throw Error('index is out of range: '+f);}return this},getComponent:function(f){switch(f){case 0:return this.x; +case 1:return this.y;case 2:return this.z;default:throw Error('index is out of range: '+f);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(f){this.x=f.x;this.y=f.y;this.z=f.z;return this},add:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(f,a);this.x+=f.x;this.y+=f.y;this.z+=f.z;return this},addScalar:function(f){this.x+=f;this.y+=f;this.z+=f;return this}, +addVectors:function(f,a){this.x=f.x+a.x;this.y=f.y+a.y;this.z=f.z+a.z;return this},addScaledVector:function(f,a){this.x+=f.x*a;this.y+=f.y*a;this.z+=f.z*a;return this},sub:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(f,a);this.x-=f.x;this.y-=f.y;this.z-=f.z;return this},subScalar:function(f){this.x-=f;this.y-=f;this.z-=f;return this},subVectors:function(f,a){this.x=f.x-a.x;this.y=f.y-a.y;this.z= +f.z-a.z;return this},multiply:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'),this.multiplyVectors(f,a);this.x*=f.x;this.y*=f.y;this.z*=f.z;return this},multiplyScalar:function(f){this.x*=f;this.y*=f;this.z*=f;return this},multiplyVectors:function(f,a){this.x=f.x*a.x;this.y=f.y*a.y;this.z=f.z*a.z;return this},applyEuler:function(){var f=new k;return function(a){a&&a.isEuler||console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.'); +return this.applyQuaternion(f.setFromEuler(a))}}(),applyAxisAngle:function(){var f=new k;return function(a,b){return this.applyQuaternion(f.setFromAxisAngle(a,b))}}(),applyMatrix3:function(f){var a=this.x,b=this.y,d=this.z;f=f.elements;this.x=f[0]*a+f[3]*b+f[6]*d;this.y=f[1]*a+f[4]*b+f[7]*d;this.z=f[2]*a+f[5]*b+f[8]*d;return this},applyMatrix4:function(f){var a=this.x,b=this.y,d=this.z;f=f.elements;var c=1/(f[3]*a+f[7]*b+f[11]*d+f[15]);this.x=(f[0]*a+f[4]*b+f[8]*d+f[12])*c;this.y=(f[1]*a+f[5]*b+f[9]* +d+f[13])*c;this.z=(f[2]*a+f[6]*b+f[10]*d+f[14])*c;return this},applyQuaternion:function(f){var a=this.x,b=this.y,d=this.z,c=f.x,h=f.y,k=f.z;f=f.w;var g=f*a+h*d-k*b,n=f*b+k*a-c*d,q=f*d+c*b-h*a,a=-c*a-h*b-k*d;this.x=g*f+a*-c+n*-k-q*-h;this.y=n*f+a*-h+q*-c-g*-k;this.z=q*f+a*-k+g*-h-n*-c;return this},project:function(){var f=new p;return function(a){f.multiplyMatrices(a.projectionMatrix,f.getInverse(a.matrixWorld));return this.applyMatrix4(f)}}(),unproject:function(){var f=new p;return function(a){f.multiplyMatrices(a.matrixWorld, +f.getInverse(a.projectionMatrix));return this.applyMatrix4(f)}}(),transformDirection:function(f){var a=this.x,b=this.y,d=this.z;f=f.elements;this.x=f[0]*a+f[4]*b+f[8]*d;this.y=f[1]*a+f[5]*b+f[9]*d;this.z=f[2]*a+f[6]*b+f[10]*d;return this.normalize()},divide:function(f){this.x/=f.x;this.y/=f.y;this.z/=f.z;return this},divideScalar:function(f){return this.multiplyScalar(1/f)},min:function(f){this.x=Math.min(this.x,f.x);this.y=Math.min(this.y,f.y);this.z=Math.min(this.z,f.z);return this},max:function(f){this.x= +Math.max(this.x,f.x);this.y=Math.max(this.y,f.y);this.z=Math.max(this.z,f.z);return this},clamp:function(f,a){this.x=Math.max(f.x,Math.min(a.x,this.x));this.y=Math.max(f.y,Math.min(a.y,this.y));this.z=Math.max(f.z,Math.min(a.z,this.z));return this},clampScalar:function(){var f=new n,a=new n;return function(b,r){f.set(b,b,b);a.set(r,r,r);return this.clamp(f,a)}}(),clampLength:function(f,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(f,Math.min(a,b)))},floor:function(){this.x= Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x= --this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,a){this.x+=(e.x- -this.x)*a;this.y+=(e.y-this.y)*a;this.z+=(e.z-this.z)*a;return this},lerpVectors:function(e,a,b){return this.subVectors(a,e).multiplyScalar(b).add(e)},cross:function(e,a){if(void 0!==a)return console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),this.crossVectors(e,a);a=this.x;var b=this.y,r=this.z;this.x=b*e.z-r*e.y;this.y=r*e.x-a*e.z;this.z=a*e.y-b*e.x;return this},crossVectors:function(e,a){var b=e.x,r=e.y;e=e.z;var d=a.x,c=a.y;a=a.z;this.x=r* -a-e*c;this.y=e*d-b*a;this.z=b*c-r*d;return this},projectOnVector:function(e){var a=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(a)},projectOnPlane:function(){var e=new n;return function(a){e.copy(this).projectOnVector(a);return this.sub(e)}}(),reflect:function(){var e=new n;return function(a){return this.sub(e.copy(a).multiplyScalar(2*this.dot(a)))}}(),angleTo:function(e){e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(ka.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))}, -distanceToSquared:function(e){var a=this.x-e.x,b=this.y-e.y;e=this.z-e.z;return a*a+b*b+e*e},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var a=Math.sin(e.phi)*e.radius;this.x=a*Math.sin(e.theta);this.y=Math.cos(e.phi)*e.radius;this.z=a*Math.cos(e.theta);return this},setFromCylindrical:function(e){this.x=e.radius*Math.sin(e.theta);this.y=e.y;this.z=e.radius*Math.cos(e.theta);return this},setFromMatrixPosition:function(e){e= -e.elements;this.x=e[12];this.y=e[13];this.z=e[14];return this},setFromMatrixScale:function(e){var a=this.setFromMatrixColumn(e,0).length(),b=this.setFromMatrixColumn(e,1).length();e=this.setFromMatrixColumn(e,2).length();this.x=a;this.y=b;this.z=e;return this},setFromMatrixColumn:function(e,a){return this.fromArray(e.elements,4*a)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,a){void 0===a&&(a=0);this.x=e[a];this.y=e[a+1];this.z=e[a+2];return this},toArray:function(e, -a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this.x;e[a+1]=this.y;e[a+2]=this.z;return e},fromBufferAttribute:function(e,a,b){void 0!==b&&console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');this.x=e.getX(a);this.y=e.getY(a);this.z=e.getZ(a);return this}});Object.assign(p.prototype,{isMatrix4:!0,set:function(e,a,b,d,c,h,k,f,n,q,l,g,p,t,m,u){var r=this.elements;r[0]=e;r[4]=a;r[8]=b;r[12]=d;r[1]=c;r[5]=h;r[9]=k;r[13]=f;r[2]=n;r[6]=q;r[10]=l;r[14]=g;r[3]=p;r[7]=t;r[11]= -m;r[15]=u;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new p).fromArray(this.elements)},copy:function(e){var a=this.elements;e=e.elements;a[0]=e[0];a[1]=e[1];a[2]=e[2];a[3]=e[3];a[4]=e[4];a[5]=e[5];a[6]=e[6];a[7]=e[7];a[8]=e[8];a[9]=e[9];a[10]=e[10];a[11]=e[11];a[12]=e[12];a[13]=e[13];a[14]=e[14];a[15]=e[15];return this},copyPosition:function(e){var a=this.elements;e=e.elements;a[12]=e[12];a[13]=e[13];a[14]=e[14];return this},extractBasis:function(e, -a,b){e.setFromMatrixColumn(this,0);a.setFromMatrixColumn(this,1);b.setFromMatrixColumn(this,2);return this},makeBasis:function(e,a,b){this.set(e.x,a.x,b.x,0,e.y,a.y,b.y,0,e.z,a.z,b.z,0,0,0,0,1);return this},extractRotation:function(){var e=new n;return function(a){var b=this.elements,r=a.elements,d=1/e.setFromMatrixColumn(a,0).length(),c=1/e.setFromMatrixColumn(a,1).length();a=1/e.setFromMatrixColumn(a,2).length();b[0]=r[0]*d;b[1]=r[1]*d;b[2]=r[2]*d;b[4]=r[4]*c;b[5]=r[5]*c;b[6]=r[6]*c;b[8]=r[8]*a; -b[9]=r[9]*a;b[10]=r[10]*a;return this}}(),makeRotationFromEuler:function(e){e&&e.isEuler||console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');var a=this.elements,b=e.x,d=e.y,c=e.z,h=Math.cos(b),b=Math.sin(b),k=Math.cos(d),d=Math.sin(d),f=Math.cos(c),c=Math.sin(c);if('XYZ'===e.order){e=h*f;var n=h*c,q=b*f,l=b*c;a[0]=k*f;a[4]=-k*c;a[8]=d;a[1]=n+q*d;a[5]=e-l*d;a[9]=-b*k;a[2]=l-e*d;a[6]=q+n*d;a[10]=h*k}else'YXZ'===e.order?(e=k*f,n=k*c, -q=d*f,l=d*c,a[0]=e+l*b,a[4]=q*b-n,a[8]=h*d,a[1]=h*c,a[5]=h*f,a[9]=-b,a[2]=n*b-q,a[6]=l+e*b,a[10]=h*k):'ZXY'===e.order?(e=k*f,n=k*c,q=d*f,l=d*c,a[0]=e-l*b,a[4]=-h*c,a[8]=q+n*b,a[1]=n+q*b,a[5]=h*f,a[9]=l-e*b,a[2]=-h*d,a[6]=b,a[10]=h*k):'ZYX'===e.order?(e=h*f,n=h*c,q=b*f,l=b*c,a[0]=k*f,a[4]=q*d-n,a[8]=e*d+l,a[1]=k*c,a[5]=l*d+e,a[9]=n*d-q,a[2]=-d,a[6]=b*k,a[10]=h*k):'YZX'===e.order?(e=h*k,n=h*d,q=b*k,l=b*d,a[0]=k*f,a[4]=l-e*c,a[8]=q*c+n,a[1]=c,a[5]=h*f,a[9]=-b*f,a[2]=-d*f,a[6]=n*c+q,a[10]=e-l*c):'XZY'=== -e.order&&(e=h*k,n=h*d,q=b*k,l=b*d,a[0]=k*f,a[4]=-c,a[8]=d*f,a[1]=e*c+l,a[5]=h*f,a[9]=n*c-q,a[2]=q*c-n,a[6]=b*f,a[10]=l*c+e);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this},makeRotationFromQuaternion:function(e){var a=this.elements,b=e._x,d=e._y,c=e._z,h=e._w,k=b+b,f=d+d,n=c+c;e=b*k;var q=b*f,b=b*n,l=d*f,d=d*n,c=c*n,k=h*k,f=h*f,h=h*n;a[0]=1-(l+c);a[4]=q-h;a[8]=b+f;a[1]=q+h;a[5]=1-(e+c);a[9]=d-k;a[2]=b-f;a[6]=d+k;a[10]=1-(e+l);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1; -return this},lookAt:function(){var e=new n,a=new n,b=new n;return function(r,d,c){var h=this.elements;b.subVectors(r,d);0===b.lengthSq()&&(b.z=1);b.normalize();e.crossVectors(c,b);0===e.lengthSq()&&(1===Math.abs(c.z)?b.x+=1E-4:b.z+=1E-4,b.normalize(),e.crossVectors(c,b));e.normalize();a.crossVectors(b,e);h[0]=e.x;h[4]=a.x;h[8]=b.x;h[1]=e.y;h[5]=a.y;h[9]=b.y;h[2]=e.z;h[6]=a.z;h[10]=b.z;return this}}(),multiply:function(e,a){return void 0!==a?(console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'), -this.multiplyMatrices(e,a)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,a){e=e.elements;a=a.elements;var b=this.elements,r=e[0],d=e[4],c=e[8],h=e[12],k=e[1],f=e[5],n=e[9],q=e[13],l=e[2],g=e[6],p=e[10],t=e[14],m=e[3],u=e[7],v=e[11];e=e[15];var w=a[0],y=a[4],A=a[8],x=a[12],C=a[1],z=a[5],E=a[9],F=a[13],D=a[2],L=a[6],U=a[10],H=a[14],G=a[3],T=a[7],M=a[11];a=a[15];b[0]=r*w+d*C+c*D+h*G;b[4]=r*y+d*z+c*L+h*T;b[8]=r*A+d*E+c*U+h*M; -b[12]=r*x+d*F+c*H+h*a;b[1]=k*w+f*C+n*D+q*G;b[5]=k*y+f*z+n*L+q*T;b[9]=k*A+f*E+n*U+q*M;b[13]=k*x+f*F+n*H+q*a;b[2]=l*w+g*C+p*D+t*G;b[6]=l*y+g*z+p*L+t*T;b[10]=l*A+g*E+p*U+t*M;b[14]=l*x+g*F+p*H+t*a;b[3]=m*w+u*C+v*D+e*G;b[7]=m*y+u*z+v*L+e*T;b[11]=m*A+u*E+v*U+e*M;b[15]=m*x+u*F+v*H+e*a;return this},multiplyScalar:function(e){var a=this.elements;a[0]*=e;a[4]*=e;a[8]*=e;a[12]*=e;a[1]*=e;a[5]*=e;a[9]*=e;a[13]*=e;a[2]*=e;a[6]*=e;a[10]*=e;a[14]*=e;a[3]*=e;a[7]*=e;a[11]*=e;a[15]*=e;return this},applyToBufferAttribute:function(){var e= -new n;return function(a){for(var b=0,d=a.count;bthis.determinant()&&(h=-h);b.x=c[12];b.y=c[13];b.z=c[14];a.copy(this);b=1/h;var c=1/k,n=1/f;a.elements[0]*=b;a.elements[1]*=b;a.elements[2]*=b;a.elements[4]*=c;a.elements[5]*= -c;a.elements[6]*=c;a.elements[8]*=n;a.elements[9]*=n;a.elements[10]*=n;d.setFromRotationMatrix(a);r.x=h;r.y=k;r.z=f;return this}}(),makePerspective:function(e,a,b,d,c,h){void 0===h&&console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');var r=this.elements;r[0]=2*c/(a-e);r[4]=0;r[8]=(a+e)/(a-e);r[12]=0;r[1]=0;r[5]=2*c/(b-d);r[9]=(b+d)/(b-d);r[13]=0;r[2]=0;r[6]=0;r[10]=-(h+c)/(h-c);r[14]=-2*h*c/(h-c);r[3]=0;r[7]=0;r[11]=-1;r[15]=0;return this}, -makeOrthographic:function(e,a,b,d,c,h){var r=this.elements,k=1/(a-e),f=1/(b-d),n=1/(h-c);r[0]=2*k;r[4]=0;r[8]=0;r[12]=-((a+e)*k);r[1]=0;r[5]=2*f;r[9]=0;r[13]=-((b+d)*f);r[2]=0;r[6]=0;r[10]=-2*n;r[14]=-((h+c)*n);r[3]=0;r[7]=0;r[11]=0;r[15]=1;return this},equals:function(e){var a=this.elements;e=e.elements;for(var b=0;16>b;b++)if(a[b]!==e[b])return!1;return!0},fromArray:function(e,a){void 0===a&&(a=0);for(var b=0;16>b;b++)this.elements[b]=e[b+a];return this},toArray:function(e,a){void 0===e&&(e=[]); -void 0===a&&(a=0);var b=this.elements;e[a]=b[0];e[a+1]=b[1];e[a+2]=b[2];e[a+3]=b[3];e[a+4]=b[4];e[a+5]=b[5];e[a+6]=b[6];e[a+7]=b[7];e[a+8]=b[8];e[a+9]=b[9];e[a+10]=b[10];e[a+11]=b[11];e[a+12]=b[12];e[a+13]=b[13];e[a+14]=b[14];e[a+15]=b[15];return e}});t.prototype=Object.create(b.prototype);t.prototype.constructor=t;t.prototype.isDataTexture=!0;h.prototype=Object.create(b.prototype);h.prototype.constructor=h;h.prototype.isCubeTexture=!0;Object.defineProperty(h.prototype,'images',{get:function(){return this.image}, -set:function(e){this.image=e}});var He=new b,Ie=new h,De=[],Ee=[],Ge=new Float32Array(16),Fe=new Float32Array(9);pa.prototype.setValue=function(e,a){for(var b=this.seq,d=0,r=b.length;d!==r;++d){var c=b[d];c.setValue(e,a[c.id])}};var Yd=/([\w\d_]+)(\])?(\[|\.)?/g;R.prototype.setValue=function(e,a,b){a=this.map[a];void 0!==a&&a.setValue(e,b,this.renderer)};R.prototype.setOptional=function(e,a,b){a=a[b];void 0!==a&&this.setValue(e,b,a)};R.upload=function(e,a,b,d){for(var r=0,c=a.length;r!==c;++r){var h= -a[r],k=b[h.id];!1!==k.needsUpdate&&h.setValue(e,k.value,d)}};R.seqWithValue=function(e,a){for(var b=[],d=0,r=e.length;d!==r;++d){var c=e[d];c.id in a&&b.push(c)}return b};var Ff={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388, +-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(f){return this.x*f.x+this.y*f.y+this.z*f.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(f){return this.normalize().multiplyScalar(f)},lerp:function(f,a){this.x+=(f.x- +this.x)*a;this.y+=(f.y-this.y)*a;this.z+=(f.z-this.z)*a;return this},lerpVectors:function(f,a,b){return this.subVectors(a,f).multiplyScalar(b).add(f)},cross:function(f,a){if(void 0!==a)return console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),this.crossVectors(f,a);a=this.x;var b=this.y,r=this.z;this.x=b*f.z-r*f.y;this.y=r*f.x-a*f.z;this.z=a*f.y-b*f.x;return this},crossVectors:function(f,a){var b=f.x,r=f.y;f=f.z;var d=a.x,c=a.y;a=a.z;this.x=r* +a-f*c;this.y=f*d-b*a;this.z=b*c-r*d;return this},projectOnVector:function(f){var a=f.dot(this)/f.lengthSq();return this.copy(f).multiplyScalar(a)},projectOnPlane:function(){var f=new n;return function(a){f.copy(this).projectOnVector(a);return this.sub(f)}}(),reflect:function(){var f=new n;return function(a){return this.sub(f.copy(a).multiplyScalar(2*this.dot(a)))}}(),angleTo:function(f){f=this.dot(f)/Math.sqrt(this.lengthSq()*f.lengthSq());return Math.acos(ka.clamp(f,-1,1))},distanceTo:function(f){return Math.sqrt(this.distanceToSquared(f))}, +distanceToSquared:function(f){var a=this.x-f.x,b=this.y-f.y;f=this.z-f.z;return a*a+b*b+f*f},distanceToManhattan:function(f){return Math.abs(this.x-f.x)+Math.abs(this.y-f.y)+Math.abs(this.z-f.z)},setFromSpherical:function(f){var a=Math.sin(f.phi)*f.radius;this.x=a*Math.sin(f.theta);this.y=Math.cos(f.phi)*f.radius;this.z=a*Math.cos(f.theta);return this},setFromCylindrical:function(f){this.x=f.radius*Math.sin(f.theta);this.y=f.y;this.z=f.radius*Math.cos(f.theta);return this},setFromMatrixPosition:function(f){f= +f.elements;this.x=f[12];this.y=f[13];this.z=f[14];return this},setFromMatrixScale:function(f){var a=this.setFromMatrixColumn(f,0).length(),b=this.setFromMatrixColumn(f,1).length();f=this.setFromMatrixColumn(f,2).length();this.x=a;this.y=b;this.z=f;return this},setFromMatrixColumn:function(f,a){return this.fromArray(f.elements,4*a)},equals:function(f){return f.x===this.x&&f.y===this.y&&f.z===this.z},fromArray:function(f,a){void 0===a&&(a=0);this.x=f[a];this.y=f[a+1];this.z=f[a+2];return this},toArray:function(f, +a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this.x;f[a+1]=this.y;f[a+2]=this.z;return f},fromBufferAttribute:function(f,a,b){void 0!==b&&console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');this.x=f.getX(a);this.y=f.getY(a);this.z=f.getZ(a);return this}});Object.assign(p.prototype,{isMatrix4:!0,set:function(f,a,b,d,c,h,k,g,n,q,e,l,p,t,m,u){var r=this.elements;r[0]=f;r[4]=a;r[8]=b;r[12]=d;r[1]=c;r[5]=h;r[9]=k;r[13]=g;r[2]=n;r[6]=q;r[10]=e;r[14]=l;r[3]=p;r[7]=t;r[11]= +m;r[15]=u;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new p).fromArray(this.elements)},copy:function(f){var a=this.elements;f=f.elements;a[0]=f[0];a[1]=f[1];a[2]=f[2];a[3]=f[3];a[4]=f[4];a[5]=f[5];a[6]=f[6];a[7]=f[7];a[8]=f[8];a[9]=f[9];a[10]=f[10];a[11]=f[11];a[12]=f[12];a[13]=f[13];a[14]=f[14];a[15]=f[15];return this},copyPosition:function(f){var a=this.elements;f=f.elements;a[12]=f[12];a[13]=f[13];a[14]=f[14];return this},extractBasis:function(f, +a,b){f.setFromMatrixColumn(this,0);a.setFromMatrixColumn(this,1);b.setFromMatrixColumn(this,2);return this},makeBasis:function(f,a,b){this.set(f.x,a.x,b.x,0,f.y,a.y,b.y,0,f.z,a.z,b.z,0,0,0,0,1);return this},extractRotation:function(){var f=new n;return function(a){var b=this.elements,r=a.elements,d=1/f.setFromMatrixColumn(a,0).length(),c=1/f.setFromMatrixColumn(a,1).length();a=1/f.setFromMatrixColumn(a,2).length();b[0]=r[0]*d;b[1]=r[1]*d;b[2]=r[2]*d;b[4]=r[4]*c;b[5]=r[5]*c;b[6]=r[6]*c;b[8]=r[8]*a; +b[9]=r[9]*a;b[10]=r[10]*a;return this}}(),makeRotationFromEuler:function(f){f&&f.isEuler||console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');var a=this.elements,b=f.x,d=f.y,c=f.z,h=Math.cos(b),b=Math.sin(b),k=Math.cos(d),d=Math.sin(d),g=Math.cos(c),c=Math.sin(c);if('XYZ'===f.order){f=h*g;var n=h*c,q=b*g,e=b*c;a[0]=k*g;a[4]=-k*c;a[8]=d;a[1]=n+q*d;a[5]=f-e*d;a[9]=-b*k;a[2]=e-f*d;a[6]=q+n*d;a[10]=h*k}else'YXZ'===f.order?(f=k*g,n=k*c, +q=d*g,e=d*c,a[0]=f+e*b,a[4]=q*b-n,a[8]=h*d,a[1]=h*c,a[5]=h*g,a[9]=-b,a[2]=n*b-q,a[6]=e+f*b,a[10]=h*k):'ZXY'===f.order?(f=k*g,n=k*c,q=d*g,e=d*c,a[0]=f-e*b,a[4]=-h*c,a[8]=q+n*b,a[1]=n+q*b,a[5]=h*g,a[9]=e-f*b,a[2]=-h*d,a[6]=b,a[10]=h*k):'ZYX'===f.order?(f=h*g,n=h*c,q=b*g,e=b*c,a[0]=k*g,a[4]=q*d-n,a[8]=f*d+e,a[1]=k*c,a[5]=e*d+f,a[9]=n*d-q,a[2]=-d,a[6]=b*k,a[10]=h*k):'YZX'===f.order?(f=h*k,n=h*d,q=b*k,e=b*d,a[0]=k*g,a[4]=e-f*c,a[8]=q*c+n,a[1]=c,a[5]=h*g,a[9]=-b*g,a[2]=-d*g,a[6]=n*c+q,a[10]=f-e*c):'XZY'=== +f.order&&(f=h*k,n=h*d,q=b*k,e=b*d,a[0]=k*g,a[4]=-c,a[8]=d*g,a[1]=f*c+e,a[5]=h*g,a[9]=n*c-q,a[2]=q*c-n,a[6]=b*g,a[10]=e*c+f);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this},makeRotationFromQuaternion:function(f){var a=this.elements,b=f._x,d=f._y,c=f._z,h=f._w,k=b+b,g=d+d,n=c+c;f=b*k;var q=b*g,b=b*n,e=d*g,d=d*n,c=c*n,k=h*k,g=h*g,h=h*n;a[0]=1-(e+c);a[4]=q-h;a[8]=b+g;a[1]=q+h;a[5]=1-(f+c);a[9]=d-k;a[2]=b-g;a[6]=d+k;a[10]=1-(f+e);a[3]=0;a[7]=0;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1; +return this},lookAt:function(){var f=new n,a=new n,b=new n;return function(r,d,c){var h=this.elements;b.subVectors(r,d);0===b.lengthSq()&&(b.z=1);b.normalize();f.crossVectors(c,b);0===f.lengthSq()&&(1===Math.abs(c.z)?b.x+=1E-4:b.z+=1E-4,b.normalize(),f.crossVectors(c,b));f.normalize();a.crossVectors(b,f);h[0]=f.x;h[4]=a.x;h[8]=b.x;h[1]=f.y;h[5]=a.y;h[9]=b.y;h[2]=f.z;h[6]=a.z;h[10]=b.z;return this}}(),multiply:function(f,a){return void 0!==a?(console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'), +this.multiplyMatrices(f,a)):this.multiplyMatrices(this,f)},premultiply:function(f){return this.multiplyMatrices(f,this)},multiplyMatrices:function(f,a){f=f.elements;a=a.elements;var b=this.elements,r=f[0],d=f[4],c=f[8],h=f[12],k=f[1],g=f[5],n=f[9],q=f[13],e=f[2],l=f[6],p=f[10],t=f[14],m=f[3],u=f[7],v=f[11];f=f[15];var w=a[0],y=a[4],A=a[8],x=a[12],C=a[1],z=a[5],E=a[9],F=a[13],D=a[2],L=a[6],U=a[10],H=a[14],G=a[3],T=a[7],M=a[11];a=a[15];b[0]=r*w+d*C+c*D+h*G;b[4]=r*y+d*z+c*L+h*T;b[8]=r*A+d*E+c*U+h*M; +b[12]=r*x+d*F+c*H+h*a;b[1]=k*w+g*C+n*D+q*G;b[5]=k*y+g*z+n*L+q*T;b[9]=k*A+g*E+n*U+q*M;b[13]=k*x+g*F+n*H+q*a;b[2]=e*w+l*C+p*D+t*G;b[6]=e*y+l*z+p*L+t*T;b[10]=e*A+l*E+p*U+t*M;b[14]=e*x+l*F+p*H+t*a;b[3]=m*w+u*C+v*D+f*G;b[7]=m*y+u*z+v*L+f*T;b[11]=m*A+u*E+v*U+f*M;b[15]=m*x+u*F+v*H+f*a;return this},multiplyScalar:function(f){var a=this.elements;a[0]*=f;a[4]*=f;a[8]*=f;a[12]*=f;a[1]*=f;a[5]*=f;a[9]*=f;a[13]*=f;a[2]*=f;a[6]*=f;a[10]*=f;a[14]*=f;a[3]*=f;a[7]*=f;a[11]*=f;a[15]*=f;return this},applyToBufferAttribute:function(){var f= +new n;return function(a){for(var b=0,d=a.count;bthis.determinant()&&(h=-h);b.x=c[12];b.y=c[13];b.z=c[14];a.copy(this);b=1/h;var c=1/k,n=1/g;a.elements[0]*=b;a.elements[1]*=b;a.elements[2]*=b;a.elements[4]*=c;a.elements[5]*= +c;a.elements[6]*=c;a.elements[8]*=n;a.elements[9]*=n;a.elements[10]*=n;d.setFromRotationMatrix(a);r.x=h;r.y=k;r.z=g;return this}}(),makePerspective:function(f,a,b,d,c,h){void 0===h&&console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');var r=this.elements;r[0]=2*c/(a-f);r[4]=0;r[8]=(a+f)/(a-f);r[12]=0;r[1]=0;r[5]=2*c/(b-d);r[9]=(b+d)/(b-d);r[13]=0;r[2]=0;r[6]=0;r[10]=-(h+c)/(h-c);r[14]=-2*h*c/(h-c);r[3]=0;r[7]=0;r[11]=-1;r[15]=0;return this}, +makeOrthographic:function(f,a,b,d,c,h){var r=this.elements,k=1/(a-f),g=1/(b-d),n=1/(h-c);r[0]=2*k;r[4]=0;r[8]=0;r[12]=-((a+f)*k);r[1]=0;r[5]=2*g;r[9]=0;r[13]=-((b+d)*g);r[2]=0;r[6]=0;r[10]=-2*n;r[14]=-((h+c)*n);r[3]=0;r[7]=0;r[11]=0;r[15]=1;return this},equals:function(f){var a=this.elements;f=f.elements;for(var b=0;16>b;b++)if(a[b]!==f[b])return!1;return!0},fromArray:function(f,a){void 0===a&&(a=0);for(var b=0;16>b;b++)this.elements[b]=f[b+a];return this},toArray:function(f,a){void 0===f&&(f=[]); +void 0===a&&(a=0);var b=this.elements;f[a]=b[0];f[a+1]=b[1];f[a+2]=b[2];f[a+3]=b[3];f[a+4]=b[4];f[a+5]=b[5];f[a+6]=b[6];f[a+7]=b[7];f[a+8]=b[8];f[a+9]=b[9];f[a+10]=b[10];f[a+11]=b[11];f[a+12]=b[12];f[a+13]=b[13];f[a+14]=b[14];f[a+15]=b[15];return f}});t.prototype=Object.create(b.prototype);t.prototype.constructor=t;t.prototype.isDataTexture=!0;h.prototype=Object.create(b.prototype);h.prototype.constructor=h;h.prototype.isCubeTexture=!0;Object.defineProperty(h.prototype,'images',{get:function(){return this.image}, +set:function(f){this.image=f}});var He=new b,Ie=new h,De=[],Ee=[],Ge=new Float32Array(16),Fe=new Float32Array(9);pa.prototype.setValue=function(f,a){for(var b=this.seq,d=0,r=b.length;d!==r;++d){var c=b[d];c.setValue(f,a[c.id])}};var Yd=/([\w\d_]+)(\])?(\[|\.)?/g;R.prototype.setValue=function(f,a,b){a=this.map[a];void 0!==a&&a.setValue(f,b,this.renderer)};R.prototype.setOptional=function(f,a,b){a=a[b];void 0!==a&&this.setValue(f,b,a)};R.upload=function(f,a,b,d){for(var r=0,c=a.length;r!==c;++r){var h= +a[r],k=b[h.id];!1!==k.needsUpdate&&h.setValue(f,k.value,d)}};R.seqWithValue=function(f,a){for(var b=[],d=0,r=f.length;d!==r;++d){var c=f[d];c.id in a&&b.push(c)}return b};var Ff={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388, crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146, floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323, lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273, moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797, -silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(Y.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){e&&e.isColor?this.copy(e):'number'===typeof e?this.setHex(e):'string'===typeof e&&this.setStyle(e);return this},setScalar:function(e){this.b= -this.g=this.r=e;return this},setHex:function(e){e=Math.floor(e);this.r=(e>>16&255)/255;this.g=(e>>8&255)/255;this.b=(e&255)/255;return this},setRGB:function(e,a,b){this.r=e;this.g=a;this.b=b;return this},setHSL:function(){function e(e,a,b){0>b&&(b+=1);1b?a:b<2/3?e+6*(a-e)*(2/3-b):e}return function(a,b,d){a=ka.euclideanModulo(a,1);b=ka.clamp(b,0,1);d=ka.clamp(d,0,1);0===b?this.r=this.g=this.b=d:(b=.5>=d?d*(1+b):d+b-d*b,d=2*d-b,this.r=e(d,b,a+1/3),this.g=e(d,b,a), -this.b=e(d,b,a-1/3));return this}}(),setStyle:function(e){function a(a){void 0!==a&&1>parseFloat(a)&&console.warn('THREE.Color: Alpha component of '+e+' will be ignored.')}var b;if(b=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var d=b[2];switch(b[1]){case 'rgb':case 'rgba':if(b=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(b[1],10))/255,this.g=Math.min(255,parseInt(b[2],10))/255,this.b=Math.min(255,parseInt(b[3],10))/255,a(b[5]),this;if(b= -/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(b[1],10))/100,this.g=Math.min(100,parseInt(b[2],10))/100,this.b=Math.min(100,parseInt(b[3],10))/100,a(b[5]),this;break;case 'hsl':case 'hsla':if(b=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(b[1])/360,c=parseInt(b[2],10)/100,h=parseInt(b[3],10)/100;a(b[5]);return this.setHSL(d,c,h)}}}else if(b=/^\#([A-Fa-f0-9]+)$/.exec(e)){b= -b[1];d=b.length;if(3===d)return this.r=parseInt(b.charAt(0)+b.charAt(0),16)/255,this.g=parseInt(b.charAt(1)+b.charAt(1),16)/255,this.b=parseInt(b.charAt(2)+b.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(b.charAt(0)+b.charAt(1),16)/255,this.g=parseInt(b.charAt(2)+b.charAt(3),16)/255,this.b=parseInt(b.charAt(4)+b.charAt(5),16)/255,this}e&&0=f?n/(c+h):n/(2-c-h);switch(c){case a:k=(b-d)/n+(b>16&255)/255;this.g=(f>>8&255)/255;this.b=(f&255)/255;return this},setRGB:function(f,a,b){this.r=f;this.g=a;this.b=b;return this},setHSL:function(){function f(f,a,b){0>b&&(b+=1);1b?a:b<2/3?f+6*(a-f)*(2/3-b):f}return function(a,b,d){a=ka.euclideanModulo(a,1);b=ka.clamp(b,0,1);d=ka.clamp(d,0,1);0===b?this.r=this.g=this.b=d:(b=.5>=d?d*(1+b):d+b-d*b,d=2*d-b,this.r=f(d,b,a+1/3),this.g=f(d,b,a), +this.b=f(d,b,a-1/3));return this}}(),setStyle:function(f){function a(a){void 0!==a&&1>parseFloat(a)&&console.warn('THREE.Color: Alpha component of '+f+' will be ignored.')}var b;if(b=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(f)){var d=b[2];switch(b[1]){case 'rgb':case 'rgba':if(b=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(b[1],10))/255,this.g=Math.min(255,parseInt(b[2],10))/255,this.b=Math.min(255,parseInt(b[3],10))/255,a(b[5]),this;if(b= +/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(b[1],10))/100,this.g=Math.min(100,parseInt(b[2],10))/100,this.b=Math.min(100,parseInt(b[3],10))/100,a(b[5]),this;break;case 'hsl':case 'hsla':if(b=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(b[1])/360,c=parseInt(b[2],10)/100,h=parseInt(b[3],10)/100;a(b[5]);return this.setHSL(d,c,h)}}}else if(b=/^\#([A-Fa-f0-9]+)$/.exec(f)){b= +b[1];d=b.length;if(3===d)return this.r=parseInt(b.charAt(0)+b.charAt(0),16)/255,this.g=parseInt(b.charAt(1)+b.charAt(1),16)/255,this.b=parseInt(b.charAt(2)+b.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(b.charAt(0)+b.charAt(1),16)/255,this.g=parseInt(b.charAt(2)+b.charAt(3),16)/255,this.b=parseInt(b.charAt(4)+b.charAt(5),16)/255,this}f&&0=g?n/(c+h):n/(2-c-h);switch(c){case a:k=(b-d)/n+(b 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n', bumpmap_pars_fragment:'#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n', @@ -433,189 +433,189 @@ ja.aomap,ja.lightmap,ja.fog]),vertexShader:ma.meshbasic_vert,fragmentShader:ma.m vertexShader:ma.meshphong_vert,fragmentShader:ma.meshphong_frag},standard:{uniforms:Oa.merge([ja.common,ja.aomap,ja.lightmap,ja.emissivemap,ja.bumpmap,ja.normalmap,ja.displacementmap,ja.roughnessmap,ja.metalnessmap,ja.fog,ja.lights,{emissive:{value:new Y(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:ma.meshphysical_vert,fragmentShader:ma.meshphysical_frag},points:{uniforms:Oa.merge([ja.points,ja.fog]),vertexShader:ma.points_vert,fragmentShader:ma.points_frag}, dashed:{uniforms:Oa.merge([ja.common,ja.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ma.linedashed_vert,fragmentShader:ma.linedashed_frag},depth:{uniforms:Oa.merge([ja.common,ja.displacementmap]),vertexShader:ma.depth_vert,fragmentShader:ma.depth_frag},normal:{uniforms:Oa.merge([ja.common,ja.bumpmap,ja.normalmap,ja.displacementmap,{opacity:{value:1}}]),vertexShader:ma.normal_vert,fragmentShader:ma.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}}, vertexShader:ma.cube_vert,fragmentShader:ma.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:ma.equirect_vert,fragmentShader:ma.equirect_frag},distanceRGBA:{uniforms:Oa.merge([ja.common,ja.displacementmap,{lightPos:{value:new n}}]),vertexShader:ma.distanceRGBA_vert,fragmentShader:ma.distanceRGBA_frag}};yb.physical={uniforms:Oa.merge([yb.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:ma.meshphysical_vert,fragmentShader:ma.meshphysical_frag}; -Object.assign(na.prototype,{set:function(e,a){this.min.copy(e);this.max.copy(a);return this},setFromPoints:function(e){this.makeEmpty();for(var a=0,b=e.length;athis.max.x||e.ythis.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,a){return(a||new m).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y?!1:!0}, -clampPoint:function(e,a){return(a||new m).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new m;return function(a){return e.copy(a).clamp(this.min,this.max).sub(a).length()}}(),intersect:function(e){this.min.max(e.min);this.max.min(e.max);return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this},translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});ca.prototype=Object.create(b.prototype); -ca.prototype.constructor=ca;var hf=0;Object.assign(ha.prototype,g.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var a in e){var b=e[a];if(void 0===b)console.warn("THREE.Material: '"+a+"' parameter is undefined.");else{var d=this[a];void 0===d?console.warn('THREE.'+this.type+": '"+a+"' is not a property of this material."):d&&d.isColor?d.set(b):d&&d.isVector3&&b&&b.isVector3?d.copy(b):this[a]='overdraw'===a?Number(b):b}}},toJSON:function(e){function a(e){var a= -[],b;for(b in e){var d=e[b];delete d.metadata;a.push(d)}return a}var b=void 0===e;b&&(e={textures:{},images:{}});var d={metadata:{version:4.5,type:'Material',generator:'Material.toJSON'}};d.uuid=this.uuid;d.type=this.type;''!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness);void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex()); -this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);void 0!==this.clearCoat&&(d.clearCoat=this.clearCoat);void 0!==this.clearCoatRoughness&&(d.clearCoatRoughness=this.clearCoatRoughness);this.map&&this.map.isTexture&&(d.map=this.map.toJSON(e).uuid);this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(e).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(e).uuid);this.bumpMap&& -this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(e).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(e).uuid,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(e).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(e).uuid); -this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(e).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(e).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(e).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(e).uuid,d.reflectivity=this.reflectivity);this.gradientMap&&this.gradientMap.isTexture&&(d.gradientMap=this.gradientMap.toJSON(e).uuid);void 0!==this.size&& +Object.assign(na.prototype,{set:function(f,a){this.min.copy(f);this.max.copy(a);return this},setFromPoints:function(f){this.makeEmpty();for(var a=0,b=f.length;athis.max.x||f.ythis.max.y?!1:!0},containsBox:function(f){return this.min.x<=f.min.x&&f.max.x<=this.max.x&&this.min.y<=f.min.y&&f.max.y<=this.max.y},getParameter:function(f,a){return(a||new m).set((f.x-this.min.x)/(this.max.x-this.min.x),(f.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(f){return f.max.xthis.max.x||f.max.ythis.max.y?!1:!0}, +clampPoint:function(f,a){return(a||new m).copy(f).clamp(this.min,this.max)},distanceToPoint:function(){var f=new m;return function(a){return f.copy(a).clamp(this.min,this.max).sub(a).length()}}(),intersect:function(f){this.min.max(f.min);this.max.min(f.max);return this},union:function(f){this.min.min(f.min);this.max.max(f.max);return this},translate:function(f){this.min.add(f);this.max.add(f);return this},equals:function(f){return f.min.equals(this.min)&&f.max.equals(this.max)}});ca.prototype=Object.create(b.prototype); +ca.prototype.constructor=ca;var hf=0;Object.assign(ha.prototype,e.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(f){if(void 0!==f)for(var a in f){var b=f[a];if(void 0===b)console.warn("THREE.Material: '"+a+"' parameter is undefined.");else{var d=this[a];void 0===d?console.warn('THREE.'+this.type+": '"+a+"' is not a property of this material."):d&&d.isColor?d.set(b):d&&d.isVector3&&b&&b.isVector3?d.copy(b):this[a]='overdraw'===a?Number(b):b}}},toJSON:function(f){function a(f){var a= +[],b;for(b in f){var d=f[b];delete d.metadata;a.push(d)}return a}var b=void 0===f;b&&(f={textures:{},images:{}});var d={metadata:{version:4.5,type:'Material',generator:'Material.toJSON'}};d.uuid=this.uuid;d.type=this.type;''!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness);void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex()); +this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);void 0!==this.clearCoat&&(d.clearCoat=this.clearCoat);void 0!==this.clearCoatRoughness&&(d.clearCoatRoughness=this.clearCoatRoughness);this.map&&this.map.isTexture&&(d.map=this.map.toJSON(f).uuid);this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(f).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(f).uuid);this.bumpMap&& +this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(f).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(f).uuid,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(f).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(f).uuid); +this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(f).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(f).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(f).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(f).uuid,d.reflectivity=this.reflectivity);this.gradientMap&&this.gradientMap.isTexture&&(d.gradientMap=this.gradientMap.toJSON(f).uuid);void 0!==this.size&& (d.size=this.size);void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(d.blending=this.blending);2!==this.shading&&(d.shading=this.shading);0!==this.side&&(d.side=this.side);0!==this.vertexColors&&(d.vertexColors=this.vertexColors);1>this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0c&&(c=q);l>h&&(h=l);g>k&&(k=g)}this.min.set(a,b,d);this.max.set(c,h,k);return this},setFromBufferAttribute:function(e){for(var a=Infinity,b=Infinity,d=Infinity,c=-Infinity,h=-Infinity,k=-Infinity,f=0,n=e.count;fc&&(c=q);l>h&&(h=l);g>k&&(k=g)}this.min.set(a,b,d);this.max.set(c,h,k);return this}, -setFromPoints:function(e){this.makeEmpty();for(var a=0,b=e.length;athis.max.x||e.ythis.max.y||e.zthis.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,a){return(a||new n).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/ -(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z?!1:!0},intersectsSphere:function(){var e=new n;return function(a){this.clampPoint(a.center,e);return e.distanceToSquared(a.center)<=a.radius*a.radius}}(),intersectsPlane:function(e){var a,b;0=e.constant},clampPoint:function(e,a){return(a||new n).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n;return function(a){return e.copy(a).clamp(this.min,this.max).sub(a).length()}}(),getBoundingSphere:function(){var e=new n;return function(a){a= -a||new qa;this.getCenter(a.center);a.radius=.5*this.getSize(e).length();return a}}(),intersect:function(e){this.min.max(e.min);this.max.min(e.max);this.isEmpty()&&this.makeEmpty();return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this},applyMatrix4:function(){var e=[new n,new n,new n,new n,new n,new n,new n,new n];return function(a){if(this.isEmpty())return this;e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a); -e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(e);return this}}(),translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&& -e.max.equals(this.max)}});Object.assign(qa.prototype,{set:function(e,a){this.center.copy(e);this.radius=a;return this},setFromPoints:function(){var e=new ia;return function(a,b){var d=this.center;void 0!==b?d.copy(b):e.setFromPoints(a).getCenter(d);for(var c=b=0,r=a.length;c= -this.radius},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var a=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=a*a},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,a){var b=this.center.distanceToSquared(e); -a=a||new n;a.copy(e);b>this.radius*this.radius&&(a.sub(this.center).normalize(),a.multiplyScalar(this.radius).add(this.center));return a},getBoundingBox:function(e){e=e||new ia;e.set(this.center,this.center);e.expandByScalar(this.radius);return e},applyMatrix4:function(e){this.center.applyMatrix4(e);this.radius*=e.getMaxScaleOnAxis();return this},translate:function(e){this.center.add(e);return this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});Object.assign(ra.prototype, -{isMatrix3:!0,set:function(e,a,b,d,c,h,k,f,n){var r=this.elements;r[0]=e;r[1]=d;r[2]=k;r[3]=a;r[4]=c;r[5]=f;r[6]=b;r[7]=h;r[8]=n;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var a=this.elements;e=e.elements;a[0]=e[0];a[1]=e[1];a[2]=e[2];a[3]=e[3];a[4]=e[4];a[5]=e[5];a[6]=e[6];a[7]=e[7];a[8]=e[8];return this},setFromMatrix4:function(e){e=e.elements;this.set(e[0],e[4],e[8],e[1],e[5], -e[9],e[2],e[6],e[10]);return this},applyToBufferAttribute:function(){var e=new n;return function(a){for(var b=0,d=a.count;bb;b++)if(a[b]!==e[b])return!1;return!0},fromArray:function(e,a){void 0===a&&(a=0);for(var b=0;9>b;b++)this.elements[b]=e[b+a];return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);var b=this.elements;e[a]=b[0];e[a+1]=b[1];e[a+2]=b[2];e[a+3]=b[3];e[a+4]=b[4];e[a+5]=b[5];e[a+6]=b[6];e[a+7]=b[7];e[a+8]=b[8];return e}});Object.assign(Aa.prototype,{set:function(e,a){this.normal.copy(e);this.constant=a;return this},setComponents:function(e,a,b, -d){this.normal.set(e,a,b);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(e,a){this.normal.copy(e);this.constant=-a.dot(this.normal);return this},setFromCoplanarPoints:function(){var e=new n,a=new n;return function(b,d,c){d=e.subVectors(c,d).cross(a.subVectors(b,d)).normalize();this.setFromNormalAndCoplanarPoint(d,b);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.normal.copy(e.normal);this.constant=e.constant;return this},normalize:function(){var e= -1/this.normal.length();this.normal.multiplyScalar(e);this.constant*=e;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,a){return(a||new n).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new n;return function(a,b){b=b||new n;var d=a.delta(e),c=this.normal.dot(d); -if(0===c){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else return c=-(a.start.dot(this.normal)+this.constant)/c,0>c||1a&&0e&&0b;b++)a[b].copy(e.planes[b]);return this},setFromMatrix:function(e){var a=this.planes,b=e.elements;e=b[0];var d=b[1],c=b[2],h=b[3],k=b[4],f=b[5],n=b[6],q=b[7],l=b[8],g=b[9],p=b[10],t=b[11],m=b[12],u=b[13],v=b[14],b=b[15];a[0].setComponents(h-e,q-k,t-l,b-m).normalize();a[1].setComponents(h+e,q+k,t+l,b+m).normalize();a[2].setComponents(h+d,q+f,t+g,b+u).normalize();a[3].setComponents(h- -d,q-f,t-g,b-u).normalize();a[4].setComponents(h-c,q-n,t-p,b-v).normalize();a[5].setComponents(h+c,q+n,t+p,b+v).normalize();return this},intersectsObject:function(){var e=new qa;return function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();e.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new qa;return function(a){e.center.set(0,0,0);e.radius=.7071067811865476;e.applyMatrix4(a.matrixWorld);return this.intersectsSphere(e)}}(), -intersectsSphere:function(e){var a=this.planes,b=e.center;e=-e.radius;for(var d=0;6>d;d++)if(a[d].distanceToPoint(b)c;c++){var r=d[c];e.x=0 -h&&0>r)return!1}return!0}}(),containsPoint:function(e){for(var a=this.planes,b=0;6>b;b++)if(0>a[b].distanceToPoint(e))return!1;return!0}});nb.RotationOrders='XYZ YZX ZXY XZY YXZ ZYX'.split(' ');nb.DefaultOrder='XYZ';Object.defineProperties(nb.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e;this.onChangeCallback()}}, -order:{get:function(){return this._order},set:function(e){this._order=e;this.onChangeCallback()}}});Object.assign(nb.prototype,{isEuler:!0,set:function(e,a,b,d){this._x=e;this._y=a;this._z=b;this._order=d||this._order;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){this._x=e._x;this._y=e._y;this._z=e._z;this._order=e._order;this.onChangeCallback();return this},setFromRotationMatrix:function(e,a,b){var d=ka.clamp, -c=e.elements;e=c[0];var r=c[4],h=c[8],k=c[1],f=c[5],n=c[9],q=c[2],l=c[6],c=c[10];a=a||this._order;'XYZ'===a?(this._y=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-n,c),this._z=Math.atan2(-r,e)):(this._x=Math.atan2(l,f),this._z=0)):'YXZ'===a?(this._x=Math.asin(-d(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(h,c),this._z=Math.atan2(k,f)):(this._y=Math.atan2(-q,e),this._z=0)):'ZXY'===a?(this._x=Math.asin(d(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-q,c),this._z=Math.atan2(-r, -f)):(this._y=0,this._z=Math.atan2(k,e))):'ZYX'===a?(this._y=Math.asin(-d(q,-1,1)),.99999>Math.abs(q)?(this._x=Math.atan2(l,c),this._z=Math.atan2(k,e)):(this._x=0,this._z=Math.atan2(-r,f))):'YZX'===a?(this._z=Math.asin(d(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(-n,f),this._y=Math.atan2(-q,e)):(this._x=0,this._y=Math.atan2(h,c))):'XZY'===a?(this._z=Math.asin(-d(r,-1,1)),.99999>Math.abs(r)?(this._x=Math.atan2(l,f),this._y=Math.atan2(h,e)):(this._x=Math.atan2(-n,c),this._y=0)):console.warn('THREE.Euler: .setFromRotationMatrix() given unsupported order: '+ -a);this._order=a;if(!1!==b)this.onChangeCallback();return this},setFromQuaternion:function(){var e=new p;return function(a,b,d){e.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(e,b,d)}}(),setFromVector3:function(e,a){return this.set(e.x,e.y,e.z,a||this._order)},reorder:function(){var e=new k;return function(a){e.setFromEuler(this);return this.setFromQuaternion(e,a)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){this._x= -e[0];this._y=e[1];this._z=e[2];void 0!==e[3]&&(this._order=e[3]);this.onChangeCallback();return this},toArray:function(e,a){void 0===e&&(e=[]);void 0===a&&(a=0);e[a]=this._x;e[a+1]=this._y;e[a+2]=this._z;e[a+3]=this._order;return e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},onChange:function(e){this.onChangeCallback=e;return this},onChangeCallback:function(){}});Object.assign(Gc.prototype,{set:function(e){this.mask=1<c&&(c=q);e>h&&(h=e);l>k&&(k=l)}this.min.set(a,b,d);this.max.set(c,h,k);return this},setFromBufferAttribute:function(f){for(var a=Infinity,b=Infinity,d=Infinity,c=-Infinity,h=-Infinity,k=-Infinity,g=0,n=f.count;gc&&(c=q);e>h&&(h=e);l>k&&(k=l)}this.min.set(a,b,d);this.max.set(c,h,k);return this}, +setFromPoints:function(f){this.makeEmpty();for(var a=0,b=f.length;athis.max.x||f.ythis.max.y||f.zthis.max.z?!1:!0},containsBox:function(f){return this.min.x<=f.min.x&&f.max.x<=this.max.x&&this.min.y<=f.min.y&&f.max.y<=this.max.y&&this.min.z<=f.min.z&&f.max.z<=this.max.z},getParameter:function(f,a){return(a||new n).set((f.x-this.min.x)/(this.max.x-this.min.x),(f.y-this.min.y)/(this.max.y-this.min.y),(f.z-this.min.z)/ +(this.max.z-this.min.z))},intersectsBox:function(f){return f.max.xthis.max.x||f.max.ythis.max.y||f.max.zthis.max.z?!1:!0},intersectsSphere:function(){var f=new n;return function(a){this.clampPoint(a.center,f);return f.distanceToSquared(a.center)<=a.radius*a.radius}}(),intersectsPlane:function(f){var a,b;0=f.constant},clampPoint:function(f,a){return(a||new n).copy(f).clamp(this.min,this.max)},distanceToPoint:function(){var f=new n;return function(a){return f.copy(a).clamp(this.min,this.max).sub(a).length()}}(),getBoundingSphere:function(){var f=new n;return function(a){a= +a||new qa;this.getCenter(a.center);a.radius=.5*this.getSize(f).length();return a}}(),intersect:function(f){this.min.max(f.min);this.max.min(f.max);this.isEmpty()&&this.makeEmpty();return this},union:function(f){this.min.min(f.min);this.max.max(f.max);return this},applyMatrix4:function(){var f=[new n,new n,new n,new n,new n,new n,new n,new n];return function(a){if(this.isEmpty())return this;f[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);f[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a); +f[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);f[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);f[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);f[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);f[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);f[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(f);return this}}(),translate:function(f){this.min.add(f);this.max.add(f);return this},equals:function(f){return f.min.equals(this.min)&& +f.max.equals(this.max)}});Object.assign(qa.prototype,{set:function(f,a){this.center.copy(f);this.radius=a;return this},setFromPoints:function(){var f=new ia;return function(a,b){var d=this.center;void 0!==b?d.copy(b):f.setFromPoints(a).getCenter(d);for(var c=b=0,r=a.length;c= +this.radius},containsPoint:function(f){return f.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(f){return f.distanceTo(this.center)-this.radius},intersectsSphere:function(f){var a=this.radius+f.radius;return f.center.distanceToSquared(this.center)<=a*a},intersectsBox:function(f){return f.intersectsSphere(this)},intersectsPlane:function(f){return Math.abs(this.center.dot(f.normal)-f.constant)<=this.radius},clampPoint:function(f,a){var b=this.center.distanceToSquared(f); +a=a||new n;a.copy(f);b>this.radius*this.radius&&(a.sub(this.center).normalize(),a.multiplyScalar(this.radius).add(this.center));return a},getBoundingBox:function(f){f=f||new ia;f.set(this.center,this.center);f.expandByScalar(this.radius);return f},applyMatrix4:function(f){this.center.applyMatrix4(f);this.radius*=f.getMaxScaleOnAxis();return this},translate:function(f){this.center.add(f);return this},equals:function(f){return f.center.equals(this.center)&&f.radius===this.radius}});Object.assign(ra.prototype, +{isMatrix3:!0,set:function(f,a,b,d,c,h,k,g,n){var r=this.elements;r[0]=f;r[1]=d;r[2]=k;r[3]=a;r[4]=c;r[5]=g;r[6]=b;r[7]=h;r[8]=n;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(f){var a=this.elements;f=f.elements;a[0]=f[0];a[1]=f[1];a[2]=f[2];a[3]=f[3];a[4]=f[4];a[5]=f[5];a[6]=f[6];a[7]=f[7];a[8]=f[8];return this},setFromMatrix4:function(f){f=f.elements;this.set(f[0],f[4],f[8],f[1],f[5], +f[9],f[2],f[6],f[10]);return this},applyToBufferAttribute:function(){var f=new n;return function(a){for(var b=0,d=a.count;bb;b++)if(a[b]!==f[b])return!1;return!0},fromArray:function(f,a){void 0===a&&(a=0);for(var b=0;9>b;b++)this.elements[b]=f[b+a];return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);var b=this.elements;f[a]=b[0];f[a+1]=b[1];f[a+2]=b[2];f[a+3]=b[3];f[a+4]=b[4];f[a+5]=b[5];f[a+6]=b[6];f[a+7]=b[7];f[a+8]=b[8];return f}});Object.assign(Aa.prototype,{set:function(f,a){this.normal.copy(f);this.constant=a;return this},setComponents:function(f,a,b, +d){this.normal.set(f,a,b);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(f,a){this.normal.copy(f);this.constant=-a.dot(this.normal);return this},setFromCoplanarPoints:function(){var f=new n,a=new n;return function(b,d,c){d=f.subVectors(c,d).cross(a.subVectors(b,d)).normalize();this.setFromNormalAndCoplanarPoint(d,b);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(f){this.normal.copy(f.normal);this.constant=f.constant;return this},normalize:function(){var f= +1/this.normal.length();this.normal.multiplyScalar(f);this.constant*=f;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(f){return this.normal.dot(f)+this.constant},distanceToSphere:function(f){return this.distanceToPoint(f.center)-f.radius},projectPoint:function(f,a){return(a||new n).copy(this.normal).multiplyScalar(-this.distanceToPoint(f)).add(f)},intersectLine:function(){var f=new n;return function(a,b){b=b||new n;var d=a.delta(f),c=this.normal.dot(d); +if(0===c){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else return c=-(a.start.dot(this.normal)+this.constant)/c,0>c||1a&&0f&&0b;b++)a[b].copy(f.planes[b]);return this},setFromMatrix:function(f){var a=this.planes,b=f.elements;f=b[0];var d=b[1],c=b[2],h=b[3],k=b[4],g=b[5],n=b[6],q=b[7],e=b[8],l=b[9],p=b[10],t=b[11],m=b[12],u=b[13],v=b[14],b=b[15];a[0].setComponents(h-f,q-k,t-e,b-m).normalize();a[1].setComponents(h+f,q+k,t+e,b+m).normalize();a[2].setComponents(h+d,q+g,t+l,b+u).normalize();a[3].setComponents(h- +d,q-g,t-l,b-u).normalize();a[4].setComponents(h-c,q-n,t-p,b-v).normalize();a[5].setComponents(h+c,q+n,t+p,b+v).normalize();return this},intersectsObject:function(){var f=new qa;return function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();f.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(f)}}(),intersectsSprite:function(){var f=new qa;return function(a){f.center.set(0,0,0);f.radius=.7071067811865476;f.applyMatrix4(a.matrixWorld);return this.intersectsSphere(f)}}(), +intersectsSphere:function(f){var a=this.planes,b=f.center;f=-f.radius;for(var d=0;6>d;d++)if(a[d].distanceToPoint(b)c;c++){var r=d[c];f.x=0 +h&&0>r)return!1}return!0}}(),containsPoint:function(f){for(var a=this.planes,b=0;6>b;b++)if(0>a[b].distanceToPoint(f))return!1;return!0}});nb.RotationOrders='XYZ YZX ZXY XZY YXZ ZYX'.split(' ');nb.DefaultOrder='XYZ';Object.defineProperties(nb.prototype,{x:{get:function(){return this._x},set:function(f){this._x=f;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(f){this._y=f;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(f){this._z=f;this.onChangeCallback()}}, +order:{get:function(){return this._order},set:function(f){this._order=f;this.onChangeCallback()}}});Object.assign(nb.prototype,{isEuler:!0,set:function(f,a,b,d){this._x=f;this._y=a;this._z=b;this._order=d||this._order;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(f){this._x=f._x;this._y=f._y;this._z=f._z;this._order=f._order;this.onChangeCallback();return this},setFromRotationMatrix:function(f,a,b){var d=ka.clamp, +c=f.elements;f=c[0];var r=c[4],h=c[8],k=c[1],g=c[5],n=c[9],q=c[2],e=c[6],c=c[10];a=a||this._order;'XYZ'===a?(this._y=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-n,c),this._z=Math.atan2(-r,f)):(this._x=Math.atan2(e,g),this._z=0)):'YXZ'===a?(this._x=Math.asin(-d(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(h,c),this._z=Math.atan2(k,g)):(this._y=Math.atan2(-q,f),this._z=0)):'ZXY'===a?(this._x=Math.asin(d(e,-1,1)),.99999>Math.abs(e)?(this._y=Math.atan2(-q,c),this._z=Math.atan2(-r, +g)):(this._y=0,this._z=Math.atan2(k,f))):'ZYX'===a?(this._y=Math.asin(-d(q,-1,1)),.99999>Math.abs(q)?(this._x=Math.atan2(e,c),this._z=Math.atan2(k,f)):(this._x=0,this._z=Math.atan2(-r,g))):'YZX'===a?(this._z=Math.asin(d(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(-n,g),this._y=Math.atan2(-q,f)):(this._x=0,this._y=Math.atan2(h,c))):'XZY'===a?(this._z=Math.asin(-d(r,-1,1)),.99999>Math.abs(r)?(this._x=Math.atan2(e,g),this._y=Math.atan2(h,f)):(this._x=Math.atan2(-n,c),this._y=0)):console.warn('THREE.Euler: .setFromRotationMatrix() given unsupported order: '+ +a);this._order=a;if(!1!==b)this.onChangeCallback();return this},setFromQuaternion:function(){var f=new p;return function(a,b,d){f.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(f,b,d)}}(),setFromVector3:function(f,a){return this.set(f.x,f.y,f.z,a||this._order)},reorder:function(){var f=new k;return function(a){f.setFromEuler(this);return this.setFromQuaternion(f,a)}}(),equals:function(f){return f._x===this._x&&f._y===this._y&&f._z===this._z&&f._order===this._order},fromArray:function(f){this._x= +f[0];this._y=f[1];this._z=f[2];void 0!==f[3]&&(this._order=f[3]);this.onChangeCallback();return this},toArray:function(f,a){void 0===f&&(f=[]);void 0===a&&(a=0);f[a]=this._x;f[a+1]=this._y;f[a+2]=this._z;f[a+3]=this._order;return f},toVector3:function(f){return f?f.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},onChange:function(f){this.onChangeCallback=f;return this},onChangeCallback:function(){}});Object.assign(Gc.prototype,{set:function(f){this.mask=1<c;c++)if(h[c]===h[(c+1)%3]){a.push(k);break}for(k=a.length-1;0<=k;k--)for(h=a[k],this.faces.splice(h,1),d=0,f=this.faceVertexUvs.length;dc;c++)if(h[c]===h[(c+1)%3]){a.push(k);break}for(k=a.length-1;0<=k;k--)for(h=a[k],this.faces.splice(h,1),d=0,g=this.faceVertexUvs.length;da?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)}, -distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new n;return function(e){var b=a.subVectors(e,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(e);a.copy(this.direction).multiplyScalar(b).add(this.origin);return a.distanceToSquared(e)}}(),distanceSqToSegment:function(){var a=new n,b=new n,d=new n;return function(e,c,h,k){a.copy(e).add(c).multiplyScalar(.5);b.copy(c).sub(e).normalize();d.copy(this.origin).sub(a); -var f=.5*e.distanceTo(c),n=-this.direction.dot(b),q=d.dot(this.direction),l=-d.dot(b),g=d.lengthSq(),r=Math.abs(1-n*n),p;0=-p?c<=p?(f=1/r,e*=f,c*=f,n=e*(e+n*c+2*q)+c*(n*e+c+2*l)+g):(c=f,e=Math.max(0,-(n*c+q)),n=-e*e+c*(c+2*l)+g):(c=-f,e=Math.max(0,-(n*c+q)),n=-e*e+c*(c+2*l)+g):c<=-p?(e=Math.max(0,-(-n*f+q)),c=0e)return null;e=Math.sqrt(e-c);c=d-e;d+=e;return 0>c&&0>d?null:0>c?this.at(d,b):this.at(c,b)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<= -a.radius},distanceToPlane:function(a){var e=a.normal.dot(this.direction);if(0===e)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/e;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var e=a.distanceToPoint(this.origin);return 0===e||0>a.normal.dot(this.direction)*e?!0:!1},intersectBox:function(a,b){var e,d,c,h,k;d=1/this.direction.x;h=1/this.direction.y;k=1/this.direction.z; -var f=this.origin;0<=d?(e=(a.min.x-f.x)*d,d*=a.max.x-f.x):(e=(a.max.x-f.x)*d,d*=a.min.x-f.x);0<=h?(c=(a.min.y-f.y)*h,h*=a.max.y-f.y):(c=(a.max.y-f.y)*h,h*=a.min.y-f.y);if(e>h||c>d)return null;if(c>e||e!==e)e=c;if(hk||c>d)return null;if(c>e||e!==e)e=c;if(kd?null:this.at(0<=e?e:d,b)},intersectsBox:function(){var a=new n;return function(e){return null!==this.intersectBox(e,a)}}(),intersectTriangle:function(){var a= -new n,b=new n,d=new n,c=new n;return function(e,h,k,f,n){b.subVectors(h,e);d.subVectors(k,e);c.crossVectors(b,d);h=this.direction.dot(c);if(0h)f=-1,h=-h;else return null;a.subVectors(this.origin,e);e=f*this.direction.dot(d.crossVectors(a,d));if(0>e)return null;k=f*this.direction.dot(b.cross(a));if(0>k||e+k>h)return null;e=-f*a.dot(c);return 0>e?null:this.at(e/h,n)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this}, +this.direction.copy(a.direction);return this},at:function(a,b){return(b||new n).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(){var a=new n;return function(f){this.origin.copy(this.at(f,a));return this}}(),closestPointToPoint:function(a,b){b=b||new n;b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)}, +distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new n;return function(f){var b=a.subVectors(f,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(f);a.copy(this.direction).multiplyScalar(b).add(this.origin);return a.distanceToSquared(f)}}(),distanceSqToSegment:function(){var a=new n,b=new n,d=new n;return function(f,c,h,k){a.copy(f).add(c).multiplyScalar(.5);b.copy(c).sub(f).normalize();d.copy(this.origin).sub(a); +var g=.5*f.distanceTo(c),n=-this.direction.dot(b),q=d.dot(this.direction),e=-d.dot(b),l=d.lengthSq(),r=Math.abs(1-n*n),p;0=-p?c<=p?(g=1/r,f*=g,c*=g,n=f*(f+n*c+2*q)+c*(n*f+c+2*e)+l):(c=g,f=Math.max(0,-(n*c+q)),n=-f*f+c*(c+2*e)+l):(c=-g,f=Math.max(0,-(n*c+q)),n=-f*f+c*(c+2*e)+l):c<=-p?(f=Math.max(0,-(-n*g+q)),c=0f)return null;f=Math.sqrt(f-c);c=d-f;d+=f;return 0>c&&0>d?null:0>c?this.at(d,b):this.at(c,b)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<= +a.radius},distanceToPlane:function(a){var f=a.normal.dot(this.direction);if(0===f)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/f;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var f=a.distanceToPoint(this.origin);return 0===f||0>a.normal.dot(this.direction)*f?!0:!1},intersectBox:function(a,b){var f,d,c,h,k;d=1/this.direction.x;h=1/this.direction.y;k=1/this.direction.z; +var g=this.origin;0<=d?(f=(a.min.x-g.x)*d,d*=a.max.x-g.x):(f=(a.max.x-g.x)*d,d*=a.min.x-g.x);0<=h?(c=(a.min.y-g.y)*h,h*=a.max.y-g.y):(c=(a.max.y-g.y)*h,h*=a.min.y-g.y);if(f>h||c>d)return null;if(c>f||f!==f)f=c;if(hk||c>d)return null;if(c>f||f!==f)f=c;if(kd?null:this.at(0<=f?f:d,b)},intersectsBox:function(){var a=new n;return function(f){return null!==this.intersectBox(f,a)}}(),intersectTriangle:function(){var a= +new n,b=new n,d=new n,c=new n;return function(f,h,k,g,n){b.subVectors(h,f);d.subVectors(k,f);c.crossVectors(b,d);h=this.direction.dot(c);if(0h)g=-1,h=-h;else return null;a.subVectors(this.origin,f);f=g*this.direction.dot(d.crossVectors(a,d));if(0>f)return null;k=g*this.direction.dot(b.cross(a));if(0>k||f+k>h)return null;f=-g*a.dot(c);return 0>f?null:this.at(f/h,n)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this}, equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(fb.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){return(a||new n).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new n).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)}, -distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){b=b||new n;return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new n,b=new n;return function(e,d){a.subVectors(e,this.start);b.subVectors(this.end,this.start);e=b.dot(b);e=b.dot(a)/e;d&&(e=ka.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,d){a=this.closestPointToPointParameter(a,b);d=d||new n;return this.delta(d).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); -this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});Object.assign(ab,{normal:function(){var a=new n;return function(e,b,d,c){c=c||new n;c.subVectors(d,b);a.subVectors(e,b);c.cross(a);e=c.lengthSq();return 0=e.x+e.y}}()});Object.assign(ab.prototype,{set:function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this},setFromPointsAndIndices:function(a,b,d,c){this.a.copy(a[b]);this.b.copy(a[d]);this.c.copy(a[c]);return this},clone:function(){return(new this.constructor).copy(this)}, +distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){b=b||new n;return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new n,b=new n;return function(f,d){a.subVectors(f,this.start);b.subVectors(this.end,this.start);f=b.dot(b);f=b.dot(a)/f;d&&(f=ka.clamp(f,0,1));return f}}(),closestPointToPoint:function(a,b,d){a=this.closestPointToPointParameter(a,b);d=d||new n;return this.delta(d).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); +this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});Object.assign(ab,{normal:function(){var a=new n;return function(f,b,d,c){c=c||new n;c.subVectors(d,b);a.subVectors(f,b);c.cross(a);f=c.lengthSq();return 0=f.x+f.y}}()});Object.assign(ab.prototype,{set:function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this},setFromPointsAndIndices:function(a,b,d,c){this.a.copy(a[b]);this.b.copy(a[d]);this.c.copy(a[c]);return this},clone:function(){return(new this.constructor).copy(this)}, copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new n,b=new n;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new n).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return ab.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new Aa).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return ab.barycoordFromPoint(a, -this.a,this.b,this.c,b)},containsPoint:function(a){return ab.containsPoint(a,this.a,this.b,this.c)},closestPointToPoint:function(){var a=new Aa,b=[new fb,new fb,new fb],d=new n,c=new n;return function(e,h){h=h||new n;var k=Infinity;a.setFromCoplanarPoints(this.a,this.b,this.c);a.projectPoint(e,d);if(!0===this.containsPoint(d))h.copy(d);else for(b[0].set(this.a,this.b),b[1].set(this.b,this.c),b[2].set(this.c,this.a),e=0;eb.far?null:{distance:e,point:C.clone(),object:a}}function d(e,d,c,h,k,n,g,r){f.fromBufferAttribute(h,n);q.fromBufferAttribute(h,g);l.fromBufferAttribute(h,r);if(e=b(e,e.material,d,c,f,q,l,x))k&&(v.fromBufferAttribute(k,n),w.fromBufferAttribute(k, -g),y.fromBufferAttribute(k,r),e.uv=a(x,f,q,l,v,w,y)),e.face=new cb(n,g,r,ab.normal(f,q,l)),e.faceIndex=n;return e}var c=new p,h=new eb,k=new qa,f=new n,q=new n,l=new n,g=new n,t=new n,u=new n,v=new m,w=new m,y=new m,A=new n,x=new n,C=new n;return function(e,n){var r=this.geometry,p=this.material,m=this.matrixWorld;if(void 0!==p&&(null===r.boundingSphere&&r.computeBoundingSphere(),k.copy(r.boundingSphere),k.applyMatrix4(m),!1!==e.ray.intersectsSphere(k)&&(c.getInverse(m),h.copy(e.ray).applyMatrix4(c), -null===r.boundingBox||!1!==h.intersectsBox(r.boundingBox)))){var B;if(r.isBufferGeometry){var A,C,p=r.index,I=r.attributes.position,m=r.attributes.uv,z,E;if(null!==p)for(z=0,E=p.count;zb.far?null:{distance:f,point:C.clone(),object:a}}function d(f,d,c,h,k,n,l,r){g.fromBufferAttribute(h,n);q.fromBufferAttribute(h,l);e.fromBufferAttribute(h,r);if(f=b(f,f.material,d,c,g,q,e,x))k&&(v.fromBufferAttribute(k,n),w.fromBufferAttribute(k, +l),y.fromBufferAttribute(k,r),f.uv=a(x,g,q,e,v,w,y)),f.face=new cb(n,l,r,ab.normal(g,q,e)),f.faceIndex=n;return f}var c=new p,h=new eb,k=new qa,g=new n,q=new n,e=new n,l=new n,t=new n,u=new n,v=new m,w=new m,y=new m,A=new n,x=new n,C=new n;return function(f,n){var r=this.geometry,p=this.material,m=this.matrixWorld;if(void 0!==p&&(null===r.boundingSphere&&r.computeBoundingSphere(),k.copy(r.boundingSphere),k.applyMatrix4(m),!1!==f.ray.intersectsSphere(k)&&(c.getInverse(m),h.copy(f.ray).applyMatrix4(c), +null===r.boundingBox||!1!==h.intersectsBox(r.boundingBox)))){var B;if(r.isBufferGeometry){var A,C,p=r.index,I=r.attributes.position,m=r.attributes.uv,z,E;if(null!==p)for(z=0,E=p.count;zh||(h=e.ray.origin.distanceTo(a),he.far||c.push({distance:h,point:a.clone(),face:null,object:this}))}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});Kc.prototype=Object.assign(Object.create(ba.prototype),{constructor:Kc,copy:function(a){ba.prototype.copy.call(this, -a,!1);a=a.levels;for(var e=0,b=a.length;e=d[c].distance)d[c-1].object.visible=!1,d[c].object.visible=!0;else break;for(;ch||(h=f.ray.origin.distanceTo(a),hf.far||c.push({distance:h,point:a.clone(),face:null,object:this}))}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});Kc.prototype=Object.assign(Object.create(ba.prototype),{constructor:Kc,copy:function(a){ba.prototype.copy.call(this, +a,!1);a=a.levels;for(var f=0,b=a.length;f=d[c].distance)d[c-1].object.visible=!1,d[c].object.visible=!0;else break;for(;ch||(g.applyMatrix4(this.matrixWorld),u=e.ray.origin.distanceTo(g),ue.far||c.push({distance:u,point:f.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else for(k=0,m=t.length/3-1;kh||(g.applyMatrix4(this.matrixWorld), -u=e.ray.origin.distanceTo(g),ue.far||c.push({distance:u,point:f.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else if(k.isGeometry)for(q=k.vertices,l=q.length,k=0;kh||(g.applyMatrix4(this.matrixWorld),u=e.ray.origin.distanceTo(g),ue.far||c.push({distance:u,point:f.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry, +return this};Ta.prototype=Object.assign(Object.create(ba.prototype),{constructor:Ta,isLine:!0,raycast:function(){var a=new p,b=new eb,d=new qa;return function(f,c){var h=f.linePrecision,h=h*h,k=this.geometry,g=this.matrixWorld;null===k.boundingSphere&&k.computeBoundingSphere();d.copy(k.boundingSphere);d.applyMatrix4(g);if(!1!==f.ray.intersectsSphere(d)){a.getInverse(g);b.copy(f.ray).applyMatrix4(a);var q=new n,e=new n,g=new n,l=new n,p=this&&this.isLineSegments?2:1;if(k.isBufferGeometry){var r=k.index, +t=k.attributes.position.array;if(null!==r)for(var r=r.array,k=0,m=r.length-1;kh||(l.applyMatrix4(this.matrixWorld),u=f.ray.origin.distanceTo(l),uf.far||c.push({distance:u,point:g.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else for(k=0,m=t.length/3-1;kh||(l.applyMatrix4(this.matrixWorld), +u=f.ray.origin.distanceTo(l),uf.far||c.push({distance:u,point:g.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else if(k.isGeometry)for(q=k.vertices,e=q.length,k=0;kh||(l.applyMatrix4(this.matrixWorld),u=f.ray.origin.distanceTo(l),uf.far||c.push({distance:u,point:g.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry, this.material)).copy(this)}});sa.prototype=Object.assign(Object.create(Ta.prototype),{constructor:sa,isLineSegments:!0});yd.prototype=Object.assign(Object.create(Ta.prototype),{constructor:yd,isLineLoop:!0});gb.prototype=Object.create(ha.prototype);gb.prototype.constructor=gb;gb.prototype.isPointsMaterial=!0;gb.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;return this};ac.prototype=Object.assign(Object.create(ba.prototype), -{constructor:ac,isPoints:!0,raycast:function(){var a=new p,b=new eb,d=new qa;return function(e,c){function h(a,d){var h=b.distanceSqToPoint(a);if(he.far||c.push({distance:f,distanceToRay:Math.sqrt(h),point:a.clone(),index:d,face:null,object:k})}}var k=this,f=this.geometry,q=this.matrixWorld,l=e.params.Points.threshold;null===f.boundingSphere&&f.computeBoundingSphere();d.copy(f.boundingSphere);d.applyMatrix4(q); -d.radius+=l;if(!1!==e.ray.intersectsSphere(d)){a.getInverse(q);b.copy(e.ray).applyMatrix4(a);var l=l/((this.scale.x+this.scale.y+this.scale.z)/3),g=l*l,l=new n;if(f.isBufferGeometry){var p=f.index,f=f.attributes.position.array;if(null!==p)for(var r=p.array,p=0,t=r.length;pf.far||c.push({distance:g,distanceToRay:Math.sqrt(h),point:a.clone(),index:d,face:null,object:k})}}var k=this,g=this.geometry,q=this.matrixWorld,e=f.params.Points.threshold;null===g.boundingSphere&&g.computeBoundingSphere();d.copy(g.boundingSphere);d.applyMatrix4(q); +d.radius+=e;if(!1!==f.ray.intersectsSphere(d)){a.getInverse(q);b.copy(f.ray).applyMatrix4(a);var e=e/((this.scale.x+this.scale.y+this.scale.z)/3),l=e*e,e=new n;if(g.isBufferGeometry){var p=g.index,g=g.attributes.position.array;if(null!==p)for(var r=p.array,p=0,t=r.length;pe)return null;var d=[],c=[],h=[],k,f,n;if(0=q--){console.warn('THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()'); -break}k=f;e<=k&&(k=0);f=k+1;e<=f&&(f=0);n=f+1;e<=n&&(n=0);var l;a:{var g,p,r,t,m,u,v,w;g=a[c[k]].x;p=a[c[k]].y;r=a[c[f]].x;t=a[c[f]].y;m=a[c[n]].x;u=a[c[n]].y;if(0>=(r-g)*(u-p)-(t-p)*(m-g))l=!1;else{var y,A,x,C,z,E,F,D,L,U;y=m-r;A=u-t;x=g-m;C=p-u;z=r-g;E=t-p;for(l=0;l=-Number.EPSILON&&D>=-Number.EPSILON&&F>=-Number.EPSILON)){l=!1;break a}l=!0}}if(l){d.push([a[c[k]], -a[c[f]],a[c[n]]]);h.push([c[k],c[f],c[n]]);k=f;for(n=f+1;nNumber.EPSILON){if(0r||r>p)return[];n=q*l-n* -g;if(0>n||n>p)return[]}else{if(0b?[]:n===b?h?[]:[k]:a<=b?[k,f]:[k,q]}function h(a,e,b,d){var c=e.x-a.x,h=e.y-a.y;e=b.x-a.x;b=b.y-a.y;var k=d.x-a.x;d=d.y-a.y;a=c*b-h*e;c=c*d-h*k;return Math.abs(a)>Number.EPSILON?(e=k*b-d*e,0d&&(d=b);var c=a+1;c>b&&(c=0);b=h(f[a],f[d],f[c],n[e]);if(!b)return!1;b=n.length-1;d=e-1;0>d&&(d=b);c=e+1;c>b&&(c=0);return h(n[e],n[d],n[c],f[a])?!0:!1}function d(a,e){var b,d;for(b=0;by){console.log('Infinite Loop! Holes left:'+q.length+', Probably Hole outside Shape!');break}for(l=m;ln;n++)q=a[n].x+':'+a[n].y,q=l[q],void 0!==q&&(a[n]=q);return b.concat()},isClockWise:function(a){return 0>ib.area(a)}};Bb.prototype=Object.create(aa.prototype);Bb.prototype.constructor=Bb;hb.prototype=Object.create(da.prototype);hb.prototype.constructor=hb;hb.prototype.getArrays=function(){var a= -this.getAttribute('position'),a=a?Array.prototype.slice.call(a.array):[],b=this.getAttribute('uv'),b=b?Array.prototype.slice.call(b.array):[],d=this.index,d=d?Array.prototype.slice.call(d.array):[];return{position:a,uv:b,index:d}};hb.prototype.addShapeList=function(a,b){var e=a.length;b.arrays=this.getArrays();for(var d=0;dNumber.EPSILON){var n=Math.sqrt(f),q=Math.sqrt(d*d+k*k),f=e.x-h/n;e=e.y+c/n;k=((b.x-k/q-f)*k-(b.y+d/q-e)*d)/(c*k-h*d);d=f+c*k-a.x;c=e+h*k-a.y;h=d*d+c*c;if(2>=h)return new m(d,c);h=Math.sqrt(h/2)}else a=!1,c>Number.EPSILON?d>Number.EPSILON&&(a=!0):c<-Number.EPSILON? -d<-Number.EPSILON&&(a=!0):Math.sign(h)===Math.sign(k)&&(a=!0),a?(d=-h,h=Math.sqrt(f)):(d=c,c=h,h=Math.sqrt(f/2));return new m(d/h,c/h)}function c(a,e){var b,d;for(R=a.length;0<=--R;){b=R;d=R-1;0>d&&(d=a.length-1);var c,h=x+2*w;for(c=0;cf)return null;var d=[],c=[],h=[],k,g,n;if(0=q--){console.warn('THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()'); +break}k=g;f<=k&&(k=0);g=k+1;f<=g&&(g=0);n=g+1;f<=n&&(n=0);var e;a:{var l,p,r,t,m,u,v,w;l=a[c[k]].x;p=a[c[k]].y;r=a[c[g]].x;t=a[c[g]].y;m=a[c[n]].x;u=a[c[n]].y;if(0>=(r-l)*(u-p)-(t-p)*(m-l))e=!1;else{var y,A,x,C,z,E,F,D,L,U;y=m-r;A=u-t;x=l-m;C=p-u;z=r-l;E=t-p;for(e=0;e=-Number.EPSILON&&D>=-Number.EPSILON&&F>=-Number.EPSILON)){e=!1;break a}e=!0}}if(e){d.push([a[c[k]], +a[c[g]],a[c[n]]]);h.push([c[k],c[g],c[n]]);k=g;for(n=g+1;nNumber.EPSILON){if(0r||r>p)return[];n=q*e-n* +l;if(0>n||n>p)return[]}else{if(0b?[]:n===b?h?[]:[k]:a<=b?[k,g]:[k,q]}function h(a,f,b,d){var c=f.x-a.x,h=f.y-a.y;f=b.x-a.x;b=b.y-a.y;var k=d.x-a.x;d=d.y-a.y;a=c*b-h*f;c=c*d-h*k;return Math.abs(a)>Number.EPSILON?(f=k*b-d*f,0d&&(d=b);var c=a+1;c>b&&(c=0);b=h(g[a],g[d],g[c],n[f]);if(!b)return!1;b=n.length-1;d=f-1;0>d&&(d=b);c=f+1;c>b&&(c=0);return h(n[f],n[d],n[c],g[a])?!0:!1}function d(a,f){var b,d;for(b=0;by){console.log('Infinite Loop! Holes left:'+q.length+', Probably Hole outside Shape!');break}for(e=m;en;n++)q=a[n].x+':'+a[n].y,q=e[q],void 0!==q&&(a[n]=q);return b.concat()},isClockWise:function(a){return 0>ib.area(a)}};Bb.prototype=Object.create(aa.prototype);Bb.prototype.constructor=Bb;hb.prototype=Object.create(da.prototype);hb.prototype.constructor=hb;hb.prototype.getArrays=function(){var a= +this.getAttribute('position'),a=a?Array.prototype.slice.call(a.array):[],b=this.getAttribute('uv'),b=b?Array.prototype.slice.call(b.array):[],d=this.index,d=d?Array.prototype.slice.call(d.array):[];return{position:a,uv:b,index:d}};hb.prototype.addShapeList=function(a,b){var f=a.length;b.arrays=this.getArrays();for(var d=0;dNumber.EPSILON){var n=Math.sqrt(g),q=Math.sqrt(d*d+k*k),g=f.x-h/n;f=f.y+c/n;k=((b.x-k/q-g)*k-(b.y+d/q-f)*d)/(c*k-h*d);d=g+c*k-a.x;c=f+h*k-a.y;h=d*d+c*c;if(2>=h)return new m(d,c);h=Math.sqrt(h/2)}else a=!1,c>Number.EPSILON?d>Number.EPSILON&&(a=!0):c<-Number.EPSILON? +d<-Number.EPSILON&&(a=!0):Math.sign(h)===Math.sign(k)&&(a=!0),a?(d=-h,h=Math.sqrt(g)):(d=c,c=h,h=Math.sqrt(g/2));return new m(d/h,c/h)}function c(a,f){var b,d;for(R=a.length;0<=--R;){b=R;d=R-1;0>d&&(d=a.length-1);var c,h=x+2*w;for(c=0;cMath.abs(e-n)?[new m(a,1-d),new m(f,1-c),new m(q,1-h),new m(g,1-b)]:[new m(e,1-d),new m(n,1-c),new m(l,1-h),new m(p,1-b)]}};Xc.prototype=Object.create(aa.prototype);Xc.prototype.constructor=Xc;kc.prototype=Object.create(hb.prototype);kc.prototype.constructor=kc;Yc.prototype=Object.create(aa.prototype); +V[T],A=A.concat(G);var fa,N,O,X,P=A.length,S,pa=Z.length,C=[],R=0;N=J.length;a=N-1;for(fa=R+1;RMath.abs(f-n)?[new m(a,1-d),new m(g,1-c),new m(q,1-h),new m(l,1-b)]:[new m(f,1-d),new m(n,1-c),new m(e,1-h),new m(p,1-b)]}};Xc.prototype=Object.create(aa.prototype);Xc.prototype.constructor=Xc;kc.prototype=Object.create(hb.prototype);kc.prototype.constructor=kc;Yc.prototype=Object.create(aa.prototype); Yc.prototype.constructor=Yc;Fb.prototype=Object.create(da.prototype);Fb.prototype.constructor=Fb;Zc.prototype=Object.create(aa.prototype);Zc.prototype.constructor=Zc;lc.prototype=Object.create(da.prototype);lc.prototype.constructor=lc;$c.prototype=Object.create(aa.prototype);$c.prototype.constructor=$c;mc.prototype=Object.create(da.prototype);mc.prototype.constructor=mc;nc.prototype=Object.create(aa.prototype);nc.prototype.constructor=nc;oc.prototype=Object.create(da.prototype);oc.prototype.constructor= oc;pc.prototype=Object.create(da.prototype);pc.prototype.constructor=pc;Gb.prototype=Object.create(aa.prototype);Gb.prototype.constructor=Gb;vb.prototype=Object.create(da.prototype);vb.prototype.constructor=vb;ad.prototype=Object.create(Gb.prototype);ad.prototype.constructor=ad;bd.prototype=Object.create(vb.prototype);bd.prototype.constructor=bd;cd.prototype=Object.create(aa.prototype);cd.prototype.constructor=cd;qc.prototype=Object.create(da.prototype);qc.prototype.constructor=qc;var mb=Object.freeze({WireframeGeometry:cc, ParametricGeometry:Oc,ParametricBufferGeometry:dc,TetrahedronGeometry:Qc,TetrahedronBufferGeometry:ec,OctahedronGeometry:Rc,OctahedronBufferGeometry:Eb,IcosahedronGeometry:Sc,IcosahedronBufferGeometry:fc,DodecahedronGeometry:Tc,DodecahedronBufferGeometry:gc,PolyhedronGeometry:Pc,PolyhedronBufferGeometry:Ua,TubeGeometry:Uc,TubeBufferGeometry:hc,TorusKnotGeometry:Vc,TorusKnotBufferGeometry:ic,TorusGeometry:Wc,TorusBufferGeometry:jc,TextGeometry:Xc,TextBufferGeometry:kc,SphereGeometry:Yc,SphereBufferGeometry:Fb, @@ -630,191 +630,191 @@ a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLine Kb.prototype.constructor=Kb;Kb.prototype.isMeshLambertMaterial=!0;Kb.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity= a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Lb.prototype=Object.create(ha.prototype);Lb.prototype.constructor=Lb;Lb.prototype.isLineDashedMaterial=!0;Lb.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color); this.linewidth=a.linewidth;this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Gf=Object.freeze({ShadowMaterial:rc,SpriteMaterial:Ab,RawShaderMaterial:sc,ShaderMaterial:ua,PointsMaterial:gb,MeshPhysicalMaterial:Hb,MeshStandardMaterial:tb,MeshPhongMaterial:jb,MeshToonMaterial:Ib,MeshNormalMaterial:Jb,MeshLambertMaterial:Kb,MeshDepthMaterial:ea,MeshBasicMaterial:Ia,LineDashedMaterial:Lb,LineBasicMaterial:va,Material:ha}),sd={enabled:!1,files:{},add:function(a,b){!1!== -this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},Wa=new ee;Object.assign(kb.prototype,{load:function(a,b,d,c){void 0===a&&(a='');void 0!==this.path&&(a=this.path+a);var e=this,h=sd.get(a);if(void 0!==h)return e.manager.itemStart(a),setTimeout(function(){b&&b(h);e.manager.itemEnd(a)},0),h;var k=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(k){var f=k[1],n=!!k[2],k=k[3],k=window.decodeURIComponent(k); -n&&(k=window.atob(k));try{var q,l=(this.responseType||'').toLowerCase();switch(l){case 'arraybuffer':case 'blob':q=new ArrayBuffer(k.length);for(var g=new Uint8Array(q),n=0;n=c)break a;else{h=e[1];a=c)break b}d=b;b= -0}}for(;b>>1,ab;)--h;++h;if(0!==c||h!==d)c>=h&&(h=Math.max(h, -1),c=h-1),d=this.getValueSize(),this.times=Ka.arraySlice(e,c,h),this.values=Ka.arraySlice(this.values,c*d,h*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error('THREE.KeyframeTrackPrototype: Invalid value size in track.',this),a=!1);var d=this.times,b=this.values,c=d.length;0===c&&(console.error('THREE.KeyframeTrackPrototype: Track is empty.',this),a=!1);for(var h=null,k=0;k!==c;k++){var f=d[k];if('number'===typeof f&&isNaN(f)){console.error('THREE.KeyframeTrackPrototype: Time is not a valid number.', -this,k,f);a=!1;break}if(null!==h&&h>f){console.error('THREE.KeyframeTrackPrototype: Out of order keys.',this,k,f,h);a=!1;break}h=f}if(void 0!==b&&Ka.isTypedArray(b))for(k=0,d=b.length;k!==d;++k)if(c=b[k],isNaN(c)){console.error('THREE.KeyframeTrackPrototype: Value is not a valid number.',this,k,c);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,d=this.getValueSize(),c=2302===this.getInterpolation(),h=1,k=a.length-1,f=1;f=c)break a;else{h=f[1];a=c)break b}d=b;b= +0}}for(;b>>1,ab;)--h;++h;if(0!==c||h!==d)c>=h&&(h=Math.max(h, +1),c=h-1),d=this.getValueSize(),this.times=Ka.arraySlice(f,c,h),this.values=Ka.arraySlice(this.values,c*d,h*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error('THREE.KeyframeTrackPrototype: Invalid value size in track.',this),a=!1);var d=this.times,b=this.values,c=d.length;0===c&&(console.error('THREE.KeyframeTrackPrototype: Track is empty.',this),a=!1);for(var h=null,k=0;k!==c;k++){var g=d[k];if('number'===typeof g&&isNaN(g)){console.error('THREE.KeyframeTrackPrototype: Time is not a valid number.', +this,k,g);a=!1;break}if(null!==h&&h>g){console.error('THREE.KeyframeTrackPrototype: Out of order keys.',this,k,g,h);a=!1;break}h=g}if(void 0!==b&&Ka.isTypedArray(b))for(k=0,d=b.length;k!==d;++k)if(c=b[k],isNaN(c)){console.error('THREE.KeyframeTrackPrototype: Value is not a valid number.',this,k,c);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,d=this.getValueSize(),c=2302===this.getInterpolation(),h=1,k=a.length-1,g=1;gq.opacity&&(q.transparent=!0);c.setTextures(n);return c.parse(q)}}()});Object.assign(ie.prototype,{load:function(a,b,d,c){var e=this,h=this.texturePath&&'string'===typeof this.texturePath?this.texturePath:vc.prototype.extractUrlBase(a),k=new kb(this.manager); -k.setWithCredentials(this.withCredentials);k.load(a,function(d){d=JSON.parse(d);var c=d.metadata;if(void 0!==c&&(c=c.type,void 0!==c)){if('object'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.ObjectLoader instead.');return}if('scene'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.SceneLoader instead.');return}}d=e.parse(d,h);b(d.geometry,d.materials)},d,c)},setTexturePath:function(a){this.texturePath=a},parse:function(){return function(a, -b){void 0!==a.data&&(a=a.data);a.scale=void 0!==a.scale?1/a.scale:1;var e=new aa,d=a,c,h,k,f,q,g,p,r,t,u,v,w,y,A,x=d.faces;t=d.vertices;var C=d.normals,z=d.colors;g=d.scale;var E=0;if(void 0!==d.uvs){for(c=0;ch;h++)r=x[f++],A=y[2*r],r=y[2*r+1],A=new m(A,r),2!==h&&e.faceVertexUvs[c][k].push(A),0!==h&&e.faceVertexUvs[c][k+1].push(A);p&&(p=3*x[f++],u.normal.set(C[p++],C[p++],C[p]),w.normal.copy(u.normal));if(v)for(c=0;4>c;c++)p=3*x[f++],v=new n(C[p++],C[p++],C[p]),2!==c&&u.vertexNormals.push(v),0!==c&& -w.vertexNormals.push(v);g&&(g=x[f++],g=z[g],u.color.setHex(g),w.color.setHex(g));if(t)for(c=0;4>c;c++)g=x[f++],g=z[g],2!==c&&u.vertexColors.push(new Y(g)),0!==c&&w.vertexColors.push(new Y(g));e.faces.push(u);e.faces.push(w)}else{u=new cb;u.a=x[f++];u.b=x[f++];u.c=x[f++];k&&(k=x[f++],u.materialIndex=k);k=e.faces.length;if(c)for(c=0;ch;h++)r=x[f++],A=y[2*r],r=y[2*r+1],A=new m(A,r),e.faceVertexUvs[c][k].push(A);p&&(p=3*x[f++],u.normal.set(C[p++],C[p++], -C[p]));if(v)for(c=0;3>c;c++)p=3*x[f++],v=new n(C[p++],C[p++],C[p]),u.vertexNormals.push(v);g&&(g=x[f++],u.color.setHex(z[g]));if(t)for(c=0;3>c;c++)g=x[f++],u.vertexColors.push(new Y(z[g]));e.faces.push(u)}d=a;f=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(q=0,x=d.skinWeights.length;qf)b=d+1;else if(0e&&(e=0);1Number.EPSILON&&(f.normalize(),e=Math.acos(ka.clamp(d[q-1].dot(d[q]),-1,1)),c[q].applyMatrix4(k.makeRotationAxis(f,e))),h[q].crossVectors(d[q],c[q]);if(!0===b)for(e= -Math.acos(ka.clamp(c[0].dot(c[a]),-1,1)),e/=a,0=e)return e=b[a]-e,a=this.curves[a],b=a.getLength(),a.getPointAt(0=== -b?0:1-e/b);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,d=0,c=this.curves.length;db;)b+=e;for(;b>e;)b-=e;be.length-2?e.length-1:a+1],e=e[a>e.length-3?e.length- -1:a+2];return new m(Ne(b,d.x,c.x,h.x,e.x),Ne(b,d.y,c.y,h.y,e.y))};wc.prototype=Object.create(Pa.prototype);wc.prototype.constructor=wc;wc.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2,c=this.v3;return new m(Qb(a,e.x,b.x,d.x,c.x),Qb(a,e.y,b.y,d.y,c.y))};xc.prototype=Object.create(Pa.prototype);xc.prototype.constructor=xc;xc.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2;return new m(Pb(a,e.x,b.x,d.x),Pb(a,e.y,b.y,d.y))};var ze=Object.assign(Object.create(gd.prototype), -{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var e=1,b=a.length;eNumber.EPSILON){if(0>q&&(f=e[h],n=-n,k=e[c],q=-q),!(a.yk.y))if(a.y===f.y){if(a.x===f.x)return!0}else{c=q*(a.x-f.x)-n*(a.y-f.y);if(0===c)return!0;0>c||(d=!d)}}else if(a.y===f.y&&(k.x<=a.x&&a.x<=f.x||f.x<=a.x&&a.x<=k.x))return!0}return d}var c=ib.isClockWise,h=this.subPaths;if(0===h.length)return[];if(!0===b)return e(h);var f,k,n=[];if(1===h.length)return f= -h[0],k=new Sb,k.curves=f.curves,n.push(k),n;var q=!c(h[0].getPoints()),q=a?!q:q;k=[];var l=[],g=[],p=0,t;l[p]=void 0;g[p]=[];for(var u=0,m=h.length;uq.opacity&&(q.transparent=!0);c.setTextures(n);return c.parse(q)}}()});Object.assign(ie.prototype,{load:function(a,b,d,c){var f=this,h=this.texturePath&&'string'===typeof this.texturePath?this.texturePath:vc.prototype.extractUrlBase(a),k=new kb(this.manager); +k.setWithCredentials(this.withCredentials);k.load(a,function(d){d=JSON.parse(d);var c=d.metadata;if(void 0!==c&&(c=c.type,void 0!==c)){if('object'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.ObjectLoader instead.');return}if('scene'===c.toLowerCase()){console.error('THREE.JSONLoader: '+a+' should be loaded with THREE.SceneLoader instead.');return}}d=f.parse(d,h);b(d.geometry,d.materials)},d,c)},setTexturePath:function(a){this.texturePath=a},parse:function(){return function(a, +b){void 0!==a.data&&(a=a.data);a.scale=void 0!==a.scale?1/a.scale:1;var f=new aa,d=a,c,h,k,g,q,e,p,r,t,u,v,w,y,A,x=d.faces;t=d.vertices;var C=d.normals,z=d.colors;e=d.scale;var E=0;if(void 0!==d.uvs){for(c=0;ch;h++)r=x[g++],A=y[2*r],r=y[2*r+1],A=new m(A,r),2!==h&&f.faceVertexUvs[c][k].push(A),0!==h&&f.faceVertexUvs[c][k+1].push(A);p&&(p=3*x[g++],u.normal.set(C[p++],C[p++],C[p]),w.normal.copy(u.normal));if(v)for(c=0;4>c;c++)p=3*x[g++],v=new n(C[p++],C[p++],C[p]),2!==c&&u.vertexNormals.push(v),0!==c&& +w.vertexNormals.push(v);e&&(e=x[g++],e=z[e],u.color.setHex(e),w.color.setHex(e));if(t)for(c=0;4>c;c++)e=x[g++],e=z[e],2!==c&&u.vertexColors.push(new Y(e)),0!==c&&w.vertexColors.push(new Y(e));f.faces.push(u);f.faces.push(w)}else{u=new cb;u.a=x[g++];u.b=x[g++];u.c=x[g++];k&&(k=x[g++],u.materialIndex=k);k=f.faces.length;if(c)for(c=0;ch;h++)r=x[g++],A=y[2*r],r=y[2*r+1],A=new m(A,r),f.faceVertexUvs[c][k].push(A);p&&(p=3*x[g++],u.normal.set(C[p++],C[p++], +C[p]));if(v)for(c=0;3>c;c++)p=3*x[g++],v=new n(C[p++],C[p++],C[p]),u.vertexNormals.push(v);e&&(e=x[g++],u.color.setHex(z[e]));if(t)for(c=0;3>c;c++)e=x[g++],u.vertexColors.push(new Y(z[e]));f.faces.push(u)}d=a;g=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(q=0,x=d.skinWeights.length;qg)b=d+1;else if(0f&&(f=0);1Number.EPSILON&&(g.normalize(),f=Math.acos(ka.clamp(d[q-1].dot(d[q]),-1,1)),c[q].applyMatrix4(k.makeRotationAxis(g,f))),h[q].crossVectors(d[q],c[q]);if(!0===b)for(f= +Math.acos(ka.clamp(c[0].dot(c[a]),-1,1)),f/=a,0=f)return f=b[a]-f,a=this.curves[a],b=a.getLength(),a.getPointAt(0=== +b?0:1-f/b);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,d=0,c=this.curves.length;db;)b+=f;for(;b>f;)b-=f;bf.length-2?f.length-1:a+1],f=f[a>f.length-3?f.length- +1:a+2];return new m(Ne(b,d.x,c.x,h.x,f.x),Ne(b,d.y,c.y,h.y,f.y))};wc.prototype=Object.create(Pa.prototype);wc.prototype.constructor=wc;wc.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2,c=this.v3;return new m(Qb(a,f.x,b.x,d.x,c.x),Qb(a,f.y,b.y,d.y,c.y))};xc.prototype=Object.create(Pa.prototype);xc.prototype.constructor=xc;xc.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2;return new m(Pb(a,f.x,b.x,d.x),Pb(a,f.y,b.y,d.y))};var ze=Object.assign(Object.create(gd.prototype), +{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var f=1,b=a.length;fNumber.EPSILON){if(0>q&&(g=f[h],n=-n,k=f[c],q=-q),!(a.yk.y))if(a.y===g.y){if(a.x===g.x)return!0}else{c=q*(a.x-g.x)-n*(a.y-g.y);if(0===c)return!0;0>c||(d=!d)}}else if(a.y===g.y&&(k.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=k.x))return!0}return d}var c=ib.isClockWise,h=this.subPaths;if(0===h.length)return[];if(!0===b)return f(h);var g,k,n=[];if(1===h.length)return g= +h[0],k=new Sb,k.curves=g.curves,n.push(k),n;var q=!c(h[0].getPoints()),q=a?!q:q;k=[];var e=[],l=[],p=0,t;e[p]=void 0;l[p]=[];for(var u=0,m=h.length;ud&&this._mixBufferRegion(b,a,3*e,1-d,e);for(var d=e,h=e+e;d!==h;++d)if(b[d]!==b[d+e]){c.setValue(b,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,d=3*b;this.binding.getValue(a,d);for(var c=b;c!==d;++c)a[c]=a[d+c%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, -b,d,c,h){if(.5<=c)for(c=0;c!==h;++c)a[b+c]=a[d+c]},_slerp:function(a,b,d,c){k.slerpFlat(a,b,a,b,a,d,c)},_lerp:function(a,b,d,c,h){for(var e=1-c,f=0;f!==h;++f){var k=b+f;a[k]=a[k]*e+a[d+f]*c}}});Object.assign(Qe.prototype,{getValue:function(a,b){this.bind();var e=this._bindings[this._targetGroup.nCachedObjects_];void 0!==e&&e.getValue(a,b)},setValue:function(a,b){for(var e=this._bindings,d=this._targetGroup.nCachedObjects_,c=e.length;d!==c;++d)e[d].setValue(a,b)},bind:function(){for(var a=this._bindings, +a},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(a){this.panner.rolloffFactor=a},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(a){this.panner.distanceModel=a},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(a){this.panner.maxDistance=a},updateMatrixWorld:function(){var a=new n;return function(f){ba.prototype.updateMatrixWorld.call(this,f);a.setFromMatrixPosition(this.matrixWorld); +this.panner.setPosition(a.x,a.y,a.z)}}()});Object.assign(pe.prototype,{getFrequencyData:function(){this.analyser.getByteFrequencyData(this.data);return this.data},getAverageFrequency:function(){for(var a=0,b=this.getFrequencyData(),d=0;dd&&this._mixBufferRegion(b,a,3*f,1-d,f);for(var d=f,h=f+f;d!==h;++d)if(b[d]!==b[d+f]){c.setValue(b,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,d=3*b;this.binding.getValue(a,d);for(var c=b;c!==d;++c)a[c]=a[d+c%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, +b,d,c,h){if(.5<=c)for(c=0;c!==h;++c)a[b+c]=a[d+c]},_slerp:function(a,b,d,c){k.slerpFlat(a,b,a,b,a,d,c)},_lerp:function(a,b,d,c,h){for(var f=1-c,g=0;g!==h;++g){var k=b+g;a[k]=a[k]*f+a[d+g]*c}}});Object.assign(Qe.prototype,{getValue:function(a,b){this.bind();var f=this._bindings[this._targetGroup.nCachedObjects_];void 0!==f&&f.getValue(a,b)},setValue:function(a,b){for(var f=this._bindings,d=this._targetGroup.nCachedObjects_,c=f.length;d!==c;++d)f[d].setValue(a,b)},bind:function(){for(var a=this._bindings, b=this._targetGroup.nCachedObjects_,d=a.length;b!==d;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,d=a.length;b!==d;++b)a[b].unbind()}});Object.assign(La,{Composite:Qe,create:function(a,b,d){return a&&a.isAnimationObjectGroup?new La.Composite(a,b,d):new La(a,b,d)},sanitizeNodeName:function(a){return a.replace(/\s/g,'_').replace(/[^\w-]/g,'')},parseTrackName:function(){var a=new RegExp('^'+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+ -/\.([\w-]+)(?:\[(.+)\])?/.source+'$'),b=['material','materials','bones'];return function(e){var d=a.exec(e);if(!d)throw Error('PropertyBinding: Cannot parse trackName: '+e);var d={nodeName:d[2],objectName:d[3],objectIndex:d[4],propertyName:d[5],propertyIndex:d[6]},c=d.nodeName&&d.nodeName.lastIndexOf('.');if(void 0!==c&&-1!==c){var h=d.nodeName.substring(c+1);-1!==b.indexOf(h)&&(d.nodeName=d.nodeName.substring(0,c),d.objectName=h)}if(null===d.propertyName||0===d.propertyName.length)throw Error('PropertyBinding: can not parse propertyName from trackName: '+ -e);return d}}(),findNode:function(a,b){if(!b||''===b||'root'===b||'.'===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var e=function(a){for(var e=0;e=b){var g=b++,p=e[g];d[p.uuid]=l;e[l]=p;d[q]=g;e[g]=n;n=0;for(q=h;n!==q;++n){var p=c[n], -t=p[l];p[l]=p[g];p[g]=t}}}this.nCachedObjects_=b},uncache:function(a){for(var e=this._objects,b=e.length,d=this.nCachedObjects_,c=this._indicesByUUID,h=this._bindings,f=h.length,k=0,n=arguments.length;k!==n;++k){var q=arguments[k].uuid,l=c[q];if(void 0!==l)if(delete c[q],l=b){var l=b++,p=f[l];d[p.uuid]=e;f[e]=p;d[q]=l;f[l]=n;n=0;for(q=h;n!==q;++n){var p=c[n], +t=p[e];p[e]=p[l];p[l]=t}}}this.nCachedObjects_=b},uncache:function(a){for(var f=this._objects,b=f.length,d=this.nCachedObjects_,c=this._indicesByUUID,h=this._bindings,g=h.length,k=0,n=arguments.length;k!==n;++k){var q=arguments[k].uuid,e=c[q];if(void 0!==e)if(delete c[q],eb||0===d)return;this._startTime=null;b*=d}b*=this._updateTimeScale(a);d=this._updateTime(b);a=this._updateWeight(a);if(0b.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(a){var e=0;if(!this.paused){var e=this.timeScale,b=this._timeScaleInterpolant;if(null!==b){var d=b.evaluate(a)[0], -e=e*d;a>b.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e},_updateTime:function(a){var e=this.time+a;if(0===a)return e;var b=this._clip.duration,d=this.loop,c=this._loopCount;if(2200===d)a:{if(-1===c&&(this._loopCount=0,this._setEndings(!0,!0,!1)),e>=b)e=b;else if(0>e)e=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:'finished',action:this,direction:0>a?-1:1})}else{d=2202===d; --1===c&&(0<=a?(c=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(e>=b||0>e){var h=Math.floor(e/b),e=e-b*h,c=c+Math.abs(h),f=this.repetitions-c;0>f?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=c,this._mixer.dispatchEvent({type:'loop',action:this,loopDelta:h}))}if(d&&1===(c&1))return this.time= -e,b-e}return this.time=e},_setEndings:function(a,b,d){var e=this._interpolantSettings;d?(e.endingStart=2401,e.endingEnd=2401):(e.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,e.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,d){var e=this._mixer,c=e.time,h=this._weightInterpolant;null===h&&(this._weightInterpolant=h=e._lendControlInterpolant());e=h.parameterPositions;h=h.sampleValues;e[0]=c;h[0]=b;e[1]=c+a;h[1]=d;return this}});Object.assign(Te.prototype,g.prototype, -{_bindAction:function(a,b){var e=a._localRoot||this._root,d=a._clip.tracks,c=d.length,h=a._propertyBindings;a=a._interpolants;var f=e.uuid,k=this._bindingsByRootAndName,n=k[f];void 0===n&&(n={},k[f]=n);for(k=0;k!==c;++k){var q=d[k],l=q.name,g=n[l];if(void 0===g){g=h[k];if(void 0!==g){null===g._cacheIndex&&(++g.referenceCount,this._addInactiveBinding(g,f,l));continue}g=new qe(La.create(e,l,b&&b._propertyBindings[k].binding.parsedPath),q.ValueTypeName,q.getValueSize());++g.referenceCount;this._addInactiveBinding(g, -f,l)}h[k]=g;a[k].resultBuffer=g.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var e=(a._localRoot||this._root).uuid,b=a._clip.uuid,d=this._actionsByClip[b];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,b,e)}e=a._propertyBindings;b=0;for(d=e.length;b!==d;++b){var c=e[b];0===c.useCount++&&(this._lendBinding(c),c.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var e=a._propertyBindings, -b=0,d=e.length;b!==d;++b){var c=e[b];0===--c.useCount&&(c.restoreOriginalState(),this._takeBackBinding(c))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length}, -get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&ab||0===d)return;this._startTime=null;b*=d}b*=this._updateTimeScale(a);d=this._updateTime(b);a=this._updateWeight(a);if(0b.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=f},_updateTimeScale:function(a){var f=0;if(!this.paused){var f=this.timeScale,b=this._timeScaleInterpolant;if(null!==b){var d=b.evaluate(a)[0], +f=f*d;a>b.parameterPositions[1]&&(this.stopWarping(),0===f?this.paused=!0:this.timeScale=f)}}return this._effectiveTimeScale=f},_updateTime:function(a){var f=this.time+a;if(0===a)return f;var b=this._clip.duration,d=this.loop,c=this._loopCount;if(2200===d)a:{if(-1===c&&(this._loopCount=0,this._setEndings(!0,!0,!1)),f>=b)f=b;else if(0>f)f=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:'finished',action:this,direction:0>a?-1:1})}else{d=2202===d; +-1===c&&(0<=a?(c=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(f>=b||0>f){var h=Math.floor(f/b),f=f-b*h,c=c+Math.abs(h),g=this.repetitions-c;0>g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,f=0a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=c,this._mixer.dispatchEvent({type:'loop',action:this,loopDelta:h}))}if(d&&1===(c&1))return this.time= +f,b-f}return this.time=f},_setEndings:function(a,b,d){var f=this._interpolantSettings;d?(f.endingStart=2401,f.endingEnd=2401):(f.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,f.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,d){var f=this._mixer,c=f.time,h=this._weightInterpolant;null===h&&(this._weightInterpolant=h=f._lendControlInterpolant());f=h.parameterPositions;h=h.sampleValues;f[0]=c;h[0]=b;f[1]=c+a;h[1]=d;return this}});Object.assign(Te.prototype,e.prototype, +{_bindAction:function(a,b){var f=a._localRoot||this._root,d=a._clip.tracks,c=d.length,h=a._propertyBindings;a=a._interpolants;var g=f.uuid,k=this._bindingsByRootAndName,n=k[g];void 0===n&&(n={},k[g]=n);for(k=0;k!==c;++k){var q=d[k],e=q.name,l=n[e];if(void 0===l){l=h[k];if(void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,g,e));continue}l=new qe(La.create(f,e,b&&b._propertyBindings[k].binding.parsedPath),q.ValueTypeName,q.getValueSize());++l.referenceCount;this._addInactiveBinding(l, +g,e)}h[k]=l;a[k].resultBuffer=l.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var f=(a._localRoot||this._root).uuid,b=a._clip.uuid,d=this._actionsByClip[b];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,b,f)}f=a._propertyBindings;b=0;for(d=f.length;b!==d;++b){var c=f[b];0===c.useCount++&&(this._lendBinding(c),c.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var f=a._propertyBindings, +b=0,d=f.length;b!==d;++b){var c=f[b];0===--c.useCount&&(c.restoreOriginalState(),this._takeBackBinding(c))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length}, +get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&ak.end&&(k.end=h);b||(b=n)}}for(n in d)k=d[n],this.createAnimation(n,k.start,k.end,a);this.firstAnimation=b};Ha.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};Ha.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};Ha.prototype.setAnimationFPS=function(a,b){(a=this.animationsMap[a])&&(a.fps=b,a.duration=(a.end-a.start)/a.fps)};Ha.prototype.setAnimationDuration= -function(a,b){(a=this.animationsMap[a])&&(a.duration=b,a.fps=(a.end-a.start)/a.duration)};Ha.prototype.setAnimationWeight=function(a,b){(a=this.animationsMap[a])&&(a.weight=b)};Ha.prototype.setAnimationTime=function(a,b){(a=this.animationsMap[a])&&(a.time=b)};Ha.prototype.getAnimationTime=function(a){var e=0;if(a=this.animationsMap[a])e=a.time;return e};Ha.prototype.getAnimationDuration=function(a){var e=-1;if(a=this.animationsMap[a])e=a.duration;return e};Ha.prototype.playAnimation=function(a){var e= -this.animationsMap[a];e?(e.time=0,e.active=!0):console.warn('THREE.MorphBlendMesh: animation['+a+'] undefined in .playAnimation()')};Ha.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};Ha.prototype.update=function(a){for(var e=0,b=this.animationsList.length;ed.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards= -!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var h=d.start+ka.clamp(Math.floor(d.time/c),0,d.length-1),f=d.weight;h!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*f,this.morphTargetInfluences[h]=0,d.lastFrame=d.currentFrame,d.currentFrame=h);c=d.time%c/c;d.directionBackwards&&(c=1-c);d.currentFrame!==d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=c*f,this.morphTargetInfluences[d.lastFrame]= -(1-c)*f):this.morphTargetInfluences[d.currentFrame]=f}}};id.prototype=Object.create(ba.prototype);id.prototype.constructor=id;id.prototype.isImmediateRenderObject=!0;jd.prototype=Object.create(sa.prototype);jd.prototype.constructor=jd;jd.prototype.update=function(){var a=new n,b=new n,d=new ra;return function(){var e=['a','b','c'];this.object.updateMatrixWorld(!0);d.getNormalMatrix(this.object.matrixWorld);var c=this.object.matrixWorld,h=this.geometry.attributes.position,f=this.object.geometry;if(f&& -f.isGeometry)for(var k=f.vertices,n=f.faces,q=f=0,l=n.length;qd.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards= +!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var h=d.start+ka.clamp(Math.floor(d.time/c),0,d.length-1),g=d.weight;h!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[h]=0,d.lastFrame=d.currentFrame,d.currentFrame=h);c=d.time%c/c;d.directionBackwards&&(c=1-c);d.currentFrame!==d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=c*g,this.morphTargetInfluences[d.lastFrame]= +(1-c)*g):this.morphTargetInfluences[d.currentFrame]=g}}};id.prototype=Object.create(ba.prototype);id.prototype.constructor=id;id.prototype.isImmediateRenderObject=!0;jd.prototype=Object.create(sa.prototype);jd.prototype.constructor=jd;jd.prototype.update=function(){var a=new n,b=new n,d=new ra;return function(){var f=['a','b','c'];this.object.updateMatrixWorld(!0);d.getNormalMatrix(this.object.matrixWorld);var c=this.object.matrixWorld,h=this.geometry.attributes.position,g=this.object.geometry;if(g&& +g.isGeometry)for(var k=g.vertices,n=g.faces,q=g=0,e=n.length;qMath.abs(a)&&(a=1E-8);this.scale.set(.5*this.size,.5*this.size,a);this.lookAt(this.plane.normal); -this.updateMatrixWorld()};var Td,we;Ub.prototype=Object.create(ba.prototype);Ub.prototype.constructor=Ub;Ub.prototype.setDirection=function(){var a=new n,b;return function(e){.99999e.y?this.quaternion.set(1,0,0,0):(a.set(e.z,0,-e.x).normalize(),b=Math.acos(e.y),this.quaternion.setFromAxisAngle(a,b))}}();Ub.prototype.setLength=function(a,b,d){void 0===b&&(b=.2*a);void 0===d&&(d=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(d, -b,d);this.cone.position.y=a;this.cone.updateMatrix()};Ub.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};Ud.prototype=Object.create(sa.prototype);Ud.prototype.constructor=Ud;var Xd=new n,Ae=new xe,Be=new xe,Ce=new xe;lb.prototype=Object.create(Pa.prototype);lb.prototype.constructor=lb;lb.prototype.getPoint=function(a){var e=this.points,b=e.length;a*=b-(this.closed?0:1);var d=Math.floor(a);a-=d;this.closed?d+=0d&&(d=1);1E-4>b&&(b=d);1E-4>k&&(k=d);Ae.initNonuniformCatmullRom(c.x, -h.x,f.x,e.x,b,d,k);Be.initNonuniformCatmullRom(c.y,h.y,f.y,e.y,b,d,k);Ce.initNonuniformCatmullRom(c.z,h.z,f.z,e.z,b,d,k)}else'catmullrom'===this.type&&(b=void 0!==this.tension?this.tension:.5,Ae.initCatmullRom(c.x,h.x,f.x,e.x,b),Be.initCatmullRom(c.y,h.y,f.y,e.y,b),Ce.initCatmullRom(c.z,h.z,f.z,e.z,b));return new n(Ae.calc(a),Be.calc(a),Ce.calc(a))};pd.prototype=Object.create(Pa.prototype);pd.prototype.constructor=pd;pd.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2,c=this.v3;return new n(Qb(a, -e.x,b.x,d.x,c.x),Qb(a,e.y,b.y,d.y,c.y),Qb(a,e.z,b.z,d.z,c.z))};qd.prototype=Object.create(Pa.prototype);qd.prototype.constructor=qd;qd.prototype.getPoint=function(a){var e=this.v0,b=this.v1,d=this.v2;return new n(Pb(a,e.x,b.x,d.x),Pb(a,e.y,b.y,d.y),Pb(a,e.z,b.z,d.z))};rd.prototype=Object.create(Pa.prototype);rd.prototype.constructor=rd;rd.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var e=new n;e.subVectors(this.v2,this.v1);e.multiplyScalar(a);e.add(this.v1);return e};Vd.prototype= +this.updateMatrixWorld()};var Td,we;Ub.prototype=Object.create(ba.prototype);Ub.prototype.constructor=Ub;Ub.prototype.setDirection=function(){var a=new n,b;return function(f){.99999f.y?this.quaternion.set(1,0,0,0):(a.set(f.z,0,-f.x).normalize(),b=Math.acos(f.y),this.quaternion.setFromAxisAngle(a,b))}}();Ub.prototype.setLength=function(a,b,d){void 0===b&&(b=.2*a);void 0===d&&(d=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(d, +b,d);this.cone.position.y=a;this.cone.updateMatrix()};Ub.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};Ud.prototype=Object.create(sa.prototype);Ud.prototype.constructor=Ud;var Xd=new n,Ae=new xe,Be=new xe,Ce=new xe;lb.prototype=Object.create(Pa.prototype);lb.prototype.constructor=lb;lb.prototype.getPoint=function(a){var f=this.points,b=f.length;a*=b-(this.closed?0:1);var d=Math.floor(a);a-=d;this.closed?d+=0d&&(d=1);1E-4>b&&(b=d);1E-4>k&&(k=d);Ae.initNonuniformCatmullRom(c.x, +h.x,g.x,f.x,b,d,k);Be.initNonuniformCatmullRom(c.y,h.y,g.y,f.y,b,d,k);Ce.initNonuniformCatmullRom(c.z,h.z,g.z,f.z,b,d,k)}else'catmullrom'===this.type&&(b=void 0!==this.tension?this.tension:.5,Ae.initCatmullRom(c.x,h.x,g.x,f.x,b),Be.initCatmullRom(c.y,h.y,g.y,f.y,b),Ce.initCatmullRom(c.z,h.z,g.z,f.z,b));return new n(Ae.calc(a),Be.calc(a),Ce.calc(a))};pd.prototype=Object.create(Pa.prototype);pd.prototype.constructor=pd;pd.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2,c=this.v3;return new n(Qb(a, +f.x,b.x,d.x,c.x),Qb(a,f.y,b.y,d.y,c.y),Qb(a,f.z,b.z,d.z,c.z))};qd.prototype=Object.create(Pa.prototype);qd.prototype.constructor=qd;qd.prototype.getPoint=function(a){var f=this.v0,b=this.v1,d=this.v2;return new n(Pb(a,f.x,b.x,d.x),Pb(a,f.y,b.y,d.y),Pb(a,f.z,b.z,d.z))};rd.prototype=Object.create(Pa.prototype);rd.prototype.constructor=rd;rd.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var f=new n;f.subVectors(this.v2,this.v1);f.multiplyScalar(a);f.add(this.v1);return f};Vd.prototype= Object.create(wb.prototype);Vd.prototype.constructor=Vd;Pa.create=function(a,b){console.log('THREE.Curve.create() has been deprecated');a.prototype=Object.create(Pa.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};$e.prototype=Object.create(lb.prototype);af.prototype=Object.create(lb.prototype);ye.prototype=Object.create(lb.prototype);Object.assign(ye.prototype,{initFromArray:function(a){console.error('THREE.Spline: .initFromArray() has been removed.')},getControlPointsArray:function(a){console.error('THREE.Spline: .getControlPointsArray() has been removed.')}, reparametrizeByArcLength:function(a){console.error('THREE.Spline: .reparametrizeByArcLength() has been removed.')}});kd.prototype.setColors=function(){console.error('THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.')};Bc.prototype.update=function(){console.error('THREE.SkeletonHelper: update() no longer needs to be called.')};Object.assign(na.prototype,{center:function(a){console.warn('THREE.Box2: .center() has been renamed to .getCenter().');return this.getCenter(a)}, empty:function(){console.warn('THREE.Box2: .empty() has been renamed to .isEmpty().');return this.isEmpty()},isIntersectionBox:function(a){console.warn('THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().');return this.intersectsBox(a)},size:function(a){console.warn('THREE.Box2: .size() has been renamed to .getSize().');return this.getSize(a)}});Object.assign(ia.prototype,{center:function(a){console.warn('THREE.Box3: .center() has been renamed to .getCenter().');return this.getCenter(a)}, @@ -825,7 +825,7 @@ return this.copyPosition(a)},flattenToArrayOffset:function(a,b){console.warn('TH return this.makeRotationFromQuaternion(a)},multiplyToArray:function(){console.warn('THREE.Matrix4: .multiplyToArray() has been removed.')},multiplyVector3:function(a){console.warn('THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.');return a.applyMatrix4(this)},multiplyVector4:function(a){console.warn('THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.');return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.error('THREE.Matrix4: .multiplyVector3Array() has been removed.')}, rotateAxis:function(a){console.warn('THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.');a.transformDirection(this)},crossVector:function(a){console.warn('THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.');return a.applyMatrix4(this)},translate:function(){console.error('THREE.Matrix4: .translate() has been removed.')},rotateX:function(){console.error('THREE.Matrix4: .rotateX() has been removed.')},rotateY:function(){console.error('THREE.Matrix4: .rotateY() has been removed.')}, rotateZ:function(){console.error('THREE.Matrix4: .rotateZ() has been removed.')},rotateByAxis:function(){console.error('THREE.Matrix4: .rotateByAxis() has been removed.')},applyToBuffer:function(a,b,d){console.warn('THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.');return this.applyToBufferAttribute(a)},applyToVector3Array:function(a,b,d){console.error('THREE.Matrix4: .applyToVector3Array() has been removed.')},makeFrustum:function(a,b,d,c, -h,f){console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.');return this.makePerspective(a,b,c,d,h,f)}});Aa.prototype.isIntersectionLine=function(a){console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().');return this.intersectsLine(a)};k.prototype.multiplyVector3=function(a){console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.'); +h,g){console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.');return this.makePerspective(a,b,c,d,h,g)}});Aa.prototype.isIntersectionLine=function(a){console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().');return this.intersectsLine(a)};k.prototype.multiplyVector3=function(a){console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.'); return a.applyQuaternion(this)};Object.assign(eb.prototype,{isIntersectionBox:function(a){console.warn('THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().');return this.intersectsBox(a)},isIntersectionPlane:function(a){console.warn('THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().');return this.intersectsPlane(a)},isIntersectionSphere:function(a){console.warn('THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().');return this.intersectsSphere(a)}}); Object.assign(Sb.prototype,{extrude:function(a){console.warn('THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.');return new Bb(this,a)},makeGeometry:function(a){console.warn('THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.');return new nc(this,a)}});Object.assign(m.prototype,{fromAttribute:function(a,b,d){console.error('THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().');return this.fromBufferAttribute(a,b,d)}});Object.assign(n.prototype, {setEulerFromRotationMatrix:function(){console.error('THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.')},setEulerFromQuaternion:function(){console.error('THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.')},getPositionFromMatrix:function(a){console.warn('THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().');return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn('THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().'); @@ -847,18 +847,18 @@ return this.extensions.get('OES_standard_derivatives')},supportsCompressedTextur supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get('EXT_blend_minmax')},supportsVertexTextures:function(){console.warn('THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.');return this.capabilities.vertexTextures},supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."); return this.extensions.get('ANGLE_instanced_arrays')},enableScissorTest:function(a){console.warn('THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().');this.setScissorTest(a)},initMaterial:function(){console.warn('THREE.WebGLRenderer: .initMaterial() has been removed.')},addPrePlugin:function(){console.warn('THREE.WebGLRenderer: .addPrePlugin() has been removed.')},addPostPlugin:function(){console.warn('THREE.WebGLRenderer: .addPostPlugin() has been removed.')},updateShadowMap:function(){console.warn('THREE.WebGLRenderer: .updateShadowMap() has been removed.')}}); Object.defineProperties(ce.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn('THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.');this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn('THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.');this.shadowMap.type=a}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(a){console.warn('THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.'); -this.shadowMap.cullFace=a}}});Object.defineProperties(td.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a;console.warn('WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to '+a+'.');this.renderReverseSided=a}}});Object.defineProperties(f.prototype,{wrapS:{get:function(){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');return this.texture.wrapS},set:function(a){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); +this.shadowMap.cullFace=a}}});Object.defineProperties(td.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a;console.warn('WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to '+a+'.');this.renderReverseSided=a}}});Object.defineProperties(g.prototype,{wrapS:{get:function(){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');return this.texture.wrapS},set:function(a){console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); this.texture.wrapS=a}},wrapT:{get:function(){console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');return this.texture.wrapT},set:function(a){console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');this.texture.wrapT=a}},magFilter:{get:function(){console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');return this.texture.magFilter},set:function(a){console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');this.texture.magFilter= a}},minFilter:{get:function(){console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');return this.texture.minFilter},set:function(a){console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');this.texture.minFilter=a}},anisotropy:{get:function(){console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');return this.texture.anisotropy},set:function(a){console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');this.texture.anisotropy= a}},offset:{get:function(){console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');return this.texture.offset},set:function(a){console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');this.texture.offset=a}},repeat:{get:function(){console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');return this.texture.repeat},set:function(a){console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');this.texture.repeat=a}},format:{get:function(){console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'); return this.texture.format},set:function(a){console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.');this.texture.format=a}},type:{get:function(){console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');return this.texture.type},set:function(a){console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');this.texture.type=a}},generateMipmaps:{get:function(){console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');return this.texture.generateMipmaps}, set:function(a){console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');this.texture.generateMipmaps=a}}});yc.prototype.load=function(a){console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.');var b=this;(new le).load(a,function(a){b.setBuffer(a)});return this};pe.prototype.getData=function(){console.warn('THREE.AudioAnalyser: .getData() is now .getFrequencyData().');return this.getFrequencyData()};a.WebGLRenderTargetCube=c;a.WebGLRenderTarget= -f;a.WebGLRenderer=ce;a.ShaderLib=yb;a.UniformsLib=ja;a.UniformsUtils=Oa;a.ShaderChunk=ma;a.FogExp2=Zb;a.Fog=$b;a.Scene=vd;a.LensFlare=de;a.Sprite=Jc;a.LOD=Kc;a.SkinnedMesh=xd;a.Skeleton=Lc;a.Bone=wd;a.Mesh=ya;a.LineSegments=sa;a.LineLoop=yd;a.Line=Ta;a.Points=ac;a.Group=Mc;a.VideoTexture=zd;a.DataTexture=t;a.CompressedTexture=bc;a.CubeTexture=h;a.CanvasTexture=ca;a.DepthTexture=Nc;a.Texture=b;a.CompressedTextureLoader=Le;a.DataTextureLoader=fe;a.CubeTextureLoader=ge;a.TextureLoader=Ad;a.ObjectLoader= +g;a.WebGLRenderer=ce;a.ShaderLib=yb;a.UniformsLib=ja;a.UniformsUtils=Oa;a.ShaderChunk=ma;a.FogExp2=Zb;a.Fog=$b;a.Scene=vd;a.LensFlare=de;a.Sprite=Jc;a.LOD=Kc;a.SkinnedMesh=xd;a.Skeleton=Lc;a.Bone=wd;a.Mesh=ya;a.LineSegments=sa;a.LineLoop=yd;a.Line=Ta;a.Points=ac;a.Group=Mc;a.VideoTexture=zd;a.DataTexture=t;a.CompressedTexture=bc;a.CubeTexture=h;a.CanvasTexture=ca;a.DepthTexture=Nc;a.Texture=b;a.CompressedTextureLoader=Le;a.DataTextureLoader=fe;a.CubeTextureLoader=ge;a.TextureLoader=Ad;a.ObjectLoader= Me;a.MaterialLoader=Pd;a.BufferGeometryLoader=he;a.DefaultLoadingManager=Wa;a.LoadingManager=ee;a.JSONLoader=ie;a.ImageLoader=dd;a.FontLoader=Oe;a.FileLoader=kb;a.Loader=vc;a.Cache=sd;a.AudioLoader=le;a.SpotLightShadow=Cd;a.SpotLight=Dd;a.PointLight=Ed;a.RectAreaLight=Id;a.HemisphereLight=Bd;a.DirectionalLightShadow=Fd;a.DirectionalLight=Gd;a.AmbientLight=Hd;a.LightShadow=Mb;a.Light=za;a.StereoCamera=Pe;a.PerspectiveCamera=xa;a.OrthographicCamera=Qa;a.CubeCamera=Qd;a.ArrayCamera=ud;a.Camera=Ea;a.AudioListener= me;a.PositionalAudio=oe;a.AudioContext=ne;a.AudioAnalyser=pe;a.Audio=yc;a.VectorKeyframeTrack=tc;a.StringKeyframeTrack=Md;a.QuaternionKeyframeTrack=fd;a.NumberKeyframeTrack=uc;a.ColorKeyframeTrack=Od;a.BooleanKeyframeTrack=Nd;a.PropertyMixer=qe;a.PropertyBinding=La;a.KeyframeTrack=Ob;a.AnimationUtils=Ka;a.AnimationObjectGroup=Re;a.AnimationMixer=Te;a.AnimationClip=bb;a.Uniform=Rd;a.InstancedBufferGeometry=re;a.BufferGeometry=da;a.GeometryIdCount=function(){return $d++};a.Geometry=aa;a.InterleavedBufferAttribute= -se;a.InstancedInterleavedBuffer=te;a.InterleavedBuffer=zc;a.InstancedBufferAttribute=ue;a.Face3=cb;a.Object3D=ba;a.Raycaster=Ue;a.Layers=Gc;a.EventDispatcher=g;a.Clock=We;a.QuaternionLinearInterpolant=Ld;a.LinearInterpolant=ed;a.DiscreteInterpolant=Kd;a.CubicInterpolant=Jd;a.Interpolant=Xa;a.Triangle=ab;a.Math=ka;a.Spherical=Xe;a.Cylindrical=Ye;a.Plane=Aa;a.Frustum=Vb;a.Sphere=qa;a.Ray=eb;a.Matrix4=p;a.Matrix3=ra;a.Box3=ia;a.Box2=na;a.Line3=fb;a.Euler=nb;a.Vector4=l;a.Vector3=n;a.Vector2=m;a.Quaternion= +se;a.InstancedInterleavedBuffer=te;a.InterleavedBuffer=zc;a.InstancedBufferAttribute=ue;a.Face3=cb;a.Object3D=ba;a.Raycaster=Ue;a.Layers=Gc;a.EventDispatcher=e;a.Clock=We;a.QuaternionLinearInterpolant=Ld;a.LinearInterpolant=ed;a.DiscreteInterpolant=Kd;a.CubicInterpolant=Jd;a.Interpolant=Xa;a.Triangle=ab;a.Math=ka;a.Spherical=Xe;a.Cylindrical=Ye;a.Plane=Aa;a.Frustum=Vb;a.Sphere=qa;a.Ray=eb;a.Matrix4=p;a.Matrix3=ra;a.Box3=ia;a.Box2=na;a.Line3=fb;a.Euler=nb;a.Vector4=l;a.Vector3=n;a.Vector2=m;a.Quaternion= k;a.Color=Y;a.MorphBlendMesh=Ha;a.ImmediateRenderObject=id;a.VertexNormalsHelper=jd;a.SpotLightHelper=Ac;a.SkeletonHelper=Bc;a.PointLightHelper=Cc;a.RectAreaLightHelper=Dc;a.HemisphereLightHelper=Ec;a.GridHelper=kd;a.PolarGridHelper=Sd;a.FaceNormalsHelper=ld;a.DirectionalLightHelper=Fc;a.CameraHelper=md;a.BoxHelper=Tb;a.Box3Helper=nd;a.PlaneHelper=od;a.ArrowHelper=Ub;a.AxisHelper=Ud;a.CatmullRomCurve3=lb;a.CubicBezierCurve3=pd;a.QuadraticBezierCurve3=qd;a.LineCurve3=rd;a.ArcCurve=Vd;a.EllipseCurve= -wb;a.SplineCurve=Rb;a.CubicBezierCurve=wc;a.QuadraticBezierCurve=xc;a.LineCurve=ub;a.Shape=Sb;a.Path=hd;a.ShapePath=je;a.Font=ke;a.CurvePath=gd;a.Curve=Pa;a.ShapeUtils=ib;a.SceneUtils={createMultiMaterialObject:function(a,b){for(var e=new Mc,d=0,c=b.length;d=m[b])return b-1;if(g<=m[a])return a;for(var l=Math.floor((a+b)/2);g=m[l+1];)g=p&&(l[g][0]=l[a][0]/n[v+1][h],t=l[g][0]*n[h][v]);w=d-1<=v?p-1:m-d;for(c=-1<=h?1:-h;c<=w;++c)l[g][c]=(l[a][c]-l[a][c-1])/n[v+1][h+c],t+=l[g][c]*n[h+c][v];d<=v&&(l[g][p]=-l[a][p-1]/n[v+1][d],t+=l[g][p]*n[d][v]);k[p][d]=t;c=a;a=g;g=c}}d=m;for(p=1;p<=b;++p){for(c=0;c<=m;++c)k[p][c]*=d;d*=m-p}return k},calcBSplineDerivatives:function(a,g,m,b,l){var f=l (http://steffe.se)',keywords:['cannon.js','cannon','physics','engine','3d'],main:'./build/cannon.js',engines:{node:'*'},repository:{type:'git',url:'https://github.com/schteppe/cannon.js.git'}, -bugs:{url:'https://github.com/schteppe/cannon.js/issues'},licenses:[{type:'MIT'}],devDependencies:{jshint:'latest','uglify-js':'latest',nodeunit:'^0.9.0',grunt:'~0.4.0','grunt-contrib-jshint':'~0.1.1','grunt-contrib-nodeunit':'^0.4.1','grunt-contrib-concat':'~0.1.3','grunt-contrib-uglify':'^0.5.1','grunt-browserify':'^2.1.4','grunt-contrib-yuidoc':'^0.5.2',browserify:'*'},dependencies:{}}},{}],2:[function(g,m){m.exports={version:g('../package.json').version,AABB:g('./collision/AABB'),ArrayCollisionMatrix:g('./collision/ArrayCollisionMatrix'), -Body:g('./objects/Body'),Box:g('./shapes/Box'),Broadphase:g('./collision/Broadphase'),Constraint:g('./constraints/Constraint'),ContactEquation:g('./equations/ContactEquation'),Narrowphase:g('./world/Narrowphase'),ConeTwistConstraint:g('./constraints/ConeTwistConstraint'),ContactMaterial:g('./material/ContactMaterial'),ConvexPolyhedron:g('./shapes/ConvexPolyhedron'),Cylinder:g('./shapes/Cylinder'),DistanceConstraint:g('./constraints/DistanceConstraint'),Equation:g('./equations/Equation'),EventTarget:g('./utils/EventTarget'), -FrictionEquation:g('./equations/FrictionEquation'),GSSolver:g('./solver/GSSolver'),GridBroadphase:g('./collision/GridBroadphase'),Heightfield:g('./shapes/Heightfield'),HingeConstraint:g('./constraints/HingeConstraint'),LockConstraint:g('./constraints/LockConstraint'),Mat3:g('./math/Mat3'),Material:g('./material/Material'),NaiveBroadphase:g('./collision/NaiveBroadphase'),ObjectCollisionMatrix:g('./collision/ObjectCollisionMatrix'),Pool:g('./utils/Pool'),Particle:g('./shapes/Particle'),Plane:g('./shapes/Plane'), -PointToPointConstraint:g('./constraints/PointToPointConstraint'),Quaternion:g('./math/Quaternion'),Ray:g('./collision/Ray'),RaycastVehicle:g('./objects/RaycastVehicle'),RaycastResult:g('./collision/RaycastResult'),RigidVehicle:g('./objects/RigidVehicle'),RotationalEquation:g('./equations/RotationalEquation'),RotationalMotorEquation:g('./equations/RotationalMotorEquation'),SAPBroadphase:g('./collision/SAPBroadphase'),SPHSystem:g('./objects/SPHSystem'),Shape:g('./shapes/Shape'),Solver:g('./solver/Solver'), -Sphere:g('./shapes/Sphere'),SplitSolver:g('./solver/SplitSolver'),Spring:g('./objects/Spring'),Trimesh:g('./shapes/Trimesh'),Vec3:g('./math/Vec3'),Vec3Pool:g('./utils/Vec3Pool'),World:g('./world/World')}},{'../package.json':1,'./collision/AABB':3,'./collision/ArrayCollisionMatrix':4,'./collision/Broadphase':5,'./collision/GridBroadphase':6,'./collision/NaiveBroadphase':7,'./collision/ObjectCollisionMatrix':8,'./collision/Ray':9,'./collision/RaycastResult':10,'./collision/SAPBroadphase':11,'./constraints/ConeTwistConstraint':12, +THREE.NURBSSurface=function(a,e,m,b,l){this.degree1=a;this.degree2=e;this.knots1=m;this.knots2=b;this.controlPoints=[];a=m.length-a-1;e=b.length-e-1;for(b=0;b=m[b])return b-1;if(e<=m[a])return a;for(var l=Math.floor((a+b)/2);e=m[l+1];)e=p&&(l[e][0]=l[a][0]/n[v+1][h],t=l[e][0]*n[h][v]);w=d-1<=v?p-1:m-d;for(c=-1<=h?1:-h;c<=w;++c)l[e][c]=(l[a][c]-l[a][c-1])/n[v+1][h+c],t+=l[e][c]*n[h+c][v];d<=v&&(l[e][p]=-l[a][p-1]/n[v+1][d],t+=l[e][p]*n[d][v]);k[p][d]=t;c=a;a=e;e=c}}d=m;for(p=1;p<=b;++p){for(c=0;c<=m;++c)k[p][c]*=d;d*=m-p}return k},calcBSplineDerivatives:function(a,e,m,b,l){var g=l (http://steffe.se)',keywords:['cannon.js','cannon','physics','engine','3d'],main:'./build/cannon.js',engines:{node:'*'},repository:{type:'git',url:'https://github.com/schteppe/cannon.js.git'}, +bugs:{url:'https://github.com/schteppe/cannon.js/issues'},licenses:[{type:'MIT'}],devDependencies:{jshint:'latest','uglify-js':'latest',nodeunit:'^0.9.0',grunt:'~0.4.0','grunt-contrib-jshint':'~0.1.1','grunt-contrib-nodeunit':'^0.4.1','grunt-contrib-concat':'~0.1.3','grunt-contrib-uglify':'^0.5.1','grunt-browserify':'^2.1.4','grunt-contrib-yuidoc':'^0.5.2',browserify:'*'},dependencies:{}}},{}],2:[function(e,m){m.exports={version:e('../package.json').version,AABB:e('./collision/AABB'),ArrayCollisionMatrix:e('./collision/ArrayCollisionMatrix'), +Body:e('./objects/Body'),Box:e('./shapes/Box'),Broadphase:e('./collision/Broadphase'),Constraint:e('./constraints/Constraint'),ContactEquation:e('./equations/ContactEquation'),Narrowphase:e('./world/Narrowphase'),ConeTwistConstraint:e('./constraints/ConeTwistConstraint'),ContactMaterial:e('./material/ContactMaterial'),ConvexPolyhedron:e('./shapes/ConvexPolyhedron'),Cylinder:e('./shapes/Cylinder'),DistanceConstraint:e('./constraints/DistanceConstraint'),Equation:e('./equations/Equation'),EventTarget:e('./utils/EventTarget'), +FrictionEquation:e('./equations/FrictionEquation'),GSSolver:e('./solver/GSSolver'),GridBroadphase:e('./collision/GridBroadphase'),Heightfield:e('./shapes/Heightfield'),HingeConstraint:e('./constraints/HingeConstraint'),LockConstraint:e('./constraints/LockConstraint'),Mat3:e('./math/Mat3'),Material:e('./material/Material'),NaiveBroadphase:e('./collision/NaiveBroadphase'),ObjectCollisionMatrix:e('./collision/ObjectCollisionMatrix'),Pool:e('./utils/Pool'),Particle:e('./shapes/Particle'),Plane:e('./shapes/Plane'), +PointToPointConstraint:e('./constraints/PointToPointConstraint'),Quaternion:e('./math/Quaternion'),Ray:e('./collision/Ray'),RaycastVehicle:e('./objects/RaycastVehicle'),RaycastResult:e('./collision/RaycastResult'),RigidVehicle:e('./objects/RigidVehicle'),RotationalEquation:e('./equations/RotationalEquation'),RotationalMotorEquation:e('./equations/RotationalMotorEquation'),SAPBroadphase:e('./collision/SAPBroadphase'),SPHSystem:e('./objects/SPHSystem'),Shape:e('./shapes/Shape'),Solver:e('./solver/Solver'), +Sphere:e('./shapes/Sphere'),SplitSolver:e('./solver/SplitSolver'),Spring:e('./objects/Spring'),Trimesh:e('./shapes/Trimesh'),Vec3:e('./math/Vec3'),Vec3Pool:e('./utils/Vec3Pool'),World:e('./world/World')}},{'../package.json':1,'./collision/AABB':3,'./collision/ArrayCollisionMatrix':4,'./collision/Broadphase':5,'./collision/GridBroadphase':6,'./collision/NaiveBroadphase':7,'./collision/ObjectCollisionMatrix':8,'./collision/Ray':9,'./collision/RaycastResult':10,'./collision/SAPBroadphase':11,'./constraints/ConeTwistConstraint':12, './constraints/Constraint':13,'./constraints/DistanceConstraint':14,'./constraints/HingeConstraint':15,'./constraints/LockConstraint':16,'./constraints/PointToPointConstraint':17,'./equations/ContactEquation':19,'./equations/Equation':20,'./equations/FrictionEquation':21,'./equations/RotationalEquation':22,'./equations/RotationalMotorEquation':23,'./material/ContactMaterial':24,'./material/Material':25,'./math/Mat3':27,'./math/Quaternion':28,'./math/Vec3':30,'./objects/Body':31,'./objects/RaycastVehicle':32, -'./objects/RigidVehicle':33,'./objects/SPHSystem':34,'./objects/Spring':35,'./shapes/Box':37,'./shapes/ConvexPolyhedron':38,'./shapes/Cylinder':39,'./shapes/Heightfield':40,'./shapes/Particle':41,'./shapes/Plane':42,'./shapes/Shape':43,'./shapes/Sphere':44,'./shapes/Trimesh':45,'./solver/GSSolver':46,'./solver/Solver':47,'./solver/SplitSolver':48,'./utils/EventTarget':49,'./utils/Pool':51,'./utils/Vec3Pool':54,'./world/Narrowphase':55,'./world/World':56}],3:[function(g,m){function b(b){b=b||{};this.lowerBound= -new l;b.lowerBound&&this.lowerBound.copy(b.lowerBound);this.upperBound=new l;b.upperBound&&this.upperBound.copy(b.upperBound)}var l=g('../math/Vec3');g('../utils/Utils');m.exports=b;var f=new l;b.prototype.setFromPoints=function(b,c,l,g){var h=this.lowerBound,d=this.upperBound;h.copy(b[0]);l&&l.vmult(h,h);d.copy(h);for(var k=1;kd.x&&(d.x=n.x);n.xd.y&&(d.y=n.y);n.yd.z&&(d.z=n.z);n.zc&&(this.lowerBound.x=c);c=b.upperBound.x;this.upperBound.xc&&(this.lowerBound.y=c);c=b.upperBound.y;this.upperBound.yc&&(this.lowerBound.z=c);c=b.upperBound.z;this.upperBound.z=b.x&&c.y<=k.y&&f.y>= -b.y&&c.z<=k.z&&f.z>=b.z};b.prototype.getCorners=function(b,c,f,l,h,d,g,m){var k=this.lowerBound,n=this.upperBound;b.copy(k);c.set(n.x,k.y,k.z);f.set(n.x,n.y,k.z);l.set(k.x,n.y,n.z);h.set(n.x,k.y,k.z);d.set(k.x,n.y,k.z);g.set(k.x,k.y,n.z);m.copy(n)};var c=[new l,new l,new l,new l,new l,new l,new l,new l];b.prototype.toLocalFrame=function(b,f){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToLocal(n,n)}return f.setFromPoints(c)};b.prototype.toWorldFrame= -function(b,f){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToWorld(n,n)}return f.setFromPoints(c)}},{'../math/Vec3':30,'../utils/Utils':53}],4:[function(g,m){function b(){this.matrix=[]}m.exports=b;b.prototype.get=function(b,f){if(b=b.index,f=f.index,f>b)b=f=b;return this.matrix[(b*(b+1)>>1)+f-1]};b.prototype.set=function(b,f,c){if(b=b.index,f=f.index,f>b)b=f=b;this.matrix[(b*(b+1)>>1)+f-1]=c?1:0};b.prototype.reset=function(){for(var b=0,f=this.matrix.length;b!== -f;b++)this.matrix[b]=0};b.prototype.setNumObjects=function(b){this.matrix.length=b*(b-1)>>1}},{}],5:[function(g,m){function b(){this.world=null;this.useBoundingBoxes=!1;this.dirty=!0}var l=g('../objects/Body'),f=g('../math/Vec3'),c=g('../math/Quaternion');g('../shapes/Shape');g('../shapes/Plane');m.exports=b;b.prototype.collisionPairs=function(){throw Error('collisionPairs not implemented for this BroadPhase class!');};var k=l.STATIC|l.KINEMATIC;b.prototype.needBroadphaseCollision=function(b,d){return 0=== -(b.collisionFilterGroup&d.collisionFilterMask)||0===(d.collisionFilterGroup&b.collisionFilterMask)?!1:0===(b.type&k)&&b.sleepState!==l.SLEEPING||0===(d.type&k)&&d.sleepState!==l.SLEEPING?!0:!1};b.prototype.intersectionTest=function(b,d,c,h){this.useBoundingBoxes?this.doBoundingBoxBroadphase(b,d,c,h):this.doBoundingSphereBroadphase(b,d,c,h)};var n=new f;new f;new c;new f;b.prototype.doBoundingSphereBroadphase=function(b,d,c,h){d.position.vsub(b.position,n);var f=Math.pow(b.boundingRadius+d.boundingRadius, -2),k=n.norm2();f>k&&(c.push(b),h.push(d))};b.prototype.doBoundingBoxBroadphase=function(b,d,c,h){b.aabbNeedsUpdate&&b.computeAABB();d.aabbNeedsUpdate&&d.computeAABB();b.aabb.overlaps(d.aabb)&&(c.push(b),h.push(d))};var p={keys:[]},t=[],h=[];b.prototype.makePairsUnique=function(b,d){for(var c=b.length,f=0;f!==c;f++)t[f]=b[f],h[f]=d[f];b.length=0;for(f=d.length=0;f!==c;f++){var k=t[f].id,n=h[f].id,k=n>k?k+','+n:n+','+k;p[k]=f;p.keys.push(k)}for(f=0;f!==p.keys.length;f++)k=p.keys.pop(),c=p[k],b.push(t[c]), -d.push(h[c]),delete p[k]};b.prototype.setWorld=function(){};var d=new f;b.boundingSphereCheck=function(b,c){return b.position.vsub(c.position,d),Math.pow(b.shape.boundingSphereRadius+c.shape.boundingSphereRadius,2)>d.norm2()};b.prototype.aabbQuery=function(){return console.warn('.aabbQuery is not implemented in this Broadphase subclass.'),[]}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Plane':42,'../shapes/Shape':43}],6:[function(g,m){function b(b,c,k,h,d){l.apply(this); -this.nx=k||10;this.ny=h||10;this.nz=d||10;this.aabbMin=b||new f(100,100,100);this.aabbMax=c||new f(-100,-100,-100);b=this.nx*this.ny*this.nz;if(0>=b)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[];this.binLengths=[];this.bins.length=b;this.binLengths.length=b;for(c=0;b>c;c++)this.bins[c]=[],this.binLengths[c]=0}m.exports=b;var l=g('./Broadphase'),f=g('../math/Vec3'),c=g('../shapes/Shape');b.prototype=new l;b.prototype.constructor=b;var k=new f;new f;b.prototype.collisionPairs=function(b, -f,l){function h(b,d,c,h,f,k,n){b=(b-z)*O|0;d=(d-H)*M|0;c=(c-G)*J|0;h=Z((h-z)*O);f=Z((f-H)*M);k=Z((k-G)*J);0>b?b=0:b>=p&&(b=p-1);0>d?d=0:d>=t&&(d=t-1);0>c?c=0:c>=q&&(c=q-1);0>h?h=0:h>=p&&(h=p-1);0>f?f=0:f>=t&&(f=t-1);0>k?k=0:k>=q&&(k=q-1);b*=u;d*=m;c*=E;h*=u;f*=m;for(k*=E;h>=b;b+=u)for(var l=d;f>=l;l+=m)for(var g=c;k>=g;g+=E){var v=b+l+g;T[v][fa[v]++]=n}}var d=b.numObjects();b=b.bodies;for(var n=this.aabbMax,g=this.aabbMin,p=this.nx,t=this.ny,q=this.nz,u=t*q,m=q,E=1,D=n.x,C=n.y,F=n.z,z=g.x,H=g.y,G= -g.z,O=p/(D-z),M=t/(C-H),J=q/(F-G),D=(D-z)/p,P=(C-H)/t,F=(F-G)/q,N=.5*Math.sqrt(D*D+P*P+F*F),C=c.types,V=C.SPHERE,X=C.PLANE,T=(C.BOX,C.COMPOUND,C.CONVEXPOLYHEDRON,this.bins),fa=this.binLengths,C=this.bins.length,g=0;g!==C;g++)fa[g]=0;for(var Z=Math.ceil,g=Math.min,n=Math.max,g=0;g!==d;g++){var n=b[g],S=n.shape;switch(S.type){case V:var L=n.position.x,U=n.position.y,oa=n.position.z,S=S.radius;h(L-S,U-S,oa-S,L+S,U+S,oa+S,n);break;case X:S.worldNormalNeedsUpdate&&S.computeWorldNormal(n.quaternion);var oa= -S.worldNormal,S=H+.5*P-n.position.y,pa=G+.5*F-n.position.z,R=k;R.set(z+.5*D-n.position.x,S,pa);for(var Y=L=0;L!==p;L++,Y+=u,R.y=S,R.x+=D)for(var na=U=0;U!==t;U++,na+=m,R.z=pa,R.y+=P)for(var la=0,ca=0;la!==q;la++,ca+=E,R.z+=F)if(R.dot(oa)b)b=f=b;return b+'-'+f in this.matrix};b.prototype.set=function(b,f,c){if(b=b.id,f=f.id,f>b)b=f=b;c?this.matrix[b+'-'+f]=!0:delete this.matrix[b+'-'+f]};b.prototype.reset=function(){this.matrix= -{}};b.prototype.setNumObjects=function(){}},{}],9:[function(g,m){function b(d,c){this.from=d?d.clone():new f;this.to=c?c.clone():new f;this._direction=new f;this.precision=1E-4;this.checkCollisionResponse=!0;this.skipBackfaces=!1;this.collisionFilterGroup=this.collisionFilterMask=-1;this.mode=b.ANY;this.result=new k;this.hasHit=!1;this.callback=function(){}}function l(b,c,f,k){k.vsub(c,V);f.vsub(c,h);b.vsub(c,d);var n,q;b=V.dot(V);c=V.dot(h);f=V.dot(d);k=h.dot(h);var l=h.dot(d);return 0<=(n=k*f-c* -l)&&0<=(q=b*l-c*f)&&b*k-c*c>n+q}m.exports=b;var f=g('../math/Vec3');m=g('../math/Quaternion');var c=g('../math/Transform'),k=(g('../shapes/ConvexPolyhedron'),g('../shapes/Box'),g('../collision/RaycastResult')),n=g('../shapes/Shape');g=g('../collision/AABB');b.prototype.constructor=b;b.CLOSEST=1;b.ANY=2;b.ALL=4;var p=new g,t=[];b.prototype.intersectWorld=function(d,c){return this.mode=c.mode||b.ANY,this.result=c.result||new k,this.skipBackfaces=!!c.skipBackfaces,this.collisionFilterMask='undefined'!= -typeof c.collisionFilterMask?c.collisionFilterMask:-1,this.collisionFilterGroup='undefined'!=typeof c.collisionFilterGroup?c.collisionFilterGroup:-1,c.from&&this.from.copy(c.from),c.to&&this.to.copy(c.to),this.callback=c.callback||function(){},this.hasHit=!1,this.result.reset(),this._updateDirection(),this.getAABB(p),t.length=0,d.broadphase.aabbQuery(d,p,t),this.intersectBodies(t),this.hasHit};var h=new f,d=new f;b.pointInTriangle=l;var v=new f,w=new m;b.prototype.intersectBody=function(b,d){d&&(this.result= -d,this._updateDirection());d=this.checkCollisionResponse;if((!d||b.collisionResponse)&&0!==(this.collisionFilterGroup&b.collisionFilterMask)&&0!==(b.collisionFilterGroup&this.collisionFilterMask))for(var c=0,h=b.shapes.length;h>c;c++){var f=b.shapes[c];if((!d||f.collisionResponse)&&(b.quaternion.mult(b.shapeOrientations[c],w),b.quaternion.vmult(b.shapeOffsets[c],v),v.vadd(b.position,v),this.intersectShape(f,w,v,b),this.result._shouldStop))break}};b.prototype.intersectBodies=function(b,d){d&&(this.result= -d,this._updateDirection());d=0;for(var c=b.length;!this.result._shouldStop&&c>d;d++)this.intersectBody(b[d])};b.prototype._updateDirection=function(){this.to.vsub(this.from,this._direction);this._direction.normalize()};b.prototype.intersectShape=function(b,d,c,h){var f=this.from,k=this._direction;c.vsub(f,V);var n=V.dot(k);k.mult(n,X);X.vadd(f,X);c.distanceTo(X)>b.boundingSphereRadius||(f=this[b.type])&&f.call(this,b,d,c,h)};var y=(new f,new f,new f),x=new f,q=new f,u=new f;new f;new k;b.prototype.intersectBox= -function(b,d,c,h){return this.intersectConvex(b.convexPolyhedronRepresentation,d,c,h)};b.prototype[n.types.BOX]=b.prototype.intersectBox;b.prototype.intersectPlane=function(b,d,c,h){var k=this.from,n=this.to,q=this._direction,l=new f(0,0,1);d.vmult(l,l);var g=new f;k.vsub(c,g);d=g.dot(l);n.vsub(c,g);g=g.dot(l);if(!(0m)&&(m=g[0]),(null===t||g[1]u)&&(u=g[1])),null!==p)for(l=[],d.getRectMinMax(p,t,m,u,l),p=(l[0],l[1],p);m>=p;p++)for(l=t;u>=l;l++){if(this.result._shouldStop||(d.getConvexTrianglePillar(p,l,!1),c.pointToWorldFrame(k,h,d.pillarOffset,q),this.intersectConvex(d.pillarConvex, -h,q,n,A),this.result._shouldStop))return;d.getConvexTrianglePillar(p,l,!0);c.pointToWorldFrame(k,h,d.pillarOffset,q);this.intersectConvex(d.pillarConvex,h,q,n,A)}};b.prototype[n.types.HEIGHTFIELD]=b.prototype.intersectHeightfield;var E=new f,D=new f;b.prototype.intersectSphere=function(b,d,c,h){d=this.from;var f=this.to,k=Math.pow(f.x-d.x,2)+Math.pow(f.y-d.y,2)+Math.pow(f.z-d.z,2),n=2*((f.x-d.x)*(d.x-c.x)+(f.y-d.y)*(d.y-c.y)+(f.z-d.z)*(d.z-c.z)),q=Math.pow(n,2)-4*k*(Math.pow(d.x-c.x,2)+Math.pow(d.y- -c.y,2)+Math.pow(d.z-c.z,2)-Math.pow(b.radius,2));if(!(0>q))if(0===q)d.lerp(f,q,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1);else{var l=(-n-Math.sqrt(q))/(2*k),k=(-n+Math.sqrt(q))/(2*k);(0<=l&&1>=l&&(d.lerp(f,l,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1)),this.result._shouldStop)||0<=k&&1>=k&&(d.lerp(f,k,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1))}};b.prototype[n.types.SPHERE]=b.prototype.intersectSphere;var C=new f,F=(new f,new f,new f); -b.prototype.intersectConvex=function(b,d,c,h,f){f=f&&f.faceList||null;for(var k=b.faces,n=b.vertices,g=b.faceNormals,p=this._direction,t=this.from,m=t.distanceTo(this.to),v=f?f.length:k.length,w=this.result,A=0;!w._shouldStop&&v>A;A++){var z=f?f[A]:A,E=k[z],D=g[z],L=d,H=c;F.copy(n[E[0]]);L.vmult(F,F);F.vadd(H,F);F.vsub(t,F);L.vmult(D,C);D=p.dot(C);if(!(Math.abs(D)D)))for(p.mult(D,y),y.vadd(t,y),x.copy(n[E[0]]),L.vmult(x,x),H.vadd(x,x),D=1;!w._shouldStop&&Dm||this.reportIntersection(C,y,b,h,z)}}};b.prototype[n.types.CONVEXPOLYHEDRON]=b.prototype.intersectConvex;var z=new f,H=new f,G=new f,O=new f,M=new f,J=new f,P=(new g,[]),N=new c;b.prototype.intersectTrimesh=function(b,d,h,f,k){k=(k&&k.faceList||null,b.indices);var n=(b.vertices,b.faceNormals,this.from),g=this.to,p=this._direction;N.position.copy(h);N.quaternion.copy(d); -c.vectorToLocalFrame(h,d,p,H);c.pointToLocalFrame(h,d,n,G);c.pointToLocalFrame(h,d,g,O);n=G.distanceSquared(O);b.tree.rayQuery(this,N,P);g=0;for(p=P.length;!this.result._shouldStop&&g!==p;g++){var t=P[g];b.getNormal(t,z);b.getVertex(k[3*t],x);x.vsub(G,F);var m=H.dot(z),m=z.dot(F)/m;0>m||(H.scale(m,y),y.vadd(G,y),b.getVertex(k[3*t+1],q),b.getVertex(k[3*t+2],u),m=y.distanceSquared(G),!l(y,q,x,u)&&!l(y,x,q,u)||m>n||(c.vectorToWorldFrame(d,z,M),c.pointToWorldFrame(h,d,y,J),this.reportIntersection(M,J, -b,f,t)))}P.length=0};b.prototype[n.types.TRIMESH]=b.prototype.intersectTrimesh;b.prototype.reportIntersection=function(d,c,h,f,k){var n=this.from,q=this.to,l=n.distanceTo(c),g=this.result;if(!(this.skipBackfaces&&0c;c++){for(var n=b[c],l=c-1;0<=l&&!(b[l].aabb.lowerBound.x<=n.aabb.lowerBound.x);l--)b[l+1]=b[l];b[l+1]=n}return b};b.insertionSortY=function(b){for(var c=1,f=b.length;f>c;c++){for(var n=b[c],l=c-1;0<=l&&!(b[l].aabb.lowerBound.y<= -n.aabb.lowerBound.y);l--)b[l+1]=b[l];b[l+1]=n}return b};b.insertionSortZ=function(b){for(var c=1,f=b.length;f>c;c++){for(var n=b[c],l=c-1;0<=l&&!(b[l].aabb.lowerBound.z<=n.aabb.lowerBound.z);l--)b[l+1]=b[l];b[l+1]=n}return b};b.prototype.collisionPairs=function(f,c,k){var n,l=this.axisList,g=l.length,h=this.axisIndex;this.dirty&&(this.sortList(),this.dirty=!1);for(f=0;f!==g;f++){var d=l[f];for(n=f+1;g>n;n++){var m=l[n];if(this.needBroadphaseCollision(d,m)){if(!b.checkBounds(d,m,h))break;this.intersectionTest(d, -m,c,k)}}}};b.prototype.sortList=function(){for(var f=this.axisList,c=this.axisIndex,k=f.length,n=0;n!==k;n++){var l=f[n];l.aabbNeedsUpdate&&l.computeAABB()}0===c?b.insertionSortX(f):1===c?b.insertionSortY(f):2===c&&b.insertionSortZ(f)};b.checkBounds=function(b,c,k){var f,l;0===k?(f=b.position.x,l=c.position.x):1===k?(f=b.position.y,l=c.position.y):2===k&&(f=b.position.z,l=c.position.z);return f+b.boundingRadius>l-c.boundingRadius};b.prototype.autoDetectAxis=function(){for(var b=0,c=0,k=0,n=0,l=0, -g=0,h=this.axisList,d=h.length,m=1/d,w=0;w!==d;w++)var y=h[w],x=y.position.x,b=b+x,c=c+x*x,x=y.position.y,k=k+x,n=n+x*x,y=y.position.z,l=l+y,g=g+y*y;b=c-b*b*m;k=n-k*k*m;l=g-l*l*m;this.axisIndex=b>k?b>l?0:2:k>l?1:2};b.prototype.aabbQuery=function(b,c,k){k=k||[];this.dirty&&(this.sortList(),this.dirty=!1);b=this.axisIndex;var f='x';1===b&&(f='y');2===b&&(f='z');b=this.axisList;for(f=(c.lowerBound[f],c.upperBound[f],0);fk;k++)for(var n=0;3>n;n++){for(var l=0,g=0;3>g;g++)l+=f.elements[k+3*g]*this.elements[g+3*n];c.elements[k+3*n]=l}return c};b.prototype.scale=function(f,c){c=c||new b;for(var k=this.elements,n=c.elements,l=0;3!==l;l++)n[3*l+0]=f.x*k[3*l+0],n[3*l+1]=f.y*k[3*l+1],n[3*l+2]=f.z*k[3*l+2];return c};b.prototype.solve=function(b,c){c=c||new l;for(var f=[],n=0;12>n;n++)f.push(0);for(var g,n=0;3>n;n++)for(g=0;3>g;g++)f[n+4*g]=this.elements[n+3*g];f[3]=b.x;f[7]=b.y;f[11]=b.z;var t, -h,d=3,m=d;do{if(n=m-d,0===f[n+4*n])for(g=n+1;m>g;g++)if(0!==f[n+4*g]){t=4;do h=4-t,f[h+4*n]+=f[h+4*g];while(--t);break}if(0!==f[n+4*n])for(g=n+1;m>g;g++){var w=f[n+4*g]/f[n+4*n];t=4;do h=4-t,f[h+4*g]=n>=h?0:f[h+4*g]-f[h+4*n]*w;while(--t)}}while(--d);if(c.z=f[11]/f[10],c.y=(f[7]-f[6]*c.z)/f[5],c.x=(f[3]-f[2]*c.z-f[1]*c.y)/f[0],isNaN(c.x)||isNaN(c.y)||isNaN(c.z)||1/0===c.x||1/0===c.y||1/0===c.z)throw'Could not solve equation! Got x=['+c.toString()+'], b=['+b.toString()+'], A=['+this.toString()+']'; -return c};b.prototype.e=function(b,c,k){return void 0===k?this.elements[c+3*b]:void(this.elements[c+3*b]=k)};b.prototype.copy=function(b){for(var c=0;cc;c++)b+=this.elements[c]+',';return b};b.prototype.reverse=function(f){f=f||new b;for(var c=[],k=0;18>k;k++)c.push(0);for(var n,k=0;3>k;k++)for(n=0;3>n;n++)c[k+6*n]=this.elements[k+3*n];c[3]=1;c[9]=0;c[15]=0;c[4]=0;c[10]=1;c[16]=0; -c[5]=0;c[11]=0;c[17]=1;var l,g,h=3,d=h;do{if(k=d-h,0===c[k+6*k])for(n=k+1;d>n;n++)if(0!==c[k+6*n]){l=6;do g=6-l,c[g+6*k]+=c[g+6*n];while(--l);break}if(0!==c[k+6*k])for(n=k+1;d>n;n++){var m=c[k+6*n]/c[k+6*k];l=6;do g=6-l,c[g+6*n]=k>=g?0:c[g+6*n]-c[g+6*k]*m;while(--l)}}while(--h);k=2;do{n=k-1;do{m=c[k+6*n]/c[k+6*k];l=6;do g=6-l,c[g+6*n]-=c[g+6*k]*m;while(--l)}while(n--)}while(--k);k=2;do{m=1/c[k+6*k];l=6;do g=6-l,c[g+6*k]*=m;while(--l)}while(k--);k=2;do{n=2;do{if(g=c[3+n+6*k],isNaN(g)||1/0===g)throw'Could not reverse! A=['+ -this.toString()+']';f.e(k,n,g)}while(n--)}while(k--);return f};b.prototype.setRotationFromQuaternion=function(b){var c=b.x,f=b.y,n=b.z,l=b.w,g=c+c,h=f+f,d=n+n;b=c*g;var m=c*h,c=c*d,w=f*h,f=f*d,n=n*d,g=l*g,h=l*h,l=l*d,d=this.elements;return d[0]=1-(w+n),d[1]=m-l,d[2]=c+h,d[3]=m+l,d[4]=1-(b+n),d[5]=f-g,d[6]=c-h,d[7]=f+g,d[8]=1-(b+w),this};b.prototype.transpose=function(f){f=f||new b;for(var c=f.elements,k=this.elements,n=0;3!==n;n++)for(var l=0;3!==l;l++)c[3*n+l]=k[3*l+n];return f}},{'./Vec3':30}], -28:[function(g,m){function b(b,c,d,f){this.x=void 0!==b?b:0;this.y=void 0!==c?c:0;this.z=void 0!==d?d:0;this.w=void 0!==f?f:1}m.exports=b;var l=g('./Vec3');b.prototype.set=function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f};b.prototype.toString=function(){return this.x+','+this.y+','+this.z+','+this.w};b.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]};b.prototype.setFromAxisAngle=function(b,c){var d=Math.sin(.5*c);this.x=b.x*d;this.y=b.y*d;this.z=b.z*d;this.w=Math.cos(.5*c)}; -b.prototype.toAxisAngle=function(b){b=b||new l;this.normalize();var c=2*Math.acos(this.w),d=Math.sqrt(1-this.w*this.w);return.001>d?(b.x=this.x,b.y=this.y,b.z=this.z):(b.x=this.x/d,b.y=this.y/d,b.z=this.z/d),[b,c]};var f=new l,c=new l;b.prototype.setFromVectors=function(b,h){if(b.isAntiparallelTo(h))b.tangents(f,c),this.setFromAxisAngle(f,Math.PI);else{var d=b.cross(h);this.x=d.x;this.y=d.y;this.z=d.z;this.w=Math.sqrt(Math.pow(b.norm(),2)*Math.pow(h.norm(),2))+b.dot(h);this.normalize()}};var k=new l, -n=new l,p=new l;b.prototype.mult=function(c,h){h=h||new b;var d=this.w;return k.set(this.x,this.y,this.z),n.set(c.x,c.y,c.z),h.w=d*c.w-k.dot(n),k.cross(n,p),h.x=d*n.x+c.w*k.x+p.x,h.y=d*n.y+c.w*k.y+p.y,h.z=d*n.z+c.w*k.z+p.z,h};b.prototype.inverse=function(c){var h=this.x,d=this.y,f=this.z,k=this.w;c=c||new b;this.conjugate(c);h=1/(h*h+d*d+f*f+k*k);return c.x*=h,c.y*=h,c.z*=h,c.w*=h,c};b.prototype.conjugate=function(c){return c=c||new b,c.x=-this.x,c.y=-this.y,c.z=-this.z,c.w=this.w,c};b.prototype.normalize= -function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.normalizeFast=function(){var b=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.vmult=function(b,c){c=c||new l;var d=b.x,h=b.y,f=b.z;b=this.x;var k=this.y,n=this.z,q=this.w,g=q*d+k*f-n*h,p=q*h+n*d-b* -f,m=q*f+b*h-k*d,d=-b*d-k*h-n*f;return c.x=g*q+d*-b+p*-n-m*-k,c.y=p*q+d*-k+m*-b-g*-n,c.z=m*q+d*-n+g*-k-p*-b,c};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this.w=b.w,this};b.prototype.toEuler=function(b,c){c=c||'YZX';var d,h,f,k=this.x,n=this.y,q=this.z,l=this.w;switch(c){case 'YZX':c=k*n+q*l;if(.499c&&(d=-2*Math.atan2(k,l),h=-Math.PI/2,f=0),isNaN(d))f=q*q,d=Math.atan2(2*n*l-2*k*q,1-2*n*n-2*f),h=Math.asin(2*c),f=Math.atan2(2* -k*l-2*n*q,1-2*k*k-2*f);break;default:throw Error('Euler order '+c+' not supported yet.');}b.y=d;b.z=h;b.x=f};b.prototype.setFromEuler=function(b,c,d,f){f=f||'XYZ';var h=Math.cos(b/2),k=Math.cos(c/2),n=Math.cos(d/2);b=Math.sin(b/2);c=Math.sin(c/2);d=Math.sin(d/2);return'XYZ'===f?(this.x=b*k*n+h*c*d,this.y=h*c*n-b*k*d,this.z=h*k*d+b*c*n,this.w=h*k*n-b*c*d):'YXZ'===f?(this.x=b*k*n+h*c*d,this.y=h*c*n-b*k*d,this.z=h*k*d-b*c*n,this.w=h*k*n+b*c*d):'ZXY'===f?(this.x=b*k*n-h*c*d,this.y=h*c*n+b*k*d,this.z= -h*k*d+b*c*n,this.w=h*k*n-b*c*d):'ZYX'===f?(this.x=b*k*n-h*c*d,this.y=h*c*n+b*k*d,this.z=h*k*d-b*c*n,this.w=h*k*n+b*c*d):'YZX'===f?(this.x=b*k*n+h*c*d,this.y=h*c*n+b*k*d,this.z=h*k*d-b*c*n,this.w=h*k*n-b*c*d):'XZY'===f&&(this.x=b*k*n-h*c*d,this.y=h*c*n-b*k*d,this.z=h*k*d+b*c*n,this.w=h*k*n+b*c*d),this};b.prototype.clone=function(){return new b(this.x,this.y,this.z,this.w)}},{'./Vec3':30}],29:[function(g,m){function b(b){b=b||{};this.position=new l;b.position&&this.position.copy(b.position);this.quaternion= -new f;b.quaternion&&this.quaternion.copy(b.quaternion)}var l=g('./Vec3'),f=g('./Quaternion');m.exports=b;var c=new f;b.pointToLocalFrame=function(b,f,g,m){m=m||new l;return g.vsub(b,m),f.conjugate(c),c.vmult(m,m),m};b.prototype.pointToLocal=function(c,f){return b.pointToLocalFrame(this.position,this.quaternion,c,f)};b.pointToWorldFrame=function(b,c,f,g){g=g||new l;return c.vmult(f,g),g.vadd(b,g),g};b.prototype.pointToWorld=function(c,f){return b.pointToWorldFrame(this.position,this.quaternion,c,f)}; -b.prototype.vectorToWorldFrame=function(b,c){c=c||new l;return this.quaternion.vmult(b,c),c};b.vectorToWorldFrame=function(b,c,f){return b.vmult(c,f),f};b.vectorToLocalFrame=function(b,c,f,g){g=g||new l;return c.w*=-1,c.vmult(f,g),c.w*=-1,g}},{'./Quaternion':28,'./Vec3':30}],30:[function(g,m){function b(b,c,f){this.x=b||0;this.y=c||0;this.z=f||0}m.exports=b;var l=g('./Mat3');b.ZERO=new b(0,0,0);b.UNIT_X=new b(1,0,0);b.UNIT_Y=new b(0,1,0);b.UNIT_Z=new b(0,0,1);b.prototype.cross=function(c,f){var k= -c.x,h=c.y;c=c.z;var d=this.x,n=this.y,l=this.z;return f=f||new b,f.x=n*c-l*h,f.y=l*k-d*c,f.z=d*h-n*k,f};b.prototype.set=function(b,c,f){return this.x=b,this.y=c,this.z=f,this};b.prototype.setZero=function(){this.x=this.y=this.z=0};b.prototype.vadd=function(c,f){return f?(f.x=c.x+this.x,f.y=c.y+this.y,f.z=c.z+this.z,void 0):new b(this.x+c.x,this.y+c.y,this.z+c.z)};b.prototype.vsub=function(c,f){return f?(f.x=this.x-c.x,f.y=this.y-c.y,f.z=this.z-c.z,void 0):new b(this.x-c.x,this.y-c.y,this.z-c.z)}; -b.prototype.crossmat=function(){return new l([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])};b.prototype.normalize=function(){var b=this.x,c=this.y,f=this.z,b=Math.sqrt(b*b+c*c+f*f);0Math.abs(f.x)?(c.set(1,0,0),f.cross(c,b)):(c.set(0,1,0),f.cross(c,b)),f.cross(b,k)):(b.set(1,0,0),k.set(0, -1,0))};b.prototype.toString=function(){return this.x+','+this.y+','+this.z};b.prototype.toArray=function(){return[this.x,this.y,this.z]};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this};b.prototype.lerp=function(b,c,f){var h=this.x,d=this.y,k=this.z;f.x=h+(b.x-h)*c;f.y=d+(b.y-d)*c;f.z=k+(b.z-k)*c};b.prototype.almostEquals=function(b,c){return void 0===c&&(c=1E-6),Math.abs(this.x-b.x)>c||Math.abs(this.y-b.y)>c||Math.abs(this.z-b.z)>c?!1:!0};b.prototype.almostZero=function(b){return void 0=== -b&&(b=1E-6),Math.abs(this.x)>b||Math.abs(this.y)>b||Math.abs(this.z)>b?!1:!0};var k=new b;b.prototype.isAntiparallelTo=function(b,c){return this.negate(k),k.almostEquals(b,c)};b.prototype.clone=function(){return new b(this.x,this.y,this.z)}},{'./Mat3':27}],31:[function(g,m){function b(d){d=d||{};l.apply(this);this.id=b.idCounter++;this.postStep=this.preStep=this.world=null;this.vlambda=new f;this.collisionFilterGroup='number'==typeof d.collisionFilterGroup?d.collisionFilterGroup:1;this.collisionFilterMask= -'number'==typeof d.collisionFilterMask?d.collisionFilterMask:1;this.collisionResponse=!0;this.position=new f;d.position&&this.position.copy(d.position);this.previousPosition=new f;this.initPosition=new f;this.velocity=new f;d.velocity&&this.velocity.copy(d.velocity);this.initVelocity=new f;this.force=new f;var h='number'==typeof d.mass?d.mass:0;this.mass=h;this.invMass=0=h?b.STATIC: -b.DYNAMIC;typeof d.type==typeof b.STATIC&&(this.type=d.type);this.allowSleep='undefined'!=typeof d.allowSleep?d.allowSleep:!0;this.sleepState=0;this.sleepSpeedLimit='undefined'!=typeof d.sleepSpeedLimit?d.sleepSpeedLimit:.1;this.sleepTimeLimit='undefined'!=typeof d.sleepTimeLimit?d.sleepTimeLimit:1;this.timeLastSleepy=0;this._wakeUpAfterNarrowphase=!1;this.torque=new f;this.quaternion=new k;d.quaternion&&this.quaternion.copy(d.quaternion);this.initQuaternion=new k;this.angularVelocity=new f;d.angularVelocity&& -this.angularVelocity.copy(d.angularVelocity);this.initAngularVelocity=new f;this.interpolatedPosition=new f;this.interpolatedQuaternion=new k;this.shapes=[];this.shapeOffsets=[];this.shapeOrientations=[];this.inertia=new f;this.invInertia=new f;this.invInertiaWorld=new c;this.invMassSolve=0;this.invInertiaSolve=new f;this.invInertiaWorldSolve=new c;this.fixedRotation='undefined'!=typeof d.fixedRotation?d.fixedRotation:!1;this.angularDamping='undefined'!=typeof d.angularDamping?d.angularDamping:.01; -this.aabb=new n;this.aabbNeedsUpdate=!0;this.wlambda=new f;d.shape&&this.addShape(d.shape);this.updateMassProperties()}m.exports=b;var l=g('../utils/EventTarget'),f=(g('../shapes/Shape'),g('../math/Vec3')),c=g('../math/Mat3'),k=g('../math/Quaternion'),n=(g('../material/Material'),g('../collision/AABB')),p=g('../shapes/Box');b.prototype=new l;b.prototype.constructor=b;b.DYNAMIC=1;b.STATIC=2;b.KINEMATIC=4;b.AWAKE=0;b.SLEEPY=1;b.SLEEPING=2;b.idCounter=0;b.prototype.wakeUp=function(){var d=this.sleepState; -this.sleepState=0;d===b.SLEEPING&&this.dispatchEvent({type:'wakeup'})};b.prototype.sleep=function(){this.sleepState=b.SLEEPING;this.velocity.set(0,0,0);this.angularVelocity.set(0,0,0)};b.sleepyEvent={type:'sleepy'};b.sleepEvent={type:'sleep'};b.prototype.sleepTick=function(d){if(this.allowSleep){var c=this.sleepState,h=this.velocity.norm2()+this.angularVelocity.norm2(),f=Math.pow(this.sleepSpeedLimit,2);c===b.AWAKE&&f>h?(this.sleepState=b.SLEEPY,this.timeLastSleepy=d,this.dispatchEvent(b.sleepyEvent)): -c===b.SLEEPY&&h>f?this.wakeUp():c===b.SLEEPY&&d-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(b.sleepEvent))}};b.prototype.updateSolveMassProperties=function(){this.sleepState===b.SLEEPING||this.type===b.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))};b.prototype.pointToLocalFrame=function(b, -d){d=d||new f;return b.vsub(this.position,d),this.quaternion.conjugate().vmult(d,d),d};b.prototype.vectorToLocalFrame=function(b,d){d=d||new f;return this.quaternion.conjugate().vmult(b,d),d};b.prototype.pointToWorldFrame=function(b,d){d=d||new f;return this.quaternion.vmult(b,d),d.vadd(this.position,d),d};b.prototype.vectorToWorldFrame=function(b,d){d=d||new f;return this.quaternion.vmult(b,d),d};var t=new f,h=new k;b.prototype.addShape=function(b,d,c){var h=new f,l=new k;return d&&h.copy(d),c&& -l.copy(c),this.shapes.push(b),this.shapeOffsets.push(h),this.shapeOrientations.push(l),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,this};b.prototype.updateBoundingRadius=function(){for(var b=this.shapes,d=this.shapeOffsets,c=b.length,h=0,f=0;f!==c;f++){var k=b[f];k.updateBoundingSphereRadius();var l=d[f].norm(),k=k.boundingSphereRadius;l+k>h&&(h=l+k)}this.boundingRadius=h};var d=new n;b.prototype.computeAABB=function(){for(var b=this.shapes,c=this.shapeOffsets, -f=this.shapeOrientations,k=b.length,l=this.quaternion,q=this.aabb,g=0;g!==k;g++){var n=b[g];f[g].mult(l,h);h.vmult(c[g],t);t.vadd(this.position,t);n.calculateWorldAABB(t,h,d.lowerBound,d.upperBound);0===g?q.copy(d):q.extend(d)}this.aabbNeedsUpdate=!1};var v=new c,w=new c;new c;b.prototype.updateInertiaWorld=function(b){var d=this.invInertia;if(d.x!==d.y||d.y!==d.z||b)v.setRotationFromQuaternion(this.quaternion),v.transpose(w),v.scale(d,v),v.mmult(w,this.invInertiaWorld)};var y=new f,x=new f;b.prototype.applyForce= -function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,y),y.cross(d,x),this.force.vadd(d,this.force),this.torque.vadd(x,this.torque))};var q=new f,u=new f;b.prototype.applyLocalForce=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,q),this.pointToWorldFrame(c,u),this.applyForce(q,u))};var A=new f,E=new f,D=new f;b.prototype.applyImpulse=function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,A),E.copy(d),E.mult(this.invMass,E),this.velocity.vadd(E,this.velocity),A.cross(d,D), -this.invInertiaWorld.vmult(D,D),this.angularVelocity.vadd(D,this.angularVelocity))};var C=new f,F=new f;b.prototype.applyLocalImpulse=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,C),this.pointToWorldFrame(c,F),this.applyImpulse(C,F))};var z=new f;b.prototype.updateMassProperties=function(){this.invMass=0d.x&&(d.x=n.x);n.xd.y&&(d.y=n.y);n.yd.z&&(d.z=n.z);n.zc&&(this.lowerBound.x=c);c=b.upperBound.x;this.upperBound.xc&&(this.lowerBound.y=c);c=b.upperBound.y;this.upperBound.yc&&(this.lowerBound.z=c);c=b.upperBound.z;this.upperBound.z=b.x&&c.y<=k.y&&g.y>= +b.y&&c.z<=k.z&&g.z>=b.z};b.prototype.getCorners=function(b,c,g,e,h,d,l,m){var k=this.lowerBound,n=this.upperBound;b.copy(k);c.set(n.x,k.y,k.z);g.set(n.x,n.y,k.z);e.set(k.x,n.y,n.z);h.set(n.x,k.y,k.z);d.set(k.x,n.y,k.z);l.set(k.x,k.y,n.z);m.copy(n)};var c=[new l,new l,new l,new l,new l,new l,new l,new l];b.prototype.toLocalFrame=function(b,g){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToLocal(n,n)}return g.setFromPoints(c)};b.prototype.toWorldFrame= +function(b,g){this.getCorners(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);for(var k=0;8!==k;k++){var n=c[k];b.pointToWorld(n,n)}return g.setFromPoints(c)}},{'../math/Vec3':30,'../utils/Utils':53}],4:[function(e,m){function b(){this.matrix=[]}m.exports=b;b.prototype.get=function(b,g){if(b=b.index,g=g.index,g>b)b=g=b;return this.matrix[(b*(b+1)>>1)+g-1]};b.prototype.set=function(b,g,c){if(b=b.index,g=g.index,g>b)b=g=b;this.matrix[(b*(b+1)>>1)+g-1]=c?1:0};b.prototype.reset=function(){for(var b=0,g=this.matrix.length;b!== +g;b++)this.matrix[b]=0};b.prototype.setNumObjects=function(b){this.matrix.length=b*(b-1)>>1}},{}],5:[function(e,m){function b(){this.world=null;this.useBoundingBoxes=!1;this.dirty=!0}var l=e('../objects/Body'),g=e('../math/Vec3'),c=e('../math/Quaternion');e('../shapes/Shape');e('../shapes/Plane');m.exports=b;b.prototype.collisionPairs=function(){throw Error('collisionPairs not implemented for this BroadPhase class!');};var k=l.STATIC|l.KINEMATIC;b.prototype.needBroadphaseCollision=function(b,d){return 0=== +(b.collisionFilterGroup&d.collisionFilterMask)||0===(d.collisionFilterGroup&b.collisionFilterMask)?!1:0===(b.type&k)&&b.sleepState!==l.SLEEPING||0===(d.type&k)&&d.sleepState!==l.SLEEPING?!0:!1};b.prototype.intersectionTest=function(b,d,c,h){this.useBoundingBoxes?this.doBoundingBoxBroadphase(b,d,c,h):this.doBoundingSphereBroadphase(b,d,c,h)};var n=new g;new g;new c;new g;b.prototype.doBoundingSphereBroadphase=function(b,d,c,h){d.position.vsub(b.position,n);var g=Math.pow(b.boundingRadius+d.boundingRadius, +2),k=n.norm2();g>k&&(c.push(b),h.push(d))};b.prototype.doBoundingBoxBroadphase=function(b,d,c,h){b.aabbNeedsUpdate&&b.computeAABB();d.aabbNeedsUpdate&&d.computeAABB();b.aabb.overlaps(d.aabb)&&(c.push(b),h.push(d))};var p={keys:[]},t=[],h=[];b.prototype.makePairsUnique=function(b,d){for(var c=b.length,g=0;g!==c;g++)t[g]=b[g],h[g]=d[g];b.length=0;for(g=d.length=0;g!==c;g++){var k=t[g].id,n=h[g].id,k=n>k?k+','+n:n+','+k;p[k]=g;p.keys.push(k)}for(g=0;g!==p.keys.length;g++)k=p.keys.pop(),c=p[k],b.push(t[c]), +d.push(h[c]),delete p[k]};b.prototype.setWorld=function(){};var d=new g;b.boundingSphereCheck=function(b,c){return b.position.vsub(c.position,d),Math.pow(b.shape.boundingSphereRadius+c.shape.boundingSphereRadius,2)>d.norm2()};b.prototype.aabbQuery=function(){return console.warn('.aabbQuery is not implemented in this Broadphase subclass.'),[]}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Plane':42,'../shapes/Shape':43}],6:[function(e,m){function b(b,c,k,h,d){l.apply(this); +this.nx=k||10;this.ny=h||10;this.nz=d||10;this.aabbMin=b||new g(100,100,100);this.aabbMax=c||new g(-100,-100,-100);b=this.nx*this.ny*this.nz;if(0>=b)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[];this.binLengths=[];this.bins.length=b;this.binLengths.length=b;for(c=0;b>c;c++)this.bins[c]=[],this.binLengths[c]=0}m.exports=b;var l=e('./Broadphase'),g=e('../math/Vec3'),c=e('../shapes/Shape');b.prototype=new l;b.prototype.constructor=b;var k=new g;new g;b.prototype.collisionPairs=function(b, +g,e){function h(b,d,c,h,g,k,n){b=(b-z)*O|0;d=(d-H)*M|0;c=(c-G)*J|0;h=Z((h-z)*O);g=Z((g-H)*M);k=Z((k-G)*J);0>b?b=0:b>=p&&(b=p-1);0>d?d=0:d>=t&&(d=t-1);0>c?c=0:c>=q&&(c=q-1);0>h?h=0:h>=p&&(h=p-1);0>g?g=0:g>=t&&(g=t-1);0>k?k=0:k>=q&&(k=q-1);b*=u;d*=m;c*=E;h*=u;g*=m;for(k*=E;h>=b;b+=u)for(var e=d;g>=e;e+=m)for(var l=c;k>=l;l+=E){var v=b+e+l;T[v][fa[v]++]=n}}var d=b.numObjects();b=b.bodies;for(var n=this.aabbMax,l=this.aabbMin,p=this.nx,t=this.ny,q=this.nz,u=t*q,m=q,E=1,D=n.x,C=n.y,F=n.z,z=l.x,H=l.y,G= +l.z,O=p/(D-z),M=t/(C-H),J=q/(F-G),D=(D-z)/p,P=(C-H)/t,F=(F-G)/q,N=.5*Math.sqrt(D*D+P*P+F*F),C=c.types,V=C.SPHERE,X=C.PLANE,T=(C.BOX,C.COMPOUND,C.CONVEXPOLYHEDRON,this.bins),fa=this.binLengths,C=this.bins.length,l=0;l!==C;l++)fa[l]=0;for(var Z=Math.ceil,l=Math.min,n=Math.max,l=0;l!==d;l++){var n=b[l],S=n.shape;switch(S.type){case V:var L=n.position.x,U=n.position.y,oa=n.position.z,S=S.radius;h(L-S,U-S,oa-S,L+S,U+S,oa+S,n);break;case X:S.worldNormalNeedsUpdate&&S.computeWorldNormal(n.quaternion);var oa= +S.worldNormal,S=H+.5*P-n.position.y,pa=G+.5*F-n.position.z,R=k;R.set(z+.5*D-n.position.x,S,pa);for(var Y=L=0;L!==p;L++,Y+=u,R.y=S,R.x+=D)for(var na=U=0;U!==t;U++,na+=m,R.z=pa,R.y+=P)for(var la=0,ca=0;la!==q;la++,ca+=E,R.z+=F)if(R.dot(oa)b)b=g=b;return b+'-'+g in this.matrix};b.prototype.set=function(b,g,c){if(b=b.id,g=g.id,g>b)b=g=b;c?this.matrix[b+'-'+g]=!0:delete this.matrix[b+'-'+g]};b.prototype.reset=function(){this.matrix= +{}};b.prototype.setNumObjects=function(){}},{}],9:[function(e,m){function b(d,c){this.from=d?d.clone():new g;this.to=c?c.clone():new g;this._direction=new g;this.precision=1E-4;this.checkCollisionResponse=!0;this.skipBackfaces=!1;this.collisionFilterGroup=this.collisionFilterMask=-1;this.mode=b.ANY;this.result=new k;this.hasHit=!1;this.callback=function(){}}function l(b,c,g,k){k.vsub(c,V);g.vsub(c,h);b.vsub(c,d);var n,q;b=V.dot(V);c=V.dot(h);g=V.dot(d);k=h.dot(h);var e=h.dot(d);return 0<=(n=k*g-c* +e)&&0<=(q=b*e-c*g)&&b*k-c*c>n+q}m.exports=b;var g=e('../math/Vec3');m=e('../math/Quaternion');var c=e('../math/Transform'),k=(e('../shapes/ConvexPolyhedron'),e('../shapes/Box'),e('../collision/RaycastResult')),n=e('../shapes/Shape');e=e('../collision/AABB');b.prototype.constructor=b;b.CLOSEST=1;b.ANY=2;b.ALL=4;var p=new e,t=[];b.prototype.intersectWorld=function(d,c){return this.mode=c.mode||b.ANY,this.result=c.result||new k,this.skipBackfaces=!!c.skipBackfaces,this.collisionFilterMask='undefined'!= +typeof c.collisionFilterMask?c.collisionFilterMask:-1,this.collisionFilterGroup='undefined'!=typeof c.collisionFilterGroup?c.collisionFilterGroup:-1,c.from&&this.from.copy(c.from),c.to&&this.to.copy(c.to),this.callback=c.callback||function(){},this.hasHit=!1,this.result.reset(),this._updateDirection(),this.getAABB(p),t.length=0,d.broadphase.aabbQuery(d,p,t),this.intersectBodies(t),this.hasHit};var h=new g,d=new g;b.pointInTriangle=l;var v=new g,w=new m;b.prototype.intersectBody=function(b,d){d&&(this.result= +d,this._updateDirection());d=this.checkCollisionResponse;if((!d||b.collisionResponse)&&0!==(this.collisionFilterGroup&b.collisionFilterMask)&&0!==(b.collisionFilterGroup&this.collisionFilterMask))for(var c=0,h=b.shapes.length;h>c;c++){var g=b.shapes[c];if((!d||g.collisionResponse)&&(b.quaternion.mult(b.shapeOrientations[c],w),b.quaternion.vmult(b.shapeOffsets[c],v),v.vadd(b.position,v),this.intersectShape(g,w,v,b),this.result._shouldStop))break}};b.prototype.intersectBodies=function(b,d){d&&(this.result= +d,this._updateDirection());d=0;for(var c=b.length;!this.result._shouldStop&&c>d;d++)this.intersectBody(b[d])};b.prototype._updateDirection=function(){this.to.vsub(this.from,this._direction);this._direction.normalize()};b.prototype.intersectShape=function(b,d,c,h){var g=this.from,k=this._direction;c.vsub(g,V);var n=V.dot(k);k.mult(n,X);X.vadd(g,X);c.distanceTo(X)>b.boundingSphereRadius||(g=this[b.type])&&g.call(this,b,d,c,h)};var y=(new g,new g,new g),x=new g,q=new g,u=new g;new g;new k;b.prototype.intersectBox= +function(b,d,c,h){return this.intersectConvex(b.convexPolyhedronRepresentation,d,c,h)};b.prototype[n.types.BOX]=b.prototype.intersectBox;b.prototype.intersectPlane=function(b,d,c,h){var k=this.from,n=this.to,q=this._direction,e=new g(0,0,1);d.vmult(e,e);var l=new g;k.vsub(c,l);d=l.dot(e);n.vsub(c,l);l=l.dot(e);if(!(0m)&&(m=l[0]),(null===t||l[1]u)&&(u=l[1])),null!==p)for(e=[],d.getRectMinMax(p,t,m,u,e),p=(e[0],e[1],p);m>=p;p++)for(e=t;u>=e;e++){if(this.result._shouldStop||(d.getConvexTrianglePillar(p,e,!1),c.pointToWorldFrame(k,h,d.pillarOffset,q),this.intersectConvex(d.pillarConvex, +h,q,n,A),this.result._shouldStop))return;d.getConvexTrianglePillar(p,e,!0);c.pointToWorldFrame(k,h,d.pillarOffset,q);this.intersectConvex(d.pillarConvex,h,q,n,A)}};b.prototype[n.types.HEIGHTFIELD]=b.prototype.intersectHeightfield;var E=new g,D=new g;b.prototype.intersectSphere=function(b,d,c,h){d=this.from;var g=this.to,k=Math.pow(g.x-d.x,2)+Math.pow(g.y-d.y,2)+Math.pow(g.z-d.z,2),n=2*((g.x-d.x)*(d.x-c.x)+(g.y-d.y)*(d.y-c.y)+(g.z-d.z)*(d.z-c.z)),q=Math.pow(n,2)-4*k*(Math.pow(d.x-c.x,2)+Math.pow(d.y- +c.y,2)+Math.pow(d.z-c.z,2)-Math.pow(b.radius,2));if(!(0>q))if(0===q)d.lerp(g,q,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1);else{var e=(-n-Math.sqrt(q))/(2*k),k=(-n+Math.sqrt(q))/(2*k);(0<=e&&1>=e&&(d.lerp(g,e,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1)),this.result._shouldStop)||0<=k&&1>=k&&(d.lerp(g,k,E),E.vsub(c,D),D.normalize(),this.reportIntersection(D,E,b,h,-1))}};b.prototype[n.types.SPHERE]=b.prototype.intersectSphere;var C=new g,F=(new g,new g,new g); +b.prototype.intersectConvex=function(b,d,c,h,g){g=g&&g.faceList||null;for(var k=b.faces,n=b.vertices,e=b.faceNormals,p=this._direction,t=this.from,m=t.distanceTo(this.to),v=g?g.length:k.length,w=this.result,A=0;!w._shouldStop&&v>A;A++){var z=g?g[A]:A,E=k[z],D=e[z],L=d,H=c;F.copy(n[E[0]]);L.vmult(F,F);F.vadd(H,F);F.vsub(t,F);L.vmult(D,C);D=p.dot(C);if(!(Math.abs(D)D)))for(p.mult(D,y),y.vadd(t,y),x.copy(n[E[0]]),L.vmult(x,x),H.vadd(x,x),D=1;!w._shouldStop&&Dm||this.reportIntersection(C,y,b,h,z)}}};b.prototype[n.types.CONVEXPOLYHEDRON]=b.prototype.intersectConvex;var z=new g,H=new g,G=new g,O=new g,M=new g,J=new g,P=(new e,[]),N=new c;b.prototype.intersectTrimesh=function(b,d,h,g,k){k=(k&&k.faceList||null,b.indices);var n=(b.vertices,b.faceNormals,this.from),e=this.to,p=this._direction;N.position.copy(h);N.quaternion.copy(d); +c.vectorToLocalFrame(h,d,p,H);c.pointToLocalFrame(h,d,n,G);c.pointToLocalFrame(h,d,e,O);n=G.distanceSquared(O);b.tree.rayQuery(this,N,P);e=0;for(p=P.length;!this.result._shouldStop&&e!==p;e++){var t=P[e];b.getNormal(t,z);b.getVertex(k[3*t],x);x.vsub(G,F);var m=H.dot(z),m=z.dot(F)/m;0>m||(H.scale(m,y),y.vadd(G,y),b.getVertex(k[3*t+1],q),b.getVertex(k[3*t+2],u),m=y.distanceSquared(G),!l(y,q,x,u)&&!l(y,x,q,u)||m>n||(c.vectorToWorldFrame(d,z,M),c.pointToWorldFrame(h,d,y,J),this.reportIntersection(M,J, +b,g,t)))}P.length=0};b.prototype[n.types.TRIMESH]=b.prototype.intersectTrimesh;b.prototype.reportIntersection=function(d,c,h,g,k){var n=this.from,q=this.to,e=n.distanceTo(c),l=this.result;if(!(this.skipBackfaces&&0c;c++){for(var n=b[c],e=c-1;0<=e&&!(b[e].aabb.lowerBound.x<=n.aabb.lowerBound.x);e--)b[e+1]=b[e];b[e+1]=n}return b};b.insertionSortY=function(b){for(var c=1,g=b.length;g>c;c++){for(var n=b[c],e=c-1;0<=e&&!(b[e].aabb.lowerBound.y<= +n.aabb.lowerBound.y);e--)b[e+1]=b[e];b[e+1]=n}return b};b.insertionSortZ=function(b){for(var c=1,g=b.length;g>c;c++){for(var n=b[c],e=c-1;0<=e&&!(b[e].aabb.lowerBound.z<=n.aabb.lowerBound.z);e--)b[e+1]=b[e];b[e+1]=n}return b};b.prototype.collisionPairs=function(g,c,k){var n,e=this.axisList,l=e.length,h=this.axisIndex;this.dirty&&(this.sortList(),this.dirty=!1);for(g=0;g!==l;g++){var d=e[g];for(n=g+1;l>n;n++){var m=e[n];if(this.needBroadphaseCollision(d,m)){if(!b.checkBounds(d,m,h))break;this.intersectionTest(d, +m,c,k)}}}};b.prototype.sortList=function(){for(var g=this.axisList,c=this.axisIndex,k=g.length,n=0;n!==k;n++){var e=g[n];e.aabbNeedsUpdate&&e.computeAABB()}0===c?b.insertionSortX(g):1===c?b.insertionSortY(g):2===c&&b.insertionSortZ(g)};b.checkBounds=function(b,c,k){var g,e;0===k?(g=b.position.x,e=c.position.x):1===k?(g=b.position.y,e=c.position.y):2===k&&(g=b.position.z,e=c.position.z);return g+b.boundingRadius>e-c.boundingRadius};b.prototype.autoDetectAxis=function(){for(var b=0,c=0,k=0,n=0,e=0, +l=0,h=this.axisList,d=h.length,m=1/d,w=0;w!==d;w++)var y=h[w],x=y.position.x,b=b+x,c=c+x*x,x=y.position.y,k=k+x,n=n+x*x,y=y.position.z,e=e+y,l=l+y*y;b=c-b*b*m;k=n-k*k*m;e=l-e*e*m;this.axisIndex=b>k?b>e?0:2:k>e?1:2};b.prototype.aabbQuery=function(b,c,k){k=k||[];this.dirty&&(this.sortList(),this.dirty=!1);b=this.axisIndex;var g='x';1===b&&(g='y');2===b&&(g='z');b=this.axisList;for(g=(c.lowerBound[g],c.upperBound[g],0);gk;k++)for(var e=0;3>e;e++){for(var l=0,t=0;3>t;t++)l+=g.elements[k+3*t]*this.elements[t+3*e];c.elements[k+3*e]=l}return c};b.prototype.scale=function(g,c){c=c||new b;for(var k=this.elements,e=c.elements,l=0;3!==l;l++)e[3*l+0]=g.x*k[3*l+0],e[3*l+1]=g.y*k[3*l+1],e[3*l+2]=g.z*k[3*l+2];return c};b.prototype.solve=function(b,c){c=c||new l;for(var g=[],e=0;12>e;e++)g.push(0);for(var p,e=0;3>e;e++)for(p=0;3>p;p++)g[e+4*p]=this.elements[e+3*p];g[3]=b.x;g[7]=b.y;g[11]=b.z;var t, +h,d=3,m=d;do{if(e=m-d,0===g[e+4*e])for(p=e+1;m>p;p++)if(0!==g[e+4*p]){t=4;do h=4-t,g[h+4*e]+=g[h+4*p];while(--t);break}if(0!==g[e+4*e])for(p=e+1;m>p;p++){var w=g[e+4*p]/g[e+4*e];t=4;do h=4-t,g[h+4*p]=e>=h?0:g[h+4*p]-g[h+4*e]*w;while(--t)}}while(--d);if(c.z=g[11]/g[10],c.y=(g[7]-g[6]*c.z)/g[5],c.x=(g[3]-g[2]*c.z-g[1]*c.y)/g[0],isNaN(c.x)||isNaN(c.y)||isNaN(c.z)||1/0===c.x||1/0===c.y||1/0===c.z)throw'Could not solve equation! Got x=['+c.toString()+'], b=['+b.toString()+'], A=['+this.toString()+']'; +return c};b.prototype.e=function(b,c,k){return void 0===k?this.elements[c+3*b]:void(this.elements[c+3*b]=k)};b.prototype.copy=function(b){for(var c=0;cc;c++)b+=this.elements[c]+',';return b};b.prototype.reverse=function(g){g=g||new b;for(var c=[],k=0;18>k;k++)c.push(0);for(var e,k=0;3>k;k++)for(e=0;3>e;e++)c[k+6*e]=this.elements[k+3*e];c[3]=1;c[9]=0;c[15]=0;c[4]=0;c[10]=1;c[16]=0; +c[5]=0;c[11]=0;c[17]=1;var l,t,h=3,d=h;do{if(k=d-h,0===c[k+6*k])for(e=k+1;d>e;e++)if(0!==c[k+6*e]){l=6;do t=6-l,c[t+6*k]+=c[t+6*e];while(--l);break}if(0!==c[k+6*k])for(e=k+1;d>e;e++){var m=c[k+6*e]/c[k+6*k];l=6;do t=6-l,c[t+6*e]=k>=t?0:c[t+6*e]-c[t+6*k]*m;while(--l)}}while(--h);k=2;do{e=k-1;do{m=c[k+6*e]/c[k+6*k];l=6;do t=6-l,c[t+6*e]-=c[t+6*k]*m;while(--l)}while(e--)}while(--k);k=2;do{m=1/c[k+6*k];l=6;do t=6-l,c[t+6*k]*=m;while(--l)}while(k--);k=2;do{e=2;do{if(t=c[3+e+6*k],isNaN(t)||1/0===t)throw'Could not reverse! A=['+ +this.toString()+']';g.e(k,e,t)}while(e--)}while(k--);return g};b.prototype.setRotationFromQuaternion=function(b){var c=b.x,g=b.y,e=b.z,l=b.w,t=c+c,h=g+g,d=e+e;b=c*t;var m=c*h,c=c*d,w=g*h,g=g*d,e=e*d,t=l*t,h=l*h,l=l*d,d=this.elements;return d[0]=1-(w+e),d[1]=m-l,d[2]=c+h,d[3]=m+l,d[4]=1-(b+e),d[5]=g-t,d[6]=c-h,d[7]=g+t,d[8]=1-(b+w),this};b.prototype.transpose=function(g){g=g||new b;for(var c=g.elements,k=this.elements,e=0;3!==e;e++)for(var l=0;3!==l;l++)c[3*e+l]=k[3*l+e];return g}},{'./Vec3':30}], +28:[function(e,m){function b(b,c,d,g){this.x=void 0!==b?b:0;this.y=void 0!==c?c:0;this.z=void 0!==d?d:0;this.w=void 0!==g?g:1}m.exports=b;var l=e('./Vec3');b.prototype.set=function(b,c,d,g){this.x=b;this.y=c;this.z=d;this.w=g};b.prototype.toString=function(){return this.x+','+this.y+','+this.z+','+this.w};b.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]};b.prototype.setFromAxisAngle=function(b,c){var d=Math.sin(.5*c);this.x=b.x*d;this.y=b.y*d;this.z=b.z*d;this.w=Math.cos(.5*c)}; +b.prototype.toAxisAngle=function(b){b=b||new l;this.normalize();var c=2*Math.acos(this.w),d=Math.sqrt(1-this.w*this.w);return.001>d?(b.x=this.x,b.y=this.y,b.z=this.z):(b.x=this.x/d,b.y=this.y/d,b.z=this.z/d),[b,c]};var g=new l,c=new l;b.prototype.setFromVectors=function(b,h){if(b.isAntiparallelTo(h))b.tangents(g,c),this.setFromAxisAngle(g,Math.PI);else{var d=b.cross(h);this.x=d.x;this.y=d.y;this.z=d.z;this.w=Math.sqrt(Math.pow(b.norm(),2)*Math.pow(h.norm(),2))+b.dot(h);this.normalize()}};var k=new l, +n=new l,p=new l;b.prototype.mult=function(c,h){h=h||new b;var d=this.w;return k.set(this.x,this.y,this.z),n.set(c.x,c.y,c.z),h.w=d*c.w-k.dot(n),k.cross(n,p),h.x=d*n.x+c.w*k.x+p.x,h.y=d*n.y+c.w*k.y+p.y,h.z=d*n.z+c.w*k.z+p.z,h};b.prototype.inverse=function(c){var h=this.x,d=this.y,g=this.z,k=this.w;c=c||new b;this.conjugate(c);h=1/(h*h+d*d+g*g+k*k);return c.x*=h,c.y*=h,c.z*=h,c.w*=h,c};b.prototype.conjugate=function(c){return c=c||new b,c.x=-this.x,c.y=-this.y,c.z=-this.z,c.w=this.w,c};b.prototype.normalize= +function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.normalizeFast=function(){var b=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=b,this.y*=b,this.z*=b,this.w*=b)};b.prototype.vmult=function(b,c){c=c||new l;var d=b.x,h=b.y,g=b.z;b=this.x;var k=this.y,e=this.z,q=this.w,n=q*d+k*g-e*h,p=q*h+e*d-b* +g,m=q*g+b*h-k*d,d=-b*d-k*h-e*g;return c.x=n*q+d*-b+p*-e-m*-k,c.y=p*q+d*-k+m*-b-n*-e,c.z=m*q+d*-e+n*-k-p*-b,c};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this.w=b.w,this};b.prototype.toEuler=function(b,c){c=c||'YZX';var d,h,g,k=this.x,e=this.y,q=this.z,n=this.w;switch(c){case 'YZX':c=k*e+q*n;if(.499c&&(d=-2*Math.atan2(k,n),h=-Math.PI/2,g=0),isNaN(d))g=q*q,d=Math.atan2(2*e*n-2*k*q,1-2*e*e-2*g),h=Math.asin(2*c),g=Math.atan2(2* +k*n-2*e*q,1-2*k*k-2*g);break;default:throw Error('Euler order '+c+' not supported yet.');}b.y=d;b.z=h;b.x=g};b.prototype.setFromEuler=function(b,c,d,g){g=g||'XYZ';var h=Math.cos(b/2),k=Math.cos(c/2),e=Math.cos(d/2);b=Math.sin(b/2);c=Math.sin(c/2);d=Math.sin(d/2);return'XYZ'===g?(this.x=b*k*e+h*c*d,this.y=h*c*e-b*k*d,this.z=h*k*d+b*c*e,this.w=h*k*e-b*c*d):'YXZ'===g?(this.x=b*k*e+h*c*d,this.y=h*c*e-b*k*d,this.z=h*k*d-b*c*e,this.w=h*k*e+b*c*d):'ZXY'===g?(this.x=b*k*e-h*c*d,this.y=h*c*e+b*k*d,this.z= +h*k*d+b*c*e,this.w=h*k*e-b*c*d):'ZYX'===g?(this.x=b*k*e-h*c*d,this.y=h*c*e+b*k*d,this.z=h*k*d-b*c*e,this.w=h*k*e+b*c*d):'YZX'===g?(this.x=b*k*e+h*c*d,this.y=h*c*e+b*k*d,this.z=h*k*d-b*c*e,this.w=h*k*e-b*c*d):'XZY'===g&&(this.x=b*k*e-h*c*d,this.y=h*c*e-b*k*d,this.z=h*k*d+b*c*e,this.w=h*k*e+b*c*d),this};b.prototype.clone=function(){return new b(this.x,this.y,this.z,this.w)}},{'./Vec3':30}],29:[function(e,m){function b(b){b=b||{};this.position=new l;b.position&&this.position.copy(b.position);this.quaternion= +new g;b.quaternion&&this.quaternion.copy(b.quaternion)}var l=e('./Vec3'),g=e('./Quaternion');m.exports=b;var c=new g;b.pointToLocalFrame=function(b,g,e,m){m=m||new l;return e.vsub(b,m),g.conjugate(c),c.vmult(m,m),m};b.prototype.pointToLocal=function(c,g){return b.pointToLocalFrame(this.position,this.quaternion,c,g)};b.pointToWorldFrame=function(b,c,g,e){e=e||new l;return c.vmult(g,e),e.vadd(b,e),e};b.prototype.pointToWorld=function(c,g){return b.pointToWorldFrame(this.position,this.quaternion,c,g)}; +b.prototype.vectorToWorldFrame=function(b,c){c=c||new l;return this.quaternion.vmult(b,c),c};b.vectorToWorldFrame=function(b,c,g){return b.vmult(c,g),g};b.vectorToLocalFrame=function(b,c,g,e){e=e||new l;return c.w*=-1,c.vmult(g,e),c.w*=-1,e}},{'./Quaternion':28,'./Vec3':30}],30:[function(e,m){function b(b,c,g){this.x=b||0;this.y=c||0;this.z=g||0}m.exports=b;var l=e('./Mat3');b.ZERO=new b(0,0,0);b.UNIT_X=new b(1,0,0);b.UNIT_Y=new b(0,1,0);b.UNIT_Z=new b(0,0,1);b.prototype.cross=function(c,g){var k= +c.x,h=c.y;c=c.z;var d=this.x,e=this.y,n=this.z;return g=g||new b,g.x=e*c-n*h,g.y=n*k-d*c,g.z=d*h-e*k,g};b.prototype.set=function(b,c,g){return this.x=b,this.y=c,this.z=g,this};b.prototype.setZero=function(){this.x=this.y=this.z=0};b.prototype.vadd=function(c,g){return g?(g.x=c.x+this.x,g.y=c.y+this.y,g.z=c.z+this.z,void 0):new b(this.x+c.x,this.y+c.y,this.z+c.z)};b.prototype.vsub=function(c,g){return g?(g.x=this.x-c.x,g.y=this.y-c.y,g.z=this.z-c.z,void 0):new b(this.x-c.x,this.y-c.y,this.z-c.z)}; +b.prototype.crossmat=function(){return new l([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])};b.prototype.normalize=function(){var b=this.x,c=this.y,g=this.z,b=Math.sqrt(b*b+c*c+g*g);0Math.abs(g.x)?(c.set(1,0,0),g.cross(c,b)):(c.set(0,1,0),g.cross(c,b)),g.cross(b,k)):(b.set(1,0,0),k.set(0, +1,0))};b.prototype.toString=function(){return this.x+','+this.y+','+this.z};b.prototype.toArray=function(){return[this.x,this.y,this.z]};b.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this};b.prototype.lerp=function(b,c,g){var h=this.x,d=this.y,k=this.z;g.x=h+(b.x-h)*c;g.y=d+(b.y-d)*c;g.z=k+(b.z-k)*c};b.prototype.almostEquals=function(b,c){return void 0===c&&(c=1E-6),Math.abs(this.x-b.x)>c||Math.abs(this.y-b.y)>c||Math.abs(this.z-b.z)>c?!1:!0};b.prototype.almostZero=function(b){return void 0=== +b&&(b=1E-6),Math.abs(this.x)>b||Math.abs(this.y)>b||Math.abs(this.z)>b?!1:!0};var k=new b;b.prototype.isAntiparallelTo=function(b,c){return this.negate(k),k.almostEquals(b,c)};b.prototype.clone=function(){return new b(this.x,this.y,this.z)}},{'./Mat3':27}],31:[function(e,m){function b(d){d=d||{};l.apply(this);this.id=b.idCounter++;this.postStep=this.preStep=this.world=null;this.vlambda=new g;this.collisionFilterGroup='number'==typeof d.collisionFilterGroup?d.collisionFilterGroup:1;this.collisionFilterMask= +'number'==typeof d.collisionFilterMask?d.collisionFilterMask:1;this.collisionResponse=!0;this.position=new g;d.position&&this.position.copy(d.position);this.previousPosition=new g;this.initPosition=new g;this.velocity=new g;d.velocity&&this.velocity.copy(d.velocity);this.initVelocity=new g;this.force=new g;var h='number'==typeof d.mass?d.mass:0;this.mass=h;this.invMass=0=h?b.STATIC: +b.DYNAMIC;typeof d.type==typeof b.STATIC&&(this.type=d.type);this.allowSleep='undefined'!=typeof d.allowSleep?d.allowSleep:!0;this.sleepState=0;this.sleepSpeedLimit='undefined'!=typeof d.sleepSpeedLimit?d.sleepSpeedLimit:.1;this.sleepTimeLimit='undefined'!=typeof d.sleepTimeLimit?d.sleepTimeLimit:1;this.timeLastSleepy=0;this._wakeUpAfterNarrowphase=!1;this.torque=new g;this.quaternion=new k;d.quaternion&&this.quaternion.copy(d.quaternion);this.initQuaternion=new k;this.angularVelocity=new g;d.angularVelocity&& +this.angularVelocity.copy(d.angularVelocity);this.initAngularVelocity=new g;this.interpolatedPosition=new g;this.interpolatedQuaternion=new k;this.shapes=[];this.shapeOffsets=[];this.shapeOrientations=[];this.inertia=new g;this.invInertia=new g;this.invInertiaWorld=new c;this.invMassSolve=0;this.invInertiaSolve=new g;this.invInertiaWorldSolve=new c;this.fixedRotation='undefined'!=typeof d.fixedRotation?d.fixedRotation:!1;this.angularDamping='undefined'!=typeof d.angularDamping?d.angularDamping:.01; +this.aabb=new n;this.aabbNeedsUpdate=!0;this.wlambda=new g;d.shape&&this.addShape(d.shape);this.updateMassProperties()}m.exports=b;var l=e('../utils/EventTarget'),g=(e('../shapes/Shape'),e('../math/Vec3')),c=e('../math/Mat3'),k=e('../math/Quaternion'),n=(e('../material/Material'),e('../collision/AABB')),p=e('../shapes/Box');b.prototype=new l;b.prototype.constructor=b;b.DYNAMIC=1;b.STATIC=2;b.KINEMATIC=4;b.AWAKE=0;b.SLEEPY=1;b.SLEEPING=2;b.idCounter=0;b.prototype.wakeUp=function(){var d=this.sleepState; +this.sleepState=0;d===b.SLEEPING&&this.dispatchEvent({type:'wakeup'})};b.prototype.sleep=function(){this.sleepState=b.SLEEPING;this.velocity.set(0,0,0);this.angularVelocity.set(0,0,0)};b.sleepyEvent={type:'sleepy'};b.sleepEvent={type:'sleep'};b.prototype.sleepTick=function(d){if(this.allowSleep){var c=this.sleepState,h=this.velocity.norm2()+this.angularVelocity.norm2(),g=Math.pow(this.sleepSpeedLimit,2);c===b.AWAKE&&g>h?(this.sleepState=b.SLEEPY,this.timeLastSleepy=d,this.dispatchEvent(b.sleepyEvent)): +c===b.SLEEPY&&h>g?this.wakeUp():c===b.SLEEPY&&d-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(b.sleepEvent))}};b.prototype.updateSolveMassProperties=function(){this.sleepState===b.SLEEPING||this.type===b.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))};b.prototype.pointToLocalFrame=function(b, +d){d=d||new g;return b.vsub(this.position,d),this.quaternion.conjugate().vmult(d,d),d};b.prototype.vectorToLocalFrame=function(b,d){d=d||new g;return this.quaternion.conjugate().vmult(b,d),d};b.prototype.pointToWorldFrame=function(b,d){d=d||new g;return this.quaternion.vmult(b,d),d.vadd(this.position,d),d};b.prototype.vectorToWorldFrame=function(b,d){d=d||new g;return this.quaternion.vmult(b,d),d};var t=new g,h=new k;b.prototype.addShape=function(b,d,c){var h=new g,e=new k;return d&&h.copy(d),c&& +e.copy(c),this.shapes.push(b),this.shapeOffsets.push(h),this.shapeOrientations.push(e),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,this};b.prototype.updateBoundingRadius=function(){for(var b=this.shapes,d=this.shapeOffsets,c=b.length,h=0,g=0;g!==c;g++){var k=b[g];k.updateBoundingSphereRadius();var e=d[g].norm(),k=k.boundingSphereRadius;e+k>h&&(h=e+k)}this.boundingRadius=h};var d=new n;b.prototype.computeAABB=function(){for(var b=this.shapes,c=this.shapeOffsets, +g=this.shapeOrientations,k=b.length,e=this.quaternion,q=this.aabb,n=0;n!==k;n++){var l=b[n];g[n].mult(e,h);h.vmult(c[n],t);t.vadd(this.position,t);l.calculateWorldAABB(t,h,d.lowerBound,d.upperBound);0===n?q.copy(d):q.extend(d)}this.aabbNeedsUpdate=!1};var v=new c,w=new c;new c;b.prototype.updateInertiaWorld=function(b){var d=this.invInertia;if(d.x!==d.y||d.y!==d.z||b)v.setRotationFromQuaternion(this.quaternion),v.transpose(w),v.scale(d,v),v.mmult(w,this.invInertiaWorld)};var y=new g,x=new g;b.prototype.applyForce= +function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,y),y.cross(d,x),this.force.vadd(d,this.force),this.torque.vadd(x,this.torque))};var q=new g,u=new g;b.prototype.applyLocalForce=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,q),this.pointToWorldFrame(c,u),this.applyForce(q,u))};var A=new g,E=new g,D=new g;b.prototype.applyImpulse=function(d,c){this.type===b.DYNAMIC&&(c.vsub(this.position,A),E.copy(d),E.mult(this.invMass,E),this.velocity.vadd(E,this.velocity),A.cross(d,D), +this.invInertiaWorld.vmult(D,D),this.angularVelocity.vadd(D,this.angularVelocity))};var C=new g,F=new g;b.prototype.applyLocalImpulse=function(d,c){this.type===b.DYNAMIC&&(this.vectorToWorldFrame(d,C),this.pointToWorldFrame(c,F),this.applyImpulse(C,F))};var z=new g;b.prototype.updateMassProperties=function(){this.invMass=0k;k++)this.updateWheelTransform(k);this.currentVehicleSpeedKmHour= -3.6*h.velocity.norm();k=new f;this.getVehicleAxisWorld(this.indexForwardAxis,k);0>k.dot(h.velocity)&&(this.currentVehicleSpeedKmHour*=-1);for(k=0;c>k;k++)this.castRay(d[k]);this.updateSuspension(b);for(var l=new f,q=new f,k=0;c>k;k++){var g=d[k],n=g.suspensionForce;n>g.maxSuspensionForce&&(n=g.maxSuspensionForce);g.raycastResult.hitNormalWorld.scale(n*b,l);g.raycastResult.hitPointWorld.vsub(h.position,q);h.applyImpulse(l,g.raycastResult.hitPointWorld)}this.updateFriction(b);l=new f;q=new f;n=new f; -for(k=0;c>k;k++){g=d[k];h.getVelocityAtWorldPoint(g.chassisConnectionPointWorld,n);var p=1;switch(this.indexUpAxis){case 1:p=-1}if(g.isInContact){this.getVehicleAxisWorld(this.indexForwardAxis,q);var m=q.dot(g.raycastResult.hitNormalWorld);g.raycastResult.hitNormalWorld.scale(m,l);q.vsub(l,q);m=q.dot(n);g.deltaRotation=p*m*b/g.radius}!g.sliding&&g.isInContact||0===g.engineForce||!g.useCustomSlidingRotationalSpeed||(g.deltaRotation=(0 -Math.abs(g.engineForce)&&(g.deltaRotation=0);g.rotation+=g.deltaRotation;g.deltaRotation*=.99}};b.prototype.updateSuspension=function(){for(var b=this.chassisBody.mass,d=this.wheelInfos,c=d.length,h=0;c>h;h++){var f=d[h];if(f.isInContact){var k;k=f.suspensionStiffness*(f.suspensionRestLength-f.suspensionLength)*f.clippedInvContactDotSuspension;var l=f.suspensionRelativeVelocity;k-=(0>l?f.dampingCompression:f.dampingRelaxation)*l;f.suspensionForce=k*b;0>f.suspensionForce&&(f.suspensionForce=0)}else f.suspensionForce= -0}};b.prototype.removeFromWorld=function(b){this.constraints;b.remove(this.chassisBody);b.removeEventListener('preStep',this.preStepCallback);this.world=null};var d=new f,v=new f;b.prototype.castRay=function(b){this.updateWheelTransformWorld(b);var c=this.chassisBody,h=-1;b.directionWorld.scale(b.suspensionRestLength+b.radius,d);var k=b.chassisConnectionPointWorld;k.vadd(d,v);var l=b.raycastResult;l.reset();var g=c.collisionResponse;c.collisionResponse=!1;this.world.rayTest(k,v,l);c.collisionResponse= -g;k=l.body;(b.raycastResult.groundObject=0,k)?(h=l.distance,b.raycastResult.hitNormalWorld=l.hitNormalWorld,b.isInContact=!0,b.suspensionLength=l.distance-b.radius,l=b.suspensionRestLength-b.maxSuspensionTravel,k=b.suspensionRestLength+b.maxSuspensionTravel,b.suspensionLengthk&&(b.suspensionLength=k,b.raycastResult.reset()),l=b.raycastResult.hitNormalWorld.dot(b.directionWorld),k=new f,c.getVelocityAtWorldPoint(b.raycastResult.hitPointWorld,k),c=b.raycastResult.hitNormalWorld.dot(k), --.1<=l?(b.suspensionRelativeVelocity=0,b.clippedInvContactDotSuspension=10):(l=-1/l,b.suspensionRelativeVelocity=c*l,b.clippedInvContactDotSuspension=l)):(b.suspensionLength=b.suspensionRestLength+0*b.maxSuspensionTravel,b.suspensionRelativeVelocity=0,b.directionWorld.scale(-1,b.raycastResult.hitNormalWorld),b.clippedInvContactDotSuspension=1);return h};b.prototype.updateWheelTransformWorld=function(b){b.isInContact=!1;var d=this.chassisBody;d.pointToWorldFrame(b.chassisConnectionPointLocal,b.chassisConnectionPointWorld); -d.vectorToWorldFrame(b.directionLocal,b.directionWorld);d.vectorToWorldFrame(b.axleLocal,b.axleWorld)};b.prototype.updateWheelTransform=function(b){b=this.wheelInfos[b];this.updateWheelTransformWorld(b);b.directionLocal.scale(-1,p);t.copy(b.axleLocal);p.cross(t,h);h.normalize();t.normalize();var d=b.steering,f=new c;f.setFromAxisAngle(p,d);d=new c;d.setFromAxisAngle(t,b.rotation);var k=b.worldTransform.quaternion;this.chassisBody.quaternion.mult(f,k);k.mult(d,k);k.normalize();f=b.worldTransform.position; -f.copy(b.directionWorld);f.scale(b.suspensionLength,f);f.vadd(b.chassisConnectionPointWorld,f)};var w=[new f(1,0,0),new f(0,1,0),new f(0,0,1)];b.prototype.getWheelTransformWorld=function(b){return this.wheelInfos[b].worldTransform};var y=new f,x=[],q=[];b.prototype.updateFriction=function(b){for(var d=this.wheelInfos,c=d.length,h=this.chassisBody,k=0,g=0;c>g;g++){var n=d[g],p=n.raycastResult.body;p&&k++;n.sideImpulse=0;n.forwardImpulse=0;q[g]||(q[g]=new f);x[g]||(x[g]=new f)}for(g=0;c>g;g++)if(n= -d[g],p=n.raycastResult.body){var m=x[g];this.getWheelTransformWorld(g).vectorToWorldFrame(w[this.indexRightAxis],m);var k=n.raycastResult.hitNormalWorld,t=m.dot(k);k.scale(t,y);m.vsub(y,m);m.normalize();k.cross(m,q[g]);q[g].normalize();k=n;var t=h,v=n.raycastResult.hitPointWorld,C=n.raycastResult.hitPointWorld;if(1.1g;g++){n=d[g];p=n.raycastResult.body;v=0;if(n.slipInfo=1,p){var k=n.brake?n.brake:0,F=h,C=p,m=n.raycastResult.hitPointWorld,z=q[g],v=k,t=0,D=m,M=u,na=A,la=E;F.getVelocityAtWorldPoint(D,M);C.getVelocityAtWorldPoint(D,na);M.vsub(na,la);D=z.dot(la);F=l(F,m,z);C=l(C,m,z);v=(t=1/(F+C)*-D,t>v&&(t=v),-v>t&&(t=-v),t);v+=n.engineForce*b;k/=v;n.slipInfo*=k}if(n.forwardImpulse=0,n.skidInfo=1,p)if(n.skidInfo=1,p=n.suspensionForce*b*n.frictionSlip,k=p*p,n.forwardImpulse=v,t=.5*n.forwardImpulse,v= -1*n.sideImpulse,t=t*t+v*v,n.sliding=!1,t>k)this.sliding=!0,n.sliding=!0,k=p/Math.sqrt(t),n.skidInfo*=k}if(this.sliding)for(g=0;c>g;g++)n=d[g],0!==n.sideImpulse&&1>n.skidInfo&&(n.forwardImpulse*=n.skidInfo,n.sideImpulse*=n.skidInfo);for(g=0;c>g;g++){n=d[g];b=new f;if(b.copy(n.raycastResult.hitPointWorld),0!==n.forwardImpulse)p=new f,q[g].scale(n.forwardImpulse,p),h.applyImpulse(p,b);0!==n.sideImpulse&&(p=n.raycastResult.body,k=new f,k.copy(n.raycastResult.hitPointWorld),t=new f,x[g].scale(n.sideImpulse, -t),h.pointToLocalFrame(b,b),b['xyz'[this.indexUpAxis]]*=n.rollInfluence,h.pointToWorldFrame(b,b),h.applyImpulse(t,b),t.scale(-1,t),p.applyImpulse(t,k))}};var u=new f,A=new f,E=new f,D=new f,C=new f,F=new f,z=new f,H=new f,G=new f,O=new f},{'../collision/Ray':9,'../collision/RaycastResult':10,'../math/Quaternion':28,'../math/Vec3':30,'../objects/WheelInfo':36,'./Body':31}],33:[function(g,m){function b(b){(this.wheelBodies=[],this.coordinateSystem='undefined'==typeof b.coordinateSystem?new k(1,2,3): -b.coordinateSystem.clone(),this.chassisBody=b.chassisBody,this.chassisBody)||(b=new c(new k(5,2,.5)),this.chassisBody=new l(1,b));this.constraints=[];this.wheelAxes=[];this.wheelForces=[]}var l=g('./Body'),f=g('../shapes/Sphere'),c=g('../shapes/Box'),k=g('../math/Vec3'),n=g('../constraints/HingeConstraint');m.exports=b;b.prototype.addWheel=function(b){b=b||{};var d=b.body;d||(d=new l(1,new f(1.2)));this.wheelBodies.push(d);this.wheelForces.push(0);var c=(new k,'undefined'!=typeof b.position?b.position.clone(): -new k),h=new k;this.chassisBody.pointToWorldFrame(c,h);d.position.set(h.x,h.y,h.z);b='undefined'!=typeof b.axis?b.axis.clone():new k(0,1,0);this.wheelAxes.push(b);d=new n(this.chassisBody,d,{pivotA:c,axisA:b,pivotB:k.ZERO,axisB:b,collideConnected:!1});return this.constraints.push(d),this.wheelBodies.length-1};b.prototype.setSteeringValue=function(b,d){var c=this.wheelAxes[d],h=Math.cos(b);b=Math.sin(b);var f=c.x,c=c.y;this.constraints[d].axisA.set(h*f-b*c,b*f+h*c,0)};b.prototype.setMotorSpeed=function(b, +3.6*h.velocity.norm();k=new g;this.getVehicleAxisWorld(this.indexForwardAxis,k);0>k.dot(h.velocity)&&(this.currentVehicleSpeedKmHour*=-1);for(k=0;c>k;k++)this.castRay(d[k]);this.updateSuspension(b);for(var e=new g,q=new g,k=0;c>k;k++){var n=d[k],l=n.suspensionForce;l>n.maxSuspensionForce&&(l=n.maxSuspensionForce);n.raycastResult.hitNormalWorld.scale(l*b,e);n.raycastResult.hitPointWorld.vsub(h.position,q);h.applyImpulse(e,n.raycastResult.hitPointWorld)}this.updateFriction(b);e=new g;q=new g;l=new g; +for(k=0;c>k;k++){n=d[k];h.getVelocityAtWorldPoint(n.chassisConnectionPointWorld,l);var p=1;switch(this.indexUpAxis){case 1:p=-1}if(n.isInContact){this.getVehicleAxisWorld(this.indexForwardAxis,q);var m=q.dot(n.raycastResult.hitNormalWorld);n.raycastResult.hitNormalWorld.scale(m,e);q.vsub(e,q);m=q.dot(l);n.deltaRotation=p*m*b/n.radius}!n.sliding&&n.isInContact||0===n.engineForce||!n.useCustomSlidingRotationalSpeed||(n.deltaRotation=(0 +Math.abs(n.engineForce)&&(n.deltaRotation=0);n.rotation+=n.deltaRotation;n.deltaRotation*=.99}};b.prototype.updateSuspension=function(){for(var b=this.chassisBody.mass,d=this.wheelInfos,c=d.length,h=0;c>h;h++){var g=d[h];if(g.isInContact){var k;k=g.suspensionStiffness*(g.suspensionRestLength-g.suspensionLength)*g.clippedInvContactDotSuspension;var e=g.suspensionRelativeVelocity;k-=(0>e?g.dampingCompression:g.dampingRelaxation)*e;g.suspensionForce=k*b;0>g.suspensionForce&&(g.suspensionForce=0)}else g.suspensionForce= +0}};b.prototype.removeFromWorld=function(b){this.constraints;b.remove(this.chassisBody);b.removeEventListener('preStep',this.preStepCallback);this.world=null};var d=new g,v=new g;b.prototype.castRay=function(b){this.updateWheelTransformWorld(b);var c=this.chassisBody,h=-1;b.directionWorld.scale(b.suspensionRestLength+b.radius,d);var k=b.chassisConnectionPointWorld;k.vadd(d,v);var e=b.raycastResult;e.reset();var q=c.collisionResponse;c.collisionResponse=!1;this.world.rayTest(k,v,e);c.collisionResponse= +q;k=e.body;(b.raycastResult.groundObject=0,k)?(h=e.distance,b.raycastResult.hitNormalWorld=e.hitNormalWorld,b.isInContact=!0,b.suspensionLength=e.distance-b.radius,e=b.suspensionRestLength-b.maxSuspensionTravel,k=b.suspensionRestLength+b.maxSuspensionTravel,b.suspensionLengthk&&(b.suspensionLength=k,b.raycastResult.reset()),e=b.raycastResult.hitNormalWorld.dot(b.directionWorld),k=new g,c.getVelocityAtWorldPoint(b.raycastResult.hitPointWorld,k),c=b.raycastResult.hitNormalWorld.dot(k), +-.1<=e?(b.suspensionRelativeVelocity=0,b.clippedInvContactDotSuspension=10):(e=-1/e,b.suspensionRelativeVelocity=c*e,b.clippedInvContactDotSuspension=e)):(b.suspensionLength=b.suspensionRestLength+0*b.maxSuspensionTravel,b.suspensionRelativeVelocity=0,b.directionWorld.scale(-1,b.raycastResult.hitNormalWorld),b.clippedInvContactDotSuspension=1);return h};b.prototype.updateWheelTransformWorld=function(b){b.isInContact=!1;var d=this.chassisBody;d.pointToWorldFrame(b.chassisConnectionPointLocal,b.chassisConnectionPointWorld); +d.vectorToWorldFrame(b.directionLocal,b.directionWorld);d.vectorToWorldFrame(b.axleLocal,b.axleWorld)};b.prototype.updateWheelTransform=function(b){b=this.wheelInfos[b];this.updateWheelTransformWorld(b);b.directionLocal.scale(-1,p);t.copy(b.axleLocal);p.cross(t,h);h.normalize();t.normalize();var d=b.steering,g=new c;g.setFromAxisAngle(p,d);d=new c;d.setFromAxisAngle(t,b.rotation);var k=b.worldTransform.quaternion;this.chassisBody.quaternion.mult(g,k);k.mult(d,k);k.normalize();g=b.worldTransform.position; +g.copy(b.directionWorld);g.scale(b.suspensionLength,g);g.vadd(b.chassisConnectionPointWorld,g)};var w=[new g(1,0,0),new g(0,1,0),new g(0,0,1)];b.prototype.getWheelTransformWorld=function(b){return this.wheelInfos[b].worldTransform};var y=new g,x=[],q=[];b.prototype.updateFriction=function(b){for(var d=this.wheelInfos,c=d.length,h=this.chassisBody,k=0,e=0;c>e;e++){var n=d[e],p=n.raycastResult.body;p&&k++;n.sideImpulse=0;n.forwardImpulse=0;q[e]||(q[e]=new g);x[e]||(x[e]=new g)}for(e=0;c>e;e++)if(n= +d[e],p=n.raycastResult.body){var m=x[e];this.getWheelTransformWorld(e).vectorToWorldFrame(w[this.indexRightAxis],m);var k=n.raycastResult.hitNormalWorld,t=m.dot(k);k.scale(t,y);m.vsub(y,m);m.normalize();k.cross(m,q[e]);q[e].normalize();k=n;var t=h,v=n.raycastResult.hitPointWorld,C=n.raycastResult.hitPointWorld;if(1.1e;e++){n=d[e];p=n.raycastResult.body;v=0;if(n.slipInfo=1,p){var k=n.brake?n.brake:0,F=h,C=p,m=n.raycastResult.hitPointWorld,z=q[e],v=k,t=0,D=m,M=u,na=A,la=E;F.getVelocityAtWorldPoint(D,M);C.getVelocityAtWorldPoint(D,na);M.vsub(na,la);D=z.dot(la);F=l(F,m,z);C=l(C,m,z);v=(t=1/(F+C)*-D,t>v&&(t=v),-v>t&&(t=-v),t);v+=n.engineForce*b;k/=v;n.slipInfo*=k}if(n.forwardImpulse=0,n.skidInfo=1,p)if(n.skidInfo=1,p=n.suspensionForce*b*n.frictionSlip,k=p*p,n.forwardImpulse=v,t=.5*n.forwardImpulse,v= +1*n.sideImpulse,t=t*t+v*v,n.sliding=!1,t>k)this.sliding=!0,n.sliding=!0,k=p/Math.sqrt(t),n.skidInfo*=k}if(this.sliding)for(e=0;c>e;e++)n=d[e],0!==n.sideImpulse&&1>n.skidInfo&&(n.forwardImpulse*=n.skidInfo,n.sideImpulse*=n.skidInfo);for(e=0;c>e;e++){n=d[e];b=new g;if(b.copy(n.raycastResult.hitPointWorld),0!==n.forwardImpulse)p=new g,q[e].scale(n.forwardImpulse,p),h.applyImpulse(p,b);0!==n.sideImpulse&&(p=n.raycastResult.body,k=new g,k.copy(n.raycastResult.hitPointWorld),t=new g,x[e].scale(n.sideImpulse, +t),h.pointToLocalFrame(b,b),b['xyz'[this.indexUpAxis]]*=n.rollInfluence,h.pointToWorldFrame(b,b),h.applyImpulse(t,b),t.scale(-1,t),p.applyImpulse(t,k))}};var u=new g,A=new g,E=new g,D=new g,C=new g,F=new g,z=new g,H=new g,G=new g,O=new g},{'../collision/Ray':9,'../collision/RaycastResult':10,'../math/Quaternion':28,'../math/Vec3':30,'../objects/WheelInfo':36,'./Body':31}],33:[function(e,m){function b(b){(this.wheelBodies=[],this.coordinateSystem='undefined'==typeof b.coordinateSystem?new k(1,2,3): +b.coordinateSystem.clone(),this.chassisBody=b.chassisBody,this.chassisBody)||(b=new c(new k(5,2,.5)),this.chassisBody=new l(1,b));this.constraints=[];this.wheelAxes=[];this.wheelForces=[]}var l=e('./Body'),g=e('../shapes/Sphere'),c=e('../shapes/Box'),k=e('../math/Vec3'),n=e('../constraints/HingeConstraint');m.exports=b;b.prototype.addWheel=function(b){b=b||{};var d=b.body;d||(d=new l(1,new g(1.2)));this.wheelBodies.push(d);this.wheelForces.push(0);var c=(new k,'undefined'!=typeof b.position?b.position.clone(): +new k),h=new k;this.chassisBody.pointToWorldFrame(c,h);d.position.set(h.x,h.y,h.z);b='undefined'!=typeof b.axis?b.axis.clone():new k(0,1,0);this.wheelAxes.push(b);d=new n(this.chassisBody,d,{pivotA:c,axisA:b,pivotB:k.ZERO,axisB:b,collideConnected:!1});return this.constraints.push(d),this.wheelBodies.length-1};b.prototype.setSteeringValue=function(b,d){var c=this.wheelAxes[d],h=Math.cos(b);b=Math.sin(b);var g=c.x,c=c.y;this.constraints[d].axisA.set(h*g-b*c,b*g+h*c,0)};b.prototype.setMotorSpeed=function(b, d){d=this.constraints[d];d.enableMotor();d.motorTargetVelocity=b};b.prototype.disableMotor=function(b){this.constraints[b].disableMotor()};var p=new k;b.prototype.setWheelForce=function(b,d){this.wheelForces[d]=b};b.prototype.applyWheelForce=function(b,d){var c=this.wheelBodies[d],h=c.torque;this.wheelAxes[d].scale(b,p);c.vectorToWorldFrame(p,p);h.vadd(p,h)};b.prototype.addToWorld=function(b){for(var d=this.constraints,c=this.wheelBodies.concat([this.chassisBody]),h=0;hthis.particles.length&&this.neighbors.pop())};var l=new m;b.prototype.getNeighbors=function(b,d){for(var c=this.particles.length,h=b.id,f=this.smoothingRadius*this.smoothingRadius,k=0;k!==c;k++){var g=this.particles[k];g.position.vsub(b.position,l);h!==g.id&&l.norm2()this.particles.length&&this.neighbors.pop())};var l=new m;b.prototype.getNeighbors=function(b,d){for(var c=this.particles.length,h=b.id,g=this.smoothingRadius*this.smoothingRadius,k=0;k!==c;k++){var e=this.particles[k];e.position.vsub(b.position,l);h!==e.id&&l.norm2()f;f++){k=n[f];c.vmult(k,k);b.vadd(k,k);var l=k.x,g=k.y,k=k.z;l>d.x&&(d.x=l);g>d.y&&(d.y=g);k>d.z&&(d.z=k);ld.dot(this.vertices[this.faces[b][0]]))for(console.error('.faceNormals['+b+'] = Vec3('+d.toString()+') looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.'),d=0;dm&&(m=v,p=u)}for(var m=[],u=c.faces[p],v=u.length,w=0;v>w;w++){var A=c.vertices[u[w]],y=new f;y.copy(A);k.vmult(y,y);h.vadd(y,y);m.push(y)}0<=p&&this.clipFaceAgainstHull(l,b,d, -m,g,n,q)};var h=new f,d=new f,v=new f,w=new f,y=new f,x=new f;b.prototype.findSeparatingAxis=function(b,c,f,k,l,g,n,q){var p=Number.MAX_VALUE,m=0;if(this.uniqueAxes)for(var u=0;u!==this.uniqueAxes.length;u++){f.vmult(this.uniqueAxes[u],h);var t=this.testSepAxis(h,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(h))}else for(var A=n?n.length:this.faces.length,u=0;A>u;u++){t=n?n[u]:u;h.copy(this.faceNormals[t]);f.vmult(h,h);t=this.testSepAxis(h,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(h))}if(b.uniqueAxes)for(u= -0;u!==b.uniqueAxes.length;u++){l.vmult(b.uniqueAxes[u],d);m++;t=this.testSepAxis(d,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(d))}else for(n=q?q.length:b.faces.length,u=0;n>u;u++){t=q?q[u]:u;d.copy(b.faceNormals[t]);l.vmult(d,d);m++;t=this.testSepAxis(d,b,c,f,k,l);if(!1===t)return!1;p>t&&(p=t,g.copy(d))}for(q=0;q!==this.uniqueEdges.length;q++)for(f.vmult(this.uniqueEdges[q],w),m=0;m!==b.uniqueEdges.length;m++)if(l.vmult(b.uniqueEdges[m],y),w.cross(y,x),!x.almostZero()){x.normalize();u=this.testSepAxis(x, -b,c,f,k,l);if(!1===u)return!1;p>u&&(p=u,g.copy(x))}return k.vsub(c,v),0h||d>c)return!1;h-=f;d=c-d;return d>h?h:d};var A=new f,E=new f;b.prototype.calculateLocalInertia=function(b,d){this.computeLocalAABB(A,E);var c=E.x-A.x,h=E.y-A.y,f=E.z-A.z;d.x=1/12*b*(4*h*h+4*f*f);d.y=1/12*b*(4*c*c+4*f*f);d.z=1/12*b*(4*h*h+4*c*c)};b.prototype.getPlaneConstantOfFace= -function(b){return-this.faceNormals[b].dot(this.vertices[this.faces[b][0]])};var D=new f,C=new f,F=new f,z=new f,H=new f,G=new f,O=new f,M=new f;b.prototype.clipFaceAgainstHull=function(b,d,c,h,f,k,l){for(var g=[],n=-1,q=Number.MAX_VALUE,p=0;pm&&(q=m,n=p)}if(!(0>n)){b=this.faces[n];b.connectedFaces=[];for(q=0;qp;p++){m=this.vertices[b[p]];m.vsub(this.vertices[b[(p+1)%q]],C);F.copy(C);c.vmult(F,F);d.vadd(F,F);z.copy(this.faceNormals[n]);c.vmult(z,z);d.vadd(z,z);F.cross(z,H);H.negate(H);G.copy(m);c.vmult(G,G);d.vadd(G,G);m=(-G.dot(H),b.connectedFaces[p]);O.copy(this.faceNormals[m]);m=this.getPlaneConstantOfFace(m);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(this.clipFaceAgainstPlane(h,g,M,m);h.length;)h.shift();for(;g.length;)h.push(g.shift())}O.copy(this.faceNormals[n]); -m=this.getPlaneConstantOfFace(n);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(q=0;q=d&&(console.log('clamped: depth='+d+' to minDist='+(f+'')),d=f),k>=d)c=h[q],0>=d&&l.push({point:c,normal:M,depth:d})}};b.prototype.clipFaceAgainstPlane=function(b,d,c,h){var k,l,g=b.length;if(2>g)return d;var n=b[b.length-1],q=b[0];k=c.dot(n)+h;for(var p=0;g>p;p++){if(q=b[p],l=c.dot(q)+h,0>k){if(0>l){var m=new f;m.copy(q)}else m=new f,n.lerp(q,k/(k-l),m);d.push(m)}else 0>l&&(m=new f,n.lerp(q, -k/(k-l),m),d.push(m),d.push(q));n=q;k=l}return d};b.prototype.computeWorldVertices=function(b,d){for(var c=this.vertices.length;this.worldVertices.lengthf;f++){var k=h[f];k.xd.x&&(d.x=k.x);k.yd.y&&(d.y=k.y);k.zd.z&&(d.z=k.z)}};b.prototype.computeWorldFaceNormals=function(b){for(var d=this.faceNormals.length;this.worldFaceNormals.lengthb&&(b=f)}this.boundingSphereRadius=Math.sqrt(b)};var J=new f;b.prototype.calculateWorldAABB=function(b,d,c,h){for(var f,k,l,g,n,q,p=this.vertices.length,m=this.vertices,u=0;p>u;u++){J.copy(m[u]);d.vmult(J,J);b.vadd(J,J);var t=J;t.xg||void 0===g)&&(g=t.x);t.yn||void 0===n)&&(n=t.y);t.zq||void 0===q)&&(q=t.z)}c.set(f,k,l);h.set(g,n,q)};b.prototype.volume=function(){return 4*Math.PI* -this.boundingSphereRadius/3};b.prototype.getAveragePointLocal=function(b){b=b||new f;for(var d=this.vertices.length,c=this.vertices,h=0;d>h;h++)b.vadd(c[h],b);return b.mult(1/d,b),b};b.prototype.transformAllPoints=function(b,d){var c=this.vertices.length,h=this.vertices;if(d){for(var f=0;c>f;f++){var k=h[f];d.vmult(k,k)}for(f=0;ff;f++)k=h[f],k.vadd(b,k)};var P=new f,N=new f,V=new f;b.prototype.pointIsInside=function(b){var d, -c=this.vertices,h=this.faces,f=this.faceNormals,k=this.faces.length;this.getAveragePointLocal(P);for(var l=0;k>l;l++){d=(this.faces[l].length,f[l]);var g=c[h[l][0]],n=N;b.vsub(g,n);var n=d.dot(n),q=V;P.vsub(g,q);d=d.dot(q);if(0>n&&0d)return!1}return-1};var X=(new f,new f),T=new f;b.project=function(b,d,h,f,k){var l=b.vertices.length;b=b.vertices;T.setZero();c.vectorToLocalFrame(h,f,d,X);c.pointToLocalFrame(h,f,T,T);f=T.dot(X);h=d=b[0].dot(X);for(var g=1;l>g;g++){var n=b[g].dot(X);n>d&& -(d=n);h>n&&(h=n)}if(h-=f,d-=f,h>d)d=h=d;k[0]=d;k[1]=h}},{'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'./Shape':43}],39:[function(g,m){function b(b,g,p,m){var h=[],d=[],k=[],n=[],t=[],x=Math.cos,q=Math.sin;h.push(new f(g*x(0),g*q(0),.5*-p));n.push(0);h.push(new f(b*x(0),b*q(0),.5*p));t.push(1);for(var u=0;m>u;u++){var A=2*Math.PI/m*(u+1),E=2*Math.PI/m*(u+.5);m-1>u?(h.push(new f(g*x(A),g*q(A),.5*-p)),n.push(2*u+2),h.push(new f(b*x(A),b*q(A),.5*p)),t.push(2*u+3),k.push([2*u+2,2* -u+3,2*u+1,2*u])):k.push([0,1,2*u+1,2*u]);(1===m%2||m/2>u)&&d.push(new f(x(E),q(E),0))}k.push(t);d.push(new f(0,0,1));b=[];for(u=0;ud&&(c=d)}this.minValue=c};b.prototype.updateMaxValue=function(){for(var b=this.data,c=b[0][0],f=0;f!==b.length;f++)for(var h=0;h!==b[f].length;h++){var d=b[f][h];d>c&&(c=d)}this.maxValue=c};b.prototype.setHeightValueAtIndex=function(b,c,f){this.data[b][c]=f;this.clearCachedConvexTrianglePillar(b,c,!1);0=b;b++)for(var g=c;h>=g;g++){var n=k[b][g];n>l&&(l=n)}d[0]=this.minValue;d[1]=l};b.prototype.getIndexOfPosition=function(b,c,f,h){var d=this.elementSize,k=this.data;b=Math.floor(b/d);c=Math.floor(c/ -d);return f[0]=b,f[1]=c,h&&(0>b&&(b=0),0>c&&(c=0),b>=k.length-1&&(b=k.length-1),c>=k[0].length-1&&(c=k[0].length-1)),0>b||0>c||b>=k.length-1||c>=k[0].length-1?!1:!0};b.prototype.getHeightAt=function(b,c,f){var h=[];this.getIndexOfPosition(b,c,h,f);b=[];return this.getRectMinMax(h[0],h[1]+1,h[0],h[1]+1,b),(b[0]+b[1])/2};b.prototype.getCacheConvexTrianglePillarKey=function(b,c,f){return b+'_'+c+'_'+(f?1:0)};b.prototype.getCachedConvexTrianglePillar=function(b,c,f){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(b, -c,f)]};b.prototype.setCachedConvexTrianglePillar=function(b,c,f,h,d){this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,f)]={convex:h,offset:d}};b.prototype.clearCachedConvexTrianglePillar=function(b,c,f){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,f)]};b.prototype.getConvexTrianglePillar=function(b,k,l){var h=this.pillarConvex,d=this.pillarOffset;if(this.cacheEnabled){var g=this.getCachedConvexTrianglePillar(b,k,l);if(g)return this.pillarConvex=g.convex,void(this.pillarOffset= -g.offset);h=new f;d=new c;this.pillarConvex=h;this.pillarOffset=d}var g=this.data,n=this.elementSize,p=h.faces;h.vertices.length=6;for(var m=0;6>m;m++)h.vertices[m]||(h.vertices[m]=new c);p.length=5;for(m=0;5>m;m++)p[m]||(p[m]=[]);var m=h.vertices,q=(Math.min(g[b][k],g[b+1][k],g[b][k+1],g[b+1][k+1])-this.minValue)/2+this.minValue;l?(d.set((b+.75)*n,(k+.75)*n,q),m[0].set(.25*n,.25*n,g[b+1][k+1]-q),m[1].set(-.75*n,.25*n,g[b][k+1]-q),m[2].set(.25*n,-.75*n,g[b+1][k]-q),m[3].set(.25*n,.25*n,-q-1),m[4].set(-.75* -n,.25*n,-q-1),m[5].set(.25*n,-.75*n,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3,p[2][0]=2,p[2][1]=5,p[2][2]=3,p[2][3]=0,p[3][0]=3,p[3][1]=4,p[3][2]=1,p[3][3]=0,p[4][0]=1,p[4][1]=4,p[4][2]=5,p[4][3]=2):(d.set((b+.25)*n,(k+.25)*n,q),m[0].set(-.25*n,-.25*n,g[b][k]-q),m[1].set(.75*n,-.25*n,g[b+1][k]-q),m[2].set(-.25*n,.75*n,g[b][k+1]-q),m[3].set(-.25*n,-.25*n,-q-1),m[4].set(.75*n,-.25*n,-q-1),m[5].set(-.25*n,.75*n,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3, -p[2][0]=0,p[2][1]=2,p[2][2]=5,p[2][3]=3,p[3][0]=1,p[3][1]=0,p[3][2]=3,p[3][3]=4,p[4][0]=4,p[4][1]=5,p[4][2]=2,p[4][3]=1);h.computeNormals();h.computeEdges();h.updateBoundingSphereRadius();this.setCachedConvexTrianglePillar(b,k,l,h,d)};b.prototype.calculateLocalInertia=function(b,f){return f=f||new c,f.set(0,0,0),f};b.prototype.volume=function(){return Number.MAX_VALUE};b.prototype.calculateWorldAABB=function(b,c,f,h){f.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);h.set(Number.MAX_VALUE, -Number.MAX_VALUE,Number.MAX_VALUE)};b.prototype.updateBoundingSphereRadius=function(){var b=this.data,f=this.elementSize;this.boundingSphereRadius=(new c(b.length*f,b[0].length*f,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue)))).norm()}},{'../math/Vec3':30,'../utils/Utils':53,'./ConvexPolyhedron':38,'./Shape':43}],41:[function(g,m){function b(){l.call(this);this.type=l.types.PARTICLE}m.exports=b;var l=g('./Shape'),f=g('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia= -function(b,k){return k=k||new f,k.set(0,0,0),k};b.prototype.volume=function(){return 0};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=0};b.prototype.calculateWorldAABB=function(b,f,g,l){g.copy(b);l.copy(b)}},{'../math/Vec3':30,'./Shape':43}],42:[function(g,m){function b(){l.call(this);this.type=l.types.PLANE;this.worldNormal=new f;this.worldNormalNeedsUpdate=!0;this.boundingSphereRadius=Number.MAX_VALUE}m.exports=b;var l=g('./Shape'),f=g('../math/Vec3');b.prototype=new l; -b.prototype.constructor=b;b.prototype.computeWorldNormal=function(b){var c=this.worldNormal;c.set(0,0,1);b.vmult(c,c);this.worldNormalNeedsUpdate=!1};b.prototype.calculateLocalInertia=function(b,c){return c||new f};b.prototype.volume=function(){return Number.MAX_VALUE};var c=new f;b.prototype.calculateWorldAABB=function(b,f,g,l){c.set(0,0,1);f.vmult(c,c);f=Number.MAX_VALUE;g.set(-f,-f,-f);l.set(f,f,f);1===c.x&&(l.x=b.x);1===c.y&&(l.y=b.y);1===c.z&&(l.z=b.z);-1===c.x&&(g.x=b.x);-1===c.y&&(g.y=b.y); --1===c.z&&(g.z=b.z)};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=Number.MAX_VALUE}},{'../math/Vec3':30,'./Shape':43}],43:[function(g,m){function b(){this.id=b.idCounter++;this.boundingSphereRadius=this.type=0;this.collisionResponse=!0;this.material=null}m.exports=b;b=g('./Shape');g('../math/Vec3');g('../math/Quaternion');g('../material/Material');b.prototype.constructor=b;b.prototype.updateBoundingSphereRadius=function(){throw'computeBoundingSphereRadius() not implemented for shape type '+ -this.type;};b.prototype.volume=function(){throw'volume() not implemented for shape type '+this.type;};b.prototype.calculateLocalInertia=function(){throw'calculateLocalInertia() not implemented for shape type '+this.type;};b.idCounter=0;b.types={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256}},{'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'./Shape':43}],44:[function(g,m){function b(b){if(l.call(this),this.radius=void 0!== -b?Number(b):1,this.type=l.types.SPHERE,0>this.radius)throw Error('The sphere radius cannot be negative.');this.updateBoundingSphereRadius()}m.exports=b;var l=g('./Shape'),f=g('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia=function(b,k){k=k||new f;b=2*b*this.radius*this.radius/5;return k.x=b,k.y=b,k.z=b,k};b.prototype.volume=function(){return 4*Math.PI*this.radius/3};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.radius}; -b.prototype.calculateWorldAABB=function(b,f,g,l){f=this.radius;for(var c=['x','y','z'],h=0;hf?f+'_'+ -k:k+'_'+f]=!0},c=0;cb.x&&(b.x=h.x),h.yb.y&&(b.y=h.y),h.zb.z&&(b.z=h.z)};b.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)};b.prototype.updateBoundingSphereRadius=function(){for(var b=0,d=this.vertices,c=new f,h=0,d=d.length/3;h!==d;h++){this.getVertex(h, -c);var k=c.norm2();k>b&&(b=k)}this.boundingSphereRadius=Math.sqrt(b)};var E=(new f,new c),D=new k;b.prototype.calculateWorldAABB=function(b,d,c,h){E.position=b;E.quaternion=d;this.aabb.toWorldFrame(E,D);c.copy(D.lowerBound);h.copy(D.upperBound)};b.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};b.createTorus=function(d,c,h,f,k){d=d||1;c=c||.5;h=h||8;f=f||6;k=k||2*Math.PI;for(var g=[],l=[],q=0;h>=q;q++)for(var n=0;f>=n;n++){var p=n/f*k,m=q/h*Math.PI*2;g.push((d+c*Math.cos(m))* -Math.cos(p),(d+c*Math.cos(m))*Math.sin(p),c*Math.sin(m))}for(q=1;h>=q;q++)for(n=1;f>=n;n++)d=(f+1)*(q-1)+n-1,c=(f+1)*(q-1)+n,k=(f+1)*q+n,l.push((f+1)*q+n-1,d,k),l.push(d,c,k);return new b(g,l)}},{'../collision/AABB':3,'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'../utils/Octree':50,'./Shape':43}],46:[function(g,m){function b(){l.call(this);this.iterations=10;this.tolerance=1E-7}m.exports=b;var l=(g('../math/Vec3'),g('../math/Quaternion'),g('./Solver'));b.prototype=new l;var f= -[],c=[],k=[];b.prototype.solve=function(b,g){var l,h,d,n,p=0,m=this.iterations,x=this.tolerance*this.tolerance,q=this.equations,u=q.length;g=g.bodies;var A=g.length;if(0!==u)for(d=0;d!==A;d++)g[d].updateSolveMassProperties();c.length=u;k.length=u;f.length=u;for(d=0;d!==u;d++){var E=q[d];f[d]=0;k[d]=E.computeB(b);c[d]=1/E.computeC()}if(0!==u){for(d=0;d!==A;d++)E=g[d],p=E.wlambda,E.vlambda.set(0,0,0),p&&p.set(0,0,0);for(p=0;p!==m;p++){for(var D=d=0;D!==u;D++)E=q[D],l=k[D],h=c[D],b=f[D],n=E.computeGWlambda(), -l=h*(l-n-E.eps*b),b+lE.maxForce&&(l=E.maxForce-b),f[D]+=l,d+=0d*d)break}for(d=0;d!==A;d++)E=g[d],m=E.velocity,x=E.angularVelocity,m.vadd(E.vlambda,m),x&&x.vadd(E.wlambda,x)}return p}},{'../math/Quaternion':28,'../math/Vec3':30,'./Solver':47}],47:[function(g,m){function b(){this.equations=[]}m.exports=b;b.prototype.solve=function(){return 0};b.prototype.addEquation=function(b){b.enabled&&this.equations.push(b)};b.prototype.removeEquation= -function(b){var f=this.equations;b=f.indexOf(b);-1!==b&&f.splice(b,1)};b.prototype.removeAllEquations=function(){this.equations.length=0}},{}],48:[function(g,m){function b(b){k.call(this);this.iterations=10;this.tolerance=1E-7;this.subsolver=b;this.nodes=[];for(this.nodePool=[];128>this.nodePool.length;)this.nodePool.push(this.createNode())}function l(b){for(var d=b.length,c=0;c!==d;c++){var f=b[c];if(!(f.visited||f.body.type&h))return f}return!1}function f(b,d,c){d.push(b.body);d=b.eqs.length;for(var h= -0;h!==d;h++){var f=b.eqs[h];-1===c.indexOf(f)&&c.push(f)}}function c(b,d){return d.id-b.id}m.exports=b;var k=(g('../math/Vec3'),g('../math/Quaternion'),g('./Solver'));g=g('../objects/Body');b.prototype=new k;var n=[],p=[],t={bodies:[]},h=g.STATIC,d=[];b.prototype.createNode=function(){return{body:null,children:[],eqs:[],visited:!1}};b.prototype.solve=function(b,h){var k=this.nodePool,g=h.bodies,q=this.equations,m=q.length,v=g.length;for(h=this.subsolver;k.lengthw;w++)n[w]=k[w];for(w=0;w!==v;w++)k=n[w],k.body=g[w],k.children.length=0,k.eqs.length=0,k.visited=!1;for(k=0;k!==m;k++){var v=q[k],w=g.indexOf(v.bi),D=g.indexOf(v.bj),w=n[w],D=n[D];w.children.push(D);w.eqs.push(v);D.children.push(w);D.eqs.push(v)}g=0;q=p;h.tolerance=this.tolerance;for(h.iterations=this.iterations;w=l(n);){q.length=0;t.bodies.length=0;v=w;w=f;m=t.bodies;k=q;d.push(v);v.visited=!0;for(w(v,m,k);d.length;)for(D=d.pop();v=l(D.children);)v.visited=!0,w(v,m,k),d.push(v); -m=q.length;q=q.sort(c);for(w=0;w!==m;w++)h.addEquation(q[w]);h.solve(b,t);h.removeAllEquations();g++}return g}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'./Solver':47}],49:[function(g,m){g=function(){};m.exports=g;g.prototype={constructor:g,addEventListener:function(b,g){void 0===this._listeners&&(this._listeners={});var f=this._listeners;return void 0===f[b]&&(f[b]=[]),-1===f[b].indexOf(g)&&f[b].push(g),this},hasEventListener:function(b,g){if(void 0===this._listeners)return!1; -var f=this._listeners;return void 0!==f[b]&&-1!==f[b].indexOf(g)?!0:!1},removeEventListener:function(b,g){if(void 0===this._listeners)return this;var f=this._listeners;if(void 0===f[b])return this;g=f[b].indexOf(g);return-1!==g&&f[b].splice(g,1),this},dispatchEvent:function(b){if(void 0===this._listeners)return this;var g=this._listeners[b.type];if(void 0!==g){b.target=this;for(var f=0,c=g.length;c>f;f++)g[f].call(this,b)}return this}}},{}],50:[function(g,m){function b(b){b=b||{};this.root=b.root|| -null;this.aabb=b.aabb?b.aabb.clone():new f;this.data=[];this.children=[]}function l(c,f){f=f||{};f.root=null;f.aabb=c;b.call(this,f);this.maxDepth='undefined'!=typeof f.maxDepth?f.maxDepth:8}var f=g('../collision/AABB'),c=g('../math/Vec3');m.exports=l;l.prototype=new b;b.prototype.reset=function(){this.children.length=this.data.length=0};b.prototype.insert=function(b,c,h){var d=this.data;if(h=h||0,!this.aabb.contains(b))return!1;var f=this.children;if(h<(this.maxDepth||this.root.maxDepth)){var k= -!1;f.length||(this.subdivide(),k=!0);for(var g=0;8!==g;g++)if(f[g].insert(b,c,h+1))return!0;k&&(f.length=0)}return d.push(c),!0};var k=new c;b.prototype.subdivide=function(){var g=this.aabb,l=g.lowerBound,h=g.upperBound,g=this.children;g.push(new b({aabb:new f({lowerBound:new c(0,0,0)})}),new b({aabb:new f({lowerBound:new c(1,0,0)})}),new b({aabb:new f({lowerBound:new c(1,1,0)})}),new b({aabb:new f({lowerBound:new c(1,1,1)})}),new b({aabb:new f({lowerBound:new c(0,1,1)})}),new b({aabb:new f({lowerBound:new c(0, -0,1)})}),new b({aabb:new f({lowerBound:new c(1,0,1)})}),new b({aabb:new f({lowerBound:new c(0,1,0)})}));h.vsub(l,k);k.scale(.5,k);for(var h=this.root||this,d=0;8!==d;d++){var n=g[d];n.root=h;var m=n.aabb.lowerBound;m.x*=k.x;m.y*=k.y;m.z*=k.z;m.vadd(l,m);m.vadd(k,n.aabb.upperBound)}};b.prototype.aabbQuery=function(b,c){for(var h=(this.data,this.children,[this]);h.length;){var d=h.pop();d.aabb.overlaps(b)&&Array.prototype.push.apply(c,d.data);Array.prototype.push.apply(h,d.children)}return c};var n= -new f;b.prototype.rayQuery=function(b,c,h){return b.getAABB(n),n.toLocalFrame(c,n),this.aabbQuery(n,h),h};b.prototype.removeEmptyNodes=function(){for(var b=[this];b.length;){for(var c=b.pop(),h=c.children.length-1;0<=h;h--)c.children[h].data.length||c.children.splice(h,1);Array.prototype.push.apply(b,c.children)}}},{'../collision/AABB':3,'../math/Vec3':30}],51:[function(g,m){function b(){this.objects=[];this.type=Object}m.exports=b;b.prototype.release=function(){for(var b=arguments.length,f=0;f!== -b;f++)this.objects.push(arguments[f])};b.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()};b.prototype.constructObject=function(){throw Error('constructObject() not implemented in this Pool subclass yet!');}},{}],52:[function(g,m){function b(){this.data={keys:[]}}m.exports=b;b.prototype.get=function(b,f){b>f&&(b=f=b);return this.data[b+'-'+f]};b.prototype.set=function(b,f,c){b>f&&(b=f=b);var k=b+'-'+f;this.get(b,f)||this.data.keys.push(k);this.data[k]= -c};b.prototype.reset=function(){for(var b=this.data,f=b.keys;0p.boundingSphereRadius+t.boundingSphereRadius)){var v=null;p.material&&t.material&&(v=c.getContactMaterial(p.material,t.material)||null);this.currentContactMaterial=v||l||c.defaultContactMaterial;(v=this[p.type|t.type])&&(p.type=A.dot(m)){var u=this.createContactEquation(q,n,b,d);u.ni.copy(A);var t=D;A.scale(m.dot(A),t);p.vsub(t,t);u.ri.copy(t);u.ri.vsub(q.position,u.ri);u.rj.copy(p);u.rj.vsub(n.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}}};var C=new c,F=new c,z=(new c,new c),H=new c,G=new c,O=new c,M=new c,J=new c,P=new c,N=new c,V=new c,X=new c,T=new c,fa=new m,Z=[];b.prototype[l.types.SPHERE|l.types.TRIMESH]=b.prototype.sphereTrimesh=function(b, -d,c,h,g,l,q,n){k.pointToLocalFrame(h,l,c,P);g=b.radius;fa.lowerBound.set(P.x-g,P.y-g,P.z-g);fa.upperBound.set(P.x+g,P.y+g,P.z+g);d.getTrianglesInAABB(fa,Z);var p=b.radius*b.radius;for(g=0;gm;m++)if(d.getVertex(d.indices[3*Z[g]+m],z),z.vsub(P,F),F.norm2()<=p){H.copy(z);k.pointToWorldFrame(h,l,H,z);z.vsub(c,F);var u=this.createContactEquation(q,n,b,d);u.ni.copy(F);u.ni.normalize();u.ri.copy(u.ni);u.ri.scale(b.radius,u.ri);u.ri.vadd(c,u.ri);u.ri.vsub(q.position,u.ri);u.rj.copy(z); -u.rj.vsub(n.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}for(g=0;gm;m++)d.getVertex(d.indices[3*Z[g]+m],G),d.getVertex(d.indices[3*Z[g]+(m+1)%3],O),O.vsub(G,M),P.vsub(O,N),c=N.dot(M),P.vsub(G,N),u=N.dot(M),0c&&(P.vsub(G,N),J.copy(M),J.normalize(),u=N.dot(J),J.scale(u,N),N.vadd(G,N),c=N.distanceTo(P),cC&&0F&&F>-E&&D>L&&L>-D&&(C=Math.abs(C-y-k),(null===t||t>C)&&(t=C,m=F,u=L,n=y,ha.copy(A),ua.copy(x),ea.copy(z),p++))}}p&&(q=!0,p=this.createContactEquation(g,l,b,d),ha.mult(-k,p.ri),p.ni.copy(ha),p.ni.negate(p.ni),ha.mult(n,ha),ua.mult(m,ua),ha.vadd(ua,ha),ea.mult(u,ea),ha.vadd(ea, -p.rj),p.ri.vadd(c,p.ri),p.ri.vsub(g.position,p.ri),p.rj.vadd(h,p.rj),p.rj.vsub(l.position,p.rj),this.result.push(p),this.createFrictionEquationsFromContact(p,this.frictionResult));C=f.get();for(n=0;2!==n&&!q;n++)for(m=0;2!==m&&!q;m++)for(u=0;2!==u&&!q;u++)if(C.set(0,0,0),n?C.vadd(ca[0],C):C.vsub(ca[0],C),m?C.vadd(ca[1],C):C.vsub(ca[1],C),u?C.vadd(ca[2],C):C.vsub(ca[2],C),h.vadd(C,Ba),Ba.vsub(c,Ba),Ba.norm2()x&&(q=!0,u=this.createContactEquation(g,l,b,d),v.vadd(w,u.rj),u.rj.copy(u.rj),C.negate(u.ni),u.ni.normalize(),u.ri.copy(u.rj),u.ri.vadd(h,u.ri),u.ri.vsub(c,u.ri),u.ri.normalize(),u.ri.mult(k,u.ri),u.ri.vadd(c,u.ri),u.ri.vsub(g.position,u.ri),u.rj.vadd(h,u.rj),u.rj.vsub(l.position,u.rj),this.result.push(u),this.createFrictionEquationsFromContact(u,this.frictionResult))}f.release(t,v,p,w,C)};var ia=new c,qa=new c,ra=new c,Aa=new c,Vb= -new c,td=new c,Zd=new c,nb=new c,Gc=new c,ba=new c;b.prototype[l.types.SPHERE|l.types.CONVEXPOLYHEDRON]=b.prototype.sphereConvex=function(b,d,c,h,f,k,g,l){f=this.v3pool;c.vsub(h,ia);for(var q=d.faceNormals,n=d.faces,p=d.vertices,m=b.radius,u=0;u!==p.length;u++){var t=Vb;k.vmult(p[u],t);h.vadd(t,t);var v=Aa;if(t.vsub(c,v),v.norm2()y&&0=L&&!1===E)){C=!1;break a}null===E&&(E=0=Qa.dot(xa)){var n=this.createContactEquation(g,l,b,d),p=cb;Qa.mult(Qa.dot(xa), -p);Ea.vsub(p,p);p.vsub(c,n.ri);n.ni.copy(Qa);Ea.vsub(h,n.rj);n.ri.vadd(c,n.ri);n.ri.vsub(g.position,n.ri);n.rj.vadd(h,n.rj);n.rj.vsub(l.position,n.rj);this.result.push(n);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(n,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)};var aa=new c,ga=new c;b.prototype[l.types.CONVEXPOLYHEDRON]=b.prototype.convexConvex=function(b,d,c,h,f,k,g,l,q,n,p,m){if(!(c.distanceTo(h)>b.boundingSphereRadius+d.boundingSphereRadius)&& -b.findSeparatingAxis(d,c,f,h,k,aa,p,m)){p=[];b.clipAgainstHull(c,f,d,h,k,aa,-100,100,p);for(k=f=0;k!==p.length;k++){m=this.createContactEquation(g,l,b,d,q,n);var u=m.ri,t=m.rj;aa.negate(m.ni);p[k].normal.negate(ga);ga.mult(p[k].depth,ga);p[k].point.vadd(ga,u);t.copy(p[k].point);u.vsub(c,u);t.vsub(h,t);u.vadd(c,u);u.vsub(g.position,u);t.vadd(h,t);t.vsub(l.position,t);this.result.push(m);f++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(m,this.frictionResult)}this.enableFrictionReduction&& -f&&this.createFrictionFromAverage(f)}};var Va=new c,zb=new c,ob=new c;b.prototype[l.types.PLANE|l.types.PARTICLE]=b.prototype.planeParticle=function(b,d,c,h,f,k,g,l){Va.set(0,0,1);g.quaternion.vmult(Va,Va);h.vsub(g.position,zb);0>=Va.dot(zb)&&(b=this.createContactEquation(l,g,d,b),b.ni.copy(Va),b.ni.negate(b.ni),b.ri.set(0,0,0),Va.mult(Va.dot(h),ob),h.vsub(ob,ob),b.rj.copy(ob),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var Ya=new c;b.prototype[l.types.PARTICLE| -l.types.SPHERE]=b.prototype.sphereParticle=function(b,d,c,h,f,k,g,l){Ya.set(0,0,1);h.vsub(c,Ya);Ya.norm2()<=b.radius*b.radius&&(d=this.createContactEquation(l,g,d,b),Ya.normalize(),d.rj.copy(Ya),d.rj.mult(b.radius,d.rj),d.ni.copy(Ya),d.ni.negate(d.ni),d.ri.set(0,0,0),this.result.push(d),this.createFrictionEquationsFromContact(d,this.frictionResult))};var pb=new n,Za=new c,db=(new c,new c),W=new c,$a=new c;b.prototype[l.types.PARTICLE|l.types.CONVEXPOLYHEDRON]=b.prototype.convexParticle=function(b, -d,c,h,f,k,g,l){var q=-1;k=null;var n=0;if(Za.copy(h),Za.vsub(c,Za),f.conjugate(pb),pb.vmult(Za,Za),b.pointIsInside(Za)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(c,f);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(f);f=0;for(var p=b.faces.length;f!==p;f++){var m=b.worldFaceNormals[f];h.vsub(b.worldVertices[b.faces[f][0]],W);var u=-m.dot(W);(null===k||Math.abs(u)t||0>p||u>n.length||v>n[0].length)){0>u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>p&&(p=0);u>=n.length&& -(u=n.length-1);t>=n.length&&(t=n.length-1);p>=n[0].length&&(p=n[0].length-1);v>=n[0].length&&(v=n[0].length-1);n=[];d.getRectMinMax(u,v,t,p,n);var w=n[0];if(!(qb.z-m>n[1]||qb.z+mm;m++)for(u=v;p>u;u++)d.getConvexTrianglePillar(m,u,!1),k.pointToWorldFrame(h,g,d.pillarOffset,rb),c.distanceTo(rb)t||0>m||u>q.length||m>q[0].length)){0> -u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>m&&(m=0);u>=q.length&&(u=q.length-1);t>=q.length&&(t=q.length-1);m>=q[0].length&&(m=q[0].length-1);v>=q[0].length&&(v=q[0].length-1);q=[];d.getRectMinMax(u,v,t,m,q);var w=q[0];if(!(Ra.z-p>q[1]||Ra.z+pu;u++)for(q=v;m>q;q++)if(w=p.length,d.getConvexTrianglePillar(u,q,!1),k.pointToWorldFrame(h,g,d.pillarOffset,Sa),c.distanceTo(Sa)g;g++){k=n[g];c.vmult(k,k);b.vadd(k,k);var e=k.x,l=k.y,k=k.z;e>d.x&&(d.x=e);l>d.y&&(d.y=l);k>d.z&&(d.z=k);ed.dot(this.vertices[this.faces[b][0]]))for(console.error('.faceNormals['+b+'] = Vec3('+d.toString()+') looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.'),d=0;dm&&(m=v,p=u)}for(var m=[],u=c.faces[p],v=u.length,w=0;v>w;w++){var A=c.vertices[u[w]],y=new g;y.copy(A);k.vmult(y,y);h.vadd(y,y);m.push(y)}0<=p&&this.clipFaceAgainstHull(e,b,d, +m,q,n,l)};var h=new g,d=new g,v=new g,w=new g,y=new g,x=new g;b.prototype.findSeparatingAxis=function(b,c,g,k,e,q,n,l){var p=Number.MAX_VALUE,m=0;if(this.uniqueAxes)for(var u=0;u!==this.uniqueAxes.length;u++){g.vmult(this.uniqueAxes[u],h);var t=this.testSepAxis(h,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(h))}else for(var A=n?n.length:this.faces.length,u=0;A>u;u++){t=n?n[u]:u;h.copy(this.faceNormals[t]);g.vmult(h,h);t=this.testSepAxis(h,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(h))}if(b.uniqueAxes)for(u= +0;u!==b.uniqueAxes.length;u++){e.vmult(b.uniqueAxes[u],d);m++;t=this.testSepAxis(d,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(d))}else for(n=l?l.length:b.faces.length,u=0;n>u;u++){t=l?l[u]:u;d.copy(b.faceNormals[t]);e.vmult(d,d);m++;t=this.testSepAxis(d,b,c,g,k,e);if(!1===t)return!1;p>t&&(p=t,q.copy(d))}for(l=0;l!==this.uniqueEdges.length;l++)for(g.vmult(this.uniqueEdges[l],w),m=0;m!==b.uniqueEdges.length;m++)if(e.vmult(b.uniqueEdges[m],y),w.cross(y,x),!x.almostZero()){x.normalize();u=this.testSepAxis(x, +b,c,g,k,e);if(!1===u)return!1;p>u&&(p=u,q.copy(x))}return k.vsub(c,v),0h||d>c)return!1;h-=g;d=c-d;return d>h?h:d};var A=new g,E=new g;b.prototype.calculateLocalInertia=function(b,d){this.computeLocalAABB(A,E);var c=E.x-A.x,h=E.y-A.y,g=E.z-A.z;d.x=1/12*b*(4*h*h+4*g*g);d.y=1/12*b*(4*c*c+4*g*g);d.z=1/12*b*(4*h*h+4*c*c)};b.prototype.getPlaneConstantOfFace= +function(b){return-this.faceNormals[b].dot(this.vertices[this.faces[b][0]])};var D=new g,C=new g,F=new g,z=new g,H=new g,G=new g,O=new g,M=new g;b.prototype.clipFaceAgainstHull=function(b,d,c,h,g,k,e){for(var q=[],n=-1,l=Number.MAX_VALUE,p=0;pm&&(l=m,n=p)}if(!(0>n)){b=this.faces[n];b.connectedFaces=[];for(l=0;lp;p++){m=this.vertices[b[p]];m.vsub(this.vertices[b[(p+1)%l]],C);F.copy(C);c.vmult(F,F);d.vadd(F,F);z.copy(this.faceNormals[n]);c.vmult(z,z);d.vadd(z,z);F.cross(z,H);H.negate(H);G.copy(m);c.vmult(G,G);d.vadd(G,G);m=(-G.dot(H),b.connectedFaces[p]);O.copy(this.faceNormals[m]);m=this.getPlaneConstantOfFace(m);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(this.clipFaceAgainstPlane(h,q,M,m);h.length;)h.shift();for(;q.length;)h.push(q.shift())}O.copy(this.faceNormals[n]); +m=this.getPlaneConstantOfFace(n);M.copy(O);c.vmult(M,M);m-=M.dot(d);for(l=0;l=d&&(console.log('clamped: depth='+d+' to minDist='+(g+'')),d=g),k>=d)c=h[l],0>=d&&e.push({point:c,normal:M,depth:d})}};b.prototype.clipFaceAgainstPlane=function(b,d,c,h){var k,e,q=b.length;if(2>q)return d;var n=b[b.length-1],l=b[0];k=c.dot(n)+h;for(var p=0;q>p;p++){if(l=b[p],e=c.dot(l)+h,0>k){if(0>e){var m=new g;m.copy(l)}else m=new g,n.lerp(l,k/(k-e),m);d.push(m)}else 0>e&&(m=new g,n.lerp(l, +k/(k-e),m),d.push(m),d.push(l));n=l;k=e}return d};b.prototype.computeWorldVertices=function(b,d){for(var c=this.vertices.length;this.worldVertices.lengthg;g++){var k=h[g];k.xd.x&&(d.x=k.x);k.yd.y&&(d.y=k.y);k.zd.z&&(d.z=k.z)}};b.prototype.computeWorldFaceNormals=function(b){for(var d=this.faceNormals.length;this.worldFaceNormals.lengthb&&(b=g)}this.boundingSphereRadius=Math.sqrt(b)};var J=new g;b.prototype.calculateWorldAABB=function(b,d,c,h){for(var g,k,e,q,n,l,p=this.vertices.length,m=this.vertices,u=0;p>u;u++){J.copy(m[u]);d.vmult(J,J);b.vadd(J,J);var t=J;t.xq||void 0===q)&&(q=t.x);t.yn||void 0===n)&&(n=t.y);t.zl||void 0===l)&&(l=t.z)}c.set(g,k,e);h.set(q,n,l)};b.prototype.volume=function(){return 4*Math.PI* +this.boundingSphereRadius/3};b.prototype.getAveragePointLocal=function(b){b=b||new g;for(var d=this.vertices.length,c=this.vertices,h=0;d>h;h++)b.vadd(c[h],b);return b.mult(1/d,b),b};b.prototype.transformAllPoints=function(b,d){var c=this.vertices.length,h=this.vertices;if(d){for(var g=0;c>g;g++){var k=h[g];d.vmult(k,k)}for(g=0;gg;g++)k=h[g],k.vadd(b,k)};var P=new g,N=new g,V=new g;b.prototype.pointIsInside=function(b){var d, +c=this.vertices,h=this.faces,g=this.faceNormals,k=this.faces.length;this.getAveragePointLocal(P);for(var e=0;k>e;e++){d=(this.faces[e].length,g[e]);var q=c[h[e][0]],n=N;b.vsub(q,n);var n=d.dot(n),l=V;P.vsub(q,l);d=d.dot(l);if(0>n&&0d)return!1}return-1};var X=(new g,new g),T=new g;b.project=function(b,d,h,g,k){var e=b.vertices.length;b=b.vertices;T.setZero();c.vectorToLocalFrame(h,g,d,X);c.pointToLocalFrame(h,g,T,T);g=T.dot(X);h=d=b[0].dot(X);for(var q=1;e>q;q++){var n=b[q].dot(X);n>d&& +(d=n);h>n&&(h=n)}if(h-=g,d-=g,h>d)d=h=d;k[0]=d;k[1]=h}},{'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'./Shape':43}],39:[function(e,m){function b(b,e,p,m){var h=[],d=[],k=[],n=[],t=[],x=Math.cos,q=Math.sin;h.push(new g(e*x(0),e*q(0),.5*-p));n.push(0);h.push(new g(b*x(0),b*q(0),.5*p));t.push(1);for(var u=0;m>u;u++){var A=2*Math.PI/m*(u+1),E=2*Math.PI/m*(u+.5);m-1>u?(h.push(new g(e*x(A),e*q(A),.5*-p)),n.push(2*u+2),h.push(new g(b*x(A),b*q(A),.5*p)),t.push(2*u+3),k.push([2*u+2,2* +u+3,2*u+1,2*u])):k.push([0,1,2*u+1,2*u]);(1===m%2||m/2>u)&&d.push(new g(x(E),q(E),0))}k.push(t);d.push(new g(0,0,1));b=[];for(u=0;ud&&(c=d)}this.minValue=c};b.prototype.updateMaxValue=function(){for(var b=this.data,c=b[0][0],g=0;g!==b.length;g++)for(var h=0;h!==b[g].length;h++){var d=b[g][h];d>c&&(c=d)}this.maxValue=c};b.prototype.setHeightValueAtIndex=function(b,c,g){this.data[b][c]=g;this.clearCachedConvexTrianglePillar(b,c,!1);0=b;b++)for(var n=c;h>=n;n++){var l=k[b][n];l>e&&(e=l)}d[0]=this.minValue;d[1]=e};b.prototype.getIndexOfPosition=function(b,c,g,h){var d=this.elementSize,k=this.data;b=Math.floor(b/d);c=Math.floor(c/ +d);return g[0]=b,g[1]=c,h&&(0>b&&(b=0),0>c&&(c=0),b>=k.length-1&&(b=k.length-1),c>=k[0].length-1&&(c=k[0].length-1)),0>b||0>c||b>=k.length-1||c>=k[0].length-1?!1:!0};b.prototype.getHeightAt=function(b,c,g){var h=[];this.getIndexOfPosition(b,c,h,g);b=[];return this.getRectMinMax(h[0],h[1]+1,h[0],h[1]+1,b),(b[0]+b[1])/2};b.prototype.getCacheConvexTrianglePillarKey=function(b,c,g){return b+'_'+c+'_'+(g?1:0)};b.prototype.getCachedConvexTrianglePillar=function(b,c,g){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(b, +c,g)]};b.prototype.setCachedConvexTrianglePillar=function(b,c,g,h,d){this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,g)]={convex:h,offset:d}};b.prototype.clearCachedConvexTrianglePillar=function(b,c,g){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,g)]};b.prototype.getConvexTrianglePillar=function(b,k,e){var h=this.pillarConvex,d=this.pillarOffset;if(this.cacheEnabled){var n=this.getCachedConvexTrianglePillar(b,k,e);if(n)return this.pillarConvex=n.convex,void(this.pillarOffset= +n.offset);h=new g;d=new c;this.pillarConvex=h;this.pillarOffset=d}var n=this.data,l=this.elementSize,p=h.faces;h.vertices.length=6;for(var m=0;6>m;m++)h.vertices[m]||(h.vertices[m]=new c);p.length=5;for(m=0;5>m;m++)p[m]||(p[m]=[]);var m=h.vertices,q=(Math.min(n[b][k],n[b+1][k],n[b][k+1],n[b+1][k+1])-this.minValue)/2+this.minValue;e?(d.set((b+.75)*l,(k+.75)*l,q),m[0].set(.25*l,.25*l,n[b+1][k+1]-q),m[1].set(-.75*l,.25*l,n[b][k+1]-q),m[2].set(.25*l,-.75*l,n[b+1][k]-q),m[3].set(.25*l,.25*l,-q-1),m[4].set(-.75* +l,.25*l,-q-1),m[5].set(.25*l,-.75*l,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3,p[2][0]=2,p[2][1]=5,p[2][2]=3,p[2][3]=0,p[3][0]=3,p[3][1]=4,p[3][2]=1,p[3][3]=0,p[4][0]=1,p[4][1]=4,p[4][2]=5,p[4][3]=2):(d.set((b+.25)*l,(k+.25)*l,q),m[0].set(-.25*l,-.25*l,n[b][k]-q),m[1].set(.75*l,-.25*l,n[b+1][k]-q),m[2].set(-.25*l,.75*l,n[b][k+1]-q),m[3].set(-.25*l,-.25*l,-q-1),m[4].set(.75*l,-.25*l,-q-1),m[5].set(-.25*l,.75*l,-q-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3, +p[2][0]=0,p[2][1]=2,p[2][2]=5,p[2][3]=3,p[3][0]=1,p[3][1]=0,p[3][2]=3,p[3][3]=4,p[4][0]=4,p[4][1]=5,p[4][2]=2,p[4][3]=1);h.computeNormals();h.computeEdges();h.updateBoundingSphereRadius();this.setCachedConvexTrianglePillar(b,k,e,h,d)};b.prototype.calculateLocalInertia=function(b,g){return g=g||new c,g.set(0,0,0),g};b.prototype.volume=function(){return Number.MAX_VALUE};b.prototype.calculateWorldAABB=function(b,c,g,h){g.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);h.set(Number.MAX_VALUE, +Number.MAX_VALUE,Number.MAX_VALUE)};b.prototype.updateBoundingSphereRadius=function(){var b=this.data,g=this.elementSize;this.boundingSphereRadius=(new c(b.length*g,b[0].length*g,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue)))).norm()}},{'../math/Vec3':30,'../utils/Utils':53,'./ConvexPolyhedron':38,'./Shape':43}],41:[function(e,m){function b(){l.call(this);this.type=l.types.PARTICLE}m.exports=b;var l=e('./Shape'),g=e('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia= +function(b,k){return k=k||new g,k.set(0,0,0),k};b.prototype.volume=function(){return 0};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=0};b.prototype.calculateWorldAABB=function(b,g,e,l){e.copy(b);l.copy(b)}},{'../math/Vec3':30,'./Shape':43}],42:[function(e,m){function b(){l.call(this);this.type=l.types.PLANE;this.worldNormal=new g;this.worldNormalNeedsUpdate=!0;this.boundingSphereRadius=Number.MAX_VALUE}m.exports=b;var l=e('./Shape'),g=e('../math/Vec3');b.prototype=new l; +b.prototype.constructor=b;b.prototype.computeWorldNormal=function(b){var c=this.worldNormal;c.set(0,0,1);b.vmult(c,c);this.worldNormalNeedsUpdate=!1};b.prototype.calculateLocalInertia=function(b,c){return c||new g};b.prototype.volume=function(){return Number.MAX_VALUE};var c=new g;b.prototype.calculateWorldAABB=function(b,g,e,l){c.set(0,0,1);g.vmult(c,c);g=Number.MAX_VALUE;e.set(-g,-g,-g);l.set(g,g,g);1===c.x&&(l.x=b.x);1===c.y&&(l.y=b.y);1===c.z&&(l.z=b.z);-1===c.x&&(e.x=b.x);-1===c.y&&(e.y=b.y); +-1===c.z&&(e.z=b.z)};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=Number.MAX_VALUE}},{'../math/Vec3':30,'./Shape':43}],43:[function(e,m){function b(){this.id=b.idCounter++;this.boundingSphereRadius=this.type=0;this.collisionResponse=!0;this.material=null}m.exports=b;b=e('./Shape');e('../math/Vec3');e('../math/Quaternion');e('../material/Material');b.prototype.constructor=b;b.prototype.updateBoundingSphereRadius=function(){throw'computeBoundingSphereRadius() not implemented for shape type '+ +this.type;};b.prototype.volume=function(){throw'volume() not implemented for shape type '+this.type;};b.prototype.calculateLocalInertia=function(){throw'calculateLocalInertia() not implemented for shape type '+this.type;};b.idCounter=0;b.types={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256}},{'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'./Shape':43}],44:[function(e,m){function b(b){if(l.call(this),this.radius=void 0!== +b?Number(b):1,this.type=l.types.SPHERE,0>this.radius)throw Error('The sphere radius cannot be negative.');this.updateBoundingSphereRadius()}m.exports=b;var l=e('./Shape'),g=e('../math/Vec3');b.prototype=new l;b.prototype.constructor=b;b.prototype.calculateLocalInertia=function(b,k){k=k||new g;b=2*b*this.radius*this.radius/5;return k.x=b,k.y=b,k.z=b,k};b.prototype.volume=function(){return 4*Math.PI*this.radius/3};b.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.radius}; +b.prototype.calculateWorldAABB=function(b,g,e,l){g=this.radius;for(var c=['x','y','z'],h=0;hg?g+'_'+ +k:k+'_'+g]=!0},c=0;cb.x&&(b.x=h.x),h.yb.y&&(b.y=h.y),h.zb.z&&(b.z=h.z)};b.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)};b.prototype.updateBoundingSphereRadius=function(){for(var b=0,d=this.vertices,c=new g,h=0,d=d.length/3;h!==d;h++){this.getVertex(h, +c);var k=c.norm2();k>b&&(b=k)}this.boundingSphereRadius=Math.sqrt(b)};var E=(new g,new c),D=new k;b.prototype.calculateWorldAABB=function(b,d,c,h){E.position=b;E.quaternion=d;this.aabb.toWorldFrame(E,D);c.copy(D.lowerBound);h.copy(D.upperBound)};b.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};b.createTorus=function(d,c,h,g,k){d=d||1;c=c||.5;h=h||8;g=g||6;k=k||2*Math.PI;for(var e=[],q=[],l=0;h>=l;l++)for(var n=0;g>=n;n++){var p=n/g*k,m=l/h*Math.PI*2;e.push((d+c*Math.cos(m))* +Math.cos(p),(d+c*Math.cos(m))*Math.sin(p),c*Math.sin(m))}for(l=1;h>=l;l++)for(n=1;g>=n;n++)d=(g+1)*(l-1)+n-1,c=(g+1)*(l-1)+n,k=(g+1)*l+n,q.push((g+1)*l+n-1,d,k),q.push(d,c,k);return new b(e,q)}},{'../collision/AABB':3,'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'../utils/Octree':50,'./Shape':43}],46:[function(e,m){function b(){l.call(this);this.iterations=10;this.tolerance=1E-7}m.exports=b;var l=(e('../math/Vec3'),e('../math/Quaternion'),e('./Solver'));b.prototype=new l;var g= +[],c=[],k=[];b.prototype.solve=function(b,e){var l,h,d,n,p=0,m=this.iterations,x=this.tolerance*this.tolerance,q=this.equations,u=q.length;e=e.bodies;var A=e.length;if(0!==u)for(d=0;d!==A;d++)e[d].updateSolveMassProperties();c.length=u;k.length=u;g.length=u;for(d=0;d!==u;d++){var E=q[d];g[d]=0;k[d]=E.computeB(b);c[d]=1/E.computeC()}if(0!==u){for(d=0;d!==A;d++)E=e[d],p=E.wlambda,E.vlambda.set(0,0,0),p&&p.set(0,0,0);for(p=0;p!==m;p++){for(var D=d=0;D!==u;D++)E=q[D],l=k[D],h=c[D],b=g[D],n=E.computeGWlambda(), +l=h*(l-n-E.eps*b),b+lE.maxForce&&(l=E.maxForce-b),g[D]+=l,d+=0d*d)break}for(d=0;d!==A;d++)E=e[d],m=E.velocity,x=E.angularVelocity,m.vadd(E.vlambda,m),x&&x.vadd(E.wlambda,x)}return p}},{'../math/Quaternion':28,'../math/Vec3':30,'./Solver':47}],47:[function(e,m){function b(){this.equations=[]}m.exports=b;b.prototype.solve=function(){return 0};b.prototype.addEquation=function(b){b.enabled&&this.equations.push(b)};b.prototype.removeEquation= +function(b){var g=this.equations;b=g.indexOf(b);-1!==b&&g.splice(b,1)};b.prototype.removeAllEquations=function(){this.equations.length=0}},{}],48:[function(e,m){function b(b){k.call(this);this.iterations=10;this.tolerance=1E-7;this.subsolver=b;this.nodes=[];for(this.nodePool=[];128>this.nodePool.length;)this.nodePool.push(this.createNode())}function l(b){for(var d=b.length,c=0;c!==d;c++){var g=b[c];if(!(g.visited||g.body.type&h))return g}return!1}function g(b,d,c){d.push(b.body);d=b.eqs.length;for(var h= +0;h!==d;h++){var g=b.eqs[h];-1===c.indexOf(g)&&c.push(g)}}function c(b,d){return d.id-b.id}m.exports=b;var k=(e('../math/Vec3'),e('../math/Quaternion'),e('./Solver'));e=e('../objects/Body');b.prototype=new k;var n=[],p=[],t={bodies:[]},h=e.STATIC,d=[];b.prototype.createNode=function(){return{body:null,children:[],eqs:[],visited:!1}};b.prototype.solve=function(b,h){var k=this.nodePool,e=h.bodies,q=this.equations,m=q.length,v=e.length;for(h=this.subsolver;k.lengthw;w++)n[w]=k[w];for(w=0;w!==v;w++)k=n[w],k.body=e[w],k.children.length=0,k.eqs.length=0,k.visited=!1;for(k=0;k!==m;k++){var v=q[k],w=e.indexOf(v.bi),D=e.indexOf(v.bj),w=n[w],D=n[D];w.children.push(D);w.eqs.push(v);D.children.push(w);D.eqs.push(v)}e=0;q=p;h.tolerance=this.tolerance;for(h.iterations=this.iterations;w=l(n);){q.length=0;t.bodies.length=0;v=w;w=g;m=t.bodies;k=q;d.push(v);v.visited=!0;for(w(v,m,k);d.length;)for(D=d.pop();v=l(D.children);)v.visited=!0,w(v,m,k),d.push(v); +m=q.length;q=q.sort(c);for(w=0;w!==m;w++)h.addEquation(q[w]);h.solve(b,t);h.removeAllEquations();e++}return e}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'./Solver':47}],49:[function(e,m){e=function(){};m.exports=e;e.prototype={constructor:e,addEventListener:function(b,e){void 0===this._listeners&&(this._listeners={});var g=this._listeners;return void 0===g[b]&&(g[b]=[]),-1===g[b].indexOf(e)&&g[b].push(e),this},hasEventListener:function(b,e){if(void 0===this._listeners)return!1; +var g=this._listeners;return void 0!==g[b]&&-1!==g[b].indexOf(e)?!0:!1},removeEventListener:function(b,e){if(void 0===this._listeners)return this;var g=this._listeners;if(void 0===g[b])return this;e=g[b].indexOf(e);return-1!==e&&g[b].splice(e,1),this},dispatchEvent:function(b){if(void 0===this._listeners)return this;var e=this._listeners[b.type];if(void 0!==e){b.target=this;for(var g=0,c=e.length;c>g;g++)e[g].call(this,b)}return this}}},{}],50:[function(e,m){function b(b){b=b||{};this.root=b.root|| +null;this.aabb=b.aabb?b.aabb.clone():new g;this.data=[];this.children=[]}function l(c,g){g=g||{};g.root=null;g.aabb=c;b.call(this,g);this.maxDepth='undefined'!=typeof g.maxDepth?g.maxDepth:8}var g=e('../collision/AABB'),c=e('../math/Vec3');m.exports=l;l.prototype=new b;b.prototype.reset=function(){this.children.length=this.data.length=0};b.prototype.insert=function(b,c,h){var d=this.data;if(h=h||0,!this.aabb.contains(b))return!1;var g=this.children;if(h<(this.maxDepth||this.root.maxDepth)){var k= +!1;g.length||(this.subdivide(),k=!0);for(var e=0;8!==e;e++)if(g[e].insert(b,c,h+1))return!0;k&&(g.length=0)}return d.push(c),!0};var k=new c;b.prototype.subdivide=function(){var e=this.aabb,l=e.lowerBound,h=e.upperBound,e=this.children;e.push(new b({aabb:new g({lowerBound:new c(0,0,0)})}),new b({aabb:new g({lowerBound:new c(1,0,0)})}),new b({aabb:new g({lowerBound:new c(1,1,0)})}),new b({aabb:new g({lowerBound:new c(1,1,1)})}),new b({aabb:new g({lowerBound:new c(0,1,1)})}),new b({aabb:new g({lowerBound:new c(0, +0,1)})}),new b({aabb:new g({lowerBound:new c(1,0,1)})}),new b({aabb:new g({lowerBound:new c(0,1,0)})}));h.vsub(l,k);k.scale(.5,k);for(var h=this.root||this,d=0;8!==d;d++){var n=e[d];n.root=h;var m=n.aabb.lowerBound;m.x*=k.x;m.y*=k.y;m.z*=k.z;m.vadd(l,m);m.vadd(k,n.aabb.upperBound)}};b.prototype.aabbQuery=function(b,c){for(var h=(this.data,this.children,[this]);h.length;){var d=h.pop();d.aabb.overlaps(b)&&Array.prototype.push.apply(c,d.data);Array.prototype.push.apply(h,d.children)}return c};var n= +new g;b.prototype.rayQuery=function(b,c,h){return b.getAABB(n),n.toLocalFrame(c,n),this.aabbQuery(n,h),h};b.prototype.removeEmptyNodes=function(){for(var b=[this];b.length;){for(var c=b.pop(),h=c.children.length-1;0<=h;h--)c.children[h].data.length||c.children.splice(h,1);Array.prototype.push.apply(b,c.children)}}},{'../collision/AABB':3,'../math/Vec3':30}],51:[function(e,m){function b(){this.objects=[];this.type=Object}m.exports=b;b.prototype.release=function(){for(var b=arguments.length,g=0;g!== +b;g++)this.objects.push(arguments[g])};b.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()};b.prototype.constructObject=function(){throw Error('constructObject() not implemented in this Pool subclass yet!');}},{}],52:[function(e,m){function b(){this.data={keys:[]}}m.exports=b;b.prototype.get=function(b,g){b>g&&(b=g=b);return this.data[b+'-'+g]};b.prototype.set=function(b,g,c){b>g&&(b=g=b);var k=b+'-'+g;this.get(b,g)||this.data.keys.push(k);this.data[k]= +c};b.prototype.reset=function(){for(var b=this.data,g=b.keys;0p.boundingSphereRadius+t.boundingSphereRadius)){var v=null;p.material&&t.material&&(v=c.getContactMaterial(p.material,t.material)||null);this.currentContactMaterial=v||n||c.defaultContactMaterial;(v=this[p.type|t.type])&&(p.type=A.dot(m)){var u=this.createContactEquation(n,l,b,d);u.ni.copy(A);var t=D;A.scale(m.dot(A),t);p.vsub(t,t);u.ri.copy(t);u.ri.vsub(n.position,u.ri);u.rj.copy(p);u.rj.vsub(l.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}}};var C=new c,F=new c,z=(new c,new c),H=new c,G=new c,O=new c,M=new c,J=new c,P=new c,N=new c,V=new c,X=new c,T=new c,fa=new m,Z=[];b.prototype[l.types.SPHERE|l.types.TRIMESH]=b.prototype.sphereTrimesh=function(b, +d,c,h,e,q,n,l){k.pointToLocalFrame(h,q,c,P);e=b.radius;fa.lowerBound.set(P.x-e,P.y-e,P.z-e);fa.upperBound.set(P.x+e,P.y+e,P.z+e);d.getTrianglesInAABB(fa,Z);var p=b.radius*b.radius;for(e=0;em;m++)if(d.getVertex(d.indices[3*Z[e]+m],z),z.vsub(P,F),F.norm2()<=p){H.copy(z);k.pointToWorldFrame(h,q,H,z);z.vsub(c,F);var u=this.createContactEquation(n,l,b,d);u.ni.copy(F);u.ni.normalize();u.ri.copy(u.ni);u.ri.scale(b.radius,u.ri);u.ri.vadd(c,u.ri);u.ri.vsub(n.position,u.ri);u.rj.copy(z); +u.rj.vsub(l.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}for(e=0;em;m++)d.getVertex(d.indices[3*Z[e]+m],G),d.getVertex(d.indices[3*Z[e]+(m+1)%3],O),O.vsub(G,M),P.vsub(O,N),c=N.dot(M),P.vsub(G,N),u=N.dot(M),0c&&(P.vsub(G,N),J.copy(M),J.normalize(),u=N.dot(J),J.scale(u,N),N.vadd(G,N),c=N.distanceTo(P),cC&&0F&&F>-E&&D>L&&L>-D&&(C=Math.abs(C-y-k),(null===t||t>C)&&(t=C,m=F,u=L,l=y,ha.copy(A),ua.copy(x),ea.copy(z),p++))}}p&&(n=!0,p=this.createContactEquation(e,q,b,d),ha.mult(-k,p.ri),p.ni.copy(ha),p.ni.negate(p.ni),ha.mult(l,ha),ua.mult(m,ua),ha.vadd(ua,ha),ea.mult(u,ea),ha.vadd(ea, +p.rj),p.ri.vadd(c,p.ri),p.ri.vsub(e.position,p.ri),p.rj.vadd(h,p.rj),p.rj.vsub(q.position,p.rj),this.result.push(p),this.createFrictionEquationsFromContact(p,this.frictionResult));C=g.get();for(l=0;2!==l&&!n;l++)for(m=0;2!==m&&!n;m++)for(u=0;2!==u&&!n;u++)if(C.set(0,0,0),l?C.vadd(ca[0],C):C.vsub(ca[0],C),m?C.vadd(ca[1],C):C.vsub(ca[1],C),u?C.vadd(ca[2],C):C.vsub(ca[2],C),h.vadd(C,Ba),Ba.vsub(c,Ba),Ba.norm2()x&&(n=!0,u=this.createContactEquation(e,q,b,d),v.vadd(w,u.rj),u.rj.copy(u.rj),C.negate(u.ni),u.ni.normalize(),u.ri.copy(u.rj),u.ri.vadd(h,u.ri),u.ri.vsub(c,u.ri),u.ri.normalize(),u.ri.mult(k,u.ri),u.ri.vadd(c,u.ri),u.ri.vsub(e.position,u.ri),u.rj.vadd(h,u.rj),u.rj.vsub(q.position,u.rj),this.result.push(u),this.createFrictionEquationsFromContact(u,this.frictionResult))}g.release(t,v,p,w,C)};var ia=new c,qa=new c,ra=new c,Aa=new c,Vb= +new c,td=new c,Zd=new c,nb=new c,Gc=new c,ba=new c;b.prototype[l.types.SPHERE|l.types.CONVEXPOLYHEDRON]=b.prototype.sphereConvex=function(b,d,c,h,g,k,e,q){g=this.v3pool;c.vsub(h,ia);for(var l=d.faceNormals,n=d.faces,p=d.vertices,m=b.radius,u=0;u!==p.length;u++){var t=Vb;k.vmult(p[u],t);h.vadd(t,t);var v=Aa;if(t.vsub(c,v),v.norm2()y&&0=L&&!1===E)){C=!1;break a}null===E&&(E=0=Qa.dot(xa)){var n=this.createContactEquation(e,q,b,d),p=cb;Qa.mult(Qa.dot(xa), +p);Ea.vsub(p,p);p.vsub(c,n.ri);n.ni.copy(Qa);Ea.vsub(h,n.rj);n.ri.vadd(c,n.ri);n.ri.vsub(e.position,n.ri);n.rj.vadd(h,n.rj);n.rj.vsub(q.position,n.rj);this.result.push(n);g++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(n,this.frictionResult)}this.enableFrictionReduction&&g&&this.createFrictionFromAverage(g)};var aa=new c,ga=new c;b.prototype[l.types.CONVEXPOLYHEDRON]=b.prototype.convexConvex=function(b,d,c,h,g,k,e,q,n,l,p,m){if(!(c.distanceTo(h)>b.boundingSphereRadius+d.boundingSphereRadius)&& +b.findSeparatingAxis(d,c,g,h,k,aa,p,m)){p=[];b.clipAgainstHull(c,g,d,h,k,aa,-100,100,p);for(k=g=0;k!==p.length;k++){m=this.createContactEquation(e,q,b,d,n,l);var u=m.ri,t=m.rj;aa.negate(m.ni);p[k].normal.negate(ga);ga.mult(p[k].depth,ga);p[k].point.vadd(ga,u);t.copy(p[k].point);u.vsub(c,u);t.vsub(h,t);u.vadd(c,u);u.vsub(e.position,u);t.vadd(h,t);t.vsub(q.position,t);this.result.push(m);g++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(m,this.frictionResult)}this.enableFrictionReduction&& +g&&this.createFrictionFromAverage(g)}};var Va=new c,zb=new c,ob=new c;b.prototype[l.types.PLANE|l.types.PARTICLE]=b.prototype.planeParticle=function(b,d,c,h,g,k,e,q){Va.set(0,0,1);e.quaternion.vmult(Va,Va);h.vsub(e.position,zb);0>=Va.dot(zb)&&(b=this.createContactEquation(q,e,d,b),b.ni.copy(Va),b.ni.negate(b.ni),b.ri.set(0,0,0),Va.mult(Va.dot(h),ob),h.vsub(ob,ob),b.rj.copy(ob),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var Ya=new c;b.prototype[l.types.PARTICLE| +l.types.SPHERE]=b.prototype.sphereParticle=function(b,d,c,h,g,k,e,q){Ya.set(0,0,1);h.vsub(c,Ya);Ya.norm2()<=b.radius*b.radius&&(d=this.createContactEquation(q,e,d,b),Ya.normalize(),d.rj.copy(Ya),d.rj.mult(b.radius,d.rj),d.ni.copy(Ya),d.ni.negate(d.ni),d.ri.set(0,0,0),this.result.push(d),this.createFrictionEquationsFromContact(d,this.frictionResult))};var pb=new n,Za=new c,db=(new c,new c),W=new c,$a=new c;b.prototype[l.types.PARTICLE|l.types.CONVEXPOLYHEDRON]=b.prototype.convexParticle=function(b, +d,c,h,g,k,e,q){var n=-1;k=null;var l=0;if(Za.copy(h),Za.vsub(c,Za),g.conjugate(pb),pb.vmult(Za,Za),b.pointIsInside(Za)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(c,g);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(g);g=0;for(var p=b.faces.length;g!==p;g++){var m=b.worldFaceNormals[g];h.vsub(b.worldVertices[b.faces[g][0]],W);var u=-m.dot(W);(null===k||Math.abs(u)t||0>p||u>l.length||v>l[0].length)){0>u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>p&&(p=0);u>=l.length&& +(u=l.length-1);t>=l.length&&(t=l.length-1);p>=l[0].length&&(p=l[0].length-1);v>=l[0].length&&(v=l[0].length-1);l=[];d.getRectMinMax(u,v,t,p,l);var w=l[0];if(!(qb.z-m>l[1]||qb.z+mm;m++)for(u=v;p>u;u++)d.getConvexTrianglePillar(m,u,!1),k.pointToWorldFrame(h,e,d.pillarOffset,rb),c.distanceTo(rb)t||0>m||u>n.length||m>n[0].length)){0> +u&&(u=0);0>t&&(t=0);0>v&&(v=0);0>m&&(m=0);u>=n.length&&(u=n.length-1);t>=n.length&&(t=n.length-1);m>=n[0].length&&(m=n[0].length-1);v>=n[0].length&&(v=n[0].length-1);n=[];d.getRectMinMax(u,v,t,m,n);var w=n[0];if(!(Ra.z-p>n[1]||Ra.z+pu;u++)for(n=v;m>n;n++)if(w=p.length,d.getConvexTrianglePillar(u,n,!1),k.pointToWorldFrame(h,e,d.pillarOffset,Sa),c.distanceTo(Sa)1E3*b));k++);this.time+=c;b=this.time%b/b;c=this.bodies;for(f=0;f!==c.length;f++)h=c[f],h.type!==d.STATIC&&h.sleepState!==d.SLEEPING?(h.position.vsub(h.previousPosition,E),E.scale(b,E),h.position.vadd(E,h.interpolatedPosition)):(h.interpolatedPosition.copy(h.position), -h.interpolatedQuaternion.copy(h.quaternion))}};var D={type:'postStep'},C={type:'preStep'},F={type:'collide',body:null,contact:null},z=[],H=[],G=[],O=[],M=(new f,new f,new f,new f,new f,new f,new f,new f,new f,new m,new m),J=new m,P=new f;b.prototype.internalStep=function(b){this.dt=b;var c,h=this.contacts,f=this.numObjects(),k=this.bodies,g=this.solver,q=this.gravity,n=this.doProfiling,p=this.profile,m=d.DYNAMIC,u=this.constraints,t=(q.norm(),q.x),v=q.y,w=q.z;n&&(c=performance.now());for(q=0;q!== -f;q++){var A=k[q];if(A.type&m){var y=A.force,A=A.mass;y.x+=A*t;y.y+=A*v;y.z+=A*w}}q=0;for(A=this.subsystems.length;q!==A;q++)this.subsystems[q].update();n&&(c=performance.now());G.length=0;O.length=0;this.broadphase.collisionPairs(this,G,O);n&&(p.broadphase=performance.now()-c);A=u.length;for(q=0;q!==A;q++)if(t=u[q],!t.collideConnected)for(v=G.length-1;0<=v;--v)(t.bodyA===G[v]&&t.bodyB===O[v]||t.bodyB===G[v]&&t.bodyA===O[v])&&(G.splice(v,1),O.splice(v,1));this.collisionMatrixTick();n&&(c=performance.now()); -A=h.length;for(q=0;q!==A;q++)z.push(h[q]);h.length=0;A=this.frictionEquations.length;for(q=0;q!==A;q++)H.push(this.frictionEquations[q]);this.frictionEquations.length=0;this.narrowphase.getContacts(G,O,this,h,z,this.frictionEquations,H);n&&(p.narrowphase=performance.now()-c);n&&(c=performance.now());for(q=0;q=2*Math.pow(w.sleepSpeedLimit,2)&&(A._wakeUpAfterNarrowphase=!0),w.allowSleep&&w.type===d.DYNAMIC&&w.sleepState===d.SLEEPING&&A.sleepState===d.AWAKE&&A.type!==d.STATIC&&A.velocity.norm2()+ -A.angularVelocity.norm2()>=2*Math.pow(A.sleepSpeedLimit,2)&&(w._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(A,w,!0),this.collisionMatrixPrevious.get(A,w)||(F.body=w,F.contact=t,A.dispatchEvent(F),F.body=A,w.dispatchEvent(F));n&&(p.makeContactConstraints=performance.now()-c,c=performance.now());for(q=0;q!==f;q++)A=k[q],A._wakeUpAfterNarrowphase&&(A.wakeUp(),A._wakeUpAfterNarrowphase=!1);A=u.length;for(q=0;q!==A;q++)for(t=u[q],t.update(),v=0,h=t.equations.length;v!==h;v++)g.addEquation(t.equations[v]); -g.solve(b,this);n&&(p.solve=performance.now()-c);g.removeAllEquations();g=Math.pow;for(q=0;q!==f;q++)if(A=k[q],A.type&m&&(u=g(1-A.linearDamping,b),h=A.velocity,h.mult(u,h),u=A.angularVelocity))h=g(1-A.angularDamping,b),u.mult(h,u);this.dispatchEvent(C);for(q=0;q!==f;q++)A=k[q],A.preStep&&A.preStep.call(A);n&&(c=performance.now());m=d.DYNAMIC|d.KINEMATIC;g=0===this.stepnumber%(this.quatNormalizeSkip+1);u=this.quatNormalizeFast;h=.5*b;l.types.PLANE;l.types.CONVEXPOLYHEDRON;for(q=0;q!==f;q++)if(A=k[q], -t=A.force,v=A.torque,A.type&m&&A.sleepState!==d.SLEEPING){var w=A.velocity,y=A.angularVelocity,x=A.position,E=A.quaternion,N=A.invMass,ea=A.invInertiaWorld;w.x+=t.x*N*b;w.y+=t.y*N*b;w.z+=t.z*N*b;A.angularVelocity&&(ea.vmult(v,P),P.mult(b,P),P.vadd(y,y));x.x+=w.x*b;x.y+=w.y*b;x.z+=w.z*b;A.angularVelocity&&(M.set(y.x,y.y,y.z,0),M.mult(E,J),E.x+=h*J.x,E.y+=h*J.y,E.z+=h*J.z,E.w+=h*J.w,g&&(u?E.normalizeFast():E.normalize()));A.aabb&&(A.aabbNeedsUpdate=!0);A.updateInertiaWorld&&A.updateInertiaWorld()}this.clearForces(); -this.broadphase.dirty=!0;n&&(p.integrate=performance.now()-c);this.time+=b;this.stepnumber+=1;this.dispatchEvent(D);for(q=0;q!==f;q++)A=k[q],(b=A.postStep)&&b.call(A);if(this.allowSleep)for(q=0;q!==f;q++)k[q].sleepTick(this.time)};b.prototype.clearForces=function(){for(var b=this.bodies,d=b.length,c=0;c!==d;c++){var h=b[c];h.force;h.torque;h.force.set(0,0,0);h.torque.set(0,0,0)}}},{'../collision/AABB':3,'../collision/ArrayCollisionMatrix':4,'../collision/NaiveBroadphase':7,'../collision/Ray':9,'../collision/RaycastResult':10, +A}}var E=new g;b.prototype.step=function(b,c,h){if(h=h||10,c=c||0,0===c)this.internalStep(b),this.time+=b;else{var g=Math.floor((this.time+c)/b)-Math.floor(this.time/b),g=Math.min(g,h);h=performance.now();for(var k=0;k!==g&&(this.internalStep(b),!(performance.now()-h>1E3*b));k++);this.time+=c;b=this.time%b/b;c=this.bodies;for(g=0;g!==c.length;g++)h=c[g],h.type!==d.STATIC&&h.sleepState!==d.SLEEPING?(h.position.vsub(h.previousPosition,E),E.scale(b,E),h.position.vadd(E,h.interpolatedPosition)):(h.interpolatedPosition.copy(h.position), +h.interpolatedQuaternion.copy(h.quaternion))}};var D={type:'postStep'},C={type:'preStep'},F={type:'collide',body:null,contact:null},z=[],H=[],G=[],O=[],M=(new g,new g,new g,new g,new g,new g,new g,new g,new g,new m,new m),J=new m,P=new g;b.prototype.internalStep=function(b){this.dt=b;var c,h=this.contacts,g=this.numObjects(),k=this.bodies,e=this.solver,q=this.gravity,n=this.doProfiling,p=this.profile,m=d.DYNAMIC,u=this.constraints,t=(q.norm(),q.x),v=q.y,w=q.z;n&&(c=performance.now());for(q=0;q!== +g;q++){var A=k[q];if(A.type&m){var y=A.force,A=A.mass;y.x+=A*t;y.y+=A*v;y.z+=A*w}}q=0;for(A=this.subsystems.length;q!==A;q++)this.subsystems[q].update();n&&(c=performance.now());G.length=0;O.length=0;this.broadphase.collisionPairs(this,G,O);n&&(p.broadphase=performance.now()-c);A=u.length;for(q=0;q!==A;q++)if(t=u[q],!t.collideConnected)for(v=G.length-1;0<=v;--v)(t.bodyA===G[v]&&t.bodyB===O[v]||t.bodyB===G[v]&&t.bodyA===O[v])&&(G.splice(v,1),O.splice(v,1));this.collisionMatrixTick();n&&(c=performance.now()); +A=h.length;for(q=0;q!==A;q++)z.push(h[q]);h.length=0;A=this.frictionEquations.length;for(q=0;q!==A;q++)H.push(this.frictionEquations[q]);this.frictionEquations.length=0;this.narrowphase.getContacts(G,O,this,h,z,this.frictionEquations,H);n&&(p.narrowphase=performance.now()-c);n&&(c=performance.now());for(q=0;q=2*Math.pow(w.sleepSpeedLimit,2)&&(A._wakeUpAfterNarrowphase=!0),w.allowSleep&&w.type===d.DYNAMIC&&w.sleepState===d.SLEEPING&&A.sleepState===d.AWAKE&&A.type!==d.STATIC&&A.velocity.norm2()+ +A.angularVelocity.norm2()>=2*Math.pow(A.sleepSpeedLimit,2)&&(w._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(A,w,!0),this.collisionMatrixPrevious.get(A,w)||(F.body=w,F.contact=t,A.dispatchEvent(F),F.body=A,w.dispatchEvent(F));n&&(p.makeContactConstraints=performance.now()-c,c=performance.now());for(q=0;q!==g;q++)A=k[q],A._wakeUpAfterNarrowphase&&(A.wakeUp(),A._wakeUpAfterNarrowphase=!1);A=u.length;for(q=0;q!==A;q++)for(t=u[q],t.update(),v=0,h=t.equations.length;v!==h;v++)e.addEquation(t.equations[v]); +e.solve(b,this);n&&(p.solve=performance.now()-c);e.removeAllEquations();e=Math.pow;for(q=0;q!==g;q++)if(A=k[q],A.type&m&&(u=e(1-A.linearDamping,b),h=A.velocity,h.mult(u,h),u=A.angularVelocity))h=e(1-A.angularDamping,b),u.mult(h,u);this.dispatchEvent(C);for(q=0;q!==g;q++)A=k[q],A.preStep&&A.preStep.call(A);n&&(c=performance.now());m=d.DYNAMIC|d.KINEMATIC;e=0===this.stepnumber%(this.quatNormalizeSkip+1);u=this.quatNormalizeFast;h=.5*b;l.types.PLANE;l.types.CONVEXPOLYHEDRON;for(q=0;q!==g;q++)if(A=k[q], +t=A.force,v=A.torque,A.type&m&&A.sleepState!==d.SLEEPING){var w=A.velocity,y=A.angularVelocity,x=A.position,E=A.quaternion,N=A.invMass,ea=A.invInertiaWorld;w.x+=t.x*N*b;w.y+=t.y*N*b;w.z+=t.z*N*b;A.angularVelocity&&(ea.vmult(v,P),P.mult(b,P),P.vadd(y,y));x.x+=w.x*b;x.y+=w.y*b;x.z+=w.z*b;A.angularVelocity&&(M.set(y.x,y.y,y.z,0),M.mult(E,J),E.x+=h*J.x,E.y+=h*J.y,E.z+=h*J.z,E.w+=h*J.w,e&&(u?E.normalizeFast():E.normalize()));A.aabb&&(A.aabbNeedsUpdate=!0);A.updateInertiaWorld&&A.updateInertiaWorld()}this.clearForces(); +this.broadphase.dirty=!0;n&&(p.integrate=performance.now()-c);this.time+=b;this.stepnumber+=1;this.dispatchEvent(D);for(q=0;q!==g;q++)A=k[q],(b=A.postStep)&&b.call(A);if(this.allowSleep)for(q=0;q!==g;q++)k[q].sleepTick(this.time)};b.prototype.clearForces=function(){for(var b=this.bodies,d=b.length,c=0;c!==d;c++){var h=b[c];h.force;h.torque;h.force.set(0,0,0);h.torque.set(0,0,0)}}},{'../collision/AABB':3,'../collision/ArrayCollisionMatrix':4,'../collision/NaiveBroadphase':7,'../collision/Ray':9,'../collision/RaycastResult':10, '../equations/ContactEquation':19,'../equations/FrictionEquation':21,'../material/ContactMaterial':24,'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Shape':43,'../solver/GSSolver':46,'../utils/EventTarget':49,'../utils/TupleDictionary':52,'../utils/Vec3Pool':54,'./Narrowphase':55}]},{},[2])(2)}); -!function(a,g,m){function b(c,f){if(!g[c]){if(!a[c]){var k='function'==typeof require&&require;if(!f&&k)return k(c,!0);if(l)return l(c,!0);throw Error("Cannot find module '"+c+"'");}f=g[c]={exports:{}};a[c][0].call(f.exports,function(f){var k=a[c][1][f];return b(k?k:f)},f,f.exports)}return g[c].exports}for(var l='function'==typeof require&&require,f=0;fl.determinant(this.basis[0].concat(this.basis[1]).concat(this.basis[2])),this._left)};a.prototype.matrix=function(){if(this._matrix)return this._matrix;var a=this.basis,b=this._matrix=f.create(); -return b[0]=a[0][0],b[1]=a[0][1],b[2]=a[0][2],b[4]=a[1][0],b[5]=a[1][1],b[6]=a[1][2],b[8]=a[2][0],b[9]=a[2][1],b[10]=a[2][2],b[3]=this.center()[0],b[7]=this.center()[1],b[11]=this.center()[2],this.left()&&(b[0]*=-1,b[1]*=-1,b[2]*=-1),this._matrix};a.prototype.lerp=function(a,f){b.lerp(a,this.prevJoint,this.nextJoint,f)};a.prototype.center=function(){if(this._center)return this._center;var a=b.create();return this.lerp(a,.5),this._center=a,a};a.prototype.direction=function(){return[-1*this.basis[2][0], --1*this.basis[2][1],-1*this.basis[2][2]]}},{'./pointable':14,'gl-matrix':23,underscore:24}],2:[function(a,g){a=g.exports=function(a){this.pos=0;this._buf=[];this.size=a};a.prototype.get=function(a){return void 0==a&&(a=0),a>=this.size?void 0:a>=this._buf.length?void 0:this._buf[(this.pos-a-1)%this.size]};a.prototype.push=function(a){return this._buf[this.pos%this.size]=a,this.pos++}},{}],3:[function(a,g){var m=a('../protocol').chooseProtocol,b=a('events').EventEmitter,l=a('underscore'),f=g.exports= -function(a){this.opts=l.defaults(a||{},{host:'127.0.0.1',enableGestures:!1,scheme:this.getScheme(),port:this.getPort(),background:!1,optimizeHMD:!1,requestProtocolVersion:f.defaultProtocolVersion});this.host=this.opts.host;this.port=this.opts.port;this.scheme=this.opts.scheme;this.protocolVersionVerified=!1;this.optimizeHMD=this.background=null;this.on('ready',function(){this.enableGestures(this.opts.enableGestures);this.setBackground(this.opts.background);this.setOptimizeHMD(this.opts.optimizeHMD); -console.log(this.opts.optimizeHMD?'Optimized for head mounted display usage.':'Optimized for desktop usage.')})};f.defaultProtocolVersion=6;f.prototype.getUrl=function(){return this.scheme+'//'+this.host+':'+this.port+'/v'+this.opts.requestProtocolVersion+'.json'};f.prototype.getScheme=function(){return'ws:'};f.prototype.getPort=function(){return 6437};f.prototype.setBackground=function(a){this.opts.background=a;this.protocol&&this.protocol.sendBackground&&this.background!==this.opts.background&& -(this.background=this.opts.background,this.protocol.sendBackground(this,this.opts.background))};f.prototype.setOptimizeHMD=function(a){this.opts.optimizeHMD=a;this.protocol&&this.protocol.sendOptimizeHMD&&this.optimizeHMD!==this.opts.optimizeHMD&&(this.optimizeHMD=this.opts.optimizeHMD,this.protocol.sendOptimizeHMD(this,this.opts.optimizeHMD))};f.prototype.handleOpen=function(){this.connected||(this.connected=!0,this.emit('connect'))};f.prototype.enableGestures=function(a){this.gesturesEnabled=a? -!0:!1;this.send(this.protocol.encode({enableGestures:this.gesturesEnabled}))};f.prototype.handleClose=function(a){this.connected&&(this.disconnect(),1001===a&&1l.determinant(this.basis[0].concat(this.basis[1]).concat(this.basis[2])),this._left)};a.prototype.matrix=function(){if(this._matrix)return this._matrix;var a=this.basis,b=this._matrix=g.create(); +return b[0]=a[0][0],b[1]=a[0][1],b[2]=a[0][2],b[4]=a[1][0],b[5]=a[1][1],b[6]=a[1][2],b[8]=a[2][0],b[9]=a[2][1],b[10]=a[2][2],b[3]=this.center()[0],b[7]=this.center()[1],b[11]=this.center()[2],this.left()&&(b[0]*=-1,b[1]*=-1,b[2]*=-1),this._matrix};a.prototype.lerp=function(a,g){b.lerp(a,this.prevJoint,this.nextJoint,g)};a.prototype.center=function(){if(this._center)return this._center;var a=b.create();return this.lerp(a,.5),this._center=a,a};a.prototype.direction=function(){return[-1*this.basis[2][0], +-1*this.basis[2][1],-1*this.basis[2][2]]}},{'./pointable':14,'gl-matrix':23,underscore:24}],2:[function(a,e){a=e.exports=function(a){this.pos=0;this._buf=[];this.size=a};a.prototype.get=function(a){return void 0==a&&(a=0),a>=this.size?void 0:a>=this._buf.length?void 0:this._buf[(this.pos-a-1)%this.size]};a.prototype.push=function(a){return this._buf[this.pos%this.size]=a,this.pos++}},{}],3:[function(a,e){var m=a('../protocol').chooseProtocol,b=a('events').EventEmitter,l=a('underscore'),g=e.exports= +function(a){this.opts=l.defaults(a||{},{host:'127.0.0.1',enableGestures:!1,scheme:this.getScheme(),port:this.getPort(),background:!1,optimizeHMD:!1,requestProtocolVersion:g.defaultProtocolVersion});this.host=this.opts.host;this.port=this.opts.port;this.scheme=this.opts.scheme;this.protocolVersionVerified=!1;this.optimizeHMD=this.background=null;this.on('ready',function(){this.enableGestures(this.opts.enableGestures);this.setBackground(this.opts.background);this.setOptimizeHMD(this.opts.optimizeHMD); +console.log(this.opts.optimizeHMD?'Optimized for head mounted display usage.':'Optimized for desktop usage.')})};g.defaultProtocolVersion=6;g.prototype.getUrl=function(){return this.scheme+'//'+this.host+':'+this.port+'/v'+this.opts.requestProtocolVersion+'.json'};g.prototype.getScheme=function(){return'ws:'};g.prototype.getPort=function(){return 6437};g.prototype.setBackground=function(a){this.opts.background=a;this.protocol&&this.protocol.sendBackground&&this.background!==this.opts.background&& +(this.background=this.opts.background,this.protocol.sendBackground(this,this.opts.background))};g.prototype.setOptimizeHMD=function(a){this.opts.optimizeHMD=a;this.protocol&&this.protocol.sendOptimizeHMD&&this.optimizeHMD!==this.opts.optimizeHMD&&(this.optimizeHMD=this.opts.optimizeHMD,this.protocol.sendOptimizeHMD(this,this.opts.optimizeHMD))};g.prototype.handleOpen=function(){this.connected||(this.connected=!0,this.emit('connect'))};g.prototype.enableGestures=function(a){this.gesturesEnabled=a? +!0:!1;this.send(this.protocol.encode({enableGestures:this.gesturesEnabled}))};g.prototype.handleClose=function(a){this.connected&&(this.disconnect(),1001===a&&1b?(console.warn('Your Protocol Version is v'+b+', this app was designed for v'+d),h.warnOutOfDate({sV:a,pV:b}),!0):!1};v._pluginFactories={};v.plugin=function(a,b){return this._pluginFactories[a]&&console.warn('Plugin "'+a+'" already registered'),this._pluginFactories[a]=b};v.plugins=function(){return d.keys(this._pluginFactories)};v.prototype.use=function(a,h){var k,g;if(k='function'==typeof a?a:v._pluginFactories[a],!k)throw'Leap Plugin '+a+' not found.';if(h||(h={}),this.plugins[a])return d.extend(this.plugins[a], -h),this;this.plugins[a]=h;h=k.call(this,h);for(g in h)if(k=h[g],'function'==typeof k){var p=a,m=g;-1!=['beforeFrameCreated','afterFrameCreated'].indexOf(m)?this.on(m,k):(this.pipeline||(this.pipeline=new n(this)),this._pluginPipelineSteps[p]||(this._pluginPipelineSteps[p]=[]),this._pluginPipelineSteps[p].push(this.pipeline.addWrappedStep(m,k)))}else{p=a;m=g;switch(this._pluginExtendedMethods[p]||(this._pluginExtendedMethods[p]=[]),m){case 'frame':m=b;break;case 'hand':m=l;break;case 'pointable':m= -f;d.extend(c.prototype,k);d.extend(c.Invalid,k);break;case 'finger':m=c;break;default:throw p+' specifies invalid object type "'+m+'" for prototypical extension';}d.extend(m.prototype,k);d.extend(m.Invalid,k);this._pluginExtendedMethods[p].push([m,k])}return this};v.prototype.stopUsing=function(a){var b,d;b=this._pluginPipelineSteps[a];var c=this._pluginExtendedMethods[a],h;if(this.plugins[a]){if(b)for(h=0;hb?(console.warn('Your Protocol Version is v'+b+', this app was designed for v'+d),h.warnOutOfDate({sV:a,pV:b}),!0):!1};v._pluginFactories={};v.plugin=function(a,b){return this._pluginFactories[a]&&console.warn('Plugin "'+a+'" already registered'),this._pluginFactories[a]=b};v.plugins=function(){return d.keys(this._pluginFactories)};v.prototype.use=function(a,h){var k,e;if(k='function'==typeof a?a:v._pluginFactories[a],!k)throw'Leap Plugin '+a+' not found.';if(h||(h={}),this.plugins[a])return d.extend(this.plugins[a], +h),this;this.plugins[a]=h;h=k.call(this,h);for(e in h)if(k=h[e],'function'==typeof k){var p=a,m=e;-1!=['beforeFrameCreated','afterFrameCreated'].indexOf(m)?this.on(m,k):(this.pipeline||(this.pipeline=new n(this)),this._pluginPipelineSteps[p]||(this._pluginPipelineSteps[p]=[]),this._pluginPipelineSteps[p].push(this.pipeline.addWrappedStep(m,k)))}else{p=a;m=e;switch(this._pluginExtendedMethods[p]||(this._pluginExtendedMethods[p]=[]),m){case 'frame':m=b;break;case 'hand':m=l;break;case 'pointable':m= +g;d.extend(c.prototype,k);d.extend(c.Invalid,k);break;case 'finger':m=c;break;default:throw p+' specifies invalid object type "'+m+'" for prototypical extension';}d.extend(m.prototype,k);d.extend(m.Invalid,k);this._pluginExtendedMethods[p].push([m,k])}return this};v.prototype.stopUsing=function(a){var b,d;b=this._pluginPipelineSteps[a];var c=this._pluginExtendedMethods[a],h;if(this.plugins[a]){if(b)for(h=0;hUpgrade", -{onclick:function(a){'leapjs-decline-upgrade'!=a.target.id&&(a=window.open(f,'_blank','height=800,width=1000,location=1,menubar=1,resizable=1,status=1,toolbar=1,scrollbars=1'),window.focus&&a.focus());return k.hide(),!0},onmousemove:function(a){a.target==document.getElementById('leapjs-decline-upgrade')?(document.getElementById('leapjs-decline-upgrade').style.color='#000',document.getElementById('leapjs-decline-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-accept-upgrade').style.color= +this.options.onmousemove&&a.addEventListener('mousemove',this.options.onmousemove)};b.prototype.show=function(){return document.body.appendChild(this.element),this};b.prototype.hide=function(){return document.body.removeChild(this.element),this};b.warnOutOfDate=function(a){a||(a={});var g='http://developer.leapmotion.com?';a.returnTo=window.location.href;for(var c in a)g+=c+'='+encodeURIComponent(a[c])+'&';var k;return k=new b("This site requires Leap Motion Tracking V2.", +{onclick:function(a){'leapjs-decline-upgrade'!=a.target.id&&(a=window.open(g,'_blank','height=800,width=1000,location=1,menubar=1,resizable=1,status=1,toolbar=1,scrollbars=1'),window.focus&&a.focus());return k.hide(),!0},onmousemove:function(a){a.target==document.getElementById('leapjs-decline-upgrade')?(document.getElementById('leapjs-decline-upgrade').style.color='#000',document.getElementById('leapjs-decline-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-accept-upgrade').style.color= '#444',document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'):(document.getElementById('leapjs-accept-upgrade').style.color='#000',document.getElementById('leapjs-accept-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-decline-upgrade').style.color='#444',document.getElementById('leapjs-decline-upgrade').style.boxShadow='none')},onmouseout:function(){document.getElementById('leapjs-decline-upgrade').style.color='#444';document.getElementById('leapjs-decline-upgrade').style.boxShadow= -'none';document.getElementById('leapjs-accept-upgrade').style.color='#444';document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'}}),k.show()};b.hasWarnedBones=!1;b.warnBones=function(){this.hasWarnedBones||(this.hasWarnedBones=!0,console.warn('Your Leap Service is out of date'),'undefined'!=typeof m&&m.versions&&m.versions.node||this.warnOutOfDate({reason:'bones'}))}},{__browserify_process:22}],7:[function(a,g){var m=a('./pointable'),b=a('./bone'),l=a('./dialog');a=a('underscore'); -g=g.exports=function(a){m.call(this,a);this.dipPosition=a.dipPosition;this.pipPosition=a.pipPosition;this.mcpPosition=a.mcpPosition;this.carpPosition=a.carpPosition;this.extended=a.extended;this.type=a.type;this.finger=!0;this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition];a.bases?this.addBones(a):l.warnBones()};a.extend(g.prototype,m.prototype);g.prototype.addBones=function(a){this.metacarpal=new b(this,{type:0,width:this.width,prevJoint:this.carpPosition, -nextJoint:this.mcpPosition,basis:a.bases[0]});this.proximal=new b(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:a.bases[1]});this.medial=new b(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:a.bases[2]});this.distal=new b(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:a.btipPosition,basis:a.bases[3]});this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]};g.prototype.toString=function(){return'Finger [ id:'+ -this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};g.Invalid={valid:!1}},{'./bone':1,'./dialog':6,'./pointable':14,underscore:24}],8:[function(a,g){var m=a('./hand'),b=a('./pointable'),l=a('./gesture').createGesture,f=a('gl-matrix'),c=f.mat3,k=f.vec3,n=a('./interaction_box'),p=a('./finger'),t=a('underscore');a=g.exports=function(a){if(this.valid=!0,this.id=a.id,this.timestamp=a.timestamp,this.hands=[],this.handsMap={},this.pointables=[],this.tools=[],this.fingers= +'none';document.getElementById('leapjs-accept-upgrade').style.color='#444';document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'}}),k.show()};b.hasWarnedBones=!1;b.warnBones=function(){this.hasWarnedBones||(this.hasWarnedBones=!0,console.warn('Your Leap Service is out of date'),'undefined'!=typeof m&&m.versions&&m.versions.node||this.warnOutOfDate({reason:'bones'}))}},{__browserify_process:22}],7:[function(a,e){var m=a('./pointable'),b=a('./bone'),l=a('./dialog');a=a('underscore'); +e=e.exports=function(a){m.call(this,a);this.dipPosition=a.dipPosition;this.pipPosition=a.pipPosition;this.mcpPosition=a.mcpPosition;this.carpPosition=a.carpPosition;this.extended=a.extended;this.type=a.type;this.finger=!0;this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition];a.bases?this.addBones(a):l.warnBones()};a.extend(e.prototype,m.prototype);e.prototype.addBones=function(a){this.metacarpal=new b(this,{type:0,width:this.width,prevJoint:this.carpPosition, +nextJoint:this.mcpPosition,basis:a.bases[0]});this.proximal=new b(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:a.bases[1]});this.medial=new b(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:a.bases[2]});this.distal=new b(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:a.btipPosition,basis:a.bases[3]});this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]};e.prototype.toString=function(){return'Finger [ id:'+ +this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};e.Invalid={valid:!1}},{'./bone':1,'./dialog':6,'./pointable':14,underscore:24}],8:[function(a,e){var m=a('./hand'),b=a('./pointable'),l=a('./gesture').createGesture,g=a('gl-matrix'),c=g.mat3,k=g.vec3,n=a('./interaction_box'),p=a('./finger'),t=a('underscore');a=e.exports=function(a){if(this.valid=!0,this.id=a.id,this.timestamp=a.timestamp,this.hands=[],this.handsMap={},this.pointables=[],this.tools=[],this.fingers= [],a.interactionBox&&(this.interactionBox=new n(a.interactionBox)),this.gestures=[],this.pointablesMap={},this._translation=a.t,this._rotation=t.flatten(a.r),this._scaleFactor=a.s,this.data=a,this.type='frame',this.currentFrameRate=a.currentFrameRate,a.gestures)for(var b=0,c=a.gestures.length;b!=c;b++)this.gestures.push(l(a.gestures[b]));this.postprocessData(a)};a.prototype.postprocessData=function(a){a||(a=this.data);for(var d=0,c=a.hands.length;d!=c;d++){var h=new m(a.hands[d]);h.frame=this;this.hands.push(h); this.handsMap[h.id]=h}a.pointables=t.sortBy(a.pointables,function(a){return a.id});d=0;for(c=a.pointables.length;d!=c;d++)h=a.pointables[d],h=h.dipPosition?new p(h):new b(h),h.frame=this,this.addPointable(h)};a.prototype.addPointable=function(a){if(this.pointables.push(a),this.pointablesMap[a.id]=a,(a.tool?this.tools:this.fingers).push(a),void 0!==a.handId&&this.handsMap.hasOwnProperty(a.handId)){var b=this.handsMap[a.handId];switch(b.pointables.push(a),(a.tool?b.tools:b.fingers).push(a),a.type){case 0:b.thumb= a;break;case 1:b.indexFinger=a;break;case 2:b.middleFinger=a;break;case 3:b.ringFinger=a;break;case 4:b.pinky=a}}};a.prototype.tool=function(a){a=this.pointable(a);return a.tool?a:b.Invalid};a.prototype.pointable=function(a){return this.pointablesMap[a]||b.Invalid};a.prototype.finger=function(a){a=this.pointable(a);return a.tool?b.Invalid:a};a.prototype.hand=function(a){return this.handsMap[a]||m.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid)return 0;var d=this.rotationMatrix(a), @@ -1197,131 +1197,131 @@ d=Math.acos(.5*(d[0]+d[4]+d[8]-1));if(d=isNaN(d)?0:d,void 0!==b)a=this.rotationA b)};a.prototype.scaleFactor=function(a){return this.valid&&a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){return this.valid&&a.valid?k.subtract(k.create(),this._translation,a._translation):k.create()};a.prototype.toString=function(){var a='Frame [ id:'+this.id+' | timestamp:'+this.timestamp+' | Hand count:('+this.hands.length+') | Pointable count:('+this.pointables.length+')';return this.gestures&&(a+=' | Gesture count:('+this.gestures.length+')'),a+' ]'}; a.prototype.dump=function(){var a;a='Frame Info:
'+this.toString();a+='

Hands:
';for(var b=0,c=this.hands.length;b!=c;b++)a+=' '+this.hands[b].toString()+'
';a+='

Pointables:
';b=0;for(c=this.pointables.length;b!=c;b++)a+=' '+this.pointables[b].toString()+'
';if(this.gestures)for(a+='

Gestures:
',b=0,c=this.gestures.length;b!=c;b++)a+=' '+this.gestures[b].toString()+'
';return a+='

Raw JSON:
',a+JSON.stringify(this.data)};a.Invalid= {valid:!1,hands:[],fingers:[],tools:[],gestures:[],pointables:[],pointable:function(){return b.Invalid},finger:function(){return b.Invalid},hand:function(){return m.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return c.create()},rotationAxis:function(){return k.create()},scaleFactor:function(){return 1},translation:function(){return k.create()}}},{'./finger':7,'./gesture':9,'./hand':10,'./interaction_box':12, -'./pointable':14,'gl-matrix':23,underscore:24}],9:[function(a,g,m){var b=a('gl-matrix').vec3;g=a('events').EventEmitter;var l=a('underscore'),f=(m.createGesture=function(a){var b;switch(a.type){case 'circle':b=new c(a);break;case 'swipe':b=new k(a);break;case 'screenTap':b=new n(a);break;case 'keyTap':b=new p(a);break;default:throw'unknown gesture type';}return b.id=a.id,b.handIds=a.handIds.slice(),b.pointableIds=a.pointableIds.slice(),b.duration=a.duration,b.state=a.state,b.type=a.type,b},m.gestureListener= -function(a,b){var d={},c={};a.on('gesture',function(a,h){if(a.type==b){if(('start'==a.state||'stop'==a.state)&&void 0===c[a.id]){var k=new f(a,h);c[a.id]=k;l.each(d,function(a,b){k.on(b,a)})}c[a.id].update(a,h);'stop'==a.state&&delete c[a.id]}});var h={start:function(a){return d.start=a,h},stop:function(a){return d.stop=a,h},complete:function(a){return d.stop=a,h},update:function(a){return d.update=a,h}};return h},m.Gesture=function(a,b){this.gestures=[a];this.frames=[b]});f.prototype.update=function(a, -b){this.lastGesture=a;this.lastFrame=b;this.gestures.push(a);this.frames.push(b);this.emit(a.state,this)};f.prototype.translation=function(){return b.subtract(b.create(),this.lastGesture.startPosition,this.lastGesture.position)};l.extend(f.prototype,g.prototype);var c=function(a){this.center=a.center;this.normal=a.normal;this.progress=a.progress;this.radius=a.radius};c.prototype.toString=function(){return'CircleGesture ['+JSON.stringify(this)+']'};var k=function(a){this.startPosition=a.startPosition; +'./pointable':14,'gl-matrix':23,underscore:24}],9:[function(a,e,m){var b=a('gl-matrix').vec3;e=a('events').EventEmitter;var l=a('underscore'),g=(m.createGesture=function(a){var b;switch(a.type){case 'circle':b=new c(a);break;case 'swipe':b=new k(a);break;case 'screenTap':b=new n(a);break;case 'keyTap':b=new p(a);break;default:throw'unknown gesture type';}return b.id=a.id,b.handIds=a.handIds.slice(),b.pointableIds=a.pointableIds.slice(),b.duration=a.duration,b.state=a.state,b.type=a.type,b},m.gestureListener= +function(a,b){var d={},c={};a.on('gesture',function(a,h){if(a.type==b){if(('start'==a.state||'stop'==a.state)&&void 0===c[a.id]){var k=new g(a,h);c[a.id]=k;l.each(d,function(a,b){k.on(b,a)})}c[a.id].update(a,h);'stop'==a.state&&delete c[a.id]}});var h={start:function(a){return d.start=a,h},stop:function(a){return d.stop=a,h},complete:function(a){return d.stop=a,h},update:function(a){return d.update=a,h}};return h},m.Gesture=function(a,b){this.gestures=[a];this.frames=[b]});g.prototype.update=function(a, +b){this.lastGesture=a;this.lastFrame=b;this.gestures.push(a);this.frames.push(b);this.emit(a.state,this)};g.prototype.translation=function(){return b.subtract(b.create(),this.lastGesture.startPosition,this.lastGesture.position)};l.extend(g.prototype,e.prototype);var c=function(a){this.center=a.center;this.normal=a.normal;this.progress=a.progress;this.radius=a.radius};c.prototype.toString=function(){return'CircleGesture ['+JSON.stringify(this)+']'};var k=function(a){this.startPosition=a.startPosition; this.position=a.position;this.direction=a.direction;this.speed=a.speed};k.prototype.toString=function(){return'SwipeGesture ['+JSON.stringify(this)+']'};var n=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};n.prototype.toString=function(){return'ScreenTapGesture ['+JSON.stringify(this)+']'};var p=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};p.prototype.toString=function(){return'KeyTapGesture ['+JSON.stringify(this)+ -']'}},{events:21,'gl-matrix':23,underscore:24}],10:[function(a,g){var m=a('./pointable'),b=a('./bone'),l=a('gl-matrix'),f=l.mat3,c=l.vec3,k=a('underscore');a=g.exports=function(a){this.id=a.id;this.palmPosition=a.palmPosition;this.direction=a.direction;this.palmVelocity=a.palmVelocity;this.palmNormal=a.palmNormal;this.sphereCenter=a.sphereCenter;this.sphereRadius=a.sphereRadius;this.valid=!0;this.pointables=[];this.fingers=[];this.arm=a.armBasis?new b(this,{type:4,width:a.armWidth,prevJoint:a.elbow, +']'}},{events:21,'gl-matrix':23,underscore:24}],10:[function(a,e){var m=a('./pointable'),b=a('./bone'),l=a('gl-matrix'),g=l.mat3,c=l.vec3,k=a('underscore');a=e.exports=function(a){this.id=a.id;this.palmPosition=a.palmPosition;this.direction=a.direction;this.palmVelocity=a.palmVelocity;this.palmNormal=a.palmNormal;this.sphereCenter=a.sphereCenter;this.sphereRadius=a.sphereRadius;this.valid=!0;this.pointables=[];this.fingers=[];this.arm=a.armBasis?new b(this,{type:4,width:a.armWidth,prevJoint:a.elbow, nextJoint:a.wrist,basis:a.armBasis}):null;this.tools=[];this._translation=a.t;this._rotation=k.flatten(a.r);this._scaleFactor=a.s;this.timeVisible=a.timeVisible;this.stabilizedPalmPosition=a.stabilizedPalmPosition;this.type=a.type;this.grabStrength=a.grabStrength;this.pinchStrength=a.pinchStrength;this.confidence=a.confidence};a.prototype.finger=function(a){return(a=this.frame.finger(a))&&a.handId==this.id?a:m.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid||!a.hand(this.id).valid)return 0; -var f=this.rotationMatrix(a),f=Math.acos(.5*(f[0]+f[4]+f[8]-1));if(f=isNaN(f)?0:f,void 0!==b)a=this.rotationAxis(a),f*=c.dot(a,c.normalize(c.create(),b));return f};a.prototype.rotationAxis=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?c.normalize(c.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):c.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return f.create();a=a.hand(this.id); -if(!a.valid)return f.create();var b=f.transpose(f.create(),this._rotation);return f.multiply(f.create(),a._rotation,b)};a.prototype.scaleFactor=function(a){if(!this.valid||!a.valid)return 1;a=a.hand(this.id);return a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?[this._translation[0]-a._translation[0],this._translation[1]-a._translation[1],this._translation[2]-a._translation[2]]:c.create()}; +var g=this.rotationMatrix(a),g=Math.acos(.5*(g[0]+g[4]+g[8]-1));if(g=isNaN(g)?0:g,void 0!==b)a=this.rotationAxis(a),g*=c.dot(a,c.normalize(c.create(),b));return g};a.prototype.rotationAxis=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?c.normalize(c.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):c.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return g.create();a=a.hand(this.id); +if(!a.valid)return g.create();var b=g.transpose(g.create(),this._rotation);return g.multiply(g.create(),a._rotation,b)};a.prototype.scaleFactor=function(a){if(!this.valid||!a.valid)return 1;a=a.hand(this.id);return a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){if(!this.valid||!a.valid)return c.create();a=a.hand(this.id);return a.valid?[this._translation[0]-a._translation[0],this._translation[1]-a._translation[1],this._translation[2]-a._translation[2]]:c.create()}; a.prototype.toString=function(){return'Hand ('+this.type+') [ id: '+this.id+' | palm velocity:'+this.palmVelocity+' | sphere center:'+this.sphereCenter+' ] '};a.prototype.pitch=function(){return Math.atan2(this.direction[1],-this.direction[2])};a.prototype.yaw=function(){return Math.atan2(this.direction[0],-this.direction[2])};a.prototype.roll=function(){return Math.atan2(this.palmNormal[0],-this.palmNormal[1])};a.Invalid={valid:!1,fingers:[],tools:[],pointables:[],left:!1,pointable:function(){return m.Invalid}, -finger:function(){return m.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return f.create()},rotationAxis:function(){return c.create()},scaleFactor:function(){return 1},translation:function(){return c.create()}}},{'./bone':1,'./pointable':14,'gl-matrix':23,underscore:24}],11:[function(a,g){g.exports={Controller:a('./controller'),Frame:a('./frame'),Gesture:a('./gesture'),Hand:a('./hand'),Pointable:a('./pointable'), +finger:function(){return m.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return g.create()},rotationAxis:function(){return c.create()},scaleFactor:function(){return 1},translation:function(){return c.create()}}},{'./bone':1,'./pointable':14,'gl-matrix':23,underscore:24}],11:[function(a,e){e.exports={Controller:a('./controller'),Frame:a('./frame'),Gesture:a('./gesture'),Hand:a('./hand'),Pointable:a('./pointable'), Finger:a('./finger'),InteractionBox:a('./interaction_box'),CircularBuffer:a('./circular_buffer'),UI:a('./ui'),JSONProtocol:a('./protocol').JSONProtocol,glMatrix:a('gl-matrix'),mat3:a('gl-matrix').mat3,vec3:a('gl-matrix').vec3,loopController:void 0,version:a('./version.js'),_:a('underscore'),EventEmitter:a('events').EventEmitter,loop:function(a,b){return a&&void 0===b&&'[object Function]'==={}.toString.call(a)&&(b=a,a={}),this.loopController?a&&this.loopController.setupFrameEvents(a):this.loopController= -new this.Controller(a),this.loopController.loop(b),this.loopController},plugin:function(a,b){this.Controller.plugin(a,b)}}},{'./circular_buffer':2,'./controller':5,'./finger':7,'./frame':8,'./gesture':9,'./hand':10,'./interaction_box':12,'./pointable':14,'./protocol':15,'./ui':16,'./version.js':19,events:21,'gl-matrix':23,underscore:24}],12:[function(a,g){var m=a('gl-matrix').vec3;a=g.exports=function(a){this.valid=!0;this.center=a.center;this.size=a.size;this.width=a.size[0];this.height=a.size[1]; -this.depth=a.size[2]};a.prototype.denormalizePoint=function(a){return m.fromValues((a[0]-.5)*this.size[0]+this.center[0],(a[1]-.5)*this.size[1]+this.center[1],(a[2]-.5)*this.size[2]+this.center[2])};a.prototype.normalizePoint=function(a,g){a=m.fromValues((a[0]-this.center[0])/this.size[0]+.5,(a[1]-this.center[1])/this.size[1]+.5,(a[2]-this.center[2])/this.size[2]+.5);return g&&(a[0]=Math.min(Math.max(a[0],0),1),a[1]=Math.min(Math.max(a[1],0),1),a[2]=Math.min(Math.max(a[2],0),1)),a};a.prototype.toString= -function(){return'InteractionBox [ width:'+this.width+' | height:'+this.height+' | depth:'+this.depth+' ]'};a.Invalid={valid:!1}},{'gl-matrix':23}],13:[function(a,g){a=g.exports=function(a){this.steps=[];this.controller=a};a.prototype.addStep=function(a){this.steps.push(a)};a.prototype.run=function(a){for(var b=this.steps.length,g=0;g!=b&&a;g++)a=this.steps[g](a);return a};a.prototype.removeStep=function(a){a=this.steps.indexOf(a);if(-1===a)throw'Step not found in pipeline';this.steps.splice(a,1)}; -a.prototype.addWrappedStep=function(a,b){var g=this.controller,f=function(c){var f,l,p;f='frame'==a?[c]:c[a+'s']||[];l=0;for(p=f.length;p>l;l++)b.call(g,f[l]);return c};return this.addStep(f),f}},{}],14:[function(a,g){a=a('gl-matrix');g=(a.vec3,g.exports=function(a){this.valid=!0;this.id=a.id;this.handId=a.handId;this.length=a.length;this.tool=a.tool;this.width=a.width;this.direction=a.direction;this.stabilizedTipPosition=a.stabilizedTipPosition;this.tipPosition=a.tipPosition;this.tipVelocity=a.tipVelocity; -this.touchZone=a.touchZone;this.touchDistance=a.touchDistance;this.timeVisible=a.timeVisible});g.prototype.toString=function(){return'Pointable [ id:'+this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};g.prototype.hand=function(){return this.frame.hand(this.handId)};g.Invalid={valid:!1}},{'gl-matrix':23}],15:[function(a,g,m){var b=a('./frame'),l=(a('./hand'),a('./pointable'),a('./finger'),a('underscore')),f=a('events').EventEmitter,c=function(a){this.type=a.type; +new this.Controller(a),this.loopController.loop(b),this.loopController},plugin:function(a,b){this.Controller.plugin(a,b)}}},{'./circular_buffer':2,'./controller':5,'./finger':7,'./frame':8,'./gesture':9,'./hand':10,'./interaction_box':12,'./pointable':14,'./protocol':15,'./ui':16,'./version.js':19,events:21,'gl-matrix':23,underscore:24}],12:[function(a,e){var m=a('gl-matrix').vec3;a=e.exports=function(a){this.valid=!0;this.center=a.center;this.size=a.size;this.width=a.size[0];this.height=a.size[1]; +this.depth=a.size[2]};a.prototype.denormalizePoint=function(a){return m.fromValues((a[0]-.5)*this.size[0]+this.center[0],(a[1]-.5)*this.size[1]+this.center[1],(a[2]-.5)*this.size[2]+this.center[2])};a.prototype.normalizePoint=function(a,e){a=m.fromValues((a[0]-this.center[0])/this.size[0]+.5,(a[1]-this.center[1])/this.size[1]+.5,(a[2]-this.center[2])/this.size[2]+.5);return e&&(a[0]=Math.min(Math.max(a[0],0),1),a[1]=Math.min(Math.max(a[1],0),1),a[2]=Math.min(Math.max(a[2],0),1)),a};a.prototype.toString= +function(){return'InteractionBox [ width:'+this.width+' | height:'+this.height+' | depth:'+this.depth+' ]'};a.Invalid={valid:!1}},{'gl-matrix':23}],13:[function(a,e){a=e.exports=function(a){this.steps=[];this.controller=a};a.prototype.addStep=function(a){this.steps.push(a)};a.prototype.run=function(a){for(var b=this.steps.length,e=0;e!=b&&a;e++)a=this.steps[e](a);return a};a.prototype.removeStep=function(a){a=this.steps.indexOf(a);if(-1===a)throw'Step not found in pipeline';this.steps.splice(a,1)}; +a.prototype.addWrappedStep=function(a,b){var e=this.controller,g=function(c){var g,n,l;g='frame'==a?[c]:c[a+'s']||[];n=0;for(l=g.length;l>n;n++)b.call(e,g[n]);return c};return this.addStep(g),g}},{}],14:[function(a,e){a=a('gl-matrix');e=(a.vec3,e.exports=function(a){this.valid=!0;this.id=a.id;this.handId=a.handId;this.length=a.length;this.tool=a.tool;this.width=a.width;this.direction=a.direction;this.stabilizedTipPosition=a.stabilizedTipPosition;this.tipPosition=a.tipPosition;this.tipVelocity=a.tipVelocity; +this.touchZone=a.touchZone;this.touchDistance=a.touchDistance;this.timeVisible=a.timeVisible});e.prototype.toString=function(){return'Pointable [ id:'+this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};e.prototype.hand=function(){return this.frame.hand(this.handId)};e.Invalid={valid:!1}},{'gl-matrix':23}],15:[function(a,e,m){var b=a('./frame'),l=(a('./hand'),a('./pointable'),a('./finger'),a('underscore')),g=a('events').EventEmitter,c=function(a){this.type=a.type; this.state=a.state};m.chooseProtocol=function(a){var b;switch(a.version){case 1:case 2:case 3:case 4:case 5:case 6:b=k(a);b.sendBackground=function(a,c){a.send(b.encode({background:c}))};b.sendFocused=function(a,c){a.send(b.encode({focused:c}))};b.sendOptimizeHMD=function(a,c){a.send(b.encode({optimizeHMD:c}))};break;default:throw'unrecognized version';}return b};var k=m.JSONProtocol=function(a){var k=function(a){if(a.event)return new c(a.event);k.emit('beforeFrameCreated',a);var h=new b(a);return k.emit('afterFrameCreated', -h,a),h};return k.encode=function(a){return JSON.stringify(a)},k.version=a.version,k.serviceVersion=a.serviceVersion,k.versionLong='Version '+a.version,k.type='protocol',l.extend(k,f.prototype),k}},{'./finger':7,'./frame':8,'./hand':10,'./pointable':14,events:21,underscore:24}],16:[function(a,g,m){m.UI={Region:a('./ui/region'),Cursor:a('./ui/cursor')}},{'./ui/cursor':17,'./ui/region':18}],17:[function(a,g){g.exports=function(){return function(a){var b=a.pointables.sort(function(a,b){return a.z-b.z})[0]; -return b&&b.valid&&(a.cursorPosition=b.tipPosition),a}}},{}],18:[function(a,g){var m=a('events').EventEmitter;a=a('underscore');var b=g.exports=function(a,b){this.start=new Vector(a);this.end=new Vector(b);this.enteredFrame=null};b.prototype.hasPointables=function(a){for(var b=0;b!=a.pointables.length;b++){var c=a.pointables[b].tipPosition;if(c.x>=this.start.x&&c.x<=this.end.x&&c.y>=this.start.y&&c.y<=this.end.y&&c.z>=this.start.z&&c.z<=this.end.z)return!0}return!1};b.prototype.listener=function(a){var b= -this;return a&&a.nearThreshold&&this.setupNearRegion(a.nearThreshold),function(a){return b.updatePosition(a)}};b.prototype.clipper=function(){var a=this;return function(b){return a.updatePosition(b),a.enteredFrame?b:null}};b.prototype.setupNearRegion=function(a){a=this.nearRegion=new b([this.start.x-a,this.start.y-a,this.start.z-a],[this.end.x+a,this.end.y+a,this.end.z+a]);var f=this;a.on('enter',function(a){f.emit('near',a)});a.on('exit',function(a){f.emit('far',a)});f.on('exit',function(a){f.emit('near', +h,a),h};return k.encode=function(a){return JSON.stringify(a)},k.version=a.version,k.serviceVersion=a.serviceVersion,k.versionLong='Version '+a.version,k.type='protocol',l.extend(k,g.prototype),k}},{'./finger':7,'./frame':8,'./hand':10,'./pointable':14,events:21,underscore:24}],16:[function(a,e,m){m.UI={Region:a('./ui/region'),Cursor:a('./ui/cursor')}},{'./ui/cursor':17,'./ui/region':18}],17:[function(a,e){e.exports=function(){return function(a){var b=a.pointables.sort(function(a,b){return a.z-b.z})[0]; +return b&&b.valid&&(a.cursorPosition=b.tipPosition),a}}},{}],18:[function(a,e){var m=a('events').EventEmitter;a=a('underscore');var b=e.exports=function(a,b){this.start=new Vector(a);this.end=new Vector(b);this.enteredFrame=null};b.prototype.hasPointables=function(a){for(var b=0;b!=a.pointables.length;b++){var c=a.pointables[b].tipPosition;if(c.x>=this.start.x&&c.x<=this.end.x&&c.y>=this.start.y&&c.y<=this.end.y&&c.z>=this.start.z&&c.z<=this.end.z)return!0}return!1};b.prototype.listener=function(a){var b= +this;return a&&a.nearThreshold&&this.setupNearRegion(a.nearThreshold),function(a){return b.updatePosition(a)}};b.prototype.clipper=function(){var a=this;return function(b){return a.updatePosition(b),a.enteredFrame?b:null}};b.prototype.setupNearRegion=function(a){a=this.nearRegion=new b([this.start.x-a,this.start.y-a,this.start.z-a],[this.end.x+a,this.end.y+a,this.end.z+a]);var g=this;a.on('enter',function(a){g.emit('near',a)});a.on('exit',function(a){g.emit('far',a)});g.on('exit',function(a){g.emit('near', a)})};b.prototype.updatePosition=function(a){return this.nearRegion&&this.nearRegion.updatePosition(a),this.hasPointables(a)&&null==this.enteredFrame?(this.enteredFrame=a,this.emit('enter',this.enteredFrame)):this.hasPointables(a)||null==this.enteredFrame||(this.enteredFrame=null,this.emit('exit',this.enteredFrame)),a};b.prototype.normalize=function(a){return new Vector([(a.x-this.start.x)/(this.end.x-this.start.x),(a.y-this.start.y)/(this.end.y-this.start.y),(a.z-this.start.z)/(this.end.z-this.start.z)])}; -b.prototype.mapToXY=function(a,b,c){a=this.normalize(a);var f=a.x,g=a.y;return 1f&&(f=-1),1g&&(g=-1),[(f+1)/2*b,(1-g)/2*c,a.z]};a.extend(b.prototype,m.prototype)},{events:21,underscore:24}],19:[function(a,g){g.exports={full:'0.6.4',major:0,minor:6,dot:4}},{}],20:[function(){},{}],21:[function(a,g,m){a=a('__browserify_process');a.EventEmitter||(a.EventEmitter=function(){});m=m.EventEmitter=a.EventEmitter;var b='function'==typeof Array.isArray?Array.isArray:function(a){return'[object Array]'=== -Object.prototype.toString.call(a)};m.prototype.setMaxListeners=function(a){this._events||(this._events={});this._events.maxListeners=a};m.prototype.emit=function(a){if('error'===a&&(!this._events||!this._events.error||b(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var f=this._events[a];if(!f)return!1;if('function'==typeof f){switch(arguments.length){case 1:f.call(this);break; -case 2:f.call(this,arguments[1]);break;case 3:f.call(this,arguments[1],arguments[2]);break;default:var c=Array.prototype.slice.call(arguments,1);f.apply(this,c)}return!0}if(b(f)){for(var c=Array.prototype.slice.call(arguments,1),f=f.slice(),k=0,g=f.length;g>k;k++)f[k].apply(this,c);return!0}return!1};m.prototype.addListener=function(a,f){if('function'!=typeof f)throw Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,f),this._events[a])if(b(this._events[a])){if(!this._events[a].warned){var c; -(c=void 0!==this._events.maxListeners?this._events.maxListeners:10)&&0c&&(this._events[a].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}this._events[a].push(f)}else this._events[a]=[this._events[a],f];else this._events[a]=f;return this};m.prototype.on=m.prototype.addListener;m.prototype.once=function(a,b){var c=this;return c.on(a, -function n(){c.removeListener(a,n);b.apply(this,arguments)}),this};m.prototype.removeListener=function(a,f){if('function'!=typeof f)throw Error('removeListener only takes instances of Function');if(!this._events||!this._events[a])return this;var c=this._events[a];if(b(c)){a:if(c.indexOf)f=c.indexOf(f);else{for(var k=0;kf)return this;c.splice(f,1);0==c.length&&delete this._events[a]}else this._events[a]===f&&delete this._events[a];return this};m.prototype.removeAllListeners= -function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)};m.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),b(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]};m.listenerCount=function(a,b){return a._events&&a._events[b]?'function'==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:22}],22:[function(a,g){a=g.exports={};a.nextTick= -function(){if('undefined'!=typeof window&&window.setImmediate)return function(a){return window.setImmediate(a)};if('undefined'!=typeof window&&window.postMessage&&window.addEventListener){var a=[];return window.addEventListener('message',function(b){var g=b.source;(g===window||null===g)&&'process-tick'===b.data&&(b.stopPropagation(),0g&&(g=-1),1e&&(e=-1),[(g+1)/2*b,(1-e)/2*c,a.z]};a.extend(b.prototype,m.prototype)},{events:21,underscore:24}],19:[function(a,e){e.exports={full:'0.6.4',major:0,minor:6,dot:4}},{}],20:[function(){},{}],21:[function(a,e,m){a=a('__browserify_process');a.EventEmitter||(a.EventEmitter=function(){});m=m.EventEmitter=a.EventEmitter;var b='function'==typeof Array.isArray?Array.isArray:function(a){return'[object Array]'=== +Object.prototype.toString.call(a)};m.prototype.setMaxListeners=function(a){this._events||(this._events={});this._events.maxListeners=a};m.prototype.emit=function(a){if('error'===a&&(!this._events||!this._events.error||b(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var g=this._events[a];if(!g)return!1;if('function'==typeof g){switch(arguments.length){case 1:g.call(this);break; +case 2:g.call(this,arguments[1]);break;case 3:g.call(this,arguments[1],arguments[2]);break;default:var c=Array.prototype.slice.call(arguments,1);g.apply(this,c)}return!0}if(b(g)){for(var c=Array.prototype.slice.call(arguments,1),g=g.slice(),k=0,e=g.length;e>k;k++)g[k].apply(this,c);return!0}return!1};m.prototype.addListener=function(a,g){if('function'!=typeof g)throw Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,g),this._events[a])if(b(this._events[a])){if(!this._events[a].warned){var c; +(c=void 0!==this._events.maxListeners?this._events.maxListeners:10)&&0c&&(this._events[a].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}this._events[a].push(g)}else this._events[a]=[this._events[a],g];else this._events[a]=g;return this};m.prototype.on=m.prototype.addListener;m.prototype.once=function(a,b){var c=this;return c.on(a, +function n(){c.removeListener(a,n);b.apply(this,arguments)}),this};m.prototype.removeListener=function(a,g){if('function'!=typeof g)throw Error('removeListener only takes instances of Function');if(!this._events||!this._events[a])return this;var c=this._events[a];if(b(c)){a:if(c.indexOf)g=c.indexOf(g);else{for(var k=0;kg)return this;c.splice(g,1);0==c.length&&delete this._events[a]}else this._events[a]===g&&delete this._events[a];return this};m.prototype.removeAllListeners= +function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)};m.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),b(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]};m.listenerCount=function(a,b){return a._events&&a._events[b]?'function'==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:22}],22:[function(a,e){a=e.exports={};a.nextTick= +function(){if('undefined'!=typeof window&&window.setImmediate)return function(a){return window.setImmediate(a)};if('undefined'!=typeof window&&window.postMessage&&window.addEventListener){var a=[];return window.addEventListener('message',function(b){var e=b.source;(e===window||null===e)&&'process-tick'===b.data&&(b.stopPropagation(),0c;c+=d)a[0]=b[c],a[1]=b[c+1],f(a,a,k),b[c]=a[0],b[c+1]=a[1];return b}}();h.str=function(a){return'vec2('+ -a[0]+', '+a[1]+')'};'undefined'!=typeof a&&(a.vec2=h);var d={create:function(){var a=new f(3);return a[0]=0,a[1]=0,a[2]=0,a},clone:function(a){var b=new f(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b},fromValues:function(a,b,d){var c=new f(3);return c[0]=a,c[1]=b,c[2]=d,c},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},set:function(a,b,d,c){return a[0]=b,a[1]=d,a[2]=c,a},add:function(a,b,d){return a[0]=b[0]+d[0],a[1]=b[1]+d[1],a[2]=b[2]+d[2],a},subtract:function(a,b,d){return a[0]=b[0]-d[0], +return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],g(a,a,k),b[c]=a[0],b[c+1]=a[1];return b}}();h.str=function(a){return'vec2('+ +a[0]+', '+a[1]+')'};'undefined'!=typeof a&&(a.vec2=h);var d={create:function(){var a=new g(3);return a[0]=0,a[1]=0,a[2]=0,a},clone:function(a){var b=new g(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b},fromValues:function(a,b,d){var c=new g(3);return c[0]=a,c[1]=b,c[2]=d,c},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},set:function(a,b,d,c){return a[0]=b,a[1]=d,a[2]=c,a},add:function(a,b,d){return a[0]=b[0]+d[0],a[1]=b[1]+d[1],a[2]=b[2]+d[2],a},subtract:function(a,b,d){return a[0]=b[0]-d[0], a[1]=b[1]-d[1],a[2]=b[2]-d[2],a}};d.sub=d.subtract;d.multiply=function(a,b,d){return a[0]=b[0]*d[0],a[1]=b[1]*d[1],a[2]=b[2]*d[2],a};d.mul=d.multiply;d.divide=function(a,b,d){return a[0]=b[0]/d[0],a[1]=b[1]/d[1],a[2]=b[2]/d[2],a};d.div=d.divide;d.min=function(a,b,d){return a[0]=Math.min(b[0],d[0]),a[1]=Math.min(b[1],d[1]),a[2]=Math.min(b[2],d[2]),a};d.max=function(a,b,d){return a[0]=Math.max(b[0],d[0]),a[1]=Math.max(b[1],d[1]),a[2]=Math.max(b[2],d[2]),a};d.scale=function(a,b,d){return a[0]=b[0]*d, a[1]=b[1]*d,a[2]=b[2]*d,a};d.scaleAndAdd=function(a,b,d,c){return a[0]=b[0]+d[0]*c,a[1]=b[1]+d[1]*c,a[2]=b[2]+d[2]*c,a};d.distance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(d*d+c*c+a*a)};d.dist=d.distance;d.squaredDistance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return d*d+c*c+a*a};d.sqrDist=d.squaredDistance;d.length=function(a){var b=a[0],d=a[1];a=a[2];return Math.sqrt(b*b+d*d+a*a)};d.len=d.length;d.squaredLength=function(a){var b=a[0],d=a[1];a=a[2];return b* -b+d*d+a*a};d.sqrLen=d.squaredLength;d.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a};d.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],d=d*d+c*c+h*h;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],f(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();d.str=function(a){return'vec3('+a[0]+', '+a[1]+', '+a[2]+')'};'undefined'!=typeof a&&(a.vec3=d);var v={create:function(){var a=new f(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a},clone:function(a){var b=new f(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},fromValues:function(a,b,d,c){var h=new f(4);return h[0]=a,h[1]=b,h[2]=d,h[3]=c,h},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2], +b+d*d+a*a};d.sqrLen=d.squaredLength;d.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a};d.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],d=d*d+c*c+h*h;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],g(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();d.str=function(a){return'vec3('+a[0]+', '+a[1]+', '+a[2]+')'};'undefined'!=typeof a&&(a.vec3=d);var v={create:function(){var a=new g(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a},clone:function(a){var b=new g(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},fromValues:function(a,b,d,c){var h=new g(4);return h[0]=a,h[1]=b,h[2]=d,h[3]=c,h},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2], a[3]=b[3],a},set:function(a,b,d,c,h){return a[0]=b,a[1]=d,a[2]=c,a[3]=h,a},add:function(a,b,d){return a[0]=b[0]+d[0],a[1]=b[1]+d[1],a[2]=b[2]+d[2],a[3]=b[3]+d[3],a},subtract:function(a,b,d){return a[0]=b[0]-d[0],a[1]=b[1]-d[1],a[2]=b[2]-d[2],a[3]=b[3]-d[3],a}};v.sub=v.subtract;v.multiply=function(a,b,d){return a[0]=b[0]*d[0],a[1]=b[1]*d[1],a[2]=b[2]*d[2],a[3]=b[3]*d[3],a};v.mul=v.multiply;v.divide=function(a,b,d){return a[0]=b[0]/d[0],a[1]=b[1]/d[1],a[2]=b[2]/d[2],a[3]=b[3]/d[3],a};v.div=v.divide; v.min=function(a,b,d){return a[0]=Math.min(b[0],d[0]),a[1]=Math.min(b[1],d[1]),a[2]=Math.min(b[2],d[2]),a[3]=Math.min(b[3],d[3]),a};v.max=function(a,b,d){return a[0]=Math.max(b[0],d[0]),a[1]=Math.max(b[1],d[1]),a[2]=Math.max(b[2],d[2]),a[3]=Math.max(b[3],d[3]),a};v.scale=function(a,b,d){return a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d,a[3]=b[3]*d,a};v.scaleAndAdd=function(a,b,d,c){return a[0]=b[0]+d[0]*c,a[1]=b[1]+d[1]*c,a[2]=b[2]+d[2]*c,a[3]=b[3]+d[3]*c,a};v.distance=function(a,b){var d=b[0]-a[0],c=b[1]- a[1],h=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(d*d+c*c+h*h+a*a)};v.dist=v.distance;v.squaredDistance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1],h=b[2]-a[2];a=b[3]-a[3];return d*d+c*c+h*h+a*a};v.sqrDist=v.squaredDistance;v.length=function(a){var b=a[0],d=a[1],c=a[2];a=a[3];return Math.sqrt(b*b+d*d+c*c+a*a)};v.len=v.length;v.squaredLength=function(a){var b=a[0],d=a[1],c=a[2];a=a[3];return b*b+d*d+c*c+a*a};v.sqrLen=v.squaredLength;v.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=-b[3], -a};v.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],d=d*d+c*c+h*h+f*f;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],a[3]=b[c+3],f(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2],b[c+3]=a[3];return b}}();v.str=function(a){return'vec4('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.vec4=v);l={create:function(){var a=new f(4);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},clone:function(a){var b=new f(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},identity:function(a){return a[0]= -1,a[1]=0,a[2]=0,a[3]=1,a},transpose:function(a,b){if(a===b){var d=b[1];a[1]=b[2];a[2]=d}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var f=d*b-h*c;return f?(f=1/f,a[0]=b*f,a[1]=-c*f,a[2]=-h*f,a[3]=d*f,a):null},adjoint:function(a,b){var d=b[0];return a[0]=b[3],a[1]=-b[1],a[2]=-b[2],a[3]=d,a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2];b=b[3];var k=d[0],g=d[1],l=d[2];d=d[3];return a[0]= -c*k+f*g,a[1]=h*k+b*g,a[2]=c*l+f*d,a[3]=h*l+b*d,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],f=b[2];b=b[3];var k=Math.sin(d);d=Math.cos(d);return a[0]=c*d+f*k,a[1]=h*d+b*k,a[2]=c*-k+f*d,a[3]=h*-k+b*d,a};l.scale=function(a,b,d){var c=b[1],h=b[2],f=b[3],k=d[0];d=d[1];return a[0]=b[0]*k,a[1]=c*k,a[2]=h*d,a[3]=f*d,a};l.str=function(a){return'mat2('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3], -2))};l.LDU=function(a,b,d,c){return a[2]=c[2]/c[0],d[0]=c[0],d[1]=c[1],d[3]=c[3]-a[2]*d[1],[a,b,d]};'undefined'!=typeof a&&(a.mat2=l);l={create:function(){var a=new f(6);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},clone:function(a){var b=new f(6);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},invert:function(a, -b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4];b=b[5];var g=d*f-c*h;return g?(g=1/g,a[0]=f*g,a[1]=-c*g,a[2]=-h*g,a[3]=d*g,a[4]=(h*b-f*k)*g,a[5]=(c*k-d*b)*g,a):null},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4];b=b[5];var l=d[0],n=d[1],q=d[2],p=d[3],m=d[4];d=d[5];return a[0]=c*l+f*n,a[1]=h*l+k*n,a[2]=c*q+f*p,a[3]=h*q+k*p,a[4]=c*m+f*d+g,a[5]=h*m+k*d+b,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4]; -b=b[5];var l=Math.sin(d);d=Math.cos(d);return a[0]=c*d+f*l,a[1]=h*d+k*l,a[2]=c*-l+f*d,a[3]=h*-l+k*d,a[4]=g,a[5]=b,a};l.scale=function(a,b,d){var c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=d[0];d=d[1];return a[0]=b[0]*l,a[1]=c*l,a[2]=h*d,a[3]=f*d,a[4]=k,a[5]=g,a};l.translate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4];b=b[5];var l=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=f,a[3]=k,a[4]=c*l+f*d+g,a[5]=h*l+k*d+b,a};l.str=function(a){return'mat2d('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+ -')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};'undefined'!=typeof a&&(a.mat2d=l);var w={create:function(){var a=new f(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},fromMat4:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},clone:function(a){var b=new f(9);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]= +a};v.normalize=function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],d=d*d+c*c+h*h+g*g;return 0c;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],a[3]=b[c+3],g(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2],b[c+3]=a[3];return b}}();v.str=function(a){return'vec4('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.vec4=v);l={create:function(){var a=new g(4);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},clone:function(a){var b=new g(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},identity:function(a){return a[0]= +1,a[1]=0,a[2]=0,a[3]=1,a},transpose:function(a,b){if(a===b){var d=b[1];a[1]=b[2];a[2]=d}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var g=d*b-h*c;return g?(g=1/g,a[0]=b*g,a[1]=-c*g,a[2]=-h*g,a[3]=d*g,a):null},adjoint:function(a,b){var d=b[0];return a[0]=b[3],a[1]=-b[1],a[2]=-b[2],a[3]=d,a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2];b=b[3];var k=d[0],e=d[1],n=d[2];d=d[3];return a[0]= +c*k+g*e,a[1]=h*k+b*e,a[2]=c*n+g*d,a[3]=h*n+b*d,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],g=b[2];b=b[3];var k=Math.sin(d);d=Math.cos(d);return a[0]=c*d+g*k,a[1]=h*d+b*k,a[2]=c*-k+g*d,a[3]=h*-k+b*d,a};l.scale=function(a,b,d){var c=b[1],h=b[2],g=b[3],k=d[0];d=d[1];return a[0]=b[0]*k,a[1]=c*k,a[2]=h*d,a[3]=g*d,a};l.str=function(a){return'mat2('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3], +2))};l.LDU=function(a,b,d,c){return a[2]=c[2]/c[0],d[0]=c[0],d[1]=c[1],d[3]=c[3]-a[2]*d[1],[a,b,d]};'undefined'!=typeof a&&(a.mat2=l);l={create:function(){var a=new g(6);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},clone:function(a){var b=new g(6);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},invert:function(a, +b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4];b=b[5];var e=d*g-c*h;return e?(e=1/e,a[0]=g*e,a[1]=-c*e,a[2]=-h*e,a[3]=d*e,a[4]=(h*b-g*k)*e,a[5]=(c*k-d*b)*e,a):null},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4];b=b[5];var n=d[0],l=d[1],q=d[2],p=d[3],m=d[4];d=d[5];return a[0]=c*n+g*l,a[1]=h*n+k*l,a[2]=c*q+g*p,a[3]=h*q+k*p,a[4]=c*m+g*d+e,a[5]=h*m+k*d+b,a}};l.mul=l.multiply;l.rotate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4]; +b=b[5];var n=Math.sin(d);d=Math.cos(d);return a[0]=c*d+g*n,a[1]=h*d+k*n,a[2]=c*-n+g*d,a[3]=h*-n+k*d,a[4]=e,a[5]=b,a};l.scale=function(a,b,d){var c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=d[0];d=d[1];return a[0]=b[0]*n,a[1]=c*n,a[2]=h*d,a[3]=g*d,a[4]=k,a[5]=e,a};l.translate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4];b=b[5];var n=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=g,a[3]=k,a[4]=c*n+g*d+e,a[5]=h*n+k*d+b,a};l.str=function(a){return'mat2d('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+ +')'};l.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};'undefined'!=typeof a&&(a.mat2d=l);var w={create:function(){var a=new g(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},fromMat4:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},clone:function(a){var b=new g(9);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]= a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},transpose:function(a,b){if(a===b){var d=b[1],c=b[2],h=b[5];a[1]=b[3];a[2]=b[6];a[3]=d;a[5]=b[7];a[6]=c;a[7]=h}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a},invert:function(a,b){var d= -b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7];b=b[8];var q=b*k-g*n,p=-b*f+g*l,m=n*f-k*l,t=d*q+c*p+h*m;return t?(t=1/t,a[0]=q*t,a[1]=(-b*c+h*n)*t,a[2]=(g*c-h*k)*t,a[3]=p*t,a[4]=(b*d-h*l)*t,a[5]=(-g*d+h*f)*t,a[6]=m*t,a[7]=(-n*d+c*l)*t,a[8]=(k*d-c*f)*t,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7];b=b[8];return a[0]=k*b-g*n,a[1]=h*n-c*b,a[2]=c*g-h*k,a[3]=g*l-f*b,a[4]=d*b-h*l,a[5]=h*f-d*g,a[6]=f*n-k*l,a[7]=c*l-d*n,a[8]=d*k-c*f,a},determinant:function(a){var b= -a[3],d=a[4],c=a[5],h=a[6],f=a[7],k=a[8];return a[0]*(k*d-c*f)+a[1]*(-k*b+c*h)+a[2]*(f*b-d*h)},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7];b=b[8];var q=d[0],m=d[1],t=d[2],v=d[3],u=d[4],w=d[5],y=d[6],x=d[7];d=d[8];return a[0]=q*c+m*k+t*n,a[1]=q*h+m*g+t*p,a[2]=q*f+m*l+t*b,a[3]=v*c+u*k+w*n,a[4]=v*h+u*g+w*p,a[5]=v*f+u*l+w*b,a[6]=y*c+x*k+d*n,a[7]=y*h+x*g+d*p,a[8]=y*f+x*l+d*b,a}};w.mul=w.multiply;w.translate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4], -l=b[5],n=b[6],p=b[7];b=b[8];var q=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=f,a[3]=k,a[4]=g,a[5]=l,a[6]=q*c+d*k+n,a[7]=q*h+d*g+p,a[8]=q*f+d*l+b,a};w.rotate=function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7];b=b[8];var q=Math.sin(d);d=Math.cos(d);return a[0]=d*c+q*k,a[1]=d*h+q*g,a[2]=d*f+q*l,a[3]=d*k-q*c,a[4]=d*g-q*h,a[5]=d*l-q*f,a[6]=n,a[7]=p,a[8]=b,a};w.scale=function(a,b,d){var c=d[0];d=d[1];return a[0]=c*b[0],a[1]=c*b[1],a[2]=c*b[2],a[3]=d*b[3],a[4]=d*b[4],a[5]=d*b[5],a[6]= -b[6],a[7]=b[7],a[8]=b[8],a};w.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a};w.fromQuat=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var f=d+d,k=c+c,g=h+h,d=d*f,l=c*f,c=c*k,n=h*f,p=h*k,h=h*g,f=b*f,k=b*k;b*=g;return a[0]=1-c-h,a[3]=l-b,a[6]=n+k,a[1]=l+b,a[4]=1-d-h,a[7]=p-f,a[2]=n-k,a[5]=p+f,a[8]=1-d-c,a};w.normalFromMat4=function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7],p=b[8],q=b[9],m=b[10],t=b[11],v=b[12], -u=b[13],w=b[14];b=b[15];var y=d*g-c*k,x=d*l-h*k,Z=d*n-f*k,S=c*l-h*g,L=c*n-f*g,U=h*n-f*l,oa=p*u-q*v,pa=p*w-m*v,p=p*b-t*v,R=q*w-m*u,q=q*b-t*u,m=m*b-t*w;return(t=y*m-x*q+Z*R+S*p-L*pa+U*oa)?(t=1/t,a[0]=(g*m-l*q+n*R)*t,a[1]=(l*p-k*m-n*pa)*t,a[2]=(k*q-g*p+n*oa)*t,a[3]=(h*q-c*m-f*R)*t,a[4]=(d*m-h*p+f*pa)*t,a[5]=(c*p-d*q-f*oa)*t,a[6]=(u*U-w*L+b*S)*t,a[7]=(w*Z-v*U-b*x)*t,a[8]=(v*L-u*Z+b*y)*t,a):null};w.str=function(a){return'mat3('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+', '+a[6]+', '+a[7]+ -', '+a[8]+')'};w.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};'undefined'!=typeof a&&(a.mat3=w);var y={create:function(){var a=new f(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},clone:function(a){var b=new f(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]= +b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7];b=b[8];var p=b*k-e*l,q=-b*g+e*n,m=l*g-k*n,t=d*p+c*q+h*m;return t?(t=1/t,a[0]=p*t,a[1]=(-b*c+h*l)*t,a[2]=(e*c-h*k)*t,a[3]=q*t,a[4]=(b*d-h*n)*t,a[5]=(-e*d+h*g)*t,a[6]=m*t,a[7]=(-l*d+c*n)*t,a[8]=(k*d-c*g)*t,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7];b=b[8];return a[0]=k*b-e*l,a[1]=h*l-c*b,a[2]=c*e-h*k,a[3]=e*n-g*b,a[4]=d*b-h*n,a[5]=h*g-d*e,a[6]=g*l-k*n,a[7]=c*n-d*l,a[8]=d*k-c*g,a},determinant:function(a){var b= +a[3],d=a[4],c=a[5],h=a[6],g=a[7],k=a[8];return a[0]*(k*d-c*g)+a[1]*(-k*b+c*h)+a[2]*(g*b-d*h)},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7];b=b[8];var q=d[0],m=d[1],t=d[2],v=d[3],u=d[4],w=d[5],y=d[6],x=d[7];d=d[8];return a[0]=q*c+m*k+t*l,a[1]=q*h+m*e+t*p,a[2]=q*g+m*n+t*b,a[3]=v*c+u*k+w*l,a[4]=v*h+u*e+w*p,a[5]=v*g+u*n+w*b,a[6]=y*c+x*k+d*l,a[7]=y*h+x*e+d*p,a[8]=y*g+x*n+d*b,a}};w.mul=w.multiply;w.translate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4], +n=b[5],l=b[6],p=b[7];b=b[8];var q=d[0];d=d[1];return a[0]=c,a[1]=h,a[2]=g,a[3]=k,a[4]=e,a[5]=n,a[6]=q*c+d*k+l,a[7]=q*h+d*e+p,a[8]=q*g+d*n+b,a};w.rotate=function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7];b=b[8];var q=Math.sin(d);d=Math.cos(d);return a[0]=d*c+q*k,a[1]=d*h+q*e,a[2]=d*g+q*n,a[3]=d*k-q*c,a[4]=d*e-q*h,a[5]=d*n-q*g,a[6]=l,a[7]=p,a[8]=b,a};w.scale=function(a,b,d){var c=d[0];d=d[1];return a[0]=c*b[0],a[1]=c*b[1],a[2]=c*b[2],a[3]=d*b[3],a[4]=d*b[4],a[5]=d*b[5],a[6]= +b[6],a[7]=b[7],a[8]=b[8],a};w.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a};w.fromQuat=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var g=d+d,k=c+c,e=h+h,d=d*g,n=c*g,c=c*k,l=h*g,p=h*k,h=h*e,g=b*g,k=b*k;b*=e;return a[0]=1-c-h,a[3]=n-b,a[6]=l+k,a[1]=n+b,a[4]=1-d-h,a[7]=p-g,a[2]=l-k,a[5]=p+g,a[8]=1-d-c,a};w.normalFromMat4=function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7],p=b[8],q=b[9],m=b[10],t=b[11],v=b[12], +u=b[13],w=b[14];b=b[15];var y=d*e-c*k,x=d*n-h*k,Z=d*l-g*k,S=c*n-h*e,L=c*l-g*e,U=h*l-g*n,oa=p*u-q*v,pa=p*w-m*v,p=p*b-t*v,R=q*w-m*u,q=q*b-t*u,m=m*b-t*w;return(t=y*m-x*q+Z*R+S*p-L*pa+U*oa)?(t=1/t,a[0]=(e*m-n*q+l*R)*t,a[1]=(n*p-k*m-l*pa)*t,a[2]=(k*q-e*p+l*oa)*t,a[3]=(h*q-c*m-g*R)*t,a[4]=(d*m-h*p+g*pa)*t,a[5]=(c*p-d*q-g*oa)*t,a[6]=(u*U-w*L+b*S)*t,a[7]=(w*Z-v*U-b*x)*t,a[8]=(v*L-u*Z+b*y)*t,a):null};w.str=function(a){return'mat3('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+', '+a[6]+', '+a[7]+ +', '+a[8]+')'};w.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};'undefined'!=typeof a&&(a.mat3=w);var y={create:function(){var a=new g(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},clone:function(a){var b=new g(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]= a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},transpose:function(a,b){if(a=== -b){var d=b[1],c=b[2],h=b[3],f=b[6],k=b[7],g=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=d;a[6]=b[9];a[7]=b[13];a[8]=c;a[9]=f;a[11]=b[14];a[12]=h;a[13]=k;a[14]=g}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];var y=d*g-c* -k,x=d*l-h*k,Z=d*n-f*k,S=c*l-h*g,L=c*n-f*g,U=h*n-f*l,oa=p*w-m*v,pa=p*u-q*v,R=p*b-t*v,Y=m*u-q*w,na=m*b-t*w,la=q*b-t*u,ca=y*la-x*na+Z*Y+S*R-L*pa+U*oa;return ca?(ca=1/ca,a[0]=(g*la-l*na+n*Y)*ca,a[1]=(h*na-c*la-f*Y)*ca,a[2]=(w*U-u*L+b*S)*ca,a[3]=(q*L-m*U-t*S)*ca,a[4]=(l*R-k*la-n*pa)*ca,a[5]=(d*la-h*R+f*pa)*ca,a[6]=(u*Z-v*U-b*x)*ca,a[7]=(p*U-q*Z+t*x)*ca,a[8]=(k*na-g*R+n*oa)*ca,a[9]=(c*R-d*na-f*oa)*ca,a[10]=(v*L-w*Z+b*y)*ca,a[11]=(m*Z-p*L-t*y)*ca,a[12]=(g*pa-k*Y-l*oa)*ca,a[13]=(d*Y-c*pa+h*oa)*ca,a[14]=(w* -x-v*S-u*y)*ca,a[15]=(p*S-m*x+q*y)*ca,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],f=b[3],k=b[4],g=b[5],l=b[6],n=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];return a[0]=g*(q*b-t*u)-m*(l*b-n*u)+w*(l*t-n*q),a[1]=-(c*(q*b-t*u)-m*(h*b-f*u)+w*(h*t-f*q)),a[2]=c*(l*b-n*u)-g*(h*b-f*u)+w*(h*n-f*l),a[3]=-(c*(l*t-n*q)-g*(h*t-f*q)+m*(h*n-f*l)),a[4]=-(k*(q*b-t*u)-p*(l*b-n*u)+v*(l*t-n*q)),a[5]=d*(q*b-t*u)-p*(h*b-f*u)+v*(h*t-f*q),a[6]=-(d*(l*b-n*u)-k*(h*b-f*u)+v*(h*n-f*l)),a[7]= -d*(l*t-n*q)-k*(h*t-f*q)+p*(h*n-f*l),a[8]=k*(m*b-t*w)-p*(g*b-n*w)+v*(g*t-n*m),a[9]=-(d*(m*b-t*w)-p*(c*b-f*w)+v*(c*t-f*m)),a[10]=d*(g*b-n*w)-k*(c*b-f*w)+v*(c*n-f*g),a[11]=-(d*(g*t-n*m)-k*(c*t-f*m)+p*(c*n-f*g)),a[12]=-(k*(m*u-q*w)-p*(g*u-l*w)+v*(g*q-l*m)),a[13]=d*(m*u-q*w)-p*(c*u-h*w)+v*(c*q-h*m),a[14]=-(d*(g*u-l*w)-k*(c*u-h*w)+v*(c*l-h*g)),a[15]=d*(g*q-l*m)-k*(c*q-h*m)+p*(c*l-h*g),a},determinant:function(a){var b=a[0],d=a[1],c=a[2],h=a[3],f=a[4],k=a[5],g=a[6],l=a[7],n=a[8],p=a[9],m=a[10],q=a[11],t= -a[12],v=a[13],w=a[14];a=a[15];return(b*k-d*f)*(m*a-q*w)-(b*g-c*f)*(p*a-q*v)+(b*l-h*f)*(p*w-m*v)+(d*g-c*k)*(n*a-q*t)-(d*l-h*k)*(n*w-m*t)+(c*l-h*g)*(n*v-p*t)},multiply:function(a,b,d){var c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],w=b[12],u=b[13],y=b[14];b=b[15];var x=d[0],A=d[1],S=d[2],L=d[3];return a[0]=x*c+A*g+S*m+L*w,a[1]=x*h+A*l+S*q+L*u,a[2]=x*f+A*n+S*t+L*y,a[3]=x*k+A*p+S*v+L*b,x=d[4],A=d[5],S=d[6],L=d[7],a[4]=x*c+A*g+S*m+L*w,a[5]=x*h+A*l+S*q+L*u,a[6]= -x*f+A*n+S*t+L*y,a[7]=x*k+A*p+S*v+L*b,x=d[8],A=d[9],S=d[10],L=d[11],a[8]=x*c+A*g+S*m+L*w,a[9]=x*h+A*l+S*q+L*u,a[10]=x*f+A*n+S*t+L*y,a[11]=x*k+A*p+S*v+L*b,x=d[12],A=d[13],S=d[14],L=d[15],a[12]=x*c+A*g+S*m+L*w,a[13]=x*h+A*l+S*q+L*u,a[14]=x*f+A*n+S*t+L*y,a[15]=x*k+A*p+S*v+L*b,a}};y.mul=y.multiply;y.translate=function(a,b,d){var c,h,f,k,g,l,n,p,m,q,t,v,w=d[0],u=d[1];d=d[2];return b===a?(a[12]=b[0]*w+b[4]*u+b[8]*d+b[12],a[13]=b[1]*w+b[5]*u+b[9]*d+b[13],a[14]=b[2]*w+b[6]*u+b[10]*d+b[14],a[15]=b[3]*w+b[7]* -u+b[11]*d+b[15]):(c=b[0],h=b[1],f=b[2],k=b[3],g=b[4],l=b[5],n=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],a[0]=c,a[1]=h,a[2]=f,a[3]=k,a[4]=g,a[5]=l,a[6]=n,a[7]=p,a[8]=m,a[9]=q,a[10]=t,a[11]=v,a[12]=c*w+g*u+m*d+b[12],a[13]=h*w+l*u+q*d+b[13],a[14]=f*w+n*u+t*d+b[14],a[15]=k*w+p*u+v*d+b[15]),a};y.scale=function(a,b,d){var c=d[0],h=d[1];d=d[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*h,a[5]=b[5]*h,a[6]=b[6]*h,a[7]=b[7]*h,a[8]=b[8]*d,a[9]=b[9]*d,a[10]=b[10]*d,a[11]=b[11]*d,a[12]=b[12], -a[13]=b[13],a[14]=b[14],a[15]=b[15],a};y.rotate=function(a,d,c,h){var f,k,g,l,n,p,m,q,t,v,w,u,y,x,A,E,S,L,U,oa,pa,R,Y,na,la=h[0],ca=h[1];h=h[2];var Ba=Math.sqrt(la*la+ca*ca+h*h);return Math.abs(Ba)g?(d.cross(a,b,f),1E-6>d.length(a)&&d.cross(a,c,f),d.normalize(a,a),x.setAxisAngle(h,a,Math.PI),h):.999999f&&(f=-f,t=-t,q=-q,v=-v,d=-d),1E-6<1-f?(h=Math.acos(f),k=Math.sin(h),g=Math.sin((1-c)*h)/k,l=Math.sin(c*h)/k):(g=1-c,l=c),a[0]=g*n+l*t,a[1]=g*p+l*q,a[2]=g*m+l*v,a[3]=g*b+l*d,a};x.invert=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var f=d*d+c*c+h*h+b*b,f=f?1/f:0;return a[0]=-d*f,a[1]=-c*f,a[2]=-h*f,a[3]=b*f,a};x.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a};x.length=v.length;x.len=x.length;x.squaredLength=v.squaredLength;x.sqrLen=x.squaredLength;x.normalize= -v.normalize;x.fromMat3=function(a,b){var d;d=b[0]+b[4]+b[8];if(0b[0]&&(c=1);b[8]>b[3*c+c]&&(c=2);var h=(c+1)%3,f=(c+2)%3;d=Math.sqrt(b[3*c+c]-b[3*h+h]-b[3*f+f]+1);a[c]=.5*d;d=.5/d;a[3]=(b[3*f+h]-b[3*h+f])*d;a[h]=(b[3*h+c]+b[3*c+h])*d;a[f]=(b[3*f+c]+b[3*c+f])*d}return a};x.str=function(a){return'quat('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.quat=x)})(b)}(this)}, -{}],24:[function(a,g,m){(function(){var a=this,l=a._,f={},c=Array.prototype,k=Object.prototype,n=c.push,p=c.slice,t=c.concat,h=k.toString,d=k.hasOwnProperty,v=c.forEach,w=c.map,y=c.reduce,x=c.reduceRight,q=c.filter,u=c.every,A=c.some,E=c.indexOf,D=c.lastIndexOf,k=Array.isArray,C=Object.keys,F=Function.prototype.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};'undefined'!=typeof m?('undefined'!=typeof g&&g.exports&&(m=g.exports=z),m._=z):a._=z;z.VERSION= -'1.4.4';var H=z.each=z.forEach=function(a,b,d){if(null!=a)if(v&&a.forEach===v)a.forEach(b,d);else if(a.length===+a.length)for(var c=0,h=a.length;h>c&&b.call(d,a[c],c,a)!==f;c++);else for(c in a)if(z.has(a,c)&&b.call(d,a[c],c,a)===f)break};z.map=z.collect=function(a,b,d){var c=[];return null==a?c:w&&a.map===w?a.map(b,d):(H(a,function(a,h,f){c[c.length]=b.call(d,a,h,f)}),c)};z.reduce=z.foldl=z.inject=function(a,b,d,c){var h=2a.length)return Math.max.apply(Math,a);if(!b&&z.isEmpty(a))return-1/0;var c={computed:-1/0,value:-1/0};return H(a,function(a,h,f){h=b?b.call(d,a,h,f):a;h>=c.computed&&(c={value:a,computed:h})}),c.value};z.min=function(a,b,d){if(!b&&z.isArray(a)&&a[0]=== -+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&z.isEmpty(a))return 1/0;var c={computed:1/0,value:1/0};return H(a,function(a,h,f){h=b?b.call(d,a,h,f):a;hc||void 0===d)return 1;if(c>d||void 0===c)return-1}return a.indexh;){var k=h+f>>>1;d.call(c,a[k])c;c++)d[c]= +b){var d=b[1],c=b[2],h=b[3],g=b[6],k=b[7],e=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=d;a[6]=b[9];a[7]=b[13];a[8]=c;a[9]=g;a[11]=b[14];a[12]=h;a[13]=k;a[14]=e}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];var y=d*e-c* +k,x=d*n-h*k,Z=d*l-g*k,S=c*n-h*e,L=c*l-g*e,U=h*l-g*n,oa=p*w-m*v,pa=p*u-q*v,R=p*b-t*v,Y=m*u-q*w,na=m*b-t*w,la=q*b-t*u,ca=y*la-x*na+Z*Y+S*R-L*pa+U*oa;return ca?(ca=1/ca,a[0]=(e*la-n*na+l*Y)*ca,a[1]=(h*na-c*la-g*Y)*ca,a[2]=(w*U-u*L+b*S)*ca,a[3]=(q*L-m*U-t*S)*ca,a[4]=(n*R-k*la-l*pa)*ca,a[5]=(d*la-h*R+g*pa)*ca,a[6]=(u*Z-v*U-b*x)*ca,a[7]=(p*U-q*Z+t*x)*ca,a[8]=(k*na-e*R+l*oa)*ca,a[9]=(c*R-d*na-g*oa)*ca,a[10]=(v*L-w*Z+b*y)*ca,a[11]=(m*Z-p*L-t*y)*ca,a[12]=(e*pa-k*Y-n*oa)*ca,a[13]=(d*Y-c*pa+h*oa)*ca,a[14]=(w* +x-v*S-u*y)*ca,a[15]=(p*S-m*x+q*y)*ca,a):null},adjoint:function(a,b){var d=b[0],c=b[1],h=b[2],g=b[3],k=b[4],e=b[5],n=b[6],l=b[7],p=b[8],m=b[9],q=b[10],t=b[11],v=b[12],w=b[13],u=b[14];b=b[15];return a[0]=e*(q*b-t*u)-m*(n*b-l*u)+w*(n*t-l*q),a[1]=-(c*(q*b-t*u)-m*(h*b-g*u)+w*(h*t-g*q)),a[2]=c*(n*b-l*u)-e*(h*b-g*u)+w*(h*l-g*n),a[3]=-(c*(n*t-l*q)-e*(h*t-g*q)+m*(h*l-g*n)),a[4]=-(k*(q*b-t*u)-p*(n*b-l*u)+v*(n*t-l*q)),a[5]=d*(q*b-t*u)-p*(h*b-g*u)+v*(h*t-g*q),a[6]=-(d*(n*b-l*u)-k*(h*b-g*u)+v*(h*l-g*n)),a[7]= +d*(n*t-l*q)-k*(h*t-g*q)+p*(h*l-g*n),a[8]=k*(m*b-t*w)-p*(e*b-l*w)+v*(e*t-l*m),a[9]=-(d*(m*b-t*w)-p*(c*b-g*w)+v*(c*t-g*m)),a[10]=d*(e*b-l*w)-k*(c*b-g*w)+v*(c*l-g*e),a[11]=-(d*(e*t-l*m)-k*(c*t-g*m)+p*(c*l-g*e)),a[12]=-(k*(m*u-q*w)-p*(e*u-n*w)+v*(e*q-n*m)),a[13]=d*(m*u-q*w)-p*(c*u-h*w)+v*(c*q-h*m),a[14]=-(d*(e*u-n*w)-k*(c*u-h*w)+v*(c*n-h*e)),a[15]=d*(e*q-n*m)-k*(c*q-h*m)+p*(c*n-h*e),a},determinant:function(a){var b=a[0],d=a[1],c=a[2],h=a[3],g=a[4],k=a[5],e=a[6],n=a[7],l=a[8],p=a[9],m=a[10],q=a[11],t= +a[12],v=a[13],w=a[14];a=a[15];return(b*k-d*g)*(m*a-q*w)-(b*e-c*g)*(p*a-q*v)+(b*n-h*g)*(p*w-m*v)+(d*e-c*k)*(l*a-q*t)-(d*n-h*k)*(l*w-m*t)+(c*n-h*e)*(l*v-p*t)},multiply:function(a,b,d){var c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],w=b[12],u=b[13],y=b[14];b=b[15];var x=d[0],A=d[1],S=d[2],L=d[3];return a[0]=x*c+A*e+S*m+L*w,a[1]=x*h+A*n+S*q+L*u,a[2]=x*g+A*l+S*t+L*y,a[3]=x*k+A*p+S*v+L*b,x=d[4],A=d[5],S=d[6],L=d[7],a[4]=x*c+A*e+S*m+L*w,a[5]=x*h+A*n+S*q+L*u,a[6]= +x*g+A*l+S*t+L*y,a[7]=x*k+A*p+S*v+L*b,x=d[8],A=d[9],S=d[10],L=d[11],a[8]=x*c+A*e+S*m+L*w,a[9]=x*h+A*n+S*q+L*u,a[10]=x*g+A*l+S*t+L*y,a[11]=x*k+A*p+S*v+L*b,x=d[12],A=d[13],S=d[14],L=d[15],a[12]=x*c+A*e+S*m+L*w,a[13]=x*h+A*n+S*q+L*u,a[14]=x*g+A*l+S*t+L*y,a[15]=x*k+A*p+S*v+L*b,a}};y.mul=y.multiply;y.translate=function(a,b,d){var c,h,g,k,e,n,l,p,m,q,t,v,w=d[0],u=d[1];d=d[2];return b===a?(a[12]=b[0]*w+b[4]*u+b[8]*d+b[12],a[13]=b[1]*w+b[5]*u+b[9]*d+b[13],a[14]=b[2]*w+b[6]*u+b[10]*d+b[14],a[15]=b[3]*w+b[7]* +u+b[11]*d+b[15]):(c=b[0],h=b[1],g=b[2],k=b[3],e=b[4],n=b[5],l=b[6],p=b[7],m=b[8],q=b[9],t=b[10],v=b[11],a[0]=c,a[1]=h,a[2]=g,a[3]=k,a[4]=e,a[5]=n,a[6]=l,a[7]=p,a[8]=m,a[9]=q,a[10]=t,a[11]=v,a[12]=c*w+e*u+m*d+b[12],a[13]=h*w+n*u+q*d+b[13],a[14]=g*w+l*u+t*d+b[14],a[15]=k*w+p*u+v*d+b[15]),a};y.scale=function(a,b,d){var c=d[0],h=d[1];d=d[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*h,a[5]=b[5]*h,a[6]=b[6]*h,a[7]=b[7]*h,a[8]=b[8]*d,a[9]=b[9]*d,a[10]=b[10]*d,a[11]=b[11]*d,a[12]=b[12], +a[13]=b[13],a[14]=b[14],a[15]=b[15],a};y.rotate=function(a,d,c,h){var g,k,e,n,l,p,m,q,t,v,w,u,y,x,A,E,S,L,U,oa,pa,R,Y,na,la=h[0],ca=h[1];h=h[2];var Ba=Math.sqrt(la*la+ca*ca+h*h);return Math.abs(Ba)e?(d.cross(a,b,g),1E-6>d.length(a)&&d.cross(a,c,g),d.normalize(a,a),x.setAxisAngle(h,a,Math.PI),h):.999999g&&(g=-g,t=-t,q=-q,v=-v,d=-d),1E-6<1-g?(h=Math.acos(g),k=Math.sin(h),e=Math.sin((1-c)*h)/k,n=Math.sin(c*h)/k):(e=1-c,n=c),a[0]=e*l+n*t,a[1]=e*p+n*q,a[2]=e*m+n*v,a[3]=e*b+n*d,a};x.invert=function(a,b){var d=b[0],c=b[1],h=b[2];b=b[3];var g=d*d+c*c+h*h+b*b,g=g?1/g:0;return a[0]=-d*g,a[1]=-c*g,a[2]=-h*g,a[3]=b*g,a};x.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a};x.length=v.length;x.len=x.length;x.squaredLength=v.squaredLength;x.sqrLen=x.squaredLength;x.normalize= +v.normalize;x.fromMat3=function(a,b){var d;d=b[0]+b[4]+b[8];if(0b[0]&&(c=1);b[8]>b[3*c+c]&&(c=2);var h=(c+1)%3,g=(c+2)%3;d=Math.sqrt(b[3*c+c]-b[3*h+h]-b[3*g+g]+1);a[c]=.5*d;d=.5/d;a[3]=(b[3*g+h]-b[3*h+g])*d;a[h]=(b[3*h+c]+b[3*c+h])*d;a[g]=(b[3*g+c]+b[3*c+g])*d}return a};x.str=function(a){return'quat('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.quat=x)})(b)}(this)}, +{}],24:[function(a,e,m){(function(){var a=this,l=a._,g={},c=Array.prototype,k=Object.prototype,n=c.push,p=c.slice,t=c.concat,h=k.toString,d=k.hasOwnProperty,v=c.forEach,w=c.map,y=c.reduce,x=c.reduceRight,q=c.filter,u=c.every,A=c.some,E=c.indexOf,D=c.lastIndexOf,k=Array.isArray,C=Object.keys,F=Function.prototype.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};'undefined'!=typeof m?('undefined'!=typeof e&&e.exports&&(m=e.exports=z),m._=z):a._=z;z.VERSION= +'1.4.4';var H=z.each=z.forEach=function(a,b,d){if(null!=a)if(v&&a.forEach===v)a.forEach(b,d);else if(a.length===+a.length)for(var c=0,h=a.length;h>c&&b.call(d,a[c],c,a)!==g;c++);else for(c in a)if(z.has(a,c)&&b.call(d,a[c],c,a)===g)break};z.map=z.collect=function(a,b,d){var c=[];return null==a?c:w&&a.map===w?a.map(b,d):(H(a,function(a,h,g){c[c.length]=b.call(d,a,h,g)}),c)};z.reduce=z.foldl=z.inject=function(a,b,d,c){var h=2a.length)return Math.max.apply(Math,a);if(!b&&z.isEmpty(a))return-1/0;var c={computed:-1/0,value:-1/0};return H(a,function(a,h,g){h=b?b.call(d,a,h,g):a;h>=c.computed&&(c={value:a,computed:h})}),c.value};z.min=function(a,b,d){if(!b&&z.isArray(a)&&a[0]=== ++a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&z.isEmpty(a))return 1/0;var c={computed:1/0,value:1/0};return H(a,function(a,h,g){h=b?b.call(d,a,h,g):a;hc||void 0===d)return 1;if(c>d||void 0===c)return-1}return a.indexh;){var k=h+g>>>1;d.call(c,a[k])c;c++)d[c]= z.pluck(a,''+c);return d};z.object=function(a,b){if(null==a)return{};for(var d={},c=0,h=a.length;h>c;c++)b?d[a[c]]=b[c]:d[a[c][0]]=a[c][1];return d};z.indexOf=function(a,b,d){if(null==a)return-1;var c=0,h=a.length;if(d){if('number'!=typeof d)return c=z.sortedIndex(a,b),a[c]===b?c:-1;c=0>d?Math.max(0,h+d):d}if(E&&a.indexOf===E)return a.indexOf(b,d);for(;h>c;c++)if(a[c]===b)return c;return-1};z.lastIndexOf=function(a,b,d){if(null==a)return-1;var c=null!=d;if(D&&a.lastIndexOf===D)return c?a.lastIndexOf(b, -d):a.lastIndexOf(b);for(d=c?d:a.length;d--;)if(a[d]===b)return d;return-1};z.range=function(a,b,d){1>=arguments.length&&(b=a||0,a=0);d=arguments[2]||1;for(var c=Math.max(Math.ceil((b-a)/d),0),h=0,f=Array(c);c>h;)f[h++]=a,a+=d;return f};z.bind=function(a,b){if(a.bind===F&&F)return F.apply(a,p.call(arguments,1));var d=p.call(arguments,2);return function(){return a.apply(b,d.concat(p.call(arguments)))}};z.partial=function(a){var b=p.call(arguments,1);return function(){return a.apply(this,b.concat(p.call(arguments)))}}; +d):a.lastIndexOf(b);for(d=c?d:a.length;d--;)if(a[d]===b)return d;return-1};z.range=function(a,b,d){1>=arguments.length&&(b=a||0,a=0);d=arguments[2]||1;for(var c=Math.max(Math.ceil((b-a)/d),0),h=0,g=Array(c);c>h;)g[h++]=a,a+=d;return g};z.bind=function(a,b){if(a.bind===F&&F)return F.apply(a,p.call(arguments,1));var d=p.call(arguments,2);return function(){return a.apply(b,d.concat(p.call(arguments)))}};z.partial=function(a){var b=p.call(arguments,1);return function(){return a.apply(this,b.concat(p.call(arguments)))}}; z.bindAll=function(a){var b=p.call(arguments,1);return 0===b.length&&(b=z.functions(a)),H(b,function(b){a[b]=z.bind(a[b],a)}),a};z.memoize=function(a,b){var d={};return b||(b=z.identity),function(){var c=b.apply(this,arguments);return z.has(d,c)?d[c]:d[c]=a.apply(this,arguments)}};z.delay=function(a,b){var d=p.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};z.defer=function(a){return z.delay.apply(z,[a,1].concat(p.call(arguments,1)))};z.throttle=function(a,b){var d,c,h, -f,k=0,g=function(){k=new Date;h=null;f=a.apply(d,c)};return function(){var l=new Date,n=b-(l-k);return d=this,c=arguments,0>=n?(clearTimeout(h),h=null,k=l,f=a.apply(d,c)):h||(h=setTimeout(g,n)),f}};z.debounce=function(a,b,d){var c,h;return function(){var f=this,k=arguments,g=d&&!c;return clearTimeout(c),c=setTimeout(function(){c=null;d||(h=a.apply(f,k))},b),g&&(h=a.apply(f,k)),h}};z.once=function(a){var b,d=!1;return function(){return d?b:(d=!0,b=a.apply(this,arguments),a=null,b)}};z.wrap=function(a, +g,k=0,e=function(){k=new Date;h=null;g=a.apply(d,c)};return function(){var n=new Date,l=b-(n-k);return d=this,c=arguments,0>=l?(clearTimeout(h),h=null,k=n,g=a.apply(d,c)):h||(h=setTimeout(e,l)),g}};z.debounce=function(a,b,d){var c,h;return function(){var g=this,k=arguments,e=d&&!c;return clearTimeout(c),c=setTimeout(function(){c=null;d||(h=a.apply(g,k))},b),e&&(h=a.apply(g,k)),h}};z.once=function(a){var b,d=!1;return function(){return d?b:(d=!0,b=a.apply(this,arguments),a=null,b)}};z.wrap=function(a, b){return function(){var d=[a];return n.apply(d,arguments),b.apply(this,d)}};z.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;0<=d;d--)b=[a[d].apply(this,b)];return b[0]}};z.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}};z.keys=C||function(a){if(a!==Object(a))throw new TypeError('Invalid object');var b=[],d;for(d in a)z.has(a,d)&&(b[b.length]=d);return b};z.values=function(a){var b=[],d;for(d in a)z.has(a,d)&&b.push(a[d]); return b};z.pairs=function(a){var b=[],d;for(d in a)z.has(a,d)&&b.push([d,a[d]]);return b};z.invert=function(a){var b={},d;for(d in a)z.has(a,d)&&(b[a[d]]=d);return b};z.functions=z.methods=function(a){var b=[],d;for(d in a)z.isFunction(a[d])&&b.push(d);return b.sort()};z.extend=function(a){return H(p.call(arguments,1),function(b){if(b)for(var d in b)a[d]=b[d]}),a};z.pick=function(a){var b={},d=t.apply(c,p.call(arguments,1));return H(d,function(d){d in a&&(b[d]=a[d])}),b};z.omit=function(a){var b= -{},d=t.apply(c,p.call(arguments,1)),h;for(h in a)z.contains(d,h)||(b[h]=a[h]);return b};z.defaults=function(a){return H(p.call(arguments,1),function(b){if(b)for(var d in b)null==a[d]&&(a[d]=b[d])}),a};z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a};z.tap=function(a,b){return b(a),a};var P=function(a,b,d,c){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped);b instanceof z&&(b=b._wrapped);var f=h.call(a);if(f!=h.call(b))return!1; -switch(f){case '[object String]':return a==String(b);case '[object Number]':return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case '[object Date]':case '[object Boolean]':return+a==+b;case '[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if('object'!=typeof a||'object'!=typeof b)return!1;for(var k=d.length;k--;)if(d[k]==a)return c[k]==b;d.push(a);c.push(b);var k=0,g=!0;if('[object Array]'==f){if(k=a.length,g=k==b.length)for(;k--&&(g=P(a[k], -b[k],d,c)););}else{var f=a.constructor,l=b.constructor;if(f!==l&&!(z.isFunction(f)&&f instanceof f&&z.isFunction(l)&&l instanceof l))return!1;for(var n in a)if(z.has(a,n)&&(k++,!(g=z.has(b,n)&&P(a[n],b[n],d,c))))break;if(g){for(n in b)if(z.has(b,n)&&!k--)break;g=!k}}return d.pop(),c.pop(),g};z.isEqual=function(a,b){return P(a,b,[],[])};z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0};z.isElement=function(a){return!(!a|| +{},d=t.apply(c,p.call(arguments,1)),h;for(h in a)z.contains(d,h)||(b[h]=a[h]);return b};z.defaults=function(a){return H(p.call(arguments,1),function(b){if(b)for(var d in b)null==a[d]&&(a[d]=b[d])}),a};z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a};z.tap=function(a,b){return b(a),a};var P=function(a,b,d,c){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped);b instanceof z&&(b=b._wrapped);var g=h.call(a);if(g!=h.call(b))return!1; +switch(g){case '[object String]':return a==String(b);case '[object Number]':return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case '[object Date]':case '[object Boolean]':return+a==+b;case '[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if('object'!=typeof a||'object'!=typeof b)return!1;for(var k=d.length;k--;)if(d[k]==a)return c[k]==b;d.push(a);c.push(b);var k=0,e=!0;if('[object Array]'==g){if(k=a.length,e=k==b.length)for(;k--&&(e=P(a[k], +b[k],d,c)););}else{var g=a.constructor,n=b.constructor;if(g!==n&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(n)&&n instanceof n))return!1;for(var l in a)if(z.has(a,l)&&(k++,!(e=z.has(b,l)&&P(a[l],b[l],d,c))))break;if(e){for(l in b)if(z.has(b,l)&&!k--)break;e=!k}}return d.pop(),c.pop(),e};z.isEqual=function(a,b){return P(a,b,[],[])};z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0};z.isElement=function(a){return!(!a|| 1!==a.nodeType)};z.isArray=k||function(a){return'[object Array]'==h.call(a)};z.isObject=function(a){return a===Object(a)};H('Arguments Function String Number Date RegExp'.split(' '),function(a){z['is'+a]=function(b){return h.call(b)=='[object '+a+']'}});z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,'callee'))});'function'!=typeof/./&&(z.isFunction=function(a){return'function'==typeof a});z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))};z.isNaN=function(a){return z.isNumber(a)&& a!=+a};z.isBoolean=function(a){return!0===a||!1===a||'[object Boolean]'==h.call(a)};z.isNull=function(a){return null===a};z.isUndefined=function(a){return void 0===a};z.has=function(a,b){return d.call(a,b)};z.noConflict=function(){return a._=l,this};z.identity=function(a){return a};z.times=function(a,b,d){for(var c=Array(a),h=0;a>h;h++)c[h]=b.call(d,h);return c};z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var N={escape:{'&':'&','<':'<','>':'>','"':'"', "'":''','/':'/'}};N.unescape=z.invert(N.escape);var V={escape:new RegExp('['+z.keys(N.escape).join('')+']','g'),unescape:new RegExp('('+z.keys(N.unescape).join('|')+')','g')};z.each(['escape','unescape'],function(a){z[a]=function(b){return null==b?'':(''+b).replace(V[a],function(b){return N[a][b]})}});z.result=function(a,b){if(null==a)return null;b=a[b];return z.isFunction(b)?b.call(a):b};z.mixin=function(a){H(z.functions(a),function(b){var d=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped]; return n.apply(a,arguments),S.call(this,d.apply(z,a))}})};var X=0;z.uniqueId=function(a){var b=++X+'';return a?a+b:b};z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,fa={"'":"'",'\\':'\\','\r':'r','\n':'n','\t':'t','\u2028':'u2028','\u2029':'u2029'},Z=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,d){var c;d=z.defaults({},d,z.templateSettings);var h=new RegExp([(d.escape||T).source,(d.interpolate||T).source,(d.evaluate|| -T).source].join('|')+'|$','g'),f=0,k="__p+='";a.replace(h,function(b,d,c,h,g){return k+=a.slice(f,g).replace(Z,function(a){return'\\'+fa[a]}),d&&(k+="'+\n((__t=("+d+"))==null?'':_.escape(__t))+\n'"),c&&(k+="'+\n((__t=("+c+"))==null?'':__t)+\n'"),h&&(k+="';\n"+h+"\n__p+='"),f=g+b.length,b});k+="';\n";d.variable||(k='with(obj||{}){\n'+k+'}\n');k="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+k+'return __p;\n';try{c=new Function(d.variable||'obj','_',k)}catch(la){throw la.source= +T).source].join('|')+'|$','g'),g=0,k="__p+='";a.replace(h,function(b,d,c,h,e){return k+=a.slice(g,e).replace(Z,function(a){return'\\'+fa[a]}),d&&(k+="'+\n((__t=("+d+"))==null?'':_.escape(__t))+\n'"),c&&(k+="'+\n((__t=("+c+"))==null?'':__t)+\n'"),h&&(k+="';\n"+h+"\n__p+='"),g=e+b.length,b});k+="';\n";d.variable||(k='with(obj||{}){\n'+k+'}\n');k="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+k+'return __p;\n';try{c=new Function(d.variable||'obj','_',k)}catch(la){throw la.source= k,la;}if(b)return c(b,z);b=function(a){return c.call(this,a,z)};return b.source='function('+(d.variable||'obj')+'){\n'+k+'}',b};z.chain=function(a){return z(a).chain()};var S=function(a){return this._chain?z(a).chain():a};z.mixin(z);H('pop push reverse shift sort splice unshift'.split(' '),function(a){var b=c[a];z.prototype[a]=function(){var d=this._wrapped;return b.apply(d,arguments),'shift'!=a&&'splice'!=a||0!==d.length||delete d[0],S.call(this,d)}});H(['concat','join','slice'],function(a){var b= c[a];z.prototype[a]=function(){return S.call(this,b.apply(this._wrapped,arguments))}});z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],25:[function(a){'undefined'!=typeof window&&'function'!=typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,1E3/60)}); Leap=a('../lib/index')},{'../lib/index':11}]},{},[25]); -var Stats=function(){function a(a){b.appendChild(a.dom);return a}function g(a){for(var c=0;cf+1E3&&(k.update(1E3*c/(a-f),100),f=a,c=0,p)){var b=performance.memory;p.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return a},update:function(){l=this.end()},domElement:b,setMode:g}}; -Stats.Panel=function(a,g,m){var b=Infinity,l=0,f=Math.round,c=f(window.devicePixelRatio||1),k=80*c,n=48*c,p=3*c,t=2*c,h=3*c,d=15*c,v=74*c,w=30*c,y=document.createElement('canvas');y.width=k;y.height=n;y.style.cssText='width:80px;height:48px';var x=y.getContext('2d');x.font='bold '+9*c+'px Helvetica,Arial,sans-serif';x.textBaseline='top';x.fillStyle=m;x.fillRect(0,0,k,n);x.fillStyle=g;x.fillText(a,p,t);x.fillRect(h,d,v,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h,d,v,w);return{dom:y,update:function(n, -u){b=Math.min(b,n);l=Math.max(l,n);x.fillStyle=m;x.globalAlpha=1;x.fillRect(0,0,k,d);x.fillStyle=g;x.fillText(f(n)+' '+a+' ('+f(b)+'-'+f(l)+')',p,t);x.drawImage(y,h+c,d,v-c,w,h,d,v-c,w);x.fillRect(h+v-c,d,c,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h+v-c,d,c,f((1-n/u)*w))}}};'object'===typeof module&&(module.exports=Stats);var SPE={distributions:{BOX:1,SPHERE:2,DISC:3},valueOverLifetimeLength:4}; -'function'==typeof define&&define.amd?define('spe',SPE):'undefined'!=typeof exports&&'undefined'!=typeof module&&(module.exports=SPE);SPE.TypedArrayHelper=function(a,g,m,b){this.componentSize=m||1;this.size=g||1;this.TypedArrayConstructor=a||Float32Array;this.array=new a(g*this.componentSize);this.indexOffset=b||0};SPE.TypedArrayHelper.constructor=SPE.TypedArrayHelper; -SPE.TypedArrayHelper.prototype.setSize=function(a,g){var m=this.array.length;return g||(a*=this.componentSize),m>a?this.shrink(a):a>m?this.grow(a):void console.info('TypedArray is already of size:',a+'.','Will not resize.')};SPE.TypedArrayHelper.prototype.shrink=function(a){return this.array=this.array.subarray(0,a),this.size=a,this};SPE.TypedArrayHelper.prototype.grow=function(a){var g=this.array,m=new this.TypedArrayConstructor(a);return m.set(g),this.array=m,this.size=a,this}; -SPE.TypedArrayHelper.prototype.splice=function(a,g){a*=this.componentSize;g*=this.componentSize;for(var m=[],b=this.array,l=b.length,f=0;l>f;++f)(a>f||f>=g)&&m.push(b[f]);return this.setFromArray(0,m),this};SPE.TypedArrayHelper.prototype.setFromArray=function(a,g){var m=a+g.length;return m>this.array.length?this.grow(m):mg+1E3&&(k.update(1E3*c/(a-g),100),g=a,c=0,p)){var b=performance.memory;p.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return a},update:function(){l=this.end()},domElement:b,setMode:e}}; +Stats.Panel=function(a,e,m){var b=Infinity,l=0,g=Math.round,c=g(window.devicePixelRatio||1),k=80*c,n=48*c,p=3*c,t=2*c,h=3*c,d=15*c,v=74*c,w=30*c,y=document.createElement('canvas');y.width=k;y.height=n;y.style.cssText='width:80px;height:48px';var x=y.getContext('2d');x.font='bold '+9*c+'px Helvetica,Arial,sans-serif';x.textBaseline='top';x.fillStyle=m;x.fillRect(0,0,k,n);x.fillStyle=e;x.fillText(a,p,t);x.fillRect(h,d,v,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h,d,v,w);return{dom:y,update:function(n, +u){b=Math.min(b,n);l=Math.max(l,n);x.fillStyle=m;x.globalAlpha=1;x.fillRect(0,0,k,d);x.fillStyle=e;x.fillText(g(n)+' '+a+' ('+g(b)+'-'+g(l)+')',p,t);x.drawImage(y,h+c,d,v-c,w,h,d,v-c,w);x.fillRect(h+v-c,d,c,w);x.fillStyle=m;x.globalAlpha=.9;x.fillRect(h+v-c,d,c,g((1-n/u)*w))}}};'object'===typeof module&&(module.exports=Stats);var SPE={distributions:{BOX:1,SPHERE:2,DISC:3},valueOverLifetimeLength:4}; +'function'==typeof define&&define.amd?define('spe',SPE):'undefined'!=typeof exports&&'undefined'!=typeof module&&(module.exports=SPE);SPE.TypedArrayHelper=function(a,e,m,b){this.componentSize=m||1;this.size=e||1;this.TypedArrayConstructor=a||Float32Array;this.array=new a(e*this.componentSize);this.indexOffset=b||0};SPE.TypedArrayHelper.constructor=SPE.TypedArrayHelper; +SPE.TypedArrayHelper.prototype.setSize=function(a,e){var m=this.array.length;return e||(a*=this.componentSize),m>a?this.shrink(a):a>m?this.grow(a):void console.info('TypedArray is already of size:',a+'.','Will not resize.')};SPE.TypedArrayHelper.prototype.shrink=function(a){return this.array=this.array.subarray(0,a),this.size=a,this};SPE.TypedArrayHelper.prototype.grow=function(a){var e=this.array,m=new this.TypedArrayConstructor(a);return m.set(e),this.array=m,this.size=a,this}; +SPE.TypedArrayHelper.prototype.splice=function(a,e){a*=this.componentSize;e*=this.componentSize;for(var m=[],b=this.array,l=b.length,g=0;l>g;++g)(a>g||g>=e)&&m.push(b[g]);return this.setFromArray(0,m),this};SPE.TypedArrayHelper.prototype.setFromArray=function(a,e){var m=a+e.length;return m>this.array.length?this.grow(m):mf;++f){var c=f*l,k=Math.floor(c);b[f]=this.lerpTypeAgnostic(a[k],a[Math.ceil(c)],c-k)}return b.push('function'==typeof a[m-1].clone?a[m-1].clone():a[m-1]),b},clamp:function(a,g,m){return Math.max(g,Math.min(a,m))},zeroToEpsilon:function(a,g){var m=a;return m=g?1E-4*Math.random():1E-5,0>a&&-1E-5a?-(Math.abs(a)-m):a+g-m)},arrayValuesAreEqual:function(a){for(var g=0;gk;++k){var n=l[k];a.copy(b[k]);a.r+=Math.random()*n.x-.5*n.x;a.g+=Math.random()*n.y-.5*n.y;a.b+=Math.random()*n.z-.5*n.z;a.r=this.clamp(a.r,0,1);a.g=this.clamp(a.g,0,1);a.b=this.clamp(a.b,0,1);c.push(a.getHex())}g.typedArray.setVec4Components(m,c[0],c[1],c[2],c[3])}}(),randomVector3OnSphere:function(a,g,m,b,l,f,c,k){k=2*Math.random()-1;var n=6.2832*Math.random(),p=Math.sqrt(1-k*k);b=this.randomFloat(b,l);c&&(b=Math.round(b/c)*c);c=p*Math.cos(n)* -b;n=p*Math.sin(n)*b;c*=f.x;n*=f.y;f=k*b*f.z;c+=m.x;n+=m.y;f+=m.z;a.typedArray.setVec3Components(g,c,n,f)},seededRandom:function(a){a=1E4*Math.sin(a);return a-(0|a)},randomVector3OnDisc:function(a,g,m,b,l,f,c){var k=6.2832*Math.random();b=Math.abs(this.randomFloat(b,l));c&&(b=Math.round(b/c)*c);c=Math.cos(k)*b;k=Math.sin(k)*b;c*=f.x;k*=f.y;c+=m.x;k+=m.y;m=0+m.z;a.typedArray.setVec3Components(g,c,k,m)},randomDirectionVector3OnSphere:function(){var a=new THREE.Vector3;return function(g,m,b,l,f,c,k,n){a.copy(c); -a.x-=b;a.y-=l;a.z-=f;a.normalize().multiplyScalar(-this.randomFloat(k,n));g.typedArray.setVec3Components(m,a.x,a.y,a.z)}}(),randomDirectionVector3OnDisc:function(){var a=new THREE.Vector3;return function(g,m,b,l,f,c,k,n){a.copy(c);a.x-=b;a.y-=l;a.z-=f;a.normalize().multiplyScalar(-this.randomFloat(k,n));g.typedArray.setVec3Components(m,a.x,a.y,0)}}(),getPackedRotationAxis:function(){var a=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Color,b=new THREE.Vector3(1,1,1);return function(l,f){return a.copy(l).normalize(), -g.copy(f).normalize(),a.x+=.5*-f.x+Math.random()*f.x,a.y+=.5*-f.y+Math.random()*f.y,a.z+=.5*-f.z+Math.random()*f.z,a.normalize().add(b).multiplyScalar(.5),m.setRGB(a.x,a.y,a.z),m.getHex()}}()}; -SPE.Group=function(a){var g=SPE.utils,m=g.types;a=g.ensureTypedArg(a,m.OBJECT,{});a.texture=g.ensureTypedArg(a.texture,m.OBJECT,{});this.uuid=THREE.Math.generateUUID();this.fixedTimeStep=g.ensureTypedArg(a.fixedTimeStep,m.NUMBER,.016);this.texture=g.ensureInstanceOf(a.texture.value,THREE.Texture,null);this.textureFrames=g.ensureInstanceOf(a.texture.frames,THREE.Vector2,new THREE.Vector2(1,1));this.textureFrameCount=g.ensureTypedArg(a.texture.frameCount,m.NUMBER,this.textureFrames.x*this.textureFrames.y); -this.textureLoop=g.ensureTypedArg(a.texture.loop,m.NUMBER,1);this.textureFrames.max(new THREE.Vector2(1,1));this.hasPerspective=g.ensureTypedArg(a.hasPerspective,m.BOOLEAN,!0);this.colorize=g.ensureTypedArg(a.colorize,m.BOOLEAN,!0);this.maxParticleCount=g.ensureTypedArg(a.maxParticleCount,m.NUMBER,null);this.blending=g.ensureTypedArg(a.blending,m.NUMBER,THREE.AdditiveBlending);this.transparent=g.ensureTypedArg(a.transparent,m.BOOLEAN,!0);this.alphaTest=parseFloat(g.ensureTypedArg(a.alphaTest,m.NUMBER, -0));this.depthWrite=g.ensureTypedArg(a.depthWrite,m.BOOLEAN,!1);this.depthTest=g.ensureTypedArg(a.depthTest,m.BOOLEAN,!0);this.fog=g.ensureTypedArg(a.fog,m.BOOLEAN,!0);this.scale=g.ensureTypedArg(a.scale,m.NUMBER,300);this.emitters=[];this.emitterIDs=[];this._pool=[];this._poolCreationSettings=null;this._createNewWhenPoolEmpty=0;this._attributesNeedDynamicReset=this._attributesNeedRefresh=!1;this.particleCount=0;this.uniforms={texture:{type:'t',value:this.texture},textureAnimation:{type:'v4',value:new THREE.Vector4(this.textureFrames.x, +SPE.utils={types:{BOOLEAN:'boolean',STRING:'string',NUMBER:'number',OBJECT:'object'},ensureTypedArg:function(a,e,m){return typeof a===e?a:m},ensureArrayTypedArg:function(a,e,m){if(Array.isArray(a)){for(var b=a.length-1;0<=b;--b)if(typeof a[b]!==e)return m;return a}return this.ensureTypedArg(a,e,m)},ensureInstanceOf:function(a,e,m){return void 0!==e&&a instanceof e?a:m},ensureArrayInstanceOf:function(a,e,m){if(Array.isArray(a)){for(var b=a.length-1;0<=b;--b)if(void 0!==e&&0==a[b]instanceof e)return m; +return a}return this.ensureInstanceOf(a,e,m)},ensureValueOverLifetimeCompliance:function(a,e,m){e=e||3;m=m||3;!1===Array.isArray(a._value)&&(a._value=[a._value]);!1===Array.isArray(a._spread)&&(a._spread=[a._spread]);var b=this.clamp(a._value.length,e,m);e=this.clamp(a._spread.length,e,m);b=Math.max(b,e);a._value.length!==b&&(a._value=this.interpolateArray(a._value,b));a._spread.length!==b&&(a._spread=this.interpolateArray(a._spread,b))},interpolateArray:function(a,e){for(var m=a.length,b=['function'== +typeof a[0].clone?a[0].clone():a[0]],l=(m-1)/(e-1),g=1;e-1>g;++g){var c=g*l,k=Math.floor(c);b[g]=this.lerpTypeAgnostic(a[k],a[Math.ceil(c)],c-k)}return b.push('function'==typeof a[m-1].clone?a[m-1].clone():a[m-1]),b},clamp:function(a,e,m){return Math.max(e,Math.min(a,m))},zeroToEpsilon:function(a,e){var m=a;return m=e?1E-4*Math.random():1E-5,0>a&&-1E-5a?-(Math.abs(a)-m):a+e-m)},arrayValuesAreEqual:function(a){for(var e=0;ek;++k){var n=l[k];a.copy(b[k]);a.r+=Math.random()*n.x-.5*n.x;a.g+=Math.random()*n.y-.5*n.y;a.b+=Math.random()*n.z-.5*n.z;a.r=this.clamp(a.r,0,1);a.g=this.clamp(a.g,0,1);a.b=this.clamp(a.b,0,1);c.push(a.getHex())}e.typedArray.setVec4Components(m,c[0],c[1],c[2],c[3])}}(),randomVector3OnSphere:function(a,e,m,b,l,g,c,k){k=2*Math.random()-1;var n=6.2832*Math.random(),p=Math.sqrt(1-k*k);b=this.randomFloat(b,l);c&&(b=Math.round(b/c)*c);c=p*Math.cos(n)* +b;n=p*Math.sin(n)*b;c*=g.x;n*=g.y;g=k*b*g.z;c+=m.x;n+=m.y;g+=m.z;a.typedArray.setVec3Components(e,c,n,g)},seededRandom:function(a){a=1E4*Math.sin(a);return a-(0|a)},randomVector3OnDisc:function(a,e,m,b,l,g,c){var k=6.2832*Math.random();b=Math.abs(this.randomFloat(b,l));c&&(b=Math.round(b/c)*c);c=Math.cos(k)*b;k=Math.sin(k)*b;c*=g.x;k*=g.y;c+=m.x;k+=m.y;m=0+m.z;a.typedArray.setVec3Components(e,c,k,m)},randomDirectionVector3OnSphere:function(){var a=new THREE.Vector3;return function(e,m,b,l,g,c,k,n){a.copy(c); +a.x-=b;a.y-=l;a.z-=g;a.normalize().multiplyScalar(-this.randomFloat(k,n));e.typedArray.setVec3Components(m,a.x,a.y,a.z)}}(),randomDirectionVector3OnDisc:function(){var a=new THREE.Vector3;return function(e,m,b,l,g,c,k,n){a.copy(c);a.x-=b;a.y-=l;a.z-=g;a.normalize().multiplyScalar(-this.randomFloat(k,n));e.typedArray.setVec3Components(m,a.x,a.y,0)}}(),getPackedRotationAxis:function(){var a=new THREE.Vector3,e=new THREE.Vector3,m=new THREE.Color,b=new THREE.Vector3(1,1,1);return function(l,g){return a.copy(l).normalize(), +e.copy(g).normalize(),a.x+=.5*-g.x+Math.random()*g.x,a.y+=.5*-g.y+Math.random()*g.y,a.z+=.5*-g.z+Math.random()*g.z,a.normalize().add(b).multiplyScalar(.5),m.setRGB(a.x,a.y,a.z),m.getHex()}}()}; +SPE.Group=function(a){var e=SPE.utils,m=e.types;a=e.ensureTypedArg(a,m.OBJECT,{});a.texture=e.ensureTypedArg(a.texture,m.OBJECT,{});this.uuid=THREE.Math.generateUUID();this.fixedTimeStep=e.ensureTypedArg(a.fixedTimeStep,m.NUMBER,.016);this.texture=e.ensureInstanceOf(a.texture.value,THREE.Texture,null);this.textureFrames=e.ensureInstanceOf(a.texture.frames,THREE.Vector2,new THREE.Vector2(1,1));this.textureFrameCount=e.ensureTypedArg(a.texture.frameCount,m.NUMBER,this.textureFrames.x*this.textureFrames.y); +this.textureLoop=e.ensureTypedArg(a.texture.loop,m.NUMBER,1);this.textureFrames.max(new THREE.Vector2(1,1));this.hasPerspective=e.ensureTypedArg(a.hasPerspective,m.BOOLEAN,!0);this.colorize=e.ensureTypedArg(a.colorize,m.BOOLEAN,!0);this.maxParticleCount=e.ensureTypedArg(a.maxParticleCount,m.NUMBER,null);this.blending=e.ensureTypedArg(a.blending,m.NUMBER,THREE.AdditiveBlending);this.transparent=e.ensureTypedArg(a.transparent,m.BOOLEAN,!0);this.alphaTest=parseFloat(e.ensureTypedArg(a.alphaTest,m.NUMBER, +0));this.depthWrite=e.ensureTypedArg(a.depthWrite,m.BOOLEAN,!1);this.depthTest=e.ensureTypedArg(a.depthTest,m.BOOLEAN,!0);this.fog=e.ensureTypedArg(a.fog,m.BOOLEAN,!0);this.scale=e.ensureTypedArg(a.scale,m.NUMBER,300);this.emitters=[];this.emitterIDs=[];this._pool=[];this._poolCreationSettings=null;this._createNewWhenPoolEmpty=0;this._attributesNeedDynamicReset=this._attributesNeedRefresh=!1;this.particleCount=0;this.uniforms={texture:{type:'t',value:this.texture},textureAnimation:{type:'v4',value:new THREE.Vector4(this.textureFrames.x, this.textureFrames.y,this.textureFrameCount,Math.max(Math.abs(this.textureLoop),1))},fogColor:{type:'c',value:null},fogNear:{type:'f',value:10},fogFar:{type:'f',value:200},fogDensity:{type:'f',value:.5},deltaTime:{type:'f',value:0},runTime:{type:'f',value:0},scale:{type:'f',value:this.scale}};this.defines={HAS_PERSPECTIVE:this.hasPerspective,COLORIZE:this.colorize,VALUE_OVER_LIFETIME_LENGTH:SPE.valueOverLifetimeLength,SHOULD_ROTATE_TEXTURE:!1,SHOULD_ROTATE_PARTICLES:!1,SHOULD_WIGGLE_PARTICLES:!1, SHOULD_CALCULATE_SPRITE:1this.maxParticleCount&&console.warn('SPE.Group: maxParticleCount exceeded. Requesting',this.particleCount,'particles, can support only',this.maxParticleCount);a._calculatePPSValue(a.maxAge._value+a.maxAge._spread);a._setBufferUpdateRanges(this.attributeKeys);a._setAttributeOffset(m);a.group=this;a.attributes=this.attributes;for(var l in g)g.hasOwnProperty(l)&&g[l]._createBufferAttribute(null!==this.maxParticleCount?this.maxParticleCount:this.particleCount); -for(g=m;b>g;++g)a._assignPositionValue(g),a._assignForceValue(g,'velocity'),a._assignForceValue(g,'acceleration'),a._assignAbsLifetimeValue(g,'opacity'),a._assignAbsLifetimeValue(g,'size'),a._assignAngleValue(g),a._assignRotationValue(g),a._assignParamsValue(g),a._assignColorValue(g);return this._applyAttributesToGeometry(),this.emitters.push(a),this.emitterIDs.push(a.uuid),this._updateDefines(a),this.material.needsUpdate=!0,this.geometry.needsUpdate=!0,this._attributesNeedRefresh=!0,this}; -SPE.Group.prototype.removeEmitter=function(a){var g=this.emitterIDs.indexOf(a.uuid);if(0==a instanceof SPE.Emitter)return void console.error('`emitter` argument must be instance of SPE.Emitter. Was provided with:',a);if(-1===g)return void console.error('Emitter does not exist in this group. Will not remove.');for(var m=a.attributeOffset,b=m+a.particleCount,l=this.attributes.params.typedArray,f=m;b>f;++f)l.array[4*f]=0,l.array[4*f+1]=0;this.emitters.splice(g,1);this.emitterIDs.splice(g,1);for(var c in this.attributes)this.attributes.hasOwnProperty(c)&& -this.attributes[c].splice(m,b);this.particleCount-=a.particleCount;a._onRemove();this._attributesNeedRefresh=!0};SPE.Group.prototype.getFromPool=function(){var a=this._pool,g=this._createNewWhenPoolEmpty;return a.length?a.pop():g?(a=new SPE.Emitter(this._poolCreationSettings),this.addEmitter(a),a):null};SPE.Group.prototype.releaseIntoPool=function(a){return 0==a instanceof SPE.Emitter?void console.error('Argument is not instanceof SPE.Emitter:',a):(a.reset(),this._pool.unshift(a),this)}; -SPE.Group.prototype.getPool=function(){return this._pool};SPE.Group.prototype.addPool=function(a,g,m){this._poolCreationSettings=g;this._createNewWhenPoolEmpty=!!m;for(var b=0;a>b;++b)m=Array.isArray(g)?new SPE.Emitter(g[b]):new SPE.Emitter(g),this.addEmitter(m),this.releaseIntoPool(m);return this}; -SPE.Group.prototype._triggerSingleEmitter=function(a){var g=this.getFromPool(),m=this;return null===g?void console.log('SPE.Group pool ran out.'):(a instanceof THREE.Vector3&&(g.position.value.copy(a),g.position.value=g.position.value),g.enable(),setTimeout(function(){g.disable();m.releaseIntoPool(g)},1E3*Math.max(g.duration,g.maxAge.value+g.maxAge.spread)),this)}; -SPE.Group.prototype.triggerPoolEmitter=function(a,g){if('number'==typeof a&&1m;++m)this._triggerSingleEmitter(g);else this._triggerSingleEmitter(g);return this};SPE.Group.prototype._updateUniforms=function(a){this.uniforms.runTime.value+=a;this.uniforms.deltaTime.value=a};SPE.Group.prototype._resetBufferRanges=function(){var a=this.attributeKeys,g=this.attributeCount-1,m=this.attributes;for(g;0<=g;--g)m[a[g]].resetUpdateRange()}; -SPE.Group.prototype._updateBuffers=function(a){var g,m=this.attributeKeys,b=this.attributeCount-1,l=this.attributes,f=a.bufferUpdateRanges;for(b;0<=b;--b)g=m[b],a=f[g],g=l[g],g.setUpdateRange(a.min,a.max),g.flagUpdate()}; -SPE.Group.prototype.tick=function(a){var g=this.emitters,m=g.length,b=a||this.fixedTimeStep,l=this.attributeKeys,f=this.attributes;if(this._updateUniforms(b),this._resetBufferRanges(),0!==m||!1!==this._attributesNeedRefresh||!1!==this._attributesNeedDynamicReset){var c;for(a=0;m>a;++a)c=g[a],c.tick(b),this._updateBuffers(c);if(!0===this._attributesNeedDynamicReset){for(a=this.attributeCount-1;0<=a;--a)f[l[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(!0===this._attributesNeedRefresh){for(a= -this.attributeCount-1;0<=a;--a)f[l[a]].forceUpdateAll();this._attributesNeedRefresh=!1;this._attributesNeedDynamicReset=!0}}};SPE.Group.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this}; -SPE.Emitter=function(a){var g=SPE.utils,m=g.types,b=SPE.valueOverLifetimeLength;a=g.ensureTypedArg(a,m.OBJECT,{});a.position=g.ensureTypedArg(a.position,m.OBJECT,{});a.velocity=g.ensureTypedArg(a.velocity,m.OBJECT,{});a.acceleration=g.ensureTypedArg(a.acceleration,m.OBJECT,{});a.radius=g.ensureTypedArg(a.radius,m.OBJECT,{});a.drag=g.ensureTypedArg(a.drag,m.OBJECT,{});a.rotation=g.ensureTypedArg(a.rotation,m.OBJECT,{});a.color=g.ensureTypedArg(a.color,m.OBJECT,{});a.opacity=g.ensureTypedArg(a.opacity, -m.OBJECT,{});a.size=g.ensureTypedArg(a.size,m.OBJECT,{});a.angle=g.ensureTypedArg(a.angle,m.OBJECT,{});a.wiggle=g.ensureTypedArg(a.wiggle,m.OBJECT,{});a.maxAge=g.ensureTypedArg(a.maxAge,m.OBJECT,{});a.onParticleSpawn&&console.warn('onParticleSpawn has been removed. Please set properties directly to alter values at runtime.');this.uuid=THREE.Math.generateUUID();this.type=g.ensureTypedArg(a.type,m.NUMBER,SPE.distributions.BOX);this.position={_value:g.ensureInstanceOf(a.position.value,THREE.Vector3, -new THREE.Vector3),_spread:g.ensureInstanceOf(a.position.spread,THREE.Vector3,new THREE.Vector3),_spreadClamp:g.ensureInstanceOf(a.position.spreadClamp,THREE.Vector3,new THREE.Vector3),_distribution:g.ensureTypedArg(a.position.distribution,m.NUMBER,this.type),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1),_radius:g.ensureTypedArg(a.position.radius,m.NUMBER,10),_radiusScale:g.ensureInstanceOf(a.position.radiusScale,THREE.Vector3,new THREE.Vector3(1,1,1)),_distributionClamp:g.ensureTypedArg(a.position.distributionClamp, -m.NUMBER,0)};this.velocity={_value:g.ensureInstanceOf(a.velocity.value,THREE.Vector3,new THREE.Vector3),_spread:g.ensureInstanceOf(a.velocity.spread,THREE.Vector3,new THREE.Vector3),_distribution:g.ensureTypedArg(a.velocity.distribution,m.NUMBER,this.type),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.acceleration={_value:g.ensureInstanceOf(a.acceleration.value,THREE.Vector3,new THREE.Vector3),_spread:g.ensureInstanceOf(a.acceleration.spread,THREE.Vector3,new THREE.Vector3), -_distribution:g.ensureTypedArg(a.acceleration.distribution,m.NUMBER,this.type),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.drag={_value:g.ensureTypedArg(a.drag.value,m.NUMBER,0),_spread:g.ensureTypedArg(a.drag.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.wiggle={_value:g.ensureTypedArg(a.wiggle.value,m.NUMBER,0),_spread:g.ensureTypedArg(a.wiggle.spread,m.NUMBER,0)};this.rotation={_axis:g.ensureInstanceOf(a.rotation.axis,THREE.Vector3, -new THREE.Vector3(0,1,0)),_axisSpread:g.ensureInstanceOf(a.rotation.axisSpread,THREE.Vector3,new THREE.Vector3),_angle:g.ensureTypedArg(a.rotation.angle,m.NUMBER,0),_angleSpread:g.ensureTypedArg(a.rotation.angleSpread,m.NUMBER,0),_static:g.ensureTypedArg(a.rotation['static'],m.BOOLEAN,!1),_center:g.ensureInstanceOf(a.rotation.center,THREE.Vector3,this.position._value.clone()),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.maxAge={_value:g.ensureTypedArg(a.maxAge.value,m.NUMBER, -2),_spread:g.ensureTypedArg(a.maxAge.spread,m.NUMBER,0)};this.color={_value:g.ensureArrayInstanceOf(a.color.value,THREE.Color,new THREE.Color),_spread:g.ensureArrayInstanceOf(a.color.spread,THREE.Vector3,new THREE.Vector3),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.opacity={_value:g.ensureArrayTypedArg(a.opacity.value,m.NUMBER,1),_spread:g.ensureArrayTypedArg(a.opacity.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.size={_value:g.ensureArrayTypedArg(a.size.value, -m.NUMBER,1),_spread:g.ensureArrayTypedArg(a.size.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.angle={_value:g.ensureArrayTypedArg(a.angle.value,m.NUMBER,0),_spread:g.ensureArrayTypedArg(a.angle.spread,m.NUMBER,0),_randomise:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.particleCount=g.ensureTypedArg(a.particleCount,m.NUMBER,100);this.duration=g.ensureTypedArg(a.duration,m.NUMBER,null);this.isStatic=g.ensureTypedArg(a.isStatic,m.BOOLEAN,!1);this.activeMultiplier= -g.ensureTypedArg(a.activeMultiplier,m.NUMBER,1);this.direction=g.ensureTypedArg(a.direction,m.NUMBER,1);this.alive=g.ensureTypedArg(a.alive,m.BOOLEAN,!0);this.activeParticleCount=this.age=this.attributeEnd=this.attributeOffset=this.activationIndex=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.resetFlags={position:g.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)||g.ensureTypedArg(a.radius.randomise,m.BOOLEAN,!1),velocity:g.ensureTypedArg(a.velocity.randomise,m.BOOLEAN, -!1),acceleration:g.ensureTypedArg(a.acceleration.randomise,m.BOOLEAN,!1)||g.ensureTypedArg(a.drag.randomise,m.BOOLEAN,!1),rotation:g.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),rotationCenter:g.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),size:g.ensureTypedArg(a.size.randomise,m.BOOLEAN,!1),color:g.ensureTypedArg(a.color.randomise,m.BOOLEAN,!1),opacity:g.ensureTypedArg(a.opacity.randomise,m.BOOLEAN,!1),angle:g.ensureTypedArg(a.angle.randomise,m.BOOLEAN,!1)};this.updateFlags={};this.updateCounts= -{};this.updateMap={maxAge:'params',position:'position',velocity:'velocity',acceleration:'acceleration',drag:'acceleration',wiggle:'params',rotation:'rotation',size:'size',color:'color',opacity:'opacity',angle:'angle'};for(var l in this.updateMap)this.updateMap.hasOwnProperty(l)&&(this.updateCounts[this.updateMap[l]]=0,this.updateFlags[this.updateMap[l]]=!1,this._createGetterSetters(this[l],l));this.bufferUpdateRanges={};this.attributeKeys=null;this.attributeCount=0;g.ensureValueOverLifetimeCompliance(this.color, -b,b);g.ensureValueOverLifetimeCompliance(this.opacity,b,b);g.ensureValueOverLifetimeCompliance(this.size,b,b);g.ensureValueOverLifetimeCompliance(this.angle,b,b)};SPE.Emitter.constructor=SPE.Emitter; -SPE.Emitter.prototype._createGetterSetters=function(a,g){var m=this,b;for(b in a)if(a.hasOwnProperty(b)){var l=b.replace('_','');Object.defineProperty(a,l,{get:function(a){return function(){return this[a]}}(b),set:function(a){return function(b){var c=m.updateMap[g],f=this[a],l=SPE.valueOverLifetimeLength;'_rotationCenter'===a?(m.updateFlags.rotationCenter=!0,m.updateCounts.rotationCenter=0):'_randomise'===a?m.resetFlags[c]=b:(m.updateFlags[c]=!0,m.updateCounts[c]=0);m.group._updateDefines();this[a]= -b;Array.isArray(f)&&SPE.utils.ensureValueOverLifetimeCompliance(m[g],l,l)}}(b)})}};SPE.Emitter.prototype._setBufferUpdateRanges=function(a){this.attributeKeys=a;this.attributeCount=a.length;for(var g=this.attributeCount-1;0<=g;--g)this.bufferUpdateRanges[a[g]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}};SPE.Emitter.prototype._calculatePPSValue=function(a){var g=this.particleCount;this.duration?this.particlesPerSecond=g/(athis.maxParticleCount&&console.warn('SPE.Group: maxParticleCount exceeded. Requesting',this.particleCount,'particles, can support only',this.maxParticleCount);a._calculatePPSValue(a.maxAge._value+a.maxAge._spread);a._setBufferUpdateRanges(this.attributeKeys);a._setAttributeOffset(m);a.group=this;a.attributes=this.attributes;for(var l in e)e.hasOwnProperty(l)&&e[l]._createBufferAttribute(null!==this.maxParticleCount?this.maxParticleCount:this.particleCount); +for(e=m;b>e;++e)a._assignPositionValue(e),a._assignForceValue(e,'velocity'),a._assignForceValue(e,'acceleration'),a._assignAbsLifetimeValue(e,'opacity'),a._assignAbsLifetimeValue(e,'size'),a._assignAngleValue(e),a._assignRotationValue(e),a._assignParamsValue(e),a._assignColorValue(e);return this._applyAttributesToGeometry(),this.emitters.push(a),this.emitterIDs.push(a.uuid),this._updateDefines(a),this.material.needsUpdate=!0,this.geometry.needsUpdate=!0,this._attributesNeedRefresh=!0,this}; +SPE.Group.prototype.removeEmitter=function(a){var e=this.emitterIDs.indexOf(a.uuid);if(0==a instanceof SPE.Emitter)return void console.error('`emitter` argument must be instance of SPE.Emitter. Was provided with:',a);if(-1===e)return void console.error('Emitter does not exist in this group. Will not remove.');for(var m=a.attributeOffset,b=m+a.particleCount,l=this.attributes.params.typedArray,g=m;b>g;++g)l.array[4*g]=0,l.array[4*g+1]=0;this.emitters.splice(e,1);this.emitterIDs.splice(e,1);for(var c in this.attributes)this.attributes.hasOwnProperty(c)&& +this.attributes[c].splice(m,b);this.particleCount-=a.particleCount;a._onRemove();this._attributesNeedRefresh=!0};SPE.Group.prototype.getFromPool=function(){var a=this._pool,e=this._createNewWhenPoolEmpty;return a.length?a.pop():e?(a=new SPE.Emitter(this._poolCreationSettings),this.addEmitter(a),a):null};SPE.Group.prototype.releaseIntoPool=function(a){return 0==a instanceof SPE.Emitter?void console.error('Argument is not instanceof SPE.Emitter:',a):(a.reset(),this._pool.unshift(a),this)}; +SPE.Group.prototype.getPool=function(){return this._pool};SPE.Group.prototype.addPool=function(a,e,m){this._poolCreationSettings=e;this._createNewWhenPoolEmpty=!!m;for(var b=0;a>b;++b)m=Array.isArray(e)?new SPE.Emitter(e[b]):new SPE.Emitter(e),this.addEmitter(m),this.releaseIntoPool(m);return this}; +SPE.Group.prototype._triggerSingleEmitter=function(a){var e=this.getFromPool(),m=this;return null===e?void console.log('SPE.Group pool ran out.'):(a instanceof THREE.Vector3&&(e.position.value.copy(a),e.position.value=e.position.value),e.enable(),setTimeout(function(){e.disable();m.releaseIntoPool(e)},1E3*Math.max(e.duration,e.maxAge.value+e.maxAge.spread)),this)}; +SPE.Group.prototype.triggerPoolEmitter=function(a,e){if('number'==typeof a&&1m;++m)this._triggerSingleEmitter(e);else this._triggerSingleEmitter(e);return this};SPE.Group.prototype._updateUniforms=function(a){this.uniforms.runTime.value+=a;this.uniforms.deltaTime.value=a};SPE.Group.prototype._resetBufferRanges=function(){var a=this.attributeKeys,e=this.attributeCount-1,m=this.attributes;for(e;0<=e;--e)m[a[e]].resetUpdateRange()}; +SPE.Group.prototype._updateBuffers=function(a){var e,m=this.attributeKeys,b=this.attributeCount-1,l=this.attributes,g=a.bufferUpdateRanges;for(b;0<=b;--b)e=m[b],a=g[e],e=l[e],e.setUpdateRange(a.min,a.max),e.flagUpdate()}; +SPE.Group.prototype.tick=function(a){var e=this.emitters,m=e.length,b=a||this.fixedTimeStep,l=this.attributeKeys,g=this.attributes;if(this._updateUniforms(b),this._resetBufferRanges(),0!==m||!1!==this._attributesNeedRefresh||!1!==this._attributesNeedDynamicReset){var c;for(a=0;m>a;++a)c=e[a],c.tick(b),this._updateBuffers(c);if(!0===this._attributesNeedDynamicReset){for(a=this.attributeCount-1;0<=a;--a)g[l[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(!0===this._attributesNeedRefresh){for(a= +this.attributeCount-1;0<=a;--a)g[l[a]].forceUpdateAll();this._attributesNeedRefresh=!1;this._attributesNeedDynamicReset=!0}}};SPE.Group.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this}; +SPE.Emitter=function(a){var e=SPE.utils,m=e.types,b=SPE.valueOverLifetimeLength;a=e.ensureTypedArg(a,m.OBJECT,{});a.position=e.ensureTypedArg(a.position,m.OBJECT,{});a.velocity=e.ensureTypedArg(a.velocity,m.OBJECT,{});a.acceleration=e.ensureTypedArg(a.acceleration,m.OBJECT,{});a.radius=e.ensureTypedArg(a.radius,m.OBJECT,{});a.drag=e.ensureTypedArg(a.drag,m.OBJECT,{});a.rotation=e.ensureTypedArg(a.rotation,m.OBJECT,{});a.color=e.ensureTypedArg(a.color,m.OBJECT,{});a.opacity=e.ensureTypedArg(a.opacity, +m.OBJECT,{});a.size=e.ensureTypedArg(a.size,m.OBJECT,{});a.angle=e.ensureTypedArg(a.angle,m.OBJECT,{});a.wiggle=e.ensureTypedArg(a.wiggle,m.OBJECT,{});a.maxAge=e.ensureTypedArg(a.maxAge,m.OBJECT,{});a.onParticleSpawn&&console.warn('onParticleSpawn has been removed. Please set properties directly to alter values at runtime.');this.uuid=THREE.Math.generateUUID();this.type=e.ensureTypedArg(a.type,m.NUMBER,SPE.distributions.BOX);this.position={_value:e.ensureInstanceOf(a.position.value,THREE.Vector3, +new THREE.Vector3),_spread:e.ensureInstanceOf(a.position.spread,THREE.Vector3,new THREE.Vector3),_spreadClamp:e.ensureInstanceOf(a.position.spreadClamp,THREE.Vector3,new THREE.Vector3),_distribution:e.ensureTypedArg(a.position.distribution,m.NUMBER,this.type),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1),_radius:e.ensureTypedArg(a.position.radius,m.NUMBER,10),_radiusScale:e.ensureInstanceOf(a.position.radiusScale,THREE.Vector3,new THREE.Vector3(1,1,1)),_distributionClamp:e.ensureTypedArg(a.position.distributionClamp, +m.NUMBER,0)};this.velocity={_value:e.ensureInstanceOf(a.velocity.value,THREE.Vector3,new THREE.Vector3),_spread:e.ensureInstanceOf(a.velocity.spread,THREE.Vector3,new THREE.Vector3),_distribution:e.ensureTypedArg(a.velocity.distribution,m.NUMBER,this.type),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.acceleration={_value:e.ensureInstanceOf(a.acceleration.value,THREE.Vector3,new THREE.Vector3),_spread:e.ensureInstanceOf(a.acceleration.spread,THREE.Vector3,new THREE.Vector3), +_distribution:e.ensureTypedArg(a.acceleration.distribution,m.NUMBER,this.type),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.drag={_value:e.ensureTypedArg(a.drag.value,m.NUMBER,0),_spread:e.ensureTypedArg(a.drag.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.wiggle={_value:e.ensureTypedArg(a.wiggle.value,m.NUMBER,0),_spread:e.ensureTypedArg(a.wiggle.spread,m.NUMBER,0)};this.rotation={_axis:e.ensureInstanceOf(a.rotation.axis,THREE.Vector3, +new THREE.Vector3(0,1,0)),_axisSpread:e.ensureInstanceOf(a.rotation.axisSpread,THREE.Vector3,new THREE.Vector3),_angle:e.ensureTypedArg(a.rotation.angle,m.NUMBER,0),_angleSpread:e.ensureTypedArg(a.rotation.angleSpread,m.NUMBER,0),_static:e.ensureTypedArg(a.rotation['static'],m.BOOLEAN,!1),_center:e.ensureInstanceOf(a.rotation.center,THREE.Vector3,this.position._value.clone()),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.maxAge={_value:e.ensureTypedArg(a.maxAge.value,m.NUMBER, +2),_spread:e.ensureTypedArg(a.maxAge.spread,m.NUMBER,0)};this.color={_value:e.ensureArrayInstanceOf(a.color.value,THREE.Color,new THREE.Color),_spread:e.ensureArrayInstanceOf(a.color.spread,THREE.Vector3,new THREE.Vector3),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.opacity={_value:e.ensureArrayTypedArg(a.opacity.value,m.NUMBER,1),_spread:e.ensureArrayTypedArg(a.opacity.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.size={_value:e.ensureArrayTypedArg(a.size.value, +m.NUMBER,1),_spread:e.ensureArrayTypedArg(a.size.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.angle={_value:e.ensureArrayTypedArg(a.angle.value,m.NUMBER,0),_spread:e.ensureArrayTypedArg(a.angle.spread,m.NUMBER,0),_randomise:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)};this.particleCount=e.ensureTypedArg(a.particleCount,m.NUMBER,100);this.duration=e.ensureTypedArg(a.duration,m.NUMBER,null);this.isStatic=e.ensureTypedArg(a.isStatic,m.BOOLEAN,!1);this.activeMultiplier= +e.ensureTypedArg(a.activeMultiplier,m.NUMBER,1);this.direction=e.ensureTypedArg(a.direction,m.NUMBER,1);this.alive=e.ensureTypedArg(a.alive,m.BOOLEAN,!0);this.activeParticleCount=this.age=this.attributeEnd=this.attributeOffset=this.activationIndex=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.resetFlags={position:e.ensureTypedArg(a.position.randomise,m.BOOLEAN,!1)||e.ensureTypedArg(a.radius.randomise,m.BOOLEAN,!1),velocity:e.ensureTypedArg(a.velocity.randomise,m.BOOLEAN, +!1),acceleration:e.ensureTypedArg(a.acceleration.randomise,m.BOOLEAN,!1)||e.ensureTypedArg(a.drag.randomise,m.BOOLEAN,!1),rotation:e.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),rotationCenter:e.ensureTypedArg(a.rotation.randomise,m.BOOLEAN,!1),size:e.ensureTypedArg(a.size.randomise,m.BOOLEAN,!1),color:e.ensureTypedArg(a.color.randomise,m.BOOLEAN,!1),opacity:e.ensureTypedArg(a.opacity.randomise,m.BOOLEAN,!1),angle:e.ensureTypedArg(a.angle.randomise,m.BOOLEAN,!1)};this.updateFlags={};this.updateCounts= +{};this.updateMap={maxAge:'params',position:'position',velocity:'velocity',acceleration:'acceleration',drag:'acceleration',wiggle:'params',rotation:'rotation',size:'size',color:'color',opacity:'opacity',angle:'angle'};for(var l in this.updateMap)this.updateMap.hasOwnProperty(l)&&(this.updateCounts[this.updateMap[l]]=0,this.updateFlags[this.updateMap[l]]=!1,this._createGetterSetters(this[l],l));this.bufferUpdateRanges={};this.attributeKeys=null;this.attributeCount=0;e.ensureValueOverLifetimeCompliance(this.color, +b,b);e.ensureValueOverLifetimeCompliance(this.opacity,b,b);e.ensureValueOverLifetimeCompliance(this.size,b,b);e.ensureValueOverLifetimeCompliance(this.angle,b,b)};SPE.Emitter.constructor=SPE.Emitter; +SPE.Emitter.prototype._createGetterSetters=function(a,e){var m=this,b;for(b in a)if(a.hasOwnProperty(b)){var l=b.replace('_','');Object.defineProperty(a,l,{get:function(a){return function(){return this[a]}}(b),set:function(a){return function(b){var c=m.updateMap[e],g=this[a],l=SPE.valueOverLifetimeLength;'_rotationCenter'===a?(m.updateFlags.rotationCenter=!0,m.updateCounts.rotationCenter=0):'_randomise'===a?m.resetFlags[c]=b:(m.updateFlags[c]=!0,m.updateCounts[c]=0);m.group._updateDefines();this[a]= +b;Array.isArray(g)&&SPE.utils.ensureValueOverLifetimeCompliance(m[e],l,l)}}(b)})}};SPE.Emitter.prototype._setBufferUpdateRanges=function(a){this.attributeKeys=a;this.attributeCount=a.length;for(var e=this.attributeCount-1;0<=e;--e)this.bufferUpdateRanges[a[e]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}};SPE.Emitter.prototype._calculatePPSValue=function(a){var e=this.particleCount;this.duration?this.particlesPerSecond=e/(a=a;--k)g=4*k,c=m[g],0!==c&&(f=m[g+1],l=m[g+2],1===this.direction?(f+=b,f>=l&&(f=0,c=0,this._decrementParticleCount())):(f-=b,0>=f&&(f=l,c=0,this._decrementParticleCount())),m[g]=c,m[g+1]=f,this._updateAttributeUpdateRange('params',k))}; -SPE.Emitter.prototype._activateParticles=function(a,g,m,b){for(var l,f,c=this.direction,k=a;g>k;++k)l=4*k,0!=m[l]&&1!==this.particleCount||(this._incrementParticleCount(),m[l]=1,this._resetParticle(k),f=b*(k-a),m[l+1]=-1===c?m[l+2]-f:f,this._updateAttributeUpdateRange('params',k))}; -SPE.Emitter.prototype.tick=function(a){if(!this.isStatic){null===this.paramsArray&&(this.paramsArray=this.attributes.params.typedArray.array);var g=this.attributeOffset,m=g+this.particleCount,b=this.paramsArray,l=this.particlesPerSecond*this.activeMultiplier*a,f=this.activationIndex;if(this._resetBufferRanges(),this._checkParticleAges(g,m,b,a),!1===this.alive)return void(this.age=0);if(null!==this.duration&&this.age>this.duration)return this.alive=!1,void(this.age=0);var f=1===this.particleCount? -f:0|f,c=Math.min(f+l,this.activationEnd),k=c-this.activationIndex|0;this._activateParticles(f,c,b,0m&&(this.activationIndex=g);this.age+=a}};SPE.Emitter.prototype.reset=function(a){if(this.age=0,this.alive=!1,!0===a){for(var g=this.attributeOffset,m=this.paramsArray,b=this.attributes.params.bufferAttribute,l=g+this.particleCount-1;l>=g;--l)a=4*l,m[a]=0,m[a+1]=0;b.updateRange.offset=0;b.updateRange.count=-1;b.needsUpdate=!0}return this}; +SPE.Emitter.prototype._resetParticle=function(a){for(var e,m,b=this.resetFlags,l=this.updateFlags,g=this.updateCounts,c=this.attributeKeys,k=this.attributeCount-1;0<=k;--k)e=c[k],m=l[e],!0!==b[e]&&!0!==m||(this._assignValue(e,a),this._updateAttributeUpdateRange(e,a),!0===m&&g[e]===this.particleCount?(l[e]=!1,g[e]=0):1==m&&++g[e])};SPE.Emitter.prototype._updateAttributeUpdateRange=function(a,e){a=this.bufferUpdateRanges[a];a.min=Math.min(e,a.min);a.max=Math.max(e,a.max)}; +SPE.Emitter.prototype._resetBufferRanges=function(){var a,e=this.bufferUpdateRanges,m=this.bufferUpdateKeys,b=this.bufferUpdateCount-1;for(b;0<=b;--b)a=m[b],e[a].min=Number.POSITIVE_INFINITY,e[a].max=Number.NEGATIVE_INFINITY};SPE.Emitter.prototype._onRemove=function(){this.activeParticleCount=this.activationIndex=this.attributeOffset=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.age=0};SPE.Emitter.prototype._decrementParticleCount=function(){--this.activeParticleCount}; +SPE.Emitter.prototype._incrementParticleCount=function(){++this.activeParticleCount};SPE.Emitter.prototype._checkParticleAges=function(a,e,m,b){for(var l,g,c,k=e-1;k>=a;--k)e=4*k,c=m[e],0!==c&&(g=m[e+1],l=m[e+2],1===this.direction?(g+=b,g>=l&&(g=0,c=0,this._decrementParticleCount())):(g-=b,0>=g&&(g=l,c=0,this._decrementParticleCount())),m[e]=c,m[e+1]=g,this._updateAttributeUpdateRange('params',k))}; +SPE.Emitter.prototype._activateParticles=function(a,e,m,b){for(var l,g,c=this.direction,k=a;e>k;++k)l=4*k,0!=m[l]&&1!==this.particleCount||(this._incrementParticleCount(),m[l]=1,this._resetParticle(k),g=b*(k-a),m[l+1]=-1===c?m[l+2]-g:g,this._updateAttributeUpdateRange('params',k))}; +SPE.Emitter.prototype.tick=function(a){if(!this.isStatic){null===this.paramsArray&&(this.paramsArray=this.attributes.params.typedArray.array);var e=this.attributeOffset,m=e+this.particleCount,b=this.paramsArray,l=this.particlesPerSecond*this.activeMultiplier*a,g=this.activationIndex;if(this._resetBufferRanges(),this._checkParticleAges(e,m,b,a),!1===this.alive)return void(this.age=0);if(null!==this.duration&&this.age>this.duration)return this.alive=!1,void(this.age=0);var g=1===this.particleCount? +g:0|g,c=Math.min(g+l,this.activationEnd),k=c-this.activationIndex|0;this._activateParticles(g,c,b,0m&&(this.activationIndex=e);this.age+=a}};SPE.Emitter.prototype.reset=function(a){if(this.age=0,this.alive=!1,!0===a){for(var e=this.attributeOffset,m=this.paramsArray,b=this.attributes.params.bufferAttribute,l=e+this.particleCount-1;l>=e;--l)a=4*l,m[a]=0,m[a+1]=0;b.updateRange.offset=0;b.updateRange.count=-1;b.needsUpdate=!0}return this}; SPE.Emitter.prototype.enable=function(){return this.alive=!0,this};SPE.Emitter.prototype.disable=function(){return this.alive=!1,this};SPE.Emitter.prototype.remove=function(){return null!==this.group?this.group.removeEmitter(this):console.error('Emitter does not belong to a group, cannot remove.'),this}; -var __extends=this&&this.__extends||function(a,g){function m(){this.constructor=a}for(var b in g)g.hasOwnProperty(b)&&(a[b]=g[b]);a.prototype=null===g?Object.create(g):(m.prototype=g.prototype,new m)},spine; -(function(a){var g=function(){function a(a,b,c){if(null==a)throw Error('name cannot be null.');if(null==b)throw Error('timelines cannot be null.');this.name=a;this.timelines=b;this.duration=c}a.prototype.apply=function(a,b,c,f,h,d,g,l){if(null==a)throw Error('skeleton cannot be null.');f&&0!=this.duration&&(c%=this.duration,0>>1;;){a[(d+1)*c]<=b?f=d+1:h=d;if(f==h)return(f+1)*c;d=f+h>>>1}};a.linearSearch=function(a,b,c){for(var f=0,h=a.length-c;f<=h;f+=c)if(a[f]>b)return f;return-1};return a}();a.Animation=g;(function(a){a[a.rotate=0]='rotate';a[a.translate=1]='translate';a[a.scale=2]='scale';a[a.shear=3]='shear';a[a.attachment=4]='attachment';a[a.color=5]='color';a[a.deform=6]='deform';a[a.event=7]='event';a[a.drawOrder=8]='drawOrder';a[a.ikConstraint=9]='ikConstraint';a[a.transformConstraint=10]= +var __extends=this&&this.__extends||function(a,e){function m(){this.constructor=a}for(var b in e)e.hasOwnProperty(b)&&(a[b]=e[b]);a.prototype=null===e?Object.create(e):(m.prototype=e.prototype,new m)},spine; +(function(a){var e=function(){function a(a,b,c){if(null==a)throw Error('name cannot be null.');if(null==b)throw Error('timelines cannot be null.');this.name=a;this.timelines=b;this.duration=c}a.prototype.apply=function(a,b,c,g,h,d,e,l){if(null==a)throw Error('skeleton cannot be null.');g&&0!=this.duration&&(c%=this.duration,0>>1;;){a[(d+1)*c]<=b?g=d+1:h=d;if(g==h)return(g+1)*c;d=g+h>>>1}};a.linearSearch=function(a,b,c){for(var g=0,h=a.length-c;g<=h;g+=c)if(a[g]>b)return g;return-1};return a}();a.Animation=e;(function(a){a[a.rotate=0]='rotate';a[a.translate=1]='translate';a[a.scale=2]='scale';a[a.shear=3]='shear';a[a.attachment=4]='attachment';a[a.color=5]='color';a[a.deform=6]='deform';a[a.event=7]='event';a[a.drawOrder=8]='drawOrder';a[a.ikConstraint=9]='ikConstraint';a[a.transformConstraint=10]= 'transformConstraint';a[a.pathConstraintPosition=11]='pathConstraintPosition';a[a.pathConstraintSpacing=12]='pathConstraintSpacing';a[a.pathConstraintMix=13]='pathConstraintMix'})(a.TimelineType||(a.TimelineType={}));var m=a.TimelineType,b=function(){function b(c){if(0>=c)throw Error('frameCount must be > 0: '+c);this.curves=a.Utils.newFloatArray((c-1)*b.BEZIER_SIZE)}b.prototype.getFrameCount=function(){return this.curves.length/b.BEZIER_SIZE+1};b.prototype.setLinear=function(a){this.curves[a*b.BEZIER_SIZE]= -b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a==b.STEPPED?b.STEPPED:b.BEZIER};b.prototype.setCurve=function(a,c,f,g,h){var d=.03*(2*-c+g),k=.03*(2*-f+h);g=.006*(3*(c-g)+1);h=.006*(3*(f-h)+1);var l=2*d+g,n=2*k+h;c=.3*c+d+.16666667*g;f=.3*f+k+.16666667*h;a*=b.BEZIER_SIZE;k=this.curves;k[a++]=b.BEZIER;for(var d=c,p=f,m=a+b.BEZIER_SIZE- -1;a=f)return c==h?d=h=0:(h=k[c-2],d=k[c-1]),d+(k[c+1]-d)*(f-h)/(g-h);k=k[c-1];return k+(1-k)*(f-g)/(1-g)};b.LINEAR=0;b.STEPPED=1;b.BEZIER=2;b.BEZIER_SIZE=19;return b}();a.CurveTimeline=b;var l=function(b){function c(c){b.call(this, -c);this.frames=a.Utils.newFloatArray(c<<1)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.rotate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,f){a<<=1;this.frames[a]=b;this.frames[a+c.ROTATION]=f};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(f=b[b.length-c.ENTRIES])k?a.rotation=a.data.rotation+b[b.length+c.PREV_ROTATION]*d:(k=a.data.rotation+b[b.length+c.PREV_ROTATION]-a.rotation,a.rotation+= -(k-360*(16384-(16384.499999999996-k/360|0)))*d);else{l=g.binarySearch(b,f,c.ENTRIES);h=b[l+c.PREV_ROTATION];var n=b[l];f=this.getCurvePercent((l>>1)-1,1-(f-n)/(b[l+c.PREV_TIME]-n));b=b[l+c.ROTATION]-h;b=h+(b-360*(16384-(16384.499999999996-b/360|0)))*f;k?a.rotation=a.data.rotation+(b-360*(16384-(16384.499999999996-b/360|0)))*d:(b=a.data.rotation+b-a.rotation,a.rotation+=(b-360*(16384-(16384.499999999996-b/360|0)))*d)}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_ROTATION=-1;c.ROTATION=1;return c}(b);a.RotateTimeline= -l;l=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.translate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,f,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.X]=f;this.frames[a+c.Y]=h};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(f=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_X],l=b[b.length+c.PREV_Y];else{var n= -g.binarySearch(b,f,c.ENTRIES);h=b[n+c.PREV_X];l=b[n+c.PREV_Y];var p=b[n];f=this.getCurvePercent(n/c.ENTRIES-1,1-(f-p)/(b[n+c.PREV_TIME]-p));h+=(b[n+c.X]-h)*f;l+=(b[n+c.Y]-l)*f}k?(a.x=a.data.x+h*d,a.y=a.data.y+l*d):(a.x+=(a.data.x+h-a.x)*d,a.y+=(a.data.y+l-a.y)*d)}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_X=-2;c.PREV_Y=-1;c.X=1;c.Y=2;return c}(b);a.TranslateTimeline=l;var f=function(b){function c(a){b.call(this,a)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.scale<<24)+this.boneIndex};c.prototype.apply= -function(b,f,k,h,d,l,m){var n=this.frames;b=b.bones[this.boneIndex];if(k=n[n.length-c.ENTRIES])f=n[n.length+c.PREV_X]*b.data.scaleX,h=n[n.length+c.PREV_Y]*b.data.scaleY;else{var p=g.binarySearch(n,k,c.ENTRIES);f=n[p+c.PREV_X];h=n[p+c.PREV_Y];var t=n[p];k=this.getCurvePercent(p/c.ENTRIES-1,1-(k-t)/(n[p+c.PREV_TIME]-t));f=(f+(n[p+c.X]-f)*k)*b.data.scaleX;h=(h+(n[p+c.Y]-h)*k)*b.data.scaleY}1==d?(b.scaleX=f,b.scaleY=h):(l?(l=b.data.scaleX, -k=b.data.scaleY):(l=b.scaleX,k=b.scaleY),m?(f=Math.abs(f)*a.MathUtils.signum(l),h=Math.abs(h)*a.MathUtils.signum(k)):(l=Math.abs(l)*a.MathUtils.signum(f),k=Math.abs(k)*a.MathUtils.signum(h)),b.scaleX=l+(f-l)*d,b.scaleY=k+(h-k)*d)}};return c}(l);a.ScaleTimeline=f;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.shear<<24)+this.boneIndex};b.prototype.apply=function(a,c,f,h,d,k,l){c=this.frames;a=a.bones[this.boneIndex];if(f=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_X],l=c[c.length+b.PREV_Y];else{var n=g.binarySearch(c,f,b.ENTRIES);h=c[n+b.PREV_X];l=c[n+b.PREV_Y];var p=c[n];f=this.getCurvePercent(n/b.ENTRIES-1,1-(f-p)/(c[n+b.PREV_TIME]-p));h+=(c[n+b.X]-h)*f;l+=(c[n+b.Y]-l)*f}k?(a.shearX=a.data.shearX+h*d,a.shearY=a.data.shearY+l*d):(a.shearX+=(a.data.shearX+h-a.shearX)*d,a.shearY+=(a.data.shearY+l-a.shearY)*d)}};return b}(l);a.ShearTimeline=l;l=function(b){function c(f){b.call(this, -f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.color<<24)+this.slotIndex};c.prototype.setFrame=function(a,b,f,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.R]=f;this.frames[a+c.G]=h;this.frames[a+c.B]=d;this.frames[a+c.A]=k};c.prototype.apply=function(a,b,f,h,d,k,l){a=a.slots[this.slotIndex];var n=this.frames;if(f=n[n.length-c.ENTRIES])f=n.length,b=n[f+c.PREV_R],h=n[f+ -c.PREV_G],l=n[f+c.PREV_B],p=n[f+c.PREV_A];else{var m=g.binarySearch(n,f,c.ENTRIES);b=n[m+c.PREV_R];h=n[m+c.PREV_G];l=n[m+c.PREV_B];p=n[m+c.PREV_A];var t=n[m];f=this.getCurvePercent(m/c.ENTRIES-1,1-(f-t)/(n[m+c.PREV_TIME]-t));b+=(n[m+c.R]-b)*f;h+=(n[m+c.G]-h)*f;l+=(n[m+c.B]-l)*f;p+=(n[m+c.A]-p)*f}1==d?a.color.set(b,h,l,p):(f=a.color,k&&f.setFromColor(a.data.color),f.add((b-f.r)*d,(h-f.g)*d,(l-f.b)*d,(p-f.a)*d))}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_R=-4;c.PREV_G=-3;c.PREV_B=-2;c.PREV_A=-1;c.R=1;c.G= -2;c.B=3;c.A=4;return c}(b);a.ColorTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}b.prototype.getPropertyId=function(){return(m.attachment<<24)+this.slotIndex};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};b.prototype.apply=function(a,b,c,f,h,d,l){b=a.slots[this.slotIndex];l&&d?(c=b.data.attachmentName,b.setAttachment(null==c?null:a.getAttachment(this.slotIndex, -c))):(l=this.frames,c=l[l.length-1]?l.length-1:g.binarySearch(l,c,1)-1,c=this.attachmentNames[c],a.slots[this.slotIndex].setAttachment(null==c?null:a.getAttachment(this.slotIndex,c))))};return b}();a.AttachmentTimeline=l;l=function(b){function c(c){b.call(this,c);this.frames=a.Utils.newFloatArray(c);this.frameVertices=Array(c)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.deform<< -24)+this.slotIndex};c.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};c.prototype.apply=function(b,c,f,h,d,k,l){b=b.slots[this.slotIndex];var n=b.getAttachment();if(n instanceof a.VertexAttachment&&n.applyDeform(this.attachment)){var p=this.frames;c=b.attachmentVertices;if(f=p[p.length-1])if(f=l[p.length-1],1==d)a.Utils.arrayCopy(f,0,c,0,b);else if(k)if(k= -n,null==k.bones)for(k=k.vertices,n=0;nc)this.apply(a,b,Number.MAX_VALUE,f,h,d,l),b=-1;else if(b>=k[n-1])return;if(!(c=k[a];a++)f.push(this.events[a])}}};return b}();a.EventTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}b.prototype.getPropertyId=function(){return m.drawOrder<<24};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};b.prototype.apply=function(b,c,f,l,h,d,m){c=b.drawOrder;l=b.slots; -if(m&&d)a.Utils.arrayCopy(b.slots,0,b.drawOrder,0,b.slots.length);else if(m=this.frames,f=m[m.length-1]?m.length-1:g.binarySearch(m,f)-1,b=this.drawOrders[b],null==b)a.Utils.arrayCopy(l,0,c,0,l.length);else for(f=0,d=b.length;f=b[b.length-c.ENTRIES])k?(a.mix=a.data.mix+(b[b.length+c.PREV_MIX]-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[b.length+c.PREV_BEND_DIRECTION]):(a.mix+=(b[b.length+ -c.PREV_MIX]-a.mix)*d,l||(a.bendDirection=b[b.length+c.PREV_BEND_DIRECTION]));else{h=g.binarySearch(b,f,c.ENTRIES);var n=b[h+c.PREV_MIX],m=b[h];f=this.getCurvePercent(h/c.ENTRIES-1,1-(f-m)/(b[h+c.PREV_TIME]-m));k?(a.mix=a.data.mix+(n+(b[h+c.MIX]-n)*f-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[h+c.PREV_BEND_DIRECTION]):(a.mix+=(n+(b[h+c.MIX]-n)*f-a.mix)*d,l||(a.bendDirection=b[h+c.PREV_BEND_DIRECTION]))}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_MIX=-2;c.PREV_BEND_DIRECTION=-1;c.MIX=1;c.BEND_DIRECTION= -2;return c}(b);a.IkConstraintTimeline=l;l=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.transformConstraint<<24)+this.transformConstraintIndex};c.prototype.setFrame=function(a,b,f,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=f;this.frames[a+c.TRANSLATE]=h;this.frames[a+c.SCALE]=d;this.frames[a+c.SHEAR]=k};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.transformConstraints[this.transformConstraintIndex]; -if(f=b[b.length-c.ENTRIES])f=b.length,h=b[f+c.PREV_ROTATE],l=b[f+c.PREV_TRANSLATE],n=b[f+c.PREV_SCALE],m=b[f+c.PREV_SHEAR];else{var p=g.binarySearch(b,f,c.ENTRIES);h=b[p+c.PREV_ROTATE];l=b[p+c.PREV_TRANSLATE];n=b[p+c.PREV_SCALE];m=b[p+c.PREV_SHEAR];var t=b[p];f=this.getCurvePercent(p/c.ENTRIES-1,1-(f-t)/(b[p+c.PREV_TIME]-t));h+=(b[p+c.ROTATE]-h)*f;l+=(b[p+c.TRANSLATE]- -l)*f;n+=(b[p+c.SCALE]-n)*f;m+=(b[p+c.SHEAR]-m)*f}k?(k=a.data,a.rotateMix=k.rotateMix+(h-k.rotateMix)*d,a.translateMix=k.translateMix+(l-k.translateMix)*d,a.scaleMix=k.scaleMix+(n-k.scaleMix)*d,a.shearMix=k.shearMix+(m-k.shearMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d,a.scaleMix+=(n-a.scaleMix)*d,a.shearMix+=(m-a.shearMix)*d)}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_ROTATE=-4;c.PREV_TRANSLATE=-3;c.PREV_SCALE=-2;c.PREV_SHEAR=-1;c.ROTATE=1;c.TRANSLATE=2;c.SCALE=3;c.SHEAR= -4;return c}(b);a.TransformConstraintTimeline=l;l=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintPosition<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,f){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.VALUE]=f};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f=b[b.length- -c.ENTRIES])h=b[b.length+c.PREV_VALUE];else{l=g.binarySearch(b,f,c.ENTRIES);h=b[l+c.PREV_VALUE];var n=b[l];f=this.getCurvePercent(l/c.ENTRIES-1,1-(f-n)/(b[l+c.PREV_TIME]-n));h+=(b[l+c.VALUE]-h)*f}a.position=k?a.data.position+(h-a.data.position)*d:a.position+(h-a.position)*d}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_VALUE=-1;c.VALUE=1;return c}(b);a.PathConstraintPositionTimeline=l;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.pathConstraintSpacing<< -24)+this.pathConstraintIndex};b.prototype.apply=function(a,c,f,h,d,k,l){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_VALUE];else{l=g.binarySearch(c,f,b.ENTRIES);h=c[l+b.PREV_VALUE];var n=c[l];f=this.getCurvePercent(l/b.ENTRIES-1,1-(f-n)/(c[l+b.PREV_TIME]-n));h+=(c[l+b.VALUE]-h)*f}a.spacing=k?a.data.spacing+(h-a.data.spacing)*d:a.spacing+(h-a.spacing)*d}};return b}(l);a.PathConstraintSpacingTimeline= -l;b=function(b){function c(f){b.call(this,f);this.frames=a.Utils.newFloatArray(f*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintMix<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,f,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=f;this.frames[a+c.TRANSLATE]=h};c.prototype.apply=function(a,b,f,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_ROTATE],l=b[b.length+c.PREV_TRANSLATE];else{var n=g.binarySearch(b,f,c.ENTRIES);h=b[n+c.PREV_ROTATE];l=b[n+c.PREV_TRANSLATE];var m=b[n];f=this.getCurvePercent(n/c.ENTRIES-1,1-(f-m)/(b[n+c.PREV_TIME]-m));h+=(b[n+c.ROTATE]-h)*f;l+=(b[n+c.TRANSLATE]-l)*f}k?(a.rotateMix=a.data.rotateMix+(h-a.data.rotateMix)*d,a.translateMix=a.data.translateMix+(l-a.data.translateMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d)}};c.ENTRIES= +b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a==b.STEPPED?b.STEPPED:b.BEZIER};b.prototype.setCurve=function(a,c,g,e,h){var d=.03*(2*-c+e),k=.03*(2*-g+h);e=.006*(3*(c-e)+1);h=.006*(3*(g-h)+1);var n=2*d+e,l=2*k+h;c=.3*c+d+.16666667*e;g=.3*g+k+.16666667*h;a*=b.BEZIER_SIZE;k=this.curves;k[a++]=b.BEZIER;for(var d=c,p=g,m=a+b.BEZIER_SIZE- +1;a=g)return c==h?d=h=0:(h=k[c-2],d=k[c-1]),d+(k[c+1]-d)*(g-h)/(e-h);k=k[c-1];return k+(1-k)*(g-e)/(1-e)};b.LINEAR=0;b.STEPPED=1;b.BEZIER=2;b.BEZIER_SIZE=19;return b}();a.CurveTimeline=b;var l=function(b){function c(c){b.call(this, +c);this.frames=a.Utils.newFloatArray(c<<1)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.rotate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,g){a<<=1;this.frames[a]=b;this.frames[a+c.ROTATION]=g};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(g=b[b.length-c.ENTRIES])k?a.rotation=a.data.rotation+b[b.length+c.PREV_ROTATION]*d:(k=a.data.rotation+b[b.length+c.PREV_ROTATION]-a.rotation,a.rotation+= +(k-360*(16384-(16384.499999999996-k/360|0)))*d);else{l=e.binarySearch(b,g,c.ENTRIES);h=b[l+c.PREV_ROTATION];var n=b[l];g=this.getCurvePercent((l>>1)-1,1-(g-n)/(b[l+c.PREV_TIME]-n));b=b[l+c.ROTATION]-h;b=h+(b-360*(16384-(16384.499999999996-b/360|0)))*g;k?a.rotation=a.data.rotation+(b-360*(16384-(16384.499999999996-b/360|0)))*d:(b=a.data.rotation+b-a.rotation,a.rotation+=(b-360*(16384-(16384.499999999996-b/360|0)))*d)}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_ROTATION=-1;c.ROTATION=1;return c}(b);a.RotateTimeline= +l;l=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.translate<<24)+this.boneIndex};c.prototype.setFrame=function(a,b,g,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.X]=g;this.frames[a+c.Y]=h};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.bones[this.boneIndex];if(g=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_X],l=b[b.length+c.PREV_Y];else{var n= +e.binarySearch(b,g,c.ENTRIES);h=b[n+c.PREV_X];l=b[n+c.PREV_Y];var p=b[n];g=this.getCurvePercent(n/c.ENTRIES-1,1-(g-p)/(b[n+c.PREV_TIME]-p));h+=(b[n+c.X]-h)*g;l+=(b[n+c.Y]-l)*g}k?(a.x=a.data.x+h*d,a.y=a.data.y+l*d):(a.x+=(a.data.x+h-a.x)*d,a.y+=(a.data.y+l-a.y)*d)}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_X=-2;c.PREV_Y=-1;c.X=1;c.Y=2;return c}(b);a.TranslateTimeline=l;var g=function(b){function c(a){b.call(this,a)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.scale<<24)+this.boneIndex};c.prototype.apply= +function(b,g,k,h,d,l,m){var n=this.frames;b=b.bones[this.boneIndex];if(k=n[n.length-c.ENTRIES])g=n[n.length+c.PREV_X]*b.data.scaleX,h=n[n.length+c.PREV_Y]*b.data.scaleY;else{var p=e.binarySearch(n,k,c.ENTRIES);g=n[p+c.PREV_X];h=n[p+c.PREV_Y];var t=n[p];k=this.getCurvePercent(p/c.ENTRIES-1,1-(k-t)/(n[p+c.PREV_TIME]-t));g=(g+(n[p+c.X]-g)*k)*b.data.scaleX;h=(h+(n[p+c.Y]-h)*k)*b.data.scaleY}1==d?(b.scaleX=g,b.scaleY=h):(l?(l=b.data.scaleX, +k=b.data.scaleY):(l=b.scaleX,k=b.scaleY),m?(g=Math.abs(g)*a.MathUtils.signum(l),h=Math.abs(h)*a.MathUtils.signum(k)):(l=Math.abs(l)*a.MathUtils.signum(g),k=Math.abs(k)*a.MathUtils.signum(h)),b.scaleX=l+(g-l)*d,b.scaleY=k+(h-k)*d)}};return c}(l);a.ScaleTimeline=g;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.shear<<24)+this.boneIndex};b.prototype.apply=function(a,c,g,h,d,k,l){c=this.frames;a=a.bones[this.boneIndex];if(g=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_X],l=c[c.length+b.PREV_Y];else{var n=e.binarySearch(c,g,b.ENTRIES);h=c[n+b.PREV_X];l=c[n+b.PREV_Y];var p=c[n];g=this.getCurvePercent(n/b.ENTRIES-1,1-(g-p)/(c[n+b.PREV_TIME]-p));h+=(c[n+b.X]-h)*g;l+=(c[n+b.Y]-l)*g}k?(a.shearX=a.data.shearX+h*d,a.shearY=a.data.shearY+l*d):(a.shearX+=(a.data.shearX+h-a.shearX)*d,a.shearY+=(a.data.shearY+l-a.shearY)*d)}};return b}(l);a.ShearTimeline=l;l=function(b){function c(g){b.call(this, +g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.color<<24)+this.slotIndex};c.prototype.setFrame=function(a,b,g,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.R]=g;this.frames[a+c.G]=h;this.frames[a+c.B]=d;this.frames[a+c.A]=k};c.prototype.apply=function(a,b,g,h,d,k,l){a=a.slots[this.slotIndex];var n=this.frames;if(g=n[n.length-c.ENTRIES])g=n.length,b=n[g+c.PREV_R],h=n[g+ +c.PREV_G],l=n[g+c.PREV_B],p=n[g+c.PREV_A];else{var m=e.binarySearch(n,g,c.ENTRIES);b=n[m+c.PREV_R];h=n[m+c.PREV_G];l=n[m+c.PREV_B];p=n[m+c.PREV_A];var t=n[m];g=this.getCurvePercent(m/c.ENTRIES-1,1-(g-t)/(n[m+c.PREV_TIME]-t));b+=(n[m+c.R]-b)*g;h+=(n[m+c.G]-h)*g;l+=(n[m+c.B]-l)*g;p+=(n[m+c.A]-p)*g}1==d?a.color.set(b,h,l,p):(g=a.color,k&&g.setFromColor(a.data.color),g.add((b-g.r)*d,(h-g.g)*d,(l-g.b)*d,(p-g.a)*d))}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_R=-4;c.PREV_G=-3;c.PREV_B=-2;c.PREV_A=-1;c.R=1;c.G= +2;c.B=3;c.A=4;return c}(b);a.ColorTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}b.prototype.getPropertyId=function(){return(m.attachment<<24)+this.slotIndex};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};b.prototype.apply=function(a,b,c,g,h,d,l){b=a.slots[this.slotIndex];l&&d?(c=b.data.attachmentName,b.setAttachment(null==c?null:a.getAttachment(this.slotIndex, +c))):(l=this.frames,c=l[l.length-1]?l.length-1:e.binarySearch(l,c,1)-1,c=this.attachmentNames[c],a.slots[this.slotIndex].setAttachment(null==c?null:a.getAttachment(this.slotIndex,c))))};return b}();a.AttachmentTimeline=l;l=function(b){function c(c){b.call(this,c);this.frames=a.Utils.newFloatArray(c);this.frameVertices=Array(c)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.deform<< +24)+this.slotIndex};c.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};c.prototype.apply=function(b,c,g,h,d,k,l){b=b.slots[this.slotIndex];var n=b.getAttachment();if(n instanceof a.VertexAttachment&&n.applyDeform(this.attachment)){var p=this.frames;c=b.attachmentVertices;if(g=p[p.length-1])if(g=l[p.length-1],1==d)a.Utils.arrayCopy(g,0,c,0,b);else if(k)if(k= +n,null==k.bones)for(k=k.vertices,n=0;nc)this.apply(a,b,Number.MAX_VALUE,g,h,d,l),b=-1;else if(b>=k[n-1])return;if(!(c=k[a];a++)g.push(this.events[a])}}};return b}();a.EventTimeline=l;l=function(){function b(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}b.prototype.getPropertyId=function(){return m.drawOrder<<24};b.prototype.getFrameCount=function(){return this.frames.length};b.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};b.prototype.apply=function(b,c,g,l,h,d,m){c=b.drawOrder;l=b.slots; +if(m&&d)a.Utils.arrayCopy(b.slots,0,b.drawOrder,0,b.slots.length);else if(m=this.frames,g=m[m.length-1]?m.length-1:e.binarySearch(m,g)-1,b=this.drawOrders[b],null==b)a.Utils.arrayCopy(l,0,c,0,l.length);else for(g=0,d=b.length;g=b[b.length-c.ENTRIES])k?(a.mix=a.data.mix+(b[b.length+c.PREV_MIX]-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[b.length+c.PREV_BEND_DIRECTION]):(a.mix+=(b[b.length+ +c.PREV_MIX]-a.mix)*d,l||(a.bendDirection=b[b.length+c.PREV_BEND_DIRECTION]));else{h=e.binarySearch(b,g,c.ENTRIES);var n=b[h+c.PREV_MIX],m=b[h];g=this.getCurvePercent(h/c.ENTRIES-1,1-(g-m)/(b[h+c.PREV_TIME]-m));k?(a.mix=a.data.mix+(n+(b[h+c.MIX]-n)*g-a.data.mix)*d,a.bendDirection=l?a.data.bendDirection:b[h+c.PREV_BEND_DIRECTION]):(a.mix+=(n+(b[h+c.MIX]-n)*g-a.mix)*d,l||(a.bendDirection=b[h+c.PREV_BEND_DIRECTION]))}};c.ENTRIES=3;c.PREV_TIME=-3;c.PREV_MIX=-2;c.PREV_BEND_DIRECTION=-1;c.MIX=1;c.BEND_DIRECTION= +2;return c}(b);a.IkConstraintTimeline=l;l=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.transformConstraint<<24)+this.transformConstraintIndex};c.prototype.setFrame=function(a,b,g,h,d,k){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=g;this.frames[a+c.TRANSLATE]=h;this.frames[a+c.SCALE]=d;this.frames[a+c.SHEAR]=k};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.transformConstraints[this.transformConstraintIndex]; +if(g=b[b.length-c.ENTRIES])g=b.length,h=b[g+c.PREV_ROTATE],l=b[g+c.PREV_TRANSLATE],n=b[g+c.PREV_SCALE],m=b[g+c.PREV_SHEAR];else{var p=e.binarySearch(b,g,c.ENTRIES);h=b[p+c.PREV_ROTATE];l=b[p+c.PREV_TRANSLATE];n=b[p+c.PREV_SCALE];m=b[p+c.PREV_SHEAR];var t=b[p];g=this.getCurvePercent(p/c.ENTRIES-1,1-(g-t)/(b[p+c.PREV_TIME]-t));h+=(b[p+c.ROTATE]-h)*g;l+=(b[p+c.TRANSLATE]- +l)*g;n+=(b[p+c.SCALE]-n)*g;m+=(b[p+c.SHEAR]-m)*g}k?(k=a.data,a.rotateMix=k.rotateMix+(h-k.rotateMix)*d,a.translateMix=k.translateMix+(l-k.translateMix)*d,a.scaleMix=k.scaleMix+(n-k.scaleMix)*d,a.shearMix=k.shearMix+(m-k.shearMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d,a.scaleMix+=(n-a.scaleMix)*d,a.shearMix+=(m-a.shearMix)*d)}};c.ENTRIES=5;c.PREV_TIME=-5;c.PREV_ROTATE=-4;c.PREV_TRANSLATE=-3;c.PREV_SCALE=-2;c.PREV_SHEAR=-1;c.ROTATE=1;c.TRANSLATE=2;c.SCALE=3;c.SHEAR= +4;return c}(b);a.TransformConstraintTimeline=l;l=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintPosition<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,g){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.VALUE]=g};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=b[b.length- +c.ENTRIES])h=b[b.length+c.PREV_VALUE];else{l=e.binarySearch(b,g,c.ENTRIES);h=b[l+c.PREV_VALUE];var n=b[l];g=this.getCurvePercent(l/c.ENTRIES-1,1-(g-n)/(b[l+c.PREV_TIME]-n));h+=(b[l+c.VALUE]-h)*g}a.position=k?a.data.position+(h-a.data.position)*d:a.position+(h-a.position)*d}};c.ENTRIES=2;c.PREV_TIME=-2;c.PREV_VALUE=-1;c.VALUE=1;return c}(b);a.PathConstraintPositionTimeline=l;l=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.getPropertyId=function(){return(m.pathConstraintSpacing<< +24)+this.pathConstraintIndex};b.prototype.apply=function(a,c,g,h,d,k,l){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=c[c.length-b.ENTRIES])h=c[c.length+b.PREV_VALUE];else{l=e.binarySearch(c,g,b.ENTRIES);h=c[l+b.PREV_VALUE];var n=c[l];g=this.getCurvePercent(l/b.ENTRIES-1,1-(g-n)/(c[l+b.PREV_TIME]-n));h+=(c[l+b.VALUE]-h)*g}a.spacing=k?a.data.spacing+(h-a.data.spacing)*d:a.spacing+(h-a.spacing)*d}};return b}(l);a.PathConstraintSpacingTimeline= +l;b=function(b){function c(g){b.call(this,g);this.frames=a.Utils.newFloatArray(g*c.ENTRIES)}__extends(c,b);c.prototype.getPropertyId=function(){return(m.pathConstraintMix<<24)+this.pathConstraintIndex};c.prototype.setFrame=function(a,b,g,h){a*=c.ENTRIES;this.frames[a]=b;this.frames[a+c.ROTATE]=g;this.frames[a+c.TRANSLATE]=h};c.prototype.apply=function(a,b,g,h,d,k,l){b=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=b[b.length-c.ENTRIES])h=b[b.length+c.PREV_ROTATE],l=b[b.length+c.PREV_TRANSLATE];else{var n=e.binarySearch(b,g,c.ENTRIES);h=b[n+c.PREV_ROTATE];l=b[n+c.PREV_TRANSLATE];var m=b[n];g=this.getCurvePercent(n/c.ENTRIES-1,1-(g-m)/(b[n+c.PREV_TIME]-m));h+=(b[n+c.ROTATE]-h)*g;l+=(b[n+c.TRANSLATE]-l)*g}k?(a.rotateMix=a.data.rotateMix+(h-a.data.rotateMix)*d,a.translateMix=a.data.translateMix+(l-a.data.translateMix)*d):(a.rotateMix+=(h-a.rotateMix)*d,a.translateMix+=(l-a.translateMix)*d)}};c.ENTRIES= 3;c.PREV_TIME=-3;c.PREV_ROTATE=-2;c.PREV_TRANSLATE=-1;c.ROTATE=1;c.TRANSLATE=2;return c}(b);a.PathConstraintMixTimeline=b})(spine||(spine={})); -(function(a){var g=function(){function f(c){this.tracks=[];this.events=[];this.listeners=[];this.queue=new b(this);this.propertyIDs=new a.IntSet;this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new m});this.data=c}f.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,f=b.length;c=g.trackEnd&&null==g.mixingFrom){b[c]=null;this.queue.end(g);this.disposeNext(g);continue}this.updateMixingFrom(g,a);g.trackTime+=h}}this.queue.drain()};f.prototype.updateMixingFrom=function(a,b){var c=a.mixingFrom;null!=c&&(this.updateMixingFrom(c,b),a.mixTime>= -a.mixDuration&&null!=c.mixingFrom&&0= +(function(a){var e=function(){function g(c){this.tracks=[];this.events=[];this.listeners=[];this.queue=new b(this);this.propertyIDs=new a.IntSet;this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new m});this.data=c}g.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,g=b.length;c=e.trackEnd&&null==e.mixingFrom){b[c]=null;this.queue.end(e);this.disposeNext(e);continue}this.updateMixingFrom(e,a);e.trackTime+=h}}this.queue.drain()};g.prototype.updateMixingFrom=function(a,b){var c=a.mixingFrom;null!=c&&(this.updateMixingFrom(c,b),a.mixTime>= +a.mixDuration&&null!=c.mixingFrom&&0= h.trackEnd&&(d=0);var m=h.animationLast,w=h.getAnimationTime(),y=h.animation.timelines.length,x=h.animation.timelines;if(1==d)for(var q=0;q=c[c.length-a.RotateTimeline.ENTRIES])c=f.data.rotation+c[c.length+a.RotateTimeline.PREV_ROTATION];else{var k=a.Animation.binarySearch(c,g,a.RotateTimeline.ENTRIES),n=c[k+a.RotateTimeline.PREV_ROTATION],p=c[k];b=b.getCurvePercent((k>>1)-1,1-(g-p)/(c[k+a.RotateTimeline.PREV_TIME]-p));c=c[k+a.RotateTimeline.ROTATION]-n;c=n+(c-360*(16384-(16384.499999999996-c/360|0)))*b+f.data.rotation;c-=360*(16384- -(16384.499999999996-c/360|0))}m=m?f.data.rotation:f.rotation;c-=m;0==c?g=h[d]:(c-=360*(16384-(16384.499999999996-c/360|0)),v?(v=0,g=c):(v=h[d],g=h[d+1]),n=0=Math.abs(g)&&(180f||this.queue.event(a,m)}for((a.loop?h>a.trackTime%k:b>=f&&a.animationLast= -this.tracks.length)&&(a=this.tracks[a],null!=a)){this.queue.end(a);this.disposeNext(a);for(var b=a;;){var c=b.mixingFrom;if(null==c)break;this.queue.end(c);b.mixingFrom=null;b=c}this.tracks[a.trackIndex]=null;this.queue.drain()}};f.prototype.setCurrent=function(a,b,f){var c=this.expandToIndex(a);this.tracks[a]=b;null!=c&&(f&&this.queue.interrupt(c),b.mixingFrom=c,b.mixTime=0,c.timelinesRotation.length=0,null!=c.mixingFrom&&0=g&&(a=c.animationEnd-c.animationStart, -g=0!=a?g+(a*(1+(c.trackTime/a|0))-this.data.getMix(c.animation,b)):0));f.delay=g;return f};f.prototype.setEmptyAnimation=function(a,b){a=this.setAnimationWith(a,f.emptyAnimation,!1);a.mixDuration=b;a.trackEnd=b;return a};f.prototype.addEmptyAnimation=function(a,b,g){0>=g&&(g-=b);a=this.addAnimationWith(a,f.emptyAnimation,!1,g);a.mixDuration=b;a.trackEnd=b;return a};f.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,f=this.tracks.length;c< -f;c++){var g=this.tracks[c];null!=g&&this.setEmptyAnimation(g.trackIndex,a)}this.queue.drainDisabled=b;this.queue.drain()};f.prototype.expandToIndex=function(b){if(b=this.tracks.length?null:this.tracks[a]};f.prototype.addListener=function(a){if(null==a)throw Error('listener cannot be null.');this.listeners.push(a)};f.prototype.removeListener= -function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};f.prototype.clearListeners=function(){this.listeners.length=0};f.prototype.clearListenerNotifications=function(){this.queue.clear()};f.emptyAnimation=new a.Animation('',[],0);return f}();a.AnimationState=g;var m=function(){function a(){this.timelinesFirst=[];this.timelinesRotation=[]}a.prototype.reset=function(){this.listener=this.animation=this.mixingFrom=this.next=null;this.timelinesFirst.length=0;this.timelinesRotation.length= +w;h.nextTrackLast=h.trackTime}}this.queue.drain()};g.prototype.applyMixingFrom=function(b,g){var c=b.mixingFrom;null!=c.mixingFrom&&this.applyMixingFrom(c,g);var e;0==b.mixDuration?e=1:(e=b.mixTime/b.mixDuration,1=c[c.length-a.RotateTimeline.ENTRIES])c=g.data.rotation+c[c.length+a.RotateTimeline.PREV_ROTATION];else{var k=a.Animation.binarySearch(c,e,a.RotateTimeline.ENTRIES),n=c[k+a.RotateTimeline.PREV_ROTATION],p=c[k];b=b.getCurvePercent((k>>1)-1,1-(e-p)/(c[k+a.RotateTimeline.PREV_TIME]-p));c=c[k+a.RotateTimeline.ROTATION]-n;c=n+(c-360*(16384-(16384.499999999996-c/360|0)))*b+g.data.rotation;c-=360*(16384- +(16384.499999999996-c/360|0))}m=m?g.data.rotation:g.rotation;c-=m;0==c?e=h[d]:(c-=360*(16384-(16384.499999999996-c/360|0)),v?(v=0,e=c):(v=h[d],e=h[d+1]),n=0=Math.abs(e)&&(180g||this.queue.event(a,m)}for((a.loop?h>a.trackTime%e:b>=g&&a.animationLast= +this.tracks.length)&&(a=this.tracks[a],null!=a)){this.queue.end(a);this.disposeNext(a);for(var b=a;;){var c=b.mixingFrom;if(null==c)break;this.queue.end(c);b.mixingFrom=null;b=c}this.tracks[a.trackIndex]=null;this.queue.drain()}};g.prototype.setCurrent=function(a,b,g){var c=this.expandToIndex(a);this.tracks[a]=b;null!=c&&(g&&this.queue.interrupt(c),b.mixingFrom=c,b.mixTime=0,c.timelinesRotation.length=0,null!=c.mixingFrom&&0=e&&(a=c.animationEnd-c.animationStart, +e=0!=a?e+(a*(1+(c.trackTime/a|0))-this.data.getMix(c.animation,b)):0));g.delay=e;return g};g.prototype.setEmptyAnimation=function(a,b){a=this.setAnimationWith(a,g.emptyAnimation,!1);a.mixDuration=b;a.trackEnd=b;return a};g.prototype.addEmptyAnimation=function(a,b,e){0>=e&&(e-=b);a=this.addAnimationWith(a,g.emptyAnimation,!1,e);a.mixDuration=b;a.trackEnd=b;return a};g.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,g=this.tracks.length;c< +g;c++){var e=this.tracks[c];null!=e&&this.setEmptyAnimation(e.trackIndex,a)}this.queue.drainDisabled=b;this.queue.drain()};g.prototype.expandToIndex=function(b){if(b=this.tracks.length?null:this.tracks[a]};g.prototype.addListener=function(a){if(null==a)throw Error('listener cannot be null.');this.listeners.push(a)};g.prototype.removeListener= +function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};g.prototype.clearListeners=function(){this.listeners.length=0};g.prototype.clearListenerNotifications=function(){this.queue.clear()};g.emptyAnimation=new a.Animation('',[],0);return g}();a.AnimationState=e;var m=function(){function a(){this.timelinesFirst=[];this.timelinesRotation=[]}a.prototype.reset=function(){this.listener=this.animation=this.mixingFrom=this.next=null;this.timelinesFirst.length=0;this.timelinesRotation.length= 0};a.prototype.getAnimationTime=function(){if(this.loop){var a=this.animationEnd-this.animationStart;return 0==a?this.animationStart:this.trackTime%a+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)};a.prototype.setAnimationLast=function(a){this.nextAnimationLast=this.animationLast=a};a.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart};a.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0}; return a}();a.TrackEntry=m;var b=function(){function a(a){this.objects=[];this.drainDisabled=!1;this.animState=a}a.prototype.start=function(a){this.objects.push(l.start);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.interrupt=function(a){this.objects.push(l.interrupt);this.objects.push(a)};a.prototype.end=function(a){this.objects.push(l.end);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.dispose=function(a){this.objects.push(l.dispose);this.objects.push(a)}; -a.prototype.complete=function(a){this.objects.push(l.complete);this.objects.push(a)};a.prototype.event=function(a,b){this.objects.push(l.event);this.objects.push(a);this.objects.push(b)};a.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var a=this.objects,b=this.animState.listeners,f=0;fk.status?(b.assets[a]=k.responseText,g&&g(a,k.responseText)):(b.errors[a]="Couldn't load text "+a+': status '+ -k.status+', '+k.responseText,f&&f(a,"Couldn't load text "+a+': status '+k.status+', '+k.responseText)),b.toLoad--,b.loaded++)};k.open('GET',a,!0);k.send()};a.prototype.loadTexture=function(a,g,f){var b=this;void 0===g&&(g=null);void 0===f&&(f=null);a=this.pathPrefix+a;this.toLoad++;var k=new Image;k.crossOrigin='anonymous';k.src=a;k.onload=function(c){c=b.textureLoader(k);b.assets[a]=c;b.toLoad--;b.loaded++;g&&g(a,k)};k.onerror=function(c){b.errors[a]="Couldn't load image "+a;b.toLoad--;b.loaded++; -f&&f(a,"Couldn't load image "+a)}};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a=this.pathPrefix+a;var b=this.assets[a];b.dispose&&b.dispose();this.assets[a]=null};a.prototype.removeAll=function(){for(var a in this.assets){var g=this.assets[a];g.dispose&&g.dispose()}this.assets={}};a.prototype.isLoadingComplete=function(){return 0==this.toLoad};a.prototype.getToLoad=function(){return this.toLoad};a.prototype.getLoaded=function(){return this.loaded}; -a.prototype.dispose=function(){this.removeAll()};a.prototype.hasErrors=function(){return 0>1);if(null==this.worldVertices||this.worldVertices.length!=c)this.worldVertices=a.Utils.newFloatArray(c);var g,n,m;null==this.region?(c=g=0,n=m=1):(c=this.region.u,g=this.region.v,n=this.region.u2-c,m=this.region.v2-g);if(this.region.rotate)for(var t=0,h=6;td*y-p*w:this.skeleton.flipX!=this.skeleton.flipY)this.b=-this.b,this.d=-this.d;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};g.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};g.prototype.getWorldRotationX=function(){return Math.atan2(this.c, -this.a)*a.MathUtils.radDeg};g.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};g.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};g.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};g.prototype.worldToLocalRotationX=function(){var b=this.parent;if(null==b)return this.arotation;var g=this.a,f=this.c;return Math.atan2(b.a*f-b.c*g,b.d*g-b.b*f)*a.MathUtils.radDeg};g.prototype.worldToLocalRotationY= -function(){var b=this.parent;if(null==b)return this.arotation;var g=this.b,f=this.d;return Math.atan2(b.a*f-b.c*g,b.d*g-b.b*f)*a.MathUtils.radDeg};g.prototype.rotateWorld=function(b){var g=this.a,f=this.b,c=this.c,k=this.d,n=a.MathUtils.cosDeg(b);b=a.MathUtils.sinDeg(b);this.a=n*g-b*c;this.b=n*f-b*k;this.c=b*g+n*c;this.d=b*f+n*k;this.appliedValid=!1};g.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var b=this.parent;if(null==b)this.ax=this.worldX,this.ay=this.worldY,this.arotation= -Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var g=b.a,f=b.b,c=b.c,k=b.d,n=1/(g*k-f*c),m=this.worldX-b.worldX,b=this.worldY-b.worldY;this.ax=m*k*n-b*f*n;this.ay=b*g*n-m*c*n;k*=n;g*=n;f*=n;n*=c;c=k*this.a-f*this.c;f=k*this.b-f*this.d;k=g*this.c-n*this.a;n=g*this.d-n*this.b;this.ashearX= -0;this.ascaleX=Math.sqrt(c*c+k*k);1E-4a)throw Error('index must be >= 0.');if(null==g)throw Error('name cannot be null.');this.index=a;this.name=g;this.parent=f}}();a.BoneData=g;(function(a){a[a.Normal=0]='Normal';a[a.OnlyTranslation=1]='OnlyTranslation';a[a.NoRotationOrReflection=2]='NoRotationOrReflection';a[a.NoScale=3]='NoScale';a[a.NoScaleOrReflection=4]='NoScaleOrReflection'})(a.TransformMode|| -(a.TransformMode={}));var m=a.TransformMode})(spine||(spine={}));(function(a){var g=function(){return function(a,b){if(null==b)throw Error('data cannot be null.');this.time=a;this.data=b}}();a.Event=g})(spine||(spine={}));(function(a){var g=function(){return function(a){this.name=a}}();a.EventData=g})(spine||(spine={})); -(function(a){var g=function(){function g(a,g){this.mix=1;this.bendDirection=0;if(null==a)throw Error('data cannot be null.');if(null==g)throw Error('skeleton cannot be null.');this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var b=0;bb.ascaleX&&(k+=180);180k&&(k+=360);b.updateWorldTransformWith(b.ax,b.ay, -b.arotation+k*c,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};g.prototype.apply2=function(b,g,f,c,k,n){if(0==n)g.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();g.appliedValid||g.updateAppliedTransform();var l=b.ax,m=b.ay,h=b.ascaleX,d=b.ascaleY,v=g.ascaleX,w,y,x;0>h?(h=-h,w=180,x=-1):(w=0,x=1);0>d&&(d=-d,x=-x);0>v?(v=-v,y=180):y=0;var q=g.ax,u,A,E,D=b.a,C=b.b,F=b.c,z=b.d,H=1E-4>=Math.abs(h-d);H?(u=g.ay,A=D*q+C*u+b.worldX,E=F*q+z*u+b.worldY):(u=0,A=D*q+b.worldX,E=F*q+b.worldY); -var G=b.parent,D=G.a,C=G.b,F=G.c,z=G.d,O=1/(D*z-C*F);f-=G.worldX;c-=G.worldY;var M=(f*z-c*C)*O-l,J=(c*D-f*F)*O-m;f=A-G.worldX;c=E-G.worldY;C=(f*z-c*C)*O-l;D=(c*D-f*F)*O-m;O=Math.sqrt(C*C+D*D);C=g.data.length*v;a:if(H)C*=h,D=(M*M+J*J-O*O-C*C)/(2*O*C),-1>D?D=-1:1f&&(z=-z),z=-(f+z)/2,f=z/J,z=F/z,z= -Math.abs(f)E&&(d=0,E=z,G=f);f=O-D;z=f*f;zE&&(d=v,E=z,G=f,P=c);H<=(F+E)/2?(D=M-Math.atan2(A*k,J),k*=h):(D=M-Math.atan2(P*k,G),k*=d)}C=Math.atan2(u,q)*x;O=b.arotation;D=(D-C)*a.MathUtils.radDeg+w-O;180D&&(D+= -360);b.updateWorldTransformWith(l,m,O+D*n,b.ascaleX,b.ascaleY,0,0);O=g.arotation;k=((k+C)*a.MathUtils.radDeg-g.ashearX)*x+y-O;180k&&(k+=360);g.updateWorldTransformWith(q,u,O+k*n,g.ascaleX,g.ascaleY,g.ashearX,g.ashearY)}};return g}();a.IkConstraint=g})(spine||(spine={}));(function(a){var g=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=g})(spine||(spine={})); -(function(a){var g=function(){function g(a,g){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==a)throw Error('data cannot be null.');if(null==g)throw Error('skeleton cannot be null.');this.data=a;this.bones=[];for(var b=0,c=a.bones.length;ba.MathUtils.PI?G-=a.MathUtils.PI2:G<-a.MathUtils.PI&&(G+=a.MathUtils.PI2);G*=g;O=Math.cos(G);M=Math.sin(G);D.a=O*F-M*z;D.b=O*C-M*H;D.c=M*F+O*z;D.d=M*C+O*H}D.appliedValid=!1}}}};g.prototype.computeWorldPositions= -function(b,l,f,c,k){var n=this.target,m=this.position,t=this.spaces,h=a.Utils.setArraySize(this.positions,3*l+2),d,v=b.closed,w=b.worldVerticesLength,y=w/6,x=g.NONE;if(!b.constantSpeed){var q=b.lengths,y=y-(v?1:2),u=q[y];c&&(m*=u);if(k)for(var A=0;AD&&(D+=u),k=0;else if(0>D){x!=g.BEFORE&&(x=g.BEFORE,b.computeWorldVerticesWith(n,2,4,d,0));this.addBeforePosition(D,d,0,h,c);continue}else if(D> -u){x!=g.AFTER&&(x=g.AFTER,b.computeWorldVerticesWith(n,w-6,4,d,0));this.addAfterPosition(D-u,d,0,h,c);continue}for(;;k++){var C=q[k];if(!(D>C)){if(0==k)D/=C;else var F=q[k-1],D=(D-F)/(C-F);break}}k!=x&&(x=k,v&&k==y?(b.computeWorldVerticesWith(n,w-4,4,d,0),b.computeWorldVerticesWith(n,0,4,d,4)):b.computeWorldVerticesWith(n,6*k+2,8,d,0));this.addCurvePosition(D,d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],h,c,f||0k.status?(b.assets[a]=k.responseText,e&&e(a,k.responseText)):(b.errors[a]="Couldn't load text "+a+': status '+ +k.status+', '+k.responseText,g&&g(a,"Couldn't load text "+a+': status '+k.status+', '+k.responseText)),b.toLoad--,b.loaded++)};k.open('GET',a,!0);k.send()};a.prototype.loadTexture=function(a,e,g){var b=this;void 0===e&&(e=null);void 0===g&&(g=null);a=this.pathPrefix+a;this.toLoad++;var k=new Image;k.crossOrigin='anonymous';k.src=a;k.onload=function(c){c=b.textureLoader(k);b.assets[a]=c;b.toLoad--;b.loaded++;e&&e(a,k)};k.onerror=function(c){b.errors[a]="Couldn't load image "+a;b.toLoad--;b.loaded++; +g&&g(a,"Couldn't load image "+a)}};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a=this.pathPrefix+a;var b=this.assets[a];b.dispose&&b.dispose();this.assets[a]=null};a.prototype.removeAll=function(){for(var a in this.assets){var e=this.assets[a];e.dispose&&e.dispose()}this.assets={}};a.prototype.isLoadingComplete=function(){return 0==this.toLoad};a.prototype.getToLoad=function(){return this.toLoad};a.prototype.getLoaded=function(){return this.loaded}; +a.prototype.dispose=function(){this.removeAll()};a.prototype.hasErrors=function(){return 0>1);if(null==this.worldVertices||this.worldVertices.length!=c)this.worldVertices=a.Utils.newFloatArray(c);var e,n,m;null==this.region?(c=e=0,n=m=1):(c=this.region.u,e=this.region.v,n=this.region.u2-c,m=this.region.v2-e);if(this.region.rotate)for(var t=0,h=6;td*y-p*w:this.skeleton.flipX!=this.skeleton.flipY)this.b=-this.b,this.d=-this.d;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};e.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};e.prototype.getWorldRotationX=function(){return Math.atan2(this.c, +this.a)*a.MathUtils.radDeg};e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};e.prototype.worldToLocalRotationX=function(){var b=this.parent;if(null==b)return this.arotation;var e=this.a,g=this.c;return Math.atan2(b.a*g-b.c*e,b.d*e-b.b*g)*a.MathUtils.radDeg};e.prototype.worldToLocalRotationY= +function(){var b=this.parent;if(null==b)return this.arotation;var e=this.b,g=this.d;return Math.atan2(b.a*g-b.c*e,b.d*e-b.b*g)*a.MathUtils.radDeg};e.prototype.rotateWorld=function(b){var e=this.a,g=this.b,c=this.c,k=this.d,n=a.MathUtils.cosDeg(b);b=a.MathUtils.sinDeg(b);this.a=n*e-b*c;this.b=n*g-b*k;this.c=b*e+n*c;this.d=b*g+n*k;this.appliedValid=!1};e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var b=this.parent;if(null==b)this.ax=this.worldX,this.ay=this.worldY,this.arotation= +Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var e=b.a,g=b.b,c=b.c,k=b.d,n=1/(e*k-g*c),m=this.worldX-b.worldX,b=this.worldY-b.worldY;this.ax=m*k*n-b*g*n;this.ay=b*e*n-m*c*n;k*=n;e*=n;g*=n;n*=c;c=k*this.a-g*this.c;g=k*this.b-g*this.d;k=e*this.c-n*this.a;n=e*this.d-n*this.b;this.ashearX= +0;this.ascaleX=Math.sqrt(c*c+k*k);1E-4a)throw Error('index must be >= 0.');if(null==e)throw Error('name cannot be null.');this.index=a;this.name=e;this.parent=g}}();a.BoneData=e;(function(a){a[a.Normal=0]='Normal';a[a.OnlyTranslation=1]='OnlyTranslation';a[a.NoRotationOrReflection=2]='NoRotationOrReflection';a[a.NoScale=3]='NoScale';a[a.NoScaleOrReflection=4]='NoScaleOrReflection'})(a.TransformMode|| +(a.TransformMode={}));var m=a.TransformMode})(spine||(spine={}));(function(a){var e=function(){return function(a,b){if(null==b)throw Error('data cannot be null.');this.time=a;this.data=b}}();a.Event=e})(spine||(spine={}));(function(a){var e=function(){return function(a){this.name=a}}();a.EventData=e})(spine||(spine={})); +(function(a){var e=function(){function e(a,e){this.mix=1;this.bendDirection=0;if(null==a)throw Error('data cannot be null.');if(null==e)throw Error('skeleton cannot be null.');this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var b=0;bb.ascaleX&&(k+=180);180k&&(k+=360);b.updateWorldTransformWith(b.ax,b.ay, +b.arotation+k*c,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};e.prototype.apply2=function(b,e,g,c,k,n){if(0==n)e.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();e.appliedValid||e.updateAppliedTransform();var l=b.ax,m=b.ay,h=b.ascaleX,d=b.ascaleY,v=e.ascaleX,w,y,x;0>h?(h=-h,w=180,x=-1):(w=0,x=1);0>d&&(d=-d,x=-x);0>v?(v=-v,y=180):y=0;var q=e.ax,u,A,E,D=b.a,C=b.b,F=b.c,z=b.d,H=1E-4>=Math.abs(h-d);H?(u=e.ay,A=D*q+C*u+b.worldX,E=F*q+z*u+b.worldY):(u=0,A=D*q+b.worldX,E=F*q+b.worldY); +var G=b.parent,D=G.a,C=G.b,F=G.c,z=G.d,O=1/(D*z-C*F);g-=G.worldX;c-=G.worldY;var M=(g*z-c*C)*O-l,J=(c*D-g*F)*O-m;g=A-G.worldX;c=E-G.worldY;C=(g*z-c*C)*O-l;D=(c*D-g*F)*O-m;O=Math.sqrt(C*C+D*D);C=e.data.length*v;a:if(H)C*=h,D=(M*M+J*J-O*O-C*C)/(2*O*C),-1>D?D=-1:1g&&(z=-z),z=-(g+z)/2,g=z/J,z=F/z,z= +Math.abs(g)E&&(d=0,E=z,G=g);g=O-D;z=g*g;zE&&(d=v,E=z,G=g,P=c);H<=(F+E)/2?(D=M-Math.atan2(A*k,J),k*=h):(D=M-Math.atan2(P*k,G),k*=d)}C=Math.atan2(u,q)*x;O=b.arotation;D=(D-C)*a.MathUtils.radDeg+w-O;180D&&(D+= +360);b.updateWorldTransformWith(l,m,O+D*n,b.ascaleX,b.ascaleY,0,0);O=e.arotation;k=((k+C)*a.MathUtils.radDeg-e.ashearX)*x+y-O;180k&&(k+=360);e.updateWorldTransformWith(q,u,O+k*n,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};return e}();a.IkConstraint=e})(spine||(spine={}));(function(a){var e=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=e})(spine||(spine={})); +(function(a){var e=function(){function e(a,e){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==a)throw Error('data cannot be null.');if(null==e)throw Error('skeleton cannot be null.');this.data=a;this.bones=[];for(var b=0,c=a.bones.length;ba.MathUtils.PI?G-=a.MathUtils.PI2:G<-a.MathUtils.PI&&(G+=a.MathUtils.PI2);G*=e;O=Math.cos(G);M=Math.sin(G);D.a=O*F-M*z;D.b=O*C-M*H;D.c=M*F+O*z;D.d=M*C+O*H}D.appliedValid=!1}}}};e.prototype.computeWorldPositions= +function(b,l,g,c,k){var n=this.target,m=this.position,t=this.spaces,h=a.Utils.setArraySize(this.positions,3*l+2),d,v=b.closed,w=b.worldVerticesLength,y=w/6,x=e.NONE;if(!b.constantSpeed){var q=b.lengths,y=y-(v?1:2),u=q[y];c&&(m*=u);if(k)for(var A=0;AD&&(D+=u),k=0;else if(0>D){x!=e.BEFORE&&(x=e.BEFORE,b.computeWorldVerticesWith(n,2,4,d,0));this.addBeforePosition(D,d,0,h,c);continue}else if(D> +u){x!=e.AFTER&&(x=e.AFTER,b.computeWorldVerticesWith(n,w-6,4,d,0));this.addAfterPosition(D-u,d,0,h,c);continue}for(;;k++){var C=q[k];if(!(D>C)){if(0==k)D/=C;else var F=q[k-1],D=(D-F)/(C-F);break}}k!=x&&(x=k,v&&k==y?(b.computeWorldVerticesWith(n,w-4,4,d,0),b.computeWorldVerticesWith(n,0,4,d,4)):b.computeWorldVerticesWith(n,6*k+2,8,d,0));this.addCurvePosition(D,d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],h,c,g||0D&&(D+=n),k=0;else if(0>D){this.addBeforePosition(D,d,0,h,c);continue}else if(D>n){this.addAfterPosition(D-n,d,w-4,h,c);continue}for(;;k++)if(V=b[k],!(D>V)){0==k?D/=V:(F=b[k-1],D=(D-F)/(V-F));break}if(k!=x){var x=k,fa=6*k,q=d[fa],u=d[fa+1],C=d[fa+2],z=d[fa+3], -H=d[fa+4],G=d[fa+5],O=d[fa+6],M=d[fa+7];J=.03*(q-2*C+H);P=.03*(u-2*z+G);F=.006*(3*(C-H)-q+O);N=.006*(3*(z-G)-u+M);V=2*J+F;X=2*P+N;J=.3*(C-q)+J+.16666667*F;P=.3*(z-u)+P+.16666667*N;T=Math.sqrt(J*J+P*P);y[0]=T;for(fa=1;8>fa;fa++)J+=V,P+=X,V+=F,X+=N,T+=Math.sqrt(J*J+P*P),y[fa]=T;J+=V;P+=X;T+=Math.sqrt(J*J+P*P);y[8]=T;J+=V+F;P+=X+N;T+=Math.sqrt(J*J+P*P);y[9]=T;N=0}for(D*=T;;N++)if(V=y[N],!(D>V)){0==N?D/=V:(F=y[N-1],D=N+(D-F)/(V-F));break}this.addCurvePosition(.1*D,q,u,C,z,H,G,O,M,h,c,f||0f.status?c.rawAssets[b]=f.responseText:c.errors[b]="Couldn't load text "+b+': status '+f.status+', '+f.responseText)};f.open('GET',b,!0);f.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var f= -new XMLHttpRequest;f.onreadystatechange=function(){f.readyState==XMLHttpRequest.DONE&&(200<=f.status&&300>f.status?c.rawAssets[b]=JSON.parse(f.responseText):c.errors[b]="Couldn't load text "+b+': status '+f.status+', '+f.responseText)};f.open('GET',b,!0);f.send()}};a.prototype.loadTexture=function(a,b,c){var f=this;c=this.pathPrefix+c;if(this.queueAsset(a,b,c)){var g=new Image;g.src=c;g.crossOrigin='anonymous';g.onload=function(a){f.rawAssets[c]=g};g.onerror=function(a){f.errors[c]="Couldn't load image "+ -c}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;a=this.clientAssets[a];return null===a||void 0===a?!0:a.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;bfa;fa++)J+=V,P+=X,V+=F,X+=N,T+=Math.sqrt(J*J+P*P),y[fa]=T;J+=V;P+=X;T+=Math.sqrt(J*J+P*P);y[8]=T;J+=V+F;P+=X+N;T+=Math.sqrt(J*J+P*P);y[9]=T;N=0}for(D*=T;;N++)if(V=y[N],!(D>V)){0==N?D/=V:(F=y[N-1],D=N+(D-F)/(V-F));break}this.addCurvePosition(.1*D,q,u,C,z,H,G,O,M,h,c,g||0g.status?c.rawAssets[b]=g.responseText:c.errors[b]="Couldn't load text "+b+': status '+g.status+', '+g.responseText)};g.open('GET',b,!0);g.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var g= +new XMLHttpRequest;g.onreadystatechange=function(){g.readyState==XMLHttpRequest.DONE&&(200<=g.status&&300>g.status?c.rawAssets[b]=JSON.parse(g.responseText):c.errors[b]="Couldn't load text "+b+': status '+g.status+', '+g.responseText)};g.open('GET',b,!0);g.send()}};a.prototype.loadTexture=function(a,b,c){var g=this;c=this.pathPrefix+c;if(this.queueAsset(a,b,c)){var e=new Image;e.src=c;e.crossOrigin='anonymous';e.onload=function(a){g.rawAssets[c]=e};e.onerror=function(a){g.errors[c]="Couldn't load image "+ +c}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;a=this.clientAssets[a];return null===a||void 0===a?!0:a.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;b=this.minX&&a<=this.maxX&&g>=this.minY&&g<=this.maxY};g.prototype.aabbIntersectsSegment=function(a,g,f,c){var b=this.minX,l=this.minY,m=this.maxX,t=this.maxY;if(a<=b&&f<=b||g<=l&&c<=l||a>=m&&f>=m||g>=t&&c>=t)return!1;f=(c-g)/(f-a);c=f*(b-a)+g;if(c>l&&cl&&cb&&lb&&la.minX&&this.minYa.minY};g.prototype.containsPoint=function(a,g){for(var b=this.polygons,c=0,k=b.length;c=f||h=f){var d=a[m];d+(f-t)/(h-t)*(a[k]-d)< -g&&(l=!l)}k=m}return l};g.prototype.intersectsSegment=function(a,g,f,c){for(var b=this.polygons,l=0,m=b.length;l=d&&u<=y||u>=y&&u<=d)&&(u>=g&&u<=c||u>=c&&u<=g)&&(d=(h*A-m*q)/E,(d>=v&&d<=x||d>=x&&d<=v)&&(d>= -f&&d<=k||d>=k&&d<=f)))return!0;d=y;v=x}return!1};g.prototype.getPolygon=function(a){if(null==a)throw Error('boundingBox cannot be null.');a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};g.prototype.getWidth=function(){return this.maxX-this.minX};g.prototype.getHeight=function(){return this.maxY-this.minY};return g}();a.SkeletonBounds=g})(spine||(spine={})); -(function(a){var g=function(){function a(){this.bones=[];this.slots=[];this.skins=[];this.events=[];this.animations=[];this.ikConstraints=[];this.transformConstraints=[];this.pathConstraints=[];this.fps=0}a.prototype.findBone=function(a){if(null==a)throw Error('boneName cannot be null.');for(var b=this.bones,f=0,c=b.length;f=this.minX&&a<=this.maxX&&e>=this.minY&&e<=this.maxY};e.prototype.aabbIntersectsSegment=function(a,e,g,c){var b=this.minX,l=this.minY,m=this.maxX,t=this.maxY;if(a<=b&&g<=b||e<=l&&c<=l||a>=m&&g>=m||e>=t&&c>=t)return!1;g=(c-e)/(g-a);c=g*(b-a)+e;if(c>l&&cl&&cb&&lb&&la.minX&&this.minYa.minY};e.prototype.containsPoint=function(a,e){for(var b=this.polygons,c=0,k=b.length;c=g||h=g){var d=a[m];d+(g-t)/(h-t)*(a[k]-d)< +e&&(l=!l)}k=m}return l};e.prototype.intersectsSegment=function(a,e,g,c){for(var b=this.polygons,l=0,m=b.length;l=d&&u<=y||u>=y&&u<=d)&&(u>=e&&u<=c||u>=c&&u<=e)&&(d=(h*A-m*q)/E,(d>=v&&d<=x||d>=x&&d<=v)&&(d>= +g&&d<=k||d>=k&&d<=g)))return!0;d=y;v=x}return!1};e.prototype.getPolygon=function(a){if(null==a)throw Error('boundingBox cannot be null.');a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};e.prototype.getWidth=function(){return this.maxX-this.minX};e.prototype.getHeight=function(){return this.maxY-this.minY};return e}();a.SkeletonBounds=e})(spine||(spine={})); +(function(a){var e=function(){function a(){this.bones=[];this.slots=[];this.skins=[];this.events=[];this.animations=[];this.ikConstraints=[];this.transformConstraints=[];this.pathConstraints=[];this.fps=0}a.prototype.findBone=function(a){if(null==a)throw Error('boneName cannot be null.');for(var b=this.bones,g=0,c=b.length;g=b.length&&(b.length=a+1);b[a]||(b[a]={});b[a][g]=f};a.prototype.getAttachment=function(a,g){return(a=this.attachments[a])?a[g]:null};a.prototype.attachAll=function(a,g){for(var b=0,c=0;cg)throw Error('index must be >= 0.');if(null==b)throw Error('name cannot be null.');if(null==l)throw Error('boneData cannot be null.');this.index=g;this.name=b;this.boneData=l}}();a.SlotData=g})(spine||(spine={})); -(function(a){var g=function(){function a(a){this._image=a}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case 'nearest':return m.Nearest;case 'linear':return m.Linear;case 'mipmap':return m.MipMap;case 'mipmapnearestnearest':return m.MipMapNearestNearest;case 'mipmaplinearnearest':return m.MipMapLinearNearest;case 'mipmapnearestlinear':return m.MipMapNearestLinear;case 'mipmaplinearlinear':return m.MipMapLinearLinear;default:throw Error('Unknown texture filter '+ -a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case 'mirroredtepeat':return b.MirroredRepeat;case 'clamptoedge':return b.ClampToEdge;case 'repeat':return b.Repeat;default:throw Error('Unknown texture wrap '+a);}};return a}();a.Texture=g;(function(a){a[a.Nearest=9728]='Nearest';a[a.Linear=9729]='Linear';a[a.MipMap=9987]='MipMap';a[a.MipMapNearestNearest=9984]='MipMapNearestNearest';a[a.MipMapLinearNearest=9985]='MipMapLinearNearest';a[a.MipMapNearestLinear=9986]='MipMapNearestLinear';a[a.MipMapLinearLinear= -9987]='MipMapLinearLinear'})(a.TextureFilter||(a.TextureFilter={}));var m=a.TextureFilter;(function(a){a[a.MirroredRepeat=33648]='MirroredRepeat';a[a.ClampToEdge=33071]='ClampToEdge';a[a.Repeat=10497]='Repeat'})(a.TextureWrap||(a.TextureWrap={}));var b=a.TextureWrap,g=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=g})(spine||(spine={})); -(function(a){var g=function(){function f(a,b){this.pages=[];this.regions=[];this.load(a,b)}f.prototype.load=function(c,f){if(null==f)throw Error('textureLoader cannot be null.');c=new m(c);for(var g=Array(4),k=null;;){var t=c.readLine();if(null==t)break;t=t.trim();if(0==t.length)k=null;else if(k){var h=new l;h.name=t;h.page=k;h.rotate='true'==c.readValue();c.readTuple(g);var t=parseInt(g[0]),d=parseInt(g[1]);c.readTuple(g);var v=parseInt(g[0]),w=parseInt(g[1]);h.u=t/k.width;h.v=d/k.height;h.rotate? -(h.u2=(t+w)/k.width,h.v2=(d+v)/k.height):(h.u2=(t+v)/k.width,h.v2=(d+w)/k.height);h.x=t;h.y=d;h.width=Math.abs(v);h.height=Math.abs(w);4==c.readTuple(g)&&4==c.readTuple(g)&&c.readTuple(g);h.originalWidth=parseInt(g[0]);h.originalHeight=parseInt(g[1]);c.readTuple(g);h.offsetX=parseInt(g[0]);h.offsetY=parseInt(g[1]);h.index=parseInt(c.readValue());h.texture=k.texture;this.regions.push(h)}else k=new b,k.name=t,2==c.readTuple(g)&&(k.width=parseInt(g[0]),k.height=parseInt(g[1]),c.readTuple(g)),c.readTuple(g), -k.minFilter=a.Texture.filterFromString(g[0]),k.magFilter=a.Texture.filterFromString(g[1]),h=c.readValue(),k.uWrap=a.TextureWrap.ClampToEdge,k.vWrap=a.TextureWrap.ClampToEdge,'x'==h?k.uWrap=a.TextureWrap.Repeat:'y'==h?k.vWrap=a.TextureWrap.Repeat:'xy'==h&&(k.uWrap=k.vWrap=a.TextureWrap.Repeat),k.texture=f(t),k.texture.setFilters(k.minFilter,k.magFilter),k.texture.setWraps(k.uWrap,k.vWrap),k.width=k.texture.getImage().width,k.height=k.texture.getImage().height,this.pages.push(k)}};f.prototype.findRegion= -function(a){for(var b=0;b=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(':');if(-1==b)throw Error('Invalid line: '+ -a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(':');if(-1==c)throw Error('Invalid line: '+b);for(var f=0,c=c+1;3>f;f++){var g=b.indexOf(',',c);if(-1==g)break;a[f]=b.substr(c,g-c).trim();c=g+1}a[f]=b.substring(c).trim();return f+1};return a}(),b=function(){return function(){}}();a.TextureAtlasPage=b;var l=function(a){function b(){a.apply(this,arguments)}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=l})(spine||(spine={})); -(function(a){var g=function(){function g(b,g){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==b)throw Error('data cannot be null.');if(null==g)throw Error('skeleton cannot be null.');this.data=b;this.rotateMix=b.rotateMix;this.translateMix=b.translateMix;this.scaleMix=b.scaleMix;this.shearMix=b.shearMix;this.bones=[];for(var f=0;fa.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2);var C=C*b,F=Math.cos(C), -C=Math.sin(C);q.a=F*A-C*E;q.b=F*u-C*D;q.c=C*A+F*E;q.d=C*u+F*D;u=!0}0!=g&&(u=this.temp,k.localToWorld(u.set(this.data.offsetX,this.data.offsetY)),q.worldX+=(u.x-q.worldX)*g,q.worldY+=(u.y-q.worldY)*g,u=!0);0a.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2),C=A+(C+d)*c,u=Math.sqrt(u*u+D*D),q.b=Math.cos(C)*u,q.d=Math.sin(C)*u,u=!0);u&&(q.appliedValid=!1)}};g.prototype.getOrder=function(){return this.data.order};return g}();a.TransformConstraint=g})(spine||(spine={})); -(function(a){var g=function(){return function(a){this.order=0;this.bones=[];this.offsetShearY=this.offsetScaleY=this.offsetScaleX=this.offsetY=this.offsetX=this.offsetRotation=this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;if(null==a)throw Error('name cannot be null.');this.name=a}}();a.TransformConstraintData=g})(spine||(spine={})); -(function(a){var g=function(){function a(){this.array=[]}a.prototype.add=function(a){var b=this.contains(a);this.array[a|0]=a|0;return!b};a.prototype.contains=function(a){return void 0!=this.array[a|0]};a.prototype.remove=function(a){this.array[a|0]=void 0};a.prototype.clear=function(){this.array.length=0};return a}();a.IntSet=g;g=function(){function a(a,g,f,c){void 0===a&&(a=0);void 0===g&&(g=0);void 0===f&&(f=0);void 0===c&&(c=0);this.r=a;this.g=g;this.b=f;this.a=c}a.prototype.set=function(a,g, -f,c){this.r=a;this.g=g;this.b=f;this.a=c;this.clamp();return this};a.prototype.setFromColor=function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a;return this};a.prototype.setFromString=function(a){a='#'==a.charAt(0)?a.substr(1):a;this.r=parseInt(a.substr(0,2),16)/255;this.g=parseInt(a.substr(2,2),16)/255;this.b=parseInt(a.substr(4,2),16)/255;this.a=(8!=a.length?255:parseInt(a.substr(6,2),16))/255;return this};a.prototype.add=function(a,g,f,c){this.r+=a;this.g+=g;this.b+=f;this.a+=c;this.clamp(); -return this};a.prototype.clamp=function(){0>this.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1f?f:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b* -a.degRad)};a.signum=function(a){return 0a?-1:0};a.toInt=function(a){return 0a?-b:b};a.PI=3.1415927;a.PI2=2*a.PI;a.radiansToDegrees=180/a.PI;a.radDeg=a.radiansToDegrees;a.degreesToRadians=a.PI/180;a.degRad=a.degreesToRadians;return a}();a.MathUtils=g;g=function(){function a(){}a.arrayCopy=function(a,g,f,c,k){for(var b=g;b=g?b:a.setArraySize(b,g,f)};a.newArray=function(a,g){for(var b=Array(a),c=0;cthis.maxDelta&&(this.delta=this.maxDelta);this.lastTime=a;this.frameCount++;1h;++h)b[h]=0;for(h=0;30-c>h;++h)b[h+c]=h/c| -0;c=f;for(h=0;30>h;++h)d[h]=c,c+=1<h;++h)b.table[h]=0;for(h=0;f>h;++h)b.table[d[c+h]]++;for(h=g=b.table[0]=0;16>h;++h)D[h]=g,g+=b.table[h];for(h=0;f>h;++h)d[c+h]&&(b.trans[D[d[c+h]]++]=h)}function n(b,d,c){if(!d)return c;for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>16-d;return b.tag>>>=d,b.bitcount-=d,f+c}function p(b,d){for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>=1,++h,c+=d.table[h],f-=d.table[h];while(0<=f);return b.tag=g,b.bitcount-=h,d.trans[c+f]}function t(b,d,c){for(;;){var f=p(b,d);if(256===f)return h;if(256>f)b.dest[b.destLen++]=f;else{var g,k,f=f-257,f=n(b,w[f],y[f]);g=p(b,c);for(k=g=b.destLen-n(b,x[g],q[g]);g+f>k;++k)b.dest[b.destLen++]=b.dest[k]}}}var h=0,d=new l,v=new l,w=new Uint8Array(30),y=new Uint16Array(30),x=new Uint8Array(30),q=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4, -12,3,13,2,14,1,15]),A=new l,E=new Uint8Array(320),D=new Uint16Array(16);(function(b,d){var c;for(c=0;7>c;++c)b.table[c]=0;b.table[7]=24;b.table[8]=152;b.table[9]=112;for(c=0;24>c;++c)b.trans[c]=256+c;for(c=0;144>c;++c)b.trans[24+c]=c;for(c=0;8>c;++c)b.trans[168+c]=280+c;for(c=0;112>c;++c)b.trans[176+c]=144+c;for(c=0;5>c;++c)d.table[c]=0;d.table[5]=32;for(c=0;32>c;++c)d.trans[c]=c})(d,v);c(w,y,4,3);c(x,q,2,1);w[28]=0;y[28]=258;m.exports=function(b,c){var g;b=new f(b,c);do{c=b;c.bitcount--||(c.tag= -c.source[c.sourceIndex++],c.bitcount=7);g=1&c.tag;switch(c=(c.tag>>>=1,g),n(b,2,0)){case 0:var l,m=l=void 0;for(g=b;8w;++w)E[w]=0;for(w=0;q>w;++w){var C=n(m,3,0);E[u[w]]=C}k(A,E,0,19);for(w=0;l+g>w;)switch(q=p(m,A),q){case 16:C=E[w-1];for(q=n(m,2,3);q;--q)E[w++]=C;break;case 17:for(q=n(m,3,3);q;--q)E[w++]=0;break;case 18:for(q=n(m,7,11);q;--q)E[w++]=0;break;default:E[w++]=q}k(x,E,0,l);k(y,E,l,g);g=t(b,b.ltree,b.dtree);break;default:g=-3}if(g!==h)throw Error('Data error');}while(!c);return b.destLen=b.length&&(b.length=a+1);b[a]||(b[a]={});b[a][e]=g};a.prototype.getAttachment=function(a,e){return(a=this.attachments[a])?a[e]:null};a.prototype.attachAll=function(a,e){for(var b=0,c=0;ce)throw Error('index must be >= 0.');if(null==b)throw Error('name cannot be null.');if(null==l)throw Error('boneData cannot be null.');this.index=e;this.name=b;this.boneData=l}}();a.SlotData=e})(spine||(spine={})); +(function(a){var e=function(){function a(a){this._image=a}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case 'nearest':return m.Nearest;case 'linear':return m.Linear;case 'mipmap':return m.MipMap;case 'mipmapnearestnearest':return m.MipMapNearestNearest;case 'mipmaplinearnearest':return m.MipMapLinearNearest;case 'mipmapnearestlinear':return m.MipMapNearestLinear;case 'mipmaplinearlinear':return m.MipMapLinearLinear;default:throw Error('Unknown texture filter '+ +a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case 'mirroredtepeat':return b.MirroredRepeat;case 'clamptoedge':return b.ClampToEdge;case 'repeat':return b.Repeat;default:throw Error('Unknown texture wrap '+a);}};return a}();a.Texture=e;(function(a){a[a.Nearest=9728]='Nearest';a[a.Linear=9729]='Linear';a[a.MipMap=9987]='MipMap';a[a.MipMapNearestNearest=9984]='MipMapNearestNearest';a[a.MipMapLinearNearest=9985]='MipMapLinearNearest';a[a.MipMapNearestLinear=9986]='MipMapNearestLinear';a[a.MipMapLinearLinear= +9987]='MipMapLinearLinear'})(a.TextureFilter||(a.TextureFilter={}));var m=a.TextureFilter;(function(a){a[a.MirroredRepeat=33648]='MirroredRepeat';a[a.ClampToEdge=33071]='ClampToEdge';a[a.Repeat=10497]='Repeat'})(a.TextureWrap||(a.TextureWrap={}));var b=a.TextureWrap,e=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=e})(spine||(spine={})); +(function(a){var e=function(){function g(a,b){this.pages=[];this.regions=[];this.load(a,b)}g.prototype.load=function(c,g){if(null==g)throw Error('textureLoader cannot be null.');c=new m(c);for(var e=Array(4),k=null;;){var t=c.readLine();if(null==t)break;t=t.trim();if(0==t.length)k=null;else if(k){var h=new l;h.name=t;h.page=k;h.rotate='true'==c.readValue();c.readTuple(e);var t=parseInt(e[0]),d=parseInt(e[1]);c.readTuple(e);var v=parseInt(e[0]),w=parseInt(e[1]);h.u=t/k.width;h.v=d/k.height;h.rotate? +(h.u2=(t+w)/k.width,h.v2=(d+v)/k.height):(h.u2=(t+v)/k.width,h.v2=(d+w)/k.height);h.x=t;h.y=d;h.width=Math.abs(v);h.height=Math.abs(w);4==c.readTuple(e)&&4==c.readTuple(e)&&c.readTuple(e);h.originalWidth=parseInt(e[0]);h.originalHeight=parseInt(e[1]);c.readTuple(e);h.offsetX=parseInt(e[0]);h.offsetY=parseInt(e[1]);h.index=parseInt(c.readValue());h.texture=k.texture;this.regions.push(h)}else k=new b,k.name=t,2==c.readTuple(e)&&(k.width=parseInt(e[0]),k.height=parseInt(e[1]),c.readTuple(e)),c.readTuple(e), +k.minFilter=a.Texture.filterFromString(e[0]),k.magFilter=a.Texture.filterFromString(e[1]),h=c.readValue(),k.uWrap=a.TextureWrap.ClampToEdge,k.vWrap=a.TextureWrap.ClampToEdge,'x'==h?k.uWrap=a.TextureWrap.Repeat:'y'==h?k.vWrap=a.TextureWrap.Repeat:'xy'==h&&(k.uWrap=k.vWrap=a.TextureWrap.Repeat),k.texture=g(t),k.texture.setFilters(k.minFilter,k.magFilter),k.texture.setWraps(k.uWrap,k.vWrap),k.width=k.texture.getImage().width,k.height=k.texture.getImage().height,this.pages.push(k)}};g.prototype.findRegion= +function(a){for(var b=0;b=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(':');if(-1==b)throw Error('Invalid line: '+ +a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(':');if(-1==c)throw Error('Invalid line: '+b);for(var g=0,c=c+1;3>g;g++){var e=b.indexOf(',',c);if(-1==e)break;a[g]=b.substr(c,e-c).trim();c=e+1}a[g]=b.substring(c).trim();return g+1};return a}(),b=function(){return function(){}}();a.TextureAtlasPage=b;var l=function(a){function b(){a.apply(this,arguments)}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=l})(spine||(spine={})); +(function(a){var e=function(){function e(b,e){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==b)throw Error('data cannot be null.');if(null==e)throw Error('skeleton cannot be null.');this.data=b;this.rotateMix=b.rotateMix;this.translateMix=b.translateMix;this.scaleMix=b.scaleMix;this.shearMix=b.shearMix;this.bones=[];for(var g=0;ga.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2);var C=C*b,F=Math.cos(C), +C=Math.sin(C);q.a=F*A-C*E;q.b=F*u-C*D;q.c=C*A+F*E;q.d=C*u+F*D;u=!0}0!=e&&(u=this.temp,k.localToWorld(u.set(this.data.offsetX,this.data.offsetY)),q.worldX+=(u.x-q.worldX)*e,q.worldY+=(u.y-q.worldY)*e,u=!0);0a.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2),C=A+(C+d)*c,u=Math.sqrt(u*u+D*D),q.b=Math.cos(C)*u,q.d=Math.sin(C)*u,u=!0);u&&(q.appliedValid=!1)}};e.prototype.getOrder=function(){return this.data.order};return e}();a.TransformConstraint=e})(spine||(spine={})); +(function(a){var e=function(){return function(a){this.order=0;this.bones=[];this.offsetShearY=this.offsetScaleY=this.offsetScaleX=this.offsetY=this.offsetX=this.offsetRotation=this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;if(null==a)throw Error('name cannot be null.');this.name=a}}();a.TransformConstraintData=e})(spine||(spine={})); +(function(a){var e=function(){function a(){this.array=[]}a.prototype.add=function(a){var b=this.contains(a);this.array[a|0]=a|0;return!b};a.prototype.contains=function(a){return void 0!=this.array[a|0]};a.prototype.remove=function(a){this.array[a|0]=void 0};a.prototype.clear=function(){this.array.length=0};return a}();a.IntSet=e;e=function(){function a(a,e,g,c){void 0===a&&(a=0);void 0===e&&(e=0);void 0===g&&(g=0);void 0===c&&(c=0);this.r=a;this.g=e;this.b=g;this.a=c}a.prototype.set=function(a,e, +g,c){this.r=a;this.g=e;this.b=g;this.a=c;this.clamp();return this};a.prototype.setFromColor=function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a;return this};a.prototype.setFromString=function(a){a='#'==a.charAt(0)?a.substr(1):a;this.r=parseInt(a.substr(0,2),16)/255;this.g=parseInt(a.substr(2,2),16)/255;this.b=parseInt(a.substr(4,2),16)/255;this.a=(8!=a.length?255:parseInt(a.substr(6,2),16))/255;return this};a.prototype.add=function(a,e,g,c){this.r+=a;this.g+=e;this.b+=g;this.a+=c;this.clamp(); +return this};a.prototype.clamp=function(){0>this.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1g?g:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b* +a.degRad)};a.signum=function(a){return 0a?-1:0};a.toInt=function(a){return 0a?-b:b};a.PI=3.1415927;a.PI2=2*a.PI;a.radiansToDegrees=180/a.PI;a.radDeg=a.radiansToDegrees;a.degreesToRadians=a.PI/180;a.degRad=a.degreesToRadians;return a}();a.MathUtils=e;e=function(){function a(){}a.arrayCopy=function(a,e,g,c,k){for(var b=e;b=e?b:a.setArraySize(b,e,g)};a.newArray=function(a,e){for(var b=Array(a),c=0;cthis.maxDelta&&(this.delta=this.maxDelta);this.lastTime=a;this.frameCount++;1g;++g)b[g]=0;for(g=0;30-c>g;++g)b[g+c]=g/c| +0;c=e;for(g=0;30>g;++g)d[g]=c,c+=1<g;++g)b.table[g]=0;for(g=0;e>g;++g)b.table[d[c+g]]++;for(g=h=b.table[0]=0;16>g;++g)D[g]=h,h+=b.table[g];for(g=0;e>g;++g)d[c+g]&&(b.trans[D[d[c+g]]++]=g)}function n(b,d,c){if(!d)return c;for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>16-d;return b.tag>>>=d,b.bitcount-=d,e+c}function p(b,d){for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>=1,++g,c+=d.table[g],e-=d.table[g];while(0<=e);return b.tag=h,b.bitcount-=g,d.trans[c+e]}function t(b,d,c){for(;;){var e=p(b,d);if(256===e)return h;if(256>e)b.dest[b.destLen++]=e;else{var g,k,e=e-257,e=n(b,w[e],y[e]);g=p(b,c);for(k=g=b.destLen-n(b,x[g],q[g]);g+e>k;++k)b.dest[b.destLen++]=b.dest[k]}}}var h=0,d=new l,v=new l,w=new Uint8Array(30),y=new Uint16Array(30),x=new Uint8Array(30),q=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4, +12,3,13,2,14,1,15]),A=new l,E=new Uint8Array(320),D=new Uint16Array(16);(function(b,d){var c;for(c=0;7>c;++c)b.table[c]=0;b.table[7]=24;b.table[8]=152;b.table[9]=112;for(c=0;24>c;++c)b.trans[c]=256+c;for(c=0;144>c;++c)b.trans[24+c]=c;for(c=0;8>c;++c)b.trans[168+c]=280+c;for(c=0;112>c;++c)b.trans[176+c]=144+c;for(c=0;5>c;++c)d.table[c]=0;d.table[5]=32;for(c=0;32>c;++c)d.trans[c]=c})(d,v);c(w,y,4,3);c(x,q,2,1);w[28]=0;y[28]=258;m.exports=function(b,c){var e;b=new g(b,c);do{c=b;c.bitcount--||(c.tag= +c.source[c.sourceIndex++],c.bitcount=7);e=1&c.tag;switch(c=(c.tag>>>=1,e),n(b,2,0)){case 0:var l,m=l=void 0;for(e=b;8w;++w)E[w]=0;for(w=0;q>w;++w){var C=n(m,3,0);E[u[w]]=C}k(A,E,0,19);for(w=0;l+e>w;)switch(q=p(m,A),q){case 16:C=E[w-1];for(q=n(m,2,3);q;--q)E[w++]=C;break;case 17:for(q=n(m,3,3);q;--q)E[w++]=0;break;case 18:for(q=n(m,7,11);q;--q)E[w++]=0;break;default:E[w++]=q}k(x,E,0,l);k(y,E,l,e);e=t(b,b.ltree,b.dtree);break;default:e=-3}if(e!==h)throw Error('Data error');}while(!c);return b.destLenb.descender,'Descender should be negative (e.g. -512).'),this.names={fontFamily:{en:b.familyName||' '},fontSubfamily:{en:b.styleName||' '}, fullName:{en:b.fullName||b.familyName+' '+b.styleName},postScriptName:{en:b.postScriptName||b.familyName+b.styleName},designer:{en:b.designer||' '},designerURL:{en:b.designerURL||' '},manufacturer:{en:b.manufacturer||' '},manufacturerURL:{en:b.manufacturerURL||' '},license:{en:b.license||' '},licenseURL:{en:b.licenseURL||' '},version:{en:b.version||'Version 0.1'},description:{en:b.description||' '},copyright:{en:b.copyright||' '},trademark:{en:b.trademark||' '}},this.unitsPerEm=b.unitsPerEm||1E3, -this.ascender=b.ascender,this.descender=b.descender,this.createdTimestamp=b.createdTimestamp,this.tables={os2:{usWeightClass:b.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:b.widthClass||this.usWidthClasses.MEDIUM,fsSelection:b.fsSelection||this.fsSelectionValues.REGULAR}});this.supported=!0;this.glyphs=new n.GlyphSet(this,b.glyphs||[]);this.encoding=new k.DefaultEncoding(this);this.substitution=new p(this);this.tables=this.tables||{}}var f=g('./path'),c=g('./tables/sfnt'),k=g('./encoding'), -n=g('./glyphset'),p=g('./substitution'),t=g('./util');l.prototype.hasChar=function(b){return null!==this.encoding.charToGlyphIndex(b)};l.prototype.charToGlyphIndex=function(b){return this.encoding.charToGlyphIndex(b)};l.prototype.charToGlyph=function(b){b=this.charToGlyphIndex(b);b=this.glyphs.get(b);return b||(b=this.glyphs.get(0)),b};l.prototype.stringToGlyphs=function(b){for(var d=[],c=0;c=c;){var k=c+g>>>1,h=b[k].tag;if(h===f)return k;f>h?c=k+1:g=k-1}return-c-1}var f=g('./check');m.exports={searchTag:l,binSearch:function(b,f){for(var c=0,g=b.length-1;g>=c;){var k=c+g>>>1,h=b[k];if(h===f)return k;f>h?c=k+1:g=k-1}return-c-1},getScriptNames:function(){var b=this.getGsubTable();return b?b.scripts.map(function(b){return b.tag}):[]},getScriptTable:function(b,f){var c=this.getGsubTable(f);if(c){f=c.scripts;c=l(c.scripts,b);if(0<=c)return f[c].script;b={tag:b,script:{defaultLangSys:{reserved:0, -reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return f.splice(-1-c,0,b.script),b}},getLangSysTable:function(b,f,g){if(b=this.getScriptTable(b,g)){if('DFLT'===f)return b.defaultLangSys;var c=l(b.langSysRecords,f);if(0<=c)return b.langSysRecords[c].langSys;if(g)return f={tag:f,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}},b.langSysRecords.splice(-1-c,0,f),f.langSys}},getFeatureTable:function(b,g,l,m){if(b=this.getLangSysTable(b,g,m)){var c;b=b.featureIndexes;g=this.font.tables.gsub.features; -for(var h=0;h=g[m-1].tag,'Features must be added in alphabetical order.'),c={tag:l,feature:{params:0,lookupListIndexes:[]}},g.push(c),b.push(m),c.feature}},getLookupTable:function(b,f,g,l,m){if(b=this.getFeatureTable(b,f,g,m)){var c;b=b.lookupListIndexes;f=this.font.tables.gsub.lookups;for(g=0;gf;f++)for(var g=b[f],l=g.end,g=g.start;l>=g;g++)c.push(g);return c}}},{'./check':2}],9:[function(g,m,b){function l(b,d){g('fs').readFile(b,function(b,c){return b?d(b.message):void d(null,w.nodeBufferToArrayBuffer(c))})}function f(b,d){var c=new XMLHttpRequest;c.open('get',b,!0);c.responseType='arraybuffer';c.onload=function(){return 200!==c.status?d('Font could not be loaded: '+ -c.statusText):d(null,c.response)};c.send()}function c(b,c){for(var f=[],g=12,h=0;c>h;h+=1){var k=d.getTag(b,g),l=d.getULong(b,g+4),n=d.getULong(b,g+8),m=d.getULong(b,g+12);f.push({tag:k,checksum:l,offset:n,length:m,compression:!1});g+=16}return f}function k(b,d){if('WOFF'===d.compression){b=new Uint8Array(b.buffer,d.offset+2,d.compressedLength-2);var c=new Uint8Array(d.originalLength);if(p(b,c),c.byteLength!==d.originalLength)throw Error('Decompression error: '+d.tag+" decompressed length doesn't match recorded length"); -return{data:new DataView(c.buffer,0),offset:0}}return{data:b,offset:d.offset}}function n(b){var f,g,l,n=new h.Font({empty:!0});b=new DataView(b,0);var m;l=d.getTag(b,0);if(l===String.fromCharCode(0,1,0,0))n.outlinesFormat='truetype',l=d.getUShort(b,4),m=c(b,l);else if('OTTO'===l)n.outlinesFormat='cff',l=d.getUShort(b,4),m=c(b,l);else{if('wOFF'!==l)throw Error('Unsupported OpenType signature '+l);m=d.getTag(b,4);if(m===String.fromCharCode(0,1,0,0))n.outlinesFormat='truetype';else{if('OTTO'!==m)throw Error('Unsupported OpenType flavor '+ -l);n.outlinesFormat='cff'}m=l=d.getUShort(b,12);for(var p=[],v=44,w=0;m>w;w+=1){var V=d.getTag(b,v),R=d.getULong(b,v+4),Y=d.getULong(b,v+8),na=d.getULong(b,v+12);p.push({tag:V,offset:R,compression:na>Y?'WOFF':!1,compressedLength:Y,originalLength:na});v+=20}m=p}for(var la,ca,Ba,ha,ua,ea,ia,qa,ra,Aa,p=0;l>p;p+=1)switch(v=m[p],v.tag){case 'cmap':v=k(b,v);n.tables.cmap=y.parse(v.data,v.offset);n.encoding=new t.CmapEncoding(n.tables.cmap);break;case 'fvar':ca=v;break;case 'head':v=k(b,v);n.tables.head= -D.parse(v.data,v.offset);n.unitsPerEm=n.tables.head.unitsPerEm;f=n.tables.head.indexToLocFormat;break;case 'hhea':v=k(b,v);n.tables.hhea=C.parse(v.data,v.offset);n.ascender=n.tables.hhea.ascender;n.descender=n.tables.hhea.descender;n.numberOfHMetrics=n.tables.hhea.numberOfHMetrics;break;case 'hmtx':ea=v;break;case 'ltag':v=k(b,v);g=H.parse(v.data,v.offset);break;case 'maxp':v=k(b,v);n.tables.maxp=O.parse(v.data,v.offset);n.numGlyphs=n.tables.maxp.numGlyphs;break;case 'name':ra=v;break;case 'OS/2':v= -k(b,v);n.tables.os2=J.parse(v.data,v.offset);break;case 'post':v=k(b,v);n.tables.post=P.parse(v.data,v.offset);n.glyphNames=new t.GlyphNames(n.tables.post);break;case 'glyf':Ba=v;break;case 'loca':qa=v;break;case 'CFF ':la=v;break;case 'kern':ia=v;break;case 'GPOS':ha=v;break;case 'GSUB':ua=v;break;case 'meta':Aa=v}ra=k(b,ra);if(n.tables.name=M.parse(ra.data,ra.offset,g),n.names=n.tables.name,Ba&&qa)f=0===f,qa=k(b,qa),qa=G.parse(qa.data,qa.offset,n.numGlyphs,f),Ba=k(b,Ba),n.glyphs=u.parse(Ba.data, -Ba.offset,qa,n);else{if(!la)throw Error("Font doesn't contain TrueType or CFF outlines.");Ba=k(b,la);x.parse(Ba.data,Ba.offset,n)}ea=k(b,ea);(F.parse(ea.data,ea.offset,n.numberOfHMetrics,n.numGlyphs,n.glyphs),t.addGlyphNames(n),ia)?(ia=k(b,ia),n.kerningPairs=z.parse(ia.data,ia.offset)):n.kerningPairs={};ha&&(ha=k(b,ha),A.parse(ha.data,ha.offset,n));ua&&(ua=k(b,ua),n.tables.gsub=E.parse(ua.data,ua.offset));ca&&(ca=k(b,ca),n.tables.fvar=q.parse(ca.data,ca.offset,n.names));Aa&&(Aa=k(b,Aa),n.tables.meta= -N.parse(Aa.data,Aa.offset),n.metas=n.tables.meta);return n}var p=g('tiny-inflate'),t=g('./encoding'),h=g('./font');m=g('./glyph');var d=g('./parse'),v=g('./path'),w=g('./util'),y=g('./tables/cmap'),x=g('./tables/cff'),q=g('./tables/fvar'),u=g('./tables/glyf'),A=g('./tables/gpos'),E=g('./tables/gsub'),D=g('./tables/head'),C=g('./tables/hhea'),F=g('./tables/hmtx'),z=g('./tables/kern'),H=g('./tables/ltag'),G=g('./tables/loca'),O=g('./tables/maxp'),M=g('./tables/name'),J=g('./tables/os2'),P=g('./tables/post'), -N=g('./tables/meta');b._parse=d;b.Font=h.Font;b.Glyph=m.Glyph;b.Path=v.Path;b.parse=n;b.load=function(b,d){('undefined'==typeof window?l:f)(b,function(b,c){if(b)return d(b);var f;try{f=n(c)}catch(S){return d(S,null)}return d(null,f)})};b.loadSync=function(b){b=g('fs').readFileSync(b);return n(w.nodeBufferToArrayBuffer(b))}},{'./encoding':4,'./font':5,'./glyph':6,'./parse':10,'./path':11,'./tables/cff':14,'./tables/cmap':15,'./tables/fvar':16,'./tables/glyf':17,'./tables/gpos':18,'./tables/gsub':19, -'./tables/head':20,'./tables/hhea':21,'./tables/hmtx':22,'./tables/kern':23,'./tables/loca':24,'./tables/ltag':25,'./tables/maxp':26,'./tables/meta':27,'./tables/name':28,'./tables/os2':29,'./tables/post':30,'./util':33,fs:void 0,'tiny-inflate':1}],10:[function(g,m,b){function l(b,c){return b.getUint16(c,!1)}function f(b,c){this.data=b;this.offset=c;this.relativeOffset=0}var c=g('./check');b.getByte=function(b,c){return b.getUint8(c)};b.getCard8=b.getByte;b.getUShort=b.getCard16=l;b.getShort=function(b, -c){return b.getInt16(c,!1)};b.getULong=function(b,c){return b.getUint32(c,!1)};b.getFixed=function(b,c){var f=b.getInt16(c,!1);b=b.getUint16(c+2,!1);return f+b/65535};b.getTag=function(b,c){for(var f='',d=c;c+4>d;d+=1)f+=String.fromCharCode(b.getInt8(d));return f};b.getOffset=function(b,c,f){for(var d=0,g=0;f>g;g+=1)d<<=8,d+=b.getUint8(c+g);return d};b.getBytes=function(b,c,f){for(var d=[];f>c;c+=1)d.push(b.getUint8(c));return d};b.bytesToString=function(b){for(var c='',f=0;fg;g++)d+=String.fromCharCode(c.getUint8(f+g));return d};f.prototype.parseTag=function(){return this.parseString(4)};f.prototype.parseLongDateTime=function(){var c=b.getULong(this.data,this.offset+this.relativeOffset+4);return c-=2082844800,this.relativeOffset+= -8,c};f.prototype.parseVersion=function(){var b=l(this.data,this.offset+this.relativeOffset),c=l(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,b+c/4096/10};f.prototype.skip=function(b,c){void 0===c&&(c=1);this.relativeOffset+=k[b]*c};f.prototype.parseOffset16List=f.prototype.parseUShortList=function(b){void 0===b&&(b=this.parseUShort());for(var c=Array(b),f=this.data,d=this.offset+this.relativeOffset,g=0;b>g;g++)c[g]=f.getUint16(d),d+=2;return this.relativeOffset+=2*b, -c};f.prototype.parseList=function(b,c){c||(c=b,b=this.parseUShort());for(var f=Array(b),d=0;b>d;d++)f[d]=c.call(this);return f};f.prototype.parseRecordList=function(b,c){c||(c=b,b=this.parseUShort());for(var f=Array(b),d=Object.keys(c),g=0;b>g;g++){for(var k={},l=0;lk;k++){var l=c[k];if(0!==l)if(this.relativeOffset=l,b){for(var n=this.parseOffset16List(),m=Array(n.length),p=0;pf;f++)b[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:b}}c.assert(!1,'0x'+b.toString(16)+': Coverage format must be 1 or 2.')};f.prototype.parseClassDef=function(){var b=this.offset+this.relativeOffset,g=this.parseUShort();return 1===g? -{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===g?{format:2,ranges:this.parseRecordList({start:f.uShort,end:f.uShort,classId:f.uShort})}:void c.assert(!1,'0x'+b.toString(16)+': ClassDef format must be 1 or 2.')};f.list=function(b,c){return function(){return this.parseList(b,c)}};f.recordList=function(b,c){return function(){return this.parseRecordList(b,c)}};f.pointer=function(b){return function(){return this.parsePointer(b)}};f.tag=f.prototype.parseTag;f.byte=f.prototype.parseByte; -f.uShort=f.offset16=f.prototype.parseUShort;f.uShortList=f.prototype.parseUShortList;f.struct=f.prototype.parseStruct;f.coverage=f.prototype.parseCoverage;f.classDef=f.prototype.parseClassDef;var n={reserved:f.uShort,reqFeatureIndex:f.uShort,featureIndexes:f.uShortList};f.prototype.parseScriptList=function(){return this.parsePointer(f.recordList({tag:f.tag,script:f.pointer({defaultLangSys:f.pointer(n),langSysRecords:f.recordList({tag:f.tag,langSys:f.pointer(n)})})}))};f.prototype.parseFeatureList= -function(){return this.parsePointer(f.recordList({tag:f.tag,feature:f.pointer({featureParams:f.offset16,lookupListIndexes:f.uShortList})}))};f.prototype.parseLookupList=function(b){return this.parsePointer(f.list(f.pointer(function(){var g=this.parseUShort();c.argument(1<=g&&8>=g,'GSUB lookup type '+g+' unknown.');var h=this.parseUShort(),d=16&h;return{lookupType:g,lookupFlag:h,subtables:this.parseList(f.pointer(b[g])),markFilteringSet:d?this.parseUShort():void 0}})))};b.Parser=f},{'./check':2}], -11:[function(g,m,b){function l(){this.commands=[];this.fill='black';this.stroke=null;this.strokeWidth=1}l.prototype.moveTo=function(b,c){this.commands.push({type:'M',x:b,y:c})};l.prototype.lineTo=function(b,c){this.commands.push({type:'L',x:b,y:c})};l.prototype.curveTo=l.prototype.bezierCurveTo=function(b,c,g,l,m,t){this.commands.push({type:'C',x1:b,y1:c,x2:g,y2:l,x:m,y:t})};l.prototype.quadTo=l.prototype.quadraticCurveTo=function(b,c,g,l){this.commands.push({type:'Q',x1:b,y1:c,x:g,y:l})};l.prototype.close= -l.prototype.closePath=function(){this.commands.push({type:'Z'})};l.prototype.extend=function(b){b.commands&&(b=b.commands);Array.prototype.push.apply(this.commands,b)};l.prototype.draw=function(b){b.beginPath();for(var c=0;c'};b.Path=l},{}],12:[function(g,m,b){function l(b,f,g){b=b.subtables;for(var c=0;cm&&(m=-1-m,b.coverage.glyphs.splice(m,0,n),b.substitute.splice(m,0,0));b.substitute[m]=g.by};b.prototype.addAlternate=function(b,g,n,m){b=this.getLookupTable(n,m,b,3,!0);b=l(b,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});f.assert(1===b.coverage.format,'Ligature: unable to modify coverage table format '+b.coverage.format);n=g.sub;m=this.binSearch(b.coverage.glyphs,n);0>m&&(m=-1-m,b.coverage.glyphs.splice(m,0,n),b.alternateSets.splice(m,0,0));b.alternateSets[m]=g.by};b.prototype.addLigature= -function(b,g,l,m){b=this.getLookupTable(l||'DFLT',m||'DFLT',b,4,!0);(l=b.subtables[0])||(l={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},b.subtables[0]=l);f.assert(1===l.coverage.format,'Ligature: unable to modify coverage table format '+l.coverage.format);m=g.sub[0];b=g.sub.slice(1);g={ligGlyph:g.by,components:b};var c=this.binSearch(l.coverage.glyphs,m);if(0<=c){l=l.ligatureSets[c];for(m=0;m -d;d++)if(c[d]!==b[d]){c=!1;break a}c=!0}}if(c)return}l.push(g)}else c=-1-c,l.coverage.glyphs.splice(c,0,m),l.ligatureSets.splice(c,0,[g])};b.prototype.getFeature=function(b,f,g){if(f=f||'DFLT',g=g||'DFLT',/ss\d\d/.test(b))return this.getSingle(b,f,g);switch(b){case 'aalt':case 'salt':return this.getSingle(b,f,g).concat(this.getAlternates(b,f,g));case 'dlig':case 'liga':case 'rlig':return this.getLigatures(b,f,g)}};b.prototype.add=function(b,f,g,l){if(g=g||'DFLT',l=l||'DFLT',/ss\d\d/.test(b))return this.addSingle(b, -f,g,l);switch(b){case 'aalt':case 'salt':return'number'==typeof f.by?this.addSingle(b,f,g,l):this.addAlternate(b,f,g,l);case 'dlig':case 'liga':case 'rlig':return this.addLigature(b,f,g,l)}};m.exports=b},{'./check':2,'./layout':8}],13:[function(g,m,b){function l(b,d,c){var f;for(f=0;fh;h++)g[h+1]={name:b+h,type:'TABLE',value:c(d[h],h)};return g}function k(b,d,c){var f=d.length,g=[];g[0]={name:b+'Count',type:'USHORT',value:f};for(b=0;f>b;b++)g=g.concat(c(d[b],b));return g}function n(b){1===b.format?l.call(this,'coverageTable',[{name:'coverageFormat', -type:'USHORT',value:1}].concat(f('glyph',b.glyphs))):d.assert(!1,"Can't create coverage table format 2 yet.")}function p(b){l.call(this,'scriptListTable',k('scriptRecord',b,function(b,c){var g=b.script,h=g.defaultLangSys;return d.assert(!!h,'Unable to write GSUB: script '+b.tag+' has no default language system.'),[{name:'scriptTag'+c,type:'TAG',value:b.tag},{name:'script'+c,type:'TABLE',value:new l('scriptTable',[{name:'defaultLangSys',type:'TABLE',value:new l('defaultLangSys',[{name:'lookupOrder', -type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:h.reqFeatureIndex}].concat(f('featureIndex',h.featureIndexes)))}].concat(k('langSys',g.langSysRecords,function(b,d){var c=b.langSys;return[{name:'langSysTag'+d,type:'TAG',value:b.tag},{name:'langSys'+d,type:'TABLE',value:new l('langSys',[{name:'lookupOrder',type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:c.reqFeatureIndex}].concat(f('featureIndex',c.featureIndexes)))}]})))}]}))}function t(b){l.call(this,'featureListTable', -k('featureRecord',b,function(b,d){var c=b.feature;return[{name:'featureTag'+d,type:'TAG',value:b.tag},{name:'feature'+d,type:'TABLE',value:new l('featureTable',[{name:'featureParams',type:'USHORT',value:c.featureParams}].concat(f('lookupListIndex',c.lookupListIndexes)))}]}))}function h(b,f){l.call(this,'lookupListTable',c('lookup',b,function(b){var g=f[b.lookupType];return d.assert(!!g,'Unable to write GSUB lookup type '+b.lookupType+' tables.'),new l('lookupTable',[{name:'lookupType',type:'USHORT', -value:b.lookupType},{name:'lookupFlag',type:'USHORT',value:b.lookupFlag}].concat(c('subtable',b.subtables,g)))}))}var d=g('./check'),v=g('./types').encode,w=g('./types').sizeOf;l.prototype.encode=function(){return v.TABLE(this)};l.prototype.sizeOf=function(){return w.TABLE(this)};n.prototype=Object.create(l.prototype);n.prototype.constructor=n;p.prototype=Object.create(l.prototype);p.prototype.constructor=p;t.prototype=Object.create(l.prototype);t.prototype.constructor=t;h.prototype=Object.create(l.prototype); -h.prototype.constructor=h;b.Record=b.Table=l;b.Coverage=n;b.ScriptList=p;b.FeatureList=t;b.LookupList=h;b.ushortList=f;b.tableList=c;b.recordList=k},{'./check':2,'./types':32}],14:[function(g,m,b){function l(b,d){if(b===d)return!0;if(Array.isArray(b)&&Array.isArray(d)){if(b.length!==d.length)return!1;for(var c=0;cf;f+= -1)k.push(u.getOffset(b,m,n)),m+=n;h=g+k[h]}else h=d+2;for(f=0;f>4;g&=15;if(15===f)break;if(d+= -c[f],15===g)break;d+=c[g]}return parseFloat(d)}if(32<=d&&246>=d)return d-139;if(247<=d&&250>=d)return c=b.parseByte(),256*(d-247)+c+108;if(251<=d&&254>=d)return c=b.parseByte(),256*-(d-251)-c-108;throw Error('Invalid b0 '+d);}function k(b,d,f){var g=new u.Parser(b,void 0!==d?d:0);d=[];var h=[];for(f=void 0!==f?f:b.length;g.relativeOffset=b?(12===b&&(b=1200+g.parseByte()),d.push([b,h]),h=[]):h.push(c(g,b));f={};for(b=0;b=d?x.cffStandardStrings[d]:b[d-391]}function p(b,d,c){for(var f={},g=0;g>1;p.length=0;t=!0}function h(c){for(var C, -z,A,D,F,E,G,H,M,J,O=0;OMath.abs(J-y)?x=M+p.shift():y=J+p.shift();q.curveTo(k,l,n,m,F, -E);q.curveTo(G,H,M,J,x,y);break;default:console.log('Glyph '+d.index+': unknown operator 1200'+F),p.length=0}break;case 14:0>3;break;case 21:2>16);O+=2;break;case 29:F=p.pop()+b.gsubrsBias;(F=b.gsubrs[F])&&h(F);break;case 30:for(;0F?console.log('Glyph '+d.index+': unknown operator '+F):247>F?p.push(F-139):251>F?(C=c[O],O+=1,p.push(256*(F-247)+C+108)):255>F?(C=c[O],O+=1,p.push(256*-(F-251)-C-108)):(C=c[O],z=c[O+1],A=c[O+2],D=c[O+3],O+=4,p.push((C<<24|z<<16|A<<8|D)/65536))}} -var k,l,n,m,q=new A.Path,p=[],v=0,t=!1,w=b.defaultWidthX,u=!1,x=0,y=0;return h(c),d.advanceWidth=w,q}function h(b){return 1240>b.length?107:33900>b.length?1131:32768}function d(b,d){var c,f=x.cffStandardStrings.indexOf(b);return f=d.indexOf(b),0<=f?c=f+x.cffStandardStrings.length:(c=x.cffStandardStrings.length+d.length,d.push(b)),c}function v(b,c,f){for(var g={},h=0;h=c;){var k=c+g>>>1,h=b[k].tag;if(h===e)return k;e>h?c=k+1:g=k-1}return-c-1}var g=e('./check');m.exports={searchTag:l,binSearch:function(b,e){for(var c=0,g=b.length-1;g>=c;){var k=c+g>>>1,h=b[k];if(h===e)return k;e>h?c=k+1:g=k-1}return-c-1},getScriptNames:function(){var b=this.getGsubTable();return b?b.scripts.map(function(b){return b.tag}):[]},getScriptTable:function(b,e){var c=this.getGsubTable(e);if(c){e=c.scripts;c=l(c.scripts,b);if(0<=c)return e[c].script;b={tag:b,script:{defaultLangSys:{reserved:0, +reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return e.splice(-1-c,0,b.script),b}},getLangSysTable:function(b,e,g){if(b=this.getScriptTable(b,g)){if('DFLT'===e)return b.defaultLangSys;var c=l(b.langSysRecords,e);if(0<=c)return b.langSysRecords[c].langSys;if(g)return e={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}},b.langSysRecords.splice(-1-c,0,e),e.langSys}},getFeatureTable:function(b,e,l,m){if(b=this.getLangSysTable(b,e,m)){var c;b=b.featureIndexes;e=this.font.tables.gsub.features; +for(var h=0;h=e[m-1].tag,'Features must be added in alphabetical order.'),c={tag:l,feature:{params:0,lookupListIndexes:[]}},e.push(c),b.push(m),c.feature}},getLookupTable:function(b,e,g,l,m){if(b=this.getFeatureTable(b,e,g,m)){var c;b=b.lookupListIndexes;e=this.font.tables.gsub.lookups;for(g=0;ge;e++)for(var g=b[e],l=g.end,g=g.start;l>=g;g++)c.push(g);return c}}},{'./check':2}],9:[function(e,m,b){function l(b,d){e('fs').readFile(b,function(b,c){return b?d(b.message):void d(null,w.nodeBufferToArrayBuffer(c))})}function g(b,d){var c=new XMLHttpRequest;c.open('get',b,!0);c.responseType='arraybuffer';c.onload=function(){return 200!==c.status?d('Font could not be loaded: '+ +c.statusText):d(null,c.response)};c.send()}function c(b,c){for(var e=[],g=12,h=0;c>h;h+=1){var k=d.getTag(b,g),l=d.getULong(b,g+4),m=d.getULong(b,g+8),n=d.getULong(b,g+12);e.push({tag:k,checksum:l,offset:m,length:n,compression:!1});g+=16}return e}function k(b,d){if('WOFF'===d.compression){b=new Uint8Array(b.buffer,d.offset+2,d.compressedLength-2);var c=new Uint8Array(d.originalLength);if(p(b,c),c.byteLength!==d.originalLength)throw Error('Decompression error: '+d.tag+" decompressed length doesn't match recorded length"); +return{data:new DataView(c.buffer,0),offset:0}}return{data:b,offset:d.offset}}function n(b){var e,g,l,m=new h.Font({empty:!0});b=new DataView(b,0);var n;l=d.getTag(b,0);if(l===String.fromCharCode(0,1,0,0))m.outlinesFormat='truetype',l=d.getUShort(b,4),n=c(b,l);else if('OTTO'===l)m.outlinesFormat='cff',l=d.getUShort(b,4),n=c(b,l);else{if('wOFF'!==l)throw Error('Unsupported OpenType signature '+l);n=d.getTag(b,4);if(n===String.fromCharCode(0,1,0,0))m.outlinesFormat='truetype';else{if('OTTO'!==n)throw Error('Unsupported OpenType flavor '+ +l);m.outlinesFormat='cff'}n=l=d.getUShort(b,12);for(var p=[],v=44,w=0;n>w;w+=1){var V=d.getTag(b,v),R=d.getULong(b,v+4),Y=d.getULong(b,v+8),na=d.getULong(b,v+12);p.push({tag:V,offset:R,compression:na>Y?'WOFF':!1,compressedLength:Y,originalLength:na});v+=20}n=p}for(var la,ca,Ba,ha,ua,ea,ia,qa,ra,Aa,p=0;l>p;p+=1)switch(v=n[p],v.tag){case 'cmap':v=k(b,v);m.tables.cmap=y.parse(v.data,v.offset);m.encoding=new t.CmapEncoding(m.tables.cmap);break;case 'fvar':ca=v;break;case 'head':v=k(b,v);m.tables.head= +D.parse(v.data,v.offset);m.unitsPerEm=m.tables.head.unitsPerEm;e=m.tables.head.indexToLocFormat;break;case 'hhea':v=k(b,v);m.tables.hhea=C.parse(v.data,v.offset);m.ascender=m.tables.hhea.ascender;m.descender=m.tables.hhea.descender;m.numberOfHMetrics=m.tables.hhea.numberOfHMetrics;break;case 'hmtx':ea=v;break;case 'ltag':v=k(b,v);g=H.parse(v.data,v.offset);break;case 'maxp':v=k(b,v);m.tables.maxp=O.parse(v.data,v.offset);m.numGlyphs=m.tables.maxp.numGlyphs;break;case 'name':ra=v;break;case 'OS/2':v= +k(b,v);m.tables.os2=J.parse(v.data,v.offset);break;case 'post':v=k(b,v);m.tables.post=P.parse(v.data,v.offset);m.glyphNames=new t.GlyphNames(m.tables.post);break;case 'glyf':Ba=v;break;case 'loca':qa=v;break;case 'CFF ':la=v;break;case 'kern':ia=v;break;case 'GPOS':ha=v;break;case 'GSUB':ua=v;break;case 'meta':Aa=v}ra=k(b,ra);if(m.tables.name=M.parse(ra.data,ra.offset,g),m.names=m.tables.name,Ba&&qa)e=0===e,qa=k(b,qa),qa=G.parse(qa.data,qa.offset,m.numGlyphs,e),Ba=k(b,Ba),m.glyphs=u.parse(Ba.data, +Ba.offset,qa,m);else{if(!la)throw Error("Font doesn't contain TrueType or CFF outlines.");Ba=k(b,la);x.parse(Ba.data,Ba.offset,m)}ea=k(b,ea);(F.parse(ea.data,ea.offset,m.numberOfHMetrics,m.numGlyphs,m.glyphs),t.addGlyphNames(m),ia)?(ia=k(b,ia),m.kerningPairs=z.parse(ia.data,ia.offset)):m.kerningPairs={};ha&&(ha=k(b,ha),A.parse(ha.data,ha.offset,m));ua&&(ua=k(b,ua),m.tables.gsub=E.parse(ua.data,ua.offset));ca&&(ca=k(b,ca),m.tables.fvar=q.parse(ca.data,ca.offset,m.names));Aa&&(Aa=k(b,Aa),m.tables.meta= +N.parse(Aa.data,Aa.offset),m.metas=m.tables.meta);return m}var p=e('tiny-inflate'),t=e('./encoding'),h=e('./font');m=e('./glyph');var d=e('./parse'),v=e('./path'),w=e('./util'),y=e('./tables/cmap'),x=e('./tables/cff'),q=e('./tables/fvar'),u=e('./tables/glyf'),A=e('./tables/gpos'),E=e('./tables/gsub'),D=e('./tables/head'),C=e('./tables/hhea'),F=e('./tables/hmtx'),z=e('./tables/kern'),H=e('./tables/ltag'),G=e('./tables/loca'),O=e('./tables/maxp'),M=e('./tables/name'),J=e('./tables/os2'),P=e('./tables/post'), +N=e('./tables/meta');b._parse=d;b.Font=h.Font;b.Glyph=m.Glyph;b.Path=v.Path;b.parse=n;b.load=function(b,d){('undefined'==typeof window?l:g)(b,function(b,c){if(b)return d(b);var e;try{e=n(c)}catch(S){return d(S,null)}return d(null,e)})};b.loadSync=function(b){b=e('fs').readFileSync(b);return n(w.nodeBufferToArrayBuffer(b))}},{'./encoding':4,'./font':5,'./glyph':6,'./parse':10,'./path':11,'./tables/cff':14,'./tables/cmap':15,'./tables/fvar':16,'./tables/glyf':17,'./tables/gpos':18,'./tables/gsub':19, +'./tables/head':20,'./tables/hhea':21,'./tables/hmtx':22,'./tables/kern':23,'./tables/loca':24,'./tables/ltag':25,'./tables/maxp':26,'./tables/meta':27,'./tables/name':28,'./tables/os2':29,'./tables/post':30,'./util':33,fs:void 0,'tiny-inflate':1}],10:[function(e,m,b){function l(b,c){return b.getUint16(c,!1)}function g(b,c){this.data=b;this.offset=c;this.relativeOffset=0}var c=e('./check');b.getByte=function(b,c){return b.getUint8(c)};b.getCard8=b.getByte;b.getUShort=b.getCard16=l;b.getShort=function(b, +c){return b.getInt16(c,!1)};b.getULong=function(b,c){return b.getUint32(c,!1)};b.getFixed=function(b,c){var e=b.getInt16(c,!1);b=b.getUint16(c+2,!1);return e+b/65535};b.getTag=function(b,c){for(var e='',d=c;c+4>d;d+=1)e+=String.fromCharCode(b.getInt8(d));return e};b.getOffset=function(b,c,e){for(var d=0,g=0;e>g;g+=1)d<<=8,d+=b.getUint8(c+g);return d};b.getBytes=function(b,c,e){for(var d=[];e>c;c+=1)d.push(b.getUint8(c));return d};b.bytesToString=function(b){for(var c='',e=0;eg;g++)d+=String.fromCharCode(c.getUint8(e+g));return d};g.prototype.parseTag=function(){return this.parseString(4)};g.prototype.parseLongDateTime=function(){var c=b.getULong(this.data,this.offset+this.relativeOffset+4);return c-=2082844800,this.relativeOffset+= +8,c};g.prototype.parseVersion=function(){var b=l(this.data,this.offset+this.relativeOffset),c=l(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,b+c/4096/10};g.prototype.skip=function(b,c){void 0===c&&(c=1);this.relativeOffset+=k[b]*c};g.prototype.parseOffset16List=g.prototype.parseUShortList=function(b){void 0===b&&(b=this.parseUShort());for(var c=Array(b),e=this.data,d=this.offset+this.relativeOffset,g=0;b>g;g++)c[g]=e.getUint16(d),d+=2;return this.relativeOffset+=2*b, +c};g.prototype.parseList=function(b,c){c||(c=b,b=this.parseUShort());for(var e=Array(b),d=0;b>d;d++)e[d]=c.call(this);return e};g.prototype.parseRecordList=function(b,c){c||(c=b,b=this.parseUShort());for(var e=Array(b),d=Object.keys(c),g=0;b>g;g++){for(var k={},l=0;lk;k++){var l=c[k];if(0!==l)if(this.relativeOffset=l,b){for(var m=this.parseOffset16List(),n=Array(m.length),p=0;pe;e++)b[e]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:b}}c.assert(!1,'0x'+b.toString(16)+': Coverage format must be 1 or 2.')};g.prototype.parseClassDef=function(){var b=this.offset+this.relativeOffset,e=this.parseUShort();return 1===e? +{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===e?{format:2,ranges:this.parseRecordList({start:g.uShort,end:g.uShort,classId:g.uShort})}:void c.assert(!1,'0x'+b.toString(16)+': ClassDef format must be 1 or 2.')};g.list=function(b,c){return function(){return this.parseList(b,c)}};g.recordList=function(b,c){return function(){return this.parseRecordList(b,c)}};g.pointer=function(b){return function(){return this.parsePointer(b)}};g.tag=g.prototype.parseTag;g.byte=g.prototype.parseByte; +g.uShort=g.offset16=g.prototype.parseUShort;g.uShortList=g.prototype.parseUShortList;g.struct=g.prototype.parseStruct;g.coverage=g.prototype.parseCoverage;g.classDef=g.prototype.parseClassDef;var n={reserved:g.uShort,reqFeatureIndex:g.uShort,featureIndexes:g.uShortList};g.prototype.parseScriptList=function(){return this.parsePointer(g.recordList({tag:g.tag,script:g.pointer({defaultLangSys:g.pointer(n),langSysRecords:g.recordList({tag:g.tag,langSys:g.pointer(n)})})}))};g.prototype.parseFeatureList= +function(){return this.parsePointer(g.recordList({tag:g.tag,feature:g.pointer({featureParams:g.offset16,lookupListIndexes:g.uShortList})}))};g.prototype.parseLookupList=function(b){return this.parsePointer(g.list(g.pointer(function(){var e=this.parseUShort();c.argument(1<=e&&8>=e,'GSUB lookup type '+e+' unknown.');var h=this.parseUShort(),d=16&h;return{lookupType:e,lookupFlag:h,subtables:this.parseList(g.pointer(b[e])),markFilteringSet:d?this.parseUShort():void 0}})))};b.Parser=g},{'./check':2}], +11:[function(e,m,b){function l(){this.commands=[];this.fill='black';this.stroke=null;this.strokeWidth=1}l.prototype.moveTo=function(b,c){this.commands.push({type:'M',x:b,y:c})};l.prototype.lineTo=function(b,c){this.commands.push({type:'L',x:b,y:c})};l.prototype.curveTo=l.prototype.bezierCurveTo=function(b,c,e,l,m,t){this.commands.push({type:'C',x1:b,y1:c,x2:e,y2:l,x:m,y:t})};l.prototype.quadTo=l.prototype.quadraticCurveTo=function(b,c,e,l){this.commands.push({type:'Q',x1:b,y1:c,x:e,y:l})};l.prototype.close= +l.prototype.closePath=function(){this.commands.push({type:'Z'})};l.prototype.extend=function(b){b.commands&&(b=b.commands);Array.prototype.push.apply(this.commands,b)};l.prototype.draw=function(b){b.beginPath();for(var c=0;c'};b.Path=l},{}],12:[function(e,m,b){function l(b,e,g){b=b.subtables;for(var c=0;cp&&(p=-1-p,b.coverage.glyphs.splice(p,0,m),b.substitute.splice(p,0,0));b.substitute[p]=e.by};b.prototype.addAlternate=function(b,e,m,p){b=this.getLookupTable(m,p,b,3,!0);b=l(b,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});g.assert(1===b.coverage.format,'Ligature: unable to modify coverage table format '+b.coverage.format);m=e.sub;p=this.binSearch(b.coverage.glyphs,m);0>p&&(p=-1-p,b.coverage.glyphs.splice(p,0,m),b.alternateSets.splice(p,0,0));b.alternateSets[p]=e.by};b.prototype.addLigature= +function(b,e,l,m){b=this.getLookupTable(l||'DFLT',m||'DFLT',b,4,!0);(l=b.subtables[0])||(l={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},b.subtables[0]=l);g.assert(1===l.coverage.format,'Ligature: unable to modify coverage table format '+l.coverage.format);m=e.sub[0];b=e.sub.slice(1);e={ligGlyph:e.by,components:b};var c=this.binSearch(l.coverage.glyphs,m);if(0<=c){l=l.ligatureSets[c];for(m=0;m +d;d++)if(c[d]!==b[d]){c=!1;break a}c=!0}}if(c)return}l.push(e)}else c=-1-c,l.coverage.glyphs.splice(c,0,m),l.ligatureSets.splice(c,0,[e])};b.prototype.getFeature=function(b,e,g){if(e=e||'DFLT',g=g||'DFLT',/ss\d\d/.test(b))return this.getSingle(b,e,g);switch(b){case 'aalt':case 'salt':return this.getSingle(b,e,g).concat(this.getAlternates(b,e,g));case 'dlig':case 'liga':case 'rlig':return this.getLigatures(b,e,g)}};b.prototype.add=function(b,e,g,l){if(g=g||'DFLT',l=l||'DFLT',/ss\d\d/.test(b))return this.addSingle(b, +e,g,l);switch(b){case 'aalt':case 'salt':return'number'==typeof e.by?this.addSingle(b,e,g,l):this.addAlternate(b,e,g,l);case 'dlig':case 'liga':case 'rlig':return this.addLigature(b,e,g,l)}};m.exports=b},{'./check':2,'./layout':8}],13:[function(e,m,b){function l(b,d,c){var e;for(e=0;eh;h++)g[h+1]={name:b+h,type:'TABLE',value:c(d[h],h)};return g}function k(b,d,c){var e=d.length,g=[];g[0]={name:b+'Count',type:'USHORT',value:e};for(b=0;e>b;b++)g=g.concat(c(d[b],b));return g}function n(b){1===b.format?l.call(this,'coverageTable',[{name:'coverageFormat', +type:'USHORT',value:1}].concat(g('glyph',b.glyphs))):d.assert(!1,"Can't create coverage table format 2 yet.")}function p(b){l.call(this,'scriptListTable',k('scriptRecord',b,function(b,c){var e=b.script,h=e.defaultLangSys;return d.assert(!!h,'Unable to write GSUB: script '+b.tag+' has no default language system.'),[{name:'scriptTag'+c,type:'TAG',value:b.tag},{name:'script'+c,type:'TABLE',value:new l('scriptTable',[{name:'defaultLangSys',type:'TABLE',value:new l('defaultLangSys',[{name:'lookupOrder', +type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:h.reqFeatureIndex}].concat(g('featureIndex',h.featureIndexes)))}].concat(k('langSys',e.langSysRecords,function(b,d){var c=b.langSys;return[{name:'langSysTag'+d,type:'TAG',value:b.tag},{name:'langSys'+d,type:'TABLE',value:new l('langSys',[{name:'lookupOrder',type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:c.reqFeatureIndex}].concat(g('featureIndex',c.featureIndexes)))}]})))}]}))}function t(b){l.call(this,'featureListTable', +k('featureRecord',b,function(b,d){var c=b.feature;return[{name:'featureTag'+d,type:'TAG',value:b.tag},{name:'feature'+d,type:'TABLE',value:new l('featureTable',[{name:'featureParams',type:'USHORT',value:c.featureParams}].concat(g('lookupListIndex',c.lookupListIndexes)))}]}))}function h(b,e){l.call(this,'lookupListTable',c('lookup',b,function(b){var g=e[b.lookupType];return d.assert(!!g,'Unable to write GSUB lookup type '+b.lookupType+' tables.'),new l('lookupTable',[{name:'lookupType',type:'USHORT', +value:b.lookupType},{name:'lookupFlag',type:'USHORT',value:b.lookupFlag}].concat(c('subtable',b.subtables,g)))}))}var d=e('./check'),v=e('./types').encode,w=e('./types').sizeOf;l.prototype.encode=function(){return v.TABLE(this)};l.prototype.sizeOf=function(){return w.TABLE(this)};n.prototype=Object.create(l.prototype);n.prototype.constructor=n;p.prototype=Object.create(l.prototype);p.prototype.constructor=p;t.prototype=Object.create(l.prototype);t.prototype.constructor=t;h.prototype=Object.create(l.prototype); +h.prototype.constructor=h;b.Record=b.Table=l;b.Coverage=n;b.ScriptList=p;b.FeatureList=t;b.LookupList=h;b.ushortList=g;b.tableList=c;b.recordList=k},{'./check':2,'./types':32}],14:[function(e,m,b){function l(b,d){if(b===d)return!0;if(Array.isArray(b)&&Array.isArray(d)){if(b.length!==d.length)return!1;for(var c=0;ce;e+= +1)k.push(u.getOffset(b,n,m)),n+=m;h=g+k[h]}else h=d+2;for(e=0;e>4;g&=15;if(15===e)break;if(d+= +c[e],15===g)break;d+=c[g]}return parseFloat(d)}if(32<=d&&246>=d)return d-139;if(247<=d&&250>=d)return c=b.parseByte(),256*(d-247)+c+108;if(251<=d&&254>=d)return c=b.parseByte(),256*-(d-251)-c-108;throw Error('Invalid b0 '+d);}function k(b,d,e){var g=new u.Parser(b,void 0!==d?d:0);d=[];var h=[];for(e=void 0!==e?e:b.length;g.relativeOffset=b?(12===b&&(b=1200+g.parseByte()),d.push([b,h]),h=[]):h.push(c(g,b));e={};for(b=0;b=d?x.cffStandardStrings[d]:b[d-391]}function p(b,d,c){for(var e={},g=0;g>1;p.length=0;t=!0}function h(c){for(var C, +z,A,D,F,E,G,H,M,J,O=0;OMath.abs(J-y)?x=M+p.shift():y=J+p.shift();q.curveTo(k,l,m,n,F, +E);q.curveTo(G,H,M,J,x,y);break;default:console.log('Glyph '+d.index+': unknown operator 1200'+F),p.length=0}break;case 14:0>3;break;case 21:2>16);O+=2;break;case 29:F=p.pop()+b.gsubrsBias;(F=b.gsubrs[F])&&h(F);break;case 30:for(;0F?console.log('Glyph '+d.index+': unknown operator '+F):247>F?p.push(F-139):251>F?(C=c[O],O+=1,p.push(256*(F-247)+C+108)):255>F?(C=c[O],O+=1,p.push(256*-(F-251)-C-108)):(C=c[O],z=c[O+1],A=c[O+2],D=c[O+3],O+=4,p.push((C<<24|z<<16|A<<8|D)/65536))}} +var k,l,m,n,q=new A.Path,p=[],v=0,t=!1,w=b.defaultWidthX,u=!1,x=0,y=0;return h(c),d.advanceWidth=w,q}function h(b){return 1240>b.length?107:33900>b.length?1131:32768}function d(b,d){var c,e=x.cffStandardStrings.indexOf(b);return e=d.indexOf(b),0<=e?c=e+x.cffStandardStrings.length:(c=x.cffStandardStrings.length+d.length,d.push(b)),c}function v(b,c,e){for(var g={},h=0;hy;y+=1)A=E.parseSID(),l.push(n(w,A));else if(1===y)for(;l.length<=v;)for(A=E.parseSID(),z=E.parseCard8(),y=0;z>= +value:0}];b.parse=function(b,d,c){c.tables.cff={};var e;e={};e=(e.formatMajor=u.getCard8(b,d),e.formatMinor=u.getCard8(b,d+1),e.size=u.getCard8(b,d+2),e.offsetSize=u.getCard8(b,d+3),e.startOffset=d,e.endOffset=d+4,e);e=g(b,e.endOffset,u.bytesToString);e=g(b,e.endOffset);var l=g(b,e.endOffset,u.bytesToString),m=g(b,l.endOffset);c.gsubrs=m.objects;c.gsubrsBias=h(c.gsubrs);m=new DataView((new Uint8Array(e.objects[0])).buffer);e=l.objects;m=k(m,0,m.byteLength);m=p(m,D,e);c.tables.cff.topDict=m;e=d+m['private'][1]; +var v;v=l.objects;var w=k(b,e,m['private'][0]);v=p(w,C,v);(c.defaultWidthX=v.defaultWidthX,c.nominalWidthX=v.nominalWidthX,0!==v.subrs)?(e=g(b,e+v.subrs),c.subrs=e.objects,c.subrsBias=h(c.subrs)):(c.subrs=[],c.subrsBias=0);e=g(b,d+m.charStrings);c.nGlyphs=e.objects.length;v=c.nGlyphs;var w=l.objects,y,A,z,E=new u.Parser(b,d+m.charset);--v;l=['.notdef'];y=E.parseCard8();if(0===y)for(y=0;v>y;y+=1)A=E.parseSID(),l.push(n(w,A));else if(1===y)for(;l.length<=v;)for(A=E.parseSID(),z=E.parseCard8(),y=0;z>= y;y+=1)l.push(n(w,A)),A+=1;else{if(2!==y)throw Error('Unknown charset format '+y);for(;l.length<=v;)for(A=E.parseSID(),z=E.parseCard16(),y=0;z>=y;y+=1)l.push(n(w,A)),A+=1}if(0===m.encoding)b=new x.CffEncoding(x.cffStandardEncoding,l);else if(1===m.encoding)b=new x.CffEncoding(x.cffExpertEncoding,l);else{v={};b=new u.Parser(b,d+m.encoding);d=b.parseCard8();if(0===d)for(w=b.parseCard8(),d=0;w>d;d+=1)m=b.parseCard8(),v[m]=d;else{if(1!==d)throw Error('Unknown encoding format '+d);w=b.parseCard8();m=1; -for(d=0;w>d;d+=1)for(E=b.parseCard8(),y=b.parseCard8(),A=E;E+y>=A;A+=1)v[A]=m,m+=1}b=new x.CffEncoding(v,l)}c.cffEncoding=b;c.encoding=c.encoding||c.cffEncoding;c.glyphs=new q.GlyphSet(c);for(b=0;bb;b+=1)for(m=k.parseULong(),d=k.parseULong(),l=k.parseULong();d>=m;m+=1)h.glyphIndexMap[m]=l,l++}else{if(4!==h.format)throw Error('Only format 4 and 12 cmap tables are supported.');var p=d;h.length=k.parseUShort();h.language=k.parseUShort(); -h.segCount=d=k.parseUShort()>>1;k.skip('uShort',3);h.glyphIndexMap={};k=new c.Parser(b,g+p+14);var l=new c.Parser(b,g+p+16+2*d),m=new c.Parser(b,g+p+16+4*d),q=new c.Parser(b,g+p+16+6*d),p=g+p+16+8*d;for(g=0;d-1>g;g+=1)for(var u=k.parseUShort(),A=l.parseUShort(),E=m.parseShort(),D=q.parseUShort(),C=A;u>=C;C+=1)0!==D?(p=q.offset+q.relativeOffset-2,p+=D,p+=2*(C-A),n=c.getUShort(b,p),0!==n&&(n=n+E&65535)):n=C+E&65535,h.glyphIndexMap[C]=n}return h};b.make=function(b){var c,f=new k.Table('cmap',[{name:'version', -type:'USHORT',value:0},{name:'numTables',type:'USHORT',value:1},{name:'platformID',type:'USHORT',value:3},{name:'encodingID',type:'USHORT',value:1},{name:'offset',type:'ULONG',value:12},{name:'format',type:'USHORT',value:4},{name:'length',type:'USHORT',value:0},{name:'language',type:'USHORT',value:0},{name:'segCountX2',type:'USHORT',value:0},{name:'searchRange',type:'USHORT',value:0},{name:'entrySelector',type:'USHORT',value:0},{name:'rangeShift',type:'USHORT',value:0}]);f.segments=[];for(c=0;cc;c+=1){var x=f.segments[c],g=g.concat({name:'end_'+c,type:'USHORT',value:x.end}), -d=d.concat({name:'start_'+c,type:'USHORT',value:x.start}),m=m.concat({name:'idDelta_'+c,type:'SHORT',value:x.delta}),n=n.concat({name:'idRangeOffset_'+c,type:'USHORT',value:x.offset});void 0!==x.glyphId&&(y=y.concat({name:'glyph_'+c,type:'USHORT',value:x.glyphId}))}return f.fields=f.fields.concat(g),f.fields.push({name:'reservedPad',type:'USHORT',value:0}),f.fields=f.fields.concat(d),f.fields=f.fields.concat(m),f.fields=f.fields.concat(n),f.fields=f.fields.concat(y),f.length=2*g.length+16+2*d.length+ -2*m.length+2*n.length+2*y.length,f}},{'../check':2,'../parse':10,'../table':13}],16:[function(g,m,b){function l(b,c){var d=JSON.stringify(b),f=256,g;for(g in c){var h=parseInt(g);if(h&&!(256>h)){if(JSON.stringify(c[g])===d)return h;h>=f&&(f=h+1)}}return c[f]=b,f}function f(b,c,f){f=l(c.name,f);return[{name:'tag_'+b,type:'TAG',value:c.tag},{name:'minValue_'+b,type:'FIXED',value:c.minValue<<16},{name:'defaultValue_'+b,type:'FIXED',value:c.defaultValue<<16},{name:'maxValue_'+b,type:'FIXED',value:c.maxValue<< -16},{name:'flags_'+b,type:'USHORT',value:0},{name:'nameID_'+b,type:'USHORT',value:f}]}function c(b,c,f){var d={};b=new t.Parser(b,c);return d.tag=b.parseTag(),d.minValue=b.parseFixed(),d.defaultValue=b.parseFixed(),d.maxValue=b.parseFixed(),b.skip('uShort',1),d.name=f[b.parseUShort()]||{},d}function k(b,c,f,g){g=l(c.name,g);g=[{name:'nameID_'+b,type:'USHORT',value:g},{name:'flags_'+b,type:'USHORT',value:0}];for(var d=0;dw;w++)v.push(c(b,f+k+w*m,g));w=[];f=f+k+l*m;for(k=0;h>k;k++)w.push(n(b,f+k*d,v,g));return{axes:v,instances:w}}},{'../check':2,'../parse':10,'../table':13}],17:[function(g,m,b){function l(b,c,f,g,h){var d;return 0<(c&g)?(d=b.parseByte(),0===(c&h)&&(d=-d),d=f+d):d=0<(c&h)?f:f+b.parseShort(),d}function f(b,c,f){c=new t.Parser(c,f);b.numberOfContours=c.parseShort();b._xMin=c.parseShort();b._yMin=c.parseShort(); -b._xMax=c.parseShort();b._yMax=c.parseShort();var d;if(0g;g+=1)if(d=c.parseByte(),f.push(d),0<(8&d))for(var m=c.parseByte(),p=0;m>p;p+=1)f.push(d),g+=1;if(n.argument(f.length===k,'Bad flags.'),0g;g+= -1)d=f[g],m={},m.onCurve=!!(1&d),m.lastPointOfContour=0<=h.indexOf(g),p.push(m);for(g=h=0;k>g;g+=1)d=f[g],m=p[g],m.x=l(c,d,h,2,16),h=m.x;for(g=h=0;k>g;g+=1)d=f[g],m=p[g],m.y=l(c,d,h,4,32),h=m.y}b.points=p}else b.points=[]}else if(0===b.numberOfContours)b.points=[];else for(b.isComposite=!0,b.points=[],b.components=[],d=!0;d;)f=c.parseUShort(),d={glyphIndex:c.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0},0<(1&f)?0<(2&f)?(d.dx=c.parseShort(),d.dy=c.parseShort()):d.matchedPoints=[c.parseUShort(), -c.parseUShort()]:0<(2&f)?(d.dx=c.parseChar(),d.dy=c.parseChar()):d.matchedPoints=[c.parseByte(),c.parseByte()],0<(8&f)?d.xScale=d.yScale=c.parseF2Dot14():0<(64&f)?(d.xScale=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()):0<(128&f)&&(d.xScale=c.parseF2Dot14(),d.scale01=c.parseF2Dot14(),d.scale10=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()),b.components.push(d),d=!!(32&f)}function c(b,c){for(var d=[],f=0;ff.points.length-1||g.matchedPoints[1]>k.points.length-1)throw Error('Matched points out of range in '+f.name);var l=f.points[g.matchedPoints[0]],m=k.points[g.matchedPoints[1]],g={xScale:g.xScale,scale01:g.scale01,scale10:g.scale10,yScale:g.yScale, -dx:0,dy:0},m=c([m],g)[0];g.dx=l.x-m.x;g.dy=l.y-m.y}k=c(k.points,g);f.points=f.points.concat(k)}}var p;f=f.points;b=new h.Path;if(f){d=[];k=[];for(l=0;lf;f++)c[b.parseTag()]={offset:b.parseUShort()};return c}function f(b,d){b=new t.Parser(b,d);var c=b.parseUShort();d=b.parseUShort();if(1===c)return b.parseUShortList(d);if(2===c){for(c=[];d--;)for(var f=b.parseUShort(), -g=b.parseUShort(),h=b.parseUShort();g>=f;f++)c[h++]=f;return c}}function c(b,d){b=new t.Parser(b,d);d=b.parseUShort();if(1===d){var c=b.parseUShort();d=b.parseUShort();var f=b.parseUShortList(d);return function(b){return f[b-c]||0}}if(2===d){d=b.parseUShort();for(var g=[],h=[],k=[],l=0;d>l;l++)g[l]=b.parseUShort(),h[l]=b.parseUShort(),k[l]=b.parseUShort();return function(b){for(var d=0,c=g.length-1;c>d;){var f=d+c+1>>1;bk;k++){var D=d[k],C=p[D];if(!C)for(C={},h.relativeOffset=D,D=h.parseUShort();D--;){var F=h.parseUShort();m&&(g=h.parseShort());n&&h.parseShort();C[F]=g}E[l[k]]=C}return function(b,d){return(b=E[b])?b[d]:void 0}}if(2===k){var C=h.parseUShort(),D=h.parseUShort(),p=h.parseUShort(),k=h.parseUShort(),z=c(b,d+C),H=c(b,d+D), -G=[];for(b=0;p>b;b++)for(d=G[b]=[],C=0;k>C;C++)m&&(g=h.parseShort()),n&&h.parseShort(),d[C]=g;var O={};for(b=0;bf;f++)n.push(k(b,d+m[f]));c.getKerningValue=function(b,d){for(var c= -n.length;c--;){var f=n[c](b,d);if(void 0!==f)return f}return 0}}return c}var p=g('../check'),t=g('../parse');b.parse=function(b,d,c){var f=new t.Parser(b,d),g=f.parseFixed();p.argument(1===g,'Unsupported GPOS table version.');l(b,d+f.parseUShort());l(b,d+f.parseUShort());var h=f.parseUShort();f.relativeOffset=h;g=f.parseUShort();f=f.parseOffset16List(g);d+=h;for(h=0;g>h;h++){var k=n(b,d+f[h]);2!==k.lookupType||c.getGposKerningValue||(c.getGposKerningValue=k.getKerningValue)}}},{'../check':2,'../parse':10}], -19:[function(g,m,b){var l=g('../check'),f=g('../parse').Parser,c=Array(9),k=g('../table');c[1]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(f.coverage),deltaGlyphId:this.parseUShort()}:2===c?{substFormat:2,coverage:this.parsePointer(f.coverage),substitute:this.parseOffset16List()}:void l.assert(!1,'0x'+b.toString(16)+': lookup type 1 format must be 1 or 2.')};c[2]=function(){var b=this.parseUShort();return l.argument(1=== -b,'GSUB Multiple Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(f.coverage),sequences:this.parseListOfLists()}};c[3]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Alternate Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(f.coverage),alternateSets:this.parseListOfLists()}};c[4]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB ligature table identifier-format must be 1'), -{substFormat:b,coverage:this.parsePointer(f.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var n={sequenceIndex:f.uShort,lookupListIndex:f.uShort};c[5]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();if(1===c)return{substFormat:c,coverage:this.parsePointer(f.coverage),ruleSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(b- -1),lookupRecords:this.parseRecordList(d,n)}})};if(2===c)return{substFormat:c,coverage:this.parsePointer(f.coverage),classDef:this.parsePointer(f.classDef),classSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(b-1),lookupRecords:this.parseRecordList(d,n)}})};if(3===c){var b=this.parseUShort(),d=this.parseUShort();return{substFormat:c,coverages:this.parseList(b,f.pointer(f.coverage)),lookupRecords:this.parseRecordList(d,n)}}l.assert(!1, -'0x'+b.toString(16)+': lookup type 5 format must be 1, 2 or 3.')};c[6]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(f.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:2===c?{substFormat:2,coverage:this.parsePointer(f.coverage),backtrackClassDef:this.parsePointer(f.classDef), -inputClassDef:this.parsePointer(f.classDef),lookaheadClassDef:this.parsePointer(f.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:3===c?{substFormat:3,backtrackCoverage:this.parseList(f.pointer(f.coverage)),inputCoverage:this.parseList(f.pointer(f.coverage)),lookaheadCoverage:this.parseList(f.pointer(f.coverage)),lookupRecords:this.parseRecordList(n)}: -void l.assert(!1,'0x'+b.toString(16)+': lookup type 6 format must be 1, 2 or 3.')};c[7]=function(){var b=this.parseUShort();l.argument(1===b,'GSUB Extension Substitution subtable identifier-format must be 1');var b=this.parseUShort(),g=new f(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:b,extension:c[b].call(g)}};c[8]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1'),{substFormat:b, -coverage:this.parsePointer(f.coverage),backtrackCoverage:this.parseList(f.pointer(f.coverage)),lookaheadCoverage:this.parseList(f.pointer(f.coverage)),substitutes:this.parseUShortList()}};var p=Array(9);p[1]=function(b){return 1===b.substFormat?new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)},{name:'deltaGlyphID',type:'USHORT',value:b.deltaGlyphId}]):new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT', +for(d=0;w>d;d+=1)for(E=b.parseCard8(),y=b.parseCard8(),A=E;E+y>=A;A+=1)v[A]=m,m+=1}b=new x.CffEncoding(v,l)}c.cffEncoding=b;c.encoding=c.encoding||c.cffEncoding;c.glyphs=new q.GlyphSet(c);for(b=0;bb;b+=1)for(m=k.parseULong(),d=k.parseULong(),l=k.parseULong();d>=m;m+=1)h.glyphIndexMap[m]=l,l++}else{if(4!==h.format)throw Error('Only format 4 and 12 cmap tables are supported.');var p=d;h.length=k.parseUShort();h.language=k.parseUShort(); +h.segCount=d=k.parseUShort()>>1;k.skip('uShort',3);h.glyphIndexMap={};k=new c.Parser(b,e+p+14);var l=new c.Parser(b,e+p+16+2*d),m=new c.Parser(b,e+p+16+4*d),q=new c.Parser(b,e+p+16+6*d),p=e+p+16+8*d;for(e=0;d-1>e;e+=1)for(var u=k.parseUShort(),A=l.parseUShort(),E=m.parseShort(),D=q.parseUShort(),C=A;u>=C;C+=1)0!==D?(p=q.offset+q.relativeOffset-2,p+=D,p+=2*(C-A),n=c.getUShort(b,p),0!==n&&(n=n+E&65535)):n=C+E&65535,h.glyphIndexMap[C]=n}return h};b.make=function(b){var c,e=new k.Table('cmap',[{name:'version', +type:'USHORT',value:0},{name:'numTables',type:'USHORT',value:1},{name:'platformID',type:'USHORT',value:3},{name:'encodingID',type:'USHORT',value:1},{name:'offset',type:'ULONG',value:12},{name:'format',type:'USHORT',value:4},{name:'length',type:'USHORT',value:0},{name:'language',type:'USHORT',value:0},{name:'segCountX2',type:'USHORT',value:0},{name:'searchRange',type:'USHORT',value:0},{name:'entrySelector',type:'USHORT',value:0},{name:'rangeShift',type:'USHORT',value:0}]);e.segments=[];for(c=0;cc;c+=1){var x=e.segments[c],g=g.concat({name:'end_'+c,type:'USHORT',value:x.end}), +d=d.concat({name:'start_'+c,type:'USHORT',value:x.start}),m=m.concat({name:'idDelta_'+c,type:'SHORT',value:x.delta}),n=n.concat({name:'idRangeOffset_'+c,type:'USHORT',value:x.offset});void 0!==x.glyphId&&(y=y.concat({name:'glyph_'+c,type:'USHORT',value:x.glyphId}))}return e.fields=e.fields.concat(g),e.fields.push({name:'reservedPad',type:'USHORT',value:0}),e.fields=e.fields.concat(d),e.fields=e.fields.concat(m),e.fields=e.fields.concat(n),e.fields=e.fields.concat(y),e.length=2*g.length+16+2*d.length+ +2*m.length+2*n.length+2*y.length,e}},{'../check':2,'../parse':10,'../table':13}],16:[function(e,m,b){function l(b,c){var d=JSON.stringify(b),e=256,g;for(g in c){var h=parseInt(g);if(h&&!(256>h)){if(JSON.stringify(c[g])===d)return h;h>=e&&(e=h+1)}}return c[e]=b,e}function g(b,c,e){e=l(c.name,e);return[{name:'tag_'+b,type:'TAG',value:c.tag},{name:'minValue_'+b,type:'FIXED',value:c.minValue<<16},{name:'defaultValue_'+b,type:'FIXED',value:c.defaultValue<<16},{name:'maxValue_'+b,type:'FIXED',value:c.maxValue<< +16},{name:'flags_'+b,type:'USHORT',value:0},{name:'nameID_'+b,type:'USHORT',value:e}]}function c(b,c,e){var d={};b=new t.Parser(b,c);return d.tag=b.parseTag(),d.minValue=b.parseFixed(),d.defaultValue=b.parseFixed(),d.maxValue=b.parseFixed(),b.skip('uShort',1),d.name=e[b.parseUShort()]||{},d}function k(b,c,e,g){g=l(c.name,g);g=[{name:'nameID_'+b,type:'USHORT',value:g},{name:'flags_'+b,type:'USHORT',value:0}];for(var d=0;dw;w++)v.push(c(b,e+k+w*m,g));w=[];e=e+k+l*m;for(k=0;h>k;k++)w.push(n(b,e+k*d,v,g));return{axes:v,instances:w}}},{'../check':2,'../parse':10,'../table':13}],17:[function(e,m,b){function l(b,c,e,g,h){var d;return 0<(c&g)?(d=b.parseByte(),0===(c&h)&&(d=-d),d=e+d):d=0<(c&h)?e:e+b.parseShort(),d}function g(b,c,e){c=new t.Parser(c,e);b.numberOfContours=c.parseShort();b._xMin=c.parseShort();b._yMin=c.parseShort(); +b._xMax=c.parseShort();b._yMax=c.parseShort();var d;if(0g;g+=1)if(d=c.parseByte(),e.push(d),0<(8&d))for(var m=c.parseByte(),p=0;m>p;p+=1)e.push(d),g+=1;if(n.argument(e.length===k,'Bad flags.'),0g;g+= +1)d=e[g],m={},m.onCurve=!!(1&d),m.lastPointOfContour=0<=h.indexOf(g),p.push(m);for(g=h=0;k>g;g+=1)d=e[g],m=p[g],m.x=l(c,d,h,2,16),h=m.x;for(g=h=0;k>g;g+=1)d=e[g],m=p[g],m.y=l(c,d,h,4,32),h=m.y}b.points=p}else b.points=[]}else if(0===b.numberOfContours)b.points=[];else for(b.isComposite=!0,b.points=[],b.components=[],d=!0;d;)e=c.parseUShort(),d={glyphIndex:c.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0},0<(1&e)?0<(2&e)?(d.dx=c.parseShort(),d.dy=c.parseShort()):d.matchedPoints=[c.parseUShort(), +c.parseUShort()]:0<(2&e)?(d.dx=c.parseChar(),d.dy=c.parseChar()):d.matchedPoints=[c.parseByte(),c.parseByte()],0<(8&e)?d.xScale=d.yScale=c.parseF2Dot14():0<(64&e)?(d.xScale=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()):0<(128&e)&&(d.xScale=c.parseF2Dot14(),d.scale01=c.parseF2Dot14(),d.scale10=c.parseF2Dot14(),d.yScale=c.parseF2Dot14()),b.components.push(d),d=!!(32&e)}function c(b,c){for(var d=[],e=0;ee.points.length-1||g.matchedPoints[1]>k.points.length-1)throw Error('Matched points out of range in '+e.name);var l=e.points[g.matchedPoints[0]],m=k.points[g.matchedPoints[1]],g={xScale:g.xScale,scale01:g.scale01,scale10:g.scale10,yScale:g.yScale, +dx:0,dy:0},m=c([m],g)[0];g.dx=l.x-m.x;g.dy=l.y-m.y}k=c(k.points,g);e.points=e.points.concat(k)}}var p;e=e.points;b=new h.Path;if(e){d=[];k=[];for(l=0;le;e++)c[b.parseTag()]={offset:b.parseUShort()};return c}function g(b,d){b=new t.Parser(b,d);var c=b.parseUShort();d=b.parseUShort();if(1===c)return b.parseUShortList(d);if(2===c){for(c=[];d--;)for(var e=b.parseUShort(), +g=b.parseUShort(),h=b.parseUShort();g>=e;e++)c[h++]=e;return c}}function c(b,d){b=new t.Parser(b,d);d=b.parseUShort();if(1===d){var c=b.parseUShort();d=b.parseUShort();var e=b.parseUShortList(d);return function(b){return e[b-c]||0}}if(2===d){d=b.parseUShort();for(var g=[],h=[],k=[],l=0;d>l;l++)g[l]=b.parseUShort(),h[l]=b.parseUShort(),k[l]=b.parseUShort();return function(b){for(var d=0,c=g.length-1;c>d;){var e=d+c+1>>1;bk;k++){var D=d[k],C=p[D];if(!C)for(C={},h.relativeOffset=D,D=h.parseUShort();D--;){var F=h.parseUShort();m&&(e=h.parseShort());n&&h.parseShort();C[F]=e}E[l[k]]=C}return function(b,d){return(b=E[b])?b[d]:void 0}}if(2===k){var C=h.parseUShort(),D=h.parseUShort(),p=h.parseUShort(),k=h.parseUShort(),z=c(b,d+C),H=c(b,d+D), +G=[];for(b=0;p>b;b++)for(d=G[b]=[],C=0;k>C;C++)m&&(e=h.parseShort()),n&&h.parseShort(),d[C]=e;var O={};for(b=0;be;e++)n.push(k(b,d+m[e]));c.getKerningValue=function(b,d){for(var c= +n.length;c--;){var e=n[c](b,d);if(void 0!==e)return e}return 0}}return c}var p=e('../check'),t=e('../parse');b.parse=function(b,d,c){var e=new t.Parser(b,d),g=e.parseFixed();p.argument(1===g,'Unsupported GPOS table version.');l(b,d+e.parseUShort());l(b,d+e.parseUShort());var h=e.parseUShort();e.relativeOffset=h;g=e.parseUShort();e=e.parseOffset16List(g);d+=h;for(h=0;g>h;h++){var k=n(b,d+e[h]);2!==k.lookupType||c.getGposKerningValue||(c.getGposKerningValue=k.getKerningValue)}}},{'../check':2,'../parse':10}], +19:[function(e,m,b){var l=e('../check'),g=e('../parse').Parser,c=Array(9),k=e('../table');c[1]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(g.coverage),deltaGlyphId:this.parseUShort()}:2===c?{substFormat:2,coverage:this.parsePointer(g.coverage),substitute:this.parseOffset16List()}:void l.assert(!1,'0x'+b.toString(16)+': lookup type 1 format must be 1 or 2.')};c[2]=function(){var b=this.parseUShort();return l.argument(1=== +b,'GSUB Multiple Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(g.coverage),sequences:this.parseListOfLists()}};c[3]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Alternate Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(g.coverage),alternateSets:this.parseListOfLists()}};c[4]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB ligature table identifier-format must be 1'), +{substFormat:b,coverage:this.parsePointer(g.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var n={sequenceIndex:g.uShort,lookupListIndex:g.uShort};c[5]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();if(1===c)return{substFormat:c,coverage:this.parsePointer(g.coverage),ruleSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(b- +1),lookupRecords:this.parseRecordList(d,n)}})};if(2===c)return{substFormat:c,coverage:this.parsePointer(g.coverage),classDef:this.parsePointer(g.classDef),classSets:this.parseListOfLists(function(){var b=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(b-1),lookupRecords:this.parseRecordList(d,n)}})};if(3===c){var b=this.parseUShort(),d=this.parseUShort();return{substFormat:c,coverages:this.parseList(b,g.pointer(g.coverage)),lookupRecords:this.parseRecordList(d,n)}}l.assert(!1, +'0x'+b.toString(16)+': lookup type 5 format must be 1, 2 or 3.')};c[6]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(g.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:2===c?{substFormat:2,coverage:this.parsePointer(g.coverage),backtrackClassDef:this.parsePointer(g.classDef), +inputClassDef:this.parsePointer(g.classDef),lookaheadClassDef:this.parsePointer(g.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:3===c?{substFormat:3,backtrackCoverage:this.parseList(g.pointer(g.coverage)),inputCoverage:this.parseList(g.pointer(g.coverage)),lookaheadCoverage:this.parseList(g.pointer(g.coverage)),lookupRecords:this.parseRecordList(n)}: +void l.assert(!1,'0x'+b.toString(16)+': lookup type 6 format must be 1, 2 or 3.')};c[7]=function(){var b=this.parseUShort();l.argument(1===b,'GSUB Extension Substitution subtable identifier-format must be 1');var b=this.parseUShort(),e=new g(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:b,extension:c[b].call(e)}};c[8]=function(){var b=this.parseUShort();return l.argument(1===b,'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1'),{substFormat:b, +coverage:this.parsePointer(g.coverage),backtrackCoverage:this.parseList(g.pointer(g.coverage)),lookaheadCoverage:this.parseList(g.pointer(g.coverage)),substitutes:this.parseUShortList()}};var p=Array(9);p[1]=function(b){return 1===b.substFormat?new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)},{name:'deltaGlyphID',type:'USHORT',value:b.deltaGlyphId}]):new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT', value:2},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)}].concat(k.ushortList('substitute',b.substitute)))};p[3]=function(b){return l.assert(1===b.substFormat,'Lookup type 3 substFormat must be 1.'),new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)}].concat(k.tableList('altSet',b.alternateSets,function(b){return new k.Table('alternateSetTable',k.ushortList('alternate',b))})))};p[4]=function(b){return l.assert(1=== b.substFormat,'Lookup type 4 substFormat must be 1.'),new k.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new k.Coverage(b.coverage)}].concat(k.tableList('ligSet',b.ligatureSets,function(b){return new k.Table('ligatureSetTable',k.tableList('ligature',b,function(b){return new k.Table('ligatureTable',[{name:'ligGlyph',type:'USHORT',value:b.ligGlyph}].concat(k.ushortList('component',b.components,b.components.length+1)))}))})))};b.parse=function(b, -g){b=new f(b,g||0);g=b.parseVersion();return l.argument(1===g,'Unsupported GSUB table version.'),{version:g,scripts:b.parseScriptList(),features:b.parseFeatureList(),lookups:b.parseLookupList(c)}};b.make=function(b){return new k.Table('GSUB',[{name:'version',type:'ULONG',value:65536},{name:'scripts',type:'TABLE',value:new k.ScriptList(b.scripts)},{name:'features',type:'TABLE',value:new k.FeatureList(b.features)},{name:'lookups',type:'TABLE',value:new k.LookupList(b.lookups,p)}])}},{'../check':2,'../parse':10, -'../table':13}],20:[function(g,m,b){var l=g('../check'),f=g('../parse'),c=g('../table');b.parse=function(b,c){var g={};b=new f.Parser(b,c);return g.version=b.parseVersion(),g.fontRevision=Math.round(1E3*b.parseFixed())/1E3,g.checkSumAdjustment=b.parseULong(),g.magicNumber=b.parseULong(),l.argument(1594834165===g.magicNumber,'Font header has wrong magic number.'),g.flags=b.parseUShort(),g.unitsPerEm=b.parseUShort(),g.created=b.parseLongDateTime(),g.modified=b.parseLongDateTime(),g.xMin=b.parseShort(), -g.yMin=b.parseShort(),g.xMax=b.parseShort(),g.yMax=b.parseShort(),g.macStyle=b.parseUShort(),g.lowestRecPPEM=b.parseUShort(),g.fontDirectionHint=b.parseShort(),g.indexToLocFormat=b.parseShort(),g.glyphDataFormat=b.parseShort(),g};b.make=function(b){var f=Math.round((new Date).getTime()/1E3)+2082844800,g=f;return b.createdTimestamp&&(g=b.createdTimestamp+2082844800),new c.Table('head',[{name:'version',type:'FIXED',value:65536},{name:'fontRevision',type:'FIXED',value:65536},{name:'checkSumAdjustment', -type:'ULONG',value:0},{name:'magicNumber',type:'ULONG',value:1594834165},{name:'flags',type:'USHORT',value:0},{name:'unitsPerEm',type:'USHORT',value:1E3},{name:'created',type:'LONGDATETIME',value:g},{name:'modified',type:'LONGDATETIME',value:f},{name:'xMin',type:'SHORT',value:0},{name:'yMin',type:'SHORT',value:0},{name:'xMax',type:'SHORT',value:0},{name:'yMax',type:'SHORT',value:0},{name:'macStyle',type:'USHORT',value:0},{name:'lowestRecPPEM',type:'USHORT',value:0},{name:'fontDirectionHint',type:'SHORT', -value:2},{name:'indexToLocFormat',type:'SHORT',value:0},{name:'glyphDataFormat',type:'SHORT',value:0}],b)}},{'../check':2,'../parse':10,'../table':13}],21:[function(g,m,b){var l=g('../parse'),f=g('../table');b.parse=function(b,f){var c={};b=new l.Parser(b,f);return c.version=b.parseVersion(),c.ascender=b.parseShort(),c.descender=b.parseShort(),c.lineGap=b.parseShort(),c.advanceWidthMax=b.parseUShort(),c.minLeftSideBearing=b.parseShort(),c.minRightSideBearing=b.parseShort(),c.xMaxExtent=b.parseShort(), -c.caretSlopeRise=b.parseShort(),c.caretSlopeRun=b.parseShort(),c.caretOffset=b.parseShort(),b.relativeOffset+=8,c.metricDataFormat=b.parseShort(),c.numberOfHMetrics=b.parseUShort(),c};b.make=function(b){return new f.Table('hhea',[{name:'version',type:'FIXED',value:65536},{name:'ascender',type:'FWORD',value:0},{name:'descender',type:'FWORD',value:0},{name:'lineGap',type:'FWORD',value:0},{name:'advanceWidthMax',type:'UFWORD',value:0},{name:'minLeftSideBearing',type:'FWORD',value:0},{name:'minRightSideBearing', -type:'FWORD',value:0},{name:'xMaxExtent',type:'FWORD',value:0},{name:'caretSlopeRise',type:'SHORT',value:1},{name:'caretSlopeRun',type:'SHORT',value:0},{name:'caretOffset',type:'SHORT',value:0},{name:'reserved1',type:'SHORT',value:0},{name:'reserved2',type:'SHORT',value:0},{name:'reserved3',type:'SHORT',value:0},{name:'reserved4',type:'SHORT',value:0},{name:'metricDataFormat',type:'SHORT',value:0},{name:'numberOfHMetrics',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],22:[function(g, -m,b){var l=g('../parse'),f=g('../table');b.parse=function(b,f,g,m,t){var c,d;b=new l.Parser(b,f);for(f=0;m>f;f+=1){g>f&&(c=b.parseUShort(),d=b.parseShort());var k=t.get(f);k.advanceWidth=c;k.leftSideBearing=d}};b.make=function(b){for(var c=new f.Table('hmtx',[]),g=0;gk;k+=1){var m=b.parseUShort(),h=b.parseUShort(),d=b.parseShort();c[m+','+h]=d}return c}},{'../check':2,'../parse':10}],24:[function(g,m,b){var l=g('../parse');b.parse= -function(b,c,g,m){b=new l.Parser(b,c);c=m?b.parseUShort:b.parseULong;for(var f=[],k=0;g+1>k;k+=1){var h=c.call(b);m&&(h*=2);f.push(h)}return f}},{'../parse':10}],25:[function(g,m,b){var l=g('../check'),f=g('../parse'),c=g('../table');b.make=function(b){for(var f=new c.Table('ltag',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'numTags',type:'ULONG',value:b.length}]),g='',k=12+4*b.length,h=0;hd&&(d=g.length,g+=b[h]);f.fields.push({name:'offset '+ -h,type:'USHORT',value:k+d});f.fields.push({name:'length '+h,type:'USHORT',value:b[h].length})}return f.fields.push({name:'stringPool',type:'CHARARRAY',value:g}),f};b.parse=function(b,c){var g=new f.Parser(b,c),k=g.parseULong();l.argument(1===k,'Unsupported ltag table version.');g.skip('uLong',1);for(var k=g.parseULong(),h=[],d=0;k>d;d++){for(var m='',n=c+g.parseUShort(),y=g.parseUShort(),x=n;n+y>x;++x)m+=String.fromCharCode(b.getInt8(x));h.push(m)}return h}},{'../check':2,'../parse':10,'../table':13}], -26:[function(g,m,b){var l=g('../parse'),f=g('../table');b.parse=function(b,f){var c={};b=new l.Parser(b,f);return c.version=b.parseVersion(),c.numGlyphs=b.parseUShort(),1===c.version&&(c.maxPoints=b.parseUShort(),c.maxContours=b.parseUShort(),c.maxCompositePoints=b.parseUShort(),c.maxCompositeContours=b.parseUShort(),c.maxZones=b.parseUShort(),c.maxTwilightPoints=b.parseUShort(),c.maxStorage=b.parseUShort(),c.maxFunctionDefs=b.parseUShort(),c.maxInstructionDefs=b.parseUShort(),c.maxStackElements= -b.parseUShort(),c.maxSizeOfInstructions=b.parseUShort(),c.maxComponentElements=b.parseUShort(),c.maxComponentDepth=b.parseUShort()),c};b.make=function(b){return new f.Table('maxp',[{name:'version',type:'FIXED',value:20480},{name:'numGlyphs',type:'USHORT',value:b}])}},{'../parse':10,'../table':13}],27:[function(g,m,b){var l=g('../types').decode,f=g('../check'),c=g('../parse'),k=g('../table');b.parse=function(b,g){var k=new c.Parser(b,g),h=k.parseULong();f.argument(1===h,'Unsupported META table version.'); -k.parseULong();k.parseULong();for(var h=k.parseULong(),d={},m=0;h>m;m++){var n=k.parseTag(),p=k.parseULong(),x=k.parseULong(),p=l.UTF8(b,g+p,x);d[n]=p}return d};b.make=function(b){var c=Object.keys(b).length,f='',g=16+12*c,c=new k.Table('meta',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'offset',type:'ULONG',value:g},{name:'numTags',type:'ULONG',value:c}]),d;for(d in b){var l=f.length,f=f+b[d];c.fields.push({name:'tag '+d,type:'TAG',value:d});c.fields.push({name:'offset '+ -d,type:'ULONG',value:g+l});c.fields.push({name:'length '+d,type:'ULONG',value:b[d].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:f}),c}},{'../check':2,'../parse':10,'../table':13,'../types':32}],28:[function(g,m,b){function l(b,d,c){switch(b){case 0:return x;case 1:return u[c]||q[d];case 3:if(1===d||10===d)return x}}function f(b){var d={},c;for(c in b)d[b[c]]=parseInt(c);return d}function c(b,d,c,f,g,k){return new h.Record('NameRecord',[{name:'platformID',type:'USHORT',value:b}, -{name:'encodingID',type:'USHORT',value:d},{name:'languageID',type:'USHORT',value:c},{name:'nameID',type:'USHORT',value:f},{name:'length',type:'USHORT',value:g},{name:'offset',type:'USHORT',value:k}])}function k(b,d){var c;a:{c=b.length;var f=d.length-c+1,g=0;b:for(;f>g;g++)for(;f>g;){for(var h=0;c>h;h++)if(d[g+h]!==b[h])continue b;c=g;break a}c=-1}if(0>c)for(c=d.length,f=0,g=b.length;g>f;++f)d.push(b[f]);return c}m=g('../types');var n=m.decode,p=m.encode,t=g('../parse'),h=g('../table'),d='copyright fontFamily fontSubfamily uniqueID fullName version postScriptName trademark manufacturer designer description manufacturerURL designerURL license licenseURL reserved preferredFamily preferredSubfamily compatibleFullName sampleText postScriptFindFontName wwsFamily wwsSubfamily'.split(' '), +e){b=new g(b,e||0);e=b.parseVersion();return l.argument(1===e,'Unsupported GSUB table version.'),{version:e,scripts:b.parseScriptList(),features:b.parseFeatureList(),lookups:b.parseLookupList(c)}};b.make=function(b){return new k.Table('GSUB',[{name:'version',type:'ULONG',value:65536},{name:'scripts',type:'TABLE',value:new k.ScriptList(b.scripts)},{name:'features',type:'TABLE',value:new k.FeatureList(b.features)},{name:'lookups',type:'TABLE',value:new k.LookupList(b.lookups,p)}])}},{'../check':2,'../parse':10, +'../table':13}],20:[function(e,m,b){var l=e('../check'),g=e('../parse'),c=e('../table');b.parse=function(b,c){var e={};b=new g.Parser(b,c);return e.version=b.parseVersion(),e.fontRevision=Math.round(1E3*b.parseFixed())/1E3,e.checkSumAdjustment=b.parseULong(),e.magicNumber=b.parseULong(),l.argument(1594834165===e.magicNumber,'Font header has wrong magic number.'),e.flags=b.parseUShort(),e.unitsPerEm=b.parseUShort(),e.created=b.parseLongDateTime(),e.modified=b.parseLongDateTime(),e.xMin=b.parseShort(), +e.yMin=b.parseShort(),e.xMax=b.parseShort(),e.yMax=b.parseShort(),e.macStyle=b.parseUShort(),e.lowestRecPPEM=b.parseUShort(),e.fontDirectionHint=b.parseShort(),e.indexToLocFormat=b.parseShort(),e.glyphDataFormat=b.parseShort(),e};b.make=function(b){var e=Math.round((new Date).getTime()/1E3)+2082844800,g=e;return b.createdTimestamp&&(g=b.createdTimestamp+2082844800),new c.Table('head',[{name:'version',type:'FIXED',value:65536},{name:'fontRevision',type:'FIXED',value:65536},{name:'checkSumAdjustment', +type:'ULONG',value:0},{name:'magicNumber',type:'ULONG',value:1594834165},{name:'flags',type:'USHORT',value:0},{name:'unitsPerEm',type:'USHORT',value:1E3},{name:'created',type:'LONGDATETIME',value:g},{name:'modified',type:'LONGDATETIME',value:e},{name:'xMin',type:'SHORT',value:0},{name:'yMin',type:'SHORT',value:0},{name:'xMax',type:'SHORT',value:0},{name:'yMax',type:'SHORT',value:0},{name:'macStyle',type:'USHORT',value:0},{name:'lowestRecPPEM',type:'USHORT',value:0},{name:'fontDirectionHint',type:'SHORT', +value:2},{name:'indexToLocFormat',type:'SHORT',value:0},{name:'glyphDataFormat',type:'SHORT',value:0}],b)}},{'../check':2,'../parse':10,'../table':13}],21:[function(e,m,b){var l=e('../parse'),g=e('../table');b.parse=function(b,e){var c={};b=new l.Parser(b,e);return c.version=b.parseVersion(),c.ascender=b.parseShort(),c.descender=b.parseShort(),c.lineGap=b.parseShort(),c.advanceWidthMax=b.parseUShort(),c.minLeftSideBearing=b.parseShort(),c.minRightSideBearing=b.parseShort(),c.xMaxExtent=b.parseShort(), +c.caretSlopeRise=b.parseShort(),c.caretSlopeRun=b.parseShort(),c.caretOffset=b.parseShort(),b.relativeOffset+=8,c.metricDataFormat=b.parseShort(),c.numberOfHMetrics=b.parseUShort(),c};b.make=function(b){return new g.Table('hhea',[{name:'version',type:'FIXED',value:65536},{name:'ascender',type:'FWORD',value:0},{name:'descender',type:'FWORD',value:0},{name:'lineGap',type:'FWORD',value:0},{name:'advanceWidthMax',type:'UFWORD',value:0},{name:'minLeftSideBearing',type:'FWORD',value:0},{name:'minRightSideBearing', +type:'FWORD',value:0},{name:'xMaxExtent',type:'FWORD',value:0},{name:'caretSlopeRise',type:'SHORT',value:1},{name:'caretSlopeRun',type:'SHORT',value:0},{name:'caretOffset',type:'SHORT',value:0},{name:'reserved1',type:'SHORT',value:0},{name:'reserved2',type:'SHORT',value:0},{name:'reserved3',type:'SHORT',value:0},{name:'reserved4',type:'SHORT',value:0},{name:'metricDataFormat',type:'SHORT',value:0},{name:'numberOfHMetrics',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],22:[function(e, +m,b){var l=e('../parse'),g=e('../table');b.parse=function(b,e,g,m,t){var c,d;b=new l.Parser(b,e);for(e=0;m>e;e+=1){g>e&&(c=b.parseUShort(),d=b.parseShort());var k=t.get(e);k.advanceWidth=c;k.leftSideBearing=d}};b.make=function(b){for(var c=new g.Table('hmtx',[]),e=0;ek;k+=1){var m=b.parseUShort(),h=b.parseUShort(),d=b.parseShort();c[m+','+h]=d}return c}},{'../check':2,'../parse':10}],24:[function(e,m,b){var l=e('../parse');b.parse= +function(b,c,e,m){b=new l.Parser(b,c);c=m?b.parseUShort:b.parseULong;for(var g=[],k=0;e+1>k;k+=1){var h=c.call(b);m&&(h*=2);g.push(h)}return g}},{'../parse':10}],25:[function(e,m,b){var l=e('../check'),g=e('../parse'),c=e('../table');b.make=function(b){for(var e=new c.Table('ltag',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'numTags',type:'ULONG',value:b.length}]),g='',k=12+4*b.length,h=0;hd&&(d=g.length,g+=b[h]);e.fields.push({name:'offset '+ +h,type:'USHORT',value:k+d});e.fields.push({name:'length '+h,type:'USHORT',value:b[h].length})}return e.fields.push({name:'stringPool',type:'CHARARRAY',value:g}),e};b.parse=function(b,c){var e=new g.Parser(b,c),k=e.parseULong();l.argument(1===k,'Unsupported ltag table version.');e.skip('uLong',1);for(var k=e.parseULong(),h=[],d=0;k>d;d++){for(var m='',n=c+e.parseUShort(),y=e.parseUShort(),x=n;n+y>x;++x)m+=String.fromCharCode(b.getInt8(x));h.push(m)}return h}},{'../check':2,'../parse':10,'../table':13}], +26:[function(e,m,b){var l=e('../parse'),g=e('../table');b.parse=function(b,e){var c={};b=new l.Parser(b,e);return c.version=b.parseVersion(),c.numGlyphs=b.parseUShort(),1===c.version&&(c.maxPoints=b.parseUShort(),c.maxContours=b.parseUShort(),c.maxCompositePoints=b.parseUShort(),c.maxCompositeContours=b.parseUShort(),c.maxZones=b.parseUShort(),c.maxTwilightPoints=b.parseUShort(),c.maxStorage=b.parseUShort(),c.maxFunctionDefs=b.parseUShort(),c.maxInstructionDefs=b.parseUShort(),c.maxStackElements= +b.parseUShort(),c.maxSizeOfInstructions=b.parseUShort(),c.maxComponentElements=b.parseUShort(),c.maxComponentDepth=b.parseUShort()),c};b.make=function(b){return new g.Table('maxp',[{name:'version',type:'FIXED',value:20480},{name:'numGlyphs',type:'USHORT',value:b}])}},{'../parse':10,'../table':13}],27:[function(e,m,b){var l=e('../types').decode,g=e('../check'),c=e('../parse'),k=e('../table');b.parse=function(b,e){var k=new c.Parser(b,e),h=k.parseULong();g.argument(1===h,'Unsupported META table version.'); +k.parseULong();k.parseULong();for(var h=k.parseULong(),d={},m=0;h>m;m++){var n=k.parseTag(),p=k.parseULong(),x=k.parseULong(),p=l.UTF8(b,e+p,x);d[n]=p}return d};b.make=function(b){var c=Object.keys(b).length,e='',g=16+12*c,c=new k.Table('meta',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'offset',type:'ULONG',value:g},{name:'numTags',type:'ULONG',value:c}]),d;for(d in b){var l=e.length,e=e+b[d];c.fields.push({name:'tag '+d,type:'TAG',value:d});c.fields.push({name:'offset '+ +d,type:'ULONG',value:g+l});c.fields.push({name:'length '+d,type:'ULONG',value:b[d].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:e}),c}},{'../check':2,'../parse':10,'../table':13,'../types':32}],28:[function(e,m,b){function l(b,d,c){switch(b){case 0:return x;case 1:return u[c]||q[d];case 3:if(1===d||10===d)return x}}function g(b){var d={},c;for(c in b)d[b[c]]=parseInt(c);return d}function c(b,d,c,e,g,k){return new h.Record('NameRecord',[{name:'platformID',type:'USHORT',value:b}, +{name:'encodingID',type:'USHORT',value:d},{name:'languageID',type:'USHORT',value:c},{name:'nameID',type:'USHORT',value:e},{name:'length',type:'USHORT',value:g},{name:'offset',type:'USHORT',value:k}])}function k(b,d){var c;a:{c=b.length;var e=d.length-c+1,g=0;b:for(;e>g;g++)for(;e>g;){for(var h=0;c>h;h++)if(d[g+h]!==b[h])continue b;c=g;break a}c=-1}if(0>c)for(c=d.length,e=0,g=b.length;g>e;++e)d.push(b[e]);return c}m=e('../types');var n=m.decode,p=m.encode,t=e('../parse'),h=e('../table'),d='copyright fontFamily fontSubfamily uniqueID fullName version postScriptName trademark manufacturer designer description manufacturerURL designerURL license licenseURL reserved preferredFamily preferredSubfamily compatibleFullName sampleText postScriptFindFontName wwsFamily wwsSubfamily'.split(' '), v={0:'en',1:'fr',2:'de',3:'it',4:'nl',5:'sv',6:'es',7:'da',8:'pt',9:'no',10:'he',11:'ja',12:'ar',13:'fi',14:'el',15:'is',16:'mt',17:'tr',18:'hr',19:'zh-Hant',20:'ur',21:'hi',22:'th',23:'ko',24:'lt',25:'pl',26:'hu',27:'es',28:'lv',29:'se',30:'fo',31:'fa',32:'ru',33:'zh',34:'nl-BE',35:'ga',36:'sq',37:'ro',38:'cz',39:'sk',40:'si',41:'yi',42:'sr',43:'mk',44:'bg',45:'uk',46:'be',47:'uz',48:'kk',49:'az-Cyrl',50:'az-Arab',51:'hy',52:'ka',53:'mo',54:'ky',55:'tg',56:'tk',57:'mn-CN',58:'mn',59:'ps',60:'ks', 61:'ku',62:'sd',63:'bo',64:'ne',65:'sa',66:'mr',67:'bn',68:'as',69:'gu',70:'pa',71:'or',72:'ml',73:'kn',74:'ta',75:'te',76:'si',77:'my',78:'km',79:'lo',80:'vi',81:'id',82:'tl',83:'ms',84:'ms-Arab',85:'am',86:'ti',87:'om',88:'so',89:'sw',90:'rw',91:'rn',92:'ny',93:'mg',94:'eo',128:'cy',129:'eu',130:'ca',131:'la',132:'qu',133:'gn',134:'ay',135:'tt',136:'ug',137:'dz',138:'jv',139:'su',140:'gl',141:'af',142:'br',143:'iu',144:'gd',145:'gv',146:'ga',147:'to',148:'el-polyton',149:'kl',150:'az',151:'nn'}, w={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0, @@ -1758,41 +1758,41 @@ w={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17 1153:'mi',1146:'arn',1102:'mr',1148:'moh',1104:'mn',2128:'mn-CN',1121:'ne',1044:'nb',2068:'nn',1154:'oc',1096:'or',1123:'ps',1045:'pl',1046:'pt',2070:'pt-PT',1094:'pa',1131:'qu-BO',2155:'qu-EC',3179:'qu',1048:'ro',1047:'rm',1049:'ru',9275:'smn',4155:'smj-NO',5179:'smj',3131:'se-FI',1083:'se',2107:'se-SE',8251:'sms',6203:'sma-NO',7227:'sms',1103:'sa',7194:'sr-Cyrl-BA',3098:'sr',6170:'sr-Latn-BA',2074:'sr-Latn',1132:'nso',1074:'tn',1115:'si',1051:'sk',1060:'sl',11274:'es-AR',16394:'es-BO',13322:'es-CL', 9226:'es-CO',5130:'es-CR',7178:'es-DO',12298:'es-EC',17418:'es-SV',4106:'es-GT',18442:'es-HN',2058:'es-MX',19466:'es-NI',6154:'es-PA',15370:'es-PY',10250:'es-PE',20490:'es-PR',3082:'es',1034:'es',21514:'es-US',14346:'es-UY',8202:'es-VE',2077:'sv-FI',1053:'sv',1114:'syr',1064:'tg',2143:'tzm',1097:'ta',1092:'tt',1098:'te',1054:'th',1105:'bo',1055:'tr',1090:'tk',1152:'ug',1058:'uk',1070:'hsb',1056:'ur',2115:'uz-Cyrl',1091:'uz',1066:'vi',1106:'cy',1160:'wo',1157:'sah',1144:'ii',1130:'yo'},x='utf-16', q={0:'macintosh',1:'x-mac-japanese',2:'x-mac-chinesetrad',3:'x-mac-korean',6:'x-mac-greek',7:'x-mac-cyrillic',9:'x-mac-devanagai',10:'x-mac-gurmukhi',11:'x-mac-gujarati',12:'x-mac-oriya',13:'x-mac-bengali',14:'x-mac-tamil',15:'x-mac-telugu',16:'x-mac-kannada',17:'x-mac-malayalam',18:'x-mac-sinhalese',19:'x-mac-burmese',20:'x-mac-khmer',21:'x-mac-thai',22:'x-mac-lao',23:'x-mac-georgian',24:'x-mac-armenian',25:'x-mac-chinesesimp',26:'x-mac-tibetan',27:'x-mac-mongolian',28:'x-mac-ethiopic',29:'x-mac-ce', -30:'x-mac-vietnamese',31:'x-mac-extarabic'},u={15:'x-mac-icelandic',17:'x-mac-turkish',18:'x-mac-croatian',24:'x-mac-ce',25:'x-mac-ce',26:'x-mac-ce',27:'x-mac-ce',28:'x-mac-ce',30:'x-mac-icelandic',37:'x-mac-romanian',38:'x-mac-ce',39:'x-mac-ce',40:'x-mac-ce',143:'x-mac-inuit',146:'x-mac-gaelic'};b.parse=function(b,c,f){var g={};c=new t.Parser(b,c);for(var h=c.parseUShort(),k=c.parseUShort(),m=c.offset+c.parseUShort(),q=0;k>q;q++){var p=c.parseUShort(),w=c.parseUShort(),u=c.parseUShort(),A=c.parseUShort(), -A=d[A]||A,D=c.parseUShort(),E=c.parseUShort(),X;a:{switch(p){case 0:if(65535===u){X='und';break a}if(f){X=f[u];break a}break;case 1:X=v[u];break a;case 3:X=y[u];break a}X=void 0}p=l(p,w,u);void 0!==p&&void 0!==X&&(p=p===x?n.UTF16(b,m+E,D):n.MACSTRING(b,m+E,D,p))&&(w=g[A],void 0===w&&(w=g[A]={}),w[X]=p)}return 1===h&&c.parseUShort(),g};b.make=function(b,g){var m,n=[],q={},t=f(d),u;for(u in b){var x=t[u];if(void 0===x&&(x=u),m=parseInt(x),isNaN(m))throw Error('Name table entry "'+u+'" does not exist, see nameTableNames for complete list.'); -q[m]=b[u];n.push(m)}u=f(v);x=f(y);b=[];for(var t=[],A=0;AV&&(V=g.length,g.push(J)),X=4,T=p.UTF16(P));var fa=k(T,t);b.push(c(N,X,V,m,T.length,fa));N=x[J];void 0!==N&&(P=p.UTF16(P),V=k(P,t),b.push(c(3,1,N,m,P.length,V)))}}b.sort(function(b,d){return b.platformID-d.platformID||b.encodingID-d.encodingID||b.languageID-d.languageID||b.nameID-d.nameID});g=new h.Table('name', -[{name:'format',type:'USHORT',value:0},{name:'count',type:'USHORT',value:b.length},{name:'stringOffset',type:'USHORT',value:6+12*b.length}]);for(m=0;mp;p++){var q=c.parseUShort(),w=c.parseUShort(),u=c.parseUShort(),A=c.parseUShort(), +A=d[A]||A,D=c.parseUShort(),E=c.parseUShort(),X;a:{switch(q){case 0:if(65535===u){X='und';break a}if(e){X=e[u];break a}break;case 1:X=v[u];break a;case 3:X=y[u];break a}X=void 0}q=l(q,w,u);void 0!==q&&void 0!==X&&(q=q===x?n.UTF16(b,m+E,D):n.MACSTRING(b,m+E,D,q))&&(w=g[A],void 0===w&&(w=g[A]={}),w[X]=q)}return 1===h&&c.parseUShort(),g};b.make=function(b,e){var m,n=[],q={},t=g(d),u;for(u in b){var x=t[u];if(void 0===x&&(x=u),m=parseInt(x),isNaN(m))throw Error('Name table entry "'+u+'" does not exist, see nameTableNames for complete list.'); +q[m]=b[u];n.push(m)}u=g(v);x=g(y);b=[];for(var t=[],A=0;AV&&(V=e.length,e.push(J)),X=4,T=p.UTF16(P));var fa=k(T,t);b.push(c(N,X,V,m,T.length,fa));N=x[J];void 0!==N&&(P=p.UTF16(P),V=k(P,t),b.push(c(3,1,N,m,P.length,V)))}}b.sort(function(b,d){return b.platformID-d.platformID||b.encodingID-d.encodingID||b.languageID-d.languageID||b.nameID-d.nameID});e=new h.Table('name', +[{name:'format',type:'USHORT',value:0},{name:'count',type:'USHORT',value:b.length},{name:'stringOffset',type:'USHORT',value:6+12*b.length}]);for(m=0;m=g.begin&&bc;c++)f.panose[c]=b.parseByte();return f.ulUnicodeRange1=b.parseULong(),f.ulUnicodeRange2=b.parseULong(), -f.ulUnicodeRange3=b.parseULong(),f.ulUnicodeRange4=b.parseULong(),f.achVendID=String.fromCharCode(b.parseByte(),b.parseByte(),b.parseByte(),b.parseByte()),f.fsSelection=b.parseUShort(),f.usFirstCharIndex=b.parseUShort(),f.usLastCharIndex=b.parseUShort(),f.sTypoAscender=b.parseShort(),f.sTypoDescender=b.parseShort(),f.sTypoLineGap=b.parseShort(),f.usWinAscent=b.parseUShort(),f.usWinDescent=b.parseUShort(),1<=f.version&&(f.ulCodePageRange1=b.parseULong(),f.ulCodePageRange2=b.parseULong()),2<=f.version&& -(f.sxHeight=b.parseShort(),f.sCapHeight=b.parseShort(),f.usDefaultChar=b.parseUShort(),f.usBreakChar=b.parseUShort(),f.usMaxContent=b.parseUShort()),f};b.make=function(b){return new f.Table('OS/2',[{name:'version',type:'USHORT',value:3},{name:'xAvgCharWidth',type:'SHORT',value:0},{name:'usWeightClass',type:'USHORT',value:0},{name:'usWidthClass',type:'USHORT',value:0},{name:'fsType',type:'USHORT',value:0},{name:'ySubscriptXSize',type:'SHORT',value:650},{name:'ySubscriptYSize',type:'SHORT',value:699}, +end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66E3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];b.unicodeRanges=c;b.getUnicodeRange=function(b){for(var e=0;e=g.begin&&bc;c++)e.panose[c]=b.parseByte();return e.ulUnicodeRange1=b.parseULong(),e.ulUnicodeRange2=b.parseULong(), +e.ulUnicodeRange3=b.parseULong(),e.ulUnicodeRange4=b.parseULong(),e.achVendID=String.fromCharCode(b.parseByte(),b.parseByte(),b.parseByte(),b.parseByte()),e.fsSelection=b.parseUShort(),e.usFirstCharIndex=b.parseUShort(),e.usLastCharIndex=b.parseUShort(),e.sTypoAscender=b.parseShort(),e.sTypoDescender=b.parseShort(),e.sTypoLineGap=b.parseShort(),e.usWinAscent=b.parseUShort(),e.usWinDescent=b.parseUShort(),1<=e.version&&(e.ulCodePageRange1=b.parseULong(),e.ulCodePageRange2=b.parseULong()),2<=e.version&& +(e.sxHeight=b.parseShort(),e.sCapHeight=b.parseShort(),e.usDefaultChar=b.parseUShort(),e.usBreakChar=b.parseUShort(),e.usMaxContent=b.parseUShort()),e};b.make=function(b){return new g.Table('OS/2',[{name:'version',type:'USHORT',value:3},{name:'xAvgCharWidth',type:'SHORT',value:0},{name:'usWeightClass',type:'USHORT',value:0},{name:'usWidthClass',type:'USHORT',value:0},{name:'fsType',type:'USHORT',value:0},{name:'ySubscriptXSize',type:'SHORT',value:650},{name:'ySubscriptYSize',type:'SHORT',value:699}, {name:'ySubscriptXOffset',type:'SHORT',value:0},{name:'ySubscriptYOffset',type:'SHORT',value:140},{name:'ySuperscriptXSize',type:'SHORT',value:650},{name:'ySuperscriptYSize',type:'SHORT',value:699},{name:'ySuperscriptXOffset',type:'SHORT',value:0},{name:'ySuperscriptYOffset',type:'SHORT',value:479},{name:'yStrikeoutSize',type:'SHORT',value:49},{name:'yStrikeoutPosition',type:'SHORT',value:258},{name:'sFamilyClass',type:'SHORT',value:0},{name:'bFamilyType',type:'BYTE',value:0},{name:'bSerifStyle', type:'BYTE',value:0},{name:'bWeight',type:'BYTE',value:0},{name:'bProportion',type:'BYTE',value:0},{name:'bContrast',type:'BYTE',value:0},{name:'bStrokeVariation',type:'BYTE',value:0},{name:'bArmStyle',type:'BYTE',value:0},{name:'bLetterform',type:'BYTE',value:0},{name:'bMidline',type:'BYTE',value:0},{name:'bXHeight',type:'BYTE',value:0},{name:'ulUnicodeRange1',type:'ULONG',value:0},{name:'ulUnicodeRange2',type:'ULONG',value:0},{name:'ulUnicodeRange3',type:'ULONG',value:0},{name:'ulUnicodeRange4', type:'ULONG',value:0},{name:'achVendID',type:'CHARARRAY',value:'XXXX'},{name:'fsSelection',type:'USHORT',value:0},{name:'usFirstCharIndex',type:'USHORT',value:0},{name:'usLastCharIndex',type:'USHORT',value:0},{name:'sTypoAscender',type:'SHORT',value:0},{name:'sTypoDescender',type:'SHORT',value:0},{name:'sTypoLineGap',type:'SHORT',value:0},{name:'usWinAscent',type:'USHORT',value:0},{name:'usWinDescent',type:'USHORT',value:0},{name:'ulCodePageRange1',type:'ULONG',value:0},{name:'ulCodePageRange2',type:'ULONG', -value:0},{name:'sxHeight',type:'SHORT',value:0},{name:'sCapHeight',type:'SHORT',value:0},{name:'usDefaultChar',type:'USHORT',value:0},{name:'usBreakChar',type:'USHORT',value:0},{name:'usMaxContext',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],30:[function(g,m,b){var l=g('../encoding'),f=g('../parse'),c=g('../table');b.parse=function(b,c){var g={};c=new f.Parser(b,c);switch(g.version=c.parseVersion(),g.italicAngle=c.parseFixed(),g.underlinePosition=c.parseShort(),g.underlineThickness= -c.parseShort(),g.isFixedPitch=c.parseULong(),g.minMemType42=c.parseULong(),g.maxMemType42=c.parseULong(),g.minMemType1=c.parseULong(),g.maxMemType1=c.parseULong(),g.version){case 1:g.names=l.standardNames.slice();break;case 2:g.numberOfGlyphs=c.parseUShort();g.glyphNameIndex=Array(g.numberOfGlyphs);for(b=0;b=l.standardNames.length){var k=c.parseChar();g.names.push(c.parseString(k))}break; -case 2.5:for(g.numberOfGlyphs=c.parseUShort(),g.offset=Array(g.numberOfGlyphs),b=0;bd.value.tag?1:-1}),d.fields=d.fields.concat(c),d.fields=d.fields.concat(g),d}function k(b,d,c){for(var f=0;fL||void 0===f)&&0N&&(N=L);L=u.getUnicodeRange(L);if(32>L)V|=1<L)X|=1<L)T|=1<L))throw Error('Unicode ranges bits > 123 are reserved for internal usage');fa|=1<=l.standardNames.length){var k=c.parseChar();e.names.push(c.parseString(k))}break; +case 2.5:for(e.numberOfGlyphs=c.parseUShort(),e.offset=Array(e.numberOfGlyphs),b=0;bd.value.tag?1:-1}),d.fields=d.fields.concat(c),d.fields=d.fields.concat(e),d}function k(b,d,c){for(var e=0;eL||void 0===e)&&0N&&(N=L);L=u.getUnicodeRange(L);if(32>L)V|=1<L)X|=1<L)T|=1<L))throw Error('Unicode ranges bits > 123 are reserved for internal usage');fa|=1<=b,'Byte value should be between 0 and 255.'),[b]};k.BYTE=l(1);c.CHAR=function(b){return[b.charCodeAt(0)]};k.CHAR=l(1);c.CHARARRAY=function(b){for(var d=[],c=0;c=b,'Byte value should be between 0 and 255.'),[b]};k.BYTE=l(1);c.CHAR=function(b){return[b.charCodeAt(0)]};k.CHAR=l(1);c.CHARARRAY=function(b){for(var d=[],c=0;c>8&255,255&b]};k.USHORT=l(2);c.SHORT=function(b){return 32768<=b&&(b=-(65536-b)),[b>>8&255,255&b]};k.SHORT=l(2);c.UINT24=function(b){return[b>>16&255,b>>8&255,255&b]};k.UINT24=l(3);c.ULONG=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]};k.ULONG=l(4);c.LONG=function(b){return 2147483648<=b&&(b=-(4294967296-b)),[b>>24&255,b>>16&255,b>>8&255,255&b]};k.LONG=l(4);c.FIXED=c.ULONG;k.FIXED=k.ULONG; -c.FWORD=c.SHORT;k.FWORD=k.SHORT;c.UFWORD=c.USHORT;k.UFWORD=k.USHORT;c.LONGDATETIME=function(b){return[0,0,0,0,b>>24&255,b>>16&255,b>>8&255,255&b]};k.LONGDATETIME=l(8);c.TAG=function(b){return f.argument(4===b.length,'Tag should be exactly 4 ASCII characters.'),[b.charCodeAt(0),b.charCodeAt(1),b.charCodeAt(2),b.charCodeAt(3)]};k.TAG=l(4);c.Card8=c.BYTE;k.Card8=k.BYTE;c.Card16=c.USHORT;k.Card16=k.USHORT;c.OffSize=c.BYTE;k.OffSize=k.BYTE;c.SID=c.USHORT;k.SID=k.USHORT;c.NUMBER=function(b){return-107<= +c.FWORD=c.SHORT;k.FWORD=k.SHORT;c.UFWORD=c.USHORT;k.UFWORD=k.USHORT;c.LONGDATETIME=function(b){return[0,0,0,0,b>>24&255,b>>16&255,b>>8&255,255&b]};k.LONGDATETIME=l(8);c.TAG=function(b){return g.argument(4===b.length,'Tag should be exactly 4 ASCII characters.'),[b.charCodeAt(0),b.charCodeAt(1),b.charCodeAt(2),b.charCodeAt(3)]};k.TAG=l(4);c.Card8=c.BYTE;k.Card8=k.BYTE;c.Card16=c.USHORT;k.Card16=k.USHORT;c.OffSize=c.BYTE;k.OffSize=k.BYTE;c.SID=c.USHORT;k.SID=k.USHORT;c.NUMBER=function(b){return-107<= b&&107>=b?[b+139]:108<=b&&1131>=b?(b-=108,[(b>>8)+247,255&b]):-1131<=b&&-108>=b?(b=-b-108,[(b>>8)+251,255&b]):-32768<=b&&32767>=b?c.NUMBER16(b):c.NUMBER32(b)};k.NUMBER=function(b){return c.NUMBER(b).length};c.NUMBER16=function(b){return[28,b>>8&255,255&b]};k.NUMBER16=l(3);c.NUMBER32=function(b){return[29,b>>24&255,b>>16&255,b>>8&255,255&b]};k.NUMBER32=l(5);c.REAL=function(b){var d=b.toString(),c=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(d);c&&(d=parseFloat('1e'+((c[2]?+c[2]:0)+c[1].length)), -d=(Math.round(b*d)/d).toString());var f='';b=0;for(c=d.length;c>b;b+=1)var g=d[b],f=f+('e'===g?'-'===d[++b]?'c':'b':'.'===g?'a':'-'===g?'e':g);f+=1&f.length?'f':'ff';d=[30];b=0;for(c=f.length;c>b;b+=2)d.push(parseInt(f.substr(b,2),16));return d};k.REAL=function(b){return c.REAL(b).length};c.NAME=c.CHARARRAY;k.NAME=k.CHARARRAY;c.STRING=c.CHARARRAY;k.STRING=k.CHARARRAY;g.UTF8=function(b,c,f){for(var d=[],g=0;f>g;g++,c+=1)d[g]=b.getUint8(c);return String.fromCharCode.apply(null,d)};g.UTF16=function(b, -c,f){var d=[];f/=2;for(var g=0;f>g;g++,c+=2)d[g]=b.getUint16(c);return String.fromCharCode.apply(null,d)};c.UTF16=function(b){for(var d=[],c=0;c>8&255;d[d.length]=255&f}return d};k.UTF16=function(b){return 2*b.length};var n={'x-mac-croatian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7', +d=(Math.round(b*d)/d).toString());var e='';b=0;for(c=d.length;c>b;b+=1)var g=d[b],e=e+('e'===g?'-'===d[++b]?'c':'b':'.'===g?'a':'-'===g?'e':g);e+=1&e.length?'f':'ff';d=[30];b=0;for(c=e.length;c>b;b+=2)d.push(parseInt(e.substr(b,2),16));return d};k.REAL=function(b){return c.REAL(b).length};c.NAME=c.CHARARRAY;k.NAME=k.CHARARRAY;c.STRING=c.CHARARRAY;k.STRING=k.CHARARRAY;e.UTF8=function(b,c,e){for(var d=[],g=0;e>g;g++,c+=1)d[g]=b.getUint8(c);return String.fromCharCode.apply(null,d)};e.UTF16=function(b, +c,e){var d=[];e/=2;for(var g=0;e>g;g++,c+=2)d[g]=b.getUint16(c);return String.fromCharCode.apply(null,d)};c.UTF16=function(b){for(var d=[],c=0;c>8&255;d[d.length]=255&e}return d};k.UTF16=function(b){return 2*b.length};var n={'x-mac-croatian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7', 'x-mac-cyrillic':'\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\u00b0\u0490\u00a3\u00a7\u2022\u00b6\u0406\u00ae\u00a9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\u00b1\u2264\u2265\u0456\u00b5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e', 'x-mac-gaelic':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u1e02\u00b1\u2264\u2265\u1e03\u010a\u010b\u1e0a\u1e0b\u1e1e\u1e1f\u0120\u0121\u1e40\u00e6\u00f8\u1e41\u1e56\u1e57\u027c\u0192\u017f\u1e60\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u1e61\u1e9b\u00ff\u0178\u1e6a\u20ac\u2039\u203a\u0176\u0177\u1e6b\u00b7\u1ef2\u1ef3\u204a\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u2663\u00d2\u00da\u00db\u00d9\u0131\u00dd\u00fd\u0174\u0175\u1e84\u1e85\u1e80\u1e81\u1e82\u1e83', 'x-mac-greek':'\u00c4\u00b9\u00b2\u00c9\u00b3\u00d6\u00dc\u0385\u00e0\u00e2\u00e4\u0384\u00a8\u00e7\u00e9\u00e8\u00ea\u00eb\u00a3\u2122\u00ee\u00ef\u2022\u00bd\u2030\u00f4\u00f6\u00a6\u20ac\u00f9\u00fb\u00fc\u2020\u0393\u0394\u0398\u039b\u039e\u03a0\u00df\u00ae\u00a9\u03a3\u03aa\u00a7\u2260\u00b0\u00b7\u0391\u00b1\u2264\u2265\u00a5\u0392\u0395\u0396\u0397\u0399\u039a\u039c\u03a6\u03ab\u03a8\u03a9\u03ac\u039d\u00ac\u039f\u03a1\u2248\u03a4\u00ab\u00bb\u2026\u00a0\u03a5\u03a7\u0386\u0388\u0153\u2013\u2015\u201c\u201d\u2018\u2019\u00f7\u0389\u038a\u038c\u038e\u03ad\u03ae\u03af\u03cc\u038f\u03cd\u03b1\u03b2\u03c8\u03b4\u03b5\u03c6\u03b3\u03b7\u03b9\u03be\u03ba\u03bb\u03bc\u03bd\u03bf\u03c0\u03ce\u03c1\u03c3\u03c4\u03b8\u03c9\u03c2\u03c7\u03c5\u03b6\u03ca\u03cb\u0390\u03b0\u00ad', @@ -1802,24 +1802,24 @@ c,f){var d=[];f/=2;for(var g=0;f>g;g++,c+=2)d[g]=b.getUint16(c);return String.fr macintosh:'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\ufb01\ufb02\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7', 'x-mac-romanian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u0102\u0218\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u0103\u0219\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\u021a\u021b\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7', 'x-mac-turkish':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u011e\u011f\u0130\u0131\u015e\u015f\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\uf8a0\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7'}; -g.MACSTRING=function(b,c,f,g){g=n[g];if(void 0!==g){for(var d='',h=0;f>h;h++)var k=b.getUint8(c+h),d=d+(127>=k?String.fromCharCode(k):g[127&k]);return d}};var p='function'==typeof WeakMap&&new WeakMap,t;c.MACSTRING=function(b,c){var d;a:{if(!t)for(d in t={},n)t[d]=new String(d);d=t[c];if(void 0!==d){if(p){var f=p.get(d);if(void 0!==f){d=f;break a}}c=n[c];if(void 0!==c){for(var f={},g=0;gh;h+=1)var k=parseInt(f[h],0),l=b[k],d=d.concat(c.OPERAND(l.value,l.type)),d=d.concat(c.OPERATOR(k));return d};k.DICT=function(b){return c.DICT(b).length};c.OPERATOR=function(b){return 1200>b?[b]:[12,b-1200]};c.OPERAND=function(b,g){var d=[];if(Array.isArray(g))for(var h=0;hg;g+=1)var k=b[g],d=d.concat(c[k.type](k.value));return h&&h.set(b,d),d};k.CHARSTRING=function(b){return c.CHARSTRING(b).length}; -c.OBJECT=function(b){var d=c[b.type];return f.argument(void 0!==d,'No encoding function for type '+b.type),d(b.value)};k.OBJECT=function(b){var d=k[b.type];return f.argument(void 0!==d,'No sizeOf function for type '+b.type),d(b.value)};c.TABLE=function(b){var d,g=[],h=b.fields.length,k=[],l=[];for(d=0;h>d;d+=1){var m=b.fields[d],n=c[m.type];f.argument(void 0!==n,'No encoding function for field type '+m.type+' ('+m.name+')');var p=b[m.name];void 0===p&&(p=m.value);n=n(p);'TABLE'===m.type?(l.push(g.length), -g=g.concat([0,0]),k.push(n)):g=g.concat(n)}for(d=0;dm,'Table '+b.tableName+' too big.'),g[h]=m>>8,g[h+1]=255&m,g=g.concat(k[d]);return g};k.TABLE=function(b){for(var d=0,c=b.fields.length,g=0;c>g;g+=1){var h=b.fields[g],l=k[h.type];f.argument(void 0!==l,'No sizeOf function for field type '+h.type+' ('+h.name+')');var m=b[h.name];void 0===m&&(m=h.value);d+=l(m);'TABLE'===h.type&&(d+=2)}return d};c.RECORD=c.TABLE;k.RECORD=k.TABLE;c.LITERAL=function(b){return b}; -k.LITERAL=function(b){return b.length};b.decode=g;b.encode=c;b.sizeOf=k},{'./check':2}],33:[function(g,m,b){b.isBrowser=function(){return'undefined'!=typeof window};b.isNode=function(){return'undefined'==typeof window};b.nodeBufferToArrayBuffer=function(b){for(var f=new ArrayBuffer(b.length),c=new Uint8Array(f),g=0;g>1,l=-7;g=c?g-1:0;var m=c?-1:1,n=a[b+g];g+=m;c=n&(1<<-l)-1;n>>=-l;for(l+=d;0>=-l;for(l+=f;0>1,n=23===g? -Math.pow(2,-24)-Math.pow(2,-77):0;k=f?0:k-1;var p=f?1:-1,t=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);for(isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,f=l):(f=Math.floor(Math.log(b)/Math.LN2),1>b*(d=Math.pow(2,-f))&&(f--,d*=2),b=1<=f+m?b+n/d:b+n*Math.pow(2,1-m),2<=b*d&&(f++,d/=2),f+m>=l?(b=0,f=l):1<=f+m?(b=(b*d-1)*Math.pow(2,g),f+=m):(b=b*Math.pow(2,m-1)*Math.pow(2,g),f=0));8<=g;a[c+k]=b&255,k+=p,b/=256,g-=8);f=f<a)throw RangeError('Illegal capacity');b=!!b;c=!!c}this.buffer=0===a?k:new ArrayBuffer(a);this.view=0===a?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};f.VERSION='5.0.1';f.LITTLE_ENDIAN=!0;f.BIG_ENDIAN=!1;f.DEFAULT_CAPACITY=16;f.DEFAULT_ENDIAN=f.BIG_ENDIAN;f.DEFAULT_NOASSERT=!1;f.Long=a|| -null;var c=f.prototype;Object.defineProperty(c,'__isByteBuffer__',{value:!0,enumerable:!1,configurable:!1});var k=new ArrayBuffer(0),n=String.fromCharCode;f.accessor=function(){return Uint8Array};f.allocate=function(a,b,c){return new f(a,b,c)};f.concat=function(a,b,c,g){if('boolean'===typeof b||'string'!==typeof b)g=c,c=b,b=void 0;for(var d=0,h=0,k=a.length,l;h=l||(b.view.set(c.view.subarray(c.offset,c.limit),b.offset),b.offset+=l);b.limit=b.offset;b.offset=0;return b};f.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};f.type=function(){return ArrayBuffer};f.wrap=function(a,b,g,k){'string'!==typeof b&&(k=g,g=b,b=void 0);if('string'===typeof a)switch('undefined'===typeof b&&(b='utf8'),b){case 'base64':return f.fromBase64(a,g);case 'hex':return f.fromHex(a,g);case 'binary':return f.fromBinary(a,g);case 'utf8':return f.fromUTF8(a, -g);case 'debug':return f.fromDebug(a,g);default:throw Error('Unsupported encoding: '+b);}if(null===a||'object'!==typeof a)throw TypeError('Illegal buffer');if(f.isByteBuffer(a))return b=c.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new f(0,g,k),0>>=0;if(0>b||b+0> -this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=b,f=a.length,g=f>>3,h=0,k;for(b+=this.writeVarint32(f,b);g--;)k=!!a[h++]&1|(!!a[h++]&1)<<1|(!!a[h++]&1)<<2|(!!a[h++]&1)<<3|(!!a[h++]&1)<<4|(!!a[h++]&1)<<5|(!!a[h++]&1)<<6|(!!a[h++]&1)<<7,this.writeByte(k,b++);if(h>3,h=0,k=[];for(a+=c.length;g--;)c=this.readByte(a++),k[h++]=!!(c&1),k[h++]=!!(c&2),k[h++]=!!(c&4),k[h++]=!!(c&8),k[h++]=!!(c&16),k[h++]=!!(c&32),k[h++]=!!(c&64),k[h++]=!!(c&128);if(h>g++&1);b&&(this.offset=a);return k};c.readBytes=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +e.MACSTRING=function(b,c,e,g){g=n[g];if(void 0!==g){for(var d='',h=0;e>h;h++)var k=b.getUint8(c+h),d=d+(127>=k?String.fromCharCode(k):g[127&k]);return d}};var p='function'==typeof WeakMap&&new WeakMap,t;c.MACSTRING=function(b,c){var d;a:{if(!t)for(d in t={},n)t[d]=new String(d);d=t[c];if(void 0!==d){if(p){var e=p.get(d);if(void 0!==e){d=e;break a}}c=n[c];if(void 0!==c){for(var e={},g=0;gh;h+=1)var k=parseInt(e[h],0),l=b[k],d=d.concat(c.OPERAND(l.value,l.type)),d=d.concat(c.OPERATOR(k));return d};k.DICT=function(b){return c.DICT(b).length};c.OPERATOR=function(b){return 1200>b?[b]:[12,b-1200]};c.OPERAND=function(b,e){var d=[];if(Array.isArray(e))for(var h=0;hg;g+=1)var k=b[g],d=d.concat(c[k.type](k.value));return h&&h.set(b,d),d};k.CHARSTRING=function(b){return c.CHARSTRING(b).length}; +c.OBJECT=function(b){var d=c[b.type];return g.argument(void 0!==d,'No encoding function for type '+b.type),d(b.value)};k.OBJECT=function(b){var d=k[b.type];return g.argument(void 0!==d,'No sizeOf function for type '+b.type),d(b.value)};c.TABLE=function(b){var d,e=[],h=b.fields.length,k=[],l=[];for(d=0;h>d;d+=1){var m=b.fields[d],n=c[m.type];g.argument(void 0!==n,'No encoding function for field type '+m.type+' ('+m.name+')');var p=b[m.name];void 0===p&&(p=m.value);n=n(p);'TABLE'===m.type?(l.push(e.length), +e=e.concat([0,0]),k.push(n)):e=e.concat(n)}for(d=0;dm,'Table '+b.tableName+' too big.'),e[h]=m>>8,e[h+1]=255&m,e=e.concat(k[d]);return e};k.TABLE=function(b){for(var d=0,c=b.fields.length,e=0;c>e;e+=1){var h=b.fields[e],l=k[h.type];g.argument(void 0!==l,'No sizeOf function for field type '+h.type+' ('+h.name+')');var m=b[h.name];void 0===m&&(m=h.value);d+=l(m);'TABLE'===h.type&&(d+=2)}return d};c.RECORD=c.TABLE;k.RECORD=k.TABLE;c.LITERAL=function(b){return b}; +k.LITERAL=function(b){return b.length};b.decode=e;b.encode=c;b.sizeOf=k},{'./check':2}],33:[function(e,m,b){b.isBrowser=function(){return'undefined'!=typeof window};b.isNode=function(){return'undefined'==typeof window};b.nodeBufferToArrayBuffer=function(b){for(var e=new ArrayBuffer(b.length),c=new Uint8Array(e),k=0;k>1,l=-7;g=c?g-1:0;var m=c?-1:1,n=a[b+g];g+=m;c=n&(1<<-l)-1;n>>=-l;for(l+=d;0>=-l;for(l+=e;0>1,n=23===g? +Math.pow(2,-24)-Math.pow(2,-77):0;k=e?0:k-1;var p=e?1:-1,t=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);for(isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,e=l):(e=Math.floor(Math.log(b)/Math.LN2),1>b*(d=Math.pow(2,-e))&&(e--,d*=2),b=1<=e+m?b+n/d:b+n*Math.pow(2,1-m),2<=b*d&&(e++,d/=2),e+m>=l?(b=0,e=l):1<=e+m?(b=(b*d-1)*Math.pow(2,g),e+=m):(b=b*Math.pow(2,m-1)*Math.pow(2,g),e=0));8<=g;a[c+k]=b&255,k+=p,b/=256,g-=8);e=e<a)throw RangeError('Illegal capacity');b=!!b;c=!!c}this.buffer=0===a?k:new ArrayBuffer(a);this.view=0===a?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};g.VERSION='5.0.1';g.LITTLE_ENDIAN=!0;g.BIG_ENDIAN=!1;g.DEFAULT_CAPACITY=16;g.DEFAULT_ENDIAN=g.BIG_ENDIAN;g.DEFAULT_NOASSERT=!1;g.Long=a|| +null;var c=g.prototype;Object.defineProperty(c,'__isByteBuffer__',{value:!0,enumerable:!1,configurable:!1});var k=new ArrayBuffer(0),n=String.fromCharCode;g.accessor=function(){return Uint8Array};g.allocate=function(a,b,c){return new g(a,b,c)};g.concat=function(a,b,c,e){if('boolean'===typeof b||'string'!==typeof b)e=c,c=b,b=void 0;for(var d=0,h=0,k=a.length,l;h=l||(b.view.set(c.view.subarray(c.offset,c.limit),b.offset),b.offset+=l);b.limit=b.offset;b.offset=0;return b};g.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};g.type=function(){return ArrayBuffer};g.wrap=function(a,b,e,k){'string'!==typeof b&&(k=e,e=b,b=void 0);if('string'===typeof a)switch('undefined'===typeof b&&(b='utf8'),b){case 'base64':return g.fromBase64(a,e);case 'hex':return g.fromHex(a,e);case 'binary':return g.fromBinary(a,e);case 'utf8':return g.fromUTF8(a, +e);case 'debug':return g.fromDebug(a,e);default:throw Error('Unsupported encoding: '+b);}if(null===a||'object'!==typeof a)throw TypeError('Illegal buffer');if(g.isByteBuffer(a))return b=c.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new g(0,e,k),0>>=0;if(0>b||b+0> +this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=b,e=a.length,g=e>>3,h=0,k;for(b+=this.writeVarint32(e,b);g--;)k=!!a[h++]&1|(!!a[h++]&1)<<1|(!!a[h++]&1)<<2|(!!a[h++]&1)<<3|(!!a[h++]&1)<<4|(!!a[h++]&1)<<5|(!!a[h++]&1)<<6|(!!a[h++]&1)<<7,this.writeByte(k,b++);if(h>3,h=0,k=[];for(a+=c.length;g--;)c=this.readByte(a++),k[h++]=!!(c&1),k[h++]=!!(c&2),k[h++]=!!(c&4),k[h++]=!!(c&8),k[h++]=!!(c&16),k[h++]=!!(c&32),k[h++]=!!(c&64),k[h++]=!!(c&128);if(h>g++&1);b&&(this.offset=a);return k};c.readBytes=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ b+' (+'+a+') <= '+this.buffer.byteLength);}b=this.slice(b,b+a);d&&(this.offset+=a);return b};c.writeBytes=c.append;c.writeInt8=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength); }b+=1;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);this.view[b-1]=a;d&&(this.offset+=1);return this};c.writeByte=c.writeInt8;c.readInt8=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}a=this.view[a];128===(a&128)&&(a=-(255-a+1));b&&(this.offset+= 1);return a};c.readByte=c.readInt8;c.writeUint8=function(a,b){var d='undefined'===typeof b;d&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=1;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b); @@ -1834,239 +1834,229 @@ b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&th if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=4;this.littleEndian?(this.view[b+3]=a>>>24&255,this.view[b+2]=a>>>16&255,this.view[b+1]=a>>>8&255,this.view[b]= a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);d&&(this.offset+=4);return this};c.writeUInt32=c.writeUint32;c.readUint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var c=0;this.littleEndian?(c=this.view[a+ 2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0);b&&(this.offset+=4);return c};c.readUInt32=c.readUint32;a&&(c.writeInt64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!== -typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var f=this.buffer.byteLength;c>f&&this.resize((f*=2)>c?f:c);c-=8;f=b.low;b=b.high;this.littleEndian?(this.view[c+3]=f>>>24&255,this.view[c+2]=f>>>16&255,this.view[c+1]=f>>>8&255,this.view[c]=f&255,c+=4,this.view[c+3]=b>>> -24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+3]=b&255,c+=4,this.view[c]=f>>>24&255,this.view[c+1]=f>>>16&255,this.view[c+2]=f>>>8&255,this.view[c+3]=f&255);d&&(this.offset+=8);return this},c.writeLong=c.writeInt64,c.readInt64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)'); -b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var f=0,g=0;this.littleEndian?(f=this.view[b+2]<<16,f|=this.view[b+1]<<8,f|=this.view[b],f+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,f=this.view[b+1]<<16,f|=this.view[b+2]<<8,f|=this.view[b+3],f+=this.view[b]<<24>>>0); -b=new a(f,g,!1);c&&(this.offset+=8);return b},c.readLong=c.readInt64,c.writeUint64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var f=this.buffer.byteLength;c>f&&this.resize((f*=2)>c?f:c);c-=8;f=b.low;b=b.high;this.littleEndian?(this.view[c+3]=f>>>24&255,this.view[c+2]=f>>>16&255,this.view[c+1]=f>>>8&255,this.view[c]=f&255,c+=4,this.view[c+3]=b>>>24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+ -3]=b&255,c+=4,this.view[c]=f>>>24&255,this.view[c+1]=f>>>16&255,this.view[c+2]=f>>>8&255,this.view[c+3]=f&255);d&&(this.offset+=8);return this},c.writeUInt64=c.writeUint64,c.readUint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var f=0,g=0;this.littleEndian? -(f=this.view[b+2]<<16,f|=this.view[b+1]<<8,f|=this.view[b],f+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,f=this.view[b+1]<<16,f|=this.view[b+2]<<8,f|=this.view[b+3],f+=this.view[b]<<24>>>0);b=new a(f,g,!0);c&&(this.offset+=8);return b},c.readUInt64=c.readUint64);c.writeFloat32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== +typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var e=this.buffer.byteLength;c>e&&this.resize((e*=2)>c?e:c);c-=8;e=b.low;b=b.high;this.littleEndian?(this.view[c+3]=e>>>24&255,this.view[c+2]=e>>>16&255,this.view[c+1]=e>>>8&255,this.view[c]=e&255,c+=4,this.view[c+3]=b>>> +24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+3]=b&255,c+=4,this.view[c]=e>>>24&255,this.view[c+1]=e>>>16&255,this.view[c+2]=e>>>8&255,this.view[c+3]=e&255);d&&(this.offset+=8);return this},c.writeLong=c.writeInt64,c.readInt64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)'); +b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var e=0,g=0;this.littleEndian?(e=this.view[b+2]<<16,e|=this.view[b+1]<<8,e|=this.view[b],e+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,e=this.view[b+1]<<16,e|=this.view[b+2]<<8,e|=this.view[b+3],e+=this.view[b]<<24>>>0); +b=new a(e,g,!1);c&&(this.offset+=8);return b},c.readLong=c.readInt64,c.writeUint64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var e=this.buffer.byteLength;c>e&&this.resize((e*=2)>c?e:c);c-=8;e=b.low;b=b.high;this.littleEndian?(this.view[c+3]=e>>>24&255,this.view[c+2]=e>>>16&255,this.view[c+1]=e>>>8&255,this.view[c]=e&255,c+=4,this.view[c+3]=b>>>24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+ +3]=b&255,c+=4,this.view[c]=e>>>24&255,this.view[c+1]=e>>>16&255,this.view[c+2]=e>>>8&255,this.view[c+3]=e&255);d&&(this.offset+=8);return this},c.writeUInt64=c.writeUint64,c.readUint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var e=0,g=0;this.littleEndian? +(e=this.view[b+2]<<16,e|=this.view[b+1]<<8,e|=this.view[b],e+=this.view[b+3]<<24>>>0,b+=4,g=this.view[b+2]<<16,g|=this.view[b+1]<<8,g|=this.view[b],g+=this.view[b+3]<<24>>>0):(g=this.view[b+1]<<16,g|=this.view[b+2]<<8,g|=this.view[b+3],g+=this.view[b]<<24>>>0,b+=4,e=this.view[b+1]<<16,e|=this.view[b+2]<<8,e|=this.view[b+3],e+=this.view[b]<<24>>>0);b=new a(e,g,!0);c&&(this.offset+=8);return b},c.readUInt64=c.readUint64);c.writeFloat32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== typeof a)throw TypeError('Illegal value: '+a+' (not a number)');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=4;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);l(this.view,a,b-4,this.littleEndian,23,4);c&&(this.offset+=4);return this};c.writeFloat=c.writeFloat32;c.readFloat32=function(a){var c='undefined'===typeof a;c&& (a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}a=b(this.view,a,this.littleEndian,23,4);c&&(this.offset+=4);return a};c.readFloat=c.readFloat32;c.writeFloat64=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a)throw TypeError('Illegal value: '+a+' (not a number)'); if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=8;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);l(this.view,a,b-8,this.littleEndian,52,8);c&&(this.offset+=8);return this};c.writeDouble=c.writeFloat64;c.readFloat64=function(a){var c='undefined'===typeof a;c&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!== -a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+8) <= '+this.buffer.byteLength);}a=b(this.view,a,this.littleEndian,52,8);c&&(this.offset+=8);return a};c.readDouble=c.readFloat64;f.MAX_VARINT32_BYTES=5;f.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};f.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};f.zigZagDecode32=function(a){return a>>>1^-(a& -1)|0};c.writeVarint32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=f.calculateVarint32(a),g;b+=d;g=this.buffer.byteLength;b>g&&this.resize((g*=2)>b?g:b); -b-=d;for(a>>>=0;128<=a;)g=a&127|128,this.view[b++]=g,a>>>=7;this.view[b++]=a;return c?(this.offset=b,this):d};c.writeVarint32ZigZag=function(a,b){return this.writeVarint32(f.zigZagEncode32(a),b)};c.readVarint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength); -}var c=0,f=0,g;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;g=this.view[a++];5>c&&(f|=(g&127)<<7*c);++c}while(0!==(g&128));f|=0;return b?(this.offset=a,f):{value:f,length:c}};c.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=f.zigZagDecode32(a.value):a=f.zigZagDecode32(a);return a};a&&(f.MAX_VARINT64_BYTES=10,f.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var c=b.toInt()>>> -0,f=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==f?16384>c?128>c?1:2:2097152>c?3:4:16384>f?128>f?5:6:2097152>f?7:8:128>b?9:10},f.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},f.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& +a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+8) <= '+this.buffer.byteLength);}a=b(this.view,a,this.littleEndian,52,8);c&&(this.offset+=8);return a};c.readDouble=c.readFloat64;g.MAX_VARINT32_BYTES=5;g.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};g.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};g.zigZagDecode32=function(a){return a>>>1^-(a& +1)|0};c.writeVarint32=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=g.calculateVarint32(a),e;b+=d;e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b); +b-=d;for(a>>>=0;128<=a;)e=a&127|128,this.view[b++]=e,a>>>=7;this.view[b++]=a;return c?(this.offset=b,this):d};c.writeVarint32ZigZag=function(a,b){return this.writeVarint32(g.zigZagEncode32(a),b)};c.readVarint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength); +}var c=0,e=0,g;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;g=this.view[a++];5>c&&(e|=(g&127)<<7*c);++c}while(0!==(g&128));e|=0;return b?(this.offset=a,e):{value:e,length:c}};c.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=g.zigZagDecode32(a.value):a=g.zigZagDecode32(a);return a};a&&(g.MAX_VARINT64_BYTES=10,g.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var c=b.toInt()>>> +0,e=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==e?16384>c?128>c?1:2:2097152>c?3:4:16384>e?128>e?5:6:2097152>e?7:8:128>b?9:10},g.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},g.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& (b=b.toSigned());return b.shiftRightUnsigned(1).xor(b.and(a.ONE).toSigned().negate()).toSigned()},c.writeVarint64=function(b,c){var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var g=f.calculateVarint64(b),h=b.toInt()>>>0,k=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;c+=g;var l=this.buffer.byteLength;c>l&&this.resize((l*=2)>c?l:c);c-=g;switch(g){case 10:this.view[c+9]=b>>>7&1;case 9:this.view[c+8]=9!==g?b|128:b&127;case 8:this.view[c+7]=8!==g?k>>>21|128:k>>>21&127;case 7:this.view[c+6]= -7!==g?k>>>14|128:k>>>14&127;case 6:this.view[c+5]=6!==g?k>>>7|128:k>>>7&127;case 5:this.view[c+4]=5!==g?k|128:k&127;case 4:this.view[c+3]=4!==g?h>>>21|128:h>>>21&127;case 3:this.view[c+2]=3!==g?h>>>14|128:h>>>14&127;case 2:this.view[c+1]=2!==g?h>>>7|128:h>>>7&127;case 1:this.view[c]=1!==g?h|128:h&127}return d?(this.offset+=g,this):g},c.writeVarint64ZigZag=function(a,b){return this.writeVarint64(f.zigZagEncode64(a),b)},c.readVarint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== -typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var f=b,g,h=0,k=0,l;l=this.view[b++];g=l&127;if(l&128&&(l=this.view[b++],g|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<14,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<21,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++], +c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var e=g.calculateVarint64(b),h=b.toInt()>>>0,k=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;c+=e;var l=this.buffer.byteLength;c>l&&this.resize((l*=2)>c?l:c);c-=e;switch(e){case 10:this.view[c+9]=b>>>7&1;case 9:this.view[c+8]=9!==e?b|128:b&127;case 8:this.view[c+7]=8!==e?k>>>21|128:k>>>21&127;case 7:this.view[c+6]= +7!==e?k>>>14|128:k>>>14&127;case 6:this.view[c+5]=6!==e?k>>>7|128:k>>>7&127;case 5:this.view[c+4]=5!==e?k|128:k&127;case 4:this.view[c+3]=4!==e?h>>>21|128:h>>>21&127;case 3:this.view[c+2]=3!==e?h>>>14|128:h>>>14&127;case 2:this.view[c+1]=2!==e?h>>>7|128:h>>>7&127;case 1:this.view[c]=1!==e?h|128:h&127}return d?(this.offset+=e,this):e},c.writeVarint64ZigZag=function(a,b){return this.writeVarint64(g.zigZagEncode64(a),b)},c.readVarint64=function(b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!== +typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var e=b,g,h=0,k=0,l;l=this.view[b++];g=l&127;if(l&128&&(l=this.view[b++],g|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<14,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],g|=(l&127)<<21,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++], h=l&127,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],h|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],h|=(l&127)<<14,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],h|=(l&127)<<21,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],k=l&127,l&128||this.noAssert&&'undefined'===typeof l)&&(l=this.view[b++],k|=(l&127)<<7,l&128||this.noAssert&&'undefined'===typeof l))throw Error('Buffer overrun');g=a.fromBits(g|h<<28,h>>>4| -k<<24,!1);return c?(this.offset=b,g):{value:g,length:b-f}},c.readVarint64ZigZag=function(b){(b=this.readVarint64(b))&&b.value instanceof a?b.value=f.zigZagDecode64(b.value):b=f.zigZagDecode64(b);return b});c.writeCString=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);var d,f=a.length;if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');for(d=0;d>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}f=t.calculateUTF16asUTF8(g(a))[1];b+=f+1;d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=f+1;t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));this.view[b++]=0;return c?(this.offset=b,this):f};c.readCString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!== -typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,f,g=-1;t.decodeUTF8toUTF16(function(){if(0===g)return null;if(a>=this.limit)throw RangeError('Illegal range: Truncated data, '+a+' < '+this.limit);g=this.view[a++];return 0===g?null:g}.bind(this),f=m(),!0);return b?(this.offset=a,f()):{string:f(),length:a-c}};c.writeIString=function(a,b){var c= -'undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,f;f=t.calculateUTF16asUTF8(g(a),this.noAssert)[1];b+=4+f;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=4+f;this.littleEndian?(this.view[b+ -3]=f>>>24&255,this.view[b+2]=f>>>16&255,this.view[b+1]=f>>>8&255,this.view[b]=f&255):(this.view[b]=f>>>24&255,this.view[b+1]=f>>>16&255,this.view[b+2]=f>>>8&255,this.view[b+3]=f&255);b+=4;t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+4+f)throw RangeError('Illegal range: Truncated data, '+b+' == '+(b+4+f));return c?(this.offset=b,this):b-d};c.readIString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+ -a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var c=a,g=this.readUint32(a),g=this.readUTF8String(g,f.METRICS_BYTES,a+=4);a+=g.length;return b?(this.offset=a,g.string):{string:g.string,length:a-c}};f.METRICS_CHARS='c';f.METRICS_BYTES='b';c.writeUTF8String=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+ -b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d,f=b;d=t.calculateUTF16asUTF8(g(a))[1];b+=d;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=d;t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));return c?(this.offset=b,this):b-f};c.writeString=c.writeUTF8String;f.calculateUTF8Chars=function(a){return t.calculateUTF16asUTF8(g(a))[0]};f.calculateUTF8Bytes=function(a){return t.calculateUTF16asUTF8(g(a))[1]}; -f.calculateString=f.calculateUTF8Bytes;c.readUTF8String=function(a,b,c){'number'===typeof b&&(c=b,b=void 0);var d='undefined'===typeof c;d&&(c=this.offset);'undefined'===typeof b&&(b=f.METRICS_CHARS);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+ -this.buffer.byteLength);}var g=0,h=c,k;if(b===f.METRICS_CHARS){k=m();t.decodeUTF8(function(){return g>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +k<<24,!1);return c?(this.offset=b,g):{value:g,length:b-e}},c.readVarint64ZigZag=function(b){(b=this.readVarint64(b))&&b.value instanceof a?b.value=g.zigZagDecode64(b.value):b=g.zigZagDecode64(b);return b});c.writeCString=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);var d,g=a.length;if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');for(d=0;d>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}g=t.calculateUTF16asUTF8(e(a))[1];b+=g+1;d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=g+1;t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));this.view[b++]=0;return c?(this.offset=b,this):g};c.readCString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!== +typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,e,g=-1;t.decodeUTF8toUTF16(function(){if(0===g)return null;if(a>=this.limit)throw RangeError('Illegal range: Truncated data, '+a+' < '+this.limit);g=this.view[a++];return 0===g?null:g}.bind(this),e=m(),!0);return b?(this.offset=a,e()):{string:e(),length:a-c}};c.writeIString=function(a,b){var c= +'undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,g;g=t.calculateUTF16asUTF8(e(a),this.noAssert)[1];b+=4+g;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=4+g;this.littleEndian?(this.view[b+ +3]=g>>>24&255,this.view[b+2]=g>>>16&255,this.view[b+1]=g>>>8&255,this.view[b]=g&255):(this.view[b]=g>>>24&255,this.view[b+1]=g>>>16&255,this.view[b+2]=g>>>8&255,this.view[b+3]=g&255);b+=4;t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+4+g)throw RangeError('Illegal range: Truncated data, '+b+' == '+(b+4+g));return c?(this.offset=b,this):b-d};c.readIString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+ +a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var c=a,e=this.readUint32(a),e=this.readUTF8String(e,g.METRICS_BYTES,a+=4);a+=e.length;return b?(this.offset=a,e.string):{string:e.string,length:a-c}};g.METRICS_CHARS='c';g.METRICS_BYTES='b';c.writeUTF8String=function(a,b){var c='undefined'===typeof b;c&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+ +b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d,g=b;d=t.calculateUTF16asUTF8(e(a))[1];b+=d;var h=this.buffer.byteLength;b>h&&this.resize((h*=2)>b?h:b);b-=d;t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));return c?(this.offset=b,this):b-g};c.writeString=c.writeUTF8String;g.calculateUTF8Chars=function(a){return t.calculateUTF16asUTF8(e(a))[0]};g.calculateUTF8Bytes=function(a){return t.calculateUTF16asUTF8(e(a))[1]}; +g.calculateString=g.calculateUTF8Bytes;c.readUTF8String=function(a,b,c){'number'===typeof b&&(c=b,b=void 0);var d='undefined'===typeof c;d&&(c=this.offset);'undefined'===typeof b&&(b=g.METRICS_CHARS);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+ +this.buffer.byteLength);}var e=0,h=c,k;if(b===g.METRICS_CHARS){k=m();t.decodeUTF8(function(){return e>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ c+' (+'+a+') <= '+this.buffer.byteLength);}var l=c+a;t.decodeUTF8toUTF16(function(){return c>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,h,k;h=t.calculateUTF16asUTF8(g(a),this.noAssert)[1];k=f.calculateVarint32(h);b+=k+h;var l=this.buffer.byteLength;b>l&&this.resize((l*=2)>b?l:b);b-=k+h;b+=this.writeVarint32(h,b);t.encodeUTF16toUTF8(g(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+h+k)throw RangeError('Illegal range: Truncated data, '+ -b+' == '+(b+h+k));return c?(this.offset=b,this):b-d};c.readVString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,g=this.readVarint32(a),g=this.readUTF8String(g.value,f.METRICS_BYTES,a+=g.length);a+=g.length;return b?(this.offset=a,g.string):{string:g.string, -length:a-c}};c.append=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof f||(a=f.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var g=this.buffer.byteLength;c>g&&this.resize((g*=2)> -c?g:c);c-=b;this.view.set(a.view.subarray(a.offset,a.limit),c);a.offset+=b;d&&(this.offset+=b);return this};c.appendTo=function(a,b){a.append(this,b);return this};c.assert=function(a){this.noAssert=!a;return this};c.capacity=function(){return this.buffer.byteLength};c.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};c.clone=function(a){var b=new f(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),b.view=new Uint8Array(b.buffer)): +if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var d=b,h,k;h=t.calculateUTF16asUTF8(e(a),this.noAssert)[1];k=g.calculateVarint32(h);b+=k+h;var l=this.buffer.byteLength;b>l&&this.resize((l*=2)>b?l:b);b-=k+h;b+=this.writeVarint32(h,b);t.encodeUTF16toUTF8(e(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+h+k)throw RangeError('Illegal range: Truncated data, '+ +b+' == '+(b+h+k));return c?(this.offset=b,this):b-d};c.readVString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var c=a,e=this.readVarint32(a),e=this.readUTF8String(e.value,g.METRICS_BYTES,a+=e.length);a+=e.length;return b?(this.offset=a,e.string):{string:e.string, +length:a-c}};c.append=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof g||(a=g.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var e=this.buffer.byteLength;c>e&&this.resize((e*=2)> +c?e:c);c-=b;this.view.set(a.view.subarray(a.offset,a.limit),c);a.offset+=b;d&&(this.offset+=b);return this};c.appendTo=function(a,b){a.append(this,b);return this};c.assert=function(a){this.noAssert=!a;return this};c.capacity=function(){return this.buffer.byteLength};c.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};c.clone=function(a){var b=new g(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),b.view=new Uint8Array(b.buffer)): (b.buffer=this.buffer,b.view=this.view);b.offset=this.offset;b.markedOffset=this.markedOffset;b.limit=this.limit;return b};c.compact=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+ -b+' <= '+this.buffer.byteLength);}if(0===a&&b===this.buffer.byteLength)return this;var c=b-a;if(0===c)return this.buffer=k,this.view=null,0<=this.markedOffset&&(this.markedOffset-=a),this.limit=this.offset=0,this;var d=new ArrayBuffer(c),f=new Uint8Array(d);f.set(this.view.subarray(a,b));this.buffer=d;this.view=f;0<=this.markedOffset&&(this.markedOffset-=a);this.offset=0;this.limit=c;return this};c.copy=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!== -typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return new f(0,this.littleEndian,this.noAssert);var c=b-a,d=new f(c,this.littleEndian,this.noAssert);d.offset=0;d.limit=c;0<=d.markedOffset&&(d.markedOffset-=a);this.copyTo(d,0,a,b);return d};c.copyTo=function(a, -b,c,g){var d,h;if(!this.noAssert&&!f.isByteBuffer(a))throw TypeError('Illegal target: Not a ByteBuffer');b=(h='undefined'===typeof b)?a.offset:b|0;c=(d='undefined'===typeof c)?this.offset:c|0;g='undefined'===typeof g?this.limit:g|0;if(0>b||b>a.buffer.byteLength)throw RangeError('Illegal target range: 0 <= '+b+' <= '+a.buffer.byteLength);if(0>c||g>this.buffer.byteLength)throw RangeError('Illegal source range: 0 <= '+c+' <= '+this.buffer.byteLength);var k=g-c;if(0===k)return a;a.ensureCapacity(b+k); -a.view.set(this.view.subarray(c,g),b);d&&(this.offset+=k);h&&(a.offset+=k);return this};c.ensureCapacity=function(a){var b=this.buffer.byteLength;return ba?b:a):this};c.fill=function(a,b,c){var d='undefined'===typeof b;d&&(b=this.offset);'string'===typeof a&&0>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return new g(0,this.littleEndian,this.noAssert);var c=b-a,d=new g(c,this.littleEndian,this.noAssert);d.offset=0;d.limit=c;0<=d.markedOffset&&(d.markedOffset-=a);this.copyTo(d,0,a,b);return d};c.copyTo=function(a, +b,c,e){var d,h;if(!this.noAssert&&!g.isByteBuffer(a))throw TypeError('Illegal target: Not a ByteBuffer');b=(h='undefined'===typeof b)?a.offset:b|0;c=(d='undefined'===typeof c)?this.offset:c|0;e='undefined'===typeof e?this.limit:e|0;if(0>b||b>a.buffer.byteLength)throw RangeError('Illegal target range: 0 <= '+b+' <= '+a.buffer.byteLength);if(0>c||e>this.buffer.byteLength)throw RangeError('Illegal source range: 0 <= '+c+' <= '+this.buffer.byteLength);var k=e-c;if(0===k)return a;a.ensureCapacity(b+k); +a.view.set(this.view.subarray(c,e),b);d&&(this.offset+=k);h&&(a.offset+=k);return this};c.ensureCapacity=function(a){var b=this.buffer.byteLength;return ba?b:a):this};c.fill=function(a,b,c){var d='undefined'===typeof b;d&&(b=this.offset);'string'===typeof a&&0>>=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal end: Not an integer');c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+c+' <= '+this.buffer.byteLength);}if(b>=c)return this;for(;b>>=0;if(0>a||a+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+0) <= '+this.buffer.byteLength);}this.markedOffset=a;return this};c.order=function(a){if(!this.noAssert&&'boolean'!==typeof a)throw TypeError('Illegal littleEndian: Not a boolean');this.littleEndian=!!a;return this};c.LE=function(a){this.littleEndian='undefined'!==typeof a?!!a:!0;return this};c.BE=function(a){this.littleEndian= -'undefined'!==typeof a?!a:!1;return this};c.prepend=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var d='undefined'===typeof c;d&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof f||(a=f.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var g=b-c;if(0>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof g||(a=g.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var e=b-c;if(0a)throw RangeError('Illegal capacity: 0 <= '+a);}if(this.buffer.byteLength>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return this;Array.prototype.reverse.call(this.view.subarray(a,b));return this}; c.skip=function(a){if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0}var b=this.offset+a;if(!this.noAssert&&(0>b||b>this.buffer.byteLength))throw RangeError('Illegal length: 0 <= '+this.offset+' + '+a+' <= '+this.buffer.byteLength);this.offset=b;return this};c.slice=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer'); a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}var c=this.clone();c.offset=a;c.limit=b;return c};c.toBuffer=function(a){var b=this.offset,c=this.limit;if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: Not an integer');b>>>=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal limit: Not an integer'); c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+c+' <= '+this.buffer.byteLength);}if(!a&&0===b&&c===this.buffer.byteLength)return this.buffer;if(b===c)return k;a=new ArrayBuffer(c-b);(new Uint8Array(a)).set((new Uint8Array(this.buffer)).subarray(b,c),0);return a};c.toArrayBuffer=c.toBuffer;c.toString=function(a,b,c){if('undefined'===typeof a)return'ByteBufferAB(offset='+this.offset+',markedOffset='+this.markedOffset+',limit='+this.limit+',capacity='+this.capacity()+ ')';'number'===typeof a&&(c=b=a='utf8');switch(a){case 'utf8':return this.toUTF8(b,c);case 'base64':return this.toBase64(b,c);case 'hex':return this.toHex(b,c);case 'binary':return this.toBinary(b,c);case 'debug':return this.toDebug();case 'columns':return this.toColumns();default:throw Error('Unsupported encoding: '+a);}};var p=function(){for(var a={},b=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113, -114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],c=[],f=0,g=b.length;f>2&63]),f=(d&3)<<4,null!==(d=a())?(f|=d>>4&15,c(b[(f|d>>4&15)&63]),f=(d&15)<<2,null!==(d=a())?(c(b[(f|d>>6&3)&63]),c(b[d&63])):(c(b[f&63]),c(61))):(c(b[f&63]),c(61),c(61))};a.decode=function(a,b){function d(a){throw Error('Illegal character code: '+a);}for(var f,g,h;null!==(f=a());)if(g=c[f],'undefined'===typeof g&&d(f),null!==(f=a())&& -(h=c[f],'undefined'===typeof h&&d(f),b(g<<2>>>0|(h&48)>>4),null!==(f=a()))){g=c[f];if('undefined'===typeof g)if(61===f)break;else d(f);b((h&15)<<4>>>0|(g&60)>>2);if(null!==(f=a())){h=c[f];if('undefined'===typeof h)if(61===f)break;else d(f);b((g&3)<<6>>>0|h)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();c.toBase64=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity|| -a>b)throw RangeError('begin, end');var c;p.encode(function(){return aa||b>this.capacity()||a>b)throw RangeError('begin, end');if(a===b)return'';for(var c=[],d=[];af?g+('0'+f.toString(16).toUpperCase()):g+f.toString(16).toUpperCase(),a&&(h+=32f?String.fromCharCode(f):'.'));++b;if(a&&0g.length;)g+=' ';k+=g+h+'\n';g=h=''}g=b===this.offset&&b===this.limit?g+(b===this.markedOffset?'!':'|'):b===this.offset?g+(b===this.markedOffset?'[':'<'):b===this.limit?g+(b===this.markedOffset?']':'>'):g+(b===this.markedOffset?"'":a||0!==b&&b!==c?' ':'')}if(a&&' '!== -g){for(;51>g.length;)g+=' ';k+=g+h+'\n'}return a?k:g};f.fromDebug=function(a,b,c){var d=a.length;b=new f((d+1)/3|0,b,c);for(var g=0,h=0,k,l=!1,m=!1,n=!1,p=!1,t=!1;g':if(!c){if(p){t=!0;break}p=!0}b.limit=h;l=!1;break;case "'":if(!c){if(n){t=!0;break}n=!0}b.markedOffset=h;l=!1;break;case ' ':l=!1;break;default:if(!c&&l)t=!0;else{k=parseInt(k+a.charAt(g++),16);if(!c&&(isNaN(k)||0>k||255>2&63]),e=(d&3)<<4,null!==(d=a())?(e|=d>>4&15,c(b[(e|d>>4&15)&63]),e=(d&15)<<2,null!==(d=a())?(c(b[(e|d>>6&3)&63]),c(b[d&63])):(c(b[e&63]),c(61))):(c(b[e&63]),c(61),c(61))};a.decode=function(a,b){function d(a){throw Error('Illegal character code: '+a);}for(var e,g,h;null!==(e=a());)if(g=c[e],'undefined'===typeof g&&d(e),null!==(e=a())&& +(h=c[e],'undefined'===typeof h&&d(e),b(g<<2>>>0|(h&48)>>4),null!==(e=a()))){g=c[e];if('undefined'===typeof g)if(61===e)break;else d(e);b((h&15)<<4>>>0|(g&60)>>2);if(null!==(e=a())){h=c[e];if('undefined'===typeof h)if(61===e)break;else d(e);b((g&3)<<6>>>0|h)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();c.toBase64=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity|| +a>b)throw RangeError('begin, end');var c;p.encode(function(){return aa||b>this.capacity()||a>b)throw RangeError('begin, end');if(a===b)return'';for(var c=[],d=[];ae?g+('0'+e.toString(16).toUpperCase()):g+e.toString(16).toUpperCase(),a&&(h+=32e?String.fromCharCode(e):'.'));++b;if(a&&0g.length;)g+=' ';k+=g+h+'\n';g=h=''}g=b===this.offset&&b===this.limit?g+(b===this.markedOffset?'!':'|'):b===this.offset?g+(b===this.markedOffset?'[':'<'):b===this.limit?g+(b===this.markedOffset?']':'>'):g+(b===this.markedOffset?"'":a||0!==b&&b!==c?' ':'')}if(a&&' '!== +g){for(;51>g.length;)g+=' ';k+=g+h+'\n'}return a?k:g};g.fromDebug=function(a,b,c){var d=a.length;b=new g((d+1)/3|0,b,c);for(var e=0,h=0,k,l=!1,m=!1,n=!1,p=!1,t=!1;e':if(!c){if(p){t=!0;break}p=!0}b.limit=h;l=!1;break;case "'":if(!c){if(n){t=!0;break}n=!0}b.markedOffset=h;l=!1;break;case ' ':l=!1;break;default:if(!c&&l)t=!0;else{k=parseInt(k+a.charAt(e++),16);if(!c&&(isNaN(k)||0>k||255>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+ -this.buffer.byteLength);}for(var c=Array(b-a),d;ad?c.push('0',d.toString(16)):c.push(d.toString(16));return c.join('')};f.fromHex=function(a,b,c){if(!c){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if(0!==a.length%2)throw TypeError('Illegal str: Length not a multiple of 2');}var d=a.length;b=new f(d/2|0,b);for(var g,h=0,k=0;hg||255c?b(c&127):(2048>c?b(c>>6&31|192):(65536>c?b(c>>12&15|224):(b(c>>18&7|240),b(c>>12&63|128)),b(c>>6&63|128)),b(c&63|128)),c=null},decodeUTF8:function(a,b){for(var c,d,f,g,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name='TruncatedError';b.bytes=a;throw b;};null!==(c=a());)if(0=== -(c&128))b(c);else if(192===(c&224))null===(d=a())&&h([c,d]),b((c&31)<<6|d&63);else if(224===(c&240))null!==(d=a())&&null!==(f=a())||h([c,d,f]),b((c&15)<<12|(d&63)<<6|f&63);else if(240===(c&248))null!==(d=a())&&null!==(f=a())&&null!==(g=a())||h([c,d,f,g]),b((c&7)<<18|(d&63)<<12|(f&63)<<6|g&63);else throw RangeError('Illegal starting byte: '+c);},UTF16toUTF8:function(a,b){for(var c,d=null;null!==(c=null!==d?d:a());)55296<=c&&57343>=c&&null!==(d=a())&&56320<=d&&57343>=d?(b(1024*(c-55296)+d-56320+65536), +this.buffer.byteLength);}for(var c=Array(b-a),d;ad?c.push('0',d.toString(16)):c.push(d.toString(16));return c.join('')};g.fromHex=function(a,b,c){if(!c){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if(0!==a.length%2)throw TypeError('Illegal str: Length not a multiple of 2');}var d=a.length;b=new g(d/2|0,b);for(var e,h=0,k=0;he||255c?b(c&127):(2048>c?b(c>>6&31|192):(65536>c?b(c>>12&15|224):(b(c>>18&7|240),b(c>>12&63|128)),b(c>>6&63|128)),b(c&63|128)),c=null},decodeUTF8:function(a,b){for(var c,d,e,g,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name='TruncatedError';b.bytes=a;throw b;};null!==(c=a());)if(0=== +(c&128))b(c);else if(192===(c&224))null===(d=a())&&h([c,d]),b((c&31)<<6|d&63);else if(224===(c&240))null!==(d=a())&&null!==(e=a())||h([c,d,e]),b((c&15)<<12|(d&63)<<6|e&63);else if(240===(c&248))null!==(d=a())&&null!==(e=a())&&null!==(g=a())||h([c,d,e,g]),b((c&7)<<18|(d&63)<<12|(e&63)<<6|g&63);else throw RangeError('Illegal starting byte: '+c);},UTF16toUTF8:function(a,b){for(var c,d=null;null!==(c=null!==d?d:a());)55296<=c&&57343>=c&&null!==(d=a())&&56320<=d&&57343>=d?(b(1024*(c-55296)+d-56320+65536), d=null):b(c);null!==d&&b(d)},UTF8toUTF16:function(a,b){var c=null;for('number'===typeof a&&(c=a,a=function(){return null});null!==c||null!==(c=a());)65535>=c?b(c):(c-=65536,b((c>>10)+55296),b(c%1024+56320)),c=null},encodeUTF16toUTF8:function(b,c){a.UTF16toUTF8(b,function(b){a.encodeUTF8(b,c)})},decodeUTF8toUTF16:function(b,c){a.decodeUTF8(b,function(b){a.UTF8toUTF16(b,c)})},calculateCodePoint:function(a){return 128>a?1:2048>a?2:65536>a?3:4},calculateUTF8:function(a){for(var b,c=0;null!==(b=a());)c+= 128>b?1:2048>b?2:65536>b?3:4;return c},calculateUTF16asUTF8:function(b){var c=0,d=0;a.UTF16toUTF8(b,function(a){++c;d+=128>a?1:2048>a?2:65536>a?3:4});return[c,d]}};return a}();c.toUTF8=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+ -a+' <= '+b+' <= '+this.buffer.byteLength);}var c;try{t.decodeUTF8toUTF16(function(){return a>>=0;if(c=0<=a&&256>a)if(b=n[a])return b;b=l(a,0>(a|0)?-1:0,!0);c&&(n[a]=b)}else{a|=0;if(c=-128<=a&&128>a)if(b=k[a])return b;b=l(a,0>a?-1:0,!1);c&&(k[a]= -b)}return b}function b(a,c){if(isNaN(a)||!isFinite(a))return c?w:v;if(c){if(0>a)return w;if(a>=t)return A}else{if(a<=-h)return E;if(a+1>=h)return u}return 0>a?b(-a,c).neg():l(a%4294967296|0,a/4294967296|0,c)}function l(b,c,d){return new a(b,c,d)}function f(a,c,d){if(0===a.length)throw Error('empty string');if('NaN'===a||'Infinity'===a||'+Infinity'===a||'-Infinity'===a)return v;'number'===typeof c?(d=c,c=!1):c=!!c;d=d||10;if(2>d||36l?(l=b(p(d,l)),h=h.mul(l).add(b(m))):(h=h.mul(g),h=h.add(b(m)))}h.unsigned=c;return h}function c(c){return c instanceof a?c:'number'===typeof c?b(c):'string'===typeof c?f(c):l(c.low,c.high,c.unsigned)}Object.defineProperty(a.prototype,'__isLong__',{value:!0,enumerable:!1,configurable:!1});a.isLong=g;var k={},n={};a.fromInt=m;a.fromNumber=b;a.fromBits= -l;var p=Math.pow;a.fromString=f;a.fromValue=c;var t=4294967296*4294967296,h=t/2,d=m(16777216),v=m(0);a.ZERO=v;var w=m(0,!0);a.UZERO=w;var y=m(1);a.ONE=y;var x=m(1,!0);a.UONE=x;var q=m(-1);a.NEG_ONE=q;var u=l(-1,2147483647,!1);a.MAX_VALUE=u;var A=l(-1,-1,!0);a.MAX_UNSIGNED_VALUE=A;var E=l(0,-2147483648,!1);a.MIN_VALUE=E;var D=a.prototype;D.toInt=function(){return this.unsigned?this.low>>>0:this.low};D.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+ -(this.low>>>0)};D.toString=function(a){a=a||10;if(2>a||36>>0).toString(a),c=g;if(c.isZero())return h+f;for(;6>h.length;)h='0'+h;f=''+h+f}};D.getHighBits=function(){return this.high};D.getHighBitsUnsigned= +a+' <= '+b+' <= '+this.buffer.byteLength);}var c;try{t.decodeUTF8toUTF16(function(){return a>>=0;if(c=0<=a&&256>a)if(b=n[a])return b;b=l(a,0>(a|0)?-1:0,!0);c&&(n[a]=b)}else{a|=0;if(c=-128<=a&&128>a)if(b=k[a])return b;b=l(a,0>a?-1:0,!1);c&&(k[a]= +b)}return b}function b(a,c){if(isNaN(a)||!isFinite(a))return c?w:v;if(c){if(0>a)return w;if(a>=t)return A}else{if(a<=-h)return E;if(a+1>=h)return u}return 0>a?b(-a,c).neg():l(a%4294967296|0,a/4294967296|0,c)}function l(b,c,d){return new a(b,c,d)}function g(a,c,d){if(0===a.length)throw Error('empty string');if('NaN'===a||'Infinity'===a||'+Infinity'===a||'-Infinity'===a)return v;'number'===typeof c?(d=c,c=!1):c=!!c;d=d||10;if(2>d||36l?(l=b(p(d,l)),h=h.mul(l).add(b(m))):(h=h.mul(e),h=h.add(b(m)))}h.unsigned=c;return h}function c(c){return c instanceof a?c:'number'===typeof c?b(c):'string'===typeof c?g(c):l(c.low,c.high,c.unsigned)}Object.defineProperty(a.prototype,'__isLong__',{value:!0,enumerable:!1,configurable:!1});a.isLong=e;var k={},n={};a.fromInt=m;a.fromNumber=b;a.fromBits= +l;var p=Math.pow;a.fromString=g;a.fromValue=c;var t=4294967296*4294967296,h=t/2,d=m(16777216),v=m(0);a.ZERO=v;var w=m(0,!0);a.UZERO=w;var y=m(1);a.ONE=y;var x=m(1,!0);a.UONE=x;var q=m(-1);a.NEG_ONE=q;var u=l(-1,2147483647,!1);a.MAX_VALUE=u;var A=l(-1,-1,!0);a.MAX_UNSIGNED_VALUE=A;var E=l(0,-2147483648,!1);a.MIN_VALUE=E;var D=a.prototype;D.toInt=function(){return this.unsigned?this.low>>>0:this.low};D.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+ +(this.low>>>0)};D.toString=function(a){a=a||10;if(2>a||36>>0).toString(a),c=g;if(c.isZero())return h+e;for(;6>h.length;)h='0'+h;e=''+h+e}};D.getHighBits=function(){return this.high};D.getHighBitsUnsigned= function(){return this.high>>>0};D.getLowBits=function(){return this.low};D.getLowBitsUnsigned=function(){return this.low>>>0};D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(E)?64:this.neg().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,b=31;0this.high};D.isPositive=function(){return this.unsigned||0<=this.high};D.isOdd= -function(){return 1===(this.low&1)};D.isEven=function(){return 0===(this.low&1)};D.equals=function(a){g(a)||(a=c(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};D.eq=D.equals;D.notEquals=function(a){return!this.eq(a)};D.neq=D.notEquals;D.lessThan=function(a){return 0>this.comp(a)};D.lt=D.lessThan;D.lessThanOrEqual=function(a){return 0>=this.comp(a)};D.lte=D.lessThanOrEqual;D.greaterThan=function(a){return 0>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1};D.comp=D.compare;D.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(y)};D.neg=D.negate;D.add=function(a){g(a)||(a=c(a));var b=this.high>>>16,d=this.high&65535, -f=this.low>>>16,h=a.high>>>16,k=a.high&65535,m=a.low>>>16,n;n=0+((this.low&65535)+(a.low&65535));a=0+(n>>>16)+(f+m);f=0+(a>>>16)+(d+k);d=0+(f>>>16)+(b+h)&65535;return l((a&65535)<<16|n&65535,d<<16|f&65535,this.unsigned)};D.subtract=function(a){g(a)||(a=c(a));return this.add(a.neg())};D.sub=D.subtract;D.multiply=function(a){if(this.isZero())return v;g(a)||(a=c(a));if(a.isZero())return v;if(this.eq(E))return a.isOdd()?E:v;if(a.eq(E))return this.isOdd()?E:v;if(this.isNegative())return a.isNegative()? -this.neg().mul(a.neg()):this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(d)&&a.lt(d))return b(this.toNumber()*a.toNumber(),this.unsigned);var f=this.high>>>16,h=this.high&65535,k=this.low>>>16,m=this.low&65535,n=a.high>>>16,p=a.high&65535,q=a.low>>>16;a=a.low&65535;var t,u,w,x;x=0+m*a;w=0+(x>>>16)+k*a;u=0+(w>>>16);w=(w&65535)+m*q;u+=w>>>16;u+=h*a;t=0+(u>>>16);u=(u&65535)+k*q;t+=u>>>16;u=(u&65535)+m*p;return l((w&65535)<<16|x&65535,(t+(u>>>16)+(f*a+h*q+k*p+m*n)&65535)<< -16|u&65535,this.unsigned)};D.mul=D.multiply;D.divide=function(a){g(a)||(a=c(a));if(a.isZero())throw Error('division by zero');if(this.isZero())return this.unsigned?w:v;var d,f,h;if(this.unsigned){a.unsigned||(a=a.toUnsigned());if(a.gt(this))return w;if(a.gt(this.shru(1)))return x;h=w}else{if(this.eq(E)){if(a.eq(y)||a.eq(q))return E;if(a.eq(E))return y;d=this.shr(1).div(a).shl(1);if(d.eq(v))return a.isNegative()?y:q;f=this.sub(a.mul(d));return d.add(f.div(a))}if(a.eq(E))return this.unsigned?w:v;if(this.isNegative())return a.isNegative()? -this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();h=v}for(f=this;f.gte(a);){d=Math.max(1,Math.floor(f.toNumber()/a.toNumber()));for(var k=Math.ceil(Math.log(d)/Math.LN2),k=48>=k?1:p(2,k-48),l=b(d),m=l.mul(a);m.isNegative()||m.gt(f);)d-=k,l=b(d,this.unsigned),m=l.mul(a);l.isZero()&&(l=y);h=h.add(l);f=f.sub(m)}return h};D.div=D.divide;D.modulo=function(a){g(a)||(a=c(a));return this.sub(this.div(a).mul(a))};D.mod=D.modulo;D.not=function(){return l(~this.low, -~this.high,this.unsigned)};D.and=function(a){g(a)||(a=c(a));return l(this.low&a.low,this.high&a.high,this.unsigned)};D.or=function(a){g(a)||(a=c(a));return l(this.low|a.low,this.high|a.high,this.unsigned)};D.xor=function(a){g(a)||(a=c(a));return l(this.low^a.low,this.high^a.high,this.unsigned)};D.shiftLeft=function(a){g(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?l(this.low<>>32-a,this.unsigned):l(0,this.low<a?l(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):l(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};D.shr=D.shiftRight;D.shiftRightUnsigned=function(a){g(a)&&(a=a.toInt());a&=63;if(0===a)return this;var b=this.high;return 32>a?l(this.low>>>a|b<<32-a,b>>>a,this.unsigned):32===a?l(b,0,this.unsigned):l(b>>>a-32,0,this.unsigned)};D.shru=D.shiftRightUnsigned;D.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this};D.toUnsigned=function(){return this.unsigned? +function(){return 1===(this.low&1)};D.isEven=function(){return 0===(this.low&1)};D.equals=function(a){e(a)||(a=c(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};D.eq=D.equals;D.notEquals=function(a){return!this.eq(a)};D.neq=D.notEquals;D.lessThan=function(a){return 0>this.comp(a)};D.lt=D.lessThan;D.lessThanOrEqual=function(a){return 0>=this.comp(a)};D.lte=D.lessThanOrEqual;D.greaterThan=function(a){return 0>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1};D.comp=D.compare;D.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(y)};D.neg=D.negate;D.add=function(a){e(a)||(a=c(a));var b=this.high>>>16,d=this.high&65535, +g=this.low>>>16,h=a.high>>>16,k=a.high&65535,m=a.low>>>16,n;n=0+((this.low&65535)+(a.low&65535));a=0+(n>>>16)+(g+m);g=0+(a>>>16)+(d+k);d=0+(g>>>16)+(b+h)&65535;return l((a&65535)<<16|n&65535,d<<16|g&65535,this.unsigned)};D.subtract=function(a){e(a)||(a=c(a));return this.add(a.neg())};D.sub=D.subtract;D.multiply=function(a){if(this.isZero())return v;e(a)||(a=c(a));if(a.isZero())return v;if(this.eq(E))return a.isOdd()?E:v;if(a.eq(E))return this.isOdd()?E:v;if(this.isNegative())return a.isNegative()? +this.neg().mul(a.neg()):this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(d)&&a.lt(d))return b(this.toNumber()*a.toNumber(),this.unsigned);var g=this.high>>>16,h=this.high&65535,k=this.low>>>16,m=this.low&65535,n=a.high>>>16,p=a.high&65535,q=a.low>>>16;a=a.low&65535;var t,u,w,x;x=0+m*a;w=0+(x>>>16)+k*a;u=0+(w>>>16);w=(w&65535)+m*q;u+=w>>>16;u+=h*a;t=0+(u>>>16);u=(u&65535)+k*q;t+=u>>>16;u=(u&65535)+m*p;return l((w&65535)<<16|x&65535,(t+(u>>>16)+(g*a+h*q+k*p+m*n)&65535)<< +16|u&65535,this.unsigned)};D.mul=D.multiply;D.divide=function(a){e(a)||(a=c(a));if(a.isZero())throw Error('division by zero');if(this.isZero())return this.unsigned?w:v;var d,g,h;if(this.unsigned){a.unsigned||(a=a.toUnsigned());if(a.gt(this))return w;if(a.gt(this.shru(1)))return x;h=w}else{if(this.eq(E)){if(a.eq(y)||a.eq(q))return E;if(a.eq(E))return y;d=this.shr(1).div(a).shl(1);if(d.eq(v))return a.isNegative()?y:q;g=this.sub(a.mul(d));return d.add(g.div(a))}if(a.eq(E))return this.unsigned?w:v;if(this.isNegative())return a.isNegative()? +this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();h=v}for(g=this;g.gte(a);){d=Math.max(1,Math.floor(g.toNumber()/a.toNumber()));for(var k=Math.ceil(Math.log(d)/Math.LN2),k=48>=k?1:p(2,k-48),l=b(d),m=l.mul(a);m.isNegative()||m.gt(g);)d-=k,l=b(d,this.unsigned),m=l.mul(a);l.isZero()&&(l=y);h=h.add(l);g=g.sub(m)}return h};D.div=D.divide;D.modulo=function(a){e(a)||(a=c(a));return this.sub(this.div(a).mul(a))};D.mod=D.modulo;D.not=function(){return l(~this.low, +~this.high,this.unsigned)};D.and=function(a){e(a)||(a=c(a));return l(this.low&a.low,this.high&a.high,this.unsigned)};D.or=function(a){e(a)||(a=c(a));return l(this.low|a.low,this.high|a.high,this.unsigned)};D.xor=function(a){e(a)||(a=c(a));return l(this.low^a.low,this.high^a.high,this.unsigned)};D.shiftLeft=function(a){e(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?l(this.low<>>32-a,this.unsigned):l(0,this.low<a?l(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):l(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};D.shr=D.shiftRight;D.shiftRightUnsigned=function(a){e(a)&&(a=a.toInt());a&=63;if(0===a)return this;var b=this.high;return 32>a?l(this.low>>>a|b<<32-a,b>>>a,this.unsigned):32===a?l(b,0,this.unsigned):l(b>>>a-32,0,this.unsigned)};D.shru=D.shiftRightUnsigned;D.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this};D.toUnsigned=function(){return this.unsigned? this:l(this.low,this.high,!0)};D.toBytes=function(a){return a?this.toBytesLE():this.toBytesBE()};D.toBytesLE=function(){var a=this.high,b=this.low;return[b&255,b>>>8&255,b>>>16&255,b>>>24&255,a&255,a>>>8&255,a>>>16&255,a>>>24&255]};D.toBytesBE=function(){var a=this.high,b=this.low;return[a>>>24&255,a>>>16&255,a>>>8&255,a&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255]};return a}); -(function(a){function g(a){if(!a)throw Error('PSON requires ByteBuffer.js: Get it at https://github.com/dcodeIO/ByteBuffer.js');var b={T:{ZERO:0,MAX:239,NULL:240,TRUE:241,FALSE:242,EOBJECT:243,EARRAY:244,ESTRING:245,OBJECT:246,ARRAY:247,INTEGER:248,LONG:249,FLOAT:250,DOUBLE:251,STRING:252,STRING_ADD:253,STRING_GET:254,BINARY:255}};b.Encoder=function(a,b){var c=new a(4);c.length=4;var f=a.Long,g=function(a,b,c){this.dict={};this.next=0;if(a&&Array.isArray(a))for(;this.nextm?g+1:m+1,a.lastIndexOf('.'))}return''};FileSystem.getNameWithoutExtension=function(a){return void 0!==a?a.substring(0,a.lastIndexOf('.')):''}; -FileSystem.getFilePath=function(a){if(void 0!==a){var g=a.lastIndexOf('\\'),m=a.lastIndexOf('/');return a.substring(0,g>m?g+1:m+1)}return''};FileSystem.getFileExtension=function(a){return void 0!==a?a.substring(a.lastIndexOf('.')+1,a.length).toLowerCase():''};THREE.Object3D.prototype.folded=!1;THREE.Object3D.prototype.hidden=!1;THREE.Object3D.prototype.initialize=function(){for(var a=0;am?e+1:m+1,a.lastIndexOf('.'))}return''};FileSystem.getNameWithoutExtension=function(a){return void 0!==a?a.substring(0,a.lastIndexOf('.')):''}; +FileSystem.getFilePath=function(a){if(void 0!==a){var e=a.lastIndexOf('\\'),m=a.lastIndexOf('/');return a.substring(0,e>m?e+1:m+1)}return''};FileSystem.getFileExtension=function(a){return void 0!==a?a.substring(a.lastIndexOf('.')+1,a.length).toLowerCase():''};THREE.Object3D.prototype.folded=!1;THREE.Object3D.prototype.hidden=!1;THREE.Object3D.prototype.initialize=function(){for(var a=0;athis.opacity&&(m.opacity=this.opacity);!0===this.transparent&&(m.transparent=this.transparent);0a;a++)this.keys.push(new Key);this.events=new EventManager;var g=this.actions,m=this;this.events.add(window,'keydown',function(a){g.push(a.keyCode);g.push(Key.DOWN)});this.events.add(window,'keyup',function(a){g.push(a.keyCode);g.push(Key.UP)});this.events.add(window,'focus',function(a){m.reset()});this.events.create()}Keyboard.prototype=Keyboard; -Keyboard.update=function(){for(var a=0;this.actions.length>a;){var g=this.actions.shift(),m=this.actions.shift();this.keys[g].update(m);if(this.keys[g].justReleased||this.keys[g].justPressed)this.actions.push(g),this.actions.push(Key.RESET),a+=2}};Keyboard.reset=function(){for(var a=0;aa;a++)this.keys.push(new Key);this.events=new EventManager;var e=this.actions,m=this;this.events.add(window,'keydown',function(a){e.push(a.keyCode);e.push(Key.DOWN)});this.events.add(window,'keyup',function(a){e.push(a.keyCode);e.push(Key.UP)});this.events.add(window,'focus',function(a){m.reset()});this.events.create()}Keyboard.prototype=Keyboard; +Keyboard.update=function(){for(var a=0;this.actions.length>a;){var e=this.actions.shift(),m=this.actions.shift();this.keys[e].update(m);if(this.keys[e].justReleased||this.keys[e].justPressed)this.actions.push(e),this.actions.push(Key.RESET),a+=2}};Keyboard.reset=function(){for(var a=0;aa;a++)this._keys.push(new Key),this.keys.push(new Key);var g=this;void 0!==window.onmousewheel?this.events.add(window,'mousewheel',function(a){g._wheel=a.deltaY; -g._wheelUpdated=!0}):void 0!==window.addEventListener?this.events.add(window,'DOMMouseScroll',function(a){g._wheel=30*a.detail;g._wheelUpdated=!0}):this.events.add(window,'wheel',function(a){g._wheel=a.deltaY;g._wheelUpdated=!0});if('ontouchstart'in window||0a;a++)this._keys.push(new Key),this.keys.push(new Key);var e=this;void 0!==window.onmousewheel?this.events.add(window,'mousewheel',function(a){e._wheel=a.deltaY; +e._wheelUpdated=!0}):void 0!==window.addEventListener?this.events.add(window,'DOMMouseScroll',function(a){e._wheel=30*a.detail;e._wheelUpdated=!0}):this.events.add(window,'wheel',function(a){e._wheel=a.deltaY;e._wheelUpdated=!0});if('ontouchstart'in window||0this.buttons.length||0>a?0:this.gamepad.buttons[a].value};Gamepad.prototype.getAxis=function(a){return a>this.gamepad.axes.length||0>a?0:this.gamepad.axes[a]};Gamepad.prototype.buttonExists=function(a){return 0<=a&&a=a.HAVE_CURRENT_DATA&&(k.needsUpdate=!0),requestAnimationFrame(c))}'string'===typeof a?this.video=new Video(a):a instanceof Video&&(this.video=a);THREE.Texture.call(this,document.createElement('video'),g,m,b,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,l,f);this.disposed=this.generateMipmaps=!1;this.name='video';this.category='Video';this.loop=this.autoplay=!0;this.volume=this.playbackRate=1;this.image.src=this.video.data; +function VideoTexture(a,e,m,b,l,g){function c(){k.disposed||(a.readyState>=a.HAVE_CURRENT_DATA&&(k.needsUpdate=!0),requestAnimationFrame(c))}'string'===typeof a?this.video=new Video(a):a instanceof Video&&(this.video=a);THREE.Texture.call(this,document.createElement('video'),e,m,b,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,l,g);this.disposed=this.generateMipmaps=!1;this.name='video';this.category='Video';this.loop=this.autoplay=!0;this.volume=this.playbackRate=1;this.image.src=this.video.data; this.image.autoplay=this.autoplay;this.image.playbackRate=this.playbackRate;this.image.loop=this.loop;this.image.volume=this.volume;var k=this;a=this.image;c()}VideoTexture.prototype=Object.create(THREE.Texture.prototype);VideoTexture.prototype.setTime=function(a){this.image.currentTime=a};VideoTexture.prototype.setLoop=function(a){this.loop=a;this.image.loop=a};VideoTexture.prototype.setVolume=function(a){this.volume=0<=a&&1>=a?a:0<=a?1:0;this.image.volume=this.volume}; VideoTexture.prototype.setAutoPlay=function(a){this.autoplay=a;this.image.autoplay=this.autoplay};VideoTexture.prototype.setPlaybackRate=function(a){this.playbackRate=a;this.image.playbackRate=a};VideoTexture.prototype.pause=function(){this.image.paused||this.image.pause()};VideoTexture.prototype.play=function(){this.image.paused&&this.image.play()};VideoTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0;this.image.pause();this.image.src='';this.image.load()}; -VideoTexture.prototype.toJSON=function(a){var g=THREE.Texture.prototype.toJSON.call(this,a);a=this.video.toJSON(a);g.video=a.uuid;g.loop=this.loop;g.autoplay=this.autoplay;g.playbackRate=this.playbackRate;g.volume=this.volume;return g}; -function WebcamTexture(a,g,m,b,l){function f(){c.readyState>=c.HAVE_CURRENT_DATA&&(k.needsUpdate=!0);k.disposed||requestAnimationFrame(f)}var c=document.createElement('video');c.autoplay=!0;c.loop=!0;navigator.webkitGetUserMedia?navigator.webkitGetUserMedia({video:!0},function(a){c.src=URL.createObjectURL(a)},function(a){console.warn('nunuStudio: No webcam available')}):navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.getUserMedia({video:!0}).then(function(a){c.src=URL.createObjectURL(a)}).catch(function(a){console.warn('nunuStudio: No webcam available')}); -THREE.Texture.call(this,c,a,g,m,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,b,l);this.disposed=this.generateMipmaps=!1;this.name='webcam';this.category='Webcam';var k=this;f()}WebcamTexture.prototype=Object.create(THREE.Texture.prototype);WebcamTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0;this.image.paused||this.image.pause()}; -function CubeTexture(a,g,m,b,l,f,c,k,n,p){void 0===g&&(g=THREE.CubeReflectionMapping);for(var t=[],h=0;6>h;h++)t.push(document.createElement('canvas'));THREE.Texture.call(this,t,g,m,b,l,f,c,k,n,p);this.images=void 0!==a?a:[];this.size=512;this.flipY=!1;this.mode=6===this.images.length?CubeTexture.CUBE:CubeTexture.CROSS;0g;g++){var f=CubeTexture.renderEquirectFace(b,g,Math.PI,a.size);a.image[g].getContext('2d').putImageData(f,0,0)}a.needsUpdate=!0}}}; -CubeTexture.resampleBilinear=function(a,g,m,b,l){var f=a.width,c=a.height;a=a.data;var k=THREE.Math.clamp(Math.floor(m),0,f-1),n=THREE.Math.clamp(Math.ceil(m),0,f-1);m-=k;var p=THREE.Math.clamp(Math.floor(b),0,c-1),t=THREE.Math.clamp(Math.ceil(b),0,c-1);b-=p;c=4*(p*f+k);p=4*(p*f+n);k=4*(t*f+k);f=4*(t*f+n);for(n=0;3>n;n++)g.data[l+n]=Math.ceil((a[c+n]*(1-m)+a[p+n]*m)*(1-b)+(a[k+n]*(1-m)+a[f+n]*m)*b)}; -CubeTexture.renderEquirectFace=function(a,g,m,b){var l=new ImageData(b,b);g=CubeTexture.faces[g];for(var f=0;f=n._endFrame&&(n.currentFrame=n._beginFrame);n.offset.x=n.currentFrame%n.framesHorizontal/n.framesHorizontal;n.offset.y=1-n.repeat.y-Math.floor(n.currentFrame/n.framesHorizontal)/n.framesVertical;n.disposed||setTimeout(k,1E3*n.animationSpeed)}'string'===typeof a?this.img=new Image(a):a instanceof Image&&(this.img=a);THREE.Texture.call(this,document.createElement('img'),l,THREE.RepeatWrapping,THREE.RepeatWrapping, -THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,f,c);this.name='animation';this.category='SpriteSheet';this.disposed=!1;this.format=this.img.hasTransparency()?THREE.RGBAFormat:THREE.RGBFormat;this.repeat.set(1/g,1/m);this.loop=!0;this.animationSpeed=.1;this._totalFrames=b;this._endFrame=this._beginFrame=0;this._framesHorizontal=g;this._framesVertical=m;var n=this;Object.defineProperties(this,{framesHorizontal:{get:function(){return n._framesHorizontal},set:function(a){n._framesHorizontal=a; +VideoTexture.prototype.toJSON=function(a){var e=THREE.Texture.prototype.toJSON.call(this,a);a=this.video.toJSON(a);e.video=a.uuid;e.loop=this.loop;e.autoplay=this.autoplay;e.playbackRate=this.playbackRate;e.volume=this.volume;return e}; +function WebcamTexture(a,e,m,b,l){function g(){c.readyState>=c.HAVE_CURRENT_DATA&&(k.needsUpdate=!0);k.disposed||requestAnimationFrame(g)}var c=document.createElement('video');c.autoplay=!0;c.loop=!0;navigator.webkitGetUserMedia?navigator.webkitGetUserMedia({video:!0},function(a){c.src=URL.createObjectURL(a)},function(a){console.warn('nunuStudio: No webcam available')}):navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.getUserMedia({video:!0}).then(function(a){c.src=URL.createObjectURL(a)}).catch(function(a){console.warn('nunuStudio: No webcam available')}); +THREE.Texture.call(this,c,a,e,m,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,b,l);this.disposed=this.generateMipmaps=!1;this.name='webcam';this.category='Webcam';var k=this;g()}WebcamTexture.prototype=Object.create(THREE.Texture.prototype);WebcamTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0;this.image.paused||this.image.pause()}; +function CubeTexture(a,e,m,b,l,g,c,k,n,p){void 0===e&&(e=THREE.CubeReflectionMapping);for(var t=[],h=0;6>h;h++)t.push(document.createElement('canvas'));THREE.Texture.call(this,t,e,m,b,l,g,c,k,n,p);this.images=void 0!==a?a:[];this.size=512;this.flipY=!1;this.mode=6===this.images.length?CubeTexture.CUBE:CubeTexture.CROSS;0e;e++){var g=CubeTexture.renderEquirectFace(b,e,Math.PI,a.size);a.image[e].getContext('2d').putImageData(g,0,0)}a.needsUpdate=!0}}}; +CubeTexture.resampleBilinear=function(a,e,m,b,l){var g=a.width,c=a.height;a=a.data;var k=THREE.Math.clamp(Math.floor(m),0,g-1),n=THREE.Math.clamp(Math.ceil(m),0,g-1);m-=k;var p=THREE.Math.clamp(Math.floor(b),0,c-1),t=THREE.Math.clamp(Math.ceil(b),0,c-1);b-=p;c=4*(p*g+k);p=4*(p*g+n);k=4*(t*g+k);g=4*(t*g+n);for(n=0;3>n;n++)e.data[l+n]=Math.ceil((a[c+n]*(1-m)+a[p+n]*m)*(1-b)+(a[k+n]*(1-m)+a[g+n]*m)*b)}; +CubeTexture.renderEquirectFace=function(a,e,m,b){var l=new ImageData(b,b);e=CubeTexture.faces[e];for(var g=0;g=n._endFrame&&(n.currentFrame=n._beginFrame);n.offset.x=n.currentFrame%n.framesHorizontal/n.framesHorizontal;n.offset.y=1-n.repeat.y-Math.floor(n.currentFrame/n.framesHorizontal)/n.framesVertical;n.disposed||setTimeout(k,1E3*n.animationSpeed)}'string'===typeof a?this.img=new Image(a):a instanceof Image&&(this.img=a);THREE.Texture.call(this,document.createElement('img'),l,THREE.RepeatWrapping,THREE.RepeatWrapping, +THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,g,c);this.name='animation';this.category='SpriteSheet';this.disposed=!1;this.format=this.img.hasTransparency()?THREE.RGBAFormat:THREE.RGBFormat;this.repeat.set(1/e,1/m);this.loop=!0;this.animationSpeed=.1;this._totalFrames=b;this._endFrame=this._beginFrame=0;this._framesHorizontal=e;this._framesVertical=m;var n=this;Object.defineProperties(this,{framesHorizontal:{get:function(){return n._framesHorizontal},set:function(a){n._framesHorizontal=a; n.repeat.x=1/a;n.totalFrames=n._framesHorizontal*n._framesVertical}},framesVertical:{get:function(){return n._framesVertical},set:function(a){n._framesVertical=a;n.repeat.y=1/a;n.totalFrames=n._framesHorizontal*n._framesVertical}},endFrame:{get:function(){return n._endFrame},set:function(a){a>n._totalFrames&&(a=n._totalFrames);n._endFrame=a}},beginFrame:{get:function(){return n._beginFrame},set:function(a){0>a&&(a=0);n.currentFrame=a;n._beginFrame=a}},totalFrames:{get:function(){return n._totalFrames}, -set:function(a){n._beginFrame=0;n._endFrame=a;n._totalFrames=a}}});this.image.src=this.img.data;this.image.onload=function(){n.needsUpdate=!0};this.currentFrame=0;k()}SpriteSheetTexture.prototype=Object.create(THREE.Texture.prototype);SpriteSheetTexture.prototype.setAnimationSpeed=function(a){this.animationSpeed=a};SpriteSheetTexture.prototype.setFrameGrid=function(a,g){this._framesHorizontal=a;this._framesVertical=g;this._totalFrames=a*g;this.repeat.set(1/a,1/g)}; -SpriteSheetTexture.prototype.setAnimationFrames=function(a,g){this.beginFrame=a;this.endFrame=g};SpriteSheetTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0}; -SpriteSheetTexture.prototype.toJSON=function(a){var g=THREE.Texture.prototype.toJSON.call(this,a);a=this.img.toJSON(a);g.image=a.uuid;g.loop=this.loop;g.animationSpeed=this.animationSpeed;g.framesHorizontal=this._framesHorizontal;g.framesVertical=this._framesVertical;g.totalFrames=this._totalFrames;g.beginFrame=this._beginFrame;g.endFrame=this._endFrame;return g};function FontLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} -FontLoader.prototype.load=function(a,g,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){g(new Font(JSON.parse(a)))},m,b)};FontLoader.prototype.parse=function(a){if(void 0!==a.data){var g=new Font;g.name=a.name;g.uuid=a.uuid;g.encoding=a.encoding;void 0!==a.reversed&&(g.reversed=a.reversed);'base64'===a.format?(g.format='arraybuffer',g.data=ArraybufferUtils.fromBase64(a.data),g.loadTTF()):(g.format=a.format,g.data=a.data,g.font=a.data);return g}return new Font(a)}; -function ImageLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}ImageLoader.prototype.loadJSON=function(a,g,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){g(l.parse(JSON.parse(a)))},m,b)};ImageLoader.prototype.parse=function(a){var g=new Image;g.name=a.name;g.uuid=a.uuid;g.format=a.format;g.encoding=a.encoding;g.data=a.data;return g};function VideoLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} -VideoLoader.prototype.load=function(a,g,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){g(l.parse(JSON.parse(a)))},m,b)};VideoLoader.prototype.parse=function(a){var g=new Video;g.name=a.name;g.uuid=a.uuid;g.format=a.format;g.encoding=a.encoding;g.data=a.data;return g};function AudioLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} -AudioLoader.prototype.load=function(a,g,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){g(self.parse(JSON.parse(a)))},m,b)};AudioLoader.prototype.parse=function(a){var g=new Audio;g.name=a.name;g.uuid=a.uuid;g.encoding=a.encoding;g.format='arraybuffer';g.data=ArraybufferUtils.fromBase64(a.data);return g};function MaterialLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.textures={}} -MaterialLoader.prototype.load=function(a,g,m,b){var l=this;(new FileLoader(l.manager)).load(a,function(a){g(l.parse(JSON.parse(a)))},m,b)};MaterialLoader.prototype.setTextures=function(a){this.textures=a}; -MaterialLoader.prototype.parse=function(a){function g(a){void 0===m[a]&&console.warn('THREE.MaterialLoader: Undefined texture',a);return m[a]}var m=this.textures,b=new window[a.type];void 0!==a.uuid&&(b.uuid=a.uuid);void 0!==a.name&&(b.name=a.name);void 0!==a.color&&(void 0===b.color&&(b.color=new THREE.Color),b.color.setHex(a.color));void 0!==a.roughness&&(b.roughness=a.roughness);void 0!==a.metalness&&(b.metalness=a.metalness);void 0!==a.emissive&&(void 0===b.emissive&&(b.emissive=new THREE.Color), +set:function(a){n._beginFrame=0;n._endFrame=a;n._totalFrames=a}}});this.image.src=this.img.data;this.image.onload=function(){n.needsUpdate=!0};this.currentFrame=0;k()}SpriteSheetTexture.prototype=Object.create(THREE.Texture.prototype);SpriteSheetTexture.prototype.setAnimationSpeed=function(a){this.animationSpeed=a};SpriteSheetTexture.prototype.setFrameGrid=function(a,e){this._framesHorizontal=a;this._framesVertical=e;this._totalFrames=a*e;this.repeat.set(1/a,1/e)}; +SpriteSheetTexture.prototype.setAnimationFrames=function(a,e){this.beginFrame=a;this.endFrame=e};SpriteSheetTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0}; +SpriteSheetTexture.prototype.toJSON=function(a){var e=THREE.Texture.prototype.toJSON.call(this,a);a=this.img.toJSON(a);e.image=a.uuid;e.loop=this.loop;e.animationSpeed=this.animationSpeed;e.framesHorizontal=this._framesHorizontal;e.framesVertical=this._framesVertical;e.totalFrames=this._totalFrames;e.beginFrame=this._beginFrame;e.endFrame=this._endFrame;return e};function FontLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} +FontLoader.prototype.load=function(a,e,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){e(new Font(JSON.parse(a)))},m,b)};FontLoader.prototype.parse=function(a){if(void 0!==a.data){var e=new Font;e.name=a.name;e.uuid=a.uuid;e.encoding=a.encoding;void 0!==a.reversed&&(e.reversed=a.reversed);'base64'===a.format?(e.format='arraybuffer',e.data=ArraybufferUtils.fromBase64(a.data),e.loadTTF()):(e.format=a.format,e.data=a.data,e.font=a.data);return e}return new Font(a)}; +function ImageLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}ImageLoader.prototype.loadJSON=function(a,e,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){e(l.parse(JSON.parse(a)))},m,b)};ImageLoader.prototype.parse=function(a){var e=new Image;e.name=a.name;e.uuid=a.uuid;e.format=a.format;e.encoding=a.encoding;e.data=a.data;return e};function VideoLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} +VideoLoader.prototype.load=function(a,e,m,b){var l=this;(new THREE.FileLoader(this.manager)).load(a,function(a){e(l.parse(JSON.parse(a)))},m,b)};VideoLoader.prototype.parse=function(a){var e=new Video;e.name=a.name;e.uuid=a.uuid;e.format=a.format;e.encoding=a.encoding;e.data=a.data;return e};function AudioLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} +AudioLoader.prototype.load=function(a,e,m,b){(new THREE.FileLoader(this.manager)).load(a,function(a){e(self.parse(JSON.parse(a)))},m,b)};AudioLoader.prototype.parse=function(a){var e=new Audio;e.name=a.name;e.uuid=a.uuid;e.encoding=a.encoding;e.format='arraybuffer';e.data=ArraybufferUtils.fromBase64(a.data);return e};function MaterialLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.textures={}} +MaterialLoader.prototype.load=function(a,e,m,b){var l=this;(new FileLoader(l.manager)).load(a,function(a){e(l.parse(JSON.parse(a)))},m,b)};MaterialLoader.prototype.setTextures=function(a){this.textures=a}; +MaterialLoader.prototype.parse=function(a){function e(a){void 0===m[a]&&console.warn('THREE.MaterialLoader: Undefined texture',a);return m[a]}var m=this.textures,b=new window[a.type];void 0!==a.uuid&&(b.uuid=a.uuid);void 0!==a.name&&(b.name=a.name);void 0!==a.color&&(void 0===b.color&&(b.color=new THREE.Color),b.color.setHex(a.color));void 0!==a.roughness&&(b.roughness=a.roughness);void 0!==a.metalness&&(b.metalness=a.metalness);void 0!==a.emissive&&(void 0===b.emissive&&(b.emissive=new THREE.Color), b.emissive.setHex(a.emissive));void 0!==a.specular&&(void 0===b.specular&&(b.specular=new THREE.Color),b.specular.setHex(a.specular));void 0!==a.shininess&&(b.shininess=a.shininess);void 0!==a.clearCoat&&(b.clearCoat=a.clearCoat);void 0!==a.clearCoatRoughness&&(b.clearCoatRoughness=a.clearCoatRoughness);void 0!==a.uniforms&&(b.uniforms=a.uniforms);void 0!==a.vertexShader&&(b.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(b.fragmentShader=a.fragmentShader);void 0!==a.vertexColors&&(b.vertexColors= a.vertexColors);void 0!==a.fog&&(b.fog=a.fog);void 0!==a.shading&&(b.shading=a.shading);void 0!==a.blending&&(b.blending=a.blending);void 0!==a.side&&(b.side=a.side);void 0!==a.opacity&&(b.opacity=a.opacity);void 0!==a.transparent&&(b.transparent=a.transparent);void 0!==a.alphaTest&&(b.alphaTest=a.alphaTest);void 0!==a.depthTest&&(b.depthTest=a.depthTest);void 0!==a.depthWrite&&(b.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(b.colorWrite=a.colorWrite);void 0!==a.wireframe&&(b.wireframe=a.wireframe); -void 0!==a.wireframeLinewidth&&(b.wireframeLinewidth=a.wireframeLinewidth);void 0!==a.wireframeLinecap&&(b.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(b.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.morphTargets&&(b.morphTargets=a.morphTargets);void 0!==a.morphNormals&&(b.morphNormals=a.morphNormals);void 0!==a.skinning&&(b.skinning=a.skinning);void 0!==a.size&&(b.size=a.size);void 0!==a.sizeAttenuation&&(b.sizeAttenuation=a.sizeAttenuation);void 0!==a.map&&(b.map=g(a.map)); -void 0!==a.alphaMap&&(b.alphaMap=g(a.alphaMap),b.transparent=!0);void 0!==a.bumpMap&&(b.bumpMap=g(a.bumpMap));void 0!==a.bumpScale&&(b.bumpScale=a.bumpScale);void 0!==a.normalMap&&(b.normalMap=g(a.normalMap));if(void 0!==a.normalScale){var l=a.normalScale;!1===Array.isArray(l)&&(l=[l,l]);b.normalScale=(new Vector2).fromArray(l)}void 0!==a.displacementMap&&(b.displacementMap=g(a.displacementMap));void 0!==a.displacementScale&&(b.displacementScale=a.displacementScale);void 0!==a.displacementBias&&(b.displacementBias= -a.displacementBias);void 0!==a.roughnessMap&&(b.roughnessMap=g(a.roughnessMap));void 0!==a.metalnessMap&&(b.metalnessMap=g(a.metalnessMap));void 0!==a.emissiveMap&&(b.emissiveMap=g(a.emissiveMap));void 0!==a.emissiveIntensity&&(b.emissiveIntensity=a.emissiveIntensity);void 0!==a.specularMap&&(b.specularMap=g(a.specularMap));void 0!==a.envMap&&(b.envMap=g(a.envMap));void 0!==a.reflectivity&&(b.reflectivity=a.reflectivity);void 0!==a.envMapIntensity&&(b.envMapIntensity=a.envMapIntensity);void 0!==a.combine&& -(b.combine=a.combine);void 0!==a.refractionRatio&&(b.refractionRatio=a.refractionRatio);void 0!==a.lightMap&&(b.lightMap=g(a.lightMap));void 0!==a.lightMapIntensity&&(b.lightMapIntensity=a.lightMapIntensity);void 0!==a.aoMap&&(b.aoMap=g(a.aoMap));void 0!==a.aoMapIntensity&&(b.aoMapIntensity=a.aoMapIntensity);void 0!==a.gradientMap&&(b.gradientMap=g(a.gradientMap));if(void 0!==a.materials)for(var l=0,f=a.materials.length;la;a++)this.gesture[a]=!1;this.pose=[];for(a=0;3>a;a++)this.pose[a]=!1;this.data=null}LeapMotion.prototype=Object.create(THREE.Object3D.prototype); -LeapMotion.DESK=0;LeapMotion.HDM=1;LeapMotion.SWIPE=0;LeapMotion.SWIPE_LEFT=1;LeapMotion.SWIPE_RIGHT=2;LeapMotion.SWIPE_FRONT=3;LeapMotion.SWIPE_BACK=4;LeapMotion.SWIPE_UP=5;LeapMotion.SWIPE_DOWN=6;LeapMotion.CIRCLE=7;LeapMotion.SCREEN_TAP=8;LeapMotion.KEY_TAP=9;LeapMotion.CLOSED=0;LeapMotion.OPEN=1;LeapMotion.POINTING=2;LeapMotion.prototype.initialize=function(){var a=this;Leap.loop({background:!0},function(g){a.data=g}).connect();for(var g=0;gk[a][2]&&(this.pose[LeapMotion.CLOSED]=!1),-.5< -k[a][2]&&(this.pose[LeapMotion.OPEN]=!1),1===a?f=l[1]:f<2*l[a]-15&&(this.pose[LeapMotion.POINTING]=!1));f<2*l[0]-15&&(this.pose[LeapMotion.POINTING]=!1)}}; -LeapMotion.prototype.updateGestures=function(){for(var a=0;ak[a][2]&&(this.pose[LeapMotion.CLOSED]=!1),-.5< +k[a][2]&&(this.pose[LeapMotion.OPEN]=!1),1===a?g=l[1]:g<2*l[a]-15&&(this.pose[LeapMotion.POINTING]=!1));g<2*l[0]-15&&(this.pose[LeapMotion.POINTING]=!1)}}; +LeapMotion.prototype.updateGestures=function(){for(var a=0;athis.dayTime&&(this.time-=this.dayTime),this.updateSky());for(var a=0;athis.dayTime&&(this.time-=this.dayTime),this.updateSky());for(var a=0;a=this.children.length}; -Sky.prototype.updateSky=function(){var a=this.time/this.dayTime;if(.25>a)this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r,this.colorBottom[3].g,this.colorBottom[3].b);else if(.292>a){var g=23.81*(a-.25),m=1-g;this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[3].r+g*this.colorTop[0].r,m*this.colorTop[3].g+g*this.colorTop[0].g,m*this.colorTop[3].b+g*this.colorTop[0].b); -this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[3].r+g*this.colorBottom[0].r,m*this.colorBottom[3].g+g*this.colorBottom[0].g,m*this.colorBottom[3].b+g*this.colorBottom[0].b)}else.4167>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[0].r,this.colorTop[0].g,this.colorTop[0].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[0].r,this.colorBottom[0].g,this.colorBottom[0].b)):.5>a?(g=12*(a-.4167),m=1-g,this.sky.material.uniforms.topColor.value.setRGB(m* -this.colorTop[0].r+g*this.colorTop[1].r,m*this.colorTop[0].g+g*this.colorTop[1].g,m*this.colorTop[0].b+g*this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[0].r+g*this.colorBottom[1].r,m*this.colorBottom[0].g+g*this.colorBottom[1].g,m*this.colorBottom[0].b+g*this.colorBottom[1].b)):.708>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[1].r,this.colorTop[1].g,this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[1].r, -this.colorBottom[1].g,this.colorBottom[1].b)):.75>a?(g=23.81*(a-.708),m=1-g,this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[1].r+g*this.colorTop[2].r,m*this.colorTop[1].g+g*this.colorTop[2].g,m*this.colorTop[1].b+g*this.colorTop[2].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[1].r+g*this.colorBottom[2].r,m*this.colorBottom[1].g+g*this.colorBottom[2].g,m*this.colorBottom[1].b+g*this.colorBottom[2].b)):.8333>a?(g=12.048*(a-.75),m=1-g,this.sky.material.uniforms.topColor.value.setRGB(m* -this.colorTop[2].r+g*this.colorTop[3].r,m*this.colorTop[2].g+g*this.colorTop[3].g,m*this.colorTop[2].b+g*this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[2].r+g*this.colorBottom[3].r,m*this.colorBottom[2].g+g*this.colorBottom[3].g,m*this.colorBottom[2].b+g*this.colorBottom[3].b)):(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r, -this.colorBottom[3].g,this.colorBottom[3].b));.2>a?this.sun.color.setHex(this.moonColor):.3>a?(g=10*(a-.2),.5>g?(this.sun.intensity=.3*(2-2*g),this.sun.color.setHex(this.moonColor)):(this.sun.intensity=.6*g,this.sun.color.setHex(this.sunColor))):.7>a?this.sun.color.setHex(this.sunColor):.8>a?(g=10*(a-.7),.5>g?(this.sun.intensity=.3*(2-2*g),this.sun.color.setHex(this.sunColor)):(this.sun.intensity=.6*g,this.sun.color.setHex(this.moonColor))):this.sun.color.setHex(this.moonColor);g=MathUtils.pi2*a- -MathUtils.pid2;.25a?(this.sun.position.x=this.sunDistance*Math.cos(g),this.sun.position.y=this.sunDistance*Math.sin(g)):(this.sun.position.x=this.sunDistance*Math.cos(g+Math.PI),this.sun.position.y=this.sunDistance*Math.sin(g+Math.PI))}; -Sky.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.colorTop=[];for(var g=0;ga)this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r,this.colorBottom[3].g,this.colorBottom[3].b);else if(.292>a){var e=23.81*(a-.25),m=1-e;this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[3].r+e*this.colorTop[0].r,m*this.colorTop[3].g+e*this.colorTop[0].g,m*this.colorTop[3].b+e*this.colorTop[0].b); +this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[3].r+e*this.colorBottom[0].r,m*this.colorBottom[3].g+e*this.colorBottom[0].g,m*this.colorBottom[3].b+e*this.colorBottom[0].b)}else.4167>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[0].r,this.colorTop[0].g,this.colorTop[0].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[0].r,this.colorBottom[0].g,this.colorBottom[0].b)):.5>a?(e=12*(a-.4167),m=1-e,this.sky.material.uniforms.topColor.value.setRGB(m* +this.colorTop[0].r+e*this.colorTop[1].r,m*this.colorTop[0].g+e*this.colorTop[1].g,m*this.colorTop[0].b+e*this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[0].r+e*this.colorBottom[1].r,m*this.colorBottom[0].g+e*this.colorBottom[1].g,m*this.colorBottom[0].b+e*this.colorBottom[1].b)):.708>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[1].r,this.colorTop[1].g,this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[1].r, +this.colorBottom[1].g,this.colorBottom[1].b)):.75>a?(e=23.81*(a-.708),m=1-e,this.sky.material.uniforms.topColor.value.setRGB(m*this.colorTop[1].r+e*this.colorTop[2].r,m*this.colorTop[1].g+e*this.colorTop[2].g,m*this.colorTop[1].b+e*this.colorTop[2].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[1].r+e*this.colorBottom[2].r,m*this.colorBottom[1].g+e*this.colorBottom[2].g,m*this.colorBottom[1].b+e*this.colorBottom[2].b)):.8333>a?(e=12.048*(a-.75),m=1-e,this.sky.material.uniforms.topColor.value.setRGB(m* +this.colorTop[2].r+e*this.colorTop[3].r,m*this.colorTop[2].g+e*this.colorTop[3].g,m*this.colorTop[2].b+e*this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(m*this.colorBottom[2].r+e*this.colorBottom[3].r,m*this.colorBottom[2].g+e*this.colorBottom[3].g,m*this.colorBottom[2].b+e*this.colorBottom[3].b)):(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r, +this.colorBottom[3].g,this.colorBottom[3].b));.2>a?this.sun.color.setHex(this.moonColor):.3>a?(e=10*(a-.2),.5>e?(this.sun.intensity=.3*(2-2*e),this.sun.color.setHex(this.moonColor)):(this.sun.intensity=.6*e,this.sun.color.setHex(this.sunColor))):.7>a?this.sun.color.setHex(this.sunColor):.8>a?(e=10*(a-.7),.5>e?(this.sun.intensity=.3*(2-2*e),this.sun.color.setHex(this.sunColor)):(this.sun.intensity=.6*e,this.sun.color.setHex(this.moonColor))):this.sun.color.setHex(this.moonColor);e=MathUtils.pi2*a- +MathUtils.pid2;.25a?(this.sun.position.x=this.sunDistance*Math.cos(e),this.sun.position.y=this.sunDistance*Math.sin(e)):(this.sun.position.x=this.sunDistance*Math.cos(e+Math.PI),this.sun.position.y=this.sunDistance*Math.sin(e+Math.PI))}; +Sky.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.colorTop=[];for(var e=0;e\n}\n\nfunction update()\n{\n\t//TODO \n}\n'; Script.METHODS='initialize update dispose onMouseOver onResize onAppData'.split(' ');Script.prototype.initialize=function(){for(var a=this;null!==a.parent;)a=a.parent,a instanceof Scene?this.scene=a:a instanceof Program&&(this.program=a);this.setCode(this.code);for(a=0;aa;a++)g=new THREE.PerspectiveCamera(90,1,this.near,this.far),g.parent=this,this.cameras.push(g);this.cameras[0].up.set(0,-1,0);this.cameras[0].lookAt(new THREE.Vector3(1,0,0));this.cameras[1].up.set(0,-1,0);this.cameras[1].lookAt(new THREE.Vector3(-1,0,0)); +{};a.object.emitter.color.value=[];for(e=0;ea;a++)e=new THREE.PerspectiveCamera(90,1,this.near,this.far),e.parent=this,this.cameras.push(e);this.cameras[0].up.set(0,-1,0);this.cameras[0].lookAt(new THREE.Vector3(1,0,0));this.cameras[1].up.set(0,-1,0);this.cameras[1].lookAt(new THREE.Vector3(-1,0,0)); this.cameras[2].up.set(0,0,1);this.cameras[2].lookAt(new THREE.Vector3(0,1,0));this.cameras[3].up.set(0,0,-1);this.cameras[3].lookAt(new THREE.Vector3(0,-1,0));this.cameras[4].up.set(0,-1,0);this.cameras[4].lookAt(new THREE.Vector3(0,0,1));this.cameras[5].up.set(0,-1,0);this.cameras[5].lookAt(new THREE.Vector3(0,0,-1));this.target=new THREE.WebGLRenderTargetCube(this.resolution,this.resolution,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.cube=this.target.texture; this.cube.generateMipmaps=!1;this.cube.name='cube';this.renderer=this.scene=null}CubeCamera.prototype=Object.create(THREE.Object3D.prototype);CubeCamera.prototype.initialize=function(){for(var a=this;null!==a.parent;)a=a.parent,a instanceof Scene?this.scene=a:a instanceof Program&&(this.renderer=a.renderer);for(a=0;ab;b++)this.cameras[b].updateMatrixWorld(),this.target.activeCubeFace=b,a.render(g,this.cameras[b],this.target);a.autoClear=m};CubeCamera.prototype.dispose=function(){for(var a=0;ab;b++)this.cameras[b].updateMatrixWorld(),this.target.activeCubeFace=b,a.render(e,this.cameras[b],this.target);a.autoClear=m};CubeCamera.prototype.dispose=function(){for(var a=0;aa?a:.05);for(a=0;a>18,f=(k&258048)>>12,c=(k&4032)>>6,k&=63,g+=Base64Utils.encoding[l]+Base64Utils.encoding[f]+Base64Utils.encoding[c]+Base64Utils.encoding[k];1===m?(k=a[b],g+=Base64Utils.encoding[(k&252)>>2]+Base64Utils.encoding[(k&3)<<4]+'=='):2===m&&(k=a[b]<<8|a[b+1],g+=Base64Utils.encoding[(k&64512)>>10]+Base64Utils.encoding[(k&1008)>>4]+Base64Utils.encoding[(k& -15)<<2]+'=');return g}; -Base64Utils.fromBinaryString=function(a){for(var g='',m=a.length%3,b=a.length-m,l,f,c,k=0;k>2),g+=Base64Utils.encoding.charAt((l&3)<<4|(f&240)>>4),g+=Base64Utils.encoding.charAt((f&15)<<2|(c&192)>>6),g+=Base64Utils.encoding.charAt(c&63);1===m?(l=a.charCodeAt(k)&255,g+=Base64Utils.encoding.charAt(l>>2),g+=Base64Utils.encoding.charAt((l&3)<<4),g+='=='):2===m&&(l=a.charCodeAt(k)&255,f=a.charCodeAt(k+ -1),g+=Base64Utils.encoding.charAt(l>>2),g+=Base64Utils.encoding.charAt((l&3)<<4|(f&240)>>4),g+=Base64Utils.encoding.charAt((f&15)<<2),g+='=');return g};function ArraybufferUtils(){}ArraybufferUtils.fromBinaryString=function(a){for(var g=a.length,m=new ArrayBuffer(g),b=new Uint8Array(m),l=0;l>4,64!==c&&(b[n+1]=(f&15)<<4|c>>2),64!==k&&(b[n+2]=(c&3)<<6|k);return m};ArraybufferUtils.fromBuffer=function(a){for(var g=new ArrayBuffer(a.length),m=new Uint8Array(g),b=0;b>18,g=(k&258048)>>12,c=(k&4032)>>6,k&=63,e+=Base64Utils.encoding[l]+Base64Utils.encoding[g]+Base64Utils.encoding[c]+Base64Utils.encoding[k];1===m?(k=a[b],e+=Base64Utils.encoding[(k&252)>>2]+Base64Utils.encoding[(k&3)<<4]+'=='):2===m&&(k=a[b]<<8|a[b+1],e+=Base64Utils.encoding[(k&64512)>>10]+Base64Utils.encoding[(k&1008)>>4]+Base64Utils.encoding[(k& +15)<<2]+'=');return e}; +Base64Utils.fromBinaryString=function(a){for(var e='',m=a.length%3,b=a.length-m,l,g,c,k=0;k>2),e+=Base64Utils.encoding.charAt((l&3)<<4|(g&240)>>4),e+=Base64Utils.encoding.charAt((g&15)<<2|(c&192)>>6),e+=Base64Utils.encoding.charAt(c&63);1===m?(l=a.charCodeAt(k)&255,e+=Base64Utils.encoding.charAt(l>>2),e+=Base64Utils.encoding.charAt((l&3)<<4),e+='=='):2===m&&(l=a.charCodeAt(k)&255,g=a.charCodeAt(k+ +1),e+=Base64Utils.encoding.charAt(l>>2),e+=Base64Utils.encoding.charAt((l&3)<<4|(g&240)>>4),e+=Base64Utils.encoding.charAt((g&15)<<2),e+='=');return e};function ArraybufferUtils(){}ArraybufferUtils.fromBinaryString=function(a){for(var e=a.length,m=new ArrayBuffer(e),b=new Uint8Array(m),l=0;l>4,64!==c&&(b[n+1]=(g&15)<<4|c>>2),64!==k&&(b[n+2]=(c&3)<<6|k);return m};ArraybufferUtils.fromBuffer=function(a){for(var e=new ArrayBuffer(a.length),m=new Uint8Array(e),b=0;b