Newer
Older
ganzhou-feidu / static / lib / freedox / FreedoX / ThirdParty / three.min.js
bairujie on 14 Apr 2023 552 KB init
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.THREE={})}(this,function(t){"use strict";function e(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),Object.assign(e.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var n=r.indexOf(e);-1!==n&&r.splice(n,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var r=e.slice(0),n=0,i=r.length;n<i;n++)r[n].call(this,t)}}}});var r,n,l,u,i,a,o,s,c,h,p,d,f,m,g,v,y,x,b,w,_,M,_t="96dev",X=0,q=1,Y=2,G=1,H=2,D=0,Mt=1,et=2,E=0,T=2,J=0,Z=1,Q=2,K=3,$=4,tt=5,rt=100,S=101,A=102,L=103,R=104,P=200,C=201,O=202,I=203,N=204,U=205,B=206,F=207,z=208,V=209,k=210,nt=0,it=1,at=2,ot=3,st=4,ct=5,ht=6,lt=7,j=0,W=1,ut=2,pt=0,Et=1,dt=2,ft=3,mt=4,gt=301,vt=302,yt=303,xt=304,bt=305,wt=306,Tt=307,St=1e3,At=1001,Lt=1002,Rt=1003,Pt=1004,Ct=1005,Ot=1006,It=1007,Nt=1008,Dt=1009,Ut=1010,Bt=1011,Ft=1012,zt=1013,Gt=1014,Ht=1015,Vt=1016,kt=1017,jt=1018,Wt=1019,Xt=1020,qt=1021,Yt=1022,Jt=1023,Zt=1024,Qt=1025,Kt=Jt,$t=1026,te=1027,ee=33776,re=33777,ne=33778,ie=33779,ae=35840,oe=35841,se=35842,ce=35843,he=36196,le=37808,ue=37809,pe=37810,de=37811,fe=37812,me=37813,ge=37814,ve=37815,ye=37816,xe=37817,be=37818,we=37819,_e=37820,Me=37821,Ee=2300,Te=2301,Se=2400,Ae=2401,Le=2402,Re=0,Pe=3e3,Ce=3001,Oe=3007,Ie=3002,Ne=3004,De=3005,Ue=3006,Be=3200,Fe=3201,ze=0,Ge=1,He={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var i=[],t=0;t<256;t++)i[t]=(t<16?"0":"")+t.toString(16);return function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(i[255&t]+i[t>>8&255]+i[t>>16&255]+i[t>>24&255]+"-"+i[255&e]+i[e>>8&255]+"-"+i[e>>16&15|64]+i[e>>24&255]+"-"+i[63&r|128]+i[r>>8&255]+"-"+i[r>>16&255]+i[r>>24&255]+i[255&n]+i[n>>8&255]+i[n>>16&255]+i[n>>24&255]).toUpperCase()}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,n,i){return n+(t-e)*(i-n)/(r-e)},lerp:function(t,e,r){return(1-r)*t+r*e},smoothstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*He.DEG2RAD},radToDeg:function(t){return t*He.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function Ve(t,e){this.x=t||0,this.y=e||0}function ke(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function je(t,e,r,n){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==n?n:1}function We(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0}function Xe(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(Ve.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(Ve.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(r=new Ve,n=new Ve,function(t,e){return r.set(t,t),n.set(e,e),this.clamp(r,n)}),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*r-a*n+t.x,this.y=i*n+a*r+t.y,this}}),Object.assign(ke.prototype,{isMatrix4:!0,set:function(t,e,r,n,i,a,o,s,c,h,l,u,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=r,g[12]=n,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=h,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new ke).fromArray(this.elements)},copy:function(t){var e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],this},copyPosition:function(t){var e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this},extractBasis:function(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:(p=new We,function(t){var e=this.elements,r=t.elements,n=1/p.setFromMatrixColumn(t,0).length(),i=1/p.setFromMatrixColumn(t,1).length(),a=1/p.setFromMatrixColumn(t,2).length();return e[0]=r[0]*n,e[1]=r[1]*n,e[2]=r[2]*n,e[3]=0,e[4]=r[4]*i,e[5]=r[5]*i,e[6]=r[6]*i,e[7]=0,e[8]=r[8]*a,e[9]=r[9]*a,e[10]=r[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,n=t.y,i=t.z,a=Math.cos(r),o=Math.sin(r),s=Math.cos(n),c=Math.sin(n),h=Math.cos(i),l=Math.sin(i);if("XYZ"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=u-f*c,e[9]=-o*s,e[2]=f-u*c,e[6]=d+p*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*h,g=s*l,v=c*h,y=c*l;e[0]=m+y*o,e[4]=v*o-g,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-o,e[2]=g*o-v,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){m=s*h,g=s*l,v=c*h,y=c*l;e[0]=m-y*o,e[4]=-a*l,e[8]=v+g*o,e[1]=g+v*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=d*c-p,e[8]=u*c+f,e[1]=s*l,e[5]=f*c+u,e[9]=p*c-d,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,b=a*c,w=o*s,_=o*c;e[0]=s*h,e[4]=_-x*l,e[8]=w*l+b,e[1]=l,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=b*l+w,e[10]=x-_*l}else if("XZY"===t.order){x=a*s,b=a*c,w=o*s,_=o*c;e[0]=s*h,e[4]=-l,e[8]=c*h,e[1]=x*l+_,e[5]=a*h,e[9]=b*l-w,e[2]=w*l-b,e[6]=o*h,e[10]=_*l+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:(c=new We(0,0,0),h=new We(1,1,1),function(t){return this.compose(c,t,h)}),lookAt:(a=new We,o=new We,s=new We,function(t,e,r){var n=this.elements;return s.subVectors(t,e),0===s.lengthSq()&&(s.z=1),s.normalize(),a.crossVectors(r,s),0===a.lengthSq()&&(1===Math.abs(r.z)?s.x+=1e-4:s.z+=1e-4,s.normalize(),a.crossVectors(r,s)),a.normalize(),o.crossVectors(s,a),n[0]=a.x,n[4]=o.x,n[8]=s.x,n[1]=a.y,n[5]=o.y,n[9]=s.y,n[2]=a.z,n[6]=o.z,n[10]=s.z,this}),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,a=r[0],o=r[4],s=r[8],c=r[12],h=r[1],l=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],x=r[11],b=r[15],w=n[0],_=n[4],M=n[8],E=n[12],T=n[1],S=n[5],A=n[9],L=n[13],R=n[2],P=n[6],C=n[10],O=n[14],I=n[3],N=n[7],D=n[11],U=n[15];return i[0]=a*w+o*T+s*R+c*I,i[4]=a*_+o*S+s*P+c*N,i[8]=a*M+o*A+s*C+c*D,i[12]=a*E+o*L+s*O+c*U,i[1]=h*w+l*T+u*R+p*I,i[5]=h*_+l*S+u*P+p*N,i[9]=h*M+l*A+u*C+p*D,i[13]=h*E+l*L+u*O+p*U,i[2]=d*w+f*T+m*R+g*I,i[6]=d*_+f*S+m*P+g*N,i[10]=d*M+f*A+m*C+g*D,i[14]=d*E+f*L+m*O+g*U,i[3]=v*w+y*T+x*R+b*I,i[7]=v*_+y*S+x*P+b*N,i[11]=v*M+y*A+x*C+b*D,i[15]=v*E+y*L+x*O+b*U,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:(i=new We,function(t){for(var e=0,r=t.count;e<r;e++)i.x=t.getX(e),i.y=t.getY(e),i.z=t.getZ(e),i.applyMatrix4(this),t.setXYZ(e,i.x,i.y,i.z);return t}),determinant:function(){var t=this.elements,e=t[0],r=t[4],n=t[8],i=t[12],a=t[1],o=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+i*s*l-n*c*l-i*o*u+r*c*u+n*o*p-r*s*p)+t[7]*(+e*s*p-e*c*u+i*a*u-n*a*p+n*c*h-i*s*h)+t[11]*(+e*c*l-e*o*p-i*a*l+r*a*p+i*o*h-r*c*h)+t[15]*(-n*o*h-e*s*l+e*o*u+n*a*l-r*a*u+r*s*h)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,n=t.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],g=n[12],v=n[13],y=n[14],x=n[15],b=d*y*u-v*f*u+v*l*m-h*y*m-d*l*x+h*f*x,w=g*f*u-p*y*u-g*l*m+c*y*m+p*l*x-c*f*x,_=p*v*u-g*d*u+g*h*m-c*v*m-p*h*x+c*d*x,M=g*d*l-p*v*l-g*h*f+c*v*f+p*h*y-c*d*y,E=i*b+a*w+o*_+s*M;if(0===E){var T="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return r[0]=b*S,r[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*S,r[2]=(h*y*s-v*l*s+v*o*u-a*y*u-h*o*x+a*l*x)*S,r[3]=(d*l*s-h*f*s-d*o*u+a*f*u+h*o*m-a*l*m)*S,r[4]=w*S,r[5]=(p*y*s-g*f*s+g*o*m-i*y*m-p*o*x+i*f*x)*S,r[6]=(g*l*s-c*y*s-g*o*u+i*y*u+c*o*x-i*l*x)*S,r[7]=(c*f*s-p*l*s+p*o*u-i*f*u-c*o*m+i*l*m)*S,r[8]=_*S,r[9]=(g*d*s-p*v*s-g*a*m+i*v*m+p*a*x-i*d*x)*S,r[10]=(c*v*s-g*h*s+g*a*u-i*v*u-c*a*x+i*h*x)*S,r[11]=(p*h*s-c*d*s-p*a*u+i*d*u+c*a*m-i*h*m)*S,r[12]=M*S,r[13]=(p*v*o-g*d*o+g*a*f-i*v*f-p*a*y+i*d*y)*S,r[14]=(g*h*o-c*v*o-g*a*l+i*v*l+c*a*y-i*h*y)*S,r[15]=(c*d*o-p*h*o+p*a*l-i*d*l-c*a*f+i*h*f)*S,this},scale:function(t){var e=this.elements,r=t.x,n=t.y,i=t.z;return e[0]*=r,e[4]*=n,e[8]*=i,e[1]*=r,e[5]*=n,e[9]*=i,e[2]*=r,e[6]*=n,e[10]*=i,e[3]*=r,e[7]*=n,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,r,n))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=1-r,a=t.x,o=t.y,s=t.z,c=i*a,h=i*o;return this.set(c*a+r,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+r,h*s-n*a,0,c*s-n*o,h*s+n*a,i*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(t,e,r){return this.set(1,e,r,0,t,1,r,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,r){var n=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,c=i+i,h=a+a,l=o+o,u=i*c,p=i*h,d=i*l,f=a*h,m=a*l,g=o*l,v=s*c,y=s*h,x=s*l,b=r.x,w=r.y,_=r.z;return n[0]=(1-(f+g))*b,n[1]=(p+x)*b,n[2]=(d-y)*b,n[3]=0,n[4]=(p-x)*w,n[5]=(1-(u+g))*w,n[6]=(m+v)*w,n[7]=0,n[8]=(d+y)*_,n[9]=(m-v)*_,n[10]=(1-(u+f))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},decompose:(l=new We,u=new ke,function(t,e,r){var n=this.elements,i=l.set(n[0],n[1],n[2]).length(),a=l.set(n[4],n[5],n[6]).length(),o=l.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),t.x=n[12],t.y=n[13],t.z=n[14],u.copy(this);var s=1/i,c=1/a,h=1/o;return u.elements[0]*=s,u.elements[1]*=s,u.elements[2]*=s,u.elements[4]*=c,u.elements[5]*=c,u.elements[6]*=c,u.elements[8]*=h,u.elements[9]*=h,u.elements[10]*=h,e.setFromRotationMatrix(u),r.x=i,r.y=a,r.z=o,this}),makePerspective:function(t,e,r,n,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(e-t),c=2*i/(r-n),h=(e+t)/(e-t),l=(r+n)/(r-n),u=-(a+i)/(a-i),p=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,r,n,i,a){var o=this.elements,s=1/(e-t),c=1/(r-n),h=1/(a-i),l=(e+t)*s,u=(r+n)*c,p=(a+i)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,r=t.elements,n=0;n<16;n++)if(e[n]!==r[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}}),Object.assign(je,{slerp:function(t,e,r,n){return r.copy(t).slerp(e,n)},slerpFlat:function(t,e,r,n,i,a,o){var s=r[n+0],c=r[n+1],h=r[n+2],l=r[n+3],u=i[a+0],p=i[a+1],d=i[a+2],f=i[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,g=s*u+c*p+h*d+l*f,v=0<=g?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*v;if(s=s*m+u*w,c=c*m+p*w,h=h*m+d*w,l=l*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=_,c*=_,h*=_,l*=_}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),Object.defineProperties(je.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(je.prototype,{set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=t._x,n=t._y,i=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(r/2),h=o(n/2),l=o(i/2),u=s(r/2),p=s(n/2),d=s(i/2);return"XYZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"YXZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"ZXY"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"ZYX"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"YZX"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l-u*p*d):"XZY"===a&&(this._x=u*h*l-c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l+u*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,n=Math.sin(r);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,r=t.elements,n=r[0],i=r[4],a=r[8],o=r[1],s=r[5],c=r[9],h=r[2],l=r[6],u=r[10],p=n+s+u;return 0<p?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-h)*e,this._z=(o-i)*e):s<n&&u<n?(e=2*Math.sqrt(1+n-s-u),this._w=(l-c)/e,this._x=.25*e,this._y=(i+o)/e,this._z=(a+h)/e):u<s?(e=2*Math.sqrt(1+s-n-u),this._w=(a-h)/e,this._x=(i+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-i)/e,this._x=(a+h)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:(f=new We,function(t,e){return void 0===f&&(f=new We),(d=t.dot(e)+1)<1e-6?(d=0,Math.abs(t.x)>Math.abs(t.z)?f.set(-t.y,t.x,0):f.set(0,-t.z,t.y)):f.crossVectors(t,e),this._x=f.x,this._y=f.y,this._z=f.z,this._w=d,this.normalize()}),angleTo:function(t){return 2*Math.acos(Math.abs(He.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var r=this.angleTo(t);if(0===r)return this;var n=Math.min(1,e/r);return this.slerp(t,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var r=t._x,n=t._y,i=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=r*h+a*o+n*c-i*s,this._y=n*h+a*s+i*o-r*c,this._z=i*h+a*c+r*s-n*o,this._w=a*h-r*o-n*s-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,n=this._y,i=this._z,a=this._w,o=a*t._w+r*t._x+n*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),1<=o)return this._w=a,this._x=r,this._y=n,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-e;return this._w=c*a+e*this._w,this._x=c*r+e*this._x,this._y=c*n+e*this._y,this._z=c*i+e*this._z,this.normalize()}var h=Math.sqrt(s),l=Math.atan2(h,o),u=Math.sin((1-e)*l)/h,p=Math.sin(e*l)/h;return this._w=a*u+this._w*p,this._x=r*u+this._x*p,this._y=n*u+this._y*p,this._z=i*u+this._z*p,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(We.prototype,{isVector3:!0,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(_=new je,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(_.setFromEuler(t))}),applyAxisAngle:(w=new je,function(t,e){return this.applyQuaternion(w.setFromAxisAngle(t,e))}),applyMatrix3:function(t){var e=this.x,r=this.y,n=this.z,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6]*n,this.y=i[1]*e+i[4]*r+i[7]*n,this.z=i[2]*e+i[5]*r+i[8]*n,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=t.elements,a=1/(i[3]*e+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*e+i[4]*r+i[8]*n+i[12])*a,this.y=(i[1]*e+i[5]*r+i[9]*n+i[13])*a,this.z=(i[2]*e+i[6]*r+i[10]*n+i[14])*a,this},applyQuaternion:function(t){var e=this.x,r=this.y,n=this.z,i=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*r,h=s*r+o*e-i*n,l=s*n+i*r-a*e,u=-i*e-a*r-o*n;return this.x=c*s+u*-i+h*-o-l*-a,this.y=h*s+u*-a+l*-i-c*-o,this.z=l*s+u*-o+c*-a-h*-i,this},project:(b=new ke,function(t){return b.multiplyMatrices(t.projectionMatrix,b.getInverse(t.matrixWorld)),this.applyMatrix4(b)}),unproject:(x=new ke,function(t){return x.multiplyMatrices(t.matrixWorld,x.getInverse(t.projectionMatrix)),this.applyMatrix4(x)}),transformDirection:function(t){var e=this.x,r=this.y,n=this.z,i=t.elements;return this.x=i[0]*e+i[4]*r+i[8]*n,this.y=i[1]*e+i[5]*r+i[9]*n,this.z=i[2]*e+i[6]*r+i[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:(v=new We,y=new We,function(t,e){return v.set(t,t,t),y.set(e,e,e),this.clamp(v,y)}),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.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)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var r=t.x,n=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-i*o,this.y=i*a-r*s,this.z=r*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(g=new We,function(t){return g.copy(this).projectOnVector(t),this.sub(g)}),reflect:(m=new We,function(t){return this.sub(m.copy(t).multiplyScalar(2*this.dot(t)))}),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(He.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return e*e+r*r+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=r,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Xe.prototype,{isMatrix3:!0,set:function(t,e,r,n,i,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=o,h[3]=e,h[4]=i,h[5]=s,h[6]=r,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:(M=new We,function(t){for(var e=0,r=t.count;e<r;e++)M.x=t.getX(e),M.y=t.getY(e),M.z=t.getZ(e),M.applyMatrix3(this),t.setXYZ(e,M.x,M.y,M.z);return t}),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,a=r[0],o=r[3],s=r[6],c=r[1],h=r[4],l=r[7],u=r[2],p=r[5],d=r[8],f=n[0],m=n[3],g=n[6],v=n[1],y=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return i[0]=a*f+o*v+s*b,i[3]=a*m+o*y+s*w,i[6]=a*g+o*x+s*_,i[1]=c*f+h*v+l*b,i[4]=c*m+h*y+l*w,i[7]=c*g+h*x+l*_,i[2]=u*f+p*v+d*b,i[5]=u*m+p*y+d*w,i[8]=u*g+p*x+d*_,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-r*i*h+r*o*s+n*i*c-n*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var r=t.elements,n=this.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],h=r[5],l=r[6],u=r[7],p=r[8],d=p*c-h*u,f=h*l-p*s,m=u*s-c*l,g=i*d+a*f+o*m;if(0===g){var v="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return n[0]=d*y,n[1]=(o*u-p*a)*y,n[2]=(h*a-o*c)*y,n[3]=f*y,n[4]=(p*i-o*l)*y,n[5]=(o*s-h*i)*y,n[6]=m*y,n[7]=(a*l-u*i)*y,n[8]=(c*i-a*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,r,n,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(r*s,r*c,-r*(s*a+c*o)+a+t,-n*c,n*s,-n*(-c*a+s*o)+o+e,0,0,1)},scale:function(t,e){var r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=this.elements,i=n[0],a=n[3],o=n[6],s=n[1],c=n[4],h=n[7];return n[0]=e*i+r*s,n[3]=e*a+r*c,n[6]=e*o+r*h,n[1]=-r*i+e*s,n[4]=-r*a+e*c,n[7]=-r*o+e*h,this},translate:function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},equals:function(t){for(var e=this.elements,r=t.elements,n=0;n<9;n++)if(e[n]!==r[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}});var qe,Ye,Je,Ze,Qe,Ke,$e,tr={getDataURL:function(t){var e;if(t instanceof HTMLCanvasElement)e=t;else{"undefined"!=typeof OffscreenCanvas?e=new OffscreenCanvas(t.width,t.height):((e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=t.width,e.height=t.height);var r=e.getContext("2d");t instanceof ImageData?r.putImageData(t,0,0):r.drawImage(t,0,0,t.width,t.height)}return 2048<e.width||2048<e.height?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},er=0;function rr(t,e,r,n,i,a,o,s,c,h){Object.defineProperty(this,"id",{value:er++}),this.uuid=He.generateUUID(),this.name="",this.image=void 0!==t?t:rr.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:rr.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:At,this.wrapT=void 0!==n?n:At,this.magFilter=void 0!==i?i:Ot,this.minFilter=void 0!==a?a:Nt,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Jt,this.type=void 0!==s?s:Dt,this.offset=new Ve(0,0),this.repeat=new Ve(1,1),this.center=new Ve(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:Pe,this.version=0,this.onUpdate=null}function nr(t,e,r,n){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==n?n:1}function ir(t,e,r){this.width=t,this.height=e,this.scissor=new nr(0,0,t,e),this.scissorTest=!1,this.viewport=new nr(0,0,t,e),void 0===(r=r||{}).minFilter&&(r.minFilter=Ot),this.texture=new rr(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.generateMipmaps=void 0===r.generateMipmaps||r.generateMipmaps,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function ar(t,e,r){ir.call(this,t,e,r),this.activeCubeFace=0,this.activeMipMapLevel=0}function or(t,e,r,n,i,a,o,s,c,h,l,u){rr.call(this,null,a,o,s,c,h,n,i,l,u),this.image={data:t,width:e,height:r},this.magFilter=void 0!==c?c:Rt,this.minFilter=void 0!==h?h:Rt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function sr(t,e){this.min=void 0!==t?t:new We(1/0,1/0,1/0),this.max=void 0!==e?e:new We(-1/0,-1/0,-1/0)}rr.DEFAULT_IMAGE=void 0,rr.DEFAULT_MAPPING=300,rr.prototype=Object.assign(Object.create(e.prototype),{constructor:rr,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var r={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],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=He.generateUUID()),!e&&void 0===t.images[n.uuid]){var i;if(Array.isArray(n)){i=[];for(var a=0,o=n.length;a<o;a++)i.push(tr.getDataURL(n[a]))}else i=tr.getDataURL(n);t.images[n.uuid]={uuid:n.uuid,url:i}}r.image=n.uuid}return e||(t.textures[this.uuid]=r),r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.applyMatrix3(this.matrix),t.x<0||1<t.x)switch(this.wrapS){case St:t.x=t.x-Math.floor(t.x);break;case At:t.x=t.x<0?0:1;break;case Lt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||1<t.y)switch(this.wrapT){case St:t.y=t.y-Math.floor(t.y);break;case At:t.y=t.y<0?0:1;break;case Lt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.defineProperty(rr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(nr.prototype,{isVector4:!0,set:function(t,e,r,n){return this.x=t,this.y=e,this.z=r,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*r+a[8]*n+a[12]*i,this.y=a[1]*e+a[5]*r+a[9]*n+a[13]*i,this.z=a[2]*e+a[6]*r+a[10]*n+a[14]*i,this.w=a[3]*e+a[7]*r+a[11]*n+a[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,n,i,a=t.elements,o=a[0],s=a[4],c=a[8],h=a[1],l=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-h)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+l+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,g=(l+1)/2,v=(f+1)/2,y=(s+h)/4,x=(c+p)/4,b=(u+d)/4;return g<m&&v<m?m<.01?(r=0,i=n=.707106781):(n=y/(r=Math.sqrt(m)),i=x/r):v<g?g<.01?(n=0,i=r=.707106781):(r=y/(n=Math.sqrt(g)),i=b/n):v<.01?(n=r=.707106781,i=0):(r=x/(i=Math.sqrt(v)),n=b/i),this.set(r,n,i,e),this}var w=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(h-s)*(h-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(c-p)/w,this.z=(h-s)/w,this.w=Math.acos((o+l+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return void 0===qe&&(qe=new nr,Ye=new nr),qe.set(t,t,t,t),Ye.set(e,e,e,e),this.clamp(qe,Ye)},clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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)},manhattanLength: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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),ir.prototype=Object.assign(Object.create(e.prototype),{constructor:ir,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((ar.prototype=Object.create(ir.prototype)).constructor=ar).prototype.isWebGLRenderTargetCube=!0,((or.prototype=Object.create(rr.prototype)).constructor=or).prototype.isDataTexture=!0,Object.assign(sr.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<r&&(r=l),u<n&&(n=u),i<h&&(i=h),a<l&&(a=l),o<u&&(o=u)}return this.min.set(e,r,n),this.max.set(i,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var h=t.getX(s),l=t.getY(s),u=t.getZ(s);h<e&&(e=h),l<r&&(r=l),u<n&&(n=u),i<h&&(i=h),a<l&&(a=l),o<u&&(o=u)}return this.min.set(e,r,n),this.max.set(i,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:($e=new We,function(t,e){var r=$e.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new We),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new We),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var i,a,o,s=new We;function e(t){var e=t.geometry;if(void 0!==e)if(e.isGeometry){var r=e.vertices;for(a=0,o=r.length;a<o;a++)s.copy(r[a]),s.applyMatrix4(t.matrixWorld),i.expandByPoint(s)}else if(e.isBufferGeometry){var n=e.attributes.position;if(void 0!==n)for(a=0,o=n.count;a<o;a++)s.fromBufferAttribute(n,a).applyMatrix4(t.matrixWorld),i.expandByPoint(s)}}return function(t){return i=this,t.updateMatrixWorld(!0),t.traverse(e),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new We),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:(Ke=new We,function(t){return this.clampPoint(t.center,Ke),Ke.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,r;return 0<t.normal.x?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),0<t.normal.y?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},intersectsTriangle:function(){var s=new We,c=new We,h=new We,r=new We,n=new We,i=new We,l=new We,a=new We,u=new We,o=new We;function p(t){var e,r;for(e=0,r=t.length-3;e<=r;e+=3){l.fromArray(t,e);var n=u.x*Math.abs(l.x)+u.y*Math.abs(l.y)+u.z*Math.abs(l.z),i=s.dot(l),a=c.dot(l),o=h.dot(l);if(Math.max(-Math.max(i,a,o),Math.min(i,a,o))>n)return!1}return!0}return function(t){if(this.isEmpty())return!1;this.getCenter(a),u.subVectors(this.max,a),s.subVectors(t.a,a),c.subVectors(t.b,a),h.subVectors(t.c,a),r.subVectors(c,s),n.subVectors(h,c),i.subVectors(s,h);var e=[0,-r.z,r.y,0,-n.z,n.y,0,-i.z,i.y,r.z,0,-r.x,n.z,0,-n.x,i.z,0,-i.x,-r.y,r.x,0,-n.y,n.x,0,-i.y,i.x,0];return!!p(e)&&(!!p(e=[1,0,0,0,1,0,0,0,1])&&(o.crossVectors(r,n),p(e=[o.x,o.y,o.z])))}}(),clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new We),e.copy(t).clamp(this.min,this.max)},distanceToPoint:(Qe=new We,function(t){return Qe.copy(t).clamp(this.min,this.max).sub(t).length()}),getBoundingSphere:(Ze=new We,function(t){return void 0===t&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),t=new yr),this.getCenter(t.center),t.radius=.5*this.getSize(Ze).length(),t}),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(Je=[new We,new We,new We,new We,new We,new We,new We,new We],function(t){return this.isEmpty()||(Je[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Je[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Je[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Je[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Je[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Je[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Je[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Je[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Je)),this}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var cr,hr,lr,ur,pr,dr,fr,mr,gr,vr=new We;function yr(t,e){this.center=void 0!==t?t:new We,this.radius=void 0!==e?e:0}function xr(t,e){this.normal=void 0!==t?t:new We(1,0,0),this.constant=void 0!==e?e:0}function br(t,e,r,n,i,a){this.planes=[void 0!==t?t:new xr,void 0!==e?e:new xr,void 0!==r?r:new xr,void 0!==n?n:new xr,void 0!==i?i:new xr,void 0!==a?a:new xr]}Object.assign(yr.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(cr=new sr,function(t,e){var r=this.center;void 0!==e?r.copy(e):cr.setFromPoints(t).getCenter(r);for(var n=0,i=0,a=t.length;i<a;i++)n=Math.max(n,r.distanceToSquared(t[i]));return this.radius=Math.sqrt(n),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new We),e.copy(t),r>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new sr),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},union:function(t){vr.subVectors(t.center,this.center);var e=vr.length();if(this.radius>=e+t.radius)return this;if(t.radius>=e+this.radius)return this.center=t.center,this.radius=t.radius,this;var r=.5*(this.radius+e+t.radius);return vr.multiplyScalar((-this.radius+r)/e),this.center.addVectors(vr,this.center),this.radius=r,this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(xr.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,n){return this.normal.set(t,e,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:(pr=new We,dr=new We,function(t,e,r){var n=pr.subVectors(r,e).cross(dr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new We),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:(ur=new We,function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new We);var r=t.delta(ur),n=this.normal.dot(r);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;var i=-(t.start.dot(this.normal)+this.constant)/n;return i<0||1<i?void 0:e.copy(r).multiplyScalar(i).add(t.start)}),intersectsLine:function(t){var e=this.distanceToPoint(t.start),r=this.distanceToPoint(t.end);return e<0&&0<r||r<0&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new We),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(hr=new We,lr=new Xe,function(t,e){var r=e||lr.getNormalMatrix(t),n=this.coplanarPoint(hr).applyMatrix4(t),i=this.normal.applyMatrix3(r).normalize();return this.constant=-n.dot(i),this}),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(br.prototype,{set:function(t,e,r,n,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(r),o[3].copy(n),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;r<6;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes,r=t.elements,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],h=r[6],l=r[7],u=r[8],p=r[9],d=r[10],f=r[11],m=r[12],g=r[13],v=r[14],y=r[15];return e[0].setComponents(o-n,l-s,f-u,y-m).normalize(),e[1].setComponents(o+n,l+s,f+u,y+m).normalize(),e[2].setComponents(o+i,l+c,f+p,y+g).normalize(),e[3].setComponents(o-i,l-c,f-p,y-g).normalize(),e[4].setComponents(o-a,l-h,f-d,y-v).normalize(),e[5].setComponents(o+a,l+h,f+d,y+v).normalize(),this},intersectsObject:(gr=new yr,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),gr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(gr)}),intersectsSprite:(mr=new yr,function(t){return mr.center.set(0,0,0),mr.radius=.7071067811865476,mr.applyMatrix4(t.matrixWorld),this.intersectsSphere(mr)}),intersectsSphere:function(t){for(var e=this.planes,r=t.center,n=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(r)<n)return!1}return!0},intersectsBox:(fr=new We,function(t){for(var e=this.planes,r=0;r<6;r++){var n=e[r];if(fr.x=0<n.normal.x?t.max.x:t.min.x,fr.y=0<n.normal.y?t.max.y:t.min.y,fr.z=0<n.normal.z?t.max.z:t.min.z,n.distanceToPoint(fr)<0)return!1}return!0}),containsPoint:function(t){for(var e=this.planes,r=0;r<6;r++)if(e[r].distanceToPoint(t)<0)return!1;return!0}});var wr,_r={alphamap_fragment:"#ifdef USE_ALPHAMAP\r\n\r\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\r\n\r\n#endif\r\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\r\n\r\n\tuniform sampler2D alphaMap;\r\n\r\n#endif\r\n",alphatest_fragment:"#ifdef ALPHATEST\r\n\r\n\tif ( diffuseColor.a < ALPHATEST ) discard;\r\n\r\n#endif\r\n",aomap_fragment:"#ifdef USE_AOMAP\r\n\r\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\r\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\r\n\r\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\r\n\r\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\r\n\r\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\r\n\r\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\r\n\r\n\t#endif\r\n\r\n#endif\r\n",aomap_pars_fragment:"#ifdef USE_AOMAP\r\n\r\n\tuniform sampler2D aoMap;\r\n\tuniform float aoMapIntensity;\r\n\r\n#endif",begin_vertex:"\r\nvec3 transformed = vec3( position );\r\n",beginnormal_vertex:"\r\nvec3 objectNormal = vec3( normal );\r\n",bsdfs:'float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\r\n\r\n\tif( decayExponent > 0.0 ) {\r\n\r\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\r\n\r\n\t\t// based upon Frostbite 3 Moving to Physically-based Rendering\r\n\t\t// page 32, equation 26: E[window1]\r\n\t\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\r\n\t\t// this is intended to be used on spot and point lights who are represented as luminous intensity\r\n\t\t// but who must be converted to luminous irradiance for surface lighting calculation\r\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\r\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\r\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\r\n\r\n#else\r\n\r\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\r\n\r\n#endif\r\n\r\n\t}\r\n\r\n\treturn 1.0;\r\n\r\n}\r\n\r\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\r\n\r\n\treturn RECIPROCAL_PI * diffuseColor;\r\n\r\n} // validated\r\n\r\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\r\n\r\n\t// Original approximation by Christophe Schlick \'94\r\n\t// float fresnel = pow( 1.0 - dotLH, 5.0 );\r\n\r\n\t// Optimized variant (presented by Epic at SIGGRAPH \'13)\r\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\r\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\r\n\r\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\r\n\r\n} // validated\r\n\r\n// Microfacet Models for Refraction through Rough Surfaces - equation (34)\r\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\r\n// alpha is "roughness squared" in Disney’s reparameterization\r\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\r\n\r\n\t// geometry term (normalized) = G(l)⋅G(v) / 4(n⋅l)(n⋅v)\r\n\t// also see #12151\r\n\r\n\tfloat a2 = pow2( alpha );\r\n\r\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\r\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\r\n\r\n\treturn 1.0 / ( gl * gv );\r\n\r\n} // validated\r\n\r\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\r\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\r\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\r\n\r\n\tfloat a2 = pow2( alpha );\r\n\r\n\t// dotNL and dotNV are explicitly swapped. This is not a mistake.\r\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\r\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\r\n\r\n\treturn 0.5 / max( gv + gl, EPSILON );\r\n\r\n}\r\n\r\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\r\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\r\n// alpha is "roughness squared" in Disney’s reparameterization\r\nfloat D_GGX( const in float alpha, const in float dotNH ) {\r\n\r\n\tfloat a2 = pow2( alpha );\r\n\r\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\r\n\r\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\r\n\r\n}\r\n\r\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\r\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\r\n\r\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\r\n\r\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r\n\r\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\r\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\r\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\r\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\r\n\r\n\tvec3 F = F_Schlick( specularColor, dotLH );\r\n\r\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\r\n\r\n\tfloat D = D_GGX( alpha, dotNH );\r\n\r\n\treturn F * ( G * D );\r\n\r\n} // validated\r\n\r\n// Rect Area Light\r\n\r\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\r\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\r\n// code: https://github.com/selfshadow/ltc_code/\r\n\r\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\r\n\r\n\tconst float LUT_SIZE  = 64.0;\r\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\r\n\tconst float LUT_BIAS  = 0.5 / LUT_SIZE;\r\n\r\n\tfloat dotNV = saturate( dot( N, V ) );\r\n\r\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\r\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\r\n\r\n\tuv = uv * LUT_SCALE + LUT_BIAS;\r\n\r\n\treturn uv;\r\n\r\n}\r\n\r\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\r\n\r\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\r\n\t// An approximation of the form factor of a horizon-clipped rectangle.\r\n\r\n\tfloat l = length( f );\r\n\r\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\r\n\r\n}\r\n\r\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\r\n\r\n\tfloat x = dot( v1, v2 );\r\n\r\n\tfloat y = abs( x );\r\n\r\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\r\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\r\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\r\n\tfloat v = a / b;\r\n\r\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\r\n\r\n\treturn cross( v1, v2 ) * theta_sintheta;\r\n\r\n}\r\n\r\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\r\n\r\n\t// bail if point is on back side of plane of light\r\n\t// assumes ccw winding order of light vertices\r\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\r\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\r\n\tvec3 lightNormal = cross( v1, v2 );\r\n\r\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\r\n\r\n\t// construct orthonormal basis around N\r\n\tvec3 T1, T2;\r\n\tT1 = normalize( V - N * dot( V, N ) );\r\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\r\n\r\n\t// compute transform\r\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\r\n\r\n\t// transform rect\r\n\tvec3 coords[ 4 ];\r\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\r\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\r\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\r\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\r\n\r\n\t// project rect onto sphere\r\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\r\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\r\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\r\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\r\n\r\n\t// calculate vector form factor\r\n\tvec3 vectorFormFactor = vec3( 0.0 );\r\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\r\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\r\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\r\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\r\n\r\n\t// adjust for horizon clipping\r\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\r\n\r\n\r\n\r\n\treturn vec3( result );\r\n\r\n}\r\n\r\n// End Rect Area Light\r\n\r\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\r\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\r\n\r\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\r\n\r\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\r\n\r\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\r\n\r\n\tvec4 r = roughness * c0 + c1;\r\n\r\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\r\n\r\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\r\n\r\n\treturn specularColor * AB.x + AB.y;\r\n\r\n} // validated\r\n\r\n\r\nfloat G_BlinnPhong_Implicit( ) {\r\n\r\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\r\n\treturn 0.25;\r\n\r\n}\r\n\r\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\r\n\r\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\r\n\r\n}\r\n\r\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\r\n\r\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r\n\r\n\t//float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\r\n\t//float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\r\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\r\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\r\n\r\n\tvec3 F = F_Schlick( specularColor, dotLH );\r\n\r\n\tfloat G = G_BlinnPhong_Implicit( );\r\n\r\n\tfloat D = D_BlinnPhong( shininess, dotNH );\r\n\r\n\treturn F * ( G * D );\r\n\r\n} // validated\r\n\r\n// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html\r\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\r\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\r\n}\r\n\r\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\r\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\r\n}\r\n',bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\r\n\r\n\tuniform sampler2D bumpMap;\r\n\tuniform float bumpScale;\r\n\r\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\r\n\t// http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf\r\n\r\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\r\n\r\n\tvec2 dHdxy_fwd() {\r\n\r\n\t\tvec2 dSTdx = dFdx( vUv );\r\n\t\tvec2 dSTdy = dFdy( vUv );\r\n\r\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\r\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\r\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\r\n\r\n\t\treturn vec2( dBx, dBy );\r\n\r\n\t}\r\n\r\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\r\n\r\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\r\n\r\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\r\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\r\n\t\tvec3 vN = surf_norm;\t\t// normalized\r\n\r\n\t\tvec3 R1 = cross( vSigmaY, vN );\r\n\t\tvec3 R2 = cross( vN, vSigmaX );\r\n\r\n\t\tfloat fDet = dot( vSigmaX, R1 );\r\n\r\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\r\n\r\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\r\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\r\n\r\n\t}\r\n\r\n#endif\r\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\r\n\r\n\tvec4 plane;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\r\n\r\n\t\tplane = clippingPlanes[ i ];\r\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\r\n\r\n\t}\r\n\r\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\r\n\r\n\t\tbool clipped = true;\r\n\r\n\t\t#pragma unroll_loop\r\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\r\n\r\n\t\t\tplane = clippingPlanes[ i ];\r\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\r\n\r\n\t\t}\r\n\r\n\t\tif ( clipped ) discard;\r\n\r\n\t#endif\r\n\r\n#endif\r\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\r\n\r\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\r\n\t\tvarying vec3 vViewPosition;\r\n\t#endif\r\n\r\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\r\n\r\n#endif\r\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\r\n\tvarying vec3 vViewPosition;\r\n#endif\r\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\r\n\tvViewPosition = - mvPosition.xyz;\r\n#endif\r\n\r\n",color_fragment:"#ifdef USE_COLOR\r\n\r\n\tdiffuseColor.rgb *= vColor;\r\n\r\n#endif",color_pars_fragment:"#ifdef USE_COLOR\r\n\r\n\tvarying vec3 vColor;\r\n\r\n#endif\r\n",color_pars_vertex:"#ifdef USE_COLOR\r\n\r\n\tvarying vec3 vColor;\r\n\r\n#endif",color_vertex:"#ifdef USE_COLOR\r\n\r\n\tvColor.xyz = color.xyz;\r\n\r\n#endif",common:"#define PI 3.14159265359\r\n#define PI2 6.28318530718\r\n#define PI_HALF 1.5707963267949\r\n#define RECIPROCAL_PI 0.31830988618\r\n#define RECIPROCAL_PI2 0.15915494\r\n#define LOG2 1.442695\r\n#define EPSILON 1e-6\r\n\r\n#define saturate(a) clamp( a, 0.0, 1.0 )\r\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\r\n\r\nfloat pow2( const in float x ) { return x*x; }\r\nfloat pow3( const in float x ) { return x*x*x; }\r\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\r\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\r\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\r\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\r\nhighp float rand( const in vec2 uv ) {\r\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\r\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\r\n\treturn fract(sin(sn) * c);\r\n}\r\n\r\nstruct IncidentLight {\r\n\tvec3 color;\r\n\tvec3 direction;\r\n\tbool visible;\r\n};\r\n\r\nstruct ReflectedLight {\r\n\tvec3 directDiffuse;\r\n\tvec3 directSpecular;\r\n\tvec3 indirectDiffuse;\r\n\tvec3 indirectSpecular;\r\n};\r\n\r\nstruct GeometricContext {\r\n\tvec3 position;\r\n\tvec3 normal;\r\n\tvec3 viewDir;\r\n};\r\n\r\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\r\n\r\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\r\n\r\n}\r\n\r\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\r\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\r\n\r\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\r\n\r\n}\r\n\r\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\r\n\r\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\r\n\r\n\treturn - distance * planeNormal + point;\r\n\r\n}\r\n\r\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\r\n\r\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\r\n\r\n}\r\n\r\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\r\n\r\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\r\n\r\n}\r\n\r\nmat3 transposeMat3( const in mat3 m ) {\r\n\r\n\tmat3 tmp;\r\n\r\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\r\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\r\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\r\n\r\n\treturn tmp;\r\n\r\n}\r\n\r\n// https://en.wikipedia.org/wiki/Relative_luminance\r\nfloat linearToRelativeLuminance( const in vec3 color ) {\r\n\r\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\r\n\r\n\treturn dot( weights, color.rgb );\r\n\r\n}\r\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\r\n\r\n#define cubeUV_textureSize (1024.0)\r\n\r\nint getFaceFromDirection(vec3 direction) {\r\n\tvec3 absDirection = abs(direction);\r\n\tint face = -1;\r\n\tif( absDirection.x > absDirection.z ) {\r\n\t\tif(absDirection.x > absDirection.y )\r\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\r\n\t\telse\r\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\r\n\t}\r\n\telse {\r\n\t\tif(absDirection.z > absDirection.y )\r\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\r\n\t\telse\r\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\r\n\t}\r\n\treturn face;\r\n}\r\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\r\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\r\n\r\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\r\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\r\n\tfloat dxRoughness = dFdx(roughness);\r\n\tfloat dyRoughness = dFdy(roughness);\r\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\r\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\r\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\r\n\t// Clamp the value to the max mip level counts. hard coded to 6 mips\r\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\r\n\tfloat mipLevel = 0.5 * log2(d);\r\n\treturn vec2(floor(mipLevel), fract(mipLevel));\r\n}\r\n\r\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\r\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\r\n\r\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\r\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\r\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\r\n\r\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\r\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\r\n\t// float powScale = exp2(roughnessLevel + mipLevel);\r\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\r\n\t// float scale =  1.0 / exp2(roughnessLevel + 2.0 + mipLevel);\r\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\r\n\t// float mipOffset = 0.75*(1.0 - 1.0/exp2(mipLevel))/exp2(roughnessLevel);\r\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\r\n\r\n\tbool bRes = mipLevel == 0.0;\r\n\tscale =  bRes && (scale < a) ? a : scale;\r\n\r\n\tvec3 r;\r\n\tvec2 offset;\r\n\tint face = getFaceFromDirection(direction);\r\n\r\n\tfloat rcpPowScale = 1.0 / powScale;\r\n\r\n\tif( face == 0) {\r\n\t\tr = vec3(direction.x, -direction.z, direction.y);\r\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\r\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\r\n\t}\r\n\telse if( face == 1) {\r\n\t\tr = vec3(direction.y, direction.x, direction.z);\r\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\r\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\r\n\t}\r\n\telse if( face == 2) {\r\n\t\tr = vec3(direction.z, direction.x, direction.y);\r\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\r\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\r\n\t}\r\n\telse if( face == 3) {\r\n\t\tr = vec3(direction.x, direction.z, direction.y);\r\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\r\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\r\n\t}\r\n\telse if( face == 4) {\r\n\t\tr = vec3(direction.y, direction.x, -direction.z);\r\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\r\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\r\n\t}\r\n\telse {\r\n\t\tr = vec3(direction.z, -direction.x, direction.y);\r\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\r\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\r\n\t}\r\n\tr = normalize(r);\r\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\r\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\r\n\tvec2 base = offset + vec2( texelOffset );\r\n\treturn base + s * ( scale - 2.0 * texelOffset );\r\n}\r\n\r\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\r\n\r\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\r\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\r\n\tfloat r1 = floor(roughnessVal);\r\n\tfloat r2 = r1 + 1.0;\r\n\tfloat t = fract(roughnessVal);\r\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\r\n\tfloat s = mipInfo.y;\r\n\tfloat level0 = mipInfo.x;\r\n\tfloat level1 = level0 + 1.0;\r\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\r\n\r\n\t// round to nearest mipmap if we are not interpolating.\r\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\r\n\r\n\t// Tri linear interpolation.\r\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\r\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\r\n\r\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\r\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\r\n\r\n\tvec4 result = mix(color10, color20, t);\r\n\r\n\treturn vec4(result.rgb, 1.0);\r\n}\r\n\r\n#endif\r\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\r\n\r\n#ifdef FLIP_SIDED\r\n\r\n\ttransformedNormal = - transformedNormal;\r\n\r\n#endif\r\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\r\n\r\n\tuniform sampler2D displacementMap;\r\n\tuniform float displacementScale;\r\n\tuniform float displacementBias;\r\n\r\n#endif\r\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\r\n\r\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\r\n\r\n#endif\r\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\r\n\r\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\r\n\r\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\r\n\r\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\r\n\r\n#endif\r\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\r\n\r\n\tuniform sampler2D emissiveMap;\r\n\r\n#endif\r\n",encodings_fragment:"  gl_FragColor = linearToOutputTexel( gl_FragColor );\r\n",encodings_pars_fragment:"// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/\r\n\r\nvec4 LinearToLinear( in vec4 value ) {\r\n\treturn value;\r\n}\r\n\r\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\r\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\r\n}\r\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\r\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\r\n}\r\n\r\nvec4 sRGBToLinear( in vec4 value ) {\r\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\r\n}\r\nvec4 LinearTosRGB( in vec4 value ) {\r\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\r\n}\r\n\r\nvec4 RGBEToLinear( in vec4 value ) {\r\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\r\n}\r\nvec4 LinearToRGBE( in vec4 value ) {\r\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\r\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\r\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\r\n//  return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );\r\n}\r\n\r\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\r\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\r\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\r\n}\r\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\r\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\r\n\tfloat M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\r\n\tM            = ceil( M * 255.0 ) / 255.0;\r\n\treturn vec4( value.rgb / ( M * maxRange ), M );\r\n}\r\n\r\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\r\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\r\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\r\n}\r\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\r\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\r\n\tfloat D      = max( maxRange / maxRGB, 1.0 );\r\n\tD            = min( floor( D ) / 255.0, 1.0 );\r\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\r\n}\r\n\r\n// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html\r\n\r\n// M matrix, for encoding\r\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\r\nvec4 LinearToLogLuv( in vec4 value )  {\r\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\r\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\r\n\tvec4 vResult;\r\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\r\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\r\n\tvResult.w = fract(Le);\r\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\r\n\treturn vResult;\r\n}\r\n\r\n// Inverse M matrix, for decoding\r\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\r\nvec4 LogLuvToLinear( in vec4 value ) {\r\n\tfloat Le = value.z * 255.0 + value.w;\r\n\tvec3 Xp_Y_XYZp;\r\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\r\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\r\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\r\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\r\n\treturn vec4( max(vRGB, 0.0), 1.0 );\r\n}\r\n",envmap_fragment:"#ifdef USE_ENVMAP\r\n\r\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\r\n\r\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\r\n\r\n\t\t// Transforming Normal Vectors with the Inverse Transformation\r\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\r\n\r\n\t\t#ifdef ENVMAP_MODE_REFLECTION\r\n\r\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\r\n\r\n\t\t#else\r\n\r\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\r\n\r\n\t\t#endif\r\n\r\n\t#else\r\n\r\n\t\tvec3 reflectVec = vReflect;\r\n\r\n\t#endif\r\n\r\n\t#ifdef ENVMAP_TYPE_CUBE\r\n\r\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\r\n\r\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\r\n\r\n\t\tvec2 sampleUV;\r\n\r\n\t\treflectVec = normalize( reflectVec );\r\n\r\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\r\n\r\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\r\n\r\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\r\n\r\n\t#elif defined( ENVMAP_TYPE_SPHERE )\r\n\r\n\t\treflectVec = normalize( reflectVec );\r\n\r\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\r\n\r\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\r\n\r\n\t#else\r\n\r\n\t\tvec4 envColor = vec4( 0.0 );\r\n\r\n\t#endif\r\n\r\n\tenvColor = envMapTexelToLinear( envColor );\r\n\r\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\r\n\r\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\r\n\r\n\t#elif defined( ENVMAP_BLENDING_MIX )\r\n\r\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\r\n\r\n\t#elif defined( ENVMAP_BLENDING_ADD )\r\n\r\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\r\n\r\n\t#endif\r\n\r\n#endif\r\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\r\n\tuniform float reflectivity;\r\n\tuniform float envMapIntensity;\r\n#endif\r\n\r\n#ifdef USE_ENVMAP\r\n\r\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\r\n\t\tvarying vec3 vWorldPosition;\r\n\t#endif\r\n\r\n\t#ifdef ENVMAP_TYPE_CUBE\r\n\t\tuniform samplerCube envMap;\r\n\t#else\r\n\t\tuniform sampler2D envMap;\r\n\t#endif\r\n\tuniform float flipEnvMap;\r\n\tuniform int maxMipLevel;\r\n\r\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\r\n\t\tuniform float refractionRatio;\r\n\t#else\r\n\t\tvarying vec3 vReflect;\r\n\t#endif\r\n\r\n#endif\r\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\r\n\r\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\r\n\t\tvarying vec3 vWorldPosition;\r\n\r\n\t#else\r\n\r\n\t\tvarying vec3 vReflect;\r\n\t\tuniform float refractionRatio;\r\n\r\n\t#endif\r\n\r\n#endif\r\n",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\r\n\r\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\r\n\r\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\r\n\r\n\t\t#ifdef ENVMAP_TYPE_CUBE\r\n\r\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\r\n\r\n\t\t\t// TODO: replace with properly filtered cubemaps and access the irradiance LOD level, be it the last LOD level\r\n\t\t\t// of a specular cubemap, or just the default level of a specially created irradiance cubemap.\r\n\r\n\t\t\t#ifdef TEXTURE_LOD_EXT\r\n\r\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\r\n\r\n\t\t\t#else\r\n\r\n\t\t\t\t// force the bias high to get the last LOD level as it is the most blurred.\r\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\r\n\r\n\t\t\t#endif\r\n\r\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\r\n\r\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\r\n\r\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\r\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\r\n\r\n\t\t#else\r\n\r\n\t\t\tvec4 envMapColor = vec4( 0.0 );\r\n\r\n\t\t#endif\r\n\r\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\r\n\r\n\t}\r\n\r\n\t// taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html\r\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\r\n\r\n\t\t//float envMapWidth = pow( 2.0, maxMIPLevelScalar );\r\n\t\t//float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\r\n\r\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\r\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\r\n\r\n\t\t// clamp to allowable LOD ranges.\r\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\r\n\r\n\t}\r\n\r\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\r\n\r\n\t\t#ifdef ENVMAP_MODE_REFLECTION\r\n\r\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\r\n\r\n\t\t#else\r\n\r\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\r\n\r\n\t\t#endif\r\n\r\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\r\n\r\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\r\n\r\n\t\t#ifdef ENVMAP_TYPE_CUBE\r\n\r\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\r\n\r\n\t\t\t#ifdef TEXTURE_LOD_EXT\r\n\r\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\r\n\r\n\t\t\t#else\r\n\r\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\r\n\r\n\t\t\t#endif\r\n\r\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\r\n\r\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\r\n\r\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\r\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\r\n\r\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\r\n\r\n\t\t\tvec2 sampleUV;\r\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\r\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\r\n\r\n\t\t\t#ifdef TEXTURE_LOD_EXT\r\n\r\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\r\n\r\n\t\t\t#else\r\n\r\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\r\n\r\n\t\t\t#endif\r\n\r\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\r\n\r\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\r\n\r\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\r\n\r\n\t\t\t#ifdef TEXTURE_LOD_EXT\r\n\r\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\r\n\r\n\t\t\t#else\r\n\r\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\r\n\r\n\t\t\t#endif\r\n\r\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\r\n\r\n\t\t#endif\r\n\r\n\t\treturn envMapColor.rgb * envMapIntensity;\r\n\r\n\t}\r\n\r\n#endif\r\n",envmap_vertex:"#ifdef USE_ENVMAP\r\n\r\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\r\n\r\n\t\tvWorldPosition = worldPosition.xyz;\r\n\r\n\t#else\r\n\r\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\r\n\r\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\r\n\r\n\t\t#ifdef ENVMAP_MODE_REFLECTION\r\n\r\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\r\n\r\n\t\t#else\r\n\r\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\r\n\r\n\t\t#endif\r\n\r\n\t#endif\r\n\r\n#endif\r\n",fog_vertex:"#ifdef USE_FOG\r\n\r\n\tvFogPosition = mvPosition.xyz;\r\n\r\n#endif\r\n",fog_pars_vertex:"#ifdef USE_FOG\r\n\r\n\tvarying vec3 vFogPosition;\r\n\r\n#endif\r\n",fog_fragment:"#ifdef USE_FOG\r\n\r\n\tfloat fogDepth = length( vFogPosition );\r\n\r\n\t#ifdef FOG_EXP2\r\n\r\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\r\n\r\n\t#else\r\n\r\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\r\n\r\n\t#endif\r\n\r\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\r\n\r\n#endif\r\n",fog_pars_fragment:"#ifdef USE_FOG\r\n\r\n\tuniform vec3 fogColor;\r\n\tvarying vec3 vFogPosition;\r\n\r\n\t#ifdef FOG_EXP2\r\n\r\n\t\tuniform float fogDensity;\r\n\r\n\t#else\r\n\r\n\t\tuniform float fogNear;\r\n\t\tuniform float fogFar;\r\n\r\n\t#endif\r\n\r\n#endif\r\n",gradientmap_pars_fragment:"#ifdef TOON\r\n\r\n\tuniform sampler2D gradientMap;\r\n\r\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\r\n\r\n\t\t// dotNL will be from -1.0 to 1.0\r\n\t\tfloat dotNL = dot( normal, lightDirection );\r\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\r\n\r\n\t\t#ifdef USE_GRADIENTMAP\r\n\r\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\r\n\r\n\t\t#else\r\n\r\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\r\n\r\n\t\t#endif\r\n\r\n\r\n\t}\r\n\r\n#endif\r\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\r\n\r\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage\r\n\r\n#endif\r\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\r\n\r\n\tuniform sampler2D lightMap;\r\n\tuniform float lightMapIntensity;\r\n\r\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\r\n\r\nGeometricContext geometry;\r\ngeometry.position = mvPosition.xyz;\r\ngeometry.normal = normalize( transformedNormal );\r\ngeometry.viewDir = normalize( -mvPosition.xyz );\r\n\r\nGeometricContext backGeometry;\r\nbackGeometry.position = geometry.position;\r\nbackGeometry.normal = -geometry.normal;\r\nbackGeometry.viewDir = geometry.viewDir;\r\n\r\nvLightFront = vec3( 0.0 );\r\n\r\n#ifdef DOUBLE_SIDED\r\n\tvLightBack = vec3( 0.0 );\r\n#endif\r\n\r\nIncidentLight directLight;\r\nfloat dotNL;\r\nvec3 directLightColor_Diffuse;\r\n\r\n#if NUM_POINT_LIGHTS > 0\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\r\n\r\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\r\n\r\n\t\tdotNL = dot( geometry.normal, directLight.direction );\r\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\r\n\r\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\r\n\r\n\t\t#ifdef DOUBLE_SIDED\r\n\r\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\r\n\r\n\t\t#endif\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#if NUM_SPOT_LIGHTS > 0\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\r\n\r\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\r\n\r\n\t\tdotNL = dot( geometry.normal, directLight.direction );\r\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\r\n\r\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\r\n\r\n\t\t#ifdef DOUBLE_SIDED\r\n\r\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\r\n\r\n\t\t#endif\r\n\t}\r\n\r\n#endif\r\n\r\n\r\n\r\n#if NUM_DIR_LIGHTS > 0\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n\r\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\r\n\r\n\t\tdotNL = dot( geometry.normal, directLight.direction );\r\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\r\n\r\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\r\n\r\n\t\t#ifdef DOUBLE_SIDED\r\n\r\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\r\n\r\n\t\t#endif\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#if NUM_HEMI_LIGHTS > 0\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\r\n\r\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\r\n\r\n\t\t#ifdef DOUBLE_SIDED\r\n\r\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\r\n\r\n\t\t#endif\r\n\r\n\t}\r\n\r\n#endif\r\n",lights_pars_begin:"uniform vec3 ambientLightColor;\r\n\r\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\r\n\r\n\tvec3 irradiance = ambientLightColor;\r\n\r\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\r\n\r\n\t\tirradiance *= PI;\r\n\r\n\t#endif\r\n\r\n\treturn irradiance;\r\n\r\n}\r\n\r\n#if NUM_DIR_LIGHTS > 0\r\n\r\n\tstruct DirectionalLight {\r\n\t\tvec3 direction;\r\n\t\tvec3 color;\r\n\r\n\t\tint shadow;\r\n\t\tfloat shadowBias;\r\n\t\tfloat shadowRadius;\r\n\t\tvec2 shadowMapSize;\r\n\t};\r\n\r\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\r\n\r\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\r\n\r\n\t\tdirectLight.color = directionalLight.color;\r\n\t\tdirectLight.direction = directionalLight.direction;\r\n\t\tdirectLight.visible = true;\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n\r\n#if NUM_POINT_LIGHTS > 0\r\n\r\n\tstruct PointLight {\r\n\t\tvec3 position;\r\n\t\tvec3 color;\r\n\t\tfloat distance;\r\n\t\tfloat decay;\r\n\r\n\t\tint shadow;\r\n\t\tfloat shadowBias;\r\n\t\tfloat shadowRadius;\r\n\t\tvec2 shadowMapSize;\r\n\t\tfloat shadowCameraNear;\r\n\t\tfloat shadowCameraFar;\r\n\t};\r\n\r\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\r\n\r\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\r\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\r\n\r\n\t\tvec3 lVector = pointLight.position - geometry.position;\r\n\t\tdirectLight.direction = normalize( lVector );\r\n\r\n\t\tfloat lightDistance = length( lVector );\r\n\r\n\t\tdirectLight.color = pointLight.color;\r\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\r\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n\r\n#if NUM_SPOT_LIGHTS > 0\r\n\r\n\tstruct SpotLight {\r\n\t\tvec3 position;\r\n\t\tvec3 direction;\r\n\t\tvec3 color;\r\n\t\tfloat distance;\r\n\t\tfloat decay;\r\n\t\tfloat coneCos;\r\n\t\tfloat penumbraCos;\r\n\r\n\t\tint shadow;\r\n\t\tfloat shadowBias;\r\n\t\tfloat shadowRadius;\r\n\t\tvec2 shadowMapSize;\r\n\t};\r\n\r\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\r\n\r\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\r\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\r\n\r\n\t\tvec3 lVector = spotLight.position - geometry.position;\r\n\t\tdirectLight.direction = normalize( lVector );\r\n\r\n\t\tfloat lightDistance = length( lVector );\r\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\r\n\r\n\t\tif ( angleCos > spotLight.coneCos ) {\r\n\r\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\r\n\r\n\t\t\tdirectLight.color = spotLight.color;\r\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\r\n\t\t\tdirectLight.visible = true;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tdirectLight.color = vec3( 0.0 );\r\n\t\t\tdirectLight.visible = false;\r\n\r\n\t\t}\r\n\t}\r\n\r\n#endif\r\n\r\n\r\n#if NUM_RECT_AREA_LIGHTS > 0\r\n\r\n\tstruct RectAreaLight {\r\n\t\tvec3 color;\r\n\t\tvec3 position;\r\n\t\tvec3 halfWidth;\r\n\t\tvec3 halfHeight;\r\n\t};\r\n\r\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\r\n\t// BRDF approximation Texture is 64x64\r\n\tuniform sampler2D ltc_1; // RGBA Float\r\n\tuniform sampler2D ltc_2; // RGBA Float\r\n\r\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\r\n\r\n#endif\r\n\r\n\r\n#if NUM_HEMI_LIGHTS > 0\r\n\r\n\tstruct HemisphereLight {\r\n\t\tvec3 direction;\r\n\t\tvec3 skyColor;\r\n\t\tvec3 groundColor;\r\n\t};\r\n\r\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\r\n\r\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\r\n\r\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\r\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\r\n\r\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\r\n\r\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\r\n\r\n\t\t\tirradiance *= PI;\r\n\r\n\t\t#endif\r\n\r\n\t\treturn irradiance;\r\n\r\n\t}\r\n\r\n#endif\r\n",lights_phong_fragment:"BlinnPhongMaterial material;\r\nmaterial.diffuseColor = diffuseColor.rgb;\r\nmaterial.specularColor = specular;\r\nmaterial.specularShininess = shininess;\r\nmaterial.specularStrength = specularStrength;\r\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n\tvarying vec3 vNormal;\r\n\r\n#endif\r\n\r\n\r\nstruct BlinnPhongMaterial {\r\n\r\n\tvec3\tdiffuseColor;\r\n\tvec3\tspecularColor;\r\n\tfloat\tspecularShininess;\r\n\tfloat\tspecularStrength;\r\n\r\n};\r\n\r\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r\n\r\n\t#ifdef TOON\r\n\r\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\r\n\r\n\t#else\r\n\r\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\r\n\t\tvec3 irradiance = dotNL * directLight.color;\r\n\r\n\t#endif\r\n\r\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\r\n\r\n\t\tirradiance *= PI; // punctual light\r\n\r\n\t#endif\r\n\r\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n\r\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\r\n\r\n}\r\n\r\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r\n\r\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n\r\n}\r\n\r\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\r\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\r\n\r\n#define Material_LightProbeLOD( material )\t(0)\r\n",lights_physical_fragment:"PhysicalMaterial material;\r\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\r\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\r\n#ifdef STANDARD\r\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\r\n#else\r\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\r\n\tmaterial.clearCoat = saturate( clearCoat ); // Burley clearcoat model\r\n\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\r\n#endif\r\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\r\n\r\n\tvec3\tdiffuseColor;\r\n\tfloat\tspecularRoughness;\r\n\tvec3\tspecularColor;\r\n\r\n\t#ifndef STANDARD\r\n\t\tfloat clearCoat;\r\n\t\tfloat clearCoatRoughness;\r\n\t#endif\r\n\r\n};\r\n\r\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\r\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\r\n\r\n// Clear coat directional hemishperical reflectance (this approximation should be improved)\r\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\r\n\r\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\r\n\r\n}\r\n\r\n#if NUM_RECT_AREA_LIGHTS > 0\r\n\r\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\r\n\r\n\t\tvec3 normal = geometry.normal;\r\n\t\tvec3 viewDir = geometry.viewDir;\r\n\t\tvec3 position = geometry.position;\r\n\t\tvec3 lightPos = rectAreaLight.position;\r\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\r\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\r\n\t\tvec3 lightColor = rectAreaLight.color;\r\n\t\tfloat roughness = material.specularRoughness;\r\n\r\n\t\tvec3 rectCoords[ 4 ];\r\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight; // counterclockwise\r\n\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\r\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\r\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\r\n\r\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\r\n\r\n\t\tvec4 t1 = texture2D( ltc_1, uv );\r\n\t\tvec4 t2 = texture2D( ltc_2, uv );\r\n\r\n\t\tmat3 mInv = mat3(\r\n\t\t\tvec3( t1.x, 0, t1.y ),\r\n\t\t\tvec3(    0, 1,    0 ),\r\n\t\t\tvec3( t1.z, 0, t1.w )\r\n\t\t);\r\n\r\n\t\t// LTC Fresnel Approximation by Stephen Hill\r\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\r\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\r\n\r\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\r\n\r\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\r\n\r\n\t}\r\n\r\n#endif\r\n\r\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\r\n\r\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\r\n\r\n\tvec3 irradiance = dotNL * directLight.color;\r\n\r\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\r\n\r\n\t\tirradiance *= PI; // punctual light\r\n\r\n\t#endif\r\n\r\n\t#ifndef STANDARD\r\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\r\n\t#else\r\n\t\tfloat clearCoatDHR = 0.0;\r\n\t#endif\r\n\r\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\r\n\r\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n\r\n\t#ifndef STANDARD\r\n\r\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\r\n\r\n\t#endif\r\n\r\n}\r\n\r\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\r\n\r\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n\r\n}\r\n\r\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\r\n\r\n\t#ifndef STANDARD\r\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\r\n\t\tfloat dotNL = dotNV;\r\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\r\n\t#else\r\n\t\tfloat clearCoatDHR = 0.0;\r\n\t#endif\r\n\r\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\r\n\r\n\t#ifndef STANDARD\r\n\r\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\r\n\r\n\t#endif\r\n\r\n}\r\n\r\n#define RE_Direct\t\t\t\tRE_Direct_Physical\r\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\r\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\r\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\r\n\r\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\r\n#define Material_ClearCoat_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\r\n\r\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\r\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\r\n\r\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\r\n\r\n}\r\n",lights_fragment_begin:"\r\n\r\nGeometricContext geometry;\r\n\r\ngeometry.position = - vViewPosition;\r\ngeometry.normal = normal;\r\ngeometry.viewDir = normalize( vViewPosition );\r\n\r\nIncidentLight directLight;\r\n\r\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\r\n\r\n\tPointLight pointLight;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\r\n\r\n\t\tpointLight = pointLights[ i ];\r\n\r\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\r\n\r\n\t\t#ifdef USE_SHADOWMAP\r\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\r\n\t\t#endif\r\n\r\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\r\n\r\n\tSpotLight spotLight;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\r\n\r\n\t\tspotLight = spotLights[ i ];\r\n\r\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\r\n\r\n\t\t#ifdef USE_SHADOWMAP\r\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\r\n\t\t#endif\r\n\r\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\r\n\r\n\tDirectionalLight directionalLight;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n\r\n\t\tdirectionalLight = directionalLights[ i ];\r\n\r\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\r\n\r\n\t\t#ifdef USE_SHADOWMAP\r\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\r\n\t\t#endif\r\n\r\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\r\n\r\n\tRectAreaLight rectAreaLight;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\r\n\r\n\t\trectAreaLight = rectAreaLights[ i ];\r\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#if defined( RE_IndirectDiffuse )\r\n\r\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\r\n\r\n\t#if ( NUM_HEMI_LIGHTS > 0 )\r\n\r\n\t\t#pragma unroll_loop\r\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\r\n\r\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\r\n\r\n\t\t}\r\n\r\n\t#endif\r\n\r\n#endif\r\n\r\n#if defined( RE_IndirectSpecular )\r\n\r\n\tvec3 radiance = vec3( 0.0 );\r\n\tvec3 clearCoatRadiance = vec3( 0.0 );\r\n\r\n#endif\r\n",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\r\n\r\n\t#ifdef USE_LIGHTMAP\r\n\r\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\r\n\r\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\r\n\r\n\t\t\tlightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage\r\n\r\n\t\t#endif\r\n\r\n\t\tirradiance += lightMapIrradiance;\r\n\r\n\t#endif\r\n\r\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\r\n\r\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\r\n\r\n\t#endif\r\n\r\n#endif\r\n\r\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\r\n\r\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\r\n\r\n\t#ifndef STANDARD\r\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\r\n\t#endif\r\n\r\n#endif\r\n",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\r\n\r\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\r\n\r\n#endif\r\n\r\n#if defined( RE_IndirectSpecular )\r\n\r\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\r\n\r\n#endif\r\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\r\n\r\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\r\n\r\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\r\n\r\n\tuniform float logDepthBufFC;\r\n\tvarying float vFragDepth;\r\n\r\n#endif\r\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\r\n\r\n\t#ifdef USE_LOGDEPTHBUF_EXT\r\n\r\n\t\tvarying float vFragDepth;\r\n\r\n\t#else\r\n\r\n\t\tuniform float logDepthBufFC;\r\n\r\n\t#endif\r\n\r\n#endif\r\n",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\r\n\r\n\t#ifdef USE_LOGDEPTHBUF_EXT\r\n\r\n\t\tvFragDepth = 1.0 + gl_Position.w;\r\n\r\n\t#else\r\n\r\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\r\n\r\n\t\tgl_Position.z *= gl_Position.w;\r\n\r\n\t#endif\r\n\r\n#endif\r\n",map_fragment:"#ifdef USE_MAP\r\n\r\n\tvec4 texelColor = texture2D( map, vUv );\r\n\r\n\ttexelColor = mapTexelToLinear( texelColor );\r\n\tdiffuseColor *= texelColor;\r\n\r\n#endif\r\n",map_pars_fragment:"#ifdef USE_MAP\r\n\r\n\tuniform sampler2D map;\r\n\r\n#endif\r\n",map_particle_fragment:"#ifdef USE_MAP\r\n\r\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\r\n\tvec4 mapTexel = texture2D( map, uv );\r\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\r\n\r\n#endif\r\n",map_particle_pars_fragment:"#ifdef USE_MAP\r\n\r\n\tuniform mat3 uvTransform;\r\n\tuniform sampler2D map;\r\n\r\n#endif\r\n",metalnessmap_fragment:"float metalnessFactor = metalness;\r\n\r\n#ifdef USE_METALNESSMAP\r\n\r\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\r\n\r\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\r\n\tmetalnessFactor *= texelMetalness.b;\r\n\r\n#endif\r\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\r\n\r\n\tuniform sampler2D metalnessMap;\r\n\r\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\r\n\r\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\r\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\r\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\r\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\r\n\r\n#endif\r\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\r\n\r\n\t#ifndef USE_MORPHNORMALS\r\n\r\n\tuniform float morphTargetInfluences[ 8 ];\r\n\r\n\t#else\r\n\r\n\tuniform float morphTargetInfluences[ 4 ];\r\n\r\n\t#endif\r\n\r\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\r\n\r\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\r\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\r\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\r\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\r\n\r\n\t#ifndef USE_MORPHNORMALS\r\n\r\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\r\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\r\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\r\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\r\n\r\n\t#endif\r\n\r\n#endif\r\n",normal_fragment_begin:"#ifdef FLAT_SHADED\r\n\r\n\t// Workaround for Adreno/Nexus5 not able able to do dFdx( vViewPosition ) ...\r\n\r\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\r\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\r\n\tvec3 normal = normalize( cross( fdx, fdy ) );\r\n\r\n#else\r\n\r\n\tvec3 normal = normalize( vNormal );\r\n\r\n\t#ifdef DOUBLE_SIDED\r\n\r\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\r\n\r\n\t#endif\r\n\r\n#endif\r\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\r\n\r\n\t#ifdef OBJECTSPACE_NORMALMAP\r\n\r\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\r\n\r\n\t\t#ifdef FLIP_SIDED\r\n\r\n\t\t\tnormal = - normal;\r\n\r\n\t\t#endif\r\n\r\n\t\t#ifdef DOUBLE_SIDED\r\n\r\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\r\n\r\n\t\t#endif\r\n\r\n\t\tnormal = normalize( normalMatrix * normal );\r\n\r\n\t#else // tangent-space normal map\r\n\r\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\r\n\r\n\t#endif\r\n\r\n#elif defined( USE_BUMPMAP )\r\n\r\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\r\n\r\n#endif\r\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\r\n\r\n\tuniform sampler2D normalMap;\r\n\tuniform vec2 normalScale;\r\n\r\n\t#ifdef OBJECTSPACE_NORMALMAP\r\n\r\n\t\tuniform mat3 normalMatrix;\r\n\r\n\t#else\r\n\r\n\t\t// Per-Pixel Tangent Space Normal Mapping\r\n\t\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\r\n\r\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\r\n\r\n\t\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\r\n\r\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\r\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\r\n\t\t\tvec2 st0 = dFdx( vUv.st );\r\n\t\t\tvec2 st1 = dFdy( vUv.st );\r\n\r\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude\r\n\r\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\r\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\r\n\t\t\tvec3 N = normalize( surf_norm );\r\n\t\t\tmat3 tsn = mat3( S, T, N );\r\n\r\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\r\n\r\n\t\t\tmapN.xy *= normalScale;\r\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\r\n\r\n\t\t\treturn normalize( tsn * mapN );\r\n\r\n\t\t}\r\n\r\n\t#endif\r\n\r\n#endif\r\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\r\n\treturn normalize( normal ) * 0.5 + 0.5;\r\n}\r\n\r\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\r\n\treturn 2.0 * rgb.xyz - 1.0;\r\n}\r\n\r\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\r\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\r\n\r\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\r\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\r\n\r\nconst float ShiftRight8 = 1. / 256.;\r\n\r\nvec4 packDepthToRGBA( const in float v ) {\r\n\tvec4 r = vec4( fract( v * PackFactors ), v );\r\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\r\n\treturn r * PackUpscale;\r\n}\r\n\r\nfloat unpackRGBAToDepth( const in vec4 v ) {\r\n\treturn dot( v, UnpackFactors );\r\n}\r\n\r\n// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions\r\n\r\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\r\n\treturn ( viewZ + near ) / ( near - far );\r\n}\r\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\r\n\treturn linearClipZ * ( near - far ) - near;\r\n}\r\n\r\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\r\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\r\n}\r\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\r\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\r\n}\r\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\r\n\r\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\r\n\tgl_FragColor.rgb *= gl_FragColor.a;\r\n\r\n#endif\r\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\r\n\r\ngl_Position = projectionMatrix * mvPosition;\r\n",dithering_fragment:"#if defined( DITHERING )\r\n\r\n  gl_FragColor.rgb = dithering( gl_FragColor.rgb );\r\n\r\n#endif\r\n",dithering_pars_fragment:"#if defined( DITHERING )\r\n\r\n\t// based on https://www.shadertoy.com/view/MslGR8\r\n\tvec3 dithering( vec3 color ) {\r\n\t\t//Calculate grid position\r\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\r\n\r\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\r\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\r\n\r\n\t\t//modify shift acording to grid position.\r\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\r\n\r\n\t\t//shift the color by dither_shift\r\n\t\treturn color + dither_shift_RGB;\r\n\t}\r\n\r\n#endif\r\n",roughnessmap_fragment:"float roughnessFactor = roughness;\r\n\r\n#ifdef USE_ROUGHNESSMAP\r\n\r\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\r\n\r\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\r\n\troughnessFactor *= texelRoughness.g;\r\n\r\n#endif\r\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\r\n\r\n\tuniform sampler2D roughnessMap;\r\n\r\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\r\n\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\r\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\r\n\t#endif\r\n\r\n\t#if NUM_SPOT_LIGHTS > 0\r\n\r\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\r\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\r\n\r\n\t#endif\r\n\r\n\t#if NUM_POINT_LIGHTS > 0\r\n\r\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\r\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\r\n\r\n\t#endif\r\n\r\n\r\n\r\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\r\n\r\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\r\n\r\n\t}\r\n\r\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\r\n\r\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\r\n\r\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\r\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\r\n\r\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\r\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\r\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\r\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\r\n\r\n\t\tvec2 f = fract( uv * size + 0.5 );\r\n\r\n\t\tfloat a = mix( lb, lt, f.y );\r\n\t\tfloat b = mix( rb, rt, f.y );\r\n\t\tfloat c = mix( a, b, f.x );\r\n\r\n\t\treturn c;\r\n\r\n\t}\r\n\r\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\r\n\r\n\t\tfloat shadow = 1.0;\r\n\r\n\t\tshadowCoord.xyz /= shadowCoord.w;\r\n\t\tshadowCoord.z += shadowBias;\r\n\r\n\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\r\n\t\t// if ( all( something, something ) ) using this instead\r\n\r\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r\n\t\tbool inFrustum = all( inFrustumVec );\r\n\r\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r\n\r\n\t\tbool frustumTest = all( frustumTestVec );\r\n\r\n\t\tif ( frustumTest ) {\r\n\r\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\r\n\r\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\r\n\r\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\r\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\r\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\r\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\r\n\r\n\t\t\tshadow = (\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r\n\t\t\t) * ( 1.0 / 9.0 );\r\n\r\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\r\n\r\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\r\n\r\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\r\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\r\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\r\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\r\n\r\n\t\t\tshadow = (\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r\n\t\t\t) * ( 1.0 / 9.0 );\r\n\r\n\t\t#else // no percentage-closer filtering:\r\n\r\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\r\n\r\n\t\t#endif\r\n\r\n\t\t}\r\n\r\n\t\treturn shadow;\r\n\r\n\t}\r\n\r\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\r\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\r\n\t// 2D texture:\r\n\t//\r\n\t// xzXZ\r\n\t//  y Y\r\n\t//\r\n\t// Y - Positive y direction\r\n\t// y - Negative y direction\r\n\t// X - Positive x direction\r\n\t// x - Negative x direction\r\n\t// Z - Positive z direction\r\n\t// z - Negative z direction\r\n\t//\r\n\t// Source and test bed:\r\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\r\n\r\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\r\n\r\n\t\t// Number of texels to avoid at the edge of each square\r\n\r\n\t\tvec3 absV = abs( v );\r\n\r\n\t\t// Intersect unit cube\r\n\r\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\r\n\t\tabsV *= scaleToCube;\r\n\r\n\t\t// Apply scale to avoid seams\r\n\r\n\t\t// two texels less per square (one texel will do for NEAREST)\r\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\r\n\r\n\t\t// Unwrap\r\n\r\n\t\t// space: -1 ... 1 range for each square\r\n\t\t//\r\n\t\t// #X##\t\tdim    := ( 4 , 2 )\r\n\t\t//  # #\t\tcenter := ( 1 , 1 )\r\n\r\n\t\tvec2 planar = v.xy;\r\n\r\n\t\tfloat almostATexel = 1.5 * texelSizeY;\r\n\t\tfloat almostOne = 1.0 - almostATexel;\r\n\r\n\t\tif ( absV.z >= almostOne ) {\r\n\r\n\t\t\tif ( v.z > 0.0 )\r\n\t\t\t\tplanar.x = 4.0 - v.x;\r\n\r\n\t\t} else if ( absV.x >= almostOne ) {\r\n\r\n\t\t\tfloat signX = sign( v.x );\r\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\r\n\r\n\t\t} else if ( absV.y >= almostOne ) {\r\n\r\n\t\t\tfloat signY = sign( v.y );\r\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\r\n\t\t\tplanar.y = v.z * signY - 2.0;\r\n\r\n\t\t}\r\n\r\n\t\t// Transform to UV space\r\n\r\n\t\t// scale := 0.5 / dim\r\n\t\t// translate := ( center + 0.5 ) / dim\r\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\r\n\r\n\t}\r\n\r\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\r\n\r\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\r\n\r\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\r\n\t\t// the vector from the light to the world-space position of the fragment.\r\n\t\tvec3 lightToPosition = shadowCoord.xyz;\r\n\r\n\t\t// dp = normalized distance from light to fragment position\r\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\r\n\t\tdp += shadowBias;\r\n\r\n\t\t// bd3D = base direction 3D\r\n\t\tvec3 bd3D = normalize( lightToPosition );\r\n\r\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\r\n\r\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\r\n\r\n\t\t\treturn (\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\r\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\r\n\t\t\t) * ( 1.0 / 9.0 );\r\n\r\n\t\t#else // no percentage-closer filtering\r\n\r\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\r\n\r\n\t\t#endif\r\n\r\n\t}\r\n\r\n#endif\r\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\r\n\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\r\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\r\n\t#endif\r\n\r\n\t#if NUM_SPOT_LIGHTS > 0\r\n\r\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\r\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\r\n\r\n\t#endif\r\n\r\n\t#if NUM_POINT_LIGHTS > 0\r\n\r\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\r\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\r\n\r\n\t#endif\r\n\r\n\r\n\r\n#endif\r\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\r\n\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n\r\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\r\n\r\n\t}\r\n\r\n\t#endif\r\n\r\n\t#if NUM_SPOT_LIGHTS > 0\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\r\n\r\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\r\n\r\n\t}\r\n\r\n\t#endif\r\n\r\n\t#if NUM_POINT_LIGHTS > 0\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\r\n\r\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\r\n\r\n\t}\r\n\r\n\t#endif\r\n\r\n\r\n\r\n#endif\r\n",shadowmask_pars_fragment:"float getShadowMask() {\r\n\r\n\tfloat shadow = 1.0;\r\n\r\n\t#ifdef USE_SHADOWMAP\r\n\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\r\n\tDirectionalLight directionalLight;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n\r\n\t\tdirectionalLight = directionalLights[ i ];\r\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\r\n\r\n\t}\r\n\r\n\t#endif\r\n\r\n\t#if NUM_SPOT_LIGHTS > 0\r\n\r\n\tSpotLight spotLight;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\r\n\r\n\t\tspotLight = spotLights[ i ];\r\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\r\n\r\n\t}\r\n\r\n\t#endif\r\n\r\n\t#if NUM_POINT_LIGHTS > 0\r\n\r\n\tPointLight pointLight;\r\n\r\n\t#pragma unroll_loop\r\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\r\n\r\n\t\tpointLight = pointLights[ i ];\r\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\r\n\r\n\t}\r\n\r\n\t#endif\r\n\r\n\r\n\r\n\t#endif\r\n\r\n\treturn shadow;\r\n\r\n}\r\n",skinbase_vertex:"#ifdef USE_SKINNING\r\n\r\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\r\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\r\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\r\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\r\n\r\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\r\n\r\n\tuniform mat4 bindMatrix;\r\n\tuniform mat4 bindMatrixInverse;\r\n\r\n\t#ifdef BONE_TEXTURE\r\n\r\n\t\tuniform sampler2D boneTexture;\r\n\t\tuniform int boneTextureSize;\r\n\r\n\t\tmat4 getBoneMatrix( const in float i ) {\r\n\r\n\t\t\tfloat j = i * 4.0;\r\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\r\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\r\n\r\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\r\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\r\n\r\n\t\t\ty = dy * ( y + 0.5 );\r\n\r\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\r\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\r\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\r\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\r\n\r\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\r\n\r\n\t\t\treturn bone;\r\n\r\n\t\t}\r\n\r\n\t#else\r\n\r\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\r\n\r\n\t\tmat4 getBoneMatrix( const in float i ) {\r\n\r\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\r\n\t\t\treturn bone;\r\n\r\n\t\t}\r\n\r\n\t#endif\r\n\r\n#endif\r\n",skinning_vertex:"#ifdef USE_SKINNING\r\n\r\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\r\n\r\n\tvec4 skinned = vec4( 0.0 );\r\n\tskinned += boneMatX * skinVertex * skinWeight.x;\r\n\tskinned += boneMatY * skinVertex * skinWeight.y;\r\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\r\n\tskinned += boneMatW * skinVertex * skinWeight.w;\r\n\r\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\r\n\r\n#endif\r\n",skinnormal_vertex:"#ifdef USE_SKINNING\r\n\r\n\tmat4 skinMatrix = mat4( 0.0 );\r\n\tskinMatrix += skinWeight.x * boneMatX;\r\n\tskinMatrix += skinWeight.y * boneMatY;\r\n\tskinMatrix += skinWeight.z * boneMatZ;\r\n\tskinMatrix += skinWeight.w * boneMatW;\r\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\r\n\r\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\r\n\r\n#endif\r\n",specularmap_fragment:"float specularStrength;\r\n\r\n#ifdef USE_SPECULARMAP\r\n\r\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\r\n\tspecularStrength = texelSpecular.r;\r\n\r\n#else\r\n\r\n\tspecularStrength = 1.0;\r\n\r\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\r\n\r\n\tuniform sampler2D specularMap;\r\n\r\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\r\n\r\n  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\r\n\r\n#endif\r\n",tonemapping_pars_fragment:"#ifndef saturate\r\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\r\n#endif\r\n\r\nuniform float toneMappingExposure;\r\nuniform float toneMappingWhitePoint;\r\n\r\n// exposure only\r\nvec3 LinearToneMapping( vec3 color ) {\r\n\r\n\treturn toneMappingExposure * color;\r\n\r\n}\r\n\r\n// source: https://www.cs.utah.edu/~reinhard/cdrom/\r\nvec3 ReinhardToneMapping( vec3 color ) {\r\n\r\n\tcolor *= toneMappingExposure;\r\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\r\n\r\n}\r\n\r\n// source: http://filmicgames.com/archives/75\r\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\r\nvec3 Uncharted2ToneMapping( vec3 color ) {\r\n\r\n\t// John Hable's filmic operator from Uncharted 2 video game\r\n\tcolor *= toneMappingExposure;\r\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\r\n\r\n}\r\n\r\n// source: http://filmicgames.com/archives/75\r\nvec3 OptimizedCineonToneMapping( vec3 color ) {\r\n\r\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\r\n\tcolor *= toneMappingExposure;\r\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\r\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\r\n\r\n}\r\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\r\n\r\n\tvarying vec2 vUv;\r\n\r\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\r\n\r\n\tvarying vec2 vUv;\r\n\tuniform mat3 uvTransform;\r\n\r\n#endif\r\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\r\n\r\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\r\n\r\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\r\n\r\n\tvarying vec2 vUv2;\r\n\r\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\r\n\r\n\tattribute vec2 uv2;\r\n\tvarying vec2 vUv2;\r\n\r\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\r\n\r\n\tvUv2 = uv2;\r\n\r\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\r\n\r\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\r\n\r\n#endif\r\n",cube_frag:"uniform samplerCube tCube;\r\nuniform float tFlip;\r\nuniform float opacity;\r\n\r\nvarying vec3 vWorldPosition;\r\n\r\nvoid main() {\r\n\r\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\r\n\tgl_FragColor.a *= opacity;\r\n\r\n}\r\n",cube_vert:"varying vec3 vWorldPosition;\r\n\r\n#include <common>\r\n\r\nvoid main() {\r\n\r\n\tvWorldPosition = transformDirection( position, modelMatrix );\r\n\r\n\t#include <begin_vertex>\r\n\t#include <project_vertex>\r\n\r\n\tgl_Position.z = gl_Position.w; // set z to camera.far\r\n\r\n}\r\n",depth_frag:"#if DEPTH_PACKING == 3200\r\n\r\n\tuniform float opacity;\r\n\r\n#endif\r\n\r\n#include <common>\r\n#include <packing>\r\n#include <uv_pars_fragment>\r\n#include <map_pars_fragment>\r\n#include <alphamap_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec4 diffuseColor = vec4( 1.0 );\r\n\r\n\t#if DEPTH_PACKING == 3200\r\n\r\n\t\tdiffuseColor.a = opacity;\r\n\r\n\t#endif\r\n\r\n\t#include <map_fragment>\r\n\t#include <alphamap_fragment>\r\n\t#include <alphatest_fragment>\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\r\n\t#if DEPTH_PACKING == 3200\r\n\r\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\r\n\r\n\t#elif DEPTH_PACKING == 3201\r\n\r\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\r\n\r\n\t#endif\r\n\r\n}\r\n",depth_vert:"#include <common>\r\n#include <uv_pars_vertex>\r\n#include <displacementmap_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\r\n\t#include <skinbase_vertex>\r\n\r\n\t#ifdef USE_DISPLACEMENTMAP\r\n\r\n\t\t#include <beginnormal_vertex>\r\n\t\t#include <morphnormal_vertex>\r\n\t\t#include <skinnormal_vertex>\r\n\r\n\t#endif\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <displacementmap_vertex>\r\n\t#include <project_vertex>\r\n\t#include <logdepthbuf_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\r\n}\r\n",distanceRGBA_frag:"#define DISTANCE\r\n\r\nuniform vec3 referencePosition;\r\nuniform float nearDistance;\r\nuniform float farDistance;\r\nvarying vec3 vWorldPosition;\r\n\r\n#include <common>\r\n#include <packing>\r\n#include <uv_pars_fragment>\r\n#include <map_pars_fragment>\r\n#include <alphamap_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main () {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec4 diffuseColor = vec4( 1.0 );\r\n\r\n\t#include <map_fragment>\r\n\t#include <alphamap_fragment>\r\n\t#include <alphatest_fragment>\r\n\r\n\tfloat dist = length( vWorldPosition - referencePosition );\r\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\r\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\r\n\r\n\tgl_FragColor = packDepthToRGBA( dist );\r\n\r\n}\r\n",distanceRGBA_vert:"#define DISTANCE\r\n\r\nvarying vec3 vWorldPosition;\r\n\r\n#include <common>\r\n#include <uv_pars_vertex>\r\n#include <displacementmap_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\r\n\t#include <skinbase_vertex>\r\n\r\n\t#ifdef USE_DISPLACEMENTMAP\r\n\r\n\t\t#include <beginnormal_vertex>\r\n\t\t#include <morphnormal_vertex>\r\n\t\t#include <skinnormal_vertex>\r\n\r\n\t#endif\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <displacementmap_vertex>\r\n\t#include <project_vertex>\r\n\t#include <worldpos_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\r\n\tvWorldPosition = worldPosition.xyz;\r\n\r\n}\r\n",equirect_frag:"uniform sampler2D tEquirect;\r\n\r\nvarying vec3 vWorldPosition;\r\n\r\n#include <common>\r\n\r\nvoid main() {\r\n\r\n\tvec3 direction = normalize( vWorldPosition );\r\n\r\n\tvec2 sampleUV;\r\n\r\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\r\n\r\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\r\n\r\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\r\n\r\n}\r\n",equirect_vert:"varying vec3 vWorldPosition;\r\n\r\n#include <common>\r\n\r\nvoid main() {\r\n\r\n\tvWorldPosition = transformDirection( position, modelMatrix );\r\n\r\n\t#include <begin_vertex>\r\n\t#include <project_vertex>\r\n\r\n}\r\n",linedashed_frag:"uniform vec3 diffuse;\r\nuniform float opacity;\r\n\r\nuniform float dashSize;\r\nuniform float totalSize;\r\n\r\nvarying float vLineDistance;\r\n\r\n#include <common>\r\n#include <color_pars_fragment>\r\n#include <fog_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\r\n\r\n\t\tdiscard;\r\n\r\n\t}\r\n\r\n\tvec3 outgoingLight = vec3( 0.0 );\r\n\tvec4 diffuseColor = vec4( diffuse, opacity );\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <color_fragment>\r\n\r\n\toutgoingLight = diffuseColor.rgb; // simple shader\r\n\r\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\r\n\r\n\t#include <premultiplied_alpha_fragment>\r\n\t#include <tonemapping_fragment>\r\n\t#include <encodings_fragment>\r\n\t#include <fog_fragment>\r\n\r\n}\r\n",linedashed_vert:"uniform float scale;\r\nattribute float lineDistance;\r\n\r\nvarying float vLineDistance;\r\n\r\n#include <common>\r\n#include <color_pars_vertex>\r\n#include <fog_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <color_vertex>\r\n\r\n\tvLineDistance = scale * lineDistance;\r\n\r\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\r\n\tgl_Position = projectionMatrix * mvPosition;\r\n\r\n\t#include <logdepthbuf_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n",meshbasic_frag:"uniform vec3 diffuse;\r\nuniform float opacity;\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n\tvarying vec3 vNormal;\r\n\r\n#endif\r\n\r\n#include <common>\r\n#include <color_pars_fragment>\r\n#include <uv_pars_fragment>\r\n#include <uv2_pars_fragment>\r\n#include <map_pars_fragment>\r\n#include <alphamap_pars_fragment>\r\n#include <aomap_pars_fragment>\r\n#include <lightmap_pars_fragment>\r\n#include <envmap_pars_fragment>\r\n#include <fog_pars_fragment>\r\n#include <specularmap_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec4 diffuseColor = vec4( diffuse, opacity );\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <map_fragment>\r\n\t#include <color_fragment>\r\n\t#include <alphamap_fragment>\r\n\t#include <alphatest_fragment>\r\n\t#include <specularmap_fragment>\r\n\r\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\r\n\r\n\t// accumulation (baked indirect lighting only)\r\n\t#ifdef USE_LIGHTMAP\r\n\r\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\r\n\r\n\t#else\r\n\r\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\r\n\r\n\t#endif\r\n\r\n\t// modulation\r\n\t#include <aomap_fragment>\r\n\r\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\r\n\r\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\r\n\r\n\t#include <envmap_fragment>\r\n\r\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\r\n\r\n\t#include <premultiplied_alpha_fragment>\r\n\t#include <tonemapping_fragment>\r\n\t#include <encodings_fragment>\r\n\t#include <fog_fragment>\r\n\r\n}\r\n",meshbasic_vert:"#include <common>\r\n#include <uv_pars_vertex>\r\n#include <uv2_pars_vertex>\r\n#include <envmap_pars_vertex>\r\n#include <color_pars_vertex>\r\n#include <fog_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\t#include <uv2_vertex>\r\n\t#include <color_vertex>\r\n\t#include <skinbase_vertex>\r\n\r\n\t#ifdef USE_ENVMAP\r\n\r\n\t#include <beginnormal_vertex>\r\n\t#include <morphnormal_vertex>\r\n\t#include <skinnormal_vertex>\r\n\t#include <defaultnormal_vertex>\r\n\r\n\t#endif\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <project_vertex>\r\n\t#include <logdepthbuf_vertex>\r\n\r\n\t#include <worldpos_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\t#include <envmap_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n",meshlambert_frag:"uniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform float opacity;\r\n\r\nvarying vec3 vLightFront;\r\n\r\n#ifdef DOUBLE_SIDED\r\n\r\n\tvarying vec3 vLightBack;\r\n\r\n#endif\r\n\r\n#include <common>\r\n#include <packing>\r\n#include <dithering_pars_fragment>\r\n#include <color_pars_fragment>\r\n#include <uv_pars_fragment>\r\n#include <uv2_pars_fragment>\r\n#include <map_pars_fragment>\r\n#include <alphamap_pars_fragment>\r\n#include <aomap_pars_fragment>\r\n#include <lightmap_pars_fragment>\r\n#include <emissivemap_pars_fragment>\r\n#include <envmap_pars_fragment>\r\n#include <bsdfs>\r\n#include <lights_pars_begin>\r\n#include <fog_pars_fragment>\r\n#include <shadowmap_pars_fragment>\r\n#include <shadowmask_pars_fragment>\r\n#include <specularmap_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec4 diffuseColor = vec4( diffuse, opacity );\r\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\r\n\tvec3 totalEmissiveRadiance = emissive;\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <map_fragment>\r\n\t#include <color_fragment>\r\n\t#include <alphamap_fragment>\r\n\t#include <alphatest_fragment>\r\n\t#include <specularmap_fragment>\r\n\t#include <emissivemap_fragment>\r\n\r\n\t// accumulation\r\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\r\n\r\n\t#include <lightmap_fragment>\r\n\r\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\r\n\r\n\t#ifdef DOUBLE_SIDED\r\n\r\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\r\n\r\n\t#else\r\n\r\n\t\treflectedLight.directDiffuse = vLightFront;\r\n\r\n\t#endif\r\n\r\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\r\n\r\n\t// modulation\r\n\t#include <aomap_fragment>\r\n\r\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\r\n\r\n\t#include <envmap_fragment>\r\n\r\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\r\n\r\n\t#include <tonemapping_fragment>\r\n\t#include <encodings_fragment>\r\n\t#include <fog_fragment>\r\n\t#include <premultiplied_alpha_fragment>\r\n\t#include <dithering_fragment>\r\n\r\n}\r\n",meshlambert_vert:"#define LAMBERT\r\n\r\nvarying vec3 vLightFront;\r\n\r\n#ifdef DOUBLE_SIDED\r\n\r\n\tvarying vec3 vLightBack;\r\n\r\n#endif\r\n\r\n#include <common>\r\n#include <uv_pars_vertex>\r\n#include <uv2_pars_vertex>\r\n#include <envmap_pars_vertex>\r\n#include <bsdfs>\r\n#include <lights_pars_begin>\r\n#include <color_pars_vertex>\r\n#include <fog_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <shadowmap_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\t#include <uv2_vertex>\r\n\t#include <color_vertex>\r\n\r\n\t#include <beginnormal_vertex>\r\n\t#include <morphnormal_vertex>\r\n\t#include <skinbase_vertex>\r\n\t#include <skinnormal_vertex>\r\n\t#include <defaultnormal_vertex>\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <project_vertex>\r\n\t#include <logdepthbuf_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\r\n\t#include <worldpos_vertex>\r\n\t#include <envmap_vertex>\r\n\t#include <lights_lambert_vertex>\r\n\t#include <shadowmap_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n",meshphong_frag:"#define PHONG\r\n\r\nuniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform vec3 specular;\r\nuniform float shininess;\r\nuniform float opacity;\r\n\r\n#include <common>\r\n#include <packing>\r\n#include <dithering_pars_fragment>\r\n#include <color_pars_fragment>\r\n#include <uv_pars_fragment>\r\n#include <uv2_pars_fragment>\r\n#include <map_pars_fragment>\r\n#include <alphamap_pars_fragment>\r\n#include <aomap_pars_fragment>\r\n#include <lightmap_pars_fragment>\r\n#include <emissivemap_pars_fragment>\r\n#include <envmap_pars_fragment>\r\n#include <gradientmap_pars_fragment>\r\n#include <fog_pars_fragment>\r\n#include <bsdfs>\r\n#include <lights_pars_begin>\r\n#include <lights_phong_pars_fragment>\r\n#include <shadowmap_pars_fragment>\r\n#include <bumpmap_pars_fragment>\r\n#include <normalmap_pars_fragment>\r\n#include <specularmap_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec4 diffuseColor = vec4( diffuse, opacity );\r\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\r\n\tvec3 totalEmissiveRadiance = emissive;\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <map_fragment>\r\n\t#include <color_fragment>\r\n\t#include <alphamap_fragment>\r\n\t#include <alphatest_fragment>\r\n\t#include <specularmap_fragment>\r\n\t#include <normal_fragment_begin>\r\n\t#include <normal_fragment_maps>\r\n\t#include <emissivemap_fragment>\r\n\r\n\t// accumulation\r\n\t#include <lights_phong_fragment>\r\n\t#include <lights_fragment_begin>\r\n\t#include <lights_fragment_maps>\r\n\t#include <lights_fragment_end>\r\n\r\n\t// modulation\r\n\t#include <aomap_fragment>\r\n\r\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\r\n\r\n\t#include <envmap_fragment>\r\n\r\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\r\n\r\n\t#include <tonemapping_fragment>\r\n\t#include <encodings_fragment>\r\n\t#include <fog_fragment>\r\n\t#include <premultiplied_alpha_fragment>\r\n\t#include <dithering_fragment>\r\n\r\n}\r\n",meshphong_vert:"#define PHONG\r\n\r\nvarying vec3 vViewPosition;\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n\tvarying vec3 vNormal;\r\n\r\n#endif\r\n\r\n#include <common>\r\n#include <uv_pars_vertex>\r\n#include <uv2_pars_vertex>\r\n#include <displacementmap_pars_vertex>\r\n#include <envmap_pars_vertex>\r\n#include <color_pars_vertex>\r\n#include <fog_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <shadowmap_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\t#include <uv2_vertex>\r\n\t#include <color_vertex>\r\n\r\n\t#include <beginnormal_vertex>\r\n\t#include <morphnormal_vertex>\r\n\t#include <skinbase_vertex>\r\n\t#include <skinnormal_vertex>\r\n\t#include <defaultnormal_vertex>\r\n\r\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\r\n\r\n\tvNormal = normalize( transformedNormal );\r\n\r\n#endif\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <displacementmap_vertex>\r\n\t#include <project_vertex>\r\n\t#include <logdepthbuf_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\r\n\tvViewPosition = - mvPosition.xyz;\r\n\r\n\t#include <worldpos_vertex>\r\n\t#include <envmap_vertex>\r\n\t#include <shadowmap_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n",meshphysical_frag:"#define PHYSICAL\r\n\r\nuniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform float roughness;\r\nuniform float metalness;\r\nuniform float opacity;\r\n\r\n#ifndef STANDARD\r\n\tuniform float clearCoat;\r\n\tuniform float clearCoatRoughness;\r\n#endif\r\n\r\nvarying vec3 vViewPosition;\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n\tvarying vec3 vNormal;\r\n\r\n#endif\r\n\r\n#include <common>\r\n#include <packing>\r\n#include <dithering_pars_fragment>\r\n#include <color_pars_fragment>\r\n#include <uv_pars_fragment>\r\n#include <uv2_pars_fragment>\r\n#include <map_pars_fragment>\r\n#include <alphamap_pars_fragment>\r\n#include <aomap_pars_fragment>\r\n#include <lightmap_pars_fragment>\r\n#include <emissivemap_pars_fragment>\r\n#include <bsdfs>\r\n#include <cube_uv_reflection_fragment>\r\n#include <envmap_pars_fragment>\r\n#include <envmap_physical_pars_fragment>\r\n#include <fog_pars_fragment>\r\n#include <lights_pars_begin>\r\n#include <lights_physical_pars_fragment>\r\n#include <shadowmap_pars_fragment>\r\n#include <bumpmap_pars_fragment>\r\n#include <normalmap_pars_fragment>\r\n#include <roughnessmap_pars_fragment>\r\n#include <metalnessmap_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec4 diffuseColor = vec4( diffuse, opacity );\r\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\r\n\tvec3 totalEmissiveRadiance = emissive;\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <map_fragment>\r\n\t#include <color_fragment>\r\n\t#include <alphamap_fragment>\r\n\t#include <alphatest_fragment>\r\n\t#include <roughnessmap_fragment>\r\n\t#include <metalnessmap_fragment>\r\n\t#include <normal_fragment_begin>\r\n\t#include <normal_fragment_maps>\r\n\t#include <emissivemap_fragment>\r\n\r\n\t// accumulation\r\n\t#include <lights_physical_fragment>\r\n\t#include <lights_fragment_begin>\r\n\t#include <lights_fragment_maps>\r\n\t#include <lights_fragment_end>\r\n\r\n\t// modulation\r\n\t#include <aomap_fragment>\r\n\r\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\r\n\r\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\r\n\r\n\t#include <tonemapping_fragment>\r\n\t#include <encodings_fragment>\r\n\t#include <fog_fragment>\r\n\t#include <premultiplied_alpha_fragment>\r\n\t#include <dithering_fragment>\r\n\r\n}\r\n",meshphysical_vert:"#define PHYSICAL\r\n\r\nvarying vec3 vViewPosition;\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n\tvarying vec3 vNormal;\r\n\r\n#endif\r\n\r\n#include <common>\r\n#include <uv_pars_vertex>\r\n#include <uv2_pars_vertex>\r\n#include <displacementmap_pars_vertex>\r\n#include <color_pars_vertex>\r\n#include <fog_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <shadowmap_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\t#include <uv2_vertex>\r\n\t#include <color_vertex>\r\n\r\n\t#include <beginnormal_vertex>\r\n\t#include <morphnormal_vertex>\r\n\t#include <skinbase_vertex>\r\n\t#include <skinnormal_vertex>\r\n\t#include <defaultnormal_vertex>\r\n\r\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\r\n\r\n\tvNormal = normalize( transformedNormal );\r\n\r\n#endif\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <displacementmap_vertex>\r\n\t#include <project_vertex>\r\n\t#include <logdepthbuf_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\r\n\tvViewPosition = - mvPosition.xyz;\r\n\r\n\t#include <worldpos_vertex>\r\n\t#include <shadowmap_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n",normal_frag:"#define NORMAL\r\n\r\nuniform float opacity;\r\n\r\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\r\n\r\n\tvarying vec3 vViewPosition;\r\n\r\n#endif\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n\tvarying vec3 vNormal;\r\n\r\n#endif\r\n\r\n#include <packing>\r\n#include <uv_pars_fragment>\r\n#include <bumpmap_pars_fragment>\r\n#include <normalmap_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <normal_fragment_begin>\r\n\t#include <normal_fragment_maps>\r\n\r\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\r\n\r\n}\r\n",normal_vert:"#define NORMAL\r\n\r\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\r\n\r\n\tvarying vec3 vViewPosition;\r\n\r\n#endif\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n\tvarying vec3 vNormal;\r\n\r\n#endif\r\n\r\n#include <uv_pars_vertex>\r\n#include <displacementmap_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <skinning_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\r\n\t#include <beginnormal_vertex>\r\n\t#include <morphnormal_vertex>\r\n\t#include <skinbase_vertex>\r\n\t#include <skinnormal_vertex>\r\n\t#include <defaultnormal_vertex>\r\n\r\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\r\n\r\n\tvNormal = normalize( transformedNormal );\r\n\r\n#endif\r\n\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <skinning_vertex>\r\n\t#include <displacementmap_vertex>\r\n\t#include <project_vertex>\r\n\t#include <logdepthbuf_vertex>\r\n\r\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\r\n\r\n\tvViewPosition = - mvPosition.xyz;\r\n\r\n#endif\r\n\r\n}\r\n",points_frag:"uniform vec3 diffuse;\r\nuniform float opacity;\r\n\r\n#include <common>\r\n#include <color_pars_fragment>\r\n#include <map_particle_pars_fragment>\r\n#include <fog_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec3 outgoingLight = vec3( 0.0 );\r\n\tvec4 diffuseColor = vec4( diffuse, opacity );\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <map_particle_fragment>\r\n\t#include <color_fragment>\r\n\t#include <alphatest_fragment>\r\n\r\n\toutgoingLight = diffuseColor.rgb;\r\n\r\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\r\n\r\n\t#include <premultiplied_alpha_fragment>\r\n\t#include <tonemapping_fragment>\r\n\t#include <encodings_fragment>\r\n\t#include <fog_fragment>\r\n\r\n}\r\n",points_vert:"uniform float size;\r\nuniform float scale;\r\n\r\n#include <common>\r\n#include <color_pars_vertex>\r\n#include <fog_pars_vertex>\r\n#include <morphtarget_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <color_vertex>\r\n\t#include <begin_vertex>\r\n\t#include <morphtarget_vertex>\r\n\t#include <project_vertex>\r\n\r\n\t#ifdef USE_SIZEATTENUATION\r\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\r\n\t#else\r\n\t\tgl_PointSize = size;\r\n\t#endif\r\n\r\n\t#include <logdepthbuf_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\t#include <worldpos_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n",shadow_frag:"uniform vec3 color;\r\nuniform float opacity;\r\n\r\n#include <common>\r\n#include <packing>\r\n#include <fog_pars_fragment>\r\n#include <bsdfs>\r\n#include <lights_pars_begin>\r\n#include <shadowmap_pars_fragment>\r\n#include <shadowmask_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\r\n\r\n\t#include <fog_fragment>\r\n\r\n}\r\n",shadow_vert:"#include <fog_pars_vertex>\r\n#include <shadowmap_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <begin_vertex>\r\n\t#include <project_vertex>\r\n\t#include <worldpos_vertex>\r\n\t#include <shadowmap_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n",sprite_frag:"uniform vec3 diffuse;\r\nuniform float opacity;\r\n\r\n#include <common>\r\n#include <uv_pars_fragment>\r\n#include <map_pars_fragment>\r\n#include <fog_pars_fragment>\r\n#include <logdepthbuf_pars_fragment>\r\n#include <clipping_planes_pars_fragment>\r\n\r\nvoid main() {\r\n\r\n\t#include <clipping_planes_fragment>\r\n\r\n\tvec3 outgoingLight = vec3( 0.0 );\r\n\tvec4 diffuseColor = vec4( diffuse, opacity );\r\n\r\n\t#include <logdepthbuf_fragment>\r\n\t#include <map_fragment>\r\n\t#include <alphatest_fragment>\r\n\r\n\toutgoingLight = diffuseColor.rgb;\r\n\r\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\r\n\r\n\t#include <tonemapping_fragment>\r\n\t#include <encodings_fragment>\r\n\t#include <fog_fragment>\r\n\r\n}\r\n",sprite_vert:"uniform float rotation;\r\nuniform vec2 center;\r\n\r\n#include <common>\r\n#include <uv_pars_vertex>\r\n#include <fog_pars_vertex>\r\n#include <logdepthbuf_pars_vertex>\r\n#include <clipping_planes_pars_vertex>\r\n\r\nvoid main() {\r\n\r\n\t#include <uv_vertex>\r\n\r\n\tvec2 scale;\r\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\r\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\r\n\r\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\r\n\r\n\tvec2 rotatedPosition;\r\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\r\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\r\n\r\n\tvec4 mvPosition;\r\n\r\n\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\r\n\tmvPosition.xy += rotatedPosition;\r\n\r\n\tgl_Position = projectionMatrix * mvPosition;\r\n\r\n\t#include <logdepthbuf_vertex>\r\n\t#include <clipping_planes_vertex>\r\n\t#include <fog_vertex>\r\n\r\n}\r\n"},Mr={merge:function(t){for(var e={},r=0;r<t.length;r++){var n=this.clone(t[r]);for(var i in n)e[i]=n[i]}return e},clone:function(t){var e={};for(var r in t)for(var n in e[r]={},t[r]){var i=t[r][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?e[r][n]=i.clone():Array.isArray(i)?e[r][n]=i.slice():e[r][n]=i}return e}},Er={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,rebeccapurple:6697881,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};function Tr(t,e,r){return void 0===e&&void 0===r?this.set(t):this.setRGB(t,e,r)}Object.assign(Tr.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function a(t,e,r){return r<0&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(t,e,r){if(t=He.euclideanModulo(t,1),e=He.clamp(e,0,1),r=He.clamp(r,0,1),0===e)this.r=this.g=this.b=r;else{var n=r<=.5?r*(1+e):r+e-r*e,i=2*r-n;this.r=a(i,n,t+1/3),this.g=a(i,n,t),this.b=a(i,n,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var n,i=r[1],a=r[2];switch(i){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(o,s,c)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){var h,l=(h=r[1]).length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}e&&0<e.length&&(void 0!==(h=Er[e])?this.setHex(h):console.warn("THREE.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=0<e?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(){function e(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.b),this}}(),copyLinearToSRGB:function(){function e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,r,n=this.r,i=this.g,a=this.b,o=Math.max(n,i,a),s=Math.min(n,i,a),c=(s+o)/2;if(s===o)r=e=0;else{var h=o-s;switch(r=c<=.5?h/(o+s):h/(2-o-s),o){case n:e=(i-a)/h+(i<a?6:0);break;case i:e=(a-n)/h+2;break;case a:e=(n-i)/h+4}e/=6}return t.h=e,t.s=r,t.l=c,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(wr={},function(t,e,r){return this.getHSL(wr),wr.h+=t,wr.s+=e,wr.l+=r,this.setHSL(wr.h,wr.s,wr.l),this}),add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Sr,Ar,Lr={common:{diffuse:{value:new Tr(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Xe},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Tr(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Tr(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new Xe}},sprite:{diffuse:{value:new Tr(15658734)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new Xe}}},Rr={basic:{uniforms:Mr.merge([Lr.common,Lr.specularmap,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.fog]),vertexShader:_r.meshbasic_vert,fragmentShader:_r.meshbasic_frag},lambert:{uniforms:Mr.merge([Lr.common,Lr.specularmap,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.emissivemap,Lr.fog,Lr.lights,{emissive:{value:new Tr(0)}}]),vertexShader:_r.meshlambert_vert,fragmentShader:_r.meshlambert_frag},phong:{uniforms:Mr.merge([Lr.common,Lr.specularmap,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.emissivemap,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,Lr.gradientmap,Lr.fog,Lr.lights,{emissive:{value:new Tr(0)},specular:{value:new Tr(1118481)},shininess:{value:30}}]),vertexShader:_r.meshphong_vert,fragmentShader:_r.meshphong_frag},standard:{uniforms:Mr.merge([Lr.common,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.emissivemap,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,Lr.roughnessmap,Lr.metalnessmap,Lr.fog,Lr.lights,{emissive:{value:new Tr(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:_r.meshphysical_vert,fragmentShader:_r.meshphysical_frag},points:{uniforms:Mr.merge([Lr.points,Lr.fog]),vertexShader:_r.points_vert,fragmentShader:_r.points_frag},dashed:{uniforms:Mr.merge([Lr.common,Lr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_r.linedashed_vert,fragmentShader:_r.linedashed_frag},depth:{uniforms:Mr.merge([Lr.common,Lr.displacementmap]),vertexShader:_r.depth_vert,fragmentShader:_r.depth_frag},normal:{uniforms:Mr.merge([Lr.common,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,{opacity:{value:1}}]),vertexShader:_r.normal_vert,fragmentShader:_r.normal_frag},sprite:{uniforms:Mr.merge([Lr.sprite,Lr.fog]),vertexShader:_r.sprite_vert,fragmentShader:_r.sprite_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_r.cube_vert,fragmentShader:_r.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_r.equirect_vert,fragmentShader:_r.equirect_frag},distanceRGBA:{uniforms:Mr.merge([Lr.common,Lr.displacementmap,{referencePosition:{value:new We},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_r.distanceRGBA_vert,fragmentShader:_r.distanceRGBA_frag},shadow:{uniforms:Mr.merge([Lr.lights,Lr.fog,{color:{value:new Tr(0)},opacity:{value:1}}]),vertexShader:_r.shadow_vert,fragmentShader:_r.shadow_frag}};function Pr(){var r=null,n=!1,i=null;function a(t,e){!1!==n&&(i(t,e),r.requestAnimationFrame(a))}return{start:function(){!0!==n&&null!==i&&(r.requestAnimationFrame(a),n=!0)},stop:function(){n=!1},setAnimationLoop:function(t){i=t},setContext:function(t){r=t}}}function Cr(c){var h=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),h.get(t)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var e=h.get(t);e&&(c.deleteBuffer(e.buffer),h.delete(t))},update:function(t,e){t.isInterleavedBufferAttribute&&(t=t.data);var r,n,i,a,o,s=h.get(t);void 0===s?h.set(t,function(t,e){var r=t.array,n=t.dynamic?c.DYNAMIC_DRAW:c.STATIC_DRAW,i=c.createBuffer();c.bindBuffer(e,i),c.bufferData(e,r,n),t.onUploadCallback();var a=c.FLOAT;return r instanceof Float32Array?a=c.FLOAT:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?a=c.UNSIGNED_SHORT:r instanceof Int16Array?a=c.SHORT:r instanceof Uint32Array?a=c.UNSIGNED_INT:r instanceof Int32Array?a=c.INT:r instanceof Int8Array?a=c.BYTE:r instanceof Uint8Array&&(a=c.UNSIGNED_BYTE),{buffer:i,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}(t,e)):s.version<t.version&&(r=s.buffer,i=e,a=(n=t).array,o=n.updateRange,c.bindBuffer(i,r),!1===n.dynamic?c.bufferData(i,a,c.STATIC_DRAW):-1===o.count?c.bufferSubData(i,0,a):0===o.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(c.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),s.version=t.version)}}}function Or(t,e,r,n){this._x=t||0,this._y=e||0,this._z=r||0,this._order=n||Or.DefaultOrder}function Ir(){this.mask=1}Rr.physical={uniforms:Mr.merge([Rr.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:_r.meshphysical_vert,fragmentShader:_r.meshphysical_frag},Or.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Or.DefaultOrder="XYZ",Object.defineProperties(Or.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(Or.prototype,{isEuler:!0,set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var n=He.clamp,i=t.elements,a=i[0],o=i[4],s=i[8],c=i[1],h=i[5],l=i[9],u=i[2],p=i[6],d=i[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:(Ar=new ke,function(t,e,r){return Ar.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ar,e,r)}),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(Sr=new je,function(t){return Sr.setFromEuler(this),this.setFromQuaternion(Sr,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new We(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(Ir.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Nr,Dr,Ur,Br,Fr,zr,Gr,Hr,Vr,kr,jr,Wr,Xr,qr,Yr,Jr,Zr,Qr,Kr=0;function $r(){Object.defineProperty(this,"id",{value:Kr++}),this.uuid=He.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=$r.DefaultUp.clone();var t=new We,e=new Or,r=new je,n=new We(1,1,1);e.onChange(function(){r.setFromEuler(e,!1)}),r.onChange(function(){e.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:n},modelViewMatrix:{value:new ke},normalMatrix:{value:new Xe}}),this.matrix=new ke,this.matrixWorld=new ke,this.matrixAutoUpdate=$r.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Ir,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function tn(){$r.call(this),this.type="Camera",this.matrixWorldInverse=new ke,this.projectionMatrix=new ke}function en(t,e,r,n,i,a){tn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=r,this.bottom=n,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function rn(t,e,r,n,i,a){this.a=t,this.b=e,this.c=r,this.normal=n&&n.isVector3?n:new We,this.vertexNormals=Array.isArray(n)?n:[],this.color=i&&i.isColor?i:new Tr,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}$r.DefaultUp=new We(0,1,0),$r.DefaultMatrixAutoUpdate=!0,$r.prototype=Object.assign(Object.create(e.prototype),{constructor:$r,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:(Zr=new je,function(t,e){return Zr.setFromAxisAngle(t,e),this.quaternion.multiply(Zr),this}),rotateOnWorldAxis:(Jr=new je,function(t,e){return Jr.setFromAxisAngle(t,e),this.quaternion.premultiply(Jr),this}),rotateX:(Yr=new We(1,0,0),function(t){return this.rotateOnAxis(Yr,t)}),rotateY:(qr=new We(0,1,0),function(t){return this.rotateOnAxis(qr,t)}),rotateZ:(Xr=new We(0,0,1),function(t){return this.rotateOnAxis(Xr,t)}),translateOnAxis:(Wr=new We,function(t,e){return Wr.copy(t).applyQuaternion(this.quaternion),this.position.add(Wr.multiplyScalar(e)),this}),translateX:(jr=new We(1,0,0),function(t){return this.translateOnAxis(jr,t)}),translateY:(kr=new We(0,1,0),function(t){return this.translateOnAxis(kr,t)}),translateZ:(Vr=new We(0,0,1),function(t){return this.translateOnAxis(Vr,t)}),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:(Hr=new ke,function(t){return t.applyMatrix4(Hr.getInverse(this.matrixWorld))}),lookAt:(zr=new ke,Gr=new We,function(t,e,r){t.isVector3?Gr.copy(t):Gr.set(t,e,r),this.isCamera?zr.lookAt(this.position,Gr,this.up):zr.lookAt(Gr,this.position,this.up),this.quaternion.setFromRotationMatrix(zr)}),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",t):t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this},remove:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var r=this.children.indexOf(t);return-1!==r&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(r,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r].getObjectByProperty(t,e);if(void 0!==i)return i}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new We),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(Br=new We,Fr=new We,function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new je),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Br,t,Fr),t}),getWorldScale:(Dr=new We,Ur=new je,function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new We),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Dr,Ur,t),t}),getWorldDirection:(Nr=new je,function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new We),this.getWorldQuaternion(Nr),t.set(0,0,1).applyQuaternion(Nr)}),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].updateMatrixWorld(t)},toJSON:function(r){var t=void 0===r||"string"==typeof r,e={};t&&(r={geometries:{},materials:{},textures:{},images:{},shapes:{}},e.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};function i(t,e){return void 0===t[e.uuid]&&(t[e.uuid]=e.toJSON(r)),e.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isMesh||this.isLine||this.isPoints){n.geometry=i(r.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var h=o[s];i(r.shapes,h)}else i(r.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var l=[];for(s=0,c=this.material.length;s<c;s++)l.push(i(r.materials,this.material[s]));n.material=l}else n.material=i(r.materials,this.material);if(0<this.children.length){n.children=[];for(s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(r).object)}if(t){var u=m(r.geometries),p=m(r.materials),d=m(r.textures),f=m(r.images);o=m(r.shapes);0<u.length&&(e.geometries=u),0<p.length&&(e.materials=p),0<d.length&&(e.textures=d),0<f.length&&(e.images=f),0<o.length&&(e.shapes=o)}return e.object=n,e;function m(t){var e=[];for(var r in t){var n=t[r];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++){var n=t.children[r];this.add(n.clone())}return this}}),tn.prototype=Object.assign(Object.create($r.prototype),{constructor:tn,isCamera:!0,copy:function(t,e){return $r.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:(Qr=new je,function(t){return void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new We),this.getWorldQuaternion(Qr),t.set(0,0,-1).applyQuaternion(Qr)}),updateMatrixWorld:function(t){$r.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),en.prototype=Object.assign(Object.create(tn.prototype),{constructor:en,isOrthographicCamera:!0,copy:function(t,e){return tn.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,r,n,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,i=r-t,a=r+t,o=n+e,s=n-e;if(null!==this.view&&this.view.enabled){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;a=(i+=l*(this.view.offsetX/c))+l*(this.view.width/c),s=(o-=u*(this.view.offsetY/h))-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far)},toJSON:function(t){var e=$r.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Object.assign(rn.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var nn,an,on,sn,cn,hn,ln,un=0;function pn(){Object.defineProperty(this,"id",{value:un+=2}),this.uuid=He.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function dn(t,e,r){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===r,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function fn(t,e,r){dn.call(this,new Int8Array(t),e,r)}function mn(t,e,r){dn.call(this,new Uint8Array(t),e,r)}function gn(t,e,r){dn.call(this,new Uint8ClampedArray(t),e,r)}function vn(t,e,r){dn.call(this,new Int16Array(t),e,r)}function yn(t,e,r){dn.call(this,new Uint16Array(t),e,r)}function xn(t,e,r){dn.call(this,new Int32Array(t),e,r)}function bn(t,e,r){dn.call(this,new Uint32Array(t),e,r)}function wn(t,e,r){dn.call(this,new Float32Array(t),e,r)}function _n(t,e,r){dn.call(this,new Float64Array(t),e,r)}function Mn(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function En(t){if(0===t.length)return-1/0;for(var e=t[0],r=1,n=t.length;r<n;++r)t[r]>e&&(e=t[r]);return e}pn.prototype=Object.assign(Object.create(e.prototype),{constructor:pn,isGeometry:!0,applyMatrix:function(t){for(var e=(new Xe).getNormalMatrix(t),r=0,n=this.vertices.length;r<n;r++){this.vertices[r].applyMatrix4(t)}for(r=0,n=this.faces.length;r<n;r++){var i=this.faces[r];i.normal.applyMatrix3(e).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:(ln=new ke,function(t){return ln.makeRotationX(t),this.applyMatrix(ln),this}),rotateY:(hn=new ke,function(t){return hn.makeRotationY(t),this.applyMatrix(hn),this}),rotateZ:(cn=new ke,function(t){return cn.makeRotationZ(t),this.applyMatrix(cn),this}),translate:(sn=new ke,function(t,e,r){return sn.makeTranslation(t,e,r),this.applyMatrix(sn),this}),scale:(on=new ke,function(t,e,r){return on.makeScale(t,e,r),this.applyMatrix(on),this}),lookAt:(an=new $r,function(t){an.lookAt(t),an.updateMatrix(),this.applyMatrix(an.matrix)}),fromBufferGeometry:function(t){var a=this,e=null!==t.index?t.index.array:void 0,r=t.attributes,n=r.position.array,o=void 0!==r.normal?r.normal.array:void 0,s=void 0!==r.color?r.color.array:void 0,c=void 0!==r.uv?r.uv.array:void 0,h=void 0!==r.uv2?r.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var l=[],u=[],p=[],i=0,d=0;i<n.length;i+=3,d+=2)a.vertices.push(new We(n[i],n[i+1],n[i+2])),void 0!==o&&l.push(new We(o[i],o[i+1],o[i+2])),void 0!==s&&a.colors.push(new Tr(s[i],s[i+1],s[i+2])),void 0!==c&&u.push(new Ve(c[d],c[d+1])),void 0!==h&&p.push(new Ve(h[d],h[d+1]));function f(t,e,r,n){var i=new rn(t,e,r,void 0!==o?[l[t].clone(),l[e].clone(),l[r].clone()]:[],void 0!==s?[a.colors[t].clone(),a.colors[e].clone(),a.colors[r].clone()]:[],n);a.faces.push(i),void 0!==c&&a.faceVertexUvs[0].push([u[t].clone(),u[e].clone(),u[r].clone()]),void 0!==h&&a.faceVertexUvs[1].push([p[t].clone(),p[e].clone(),p[r].clone()])}var m=t.groups;if(0<m.length)for(i=0;i<m.length;i++)for(var g=m[i],v=g.start,y=(d=v,v+g.count);d<y;d+=3)void 0!==e?f(e[d],e[d+1],e[d+2],g.materialIndex):f(d,d+1,d+2,g.materialIndex);else if(void 0!==e)for(i=0;i<e.length;i+=3)f(e[i],e[i+1],e[i+2]);else for(i=0;i<n.length/3;i+=3)f(i,i+1,i+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:(nn=new We,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(nn).negate(),this.translate(nn.x,nn.y,nn.z),this}),normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,r=0===e?1:1/e,n=new ke;return n.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new We,e=new We,r=0,n=this.faces.length;r<n;r++){var i=this.faces[r],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),i.normal.copy(t)}},computeVertexNormals:function(t){var e,r,n,i,a,o;for(void 0===t&&(t=!0),o=new Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)o[e]=new We;if(t){var s,c,h,l=new We,u=new We;for(n=0,i=this.faces.length;n<i;n++)a=this.faces[n],s=this.vertices[a.a],c=this.vertices[a.b],h=this.vertices[a.c],l.subVectors(h,c),u.subVectors(s,c),l.cross(u),o[a.a].add(l),o[a.b].add(l),o[a.c].add(l)}else for(this.computeFaceNormals(),n=0,i=this.faces.length;n<i;n++)o[(a=this.faces[n]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,r=this.vertices.length;e<r;e++)o[e].normalize();for(n=0,i=this.faces.length;n<i;n++){var p=(a=this.faces[n]).vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,r;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(r=this.faces[t]).vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,n,i;for(r=0,n=this.faces.length;r<n;r++)for((i=this.faces[r]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;t<e;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var a=new pn;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(r=0,n=this.faces.length;r<n;r++)c=new We,h={a:new We,b:new We,c:new We},o.push(c),s.push(h)}var c,h,l=this.morphNormals[t];for(a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),r=0,n=this.faces.length;r<n;r++)i=this.faces[r],c=l.faceNormals[r],h=l.vertexNormals[r],c.copy(i.normal),h.a.copy(i.vertexNormals[0]),h.b.copy(i.vertexNormals[1]),h.c.copy(i.vertexNormals[2])}for(r=0,n=this.faces.length;r<n;r++)(i=this.faces[r]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new sr),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new yr),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(t&&t.isGeometry){var n,i=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],l=t.faceVertexUvs[0],u=this.colors,p=t.colors;void 0===r&&(r=0),void 0!==e&&(n=(new Xe).getNormalMatrix(e));for(var d=0,f=o.length;d<f;d++){var m=o[d].clone();void 0!==e&&m.applyMatrix4(e),a.push(m)}for(d=0,f=p.length;d<f;d++)u.push(p[d].clone());for(d=0,f=c.length;d<f;d++){var g,v,y,x=c[d],b=x.vertexNormals,w=x.vertexColors;(g=new rn(x.a+i,x.b+i,x.c+i)).normal.copy(x.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var _=0,M=b.length;_<M;_++)v=b[_].clone(),void 0!==n&&v.applyMatrix3(n).normalize(),g.vertexNormals.push(v);g.color.copy(x.color);for(_=0,M=w.length;_<M;_++)y=w[_],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+r,s.push(g)}for(d=0,f=l.length;d<f;d++){var E=l[d],T=[];if(void 0!==E){for(_=0,M=E.length;_<M;_++)T.push(E[_].clone());h.push(T)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,r,n,i,a,o,s,c={},h=[],l=[],u=Math.pow(10,4);for(r=0,n=this.vertices.length;r<n;r++)t=this.vertices[r],void 0===c[e=Math.round(t.x*u)+"_"+Math.round(t.y*u)+"_"+Math.round(t.z*u)]?(c[e]=r,h.push(this.vertices[r]),l[r]=h.length-1):l[r]=l[c[e]];var p=[];for(r=0,n=this.faces.length;r<n;r++){(i=this.faces[r]).a=l[i.a],i.b=l[i.b],i.c=l[i.c],a=[i.a,i.b,i.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(r);break}}for(r=p.length-1;0<=r;r--){var f=p[r];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-h.length;return this.vertices=h,m},setFromPoints:function(t){this.vertices=[];for(var e=0,r=t.length;e<r;e++){var n=t[e];this.vertices.push(new We(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,r=0;r<e;r++)t[r]._id=r;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var n,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===e&&(n=[]),o&&o.length===e&&(i=[]);for(r=0;r<e;r++){var s=t[r]._id;n&&n.push(a[s]),i&&i.push(o[s])}n&&(this.faceVertexUvs[0]=n),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}for(var n=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];n.push(a.x,a.y,a.z)}var o=[],s=[],c={},h=[],l={},u=[],p={};for(i=0;i<this.faces.length;i++){var d=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=0<d.normal.length(),g=0<d.vertexNormals.length,v=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=0<d.vertexColors.length,x=0;if(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x,0,0),1,!0),2,!1),3,f),4,m),5,g),6,v),7,y),o.push(x),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var b=this.faceVertexUvs[0][i];o.push(S(b[0]),S(b[1]),S(b[2]))}if(m&&o.push(E(d.normal)),g){var w=d.vertexNormals;o.push(E(w[0]),E(w[1]),E(w[2]))}if(v&&o.push(T(d.color)),y){var _=d.vertexColors;o.push(T(_[0]),T(_[1]),T(_[2]))}}function M(t,e,r){return r?t|1<<e:t&~(1<<e)}function E(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]||(c[e]=s.length/3,s.push(t.x,t.y,t.z)),c[e]}function T(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==l[e]||(l[e]=h.length,h.push(t.getHex())),l[e]}function S(t){var e=t.x.toString()+t.y.toString();return void 0!==p[e]||(p[e]=u.length/2,u.push(t.x,t.y)),p[e]}return t.data={},t.data.vertices=n,t.data.normals=s,0<h.length&&(t.data.colors=h),0<u.length&&(t.data.uvs=[u]),t.data.faces=o,t},clone:function(){return(new pn).copy(this)},copy:function(t){var e,r,n,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,r=s.length;e<r;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,r=c.length;e<r;e++)this.colors.push(c[e].clone());var h=t.faces;for(e=0,r=h.length;e<r;e++)this.faces.push(h[e].clone());for(e=0,r=t.faceVertexUvs.length;e<r;e++){var l=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),n=0,i=l.length;n<i;n++){var u=l[n],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[e].push(p)}}var f=t.morphTargets;for(e=0,r=f.length;e<r;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],n=0,i=f[e].vertices.length;n<i;n++)m.vertices.push(f[e].vertices[n].clone());if(void 0!==f[e].normals)for(m.normals=[],n=0,i=f[e].normals.length;n<i;n++)m.normals.push(f[e].normals[n].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(e=0,r=g.length;e<r;e++){var v={};if(void 0!==g[e].vertexNormals)for(v.vertexNormals=[],n=0,i=g[e].vertexNormals.length;n<i;n++){var y=g[e].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[e].faceNormals)for(v.faceNormals=[],n=0,i=g[e].faceNormals.length;n<i;n++)v.faceNormals.push(g[e].faceNormals[n].clone());this.morphNormals.push(v)}var b=t.skinWeights;for(e=0,r=b.length;e<r;e++)this.skinWeights.push(b[e].clone());var w=t.skinIndices;for(e=0,r=w.length;e<r;e++)this.skinIndices.push(w[e].clone());var _=t.lineDistances;for(e=0,r=_.length;e<r;e++)this.lineDistances.push(_[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=t.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(dn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(dn.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.itemSize:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var n=0,i=this.itemSize;n<i;n++)this.array[t+n]=e.array[r+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new Tr),e[r++]=a.r,e[r++]=a.g,e[r++]=a.b}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new Ve),e[r++]=a.x,e[r++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new We),e[r++]=a.x,e[r++]=a.y,e[r++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new nr),e[r++]=a.x,e[r++]=a.y,e[r++]=a.z,e[r++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=n,this},setXYZW:function(t,e,r,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=n,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(fn.prototype=Object.create(dn.prototype)).constructor=fn,(mn.prototype=Object.create(dn.prototype)).constructor=mn,(gn.prototype=Object.create(dn.prototype)).constructor=gn,(vn.prototype=Object.create(dn.prototype)).constructor=vn,(yn.prototype=Object.create(dn.prototype)).constructor=yn,(xn.prototype=Object.create(dn.prototype)).constructor=xn,(bn.prototype=Object.create(dn.prototype)).constructor=bn,(wn.prototype=Object.create(dn.prototype)).constructor=wn,(_n.prototype=Object.create(dn.prototype)).constructor=_n,Object.assign(Mn.prototype,{computeGroups:function(t){for(var e,r=[],n=void 0,i=t.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,r.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,r.push(e)),this.groups=r},fromGeometry:function(t){var e,r=t.faces,n=t.vertices,i=t.faceVertexUvs,a=i[0]&&0<i[0].length,o=i[1]&&0<i[1].length,s=t.morphTargets,c=s.length;if(0<c){e=[];for(var h=0;h<c;h++)e[h]=[];this.morphTargets.position=e}var l,u=t.morphNormals,p=u.length;if(0<p){l=[];for(h=0;h<p;h++)l[h]=[];this.morphTargets.normal=l}var d=t.skinIndices,f=t.skinWeights,m=d.length===n.length,g=f.length===n.length;0<n.length&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(h=0;h<r.length;h++){var v=r[h];this.vertices.push(n[v.a],n[v.b],n[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b,w=v.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=v.color;this.colors.push(_,_,_)}if(!0===a)void 0!==(b=i[0][h])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new Ve,new Ve,new Ve));if(!0===o)void 0!==(b=i[1][h])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new Ve,new Ve,new Ve));for(var M=0;M<c;M++){var E=s[M].vertices;e[M].push(E[v.a],E[v.b],E[v.c])}for(M=0;M<p;M++){var T=u[M].vertexNormals[h];l[M].push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}});var Tn,Sn,An,Ln,Rn,Pn,Cn,On,In,Nn,Dn=1;function Un(){Object.defineProperty(this,"id",{value:Dn+=2}),this.uuid=He.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function Bn(t,e,r,n,i,a){pn.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new Fn(t,e,r,n,i,a)),this.mergeVertices()}function Fn(t,e,r,n,i,a){Un.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:a};var R=this;t=t||1,e=e||1,r=r||1,n=Math.floor(n)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var P=[],C=[],O=[],I=[],N=0,D=0;function o(t,e,r,n,i,a,o,s,c,h,l){var u,p,d=a/c,f=o/h,m=a/2,g=o/2,v=s/2,y=c+1,x=h+1,b=0,w=0,_=new We;for(p=0;p<x;p++){var M=p*f-g;for(u=0;u<y;u++){var E=u*d-m;_[t]=E*n,_[e]=M*i,_[r]=v,C.push(_.x,_.y,_.z),_[t]=0,_[e]=0,_[r]=0<s?1:-1,O.push(_.x,_.y,_.z),I.push(u/c),I.push(1-p/h),b+=1}}for(p=0;p<h;p++)for(u=0;u<c;u++){var T=N+u+y*p,S=N+u+y*(p+1),A=N+(u+1)+y*(p+1),L=N+(u+1)+y*p;P.push(T,S,L),P.push(S,A,L),w+=6}R.addGroup(D,w,l),D+=w,N+=b}o("z","y","x",-1,-1,r,e,t,a,i,0),o("z","y","x",1,-1,r,e,-t,a,i,1),o("x","z","y",1,1,t,r,e,n,a,2),o("x","z","y",1,-1,t,r,-e,n,a,3),o("x","y","z",1,-1,t,e,r,n,i,4),o("x","y","z",-1,-1,t,e,-r,n,i,5),this.setIndex(P),this.addAttribute("position",new wn(C,3)),this.addAttribute("normal",new wn(O,3)),this.addAttribute("uv",new wn(I,2))}function zn(t,e,r,n){pn.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new Gn(t,e,r,n)),this.mergeVertices()}function Gn(t,e,r,n){Un.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n};var i,a,o=(t=t||1)/2,s=(e=e||1)/2,c=Math.floor(r)||1,h=Math.floor(n)||1,l=c+1,u=h+1,p=t/c,d=e/h,f=[],m=[],g=[],v=[];for(a=0;a<u;a++){var y=a*d-s;for(i=0;i<l;i++){var x=i*p-o;m.push(x,-y,0),g.push(0,0,1),v.push(i/c),v.push(1-a/h)}}for(a=0;a<h;a++)for(i=0;i<c;i++){var b=i+l*a,w=i+l*(a+1),_=i+1+l*(a+1),M=i+1+l*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.addAttribute("position",new wn(m,3)),this.addAttribute("normal",new wn(g,3)),this.addAttribute("uv",new wn(v,2))}Un.prototype=Object.assign(Object.create(e.prototype),{constructor:Un,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(65535<En(t)?bn:yn)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?("index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)):this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new dn(e,arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var r=this.attributes.normal;void 0!==r&&((new Xe).getNormalMatrix(t).applyToBufferAttribute(r),r.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(Nn=new ke,function(t){return Nn.makeRotationX(t),this.applyMatrix(Nn),this}),rotateY:(In=new ke,function(t){return In.makeRotationY(t),this.applyMatrix(In),this}),rotateZ:(On=new ke,function(t){return On.makeRotationZ(t),this.applyMatrix(On),this}),translate:(Cn=new ke,function(t,e,r){return Cn.makeTranslation(t,e,r),this.applyMatrix(Cn),this}),scale:(Pn=new ke,function(t,e,r){return Pn.makeScale(t,e,r),this.applyMatrix(Pn),this}),lookAt:(Rn=new $r,function(t){Rn.lookAt(t),Rn.updateMatrix(),this.applyMatrix(Rn.matrix)}),center:(Ln=new We,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ln).negate(),this.translate(Ln.x,Ln.y,Ln.z),this}),setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var r=new wn(3*e.vertices.length,3),n=new wn(3*e.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new wn(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];e.push(i.x,i.y,i.z||0)}return this.addAttribute("position",new wn(e,3)),this},updateFromObject:function(t){var e,r=t.geometry;if(t.isMesh){var n=r.__directGeometry;if(!0===r.elementsNeedUpdate&&(n=void 0,r.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(r);n.verticesNeedUpdate=r.verticesNeedUpdate,n.normalsNeedUpdate=r.normalsNeedUpdate,n.colorsNeedUpdate=r.colorsNeedUpdate,n.uvsNeedUpdate=r.uvsNeedUpdate,n.groupsNeedUpdate=r.groupsNeedUpdate,r.verticesNeedUpdate=!1,r.normalsNeedUpdate=!1,r.colorsNeedUpdate=!1,r.uvsNeedUpdate=!1,r.groupsNeedUpdate=!1,r=n}return!0===r.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(r.vertices),e.needsUpdate=!0),r.verticesNeedUpdate=!1),!0===r.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(r.normals),e.needsUpdate=!0),r.normalsNeedUpdate=!1),!0===r.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(r.colors),e.needsUpdate=!0),r.colorsNeedUpdate=!1),r.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(r.uvs),e.needsUpdate=!0),r.uvsNeedUpdate=!1),r.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(r.lineDistances),e.needsUpdate=!0),r.lineDistancesNeedUpdate=!1),r.groupsNeedUpdate&&(r.computeGroups(t.geometry),this.groups=r.groups,r.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Mn).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new dn(e,3).copyVector3sArray(t.vertices)),0<t.normals.length){var r=new Float32Array(3*t.normals.length);this.addAttribute("normal",new dn(r,3).copyVector3sArray(t.normals))}if(0<t.colors.length){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new dn(n,3).copyColorsArray(t.colors))}if(0<t.uvs.length){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new dn(i,2).copyVector2sArray(t.uvs))}if(0<t.uvs2.length){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new dn(a,2).copyVector2sArray(t.uvs2))}for(var o in this.groups=t.groups,t.morphTargets){for(var s=[],c=t.morphTargets[o],h=0,l=c.length;h<l;h++){var u=c[h],p=new wn(3*u.length,3);s.push(p.copyVector3sArray(u))}this.morphAttributes[o]=s}if(0<t.skinIndices.length){var d=new wn(4*t.skinIndices.length,4);this.addAttribute("skinIndex",d.copyVector4sArray(t.skinIndices))}if(0<t.skinWeights.length){var f=new wn(4*t.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new sr);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:(Sn=new sr,An=new We,function(){null===this.boundingSphere&&(this.boundingSphere=new yr);var t=this.attributes.position;if(t){var e=this.boundingSphere.center;Sn.setFromBufferAttribute(t),Sn.getCenter(e);for(var r=0,n=0,i=t.count;n<i;n++)An.x=t.getX(n),An.y=t.getY(n),An.z=t.getZ(n),r=Math.max(r,e.distanceToSquared(An));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,r=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new dn(new Float32Array(n.length),3));else for(var i=e.normal.array,a=0,o=i.length;a<o;a++)i[a]=0;var s,c,h,l=e.normal.array,u=new We,p=new We,d=new We,f=new We,m=new We;if(t){var g=t.array;0===r.length&&this.addGroup(0,g.length);for(var v=0,y=r.length;v<y;++v){var x=r[v],b=x.start;for(a=b,o=b+x.count;a<o;a+=3)s=3*g[a+0],c=3*g[a+1],h=3*g[a+2],u.fromArray(n,s),p.fromArray(n,c),d.fromArray(n,h),f.subVectors(d,p),m.subVectors(u,p),f.cross(m),l[s]+=f.x,l[s+1]+=f.y,l[s+2]+=f.z,l[c]+=f.x,l[c+1]+=f.y,l[c+2]+=f.z,l[h]+=f.x,l[h+1]+=f.y,l[h+2]+=f.z}}else for(a=0,o=n.length;a<o;a+=9)u.fromArray(n,a),p.fromArray(n,a+3),d.fromArray(n,a+6),f.subVectors(d,p),m.subVectors(u,p),f.cross(m),l[a]=f.x,l[a+1]=f.y,l[a+2]=f.z,l[a+3]=f.x,l[a+4]=f.y,l[a+5]=f.z,l[a+6]=f.x,l[a+7]=f.y,l[a+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var r=this.attributes;for(var n in r)if(void 0!==t.attributes[n])for(var i=r[n].array,a=t.attributes[n],o=a.array,s=0,c=a.itemSize*e;s<o.length;s++,c++)i[c]=o[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:(Tn=new We,function(){for(var t=this.attributes.normal,e=0,r=t.count;e<r;e++)Tn.x=t.getX(e),Tn.y=t.getY(e),Tn.z=t.getZ(e),Tn.normalize(),t.setXYZ(e,Tn.x,Tn.y,Tn.z)}),toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Un,e=this.index.array,r=this.attributes;for(var n in r){for(var i=r[n],a=i.array,o=i.itemSize,s=new a.constructor(e.length*o),c=0,h=0,l=0,u=e.length;l<u;l++){c=e[l]*o;for(var p=0;p<o;p++)s[h++]=a[c++]}t.addAttribute(n,new dn(s,o))}var d=this.groups;for(l=0,u=d.length;l<u;l++){var f=d[l];t.addGroup(f.start,f.count,f.materialIndex)}return t},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),0<Object.keys(this.userData).length&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}t.data={attributes:{}};var n=this.index;if(null!==n){var i=Array.prototype.slice.call(n.array);t.data.index={type:n.array.constructor.name,array:i}}var a=this.attributes;for(var r in a){var o=a[r];i=Array.prototype.slice.call(o.array);t.data.attributes[r]={itemSize:o.itemSize,type:o.array.constructor.name,array:i,normalized:o.normalized}}var s=this.groups;0<s.length&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Un).copy(this)},copy:function(t){var e,r,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var c=[],h=s[e];for(r=0,n=h.length;r<n;r++)c.push(h[r].clone());this.morphAttributes[e]=c}var l=t.groups;for(r=0,n=l.length;r<n;r++){var u=l[r];this.addGroup(u.start,u.count,u.materialIndex)}var p=t.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=t.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(Bn.prototype=Object.create(pn.prototype)).constructor=Bn,(Fn.prototype=Object.create(Un.prototype)).constructor=Fn,(zn.prototype=Object.create(pn.prototype)).constructor=zn,(Gn.prototype=Object.create(Un.prototype)).constructor=Gn;var Hn,Vn,kn,jn,Wn,Xn,qn,Yn,Jn,Zn,Qn,Kn,$n,ti,ei,ri,ni,ii,ai,oi,si,ci,hi,li,ui=0;function pi(){Object.defineProperty(this,"id",{value:ui++}),this.uuid=He.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Z,this.side=D,this.flatShading=!1,this.vertexColors=E,this.opacity=1,this.transparent=!1,this.blendSrc=N,this.blendDst=U,this.blendEquation=rt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ot,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function di(t){pi.call(this),this.type="MeshBasicMaterial",this.color=new Tr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function fi(t){pi.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function mi(t,e){this.origin=void 0!==t?t:new We,this.direction=void 0!==e?e:new We}function gi(t,e,r){this.a=void 0!==t?t:new We,this.b=void 0!==e?e:new We,this.c=void 0!==r?r:new We}function vi(t,e){$r.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Un,this.material=void 0!==e?e:new di({color:16777215*Math.random()}),this.drawMode=Re,this.updateMorphTargets()}function yi(a,r,o,n){var s,c,h,l=new Tr(0),u=0;function p(t,e){r.buffers.color.setClear(t.r,t.g,t.b,e,n)}return{getClearColor:function(){return l},setClearColor:function(t,e){l.set(t),p(l,u=void 0!==e?e:1)},getClearAlpha:function(){return u},setClearAlpha:function(t){p(l,u=t)},render:function(t,e,r,n){var i=e.background;null===i?p(l,u):i&&i.isColor&&(p(i,1),n=!0),(a.autoClear||n)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil),i&&i.isCubeTexture?(void 0===h&&((h=new vi(new Fn(1,1,1),new fi({uniforms:Rr.cube.uniforms,vertexShader:Rr.cube.vertexShader,fragmentShader:Rr.cube.fragmentShader,side:Mt,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),h.geometry.removeAttribute("uv"),h.onBeforeRender=function(t,e,r){this.matrixWorld.copyPosition(r.matrixWorld)},o.update(h)),h.material.uniforms.tCube.value=i,t.push(h,h.geometry,h.material,0,null)):i&&i.isTexture&&(void 0===s&&(s=new en(-1,1,1,-1,0,1),c=new vi(new Gn(2,2),new di({depthTest:!1,depthWrite:!1,fog:!1})),o.update(c)),c.material.map=i,a.renderBufferDirect(s,null,c.geometry,c.material,c,null))}}}function xi(i,a,o,s){var c;this.setMode=function(t){c=t},this.render=function(t,e){i.drawArrays(c,t,e),o.update(e,c)},this.renderInstances=function(t,e,r){var n;if(s.isWebGL2)n=i;else if(null===(n=a.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");n[s.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](c,e,r,t.maxInstancedCount),o.update(r,c,t.maxInstancedCount)}}function bi(e,r,t){var n;function i(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,o=void 0!==t.precision?t.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===t.logarithmicDepthBuffer,h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),l=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),f=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=0<l,y=a||!!r.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==n)return n;var t=r.get("EXT_texture_filter_anisotropic");return n=null!==t?e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y}}function wi(){var l=this,u=null,p=0,d=!1,f=!1,m=new xr,g=new Xe,v={value:null,needsUpdate:!1};function y(){v.value!==u&&(v.value=u,v.needsUpdate=0<p),l.numPlanes=p,l.numIntersection=0}function x(t,e,r,n){var i=null!==t?t.length:0,a=null;if(0!==i){if(a=v.value,!0!==n||null===a){var o=r+4*i,s=e.matrixWorldInverse;g.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var c=0,h=r;c!==i;++c,h+=4)m.copy(t[c]).applyMatrix4(s,g),m.normal.toArray(a,h),a[h+3]=m.constant}v.value=a,v.needsUpdate=!0}return l.numPlanes=i,a}this.uniform=v,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,r){var n=0!==t.length||e||0!==p||d;return d=e,u=x(t,r,0),p=t.length,n},this.beginShadows=function(){f=!0,x(null)},this.endShadows=function(){f=!1,y()},this.setState=function(t,e,r,n,i,a){if(!d||null===t||0===t.length||f&&!r)f?x(null):y();else{var o=f?0:p,s=4*o,c=i.clippingState||null;v.value=c,c=x(t,n,s,a);for(var h=0;h!==s;++h)c[h]=u[h];i.clippingState=c,this.numIntersection=e?this.numPlanes:0,this.numPlanes+=o}}}function _i(r){var n={};return{get:function(t){if(void 0!==n[t])return n[t];var e;switch(t){case"WEBGL_depth_texture":e=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":e=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:e=r.getExtension(t)}return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),n[t]=e}}}function Mi(u,p,a){var o={},d={};function s(t){var e=t.target,r=o[e.id];for(var n in null!==r.index&&p.remove(r.index),r.attributes)p.remove(r.attributes[n]);e.removeEventListener("dispose",s),delete o[e.id];var i=d[r.id];i&&(p.remove(i),delete d[r.id]),a.memory.geometries--}return{get:function(t,e){var r=o[e.id];return r||(e.addEventListener("dispose",s),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Un).setFromObject(t)),r=e._bufferGeometry),o[e.id]=r,a.memory.geometries++,r)},update:function(t){var e=t.index,r=t.attributes;for(var n in null!==e&&p.update(e,u.ELEMENT_ARRAY_BUFFER),r)p.update(r[n],u.ARRAY_BUFFER);var i=t.morphAttributes;for(var n in i)for(var a=i[n],o=0,s=a.length;o<s;o++)p.update(a[o],u.ARRAY_BUFFER)},getWireframeAttribute:function(t){var e=d[t.id];if(e)return e;var r,n=[],i=t.index,a=t.attributes;if(null!==i)for(var o=0,s=(r=i.array).length;o<s;o+=3){var c=r[o+0],h=r[o+1],l=r[o+2];n.push(c,h,h,l,l,c)}else for(o=0,s=(r=a.position.array).length/3-1;o<s;o+=3)c=o+0,h=o+1,l=o+2,n.push(c,h,h,l,l,c);return e=new(65535<En(n)?bn:yn)(n,1),p.update(e,u.ELEMENT_ARRAY_BUFFER),d[t.id]=e}}}function Ei(i,a,o,s){var c,h,l;this.setMode=function(t){c=t},this.setIndex=function(t){h=t.type,l=t.bytesPerElement},this.render=function(t,e){i.drawElements(c,e,h,t*l),o.update(e,c)},this.renderInstances=function(t,e,r){var n;if(s.isWebGL2)n=i;else if(null===(n=a.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");n[s.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](c,r,h,e*l,t.maxInstancedCount),o.update(r,c,t.maxInstancedCount)}}function Ti(n){var i={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:i,programs:null,autoReset:!0,reset:function(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0},update:function(t,e,r){switch(r=r||1,i.calls++,e){case n.TRIANGLES:i.triangles+=r*(t/3);break;case n.TRIANGLE_STRIP:case n.TRIANGLE_FAN:i.triangles+=r*(t-2);break;case n.LINES:i.lines+=r*(t/2);break;case n.LINE_STRIP:i.lines+=r*(t-1);break;case n.LINE_LOOP:i.lines+=r*t;break;case n.POINTS:i.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",e)}}}}function Si(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Ai(d){var f={},m=new Float32Array(8);return{update:function(t,e,r,n){var i=t.morphTargetInfluences,a=i.length,o=f[e.id];if(void 0===o){o=[];for(var s=0;s<a;s++)o[s]=[s,0];f[e.id]=o}var c=r.morphTargets&&e.morphAttributes.position,h=r.morphNormals&&e.morphAttributes.normal;for(s=0;s<a;s++)0!==(l=o[s])[1]&&(c&&e.removeAttribute("morphTarget"+s),h&&e.removeAttribute("morphNormal"+s));for(s=0;s<a;s++)(l=o[s])[0]=s,l[1]=i[s];for(o.sort(Si),s=0;s<8;s++){var l;if(l=o[s]){var u=l[0],p=l[1];if(p){c&&e.addAttribute("morphTarget"+s,c[u]),h&&e.addAttribute("morphNormal"+s,h[u]),m[s]=p;continue}}m[s]=0}n.getUniforms().setValue(d,"morphTargetInfluences",m)}}}function Li(i,a){var o={};return{update:function(t){var e=a.render.frame,r=t.geometry,n=i.get(t,r);return o[n.id]!==e&&(r.isGeometry&&n.updateFromObject(t),i.update(n),o[n.id]=e),n},dispose:function(){o={}}}}function Ri(t,e,r,n,i,a,o,s,c,h){rr.call(this,t=void 0!==t?t:[],e=void 0!==e?e:gt,r,n,i,a,o,s,c,h),this.flipY=!1}pi.prototype=Object.assign(Object.create(e.prototype),{constructor:pi,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0!==r)if("shading"!==e){var n=this[e];void 0!==n?n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[e]="overdraw"===e?Number(r):r:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===r;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){var e=[];for(var r in t){var n=t[r];delete n.metadata,e.push(n)}return e}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearCoat&&(r.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(r.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(t).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Z&&(r.blending=this.blending),!0===this.flatShading&&(r.flatShading=this.flatShading),this.side!==D&&(r.side=this.side),this.vertexColors!==E&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,0!==this.rotation&&(r.rotation=this.rotation),1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),0<this.alphaTest&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),1<this.wireframeLinewidth&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(r.morphTargets=!0),!0===this.skinning&&(r.skinning=!0),!1===this.visible&&(r.visible=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),e){var i=n(t.textures),a=n(t.images);0<i.length&&(r.textures=i),0<a.length&&(r.images=a)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.materialShaderForHighlight=t.materialShaderForHighlight,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,r=null;if(null!==e){var n=e.length;r=new Array(n);for(var i=0;i!==n;++i)r[i]=e[i].clone()}return this.clippingPlanes=r,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((di.prototype=Object.create(pi.prototype)).constructor=di).prototype.isMeshBasicMaterial=!0,di.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},((fi.prototype=Object.create(pi.prototype)).constructor=fi).prototype.isShaderMaterial=!0,fi.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Mr.clone(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},fi.prototype.toJSON=function(t){var e=pi.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},Object.assign(mi.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new We),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:(Qn=new We,function(t){return this.origin.copy(this.at(t,Qn)),this}),closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new We),e.subVectors(t,this.origin);var r=e.dot(this.direction);return r<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:(Zn=new We,function(t){var e=Zn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Zn.copy(this.direction).multiplyScalar(e).add(this.origin),Zn.distanceToSquared(t))}),distanceSqToSegment:(qn=new We,Yn=new We,Jn=new We,function(t,e,r,n){qn.copy(t).add(e).multiplyScalar(.5),Yn.copy(e).sub(t).normalize(),Jn.copy(this.origin).sub(qn);var i,a,o,s,c=.5*t.distanceTo(e),h=-this.direction.dot(Yn),l=Jn.dot(this.direction),u=-Jn.dot(Yn),p=Jn.lengthSq(),d=Math.abs(1-h*h);if(0<d)if(a=h*l-u,s=c*d,0<=(i=h*u-l))if(-s<=a)if(a<=s){var f=1/d;o=(i*=f)*(i+h*(a*=f)+2*l)+a*(h*i+a+2*u)+p}else a=c,o=-(i=Math.max(0,-(h*a+l)))*i+a*(a+2*u)+p;else a=-c,o=-(i=Math.max(0,-(h*a+l)))*i+a*(a+2*u)+p;else a<=-s?o=-(i=Math.max(0,-(-h*c+l)))*i+(a=0<i?-c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p:a<=s?(i=0,o=(a=Math.min(Math.max(-c,-u),c))*(a+2*u)+p):o=-(i=Math.max(0,-(h*c+l)))*i+(a=0<i?c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p;else a=0<h?-c:c,o=-(i=Math.max(0,-(h*a+l)))*i+a*(a+2*u)+p;return r&&r.copy(this.direction).multiplyScalar(i).add(this.origin),n&&n.copy(Yn).multiplyScalar(a).add(qn),o}),intersectSphere:(Xn=new We,function(t,e){Xn.subVectors(t.center,this.origin);var r=Xn.dot(this.direction),n=Xn.dot(Xn)-r*r,i=t.radius*t.radius;if(i<n)return null;var a=Math.sqrt(i-n),o=r-a,s=r+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)}),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(t.normal)+t.constant)/e;return 0<=r?r:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var r,n,i,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return 0<=c?(r=(t.min.x-u.x)*c,n=(t.max.x-u.x)*c):(r=(t.max.x-u.x)*c,n=(t.min.x-u.x)*c),0<=h?(i=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(i=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),a<r||n<i?null:((r<i||r!=r)&&(r=i),(a<n||n!=n)&&(n=a),0<=l?(o=(t.min.z-u.z)*l,s=(t.max.z-u.z)*l):(o=(t.max.z-u.z)*l,s=(t.min.z-u.z)*l),s<r||n<o?null:((r<o||r!=r)&&(r=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(0<=r?r:n,e)))},intersectsBox:(Wn=new We,function(t){return null!==this.intersectBox(t,Wn)}),intersectTriangle:(Hn=new We,Vn=new We,kn=new We,jn=new We,function(t,e,r,n,i){Vn.subVectors(e,t),kn.subVectors(r,t),jn.crossVectors(Vn,kn);var a,o=this.direction.dot(jn);if(0<o){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Hn.subVectors(this.origin,t);var s=a*this.direction.dot(kn.crossVectors(Hn,kn));if(s<0)return null;var c=a*this.direction.dot(Vn.cross(Hn));if(c<0)return null;if(o<s+c)return null;var h=-a*Hn.dot(jn);return h<0?null:this.at(h/o,i)}),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(gi,{getNormal:(ri=new We,function(t,e,r,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new We),n.subVectors(r,e),ri.subVectors(t,e),n.cross(ri);var i=n.lengthSq();return 0<i?n.multiplyScalar(1/Math.sqrt(i)):n.set(0,0,0)}),getBarycoord:($n=new We,ti=new We,ei=new We,function(t,e,r,n,i){$n.subVectors(n,e),ti.subVectors(r,e),ei.subVectors(t,e);var a=$n.dot($n),o=$n.dot(ti),s=$n.dot(ei),c=ti.dot(ti),h=ti.dot(ei),l=a*c-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new We),0===l)return i.set(-2,-1,-1);var u=1/l,p=(c*s-o*h)*u,d=(a*h-o*s)*u;return i.set(1-p-d,d,p)}),containsPoint:(Kn=new We,function(t,e,r,n){return gi.getBarycoord(t,e,r,n,Kn),0<=Kn.x&&0<=Kn.y&&Kn.x+Kn.y<=1})}),Object.assign(gi.prototype,{set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,n){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:(hi=new We,li=new We,function(){return hi.subVectors(this.c,this.b),li.subVectors(this.a,this.b),.5*hi.cross(li).length()}),getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new We),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return gi.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new We),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return gi.getBarycoord(t,this.a,this.b,this.c,e)},containsPoint:function(t){return gi.containsPoint(t,this.a,this.b,this.c)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:(ni=new We,ii=new We,ai=new We,oi=new We,si=new We,ci=new We,function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new We);var r,n,i=this.a,a=this.b,o=this.c;ni.subVectors(a,i),ii.subVectors(o,i),oi.subVectors(t,i);var s=ni.dot(oi),c=ii.dot(oi);if(s<=0&&c<=0)return e.copy(i);si.subVectors(t,a);var h=ni.dot(si),l=ii.dot(si);if(0<=h&&l<=h)return e.copy(a);var u=s*l-h*c;if(u<=0&&0<=s&&h<=0)return r=s/(s-h),e.copy(i).addScaledVector(ni,r);ci.subVectors(t,o);var p=ni.dot(ci),d=ii.dot(ci);if(0<=d&&p<=d)return e.copy(o);var f=p*c-s*d;if(f<=0&&0<=c&&d<=0)return n=c/(c-d),e.copy(i).addScaledVector(ii,n);var m=h*d-p*l;if(m<=0&&0<=l-h&&0<=p-d)return ai.subVectors(o,a),n=(l-h)/(l-h+(p-d)),e.copy(a).addScaledVector(ai,n);var g=1/(m+f+u);return r=f*g,n=u*g,e.copy(i).addScaledVector(ni,r).addScaledVector(ii,n)}),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),vi.prototype=Object.assign(Object.create($r.prototype),{constructor:vi,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return $r.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,e,r,n=this.geometry;if(n.isBufferGeometry){var i=n.morphAttributes,a=Object.keys(i);if(0<a.length){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=n.morphTargets;if(void 0!==s&&0<s.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;t<e;t++)r=s[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}},raycast:function(){var z=new ke,G=new mi,H=new yr,V=new We,k=new We,j=new We,W=new We,X=new We,q=new We,Y=new Ve,J=new Ve,Z=new Ve,s=new We,Q=new We,h=new We;function K(t,e,r,n,i,a,o){return gi.getBarycoord(t,e,r,n,s),i.multiplyScalar(s.x),a.multiplyScalar(s.y),o.multiplyScalar(s.z),i.add(a).add(o),i.clone()}function $(t,e,r,n,i,a,o,s){if(null===(e.side===Mt?n.intersectTriangle(o,a,i,!0,s):n.intersectTriangle(i,a,o,e.side!==et,s)))return null;h.copy(s),h.applyMatrix4(t.matrixWorld);var c=r.ray.origin.distanceTo(h);return c<r.near||c>r.far?null:{distance:c,point:h.clone(),object:t}}function tt(t,e,r,n,i,a,o,s,c){V.fromBufferAttribute(i,o),k.fromBufferAttribute(i,s),j.fromBufferAttribute(i,c);var h=$(t,e,r,n,V,k,j,Q);if(h){a&&(Y.fromBufferAttribute(a,o),J.fromBufferAttribute(a,s),Z.fromBufferAttribute(a,c),h.uv=K(Q,V,k,j,Y,J,Z));var l=new rn(o,s,c);gi.getNormal(V,k,j,l.normal),h.face=l}return h}return function(t,e){var r,n=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===n.boundingSphere&&n.computeBoundingSphere(),H.copy(n.boundingSphere),H.applyMatrix4(a),!1!==t.ray.intersectsSphere(H)&&(z.getInverse(a),G.copy(t.ray).applyMatrix4(z),null===n.boundingBox||!1!==G.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var o,s,c,h,l,u,p,d,f,m=n.index,g=n.attributes.position,v=n.attributes.uv,y=n.groups,x=n.drawRange;if(null!==m)if(Array.isArray(i))for(h=0,u=y.length;h<u;h++)for(f=i[(d=y[h]).materialIndex],l=Math.max(d.start,x.start),p=Math.min(d.start+d.count,x.start+x.count);l<p;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(r=tt(this,f,t,G,g,v,o,s,c))&&(r.faceIndex=Math.floor(l/3),e.push(r));else for(h=Math.max(0,x.start),u=Math.min(m.count,x.start+x.count);h<u;h+=3)o=m.getX(h),s=m.getX(h+1),c=m.getX(h+2),(r=tt(this,i,t,G,g,v,o,s,c))&&(r.faceIndex=Math.floor(h/3),e.push(r));else if(void 0!==g)if(Array.isArray(i))for(h=0,u=y.length;h<u;h++)for(f=i[(d=y[h]).materialIndex],l=Math.max(d.start,x.start),p=Math.min(d.start+d.count,x.start+x.count);l<p;l+=3)(r=tt(this,f,t,G,g,v,o=l,s=l+1,c=l+2))&&(r.faceIndex=Math.floor(l/3),e.push(r));else for(h=Math.max(0,x.start),u=Math.min(g.count,x.start+x.count);h<u;h+=3)(r=tt(this,i,t,G,g,v,o=h,s=h+1,c=h+2))&&(r.faceIndex=Math.floor(h/3),e.push(r))}else if(n.isGeometry){var b,w,_,M,E=Array.isArray(i),T=n.vertices,S=n.faces,A=n.faceVertexUvs[0];0<A.length&&(M=A);for(var L=0,R=S.length;L<R;L++){var P=S[L],C=E?i[P.materialIndex]:i;if(void 0!==C){if(b=T[P.a],w=T[P.b],_=T[P.c],!0===C.morphTargets){var O=n.morphTargets,I=this.morphTargetInfluences;V.set(0,0,0),k.set(0,0,0),j.set(0,0,0);for(var N=0,D=O.length;N<D;N++){var U=I[N];if(0!==U){var B=O[N].vertices;V.addScaledVector(W.subVectors(B[P.a],b),U),k.addScaledVector(X.subVectors(B[P.b],w),U),j.addScaledVector(q.subVectors(B[P.c],_),U)}}V.add(b),k.add(w),j.add(_),b=V,w=k,_=j}if(r=$(this,C,t,G,b,w,_,Q)){if(M&&M[L]){var F=M[L];Y.copy(F[0]),J.copy(F[1]),Z.copy(F[2]),r.uv=K(Q,b,w,_,Y,J,Z)}r.face=P,r.faceIndex=L,e.push(r)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((Ri.prototype=Object.create(rr.prototype)).constructor=Ri).prototype.isCubeTexture=!0,Object.defineProperty(Ri.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Pi=new rr,Ci=new Ri;function Oi(){this.seq=[],this.map={}}var Ii=[],Ni=[],Di=new Float32Array(16),Ui=new Float32Array(9),Bi=new Float32Array(4);function Fi(t,e,r){var n=t[0];if(n<=0||0<n)return t;var i=e*r,a=Ii[i];if(void 0===a&&(a=new Float32Array(i),Ii[i]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=r,t[o].toArray(a,s)}return a}function zi(t,e){if(t.length!==e.length)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Gi(t,e){for(var r=0,n=e.length;r<n;r++)t[r]=e[r]}function Hi(t,e){var r=Ni[e];void 0===r&&(r=new Int32Array(e),Ni[e]=r);for(var n=0;n!==e;++n)r[n]=t.allocTextureUnit();return r}function Vi(t,e){var r=this.cache;r[0]!==e&&(t.uniform1f(this.addr,e),r[0]=e)}function ki(t,e){var r=this.cache;r[0]!==e&&(t.uniform1i(this.addr,e),r[0]=e)}function ji(t,e){var r=this.cache;if(void 0!==e.x)r[0]===e.x&&r[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),r[0]=e.x,r[1]=e.y);else{if(zi(r,e))return;t.uniform2fv(this.addr,e),Gi(r,e)}}function Wi(t,e){var r=this.cache;if(void 0!==e.x)r[0]===e.x&&r[1]===e.y&&r[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),r[0]=e.x,r[1]=e.y,r[2]=e.z);else if(void 0!==e.r)r[0]===e.r&&r[1]===e.g&&r[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),r[0]=e.r,r[1]=e.g,r[2]=e.b);else{if(zi(r,e))return;t.uniform3fv(this.addr,e),Gi(r,e)}}function Xi(t,e){var r=this.cache;if(void 0!==e.x)r[0]===e.x&&r[1]===e.y&&r[2]===e.z&&r[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),r[0]=e.x,r[1]=e.y,r[2]=e.z,r[3]=e.w);else{if(zi(r,e))return;t.uniform4fv(this.addr,e),Gi(r,e)}}function qi(t,e){var r=this.cache,n=e.elements;if(void 0===n){if(zi(r,e))return;t.uniformMatrix2fv(this.addr,!1,e),Gi(r,e)}else{if(zi(r,n))return;Bi.set(n),t.uniformMatrix2fv(this.addr,!1,Bi),Gi(r,n)}}function Yi(t,e){var r=this.cache,n=e.elements;if(void 0===n){if(zi(r,e))return;t.uniformMatrix3fv(this.addr,!1,e),Gi(r,e)}else{if(zi(r,n))return;Ui.set(n),t.uniformMatrix3fv(this.addr,!1,Ui),Gi(r,n)}}function Ji(t,e){var r=this.cache,n=e.elements;if(void 0===n){if(zi(r,e))return;t.uniformMatrix4fv(this.addr,!1,e),Gi(r,e)}else{if(zi(r,n))return;Di.set(n),t.uniformMatrix4fv(this.addr,!1,Di),Gi(r,n)}}function Zi(t,e,r){var n=this.cache,i=r.allocTextureUnit();n[0]!==i&&(t.uniform1i(this.addr,i),n[0]=i),r.setTexture2D(e||Pi,i)}function Qi(t,e,r){var n=this.cache,i=r.allocTextureUnit();n[0]!==i&&(t.uniform1i(this.addr,i),n[0]=i),r.setTextureCube(e||Ci,i)}function Ki(t,e){var r=this.cache;zi(r,e)||(t.uniform2iv(this.addr,e),Gi(r,e))}function $i(t,e){var r=this.cache;zi(r,e)||(t.uniform3iv(this.addr,e),Gi(r,e))}function ta(t,e){var r=this.cache;zi(r,e)||(t.uniform4iv(this.addr,e),Gi(r,e))}function ea(t,e){var r=this.cache;zi(r,e)||(t.uniform1fv(this.addr,e),Gi(r,e))}function ra(t,e){var r=this.cache;zi(r,e)||(t.uniform1iv(this.addr,e),Gi(r,e))}function na(t,e){var r=this.cache,n=Fi(e,this.size,2);zi(r,n)||(t.uniform2fv(this.addr,n),this.updateCache(n))}function ia(t,e){var r=this.cache,n=Fi(e,this.size,3);zi(r,n)||(t.uniform3fv(this.addr,n),this.updateCache(n))}function aa(t,e){var r=this.cache,n=Fi(e,this.size,4);zi(r,n)||(t.uniform4fv(this.addr,n),this.updateCache(n))}function oa(t,e){var r=this.cache,n=Fi(e,this.size,4);zi(r,n)||(t.uniformMatrix2fv(this.addr,!1,n),this.updateCache(n))}function sa(t,e){var r=this.cache,n=Fi(e,this.size,9);zi(r,n)||(t.uniformMatrix3fv(this.addr,!1,n),this.updateCache(n))}function ca(t,e){var r=this.cache,n=Fi(e,this.size,16);zi(r,n)||(t.uniformMatrix4fv(this.addr,!1,n),this.updateCache(n))}function ha(t,e,r){var n=this.cache,i=e.length,a=Hi(r,i);!1===zi(n,a)&&(t.uniform1iv(this.addr,a),Gi(n,a));for(var o=0;o!==i;++o)r.setTexture2D(e[o]||Pi,a[o])}function la(t,e,r){var n=this.cache,i=e.length,a=Hi(r,i);!1===zi(n,a)&&(t.uniform1iv(this.addr,a),Gi(n,a));for(var o=0;o!==i;++o)r.setTextureCube(e[o]||Ci,a[o])}function ua(t,e,r){this.id=t,this.addr=r,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Vi;case 35664:return ji;case 35665:return Wi;case 35666:return Xi;case 35674:return qi;case 35675:return Yi;case 35676:return Ji;case 35678:case 36198:return Zi;case 35680:return Qi;case 5124:case 35670:return ki;case 35667:case 35671:return Ki;case 35668:case 35672:return $i;case 35669:case 35673:return ta}}(e.type)}function pa(t,e,r){this.id=t,this.addr=r,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return ea;case 35664:return na;case 35665:return ia;case 35666:return aa;case 35674:return oa;case 35675:return sa;case 35676:return ca;case 35678:return ha;case 35680:return la;case 5124:case 35670:return ra;case 35667:case 35671:return Ki;case 35668:case 35672:return $i;case 35669:case 35673:return ta}}(e.type)}function da(t){this.id=t,Oi.call(this)}pa.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Gi(e,t)},da.prototype.setValue=function(t,e,r){for(var n=this.seq,i=0,a=n.length;i!==a;++i){var o=n[i];o.setValue(t,e[o.id],r)}};var fa=/([\w\d_]+)(\])?(\[|\.)?/g;function ma(t,e){t.seq.push(e),t.map[e.id]=e}function ga(t,e,r){var n=t.name,i=n.length;for(fa.lastIndex=0;;){var a=fa.exec(n),o=fa.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s|=0),void 0===h||"["===h&&o+2===i){ma(r,void 0===h?new ua(s,t,e):new pa(s,t,e));break}var l=r.map[s];void 0===l&&ma(r,l=new da(s)),r=l}}function va(t,e,r){Oi.call(this),this.renderer=r;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i<n;++i){var a=t.getActiveUniform(e,i);ga(a,t.getUniformLocation(e,a.name),this)}}function ya(t,e,r){var n=t.createShader(e);return t.shaderSource(n,r),t.compileShader(n),!1===t.getShaderParameter(n,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),function(t){for(var e=t.split("\n"),r=0;r<e.length;r++)e[r]=r+1+": "+e[r];return e.join("\n")}(r)),n}va.prototype.setValue=function(t,e,r){var n=this.map[e];void 0!==n&&n.setValue(t,r,this.renderer)},va.prototype.setOptional=function(t,e,r){var n=e[r];void 0!==n&&this.setValue(t,r,n)},va.upload=function(t,e,r,n){for(var i=0,a=e.length;i!==a;++i){var o=e[i],s=r[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},va.seqWithValue=function(t,e){for(var r=[],n=0,i=t.length;n!==i;++n){var a=t[n];a.id in e&&r.push(a)}return r};var xa=0;function ba(t){switch(t){case Pe:return["Linear","( value )"];case Ce:return["sRGB","( value )"];case Ie:return["RGBE","( value )"];case Ne:return["RGBM","( value, 7.0 )"];case De:return["RGBM","( value, 16.0 )"];case Ue:return["RGBD","( value, 256.0 )"];case Oe:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function wa(t,e){var r=ba(e);return"vec4 "+t+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function _a(t){return""!==t}function Ma(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function Ea(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function Ta(t){return t.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(t,e){var r=_r[e];if(void 0===r)throw new Error("Can not resolve #include <"+e+">");return Ta(r)})}function Sa(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,n){for(var i="",a=parseInt(e);a<parseInt(r);a++)i+=n.replace(/\[ i \]/g,"[ "+a+" ]");return i})}function Aa(t,e,r,n,i,a,o){var s=t.context,c=n.defines,h=i.vertexShader,l=i.fragmentShader,u="SHADOWMAP_TYPE_BASIC";a.shadowMapType===G?u="SHADOWMAP_TYPE_PCF":a.shadowMapType===H&&(u="SHADOWMAP_TYPE_PCF_SOFT");var p="ENVMAP_TYPE_CUBE",d="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(n.envMap.mapping){case gt:case vt:p="ENVMAP_TYPE_CUBE";break;case wt:case Tt:p="ENVMAP_TYPE_CUBE_UV";break;case yt:case xt:p="ENVMAP_TYPE_EQUIREC";break;case bt:p="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case vt:case xt:d="ENVMAP_MODE_REFRACTION"}switch(n.combine){case j:f="ENVMAP_BLENDING_MULTIPLY";break;case W:f="ENVMAP_BLENDING_MIX";break;case ut:f="ENVMAP_BLENDING_ADD"}}var m,g,v,y,x,b,w,_,M=0<t.gammaFactor?t.gammaFactor:1,E=o.isWebGL2?"":(m=n.extensions,g=a,v=e,[(m=m||{}).derivatives||g.envMapCubeUV||g.bumpMap||g.normalMap&&!g.objectSpaceNormalMap||g.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(m.fragDepth||g.logarithmicDepthBuffer)&&v.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",m.drawBuffers&&v.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(m.shaderTextureLOD||g.envMap)&&v.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(_a).join("\n")),T=function(t){var e=[];for(var r in t){var n=t[r];!1!==n&&e.push("#define "+r+" "+n)}return e.join("\n")}(c),S=s.createProgram();if(n.isRawShaderMaterial?(0<(y=[T].filter(_a).join("\n")).length&&(y+="\n"),0<(x=[E,T].filter(_a).join("\n")).length&&(x+="\n")):(y=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,T,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+M,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(_a).join("\n"),x=[E,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,T,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+M,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.envMap?"#define "+d:"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==pt?"#define TONE_MAPPING":"",a.toneMapping!==pt?_r.tonemapping_pars_fragment:"",a.toneMapping!==pt?function(t,e){var r;switch(e){case Et:r="Linear";break;case dt:r="Reinhard";break;case ft:r="Uncharted2";break;case mt:r="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.envMapEncoding||a.emissiveMapEncoding?_r.encodings_pars_fragment:"",a.mapEncoding?wa("mapTexelToLinear",a.mapEncoding):"",a.envMapEncoding?wa("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?wa("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(b="linearToOutputTexel",w=a.outputEncoding,_=ba(w),"vec4 "+b+"( vec4 value ) { return LinearTo"+_[0]+_[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_a).join("\n")),h=Ea(h=Ma(h=Ta(h),a),a),l=Ea(l=Ma(l=Ta(l),a),a),h=Sa(h),l=Sa(l),o.isWebGL2&&!n.isRawShaderMaterial){var A=!1,L=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==h.match(L)&&null!==l.match(L)&&(A=!0,h=h.replace(L,""),l=l.replace(L,"")),y=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,x=["#version 300 es\n","#define varying in",A?"":"out highp vec4 pc_fragColor;",A?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x}var R=y+h,P=x+l,C=ya(s,s.VERTEX_SHADER,R),O=ya(s,s.FRAGMENT_SHADER,P);s.attachShader(S,C),s.attachShader(S,O),void 0!==n.index0AttributeName?s.bindAttribLocation(S,0,n.index0AttributeName):!0===a.morphTargets&&s.bindAttribLocation(S,0,"position"),s.linkProgram(S);var I,N,D=s.getProgramInfoLog(S).trim(),U=s.getShaderInfoLog(C).trim(),B=s.getShaderInfoLog(O).trim(),F=!0,z=!0;return!1===s.getProgramParameter(S,s.LINK_STATUS)?(F=!1,console.error("THREE.WebGLProgram: shader error: ",s.getError(),"gl.VALIDATE_STATUS",s.getProgramParameter(S,s.VALIDATE_STATUS),"gl.getProgramInfoLog",D,U,B)):""!==D?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",D):""!==U&&""!==B||(z=!1),z&&(this.diagnostics={runnable:F,material:n,programLog:D,vertexShader:{log:U,prefix:y},fragmentShader:{log:B,prefix:x}}),s.deleteShader(C),s.deleteShader(O),this.getUniforms=function(){return void 0===I&&(I=new va(s,S,t)),I},this.getAttributes=function(){return void 0===N&&(N=function(t,e){for(var r={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=0;i<n;i++){var a=t.getActiveAttrib(e,i).name;r[a]=t.getAttribLocation(e,a)}return r}(s,S)),N},this.destroy=function(){s.deleteProgram(S),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.name=i.name,this.id=xa++,this.code=r,this.usedTimes=1,this.program=S,this.vertexShader=C,this.fragmentShader=O,this}function La(u,c,p){var h=[],d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function f(t,e){var r;return t?t.isTexture?r=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),r=t.texture.encoding):r=Pe,r===Pe&&e&&(r=Oe),r}this.getParameters=function(t,e,r,n,i,a,o){var s=d[t.type],c=o.isSkinnedMesh?function(t){var e=t.skeleton.bones;if(p.floatVertexTextures)return 1024;var r=p.maxVertexUniforms,n=Math.floor((r-20)/4),i=Math.min(n,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}(o):0,h=p.precision;null!==t.precision&&(h=p.getMaxPrecision(t.precision))!==t.precision&&console.warn("THREE.WebGLProgram.getParameters:",t.precision,"not supported, using",h,"instead.");var l=u.getRenderTarget();return{shaderID:s,precision:h,supportsVertexTextures:p.vertexTextures,outputEncoding:f(l?l.texture:null,u.gammaOutput),map:!!t.map,mapEncoding:f(t.map,u.gammaInput),envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,envMapEncoding:f(t.envMap,u.gammaInput),envMapCubeUV:!!t.envMap&&(t.envMap.mapping===wt||t.envMap.mapping===Tt),lightMap:!!t.lightMap,aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,emissiveMapEncoding:f(t.emissiveMap,u.gammaInput),bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,objectSpaceNormalMap:t.normalMapType===Ge,displacementMap:!!t.displacementMap,roughnessMap:!!t.roughnessMap,metalnessMap:!!t.metalnessMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,gradientMap:!!t.gradientMap,combine:t.combine,vertexColors:t.vertexColors,fog:!!n,useFog:t.fog,fogExp:n&&n.isFogExp2,flatShading:t.flatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:p.logarithmicDepthBuffer,skinning:t.skinning&&0<c,maxBones:c,useVertexTexture:p.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:u.maxMorphTargets,maxMorphNormals:u.maxMorphNormals,numDirLights:e.directional.length,numPointLights:e.point.length,numSpotLights:e.spot.length,numRectAreaLights:e.rectArea.length,numHemiLights:e.hemi.length,numClippingPlanes:i,numClipIntersection:a,dithering:t.dithering,shadowMapEnabled:u.shadowMap.enabled&&o.receiveShadow&&0<r.length,shadowMapType:u.shadowMap.type,toneMapping:u.toneMapping,physicallyCorrectLights:u.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===et,flipSided:t.side===Mt,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)r.push(n),r.push(t.defines[n]);for(var i=0;i<a.length;i++)r.push(e[a[i]]);return r.push(t.onBeforeCompile.toString()),r.push(u.gammaOutput),r.join()},this.acquireProgram=function(t,e,r,n){for(var i,a=0,o=h.length;a<o;a++){var s=h[a];if(s.code===n){++(i=s).usedTimes;break}}return void 0===i&&(i=new Aa(u,c,n,t,e,r,p),h.push(i)),i},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},this.programs=h}function Ra(){var n=new WeakMap;return{get:function(t){var e=n.get(t);return void 0===e&&(e={},n.set(t,e)),e},remove:function(t){n.delete(t)},update:function(t,e,r){n.get(t)[e]=r},dispose:function(){n=new WeakMap}}}function Pa(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Ca(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Oa(){var o=[],s=0,c=[],h=[];return{opaque:c,transparent:h,init:function(){s=0,c.length=0,h.length=0},push:function(t,e,r,n,i){var a=o[s];void 0===a?(a={id:t.id,object:t,geometry:e,material:r,program:r.program,renderOrder:t.renderOrder,z:n,group:i},o[s]=a):(a.id=t.id,a.object=t,a.geometry=e,a.material=r,a.program=r.program,a.renderOrder=t.renderOrder,a.z=n,a.group=i),(!0===r.transparent?h:c).push(a),s++},sort:function(){1<c.length&&c.sort(Pa),1<h.length&&h.sort(Ca)}}}function Ia(){var i={};return{get:function(t,e){var r=t.id+","+e.id,n=i[r];return void 0===n&&(n=new Oa,i[r]=n),n},dispose:function(){i={}}}}function Na(){var r={};return{get:function(t){if(void 0!==r[t.id])return r[t.id];var e;switch(t.type){case"DirectionalLight":e={direction:new We,color:new Tr,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"SpotLight":e={position:new We,direction:new We,color:new Tr,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":e={position:new We,color:new Tr,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":e={direction:new We,skyColor:new Tr,groundColor:new Tr};break;case"RectAreaLight":e={color:new Tr,position:new We,halfWidth:new We,halfHeight:new We}}return r[t.id]=e}}}var Da,Ua,Ba,Fa,za,Ga,Ha,Va,ka,ja,Wa,Xa,qa,Ya,Ja,Za,Qa=0;function Ka(){var w=new Na,_={id:Qa++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},M=new We,E=new ke,T=new ke;return{setup:function(t,e,r){for(var n=0,i=0,a=0,o=0,s=0,c=0,h=0,l=0,u=r.matrixWorldInverse,p=0,d=t.length;p<d;p++){var f=t[p],m=f.color,g=f.intensity,v=f.distance,y=f.shadow&&f.shadow.map?f.shadow.map.texture:null;if(f.isAmbientLight)n+=m.r*g,i+=m.g*g,a+=m.b*g;else if(f.isDirectionalLight){if((b=w.get(f)).color.copy(f.color).multiplyScalar(f.intensity),b.direction.setFromMatrixPosition(f.matrixWorld),M.setFromMatrixPosition(f.target.matrixWorld),b.direction.sub(M),b.direction.transformDirection(u),b.shadow=f.castShadow,f.castShadow){var x=f.shadow;b.shadowBias=x.bias,b.shadowRadius=x.radius,b.shadowMapSize=x.mapSize}_.directionalShadowMap[o]=y,_.directionalShadowMatrix[o]=f.shadow.matrix,_.directional[o]=b,o++}else if(f.isSpotLight)(b=w.get(f)).position.setFromMatrixPosition(f.matrixWorld),b.position.applyMatrix4(u),b.color.copy(m).multiplyScalar(g),b.distance=v,b.direction.setFromMatrixPosition(f.matrixWorld),M.setFromMatrixPosition(f.target.matrixWorld),b.direction.sub(M),b.direction.transformDirection(u),b.coneCos=Math.cos(f.angle),b.penumbraCos=Math.cos(f.angle*(1-f.penumbra)),b.decay=0===f.distance?0:f.decay,b.shadow=f.castShadow,f.castShadow&&(x=f.shadow,b.shadowBias=x.bias,b.shadowRadius=x.radius,b.shadowMapSize=x.mapSize),_.spotShadowMap[c]=y,_.spotShadowMatrix[c]=f.shadow.matrix,_.spot[c]=b,c++;else if(f.isRectAreaLight)(b=w.get(f)).color.copy(m).multiplyScalar(g),b.position.setFromMatrixPosition(f.matrixWorld),b.position.applyMatrix4(u),T.identity(),E.copy(f.matrixWorld),E.premultiply(u),T.extractRotation(E),b.halfWidth.set(.5*f.width,0,0),b.halfHeight.set(0,.5*f.height,0),b.halfWidth.applyMatrix4(T),b.halfHeight.applyMatrix4(T),_.rectArea[h]=b,h++;else if(f.isPointLight)(b=w.get(f)).position.setFromMatrixPosition(f.matrixWorld),b.position.applyMatrix4(u),b.color.copy(f.color).multiplyScalar(f.intensity),b.distance=f.distance,b.decay=0===f.distance?0:f.decay,b.shadow=f.castShadow,f.castShadow&&(x=f.shadow,b.shadowBias=x.bias,b.shadowRadius=x.radius,b.shadowMapSize=x.mapSize,b.shadowCameraNear=x.camera.near,b.shadowCameraFar=x.camera.far),_.pointShadowMap[s]=y,_.pointShadowMatrix[s]=f.shadow.matrix,_.point[s]=b,s++;else if(f.isHemisphereLight){var b;(b=w.get(f)).direction.setFromMatrixPosition(f.matrixWorld),b.direction.transformDirection(u),b.direction.normalize(),b.skyColor.copy(f.color).multiplyScalar(g),b.groundColor.copy(f.groundColor).multiplyScalar(g),_.hemi[l]=b,l++}}_.ambient[0]=n,_.ambient[1]=i,_.ambient[2]=a,_.directional.length=o,_.spot.length=c,_.rectArea.length=h,_.point.length=s,_.hemi.length=l,_.hash.stateID=_.id,_.hash.directionalLength=o,_.hash.pointLength=s,_.hash.spotLength=c,_.hash.rectAreaLength=h,_.hash.hemiLength=l,_.hash.shadowsLength=e.length},state:_}}function $a(){var e=new Ka,r=[],n=[];return{init:function(){r.length=0,n.length=0},state:{lightsArray:r,shadowsArray:n,lights:e},setupLights:function(t){e.setup(r,n,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){n.push(t)}}}function to(){var n={};return{get:function(t,e){var r;return void 0===n[t.id]?(r=new $a,n[t.id]={},n[t.id][e.id]=r):void 0===n[t.id][e.id]?(r=new $a,n[t.id][e.id]=r):r=n[t.id][e.id],r},dispose:function(){n={}}}}function eo(t){pi.call(this),this.type="MeshDepthMaterial",this.depthPacking=Be,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function ro(t){pi.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new We,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(t)}function no(x,m,t){for(var b=new br,w=new ke,_=new Ve,M=new Ve(t,t),E=new We,T=new We,v=1,y=2,e=1+(v|y),S=new Array(e),A=new Array(e),L={},R={0:Mt,1:D,2:et},P=[new We(1,0,0),new We(-1,0,0),new We(0,0,1),new We(0,0,-1),new We(0,1,0),new We(0,-1,0)],C=[new We(0,1,0),new We(0,1,0),new We(0,1,0),new We(0,1,0),new We(0,0,1),new We(0,0,-1)],O=[new nr,new nr,new nr,new nr,new nr,new nr],r=0;r!==e;++r){var n=0!=(r&v),i=0!=(r&y),a=new eo({depthPacking:Fe,morphTargets:n,skinning:i});S[r]=a;var o=new ro({morphTargets:n,skinning:i});A[r]=o}var I=this;function g(t,e,r,n,i,a){var o=t.geometry,s=null,c=S,h=t.customDepthMaterial;if(r&&(c=A,h=t.customDistanceMaterial),h)s=h;else{var l=!1;e.morphTargets&&(o&&o.isBufferGeometry?l=o.morphAttributes&&o.morphAttributes.position&&0<o.morphAttributes.position.length:o&&o.isGeometry&&(l=o.morphTargets&&0<o.morphTargets.length)),t.isSkinnedMesh&&!1===e.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var u=t.isSkinnedMesh&&e.skinning,p=0;l&&(p|=v),u&&(p|=y),s=c[p]}if(x.localClippingEnabled&&!0===e.clipShadows&&0!==e.clippingPlanes.length){var d=s.uuid,f=e.uuid,m=L[d];void 0===m&&(m={},L[d]=m);var g=m[f];void 0===g&&(g=s.clone(),m[f]=g),s=g}return s.visible=e.visible,s.wireframe=e.wireframe,s.side=null!=e.shadowSide?e.shadowSide:R[e.side],s.clipShadows=e.clipShadows,s.clippingPlanes=e.clippingPlanes,s.clipIntersection=e.clipIntersection,s.wireframeLinewidth=e.wireframeLinewidth,s.linewidth=e.linewidth,r&&s.isMeshDistanceMaterial&&(s.referencePosition.copy(n),s.nearDistance=i,s.farDistance=a),s}function N(t,e,r,n){if(!1!==t.visible){if(t.layers.test(e.layers)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!t.frustumCulled||b.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld);var i=m.update(t),a=t.material;if(Array.isArray(a))for(var o=i.groups,s=0,c=o.length;s<c;s++){var h=o[s],l=a[h.materialIndex];if(l&&l.visible){var u=g(t,l,n,T,r.near,r.far);x.renderBufferDirect(r,null,i,u,t,h)}}else if(a.visible){u=g(t,a,n,T,r.near,r.far);x.renderBufferDirect(r,null,i,u,t,null)}}for(var p=t.children,d=0,f=p.length;d<f;d++)N(p[d],e,r,n)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=G,this.render=function(t,e,r){if(!1!==I.enabled&&(!1!==I.autoUpdate||!1!==I.needsUpdate)&&0!==t.length){var n,i=x.context,a=x.state;a.disable(i.BLEND),a.buffers.color.setClear(1,1,1,1),a.buffers.depth.setTest(!0),a.setScissorTest(!1);for(var o=0,s=t.length;o<s;o++){var c=t[o],h=c.shadow,l=c&&c.isPointLight;if(void 0!==h){var u=h.camera;if(_.copy(h.mapSize),_.min(M),l){var p=_.x,d=_.y;O[0].set(2*p,d,p,d),O[1].set(0,d,p,d),O[2].set(3*p,d,p,d),O[3].set(p,d,p,d),O[4].set(3*p,0,p,d),O[5].set(p,0,p,d),_.x*=4,_.y*=2}if(null===h.map){var f={minFilter:Rt,magFilter:Rt,format:Jt};h.map=new ir(_.x,_.y,f),h.map.texture.name=c.name+".shadowMap",u.updateProjectionMatrix()}h.isSpotLightShadow&&h.update(c);var m=h.map,g=h.matrix;T.setFromMatrixPosition(c.matrixWorld),u.position.copy(T),l?(n=6,g.makeTranslation(-T.x,-T.y,-T.z)):(n=1,E.setFromMatrixPosition(c.target.matrixWorld),u.lookAt(E),u.updateMatrixWorld(),g.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),g.multiply(u.projectionMatrix),g.multiply(u.matrixWorldInverse)),x.setRenderTarget(m),x.clear();for(var v=0;v<n;v++){if(l){E.copy(u.position),E.add(P[v]),u.up.copy(C[v]),u.lookAt(E),u.updateMatrixWorld();var y=O[v];a.viewport(y)}w.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),b.setFromMatrix(w),N(e,r,u,l)}}else console.warn("THREE.WebGLShadowMap:",c,"has no shadow.")}I.needsUpdate=!1}}}function io(l,r,c,n){var i=new function(){var e=!1,a=new nr,r=null,o=new nr(0,0,0,0);return{setMask:function(t){r===t||e||(l.colorMask(t,t,t,t),r=t)},setLocked:function(t){e=t},setClear:function(t,e,r,n,i){!0===i&&(t*=n,e*=n,r*=n),a.set(t,e,r,n),!1===o.equals(a)&&(l.clearColor(t,e,r,n),o.copy(a))},reset:function(){e=!1,r=null,o.set(-1,0,0,0)}}},a=new function(){var e=!1,r=null,n=null,i=null;return{setTest:function(t){t?z(l.DEPTH_TEST):G(l.DEPTH_TEST)},setMask:function(t){r===t||e||(l.depthMask(t),r=t)},setFunc:function(t){if(n!==t){if(t)switch(t){case nt:l.depthFunc(l.NEVER);break;case it:l.depthFunc(l.ALWAYS);break;case at:l.depthFunc(l.LESS);break;case ot:l.depthFunc(l.LEQUAL);break;case st:l.depthFunc(l.EQUAL);break;case ct:l.depthFunc(l.GEQUAL);break;case ht:l.depthFunc(l.GREATER);break;case lt:l.depthFunc(l.NOTEQUAL);break;default:l.depthFunc(l.LEQUAL)}else l.depthFunc(l.LEQUAL);n=t}},setLocked:function(t){e=t},setClear:function(t){i!==t&&(l.clearDepth(t),i=t)},reset:function(){e=!1,i=n=r=null}}},e=new function(){var e=!1,r=null,n=null,i=null,a=null,o=null,s=null,c=null,h=null;return{setTest:function(t){t?z(l.STENCIL_TEST):G(l.STENCIL_TEST)},setMask:function(t){r===t||e||(l.stencilMask(t),r=t)},setFunc:function(t,e,r){n===t&&i===e&&a===r||(l.stencilFunc(t,e,r),n=t,i=e,a=r)},setOp:function(t,e,r){o===t&&s===e&&c===r||(l.stencilOp(t,e,r),o=t,s=e,c=r)},setLocked:function(t){e=t},setClear:function(t){h!==t&&(l.clearStencil(t),h=t)},reset:function(){e=!1,h=c=s=o=a=i=n=r=null}}},t=l.getParameter(l.MAX_VERTEX_ATTRIBS),o=new Uint8Array(t),s=new Uint8Array(t),h=new Uint8Array(t),u={},p=null,d=null,f=null,m=null,g=null,v=null,y=null,x=null,b=null,w=null,_=!1,M=null,E=null,T=null,S=null,A=null,L=l.getParameter(l.MAX_COMBINED_TEXTURE_IMAGE_UNITS),R=!1,P=0,C=l.getParameter(l.VERSION);-1!==C.indexOf("WebGL")?(P=parseFloat(/^WebGL\ ([0-9])/.exec(C)[1]),R=1<=P):-1!==C.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(C)[1]),R=2<=P);var O=null,I={},N=new nr,D=new nr;function U(t,e,r){var n=new Uint8Array(4),i=l.createTexture();l.bindTexture(t,i),l.texParameteri(t,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(t,l.TEXTURE_MAG_FILTER,l.NEAREST);for(var a=0;a<r;a++)l.texImage2D(e+a,0,l.RGBA,1,1,0,l.RGBA,l.UNSIGNED_BYTE,n);return i}var B={};function F(t,e){(o[t]=1,0===s[t]&&(l.enableVertexAttribArray(t),s[t]=1),h[t]!==e)&&((n.isWebGL2?l:r.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](t,e),h[t]=e)}function z(t){!0!==u[t]&&(l.enable(t),u[t]=!0)}function G(t){!1!==u[t]&&(l.disable(t),u[t]=!1)}function H(t,e,r,n,i,a,o,s){if(t!==J){if(f||(z(l.BLEND),f=!0),t===tt)i=i||e,a=a||r,o=o||n,e===g&&i===x||(l.blendEquationSeparate(c.convert(e),c.convert(i)),g=e,x=i),r===v&&n===y&&a===b&&o===w||(l.blendFuncSeparate(c.convert(r),c.convert(n),c.convert(a),c.convert(o)),v=r,y=n,b=a,w=o),m=t,_=null;else if(t!==m||s!==_){if(g===rt&&x===rt||(l.blendEquation(l.FUNC_ADD),x=g=rt),s)switch(t){case Z:l.blendFuncSeparate(l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case Q:l.blendFunc(l.ONE,l.ONE);break;case K:l.blendFuncSeparate(l.ZERO,l.ZERO,l.ONE_MINUS_SRC_COLOR,l.ONE_MINUS_SRC_ALPHA);break;case $:l.blendFuncSeparate(l.ZERO,l.SRC_COLOR,l.ZERO,l.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case Z:l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case Q:l.blendFunc(l.SRC_ALPHA,l.ONE);break;case K:l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case $:l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}w=b=y=v=null,m=t,_=s}}else f&&(G(l.BLEND),f=!1)}function V(t){M!==t&&(t?l.frontFace(l.CW):l.frontFace(l.CCW),M=t)}function k(t){t!==X?(z(l.CULL_FACE),t!==E&&(t===q?l.cullFace(l.BACK):t===Y?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK))):G(l.CULL_FACE),E=t}function j(t,e,r){t?(z(l.POLYGON_OFFSET_FILL),S===e&&A===r||(l.polygonOffset(e,r),S=e,A=r)):G(l.POLYGON_OFFSET_FILL)}function W(t){void 0===t&&(t=l.TEXTURE0+L-1),O!==t&&(l.activeTexture(t),O=t)}return B[l.TEXTURE_2D]=U(l.TEXTURE_2D,l.TEXTURE_2D,1),B[l.TEXTURE_CUBE_MAP]=U(l.TEXTURE_CUBE_MAP,l.TEXTURE_CUBE_MAP_POSITIVE_X,6),i.setClear(0,0,0,1),a.setClear(1),e.setClear(0),z(l.DEPTH_TEST),a.setFunc(ot),V(!1),k(q),z(l.CULL_FACE),H(J),{buffers:{color:i,depth:a,stencil:e},initAttributes:function(){for(var t=0,e=o.length;t<e;t++)o[t]=0},enableAttribute:function(t){F(t,0)},enableAttributeAndDivisor:F,disableUnusedAttributes:function(){for(var t=0,e=s.length;t!==e;++t)s[t]!==o[t]&&(l.disableVertexAttribArray(t),s[t]=0)},enable:z,disable:G,getCompressedTextureFormats:function(){if(null===p&&(p=[],r.get("WEBGL_compressed_texture_pvrtc")||r.get("WEBGL_compressed_texture_s3tc")||r.get("WEBGL_compressed_texture_etc1")||r.get("WEBGL_compressed_texture_astc")))for(var t=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),e=0;e<t.length;e++)p.push(t[e]);return p},useProgram:function(t){return d!==t&&(l.useProgram(t),d=t,!0)},setBlending:H,setMaterial:function(t,e){t.side===et?G(l.CULL_FACE):z(l.CULL_FACE);var r=t.side===Mt;e&&(r=!r),V(r),t.blending===Z&&!1===t.transparent?H(J):H(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),i.setMask(t.colorWrite),j(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:V,setCullFace:k,setLineWidth:function(t){t!==T&&(R&&l.lineWidth(t),T=t)},setPolygonOffset:j,setScissorTest:function(t){t?z(l.SCISSOR_TEST):G(l.SCISSOR_TEST)},activeTexture:W,bindTexture:function(t,e){null===O&&W();var r=I[O];void 0===r&&(r={type:void 0,texture:void 0},I[O]=r),r.type===t&&r.texture===e||(l.bindTexture(t,e||B[t]),r.type=t,r.texture=e)},compressedTexImage2D:function(){try{l.compressedTexImage2D.apply(l,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{l.texImage2D.apply(l,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(t){!1===N.equals(t)&&(l.scissor(t.x,t.y,t.z,t.w),N.copy(t))},viewport:function(t){!1===D.equals(t)&&(l.viewport(t.x,t.y,t.z,t.w),D.copy(t))},reset:function(){for(var t=0;t<s.length;t++)1===s[t]&&(l.disableVertexAttribArray(t),s[t]=0);u={},I={},E=M=m=d=O=p=null,i.reset(),a.reset(),e.reset()}}}function ao(g,i,v,y,x,b,w){var f,s={};function _(t,e){if(t.width>e||t.height>e){if("data"in t)return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+t.width+"x"+t.height+").");var r=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return n.width=Math.floor(t.width*r),n.height=Math.floor(t.height*r),n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height),n}return t}function M(t){return He.isPowerOfTwo(t.width)&&He.isPowerOfTwo(t.height)}function E(t,e){return t.generateMipmaps&&e&&t.minFilter!==Rt&&t.minFilter!==Ot}function T(t,e,r,n){g.generateMipmap(t),y.get(e).__maxMipLevel=Math.log(Math.max(r,n))*Math.LOG2E}function S(t,e){if(!x.isWebGL2)return t;if(t===g.RGB){if(e===g.FLOAT)return g.RGB32F;if(e===g.HALF_FLOAT)return g.RGB16F;if(e===g.UNSIGNED_BYTE)return g.RGB8}if(t===g.RGBA){if(e===g.FLOAT)return g.RGBA32F;if(e===g.HALF_FLOAT)return g.RGBA16F;if(e===g.UNSIGNED_BYTE)return g.RGBA8}return t}function a(t){return t===Rt||t===Pt||t===Ct?g.NEAREST:g.LINEAR}function A(t){var e=t.target;e.removeEventListener("dispose",A),function(t){var e=y.get(t);if(t.image&&e.__image__webglTextureCube)g.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)return;g.deleteTexture(e.__webglTexture)}y.remove(t)}(e),e.isVideoTexture&&delete s[e.id],w.memory.textures--}function o(t){var e=t.target;e.removeEventListener("dispose",o),function(t){var e=y.get(t),r=y.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&g.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var n=0;n<6;n++)g.deleteFramebuffer(e.__webglFramebuffer[n]),e.__webglDepthbuffer&&g.deleteRenderbuffer(e.__webglDepthbuffer[n]);else g.deleteFramebuffer(e.__webglFramebuffer),e.__webglDepthbuffer&&g.deleteRenderbuffer(e.__webglDepthbuffer);y.remove(t.texture),y.remove(t)}(e),w.memory.textures--}function c(t,e){var r,n,i,a=y.get(t);if(t.isVideoTexture&&(n=(r=t).id,i=w.render.frame,s[n]!==i&&(s[n]=i,r.update())),0<t.version&&a.__version!==t.version){var o=t.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void function(t,e,r){void 0===t.__webglInit&&(t.__webglInit=!0,e.addEventListener("dispose",A),t.__webglTexture=g.createTexture(),w.memory.textures++);v.activeTexture(g.TEXTURE0+r),v.bindTexture(g.TEXTURE_2D,t.__webglTexture),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,e.flipY),g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),g.pixelStorei(g.UNPACK_ALIGNMENT,e.unpackAlignment);var n=_(e.image,x.maxTextureSize);a=e,x.isWebGL2||a.wrapS===At&&a.wrapT===At&&(a.minFilter===Rt||a.minFilter===Ot)||!1!==M(n)||(n=(i=n)instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof ImageBitmap?(void 0===f&&(f=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),f.width=He.floorPowerOfTwo(i.width),f.height=He.floorPowerOfTwo(i.height),f.getContext("2d").drawImage(i,0,0,f.width,f.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+i.width+"x"+i.height+"). Resized to "+f.width+"x"+f.height),f):i);var i;var a;var o=M(n),s=b.convert(e.format),c=b.convert(e.type),h=S(s,c);L(g.TEXTURE_2D,e,o);var l,u=e.mipmaps;if(e.isDepthTexture){if(h=g.DEPTH_COMPONENT,e.type===Ht){if(!x.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");h=g.DEPTH_COMPONENT32F}else x.isWebGL2&&(h=g.DEPTH_COMPONENT16);e.format===$t&&h===g.DEPTH_COMPONENT&&e.type!==Ft&&e.type!==Gt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),e.type=Ft,c=b.convert(e.type)),e.format===te&&(h=g.DEPTH_STENCIL,e.type!==Xt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),e.type=Xt,c=b.convert(e.type))),v.texImage2D(g.TEXTURE_2D,0,h,n.width,n.height,0,s,c,null)}else if(e.isDataTexture)if(0<u.length&&o){for(var p=0,d=u.length;p<d;p++)l=u[p],v.texImage2D(g.TEXTURE_2D,p,h,l.width,l.height,0,s,c,l.data);e.generateMipmaps=!1,t.__maxMipLevel=u.length-1}else v.texImage2D(g.TEXTURE_2D,0,h,n.width,n.height,0,s,c,n.data),t.__maxMipLevel=0;else if(e.isCompressedTexture){for(var p=0,d=u.length;p<d;p++)l=u[p],e.format!==Jt&&e.format!==Yt?-1<v.getCompressedTextureFormats().indexOf(s)?v.compressedTexImage2D(g.TEXTURE_2D,p,h,l.width,l.height,0,l.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v.texImage2D(g.TEXTURE_2D,p,h,l.width,l.height,0,s,c,l.data);t.__maxMipLevel=u.length-1}else if(0<u.length&&o){for(var p=0,d=u.length;p<d;p++)l=u[p],v.texImage2D(g.TEXTURE_2D,p,h,s,c,l);e.generateMipmaps=!1,t.__maxMipLevel=u.length-1}else v.texImage2D(g.TEXTURE_2D,0,h,s,c,n),t.__maxMipLevel=0;E(e,o)&&T(g.TEXTURE_2D,e,n.width,n.height);t.__version=e.version,e.onUpdate&&e.onUpdate(e)}(a,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_2D,a.__webglTexture)}function L(t,e,r){var n;if(r?(g.texParameteri(t,g.TEXTURE_WRAP_S,b.convert(e.wrapS)),g.texParameteri(t,g.TEXTURE_WRAP_T,b.convert(e.wrapT)),g.texParameteri(t,g.TEXTURE_MAG_FILTER,b.convert(e.magFilter)),g.texParameteri(t,g.TEXTURE_MIN_FILTER,b.convert(e.minFilter))):(g.texParameteri(t,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(t,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),e.wrapS===At&&e.wrapT===At||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),g.texParameteri(t,g.TEXTURE_MAG_FILTER,a(e.magFilter)),g.texParameteri(t,g.TEXTURE_MIN_FILTER,a(e.minFilter)),e.minFilter!==Rt&&e.minFilter!==Ot&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),n=i.get("EXT_texture_filter_anisotropic")){if(e.type===Ht&&null===i.get("OES_texture_float_linear"))return;if(e.type===Vt&&null===(x.isWebGL2||i.get("OES_texture_half_float_linear")))return;(1<e.anisotropy||y.get(e).__currentAnisotropy)&&(g.texParameterf(t,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,x.getMaxAnisotropy())),y.get(e).__currentAnisotropy=e.anisotropy)}}function h(t,e,r,n){var i=b.convert(e.texture.format),a=b.convert(e.texture.type),o=S(i,a);v.texImage2D(n,0,o,e.width,e.height,0,i,a,null),g.bindFramebuffer(g.FRAMEBUFFER,t),g.framebufferTexture2D(g.FRAMEBUFFER,r,n,y.get(e.texture).__webglTexture,0),g.bindFramebuffer(g.FRAMEBUFFER,null)}function l(t,e){g.bindRenderbuffer(g.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,e.width,e.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,e.width,e.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,t)):g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,e.width,e.height),g.bindRenderbuffer(g.RENDERBUFFER,null)}function u(t){var e=y.get(t),r=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,e){if(e&&e.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(g.bindFramebuffer(g.FRAMEBUFFER,t),!e.depthTexture||!e.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");y.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),c(e.depthTexture,0);var r=y.get(e.depthTexture).__webglTexture;if(e.depthTexture.format===$t)g.framebufferTexture2D(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.TEXTURE_2D,r,0);else{if(e.depthTexture.format!==te)throw new Error("Unknown depthTexture format");g.framebufferTexture2D(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.TEXTURE_2D,r,0)}}(e.__webglFramebuffer,t)}else if(r){e.__webglDepthbuffer=[];for(var n=0;n<6;n++)g.bindFramebuffer(g.FRAMEBUFFER,e.__webglFramebuffer[n]),e.__webglDepthbuffer[n]=g.createRenderbuffer(),l(e.__webglDepthbuffer[n],t)}else g.bindFramebuffer(g.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=g.createRenderbuffer(),l(e.__webglDepthbuffer,t);g.bindFramebuffer(g.FRAMEBUFFER,null)}this.setTexture2D=c,this.setTextureCube=function(t,e){var r=y.get(t);if(6===t.image.length)if(0<t.version&&r.__version!==t.version){r.__image__webglTextureCube||(t.addEventListener("dispose",A),r.__image__webglTextureCube=g.createTexture(),w.memory.textures++),v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var n=t&&t.isCompressedTexture,i=t.image[0]&&t.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=n||i?i?t.image[o].image:t.image[o]:_(t.image[o],x.maxCubemapSize);var s=a[0],c=M(s),h=b.convert(t.format),l=b.convert(t.type),u=S(h,l);for(L(g.TEXTURE_CUBE_MAP,t,c),o=0;o<6;o++)if(n)for(var p,d=a[o].mipmaps,f=0,m=d.length;f<m;f++)p=d[f],t.format!==Jt&&t.format!==Yt?-1<v.getCompressedTextureFormats().indexOf(h)?v.compressedTexImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,u,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):v.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,u,p.width,p.height,0,h,l,p.data);else i?v.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,u,a[o].width,a[o].height,0,h,l,a[o].data):v.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,u,h,l,a[o]);r.__maxMipLevel=n?d.length-1:0,E(t,c)&&T(g.TEXTURE_CUBE_MAP,t,s.width,s.height),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,e){v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_CUBE_MAP,y.get(t).__webglTexture)},this.setupRenderTarget=function(t){var e=y.get(t),r=y.get(t.texture);t.addEventListener("dispose",o),r.__webglTexture=g.createTexture(),w.memory.textures++;var n=!0===t.isWebGLRenderTargetCube,i=M(t);if(n){e.__webglFramebuffer=[];for(var a=0;a<6;a++)e.__webglFramebuffer[a]=g.createFramebuffer()}else e.__webglFramebuffer=g.createFramebuffer();if(n){for(v.bindTexture(g.TEXTURE_CUBE_MAP,r.__webglTexture),L(g.TEXTURE_CUBE_MAP,t.texture,i),a=0;a<6;a++)h(e.__webglFramebuffer[a],t,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+a);E(t.texture,i)&&T(g.TEXTURE_CUBE_MAP,t.texture,t.width,t.height),v.bindTexture(g.TEXTURE_CUBE_MAP,null)}else v.bindTexture(g.TEXTURE_2D,r.__webglTexture),L(g.TEXTURE_2D,t.texture,i),h(e.__webglFramebuffer,t,g.COLOR_ATTACHMENT0,g.TEXTURE_2D),E(t.texture,i)&&T(g.TEXTURE_2D,t.texture,t.width,t.height),v.bindTexture(g.TEXTURE_2D,null);t.depthBuffer&&u(t)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(E(e,M(t))){var r=t.isWebGLRenderTargetCube?g.TEXTURE_CUBE_MAP:g.TEXTURE_2D,n=y.get(e).__webglTexture;v.bindTexture(r,n),T(r,e,t.width,t.height),v.bindTexture(r,null)}}}function oo(r,n,i){return{convert:function(t){var e;if(t===St)return r.REPEAT;if(t===At)return r.CLAMP_TO_EDGE;if(t===Lt)return r.MIRRORED_REPEAT;if(t===Rt)return r.NEAREST;if(t===Pt)return r.NEAREST_MIPMAP_NEAREST;if(t===Ct)return r.NEAREST_MIPMAP_LINEAR;if(t===Ot)return r.LINEAR;if(t===It)return r.LINEAR_MIPMAP_NEAREST;if(t===Nt)return r.LINEAR_MIPMAP_LINEAR;if(t===Dt)return r.UNSIGNED_BYTE;if(t===kt)return r.UNSIGNED_SHORT_4_4_4_4;if(t===jt)return r.UNSIGNED_SHORT_5_5_5_1;if(t===Wt)return r.UNSIGNED_SHORT_5_6_5;if(t===Ut)return r.BYTE;if(t===Bt)return r.SHORT;if(t===Ft)return r.UNSIGNED_SHORT;if(t===zt)return r.INT;if(t===Gt)return r.UNSIGNED_INT;if(t===Ht)return r.FLOAT;if(t===Vt){if(i.isWebGL2)return r.HALF_FLOAT;if(null!==(e=n.get("OES_texture_half_float")))return e.HALF_FLOAT_OES}if(t===qt)return r.ALPHA;if(t===Yt)return r.RGB;if(t===Jt)return r.RGBA;if(t===Zt)return r.LUMINANCE;if(t===Qt)return r.LUMINANCE_ALPHA;if(t===$t)return r.DEPTH_COMPONENT;if(t===te)return r.DEPTH_STENCIL;if(t===rt)return r.FUNC_ADD;if(t===S)return r.FUNC_SUBTRACT;if(t===A)return r.FUNC_REVERSE_SUBTRACT;if(t===P)return r.ZERO;if(t===C)return r.ONE;if(t===O)return r.SRC_COLOR;if(t===I)return r.ONE_MINUS_SRC_COLOR;if(t===N)return r.SRC_ALPHA;if(t===U)return r.ONE_MINUS_SRC_ALPHA;if(t===B)return r.DST_ALPHA;if(t===F)return r.ONE_MINUS_DST_ALPHA;if(t===z)return r.DST_COLOR;if(t===V)return r.ONE_MINUS_DST_COLOR;if(t===k)return r.SRC_ALPHA_SATURATE;if((t===ee||t===re||t===ne||t===ie)&&null!==(e=n.get("WEBGL_compressed_texture_s3tc"))){if(t===ee)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===re)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===ne)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===ie)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===ae||t===oe||t===se||t===ce)&&null!==(e=n.get("WEBGL_compressed_texture_pvrtc"))){if(t===ae)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===oe)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===se)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ce)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===he&&null!==(e=n.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===le||t===ue||t===pe||t===de||t===fe||t===me||t===ge||t===ve||t===ye||t===xe||t===be||t===we||t===_e||t===Me)&&null!==(e=n.get("WEBGL_compressed_texture_astc")))return t;if(t===L||t===R){if(i.isWebGL2){if(t===L)return r.MIN;if(t===R)return r.MAX}if(null!==(e=n.get("EXT_blend_minmax"))){if(t===L)return e.MIN_EXT;if(t===R)return e.MAX_EXT}}if(t===Xt){if(i.isWebGL2)return r.UNSIGNED_INT_24_8;if(null!==(e=n.get("WEBGL_depth_texture")))return e.UNSIGNED_INT_24_8_WEBGL}return 0}}}function so(){$r.call(this),this.type="Group"}function co(t,e,r,n){tn.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ho(t){co.call(this),this.cameras=t||[]}function lo(n){var s=this,c=null,h=null,l=null,u=[],p=new ke,d=new ke;"undefined"!=typeof window&&"VRFrameData"in window&&(h=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",t,!1));var f=new ke,m=new je,g=new We,v=new co;v.bounds=new nr(0,0,.5,1),v.layers.enable(1);var y=new co;y.bounds=new nr(.5,0,.5,1),y.layers.enable(2);var i,a,x=new ho([v,y]);function o(){return null!==c&&!0===c.isPresenting}function t(){if(o()){var t=c.getEyeParameters("left"),e=t.renderWidth,r=t.renderHeight;a=n.getPixelRatio(),i=n.getSize(),n.setDrawingBufferSize(2*e,r,1),_.start()}else s.enabled&&(n.setDrawingBufferSize(i.width,i.height,a),_.stop())}x.layers.enable(1),x.layers.enable(2);var b=[];function w(t){for(var e=navigator.getGamepads&&navigator.getGamepads(),r=0,n=0,i=e.length;r<i;r++){var a=e[r];if(a&&("Daydream Controller"===a.id||"Gear VR Controller"===a.id||"Oculus Go Controller"===a.id||"OpenVR Gamepad"===a.id||a.id.startsWith("Oculus Touch")||a.id.startsWith("Spatial Controller"))){if(n===t)return a;n++}}}this.enabled=!1,this.userHeight=1.6,this.getController=function(t){var e=u[t];return void 0===e&&((e=new so).matrixAutoUpdate=!1,e.visible=!1,u[t]=e),e},this.getDevice=function(){return c},this.setDevice=function(t){void 0!==t&&(c=t),_.setContext(t)},this.setPoseTarget=function(t){void 0!==t&&(l=t)},this.getCamera=function(t){if(null===c)return t.position.set(0,s.userHeight,0),t;c.depthNear=t.near,c.depthFar=t.far,c.getFrameData(h);var e=c.stageParameters;e?p.fromArray(e.sittingToStandingTransform):p.makeTranslation(0,s.userHeight,0);var r=h.pose,n=null!==l?l:t;if(n.matrix.copy(p),n.matrix.decompose(n.position,n.quaternion,n.scale),null!==r.orientation&&(m.fromArray(r.orientation),n.quaternion.multiply(m)),null!==r.position&&(m.setFromRotationMatrix(p),g.fromArray(r.position),g.applyQuaternion(m),n.position.add(g)),n.updateMatrixWorld(),!1===c.isPresenting)return t;v.near=t.near,y.near=t.near,v.far=t.far,y.far=t.far,x.matrixWorld.copy(t.matrixWorld),x.matrixWorldInverse.copy(t.matrixWorldInverse),v.matrixWorldInverse.fromArray(h.leftViewMatrix),y.matrixWorldInverse.fromArray(h.rightViewMatrix),d.getInverse(p),v.matrixWorldInverse.multiply(d),y.matrixWorldInverse.multiply(d);var i=n.parent;null!==i&&(f.getInverse(i.matrixWorld),v.matrixWorldInverse.multiply(f),y.matrixWorldInverse.multiply(f)),v.matrixWorld.getInverse(v.matrixWorldInverse),y.matrixWorld.getInverse(y.matrixWorldInverse),v.projectionMatrix.fromArray(h.leftProjectionMatrix),y.projectionMatrix.fromArray(h.rightProjectionMatrix),x.projectionMatrix.copy(v.projectionMatrix);var a=c.getLayers();if(a.length){var o=a[0];null!==o.leftBounds&&4===o.leftBounds.length&&v.bounds.fromArray(o.leftBounds),null!==o.rightBounds&&4===o.rightBounds.length&&y.bounds.fromArray(o.rightBounds)}return function(){for(var t=0;t<u.length;t++){var e=u[t],r=w(t);if(void 0!==r&&void 0!==r.pose){if(null===r.pose)return;var n=r.pose;!1===n.hasPosition&&e.position.set(.2,-.6,-.05),null!==n.position&&e.position.fromArray(n.position),null!==n.orientation&&e.quaternion.fromArray(n.orientation),e.matrix.compose(e.position,e.quaternion,e.scale),e.matrix.premultiply(p),e.matrix.decompose(e.position,e.quaternion,e.scale),e.matrixWorldNeedsUpdate=!0,e.visible=!0;var i="Daydream Controller"===r.id?0:1;b[t]!==r.buttons[i].pressed&&(b[t]=r.buttons[i].pressed,!0===b[t]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"})))}else e.visible=!1}}(),x},this.getStandingMatrix=function(){return p},this.isPresenting=o;var _=new Pr;this.setAnimationLoop=function(t){_.setAnimationLoop(t)},this.submitFrame=function(){o()&&c.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",t)}}function uo(r){var n=r.context,e=null,p=null,d=null,f=null,m=[],g=[];function o(){return null!==p&&null!==d}var t=new co;t.layers.enable(1),t.viewport=new nr;var i=new co;i.layers.enable(2),i.viewport=new nr;var v=new ho([t,i]);function a(t){var e=m[g.indexOf(t.inputSource)];e&&e.dispatchEvent({type:t.type})}function s(){r.setFramebuffer(null),h.stop()}function c(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)}v.layers.enable(1),v.layers.enable(2),this.enabled=!1,this.getController=function(t){var e=m[t];return void 0===e&&((e=new so).matrixAutoUpdate=!1,e.visible=!1,m[t]=e),e},this.getDevice=function(){return e},this.setDevice=function(t){void 0!==t&&(e=t),t instanceof XRDevice&&n.setCompatibleXRDevice(t)},this.setSession=function(t,e){null!==(p=t)&&(p.addEventListener("select",a),p.addEventListener("selectstart",a),p.addEventListener("selectend",a),p.addEventListener("end",s),p.baseLayer=new XRWebGLLayer(p,n),p.requestFrameOfReference(e.frameOfReferenceType).then(function(t){d=t,r.setFramebuffer(p.baseLayer.framebuffer),h.setContext(p),h.start()}),g=p.getInputSources(),p.addEventListener("inputsourceschange",function(){g=p.getInputSources(),console.log(g)}))},this.getCamera=function(t){if(o()){var e=t.parent,r=v.cameras;c(v,e);for(var n=0;n<r.length;n++)c(r[n],e);t.matrixWorld.copy(v.matrixWorld);for(var i=t.children,a=(n=0,i.length);n<a;n++)i[n].updateMatrixWorld(!0);return v}return t},this.isPresenting=o;var y=null;var h=new Pr;h.setAnimationLoop(function(t,e){if(null!==(f=e.getDevicePose(d)))for(var r=p.baseLayer,n=e.views,i=0;i<n.length;i++){var a=n[i],o=r.getViewport(a),s=f.getViewMatrix(a),c=v.cameras[i];c.matrix.fromArray(s).getInverse(c.matrix),c.projectionMatrix.fromArray(a.projectionMatrix),c.viewport.set(o.x,o.y,o.width,o.height),0===i&&(v.matrix.copy(c.matrix),v.projectionMatrix.copy(c.projectionMatrix))}for(i=0;i<m.length;i++){var h=m[i],l=g[i];if(l){var u=e.getInputPose(l,d);if(null!==u){h.matrix.elements=u.pointerMatrix,h.matrix.decompose(h.position,h.rotation,h.scale),h.visible=!0;continue}}h.visible=!1}y&&y(t)}),this.setAnimationLoop=function(t){y=t},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new THREE.Matrix4},this.submitFrame=function(){}}function po(t){console.log("THREE.WebGLRenderer",_t);var n=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",d=null,H=null;this.domElement=n,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Et,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var V,M,k,j,l,W,u,E,T,f,y,p,m,g,S,A,L,v,X=this,x=!1,b=null,w=null,_=null,q=-1,R={geometry:null,program:null,wireframe:!1},Y=null,J=null,P=new nr,C=new nr,O=null,Z=0,I=n.width,Q=n.height,K=1,N=new nr(0,0,I,Q),D=new nr(0,0,I,Q),U=!1,B=new br,$=new wi,tt=!1,et=!1,F=new ke,rt=new We;function z(){return null===w?K:1}try{var G={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:h};if(n.addEventListener("webglcontextlost",ot,!1),n.addEventListener("webglcontextrestored",st,!1),null===(V=e||n.getContext("webgl",G)||n.getContext("experimental-webgl",G)))throw null!==n.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===V.getShaderPrecisionFormat&&(V.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){console.error("THREE.WebGLRenderer: "+t.message)}function nt(){M=new _i(V),(k=new bi(V,M,t)).isWebGL2||(M.get("WEBGL_depth_texture"),M.get("OES_texture_float"),M.get("OES_texture_half_float"),M.get("OES_texture_half_float_linear"),M.get("OES_standard_derivatives"),M.get("OES_element_index_uint"),M.get("ANGLE_instanced_arrays")),M.get("OES_texture_float_linear"),v=new oo(V,M,k),(j=new io(V,M,v,k)).scissor(C.copy(D).multiplyScalar(K)),j.viewport(P.copy(N).multiplyScalar(K)),l=new Ti(V),W=new Ra,u=new ao(V,M,j,W,k,v,l),E=new Cr(V),T=new Mi(V,E,l),f=new Li(T,l),S=new Ai(V),y=new La(X,M,k),p=new Ia,m=new to,g=new yi(X,j,f,s),A=new xi(V,M,l,k),L=new Ei(V,M,l,k),l.programs=y.programs,X.context=V,X.capabilities=k,X.extensions=M,X.properties=W,X.renderLists=p,X.state=j,X.info=l}nt();var it="xr"in navigator?new uo(X):new lo(X);this.vr=it;var at=new no(X,f,k.maxTextureSize);function ot(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function st(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1,nt()}function ct(t){var e,r=t.target;r.removeEventListener("dispose",ct),ht(e=r),W.remove(e)}function ht(t){var e=W.get(t).program;(t.program=void 0)!==e&&y.releaseProgram(e)}this.shadowMap=at,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){var t=M.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=M.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return K},this.setPixelRatio=function(t){void 0!==t&&(K=t,this.setSize(I,Q,!1))},this.getSize=function(){return{width:I,height:Q}},this.setSize=function(t,e,r){it.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(I=t,Q=e,n.width=t*K,n.height=e*K,!1!==r&&(n.style.width=t+"px",n.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(){return{width:I*K,height:Q*K}},this.setDrawingBufferSize=function(t,e,r){I=t,Q=e,K=r,n.width=t*r,n.height=e*r,this.setViewport(0,0,t,e)},this.getCurrentViewport=function(){return P},this.setViewport=function(t,e,r,n){N.set(t,Q-e-n,r,n),j.viewport(P.copy(N).multiplyScalar(K))},this.setScissor=function(t,e,r,n){D.set(t,Q-e-n,r,n),j.scissor(C.copy(D).multiplyScalar(K))},this.setScissorTest=function(t){j.setScissorTest(U=t)},this.getClearColor=function(){return g.getClearColor()},this.setClearColor=function(){g.setClearColor.apply(g,arguments)},this.getClearAlpha=function(){return g.getClearAlpha()},this.setClearAlpha=function(){g.setClearAlpha.apply(g,arguments)},this.clear=function(t,e,r){var n=0;(void 0===t||t)&&(n|=V.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=V.DEPTH_BUFFER_BIT),(void 0===r||r)&&(n|=V.STENCIL_BUFFER_BIT),V.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,r,n){this.setRenderTarget(t),this.clear(e,r,n)},this.dispose=function(){n.removeEventListener("webglcontextlost",ot,!1),n.removeEventListener("webglcontextrestored",st,!1),p.dispose(),m.dispose(),W.dispose(),f.dispose(),it.dispose(),ft.stop()},this.renderBufferImmediate=function(t,e){j.initAttributes();var r=W.get(t);t.hasPositions&&!r.position&&(r.position=V.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=V.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=V.createBuffer()),t.hasColors&&!r.color&&(r.color=V.createBuffer());var n=e.getAttributes();t.hasPositions&&(V.bindBuffer(V.ARRAY_BUFFER,r.position),V.bufferData(V.ARRAY_BUFFER,t.positionArray,V.DYNAMIC_DRAW),j.enableAttribute(n.position),V.vertexAttribPointer(n.position,3,V.FLOAT,!1,0,0)),t.hasNormals&&(V.bindBuffer(V.ARRAY_BUFFER,r.normal),V.bufferData(V.ARRAY_BUFFER,t.normalArray,V.DYNAMIC_DRAW),j.enableAttribute(n.normal),V.vertexAttribPointer(n.normal,3,V.FLOAT,!1,0,0)),t.hasUvs&&(V.bindBuffer(V.ARRAY_BUFFER,r.uv),V.bufferData(V.ARRAY_BUFFER,t.uvArray,V.DYNAMIC_DRAW),j.enableAttribute(n.uv),V.vertexAttribPointer(n.uv,2,V.FLOAT,!1,0,0)),t.hasColors&&(V.bindBuffer(V.ARRAY_BUFFER,r.color),V.bufferData(V.ARRAY_BUFFER,t.colorArray,V.DYNAMIC_DRAW),j.enableAttribute(n.color),V.vertexAttribPointer(n.color,3,V.FLOAT,!1,0,0)),j.disableUnusedAttributes(),V.drawArrays(V.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,n,i,a){var o=i.isMesh&&i.normalMatrix.determinant()<0;j.setMaterial(n,o);var s=yt(t,e,n,i),c=!1;R.geometry===r.id&&R.program===s.id&&R.wireframe===(!0===n.wireframe)||(R.geometry=r.id,R.program=s.id,R.wireframe=!0===n.wireframe,c=!0),i.morphTargetInfluences&&(S.update(i,r,n,s),c=!0);var h,l=r.index,u=r.attributes.position,p=1;!0===n.wireframe&&(l=T.getWireframeAttribute(r),p=2);var d=A;null!==l&&(h=E.get(l),(d=L).setIndex(h)),c&&(!function(t,e,r){if(r&&r.isInstancedBufferGeometry&!k.isWebGL2&&null===M.get("ANGLE_instanced_arrays"))return console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");j.initAttributes();var n=r.attributes,i=e.getAttributes(),a=t.defaultAttributeValues;for(var o in i){var s=i[o];if(0<=s){var c=n[o];if(void 0!==c){var h=c.normalized,l=c.itemSize,u=E.get(c);if(void 0===u)continue;var p=u.buffer,d=u.type,f=u.bytesPerElement;if(c.isInterleavedBufferAttribute){var m=c.data,g=m.stride,v=c.offset;m&&m.isInstancedInterleavedBuffer?(j.enableAttributeAndDivisor(s,m.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=m.meshPerAttribute*m.count)):j.enableAttribute(s),V.bindBuffer(V.ARRAY_BUFFER,p),V.vertexAttribPointer(s,l,d,h,g*f,v*f)}else c.isInstancedBufferAttribute?(j.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=c.meshPerAttribute*c.count)):j.enableAttribute(s),V.bindBuffer(V.ARRAY_BUFFER,p),V.vertexAttribPointer(s,l,d,h,0,0)}else if(void 0!==a){var y=a[o];if(void 0!==y)switch(y.length){case 2:V.vertexAttrib2fv(s,y);break;case 3:V.vertexAttrib3fv(s,y);break;case 4:V.vertexAttrib4fv(s,y);break;default:V.vertexAttrib1fv(s,y)}}}}j.disableUnusedAttributes()}(n,s,r),null!==l&&V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,h.buffer));var f=1/0;null!==l?f=l.count:void 0!==u&&(f=u.count);var m=r.drawRange.start*p,g=r.drawRange.count*p,v=null!==a?a.start*p:0,y=null!==a?a.count*p:1/0,x=Math.max(m,v),b=Math.min(f,m+g,v+y)-1,w=Math.max(0,b-x+1);if(0!==w){if(i.isMesh)if(!0===n.wireframe)j.setLineWidth(n.wireframeLinewidth*z()),d.setMode(V.LINES);else switch(i.drawMode){case Re:d.setMode(V.TRIANGLES);break;case 1:d.setMode(V.TRIANGLE_STRIP);break;case 2:d.setMode(V.TRIANGLE_FAN)}else if(i.isLine){var _=n.linewidth;void 0===_&&(_=1),j.setLineWidth(_*z()),i.isLineSegments?d.setMode(V.LINES):i.isLineLoop?d.setMode(V.LINE_LOOP):d.setMode(V.LINE_STRIP)}else i.isPoints?d.setMode(V.POINTS):i.isSprite&&d.setMode(V.TRIANGLES);r&&r.isInstancedBufferGeometry?0<r.maxInstancedCount&&d.renderInstances(r,x,w):d.render(x,w)}},this.compile=function(r,t){(H=m.get(r,t)).init(),r.traverse(function(t){t.isLight&&(H.pushLight(t),t.castShadow&&H.pushShadow(t))}),H.setupLights(t),r.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var e=0;e<t.material.length;e++)vt(t.material[e],r.fog,t);else vt(t.material,r.fog,t)})};var lt=null;var ut,pt,dt,ft=new Pr;function mt(t,e,r,n){for(var i=0,a=t.length;i<a;i++){var o=t[i],s=o.object,c=o.geometry,h=void 0===n?o.material:n,l=o.group;if(r.isArrayCamera)for(var u=(J=r).cameras,p=0,d=u.length;p<d;p++){var f=u[p];if(s.layers.test(f.layers)){if("viewport"in f)j.viewport(P.copy(f.viewport));else{var m=f.bounds,g=m.x*I,v=m.y*Q,y=m.z*I,x=m.w*Q;j.viewport(P.set(g,v,y,x).multiplyScalar(K))}gt(s,e,f,c,h,l)}}else J=null,gt(s,e,r,c,h,l)}}function gt(t,e,r,n,i,a){if(t.onBeforeRender(X,e,r,n,i,a),H=m.get(e,J||r),t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){j.setMaterial(i);var o=yt(r,e.fog,i,t);R.geometry=null,R.program=null,R.wireframe=!1,s=o,t.render(function(t){X.renderBufferImmediate(t,s)})}else X.renderBufferDirect(r,e.fog,n,i,t,a);var s;t.onAfterRender(X,e,r,n,i,a),H=m.get(e,J||r)}function vt(t,e,r){var n=W.get(t),i=H.state.lights,a=H.state.shadowsArray,o=n.lightsHash,s=i.state.hash,c=y.getParameters(t,i.state,a,e,$.numPlanes,$.numIntersection,r),h=y.getProgramCode(t,c),l=n.program,u=!0;if(void 0===l)t.addEventListener("dispose",ct);else if(l.code!==h)ht(t);else if(o.stateID!==s.stateID||o.directionalLength!==s.directionalLength||o.pointLength!==s.pointLength||o.spotLength!==s.spotLength||o.rectAreaLength!==s.rectAreaLength||o.hemiLength!==s.hemiLength||o.shadowsLength!==s.shadowsLength)o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,u=!1;else{if(void 0!==c.shaderID)return;u=!1}if(u){if(c.shaderID){var p=Rr[c.shaderID];n.shader={name:t.type,uniforms:Mr.clone(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}}else n.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.onBeforeCompile(n.shader,X),h=y.getProgramCode(t,c),l=y.acquireProgram(t,n.shader,c,h),n.program=l,t.program=l}var d=l.getAttributes();if(t.morphTargets)for(var f=t.numSupportedMorphTargets=0;f<X.maxMorphTargets;f++)0<=d["morphTarget"+f]&&t.numSupportedMorphTargets++;if(t.morphNormals)for(f=t.numSupportedMorphNormals=0;f<X.maxMorphNormals;f++)0<=d["morphNormal"+f]&&t.numSupportedMorphNormals++;var m=n.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=$.numPlanes,n.numIntersection=$.numIntersection,m.clippingPlanes=$.uniform),n.fog=e,void 0===o&&(n.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,t.lights&&(m.ambientLightColor.value=i.state.ambient,m.directionalLights.value=i.state.directional,m.spotLights.value=i.state.spot,m.rectAreaLights.value=i.state.rectArea,m.pointLights.value=i.state.point,m.hemisphereLights.value=i.state.hemi,m.directionalShadowMap.value=i.state.directionalShadowMap,m.directionalShadowMatrix.value=i.state.directionalShadowMatrix,m.spotShadowMap.value=i.state.spotShadowMap,m.spotShadowMatrix.value=i.state.spotShadowMatrix,m.pointShadowMap.value=i.state.pointShadowMap,m.pointShadowMatrix.value=i.state.pointShadowMatrix);var g=n.program.getUniforms(),v=va.seqWithValue(g.seq,m);n.uniformsList=v}function yt(t,e,r,n){Z=0;var i=W.get(r),a=H.state.lights,o=i.lightsHash,s=a.state.hash;if(tt&&(et||t!==Y)){var c=t===Y&&r.id===q;$.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,t,i,c)}!1===r.needsUpdate&&(void 0===i.program?r.needsUpdate=!0:r.fog&&i.fog!==e?r.needsUpdate=!0:(!r.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===i.numClippingPlanes||i.numClippingPlanes===$.numPlanes&&i.numIntersection===$.numIntersection)||(r.needsUpdate=!0)),r.needsUpdate&&(vt(r,e,n),r.needsUpdate=!1);var h,l,u,p,d,f,m,g,v,y,x,b,w,_,M,E,T,S,A,L,R=!1,P=!1,C=!1,O=i.program,I=O.getUniforms(),N=i.shader.uniforms;if(j.useProgram(O.program)&&(C=P=R=!0),r.id!==q&&(q=r.id,P=!0),R||t!==Y){if(I.setValue(V,"projectionMatrix",t.projectionMatrix),k.logarithmicDepthBuffer&&I.setValue(V,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),Y!==(J||t)&&(Y=J||t,C=P=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.envMap){var D=I.map.cameraPosition;void 0!==D&&D.setValue(V,rt.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&I.setValue(V,"viewMatrix",t.matrixWorldInverse)}if(r.skinning){I.setOptional(V,n,"bindMatrix"),I.setOptional(V,n,"bindMatrixInverse");var U=n.skeleton;if(U){var B=U.bones;if(k.floatVertexTextures){if(void 0===U.boneTexture){var F=Math.sqrt(4*B.length);F=He.ceilPowerOfTwo(F),F=Math.max(F,4);var z=new Float32Array(F*F*4);z.set(U.boneMatrices);var G=new or(z,F,F,Jt,Ht);G.needsUpdate=!0,U.boneMatrices=z,U.boneTexture=G,U.boneTextureSize=F}I.setValue(V,"boneTexture",U.boneTexture),I.setValue(V,"boneTextureSize",U.boneTextureSize)}else I.setOptional(V,U,"boneMatrices")}}return P&&(I.setValue(V,"toneMappingExposure",X.toneMappingExposure),I.setValue(V,"toneMappingWhitePoint",X.toneMappingWhitePoint),r.lights&&(L=C,(A=N).ambientLightColor.needsUpdate=L,A.directionalLights.needsUpdate=L,A.pointLights.needsUpdate=L,A.spotLights.needsUpdate=L,A.rectAreaLights.needsUpdate=L,A.hemisphereLights.needsUpdate=L),e&&r.fog&&(S=e,(T=N).fogColor.value=S.color,S.isFog?(T.fogNear.value=S.near,T.fogFar.value=S.far):S.isFogExp2&&(T.fogDensity.value=S.density)),r.isMeshBasicMaterial?xt(N,r):r.isMeshLambertMaterial?(xt(N,r),M=N,(E=r).emissiveMap&&(M.emissiveMap.value=E.emissiveMap)):r.isMeshPhongMaterial?(xt(N,r),r.isMeshToonMaterial?(bt(w=N,_=r),_.gradientMap&&(w.gradientMap.value=_.gradientMap)):bt(N,r)):r.isMeshStandardMaterial?(xt(N,r),r.isMeshPhysicalMaterial?(wt(x=N,b=r),x.reflectivity.value=b.reflectivity,x.clearCoat.value=b.clearCoat,x.clearCoatRoughness.value=b.clearCoatRoughness):wt(N,r)):r.isMeshDepthMaterial?(xt(N,r),v=N,(y=r).displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias)):r.isMeshDistanceMaterial?(xt(N,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(N,r)):r.isMeshNormalMaterial?(xt(N,r),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Mt&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Mt&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(N,r)):r.isLineBasicMaterial?(g=r,(m=N).diffuse.value=g.color,m.opacity.value=g.opacity,r.isLineDashedMaterial&&(f=r,(d=N).dashSize.value=f.dashSize,d.totalSize.value=f.dashSize+f.gapSize,d.scale.value=f.scale)):r.isPointsMaterial?(p=r,(u=N).diffuse.value=p.color,u.opacity.value=p.opacity,u.size.value=p.size*K,u.scale.value=.5*Q,u.map.value=p.map,null!==p.map&&(!0===p.map.matrixAutoUpdate&&p.map.updateMatrix(),u.uvTransform.value.copy(p.map.matrix))):r.isSpriteMaterial?(l=r,(h=N).diffuse.value=l.color,h.opacity.value=l.opacity,h.rotation.value=l.rotation,h.map.value=l.map,null!==l.map&&(!0===l.map.matrixAutoUpdate&&l.map.updateMatrix(),h.uvTransform.value.copy(l.map.matrix))):r.isShadowMaterial&&(N.color.value=r.color,N.opacity.value=r.opacity),void 0!==N.ltc_1&&(N.ltc_1.value=Lr.LTC_1),void 0!==N.ltc_2&&(N.ltc_2.value=Lr.LTC_2),va.upload(V,i.uniformsList,N,X)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(va.upload(V,i.uniformsList,N,X),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&I.setValue(V,"center",n.center),I.setValue(V,"modelViewMatrix",n.modelViewMatrix),I.setValue(V,"normalMatrix",n.normalMatrix),I.setValue(V,"modelMatrix",n.matrixWorld),O}function xt(t,e){var r;t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=W.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?r=e.map:e.specularMap?r=e.specularMap:e.displacementMap?r=e.displacementMap:e.normalMap?r=e.normalMap:e.bumpMap?r=e.bumpMap:e.roughnessMap?r=e.roughnessMap:e.metalnessMap?r=e.metalnessMap:e.alphaMap?r=e.alphaMap:e.emissiveMap&&(r=e.emissiveMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}function bt(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Mt&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Mt&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function wt(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Mt&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Mt&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}ft.setAnimationLoop(function(t){it.isPresenting()||lt&&lt(t)}),"undefined"!=typeof window&&ft.setContext(window),this.setAnimationLoop=function(t){lt=t,it.setAnimationLoop(t),ft.start()},this.render=function(t,e,r,n){if(e&&e.isCamera){if(!x){R.geometry=null,R.program=null,R.wireframe=!1,q=-1,!(Y=null)===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),it.enabled&&(e=it.getCamera(e)),(H=m.get(t,e)).init(),t.onBeforeRender(X,t,e,r),F.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),B.setFromMatrix(F),et=this.localClippingEnabled,tt=$.init(this.clippingPlanes,et,e),(d=p.get(t,e)).init(),function t(e,r,n){if(!1===e.visible)return;var i=e.layers.test(r.layers);if(i)if(e.isLight)H.pushLight(e),e.castShadow&&H.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||B.intersectsSprite(e)){n&&rt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F);var a=f.update(e),o=e.material;d.push(e,a,o,rt.z,null)}}else if(e.isImmediateRenderObject)n&&rt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F),d.push(e,null,e.material,rt.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||B.intersectsObject(e))){n&&rt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F);var a=f.update(e),o=e.material;if(Array.isArray(o))for(var s=a.groups,c=0,h=s.length;c<h;c++){var l=s[c],u=o[l.materialIndex];u&&u.visible&&d.push(e,a,u,rt.z,l)}else o.visible&&d.push(e,a,o,rt.z,null)}var p=e.children;for(var c=0,h=p.length;c<h;c++)t(p[c],r,n)}(t,e,X.sortObjects),!0===X.sortObjects&&d.sort(),tt&&$.beginShadows();var i=H.state.shadowsArray;at.render(i,t,e),H.setupLights(e),tt&&$.endShadows(),this.info.autoReset&&this.info.reset(),void 0===r&&(r=null),this.setRenderTarget(r),g.render(d,t,e,n);var a=d.opaque,o=d.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&mt(a,t,e,s),o.length&&mt(o,t,e,s)}else a.length&&mt(a,t,e),o.length&&mt(o,t,e);r&&u.updateRenderTargetMipmap(r),j.buffers.depth.setTest(!0),j.buffers.depth.setMask(!0),j.buffers.color.setMask(!0),j.setPolygonOffset(!1),t.onAfterRender(X,t,e),it.enabled&&it.submitFrame(),H=d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.allocTextureUnit=function(){var t=Z;return t>=k.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+k.maxTextures),Z+=1,t},this.setTexture2D=(ut=!1,function(t,e){t&&t.isWebGLRenderTarget&&(ut||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),ut=!0),t=t.texture),u.setTexture2D(t,e)}),this.setTexture=(pt=!1,function(t,e){pt||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),pt=!0),u.setTexture2D(t,e)}),this.setTextureCube=(dt=!1,function(t,e){t&&t.isWebGLRenderTargetCube&&(dt||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),dt=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?u.setTextureCube(t,e):u.setTextureCubeDynamic(t,e)}),this.setFramebuffer=function(t){b=t},this.getRenderTarget=function(){return w},this.setRenderTarget=function(t){(w=t)&&void 0===W.get(t).__webglFramebuffer&&u.setupRenderTarget(t);var e=b,r=!1;if(t){var n=W.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(e=n[t.activeCubeFace],r=!0):e=n,P.copy(t.viewport),C.copy(t.scissor),O=t.scissorTest}else P.copy(N).multiplyScalar(K),C.copy(D).multiplyScalar(K),O=U;if(_!==e&&(V.bindFramebuffer(V.FRAMEBUFFER,e),_=e),j.viewport(P),j.scissor(C),j.setScissorTest(O),r){var i=W.get(t.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,r,n,i,a){if(t&&t.isWebGLRenderTarget){var o=W.get(t).__webglFramebuffer;if(o){var s=!1;o!==_&&(V.bindFramebuffer(V.FRAMEBUFFER,o),s=!0);try{var c=t.texture,h=c.format,l=c.type;if(h!==Jt&&v.convert(h)!==V.getParameter(V.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===Dt||v.convert(l)===V.getParameter(V.IMPLEMENTATION_COLOR_READ_TYPE)||l===Ht&&(k.isWebGL2||M.get("OES_texture_float")||M.get("WEBGL_color_buffer_float"))||l===Vt&&(k.isWebGL2?M.get("EXT_color_buffer_float"):M.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");V.checkFramebufferStatus(V.FRAMEBUFFER)===V.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=r&&r<=t.height-i&&V.readPixels(e,r,n,i,v.convert(h),v.convert(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&V.bindFramebuffer(V.FRAMEBUFFER,_)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,r){var n=e.image.width,i=e.image.height,a=v.convert(e.format);this.setTexture2D(e,0),V.copyTexImage2D(V.TEXTURE_2D,r||0,a,t.x,t.y,n,i,0)},this.copyTextureToTexture=function(t,e,r,n){var i=e.image.width,a=e.image.height,o=v.convert(r.format),s=v.convert(r.type);this.setTexture2D(r,0),e.isDataTexture?V.texSubImage2D(V.TEXTURE_2D,n||0,t.x,t.y,i,a,o,s,e.image.data):V.texSubImage2D(V.TEXTURE_2D,n||0,t.x,t.y,o,s,e.image)}}function fo(t,e){this.name="",this.color=new Tr(t),this.density=void 0!==e?e:25e-5}function mo(t,e,r){this.name="",this.color=new Tr(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3}function go(){$r.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function vo(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function yo(t,e,r,n){this.data=t,this.itemSize=e,this.offset=r,this.normalized=!0===n}function xo(t){pi.call(this),this.type="SpriteMaterial",this.color=new Tr(16777215),this.map=null,this.rotation=0,this.lights=!1,this.transparent=!0,this.setValues(t)}function bo(t){if($r.call(this),this.type="Sprite",void 0===Da){Da=new Un;var e=new vo(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Da.setIndex([0,1,2,0,2,3]),Da.addAttribute("position",new yo(e,3,0,!1)),Da.addAttribute("uv",new yo(e,2,3,!1))}this.geometry=Da,this.material=void 0!==t?t:new xo,this.center=new Ve(.5,.5)}function wo(){$r.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function _o(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var r=0,n=this.bones.length;r<n;r++)this.boneInverses.push(new ke)}}function Mo(){$r.call(this),this.type="Bone"}function Eo(t,e){vi.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ke,this.bindMatrixInverse=new ke;var r=new _o(this.initBones());this.bind(r,this.matrixWorld),this.normalizeSkinWeights()}function To(t){pi.call(this),this.type="LineBasicMaterial",this.color=new Tr(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function So(t,e,r){1===r&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),$r.call(this),this.type="Line",this.geometry=void 0!==t?t:new Un,this.material=void 0!==e?e:new To({color:16777215*Math.random()})}function Ao(t,e){So.call(this,t,e),this.type="LineSegments"}function Lo(t,e){So.call(this,t,e),this.type="LineLoop"}function Ro(t){pi.call(this),this.type="PointsMaterial",this.color=new Tr(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Po(t,e){$r.call(this),this.type="Points",this.geometry=void 0!==t?t:new Un,this.material=void 0!==e?e:new Ro({color:16777215*Math.random()})}function Co(t,e,r,n,i,a,o,s,c){rr.call(this,t,e,r,n,i,a,o,s,c),this.generateMipmaps=!1}function Oo(t,e,r,n,i,a,o,s,c,h,l,u){rr.call(this,null,a,o,s,c,h,n,i,l,u),this.image={width:e,height:r},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Io(t,e,r,n,i,a,o,s,c){rr.call(this,t,e,r,n,i,a,o,s,c),this.needsUpdate=!0}function No(t,e,r,n,i,a,o,s,c,h){if((h=void 0!==h?h:$t)!==$t&&h!==te)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&h===$t&&(r=Ft),void 0===r&&h===te&&(r=Xt),rr.call(this,null,n,i,a,o,s,h,r,c),this.image={width:t,height:e},this.magFilter=void 0!==o?o:Rt,this.minFilter=void 0!==s?s:Rt,this.flipY=!1,this.generateMipmaps=!1}function Do(t){Un.call(this),this.type="WireframeGeometry";var e,r,n,i,a,o,s,c,h,l,u=[],p=[0,0],d={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,n=m.length;e<n;e++){var g=m[e];for(r=0;r<3;r++)s=g[f[r]],c=g[f[(r+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[h=p[0]+","+p[1]]&&(d[h]={index1:p[0],index2:p[1]})}for(h in d)o=d[h],l=t.vertices[o.index1],u.push(l.x,l.y,l.z),l=t.vertices[o.index2],u.push(l.x,l.y,l.z)}else if(t&&t.isBufferGeometry){var v,y,x,b,w,_;if(l=new We,null!==t.index){for(v=t.attributes.position,y=t.index,0===(x=t.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(n=(e=(b=x[i]).start)+b.count;e<n;e+=3)for(r=0;r<3;r++)s=y.getX(e+r),c=y.getX(e+(r+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[h=p[0]+","+p[1]]&&(d[h]={index1:p[0],index2:p[1]});for(h in d)o=d[h],l.fromBufferAttribute(v,o.index1),u.push(l.x,l.y,l.z),l.fromBufferAttribute(v,o.index2),u.push(l.x,l.y,l.z)}else for(e=0,n=(v=t.attributes.position).count/3;e<n;e++)for(r=0;r<3;r++)w=3*e+r,l.fromBufferAttribute(v,w),u.push(l.x,l.y,l.z),_=3*e+(r+1)%3,l.fromBufferAttribute(v,_),u.push(l.x,l.y,l.z)}this.addAttribute("position",new wn(u,3))}function Uo(t,e,r){pn.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r},this.fromBufferGeometry(new Bo(t,e,r)),this.mergeVertices()}function Bo(t,e,r){Un.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:r};var n,i,a=[],o=[],s=[],c=[],h=new We,l=new We,u=new We,p=new We,d=new We;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=e+1;for(n=0;n<=r;n++){var m=n/r;for(i=0;i<=e;i++){var g=i/e;t(g,m,l),o.push(l.x,l.y,l.z),0<=g-1e-5?(t(g-1e-5,m,u),p.subVectors(l,u)):(t(g+1e-5,m,u),p.subVectors(u,l)),0<=m-1e-5?(t(g,m-1e-5,u),d.subVectors(l,u)):(t(g,m+1e-5,u),d.subVectors(u,l)),h.crossVectors(p,d).normalize(),s.push(h.x,h.y,h.z),c.push(g,m)}}for(n=0;n<r;n++)for(i=0;i<e;i++){var v=n*f+i,y=n*f+i+1,x=(n+1)*f+i+1,b=(n+1)*f+i;a.push(v,y,b),a.push(y,x,b)}this.setIndex(a),this.addAttribute("position",new wn(o,3)),this.addAttribute("normal",new wn(s,3)),this.addAttribute("uv",new wn(c,2))}function Fo(t,e,r,n){pn.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:n},this.fromBufferGeometry(new zo(t,e,r,n)),this.mergeVertices()}function zo(n,a,t,e){Un.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:n,indices:a,radius:t,detail:e},t=t||1;var l=[],u=[];function o(t,e,r,n){var i,a,o=Math.pow(2,n),s=[];for(i=0;i<=o;i++){s[i]=[];var c=t.clone().lerp(r,i/o),h=e.clone().lerp(r,i/o),l=o-i;for(a=0;a<=l;a++)s[i][a]=0===a&&i===o?c:c.clone().lerp(h,a/l)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var u=Math.floor(a/2);a%2==0?(p(s[i][u+1]),p(s[i+1][u]),p(s[i][u])):(p(s[i][u+1]),p(s[i+1][u+1]),p(s[i+1][u]))}}function p(t){l.push(t.x,t.y,t.z)}function s(t,e){var r=3*t;e.x=n[r+0],e.y=n[r+1],e.z=n[r+2]}function d(t,e,r,n){n<0&&1===t.x&&(u[e]=t.x-1),0===r.x&&0===r.z&&(u[e]=n/2/Math.PI+.5)}function f(t){return Math.atan2(t.z,-t.x)}!function(t){for(var e=new We,r=new We,n=new We,i=0;i<a.length;i+=3)s(a[i+0],e),s(a[i+1],r),s(a[i+2],n),o(e,r,n,t)}(e=e||0),function(t){for(var e=new We,r=0;r<l.length;r+=3)e.x=l[r+0],e.y=l[r+1],e.z=l[r+2],e.normalize().multiplyScalar(t),l[r+0]=e.x,l[r+1]=e.y,l[r+2]=e.z}(t),function(){for(var t=new We,e=0;e<l.length;e+=3){t.x=l[e+0],t.y=l[e+1],t.z=l[e+2];var r=f(t)/2/Math.PI+.5,n=(i=t,Math.atan2(-i.y,Math.sqrt(i.x*i.x+i.z*i.z))/Math.PI+.5);u.push(r,1-n)}var i;(function(){for(var t=new We,e=new We,r=new We,n=new We,i=new Ve,a=new Ve,o=new Ve,s=0,c=0;s<l.length;s+=9,c+=6){t.set(l[s+0],l[s+1],l[s+2]),e.set(l[s+3],l[s+4],l[s+5]),r.set(l[s+6],l[s+7],l[s+8]),i.set(u[c+0],u[c+1]),a.set(u[c+2],u[c+3]),o.set(u[c+4],u[c+5]),n.copy(t).add(e).add(r).divideScalar(3);var h=f(n);d(i,c+0,t,h),d(a,c+2,e,h),d(o,c+4,r,h)}})(),function(){for(var t=0;t<u.length;t+=6){var e=u[t+0],r=u[t+2],n=u[t+4],i=Math.max(e,r,n),a=Math.min(e,r,n);.9<i&&a<.1&&(e<.2&&(u[t+0]+=1),r<.2&&(u[t+2]+=1),n<.2&&(u[t+4]+=1))}}()}(),this.addAttribute("position",new wn(l,3)),this.addAttribute("normal",new wn(l.slice(),3)),this.addAttribute("uv",new wn(u,2)),0===e?this.computeVertexNormals():this.normalizeNormals()}function Go(t,e){pn.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ho(t,e)),this.mergeVertices()}function Ho(t,e){zo.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],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Vo(t,e){pn.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ko(t,e)),this.mergeVertices()}function ko(t,e){zo.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],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function jo(t,e){pn.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Wo(t,e)),this.mergeVertices()}function Wo(t,e){var r=(1+Math.sqrt(5))/2;zo.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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xo(t,e){pn.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new qo(t,e)),this.mergeVertices()}function qo(t,e){var r=(1+Math.sqrt(5))/2,n=1/r;zo.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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],[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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Yo(t,e,r,n,i,a){pn.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:n,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Jo(t,e,r,n,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Jo(o,s,c,h,t){Un.call(this),this.type="TubeBufferGeometry",this.parameters={path:o,tubularSegments:s,radius:c,radialSegments:h,closed:t},s=s||64,c=c||1,h=h||8,t=t||!1;var l=o.computeFrenetFrames(s,t);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;var i,u,p=new We,d=new We,e=new Ve,f=new We,m=[],g=[],r=[],a=[];function n(t){f=o.getPointAt(t/s,f);var e=l.normals[t],r=l.binormals[t];for(u=0;u<=h;u++){var n=u/h*Math.PI*2,i=Math.sin(n),a=-Math.cos(n);d.x=a*e.x+i*r.x,d.y=a*e.y+i*r.y,d.z=a*e.z+i*r.z,d.normalize(),g.push(d.x,d.y,d.z),p.x=f.x+c*d.x,p.y=f.y+c*d.y,p.z=f.z+c*d.z,m.push(p.x,p.y,p.z)}}!function(){for(i=0;i<s;i++)n(i);n(!1===t?s:0),function(){for(i=0;i<=s;i++)for(u=0;u<=h;u++)e.x=i/s,e.y=u/h,r.push(e.x,e.y)}(),function(){for(u=1;u<=s;u++)for(i=1;i<=h;i++){var t=(h+1)*(u-1)+(i-1),e=(h+1)*u+(i-1),r=(h+1)*u+i,n=(h+1)*(u-1)+i;a.push(t,e,n),a.push(e,r,n)}}()}(),this.setIndex(a),this.addAttribute("position",new wn(m,3)),this.addAttribute("normal",new wn(g,3)),this.addAttribute("uv",new wn(r,2))}function Zo(t,e,r,n,i,a,o){pn.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:n,p:i,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Qo(t,e,r,n,i,a)),this.mergeVertices()}function Qo(t,e,r,n,i,a){Un.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:n,p:i,q:a},t=t||1,e=e||.4,r=Math.floor(r)||64,n=Math.floor(n)||8,i=i||2,a=a||3;var o,s,c=[],h=[],l=[],u=[],p=new We,d=new We,f=new We,m=new We,g=new We,v=new We,y=new We;for(o=0;o<=r;++o){var x=o/r*i*Math.PI*2;for(A(x,i,a,t,f),A(x+.01,i,a,t,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=n;++s){var b=s/n*Math.PI*2,w=-e*Math.cos(b),_=e*Math.sin(b);p.x=f.x+(w*y.x+_*g.x),p.y=f.y+(w*y.y+_*g.y),p.z=f.z+(w*y.z+_*g.z),h.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),l.push(d.x,d.y,d.z),u.push(o/r),u.push(s/n)}}for(s=1;s<=r;s++)for(o=1;o<=n;o++){var M=(n+1)*(s-1)+(o-1),E=(n+1)*s+(o-1),T=(n+1)*s+o,S=(n+1)*(s-1)+o;c.push(M,E,S),c.push(E,T,S)}function A(t,e,r,n,i){var a=Math.cos(t),o=Math.sin(t),s=r/e*t,c=Math.cos(s);i.x=n*(2+c)*.5*a,i.y=n*(2+c)*o*.5,i.z=n*Math.sin(s)*.5}this.setIndex(c),this.addAttribute("position",new wn(h,3)),this.addAttribute("normal",new wn(l,3)),this.addAttribute("uv",new wn(u,2))}function Ko(t,e,r,n,i){pn.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:n,arc:i},this.fromBufferGeometry(new $o(t,e,r,n,i)),this.mergeVertices()}function $o(t,e,r,n,i){Un.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:n,arc:i},t=t||1,e=e||.4,r=Math.floor(r)||8,n=Math.floor(n)||6,i=i||2*Math.PI;var a,o,s=[],c=[],h=[],l=[],u=new We,p=new We,d=new We;for(a=0;a<=r;a++)for(o=0;o<=n;o++){var f=o/n*i,m=a/r*Math.PI*2;p.x=(t+e*Math.cos(m))*Math.cos(f),p.y=(t+e*Math.cos(m))*Math.sin(f),p.z=e*Math.sin(m),c.push(p.x,p.y,p.z),u.x=t*Math.cos(f),u.y=t*Math.sin(f),d.subVectors(p,u).normalize(),h.push(d.x,d.y,d.z),l.push(o/n),l.push(a/r)}for(a=1;a<=r;a++)for(o=1;o<=n;o++){var g=(n+1)*a+o-1,v=(n+1)*(a-1)+o-1,y=(n+1)*(a-1)+o,x=(n+1)*a+o;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.addAttribute("position",new wn(c,3)),this.addAttribute("normal",new wn(h,3)),this.addAttribute("uv",new wn(l,2))}((eo.prototype=Object.create(pi.prototype)).constructor=eo).prototype.isMeshDepthMaterial=!0,eo.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},((ro.prototype=Object.create(pi.prototype)).constructor=ro).prototype.isMeshDistanceMaterial=!0,ro.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},so.prototype=Object.assign(Object.create($r.prototype),{constructor:so,isGroup:!0}),co.prototype=Object.assign(Object.create(tn.prototype),{constructor:co,isPerspectiveCamera:!0,copy:function(t,e){return tn.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*He.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*He.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*He.RAD2DEG*Math.atan(Math.tan(.5*He.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,r,n,i,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*He.DEG2RAD*this.fov)/this.zoom,r=2*e,n=this.aspect*r,i=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*n/o,e-=a.offsetY*r/s,n*=a.width/o,r*=a.height/s}var c=this.filmOffset;0!==c&&(i+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+n,e,e-r,t,this.far)},toJSON:function(t){var e=$r.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),ho.prototype=Object.assign(Object.create(co.prototype),{constructor:ho,isArrayCamera:!0}),fo.prototype.isFogExp2=!0,fo.prototype.clone=function(){return new fo(this.color,this.density)},fo.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},mo.prototype.isFog=!0,mo.prototype.clone=function(){return new mo(this.color,this.near,this.far)},mo.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},go.prototype=Object.assign(Object.create($r.prototype),{constructor:go,copy:function(t,e){return $r.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=$r.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),Object.defineProperty(vo.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(vo.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.stride:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var n=0,i=this.stride;n<i;n++)this.array[t+n]=e.array[r+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Object.defineProperties(yo.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(yo.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=n,this},setXYZW:function(t,e,r,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=n,this.data.array[t+3]=i,this}}),((xo.prototype=Object.create(pi.prototype)).constructor=xo).prototype.isSpriteMaterial=!0,xo.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},bo.prototype=Object.assign(Object.create($r.prototype),{constructor:bo,isSprite:!0,raycast:function(){var c=new We,h=new We,l=new We,o=new Ve,s=new Ve,u=new ke,p=new We,d=new We,f=new We;function m(t,e,r,n,i,a){o.subVectors(t,r).addScalar(.5).multiply(n),void 0!==i?(s.x=a*o.x-i*o.y,s.y=i*o.x+a*o.y):s.copy(o),t.copy(e),t.x+=s.x,t.y+=s.y,t.applyMatrix4(u)}return function(t,e){h.setFromMatrixScale(this.matrixWorld),u.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),l.setFromMatrixPosition(this.modelViewMatrix);var r,n,i=this.material.rotation;0!==i&&(n=Math.cos(i),r=Math.sin(i));var a=this.center;m(p.set(-.5,-.5,0),l,a,h,r,n),m(d.set(.5,-.5,0),l,a,h,r,n),m(f.set(.5,.5,0),l,a,h,r,n);var o=t.ray.intersectTriangle(p,d,f,!1,c);if(null!==o||(m(d.set(-.5,.5,0),l,a,h,r,n),null!==(o=t.ray.intersectTriangle(p,f,d,!1,c)))){var s=t.ray.origin.distanceTo(c);s<t.near||s>t.far||e.push({distance:s,point:c.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return $r.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),wo.prototype=Object.assign(Object.create($r.prototype),{constructor:wo,copy:function(t){$r.prototype.copy.call(this,t,!1);for(var e=t.levels,r=0,n=e.length;r<n;r++){var i=e[r];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,n=0;n<r.length&&!(e<r[n].distance);n++);r.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,r=1,n=e.length;r<n&&!(t<e[r].distance);r++);return e[r-1].object},raycast:(Fa=new We,function(t,e){Fa.setFromMatrixPosition(this.matrixWorld);var r=t.ray.origin.distanceTo(Fa);this.getObjectForDistance(r).raycast(t,e)}),update:(Ua=new We,Ba=new We,function(t){var e=this.levels;if(1<e.length){Ua.setFromMatrixPosition(t.matrixWorld),Ba.setFromMatrixPosition(this.matrixWorld);var r=Ua.distanceTo(Ba);e[0].object.visible=!0;for(var n=1,i=e.length;n<i&&r>=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(;n<i;n++)e[n].object.visible=!1}}),toJSON:function(t){var e=$r.prototype.toJSON.call(this,t);e.object.levels=[];for(var r=this.levels,n=0,i=r.length;n<i;n++){var a=r[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),Object.assign(_o.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new ke;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},pose:function(){var t,e,r;for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:(za=new ke,Ga=new ke,function(){for(var t=this.bones,e=this.boneInverses,r=this.boneMatrices,n=this.boneTexture,i=0,a=t.length;i<a;i++){var o=t[i]?t[i].matrixWorld:Ga;za.multiplyMatrices(o,e[i]),za.toArray(r,16*i)}void 0!==n&&(n.needsUpdate=!0)}),clone:function(){return new _o(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,r=this.bones.length;e<r;e++){var n=this.bones[e];if(n.name===t)return n}}}),Mo.prototype=Object.assign(Object.create($r.prototype),{constructor:Mo,isBone:!0}),Eo.prototype=Object.assign(Object.create(vi.prototype),{constructor:Eo,isSkinnedMesh:!0,initBones:function(){var t,e,r,n,i=[];if(this.geometry&&void 0!==this.geometry.bones){for(r=0,n=this.geometry.bones.length;r<n;r++)e=this.geometry.bones[r],t=new Mo,i.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(r=0,n=this.geometry.bones.length;r<n;r++)-1!==(e=this.geometry.bones[r]).parent&&null!==e.parent&&void 0!==i[e.parent]?i[e.parent].add(i[r]):this.add(i[r])}return this.updateMatrixWorld(!0),i},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var r=this.geometry.skinWeights[e];(t=1/r.manhattanLength())!==1/0?r.multiplyScalar(t):r.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var n=new nr,i=this.geometry.attributes.skinWeight;for(e=0;e<i.count;e++)n.x=i.getX(e),n.y=i.getY(e),n.z=i.getZ(e),n.w=i.getW(e),(t=1/n.manhattanLength())!==1/0?n.multiplyScalar(t):n.set(1,0,0,0),i.setXYZW(e,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(t){vi.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((To.prototype=Object.create(pi.prototype)).constructor=To).prototype.isLineBasicMaterial=!0,To.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},So.prototype=Object.assign(Object.create($r.prototype),{constructor:So,isLine:!0,computeLineDistances:(ja=new We,Wa=new We,function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,r=[0],n=1,i=e.count;n<i;n++)ja.fromBufferAttribute(e,n-1),Wa.fromBufferAttribute(e,n),r[n]=r[n-1],r[n]+=ja.distanceTo(Wa);t.addAttribute("lineDistance",new wn(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var a=t.vertices;for((r=t.lineDistances)[0]=0,n=1,i=a.length;n<i;n++)r[n]=r[n-1],r[n]+=a[n-1].distanceTo(a[n])}return this}),raycast:(Ha=new ke,Va=new mi,ka=new yr,function(t,e){var r=t.linePrecision,n=r*r,i=this.geometry,a=this.matrixWorld;if(null===i.boundingSphere&&i.computeBoundingSphere(),ka.copy(i.boundingSphere),ka.applyMatrix4(a),!1!==t.ray.intersectsSphere(ka)){Ha.getInverse(a),Va.copy(t.ray).applyMatrix4(Ha);var o=new We,s=new We,c=new We,h=new We,l=this&&this.isLineSegments?2:1;if(i.isBufferGeometry){var u=i.index,p=i.attributes.position.array;if(null!==u)for(var d=u.array,f=0,m=d.length-1;f<m;f+=l){var g=d[f],v=d[f+1];o.fromArray(p,3*g),s.fromArray(p,3*v),n<Va.distanceSqToSegment(o,s,h,c)||(h.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(h))<t.near||b>t.far||e.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else for(f=0,m=p.length/3-1;f<m;f+=l)o.fromArray(p,3*f),s.fromArray(p,3*f+3),n<Va.distanceSqToSegment(o,s,h,c)||(h.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(h))<t.near||b>t.far||e.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else if(i.isGeometry){var y=i.vertices,x=y.length;for(f=0;f<x-1;f+=l){var b;n<Va.distanceSqToSegment(y[f],y[f+1],h,c)||(h.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(h))<t.near||b>t.far||e.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ao.prototype=Object.assign(Object.create(So.prototype),{constructor:Ao,isLineSegments:!0,computeLineDistances:(Xa=new We,qa=new We,function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,r=[],n=0,i=e.count;n<i;n+=2)Xa.fromBufferAttribute(e,n),qa.fromBufferAttribute(e,n+1),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+Xa.distanceTo(qa);t.addAttribute("lineDistance",new wn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var a=t.vertices;for(r=t.lineDistances,n=0,i=a.length;n<i;n+=2)Xa.copy(a[n]),qa.copy(a[n+1]),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+Xa.distanceTo(qa)}return this})}),Lo.prototype=Object.assign(Object.create(So.prototype),{constructor:Lo,isLineLoop:!0}),((Ro.prototype=Object.create(pi.prototype)).constructor=Ro).prototype.isPointsMaterial=!0,Ro.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this},Po.prototype=Object.assign(Object.create($r.prototype),{constructor:Po,isPoints:!0,raycast:(Ya=new ke,Ja=new mi,Za=new yr,function(i,a){var o=this,t=this.geometry,s=this.matrixWorld,e=i.params.Points.threshold;if(null===t.boundingSphere&&t.computeBoundingSphere(),Za.copy(t.boundingSphere),Za.applyMatrix4(s),Za.radius+=e,!1!==i.ray.intersectsSphere(Za)){Ya.getInverse(s),Ja.copy(i.ray).applyMatrix4(Ya);var r=e/((this.scale.x+this.scale.y+this.scale.z)/3),c=r*r,n=new We,h=new We;if(t.isBufferGeometry){var l=t.index,u=t.attributes.position.array;if(null!==l)for(var p=l.array,d=0,f=p.length;d<f;d++){var m=p[d];n.fromArray(u,3*m),y(n,m)}else{d=0;for(var g=u.length/3;d<g;d++)n.fromArray(u,3*d),y(n,d)}}else{var v=t.vertices;for(d=0,g=v.length;d<g;d++)y(v[d],d)}}function y(t,e){var r=Ja.distanceSqToPoint(t);if(r<c){Ja.closestPointToPoint(t,h),h.applyMatrix4(s);var n=i.ray.origin.distanceTo(h);if(n<i.near||n>i.far)return;a.push({distance:n,distanceToRay:Math.sqrt(r),point:h.clone(),index:e,face:null,object:o})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Co.prototype=Object.assign(Object.create(rr.prototype),{constructor:Co,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((Oo.prototype=Object.create(rr.prototype)).constructor=Oo).prototype.isCompressedTexture=!0,((Io.prototype=Object.create(rr.prototype)).constructor=Io).prototype.isCanvasTexture=!0,((No.prototype=Object.create(rr.prototype)).constructor=No).prototype.isDepthTexture=!0,(Do.prototype=Object.create(Un.prototype)).constructor=Do,(Uo.prototype=Object.create(pn.prototype)).constructor=Uo,(Bo.prototype=Object.create(Un.prototype)).constructor=Bo,(Fo.prototype=Object.create(pn.prototype)).constructor=Fo,(zo.prototype=Object.create(Un.prototype)).constructor=zo,(Go.prototype=Object.create(pn.prototype)).constructor=Go,(Ho.prototype=Object.create(zo.prototype)).constructor=Ho,(Vo.prototype=Object.create(pn.prototype)).constructor=Vo,(ko.prototype=Object.create(zo.prototype)).constructor=ko,(jo.prototype=Object.create(pn.prototype)).constructor=jo,(Wo.prototype=Object.create(zo.prototype)).constructor=Wo,(Xo.prototype=Object.create(pn.prototype)).constructor=Xo,(qo.prototype=Object.create(zo.prototype)).constructor=qo,(Yo.prototype=Object.create(pn.prototype)).constructor=Yo,(Jo.prototype=Object.create(Un.prototype)).constructor=Jo,(Zo.prototype=Object.create(pn.prototype)).constructor=Zo,(Qo.prototype=Object.create(Un.prototype)).constructor=Qo,(Ko.prototype=Object.create(pn.prototype)).constructor=Ko,($o.prototype=Object.create(Un.prototype)).constructor=$o;var ts=function(t,e,r){r=r||2;var n,i,a,o,s,c,h,l=e&&e.length,u=l?e[0]*r:t.length,p=es(t,0,u,r,!0),d=[];if(!p)return d;if(l&&(p=function(t,e,r,n){var i,a,o,s,c,h=[];for(i=0,a=e.length;i<a;i++)o=e[i]*n,s=i<a-1?e[i+1]*n:t.length,(c=es(t,o,s,n,!1))===c.next&&(c.steiner=!0),h.push(us(c));for(h.sort(cs),i=0;i<h.length;i++)hs(h[i],r),r=rs(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],i=o=t[1];for(var f=r;f<u;f+=r)(s=t[f])<n&&(n=s),(c=t[f+1])<i&&(i=c),a<s&&(a=s),o<c&&(o=c);h=0!==(h=Math.max(a-n,o-i))?1/h:0}return ns(p,d,r,n,i,h),d};function es(t,e,r,n,i){var a,o;if(i===0<function(t,e,r,n){for(var i=0,a=e,o=r-n;a<r;a+=n)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}(t,e,r,n))for(a=e;a<r;a+=n)o=ys(a,t[a],t[a+1],o);else for(a=r-n;e<=a;a-=n)o=ys(a,t[a],t[a+1],o);return o&&fs(o,o.next)&&(xs(o),o=o.next),o}function rs(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!fs(n,n.next)&&0!==ds(n.prev,n,n.next))n=n.next;else{if(xs(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ns(t,e,r,n,i,a,o){if(t){!o&&a&&function(t,e,r,n){var i=t;for(;null===i.z&&(i.z=ls(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next,i!==t;);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,c,h=1;do{for(r=t,a=t=null,o=0;r;){for(o++,n=r,e=s=0;e<h&&(s++,n=n.nextZ);e++);for(c=h;0<s||0<c&&n;)0!==s&&(0===c||!n||r.z<=n.z)?(r=(i=r).nextZ,s--):(n=(i=n).nextZ,c--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,h*=2}while(1<o)}(i)}(t,n,i,a);for(var s,c,h=t;t.prev!==t.next;)if(s=t.prev,c=t.next,a?as(t,n,i,a):is(t))e.push(s.i/r),e.push(t.i/r),e.push(c.i/r),xs(t),t=c.next,h=c.next;else if((t=c)===h){o?1===o?ns(t=os(t,e,r),e,r,n,i,a,2):2===o&&ss(t,e,r,n,i,a):ns(rs(t),e,r,n,i,a,1);break}}}function is(t){var e=t.prev,r=t,n=t.next;if(0<=ds(e,r,n))return!1;for(var i=t.next.next;i!==t.prev;){if(ps(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&0<=ds(i.prev,i,i.next))return!1;i=i.next}return!0}function as(t,e,r,n){var i=t.prev,a=t,o=t.next;if(0<=ds(i,a,o))return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,h=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,l=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,u=ls(s,c,e,r,n),p=ls(h,l,e,r,n),d=t.nextZ;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&ps(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=ds(d.prev,d,d.next))return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&ps(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=ds(d.prev,d,d.next))return!1;d=d.prevZ}return!0}function os(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!fs(i,a)&&ms(i,n,n.next,a)&&gs(i,a)&&gs(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),xs(n),xs(n.next),n=t=a),n=n.next}while(n!==t);return n}function ss(t,e,r,n,i,a){var o,s,c=t;do{for(var h=c.next.next;h!==c.prev;){if(c.i!==h.i&&(s=h,(o=c).next.i!==s.i&&o.prev.i!==s.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ms(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(o,s)&&gs(o,s)&&gs(s,o)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;for(;r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next,r!==t;);return n}(o,s))){var l=vs(c,h);return c=rs(c,c.next),l=rs(l,l.next),ns(c,e,r,n,i,a),void ns(l,e,r,n,i,a)}h=h.next}c=c.next}while(c!==t)}function cs(t,e){return t.x-e.x}function hs(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&o<s){if((o=s)===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===o)return r.prev;var c,h=r,l=r.x,u=r.y,p=1/0;n=r.next;for(;n!==h;)i>=n.x&&n.x>=l&&i!==n.x&&ps(a<u?i:o,a,l,u,a<u?o:i,a,n.x,n.y)&&((c=Math.abs(a-n.y)/(i-n.x))<p||c===p&&n.x>r.x)&&gs(n,t)&&(r=n,p=c),n=n.next;return r}(t,e)){var r=vs(e,t);rs(r,r.next)}}function ls(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function us(t){for(var e=t,r=t;e.x<r.x&&(r=e),(e=e.next)!==t;);return r}function ps(t,e,r,n,i,a,o,s){return 0<=(i-o)*(e-s)-(t-o)*(a-s)&&0<=(t-o)*(n-s)-(r-o)*(e-s)&&0<=(r-o)*(a-s)-(i-o)*(n-s)}function ds(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function fs(t,e){return t.x===e.x&&t.y===e.y}function ms(t,e,r,n){return!!(fs(t,e)&&fs(r,n)||fs(t,n)&&fs(r,e))||0<ds(t,e,r)!=0<ds(t,e,n)&&0<ds(r,n,t)!=0<ds(r,n,e)}function gs(t,e){return ds(t.prev,t,t.next)<0?0<=ds(t,e,t.next)&&0<=ds(t,t.prev,e):ds(t,e,t.prev)<0||ds(t,t.next,e)<0}function vs(t,e){var r=new bs(t.i,t.x,t.y),n=new bs(e.i,e.x,e.y),i=t.next,a=e.prev;return(t.next=e).prev=t,(r.next=i).prev=r,(n.next=r).prev=n,(a.next=n).prev=a,n}function ys(t,e,r,n){var i=new bs(t,e,r);return n?(i.next=n.next,(i.prev=n).next.prev=i,n.next=i):(i.prev=i).next=i,i}function xs(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function bs(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ws={area:function(t){for(var e=t.length,r=0,n=e-1,i=0;i<e;n=i++)r+=t[n].x*t[i].y-t[i].x*t[n].y;return.5*r},isClockWise:function(t){return ws.area(t)<0},triangulateShape:function(t,e){var r=[],n=[],i=[];_s(t),Ms(r,t);var a=t.length;e.forEach(_s);for(var o=0;o<e.length;o++)n.push(a),a+=e[o].length,Ms(r,e[o]);var s=ts(r,n);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function _s(t){var e=t.length;2<e&&t[e-1].equals(t[0])&&t.pop()}function Ms(t,e){for(var r=0;r<e.length;r++)t.push(e[r].x),t.push(e[r].y)}function Es(t,e){pn.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new Ts(t,e)),this.mergeVertices()}function Ts(t,Z){Un.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:Z},t=Array.isArray(t)?t:[t];for(var Q=this,K=[],$=[],e=0,r=t.length;e<r;e++){n(t[e])}function n(t){var n=[],e=void 0!==Z.curveSegments?Z.curveSegments:12,c=void 0!==Z.steps?Z.steps:1,r=void 0!==Z.depth?Z.depth:100,i=void 0===Z.bevelEnabled||Z.bevelEnabled,a=void 0!==Z.bevelThickness?Z.bevelThickness:6,o=void 0!==Z.bevelSize?Z.bevelSize:a-2,h=void 0!==Z.bevelSegments?Z.bevelSegments:3,s=Z.extrudePath,l=void 0!==Z.UVGenerator?Z.UVGenerator:Ss;void 0!==Z.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),r=Z.amount);var u,p,d,f,m,g,v,y,x=!1;s&&(u=s.getSpacedPoints(c),i=!(x=!0),p=s.computeFrenetFrames(c,!1),d=new We,f=new We,m=new We),i||(o=a=h=0);var b=t.extractPoints(e),w=b.shape,_=b.holes;if(!ws.isClockWise(w))for(w=w.reverse(),v=0,y=_.length;v<y;v++)g=_[v],ws.isClockWise(g)&&(_[v]=g.reverse());var M=ws.triangulateShape(w,_),E=w;for(v=0,y=_.length;v<y;v++)g=_[v],w=w.concat(g);function T(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}var S,A,L,R,P,C,O=w.length,I=M.length;function N(t,e,r){var n,i,a,o=t.x-e.x,s=t.y-e.y,c=r.x-t.x,h=r.y-t.y,l=o*o+s*s,u=o*h-s*c;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(l),d=Math.sqrt(c*c+h*h),f=e.x-s/p,m=e.y+o/p,g=((r.x-h/d-f)*h-(r.y+c/d-m)*c)/(o*h-s*c),v=(n=f+o*g-t.x)*n+(i=m+s*g-t.y)*i;if(v<=2)return new Ve(n,i);a=Math.sqrt(v/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(h)&&(y=!0),y?(n=-s,i=o,a=Math.sqrt(l)):(n=o,i=s,a=Math.sqrt(l/2))}return new Ve(n/a,i/a)}for(var D=[],U=0,B=E.length,F=B-1,z=U+1;U<B;U++,F++,z++)F===B&&(F=0),z===B&&(z=0),D[U]=N(E[U],E[F],E[z]);var G,H,V=[],k=D.concat();for(v=0,y=_.length;v<y;v++){for(g=_[v],G=[],U=0,F=(B=g.length)-1,z=U+1;U<B;U++,F++,z++)F===B&&(F=0),z===B&&(z=0),G[U]=N(g[U],g[F],g[z]);V.push(G),k=k.concat(G)}for(S=0;S<h;S++){for(L=S/h,R=a*Math.cos(L*Math.PI/2),A=o*Math.sin(L*Math.PI/2),U=0,B=E.length;U<B;U++)W((P=T(E[U],D[U],A)).x,P.y,-R);for(v=0,y=_.length;v<y;v++)for(g=_[v],G=V[v],U=0,B=g.length;U<B;U++)W((P=T(g[U],G[U],A)).x,P.y,-R)}for(A=o,U=0;U<O;U++)P=i?T(w[U],k[U],A):w[U],x?(f.copy(p.normals[0]).multiplyScalar(P.x),d.copy(p.binormals[0]).multiplyScalar(P.y),m.copy(u[0]).add(f).add(d),W(m.x,m.y,m.z)):W(P.x,P.y,0);for(H=1;H<=c;H++)for(U=0;U<O;U++)P=i?T(w[U],k[U],A):w[U],x?(f.copy(p.normals[H]).multiplyScalar(P.x),d.copy(p.binormals[H]).multiplyScalar(P.y),m.copy(u[H]).add(f).add(d),W(m.x,m.y,m.z)):W(P.x,P.y,r/c*H);for(S=h-1;0<=S;S--){for(L=S/h,R=a*Math.cos(L*Math.PI/2),A=o*Math.sin(L*Math.PI/2),U=0,B=E.length;U<B;U++)W((P=T(E[U],D[U],A)).x,P.y,r+R);for(v=0,y=_.length;v<y;v++)for(g=_[v],G=V[v],U=0,B=g.length;U<B;U++)P=T(g[U],G[U],A),x?W(P.x,P.y+u[c-1].y,u[c-1].x+R):W(P.x,P.y,r+R)}function j(t,e){var r,n;for(U=t.length;0<=--U;){(n=(r=U)-1)<0&&(n=t.length-1);var i=0,a=c+2*h;for(i=0;i<a;i++){var o=O*i,s=O*(i+1);q(e+r+o,e+n+o,e+n+s,e+r+s)}}}function W(t,e,r){n.push(t),n.push(e),n.push(r)}function X(t,e,r){Y(t),Y(e),Y(r);var n=K.length/3,i=l.generateTopUV(Q,K,n-3,n-2,n-1);J(i[0]),J(i[1]),J(i[2])}function q(t,e,r,n){Y(t),Y(e),Y(n),Y(e),Y(r),Y(n);var i=K.length/3,a=l.generateSideWallUV(Q,K,i-6,i-3,i-2,i-1);J(a[0]),J(a[1]),J(a[3]),J(a[1]),J(a[2]),J(a[3])}function Y(t){K.push(n[3*t+0]),K.push(n[3*t+1]),K.push(n[3*t+2])}function J(t){$.push(t.x),$.push(t.y)}!function(){var t=K.length/3;if(i){var e=0,r=O*e;for(U=0;U<I;U++)X((C=M[U])[2]+r,C[1]+r,C[0]+r);for(r=O*(e=c+2*h),U=0;U<I;U++)X((C=M[U])[0]+r,C[1]+r,C[2]+r)}else{for(U=0;U<I;U++)X((C=M[U])[2],C[1],C[0]);for(U=0;U<I;U++)X((C=M[U])[0]+O*c,C[1]+O*c,C[2]+O*c)}Q.addGroup(t,K.length/3-t,0)}(),function(){var t=K.length/3,e=0;for(j(E,e),e+=E.length,v=0,y=_.length;v<y;v++)j(g=_[v],e),e+=g.length;Q.addGroup(t,K.length/3-t,1)}()}this.addAttribute("position",new wn(K,3)),this.addAttribute("uv",new wn($,2)),this.computeVertexNormals()}((Es.prototype=Object.create(pn.prototype)).constructor=Es).prototype.toJSON=function(){var t=pn.prototype.toJSON.call(this);return As(this.parameters.shapes,this.parameters.options,t)},((Ts.prototype=Object.create(Un.prototype)).constructor=Ts).prototype.toJSON=function(){var t=Un.prototype.toJSON.call(this);return As(this.parameters.shapes,this.parameters.options,t)};var Ss={generateTopUV:function(t,e,r,n,i){var a=e[3*r],o=e[3*r+1],s=e[3*n],c=e[3*n+1],h=e[3*i],l=e[3*i+1];return[new Ve(a,o),new Ve(s,c),new Ve(h,l)]},generateSideWallUV:function(t,e,r,n,i,a){var o=e[3*r],s=e[3*r+1],c=e[3*r+2],h=e[3*n],l=e[3*n+1],u=e[3*n+2],p=e[3*i],d=e[3*i+1],f=e[3*i+2],m=e[3*a],g=e[3*a+1],v=e[3*a+2];return Math.abs(s-l)<.01?[new Ve(o,1-c),new Ve(h,1-u),new Ve(p,1-f),new Ve(m,1-v)]:[new Ve(s,1-c),new Ve(l,1-u),new Ve(d,1-f),new Ve(g,1-v)]}};function As(t,e,r){if(r.shapes=[],Array.isArray(t))for(var n=0,i=t.length;n<i;n++){var a=t[n];r.shapes.push(a.uuid)}else r.shapes.push(t.uuid);return void 0!==e.extrudePath&&(r.options.extrudePath=e.extrudePath.toJSON()),r}function Ls(t,e){pn.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new Rs(t,e)),this.mergeVertices()}function Rs(t,e){var r=(e=e||{}).font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new pn;var n=r.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),Ts.call(this,n,e),this.type="TextBufferGeometry"}function Ps(t,e,r,n,i,a,o){pn.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Cs(t,e,r,n,i,a,o)),this.mergeVertices()}function Cs(t,e,r,n,i,a,o){Un.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},t=t||1,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var s,c,h=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),l=0,u=[],p=new We,d=new We,f=[],m=[],g=[],v=[];for(c=0;c<=r;c++){var y=[],x=c/r;for(s=0;s<=e;s++){var b=s/e;p.x=-t*Math.cos(n+b*i)*Math.sin(a+x*o),p.y=t*Math.cos(a+x*o),p.z=t*Math.sin(n+b*i)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.set(p.x,p.y,p.z).normalize(),g.push(d.x,d.y,d.z),v.push(b,1-x),y.push(l++)}u.push(y)}for(c=0;c<r;c++)for(s=0;s<e;s++){var w=u[c][s+1],_=u[c][s],M=u[c+1][s],E=u[c+1][s+1];(0!==c||0<a)&&f.push(w,_,E),(c!==r-1||h<Math.PI)&&f.push(_,M,E)}this.setIndex(f),this.addAttribute("position",new wn(m,3)),this.addAttribute("normal",new wn(g,3)),this.addAttribute("uv",new wn(v,2))}function Os(t,e,r,n,i,a){pn.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Is(t,e,r,n,i,a)),this.mergeVertices()}function Is(t,e,r,n,i,a){Un.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},t=t||.5,e=e||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var o,s,c,h=[],l=[],u=[],p=[],d=t,f=(e-t)/(n=void 0!==n?Math.max(1,n):1),m=new We,g=new Ve;for(s=0;s<=n;s++){for(c=0;c<=r;c++)o=i+c/r*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),l.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/e+1)/2,g.y=(m.y/e+1)/2,p.push(g.x,g.y);d+=f}for(s=0;s<n;s++){var v=s*(r+1);for(c=0;c<r;c++){var y=o=c+v,x=o+r+1,b=o+r+2,w=o+1;h.push(y,x,w),h.push(x,b,w)}}this.setIndex(h),this.addAttribute("position",new wn(l,3)),this.addAttribute("normal",new wn(u,3)),this.addAttribute("uv",new wn(p,2))}function Ns(t,e,r,n){pn.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:n},this.fromBufferGeometry(new Ds(t,e,r,n)),this.mergeVertices()}function Ds(t,e,r,n){Un.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:n},e=Math.floor(e)||12,r=r||0,n=n||2*Math.PI,n=He.clamp(n,0,2*Math.PI);var i,a,o,s=[],c=[],h=[],l=1/e,u=new We,p=new Ve;for(a=0;a<=e;a++){var d=r+a*l*n,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=t.length-1;o++)u.x=t[o].x*f,u.y=t[o].y,u.z=t[o].x*m,c.push(u.x,u.y,u.z),p.x=a/e,p.y=o/(t.length-1),h.push(p.x,p.y)}for(a=0;a<e;a++)for(o=0;o<t.length-1;o++){var g=i=o+a*t.length,v=i+t.length,y=i+t.length+1,x=i+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.addAttribute("position",new wn(c,3)),this.addAttribute("uv",new wn(h,2)),this.computeVertexNormals(),n===2*Math.PI){var b=this.attributes.normal.array,w=new We,_=new We,M=new We;for(i=e*t.length*3,o=a=0;a<t.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[i+o+0],_.y=b[i+o+1],_.z=b[i+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[i+o+0]=M.x,b[o+1]=b[i+o+1]=M.y,b[o+2]=b[i+o+2]=M.z}}function Us(t,e){pn.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new Bs(t,e)),this.mergeVertices()}function Bs(t,f){Un.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:f},f=f||12;var m=[],g=[],v=[],y=[],e=0,x=0;if(!1===Array.isArray(t))n(t);else for(var r=0;r<t.length;r++)n(t[r]),this.addGroup(e,x,r),e+=x,x=0;function n(t){var e,r,n,i=g.length/3,a=t.extractPoints(f),o=a.shape,s=a.holes;if(!1===ws.isClockWise(o))for(o=o.reverse(),e=0,r=s.length;e<r;e++)n=s[e],!0===ws.isClockWise(n)&&(s[e]=n.reverse());var c=ws.triangulateShape(o,s);for(e=0,r=s.length;e<r;e++)n=s[e],o=o.concat(n);for(e=0,r=o.length;e<r;e++){var h=o[e];g.push(h.x,h.y,0),v.push(0,0,1),y.push(h.x,h.y)}for(e=0,r=c.length;e<r;e++){var l=c[e],u=l[0]+i,p=l[1]+i,d=l[2]+i;m.push(u,p,d),x+=3}}this.setIndex(m),this.addAttribute("position",new wn(g,3)),this.addAttribute("normal",new wn(v,3)),this.addAttribute("uv",new wn(y,2))}function Fs(t,e){if(e.shapes=[],Array.isArray(t))for(var r=0,n=t.length;r<n;r++){var i=t[r];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}function zs(t,e){Un.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var r,n,i,a,o=[],s=Math.cos(He.DEG2RAD*e),c=[0,0],h={},l=["a","b","c"];t.isBufferGeometry?(a=new pn).fromBufferGeometry(t):a=t.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],g=0;g<3;g++)r=m[l[g]],n=m[l[(g+1)%3]],c[0]=Math.min(r,n),c[1]=Math.max(r,n),void 0===h[i=c[0]+","+c[1]]?h[i]={index1:c[0],index2:c[1],face1:d,face2:void 0}:h[i].face2=d;for(i in h){var v=h[i];if(void 0===v.face2||p[v.face1].normal.dot(p[v.face2].normal)<=s){var y=u[v.index1];o.push(y.x,y.y,y.z),y=u[v.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new wn(o,3))}function Gs(t,e,r,n,i,a,o,s){pn.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Hs(t,e,r,n,i,a,o,s)),this.mergeVertices()}function Hs(v,y,x,b,w,t,_,M){Un.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:v,radiusBottom:y,height:x,radialSegments:b,heightSegments:w,openEnded:t,thetaStart:_,thetaLength:M};var E=this;v=void 0!==v?v:1,y=void 0!==y?y:1,x=x||1,b=Math.floor(b)||8,w=Math.floor(w)||1,t=void 0!==t&&t,_=void 0!==_?_:0,M=void 0!==M?M:2*Math.PI;var T=[],S=[],A=[],L=[],R=0,P=[],C=x/2,O=0;function e(t){var e,r,n,i=new Ve,a=new We,o=0,s=!0===t?v:y,c=!0===t?1:-1;for(r=R,e=1;e<=b;e++)S.push(0,C*c,0),A.push(0,c,0),L.push(.5,.5),R++;for(n=R,e=0;e<=b;e++){var h=e/b*M+_,l=Math.cos(h),u=Math.sin(h);a.x=s*u,a.y=C*c,a.z=s*l,S.push(a.x,a.y,a.z),A.push(0,c,0),i.x=.5*l+.5,i.y=.5*u*c+.5,L.push(i.x,i.y),R++}for(e=0;e<b;e++){var p=r+e,d=n+e;!0===t?T.push(d,d+1,p):T.push(d+1,d,p),o+=3}E.addGroup(O,o,!0===t?1:2),O+=o}!function(){var t,e,r=new We,n=new We,i=0,a=(y-v)/x;for(e=0;e<=w;e++){var o=[],s=e/w,c=s*(y-v)+v;for(t=0;t<=b;t++){var h=t/b,l=h*M+_,u=Math.sin(l),p=Math.cos(l);n.x=c*u,n.y=-s*x+C,n.z=c*p,S.push(n.x,n.y,n.z),r.set(u,a,p).normalize(),A.push(r.x,r.y,r.z),L.push(h,1-s),o.push(R++)}P.push(o)}for(t=0;t<b;t++)for(e=0;e<w;e++){var d=P[e][t],f=P[e+1][t],m=P[e+1][t+1],g=P[e][t+1];T.push(d,f,g),T.push(f,m,g),i+=6}E.addGroup(O,i,0),O+=i}(),!1===t&&(0<v&&e(!0),0<y&&e(!1)),this.setIndex(T),this.addAttribute("position",new wn(S,3)),this.addAttribute("normal",new wn(A,3)),this.addAttribute("uv",new wn(L,2))}function Vs(t,e,r,n,i,a,o){Gs.call(this,0,t,e,r,n,i,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function ks(t,e,r,n,i,a,o){Hs.call(this,0,t,e,r,n,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function js(t,e,r,n){pn.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new Ws(t,e,r,n)),this.mergeVertices()}function Ws(t,e,r,n){Un.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var i,a,o=[],s=[],c=[],h=[],l=new We,u=new Ve;for(s.push(0,0,0),c.push(0,0,1),h.push(.5,.5),a=0,i=3;a<=e;a++,i+=3){var p=r+a/e*n;l.x=t*Math.cos(p),l.y=t*Math.sin(p),s.push(l.x,l.y,l.z),c.push(0,0,1),u.x=(s[i]/t+1)/2,u.y=(s[i+1]/t+1)/2,h.push(u.x,u.y)}for(i=1;i<=e;i++)o.push(i,i+1,0);this.setIndex(o),this.addAttribute("position",new wn(s,3)),this.addAttribute("normal",new wn(c,3)),this.addAttribute("uv",new wn(h,2))}(Ls.prototype=Object.create(pn.prototype)).constructor=Ls,(Rs.prototype=Object.create(Ts.prototype)).constructor=Rs,(Ps.prototype=Object.create(pn.prototype)).constructor=Ps,(Cs.prototype=Object.create(Un.prototype)).constructor=Cs,(Os.prototype=Object.create(pn.prototype)).constructor=Os,(Is.prototype=Object.create(Un.prototype)).constructor=Is,(Ns.prototype=Object.create(pn.prototype)).constructor=Ns,(Ds.prototype=Object.create(Un.prototype)).constructor=Ds,((Us.prototype=Object.create(pn.prototype)).constructor=Us).prototype.toJSON=function(){var t=pn.prototype.toJSON.call(this);return Fs(this.parameters.shapes,t)},((Bs.prototype=Object.create(Un.prototype)).constructor=Bs).prototype.toJSON=function(){var t=Un.prototype.toJSON.call(this);return Fs(this.parameters.shapes,t)},(zs.prototype=Object.create(Un.prototype)).constructor=zs,(Gs.prototype=Object.create(pn.prototype)).constructor=Gs,(Hs.prototype=Object.create(Un.prototype)).constructor=Hs,(Vs.prototype=Object.create(Gs.prototype)).constructor=Vs,(ks.prototype=Object.create(Hs.prototype)).constructor=ks,(js.prototype=Object.create(pn.prototype)).constructor=js,(Ws.prototype=Object.create(Un.prototype)).constructor=Ws;var Xs=Object.freeze({WireframeGeometry:Do,ParametricGeometry:Uo,ParametricBufferGeometry:Bo,TetrahedronGeometry:Go,TetrahedronBufferGeometry:Ho,OctahedronGeometry:Vo,OctahedronBufferGeometry:ko,IcosahedronGeometry:jo,IcosahedronBufferGeometry:Wo,DodecahedronGeometry:Xo,DodecahedronBufferGeometry:qo,PolyhedronGeometry:Fo,PolyhedronBufferGeometry:zo,TubeGeometry:Yo,TubeBufferGeometry:Jo,TorusKnotGeometry:Zo,TorusKnotBufferGeometry:Qo,TorusGeometry:Ko,TorusBufferGeometry:$o,TextGeometry:Ls,TextBufferGeometry:Rs,SphereGeometry:Ps,SphereBufferGeometry:Cs,RingGeometry:Os,RingBufferGeometry:Is,PlaneGeometry:zn,PlaneBufferGeometry:Gn,LatheGeometry:Ns,LatheBufferGeometry:Ds,ShapeGeometry:Us,ShapeBufferGeometry:Bs,ExtrudeGeometry:Es,ExtrudeBufferGeometry:Ts,EdgesGeometry:zs,ConeGeometry:Vs,ConeBufferGeometry:ks,CylinderGeometry:Gs,CylinderBufferGeometry:Hs,CircleGeometry:js,CircleBufferGeometry:Ws,BoxGeometry:Bn,BoxBufferGeometry:Fn});function qs(t){pi.call(this),this.type="ShadowMaterial",this.color=new Tr(0),this.transparent=!0,this.setValues(t)}function Ys(t){fi.call(this,t),this.type="RawShaderMaterial"}function Js(t){pi.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Tr(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Tr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ze,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Zs(t){Js.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Qs(t){pi.call(this),this.type="MeshPhongMaterial",this.color=new Tr(16777215),this.specular=new Tr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Tr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ze,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ks(t){Qs.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function $s(t){pi.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ze,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function tc(t){pi.call(this),this.type="MeshLambertMaterial",this.color=new Tr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Tr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ec(t){To.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}((qs.prototype=Object.create(pi.prototype)).constructor=qs).prototype.isShadowMaterial=!0,qs.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.color.copy(t.color),this},((Ys.prototype=Object.create(fi.prototype)).constructor=Ys).prototype.isRawShaderMaterial=!0,((Js.prototype=Object.create(pi.prototype)).constructor=Js).prototype.isMeshStandardMaterial=!0,Js.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Zs.prototype=Object.create(Js.prototype)).constructor=Zs).prototype.isMeshPhysicalMaterial=!0,Zs.prototype.copy=function(t){return Js.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},((Qs.prototype=Object.create(pi.prototype)).constructor=Qs).prototype.isMeshPhongMaterial=!0,Qs.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Ks.prototype=Object.create(Qs.prototype)).constructor=Ks).prototype.isMeshToonMaterial=!0,Ks.prototype.copy=function(t){return Qs.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},(($s.prototype=Object.create(pi.prototype)).constructor=$s).prototype.isMeshNormalMaterial=!0,$s.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((tc.prototype=Object.create(pi.prototype)).constructor=tc).prototype.isMeshLambertMaterial=!0,tc.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((ec.prototype=Object.create(To.prototype)).constructor=ec).prototype.isLineDashedMaterial=!0,ec.prototype.copy=function(t){return To.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var rc=Object.freeze({ShadowMaterial:qs,SpriteMaterial:xo,RawShaderMaterial:Ys,ShaderMaterial:fi,PointsMaterial:Ro,MeshPhysicalMaterial:Zs,MeshStandardMaterial:Js,MeshPhongMaterial:Qs,MeshToonMaterial:Ks,MeshNormalMaterial:$s,MeshLambertMaterial:tc,MeshDepthMaterial:eo,MeshDistanceMaterial:ro,MeshBasicMaterial:di,LineDashedMaterial:ec,LineBasicMaterial:To,Material:pi}),nc={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function ic(t,e,r){var n=this,i=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){o++,!1===i&&void 0!==n.onStart&&n.onStart(t,a,o),i=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(i=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this}}var ac=new ic,oc={};function sc(t){this.manager=void 0!==t?t:ac}function cc(t){this.manager=void 0!==t?t:ac,this._parser=null}function hc(t){this.manager=void 0!==t?t:ac,this._parser=null}function lc(t){this.manager=void 0!==t?t:ac}function uc(t){this.manager=void 0!==t?t:ac}function pc(t){this.manager=void 0!==t?t:ac}function dc(){this.type="Curve",this.arcLengthDivisions=200}function fc(t,e,r,n,i,a,o,s){dc.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=r||1,this.yRadius=n||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function mc(t,e,r,n,i,a){fc.call(this,t,e,r,r,n,i,a),this.type="ArcCurve"}function gc(){var i=0,a=0,o=0,s=0;function h(t,e,r,n){o=-3*(i=t)+3*e-2*(a=r)-n,s=2*t-2*e+r+n}return{initCatmullRom:function(t,e,r,n,i){h(e,r,i*(r-t),i*(n-e))},initNonuniformCatmullRom:function(t,e,r,n,i,a,o){var s=(e-t)/i-(r-t)/(i+a)+(r-e)/a,c=(r-e)/a-(n-e)/(a+o)+(n-r)/o;h(e,r,s*=a,c*=a)},calc:function(t){var e=t*t;return i+a*t+o*e+s*(e*t)}}}Object.assign(sc.prototype,{load:function(o,t,e,r){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,n=nc.get(o);if(void 0!==n)return s.manager.itemStart(o),setTimeout(function(){t&&t(n),s.manager.itemEnd(o)},0),n;if(void 0===oc[o]){var i=o.match(/^data:(.*?)(;base64)?,(.*)$/);if(i){var a=i[1],c=!!i[2],h=i[3];h=window.decodeURIComponent(h),c&&(h=window.atob(h));try{var l,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var p=new Uint8Array(h.length),d=0;d<h.length;d++)p[d]=h.charCodeAt(d);l="blob"===u?new Blob([p.buffer],{type:a}):p.buffer;break;case"document":var f=new DOMParser;l=f.parseFromString(h,a);break;case"json":l=JSON.parse(h);break;default:l=h}window.setTimeout(function(){t&&t(l),s.manager.itemEnd(o)},0)}catch(t){window.setTimeout(function(){r&&r(t),s.manager.itemEnd(o),s.manager.itemError(o)},0)}}else{oc[o]=[],oc[o].push({onLoad:t,onProgress:e,onError:r});var m=new XMLHttpRequest;for(var g in m.open("GET",o,!0),m.addEventListener("load",function(t){var e=this.response;nc.add(o,e);var r=oc[o];if(delete oc[o],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var n=0,i=r.length;n<i;n++){(a=r[n]).onLoad&&a.onLoad(e)}s.manager.itemEnd(o)}else{for(n=0,i=r.length;n<i;n++){var a;(a=r[n]).onError&&a.onError(t)}s.manager.itemEnd(o),s.manager.itemError(o)}},!1),m.addEventListener("progress",function(t){for(var e=oc[o],r=0,n=e.length;r<n;r++){var i=e[r];i.onProgress&&i.onProgress(t)}},!1),m.addEventListener("error",function(t){var e=oc[o];delete oc[o];for(var r=0,n=e.length;r<n;r++){var i=e[r];i.onError&&i.onError(t)}s.manager.itemEnd(o),s.manager.itemError(o)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return s.manager.itemStart(o),m}oc[o].push({onLoad:t,onProgress:e,onError:r})},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(cc.prototype,{load:function(t,a,e,n){var o=this,s=[],c=new Oo;c.image=s;var i=new sc(this.manager);function r(r){i.load(t[r],function(t){var e=o._parser(t,!0);s[r]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(h+=1)&&(1===e.mipmapCount&&(c.minFilter=Ot),c.format=e.format,c.needsUpdate=!0,a&&a(c))},e,n)}if(i.setPath(this.path),i.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,l=0,u=t.length;l<u;++l)r(l);else i.load(t,function(t){var e=o._parser(t,!0);if(e.isCubemap)for(var r=e.mipmaps.length/e.mipmapCount,n=0;n<r;n++){s[n]={mipmaps:[]};for(var i=0;i<e.mipmapCount;i++)s[n].mipmaps.push(e.mipmaps[n*e.mipmapCount+i]),s[n].format=e.format,s[n].width=e.width,s[n].height=e.height}else c.image.width=e.width,c.image.height=e.height,c.mipmaps=e.mipmaps;1===e.mipmapCount&&(c.minFilter=Ot),c.format=e.format,c.needsUpdate=!0,a&&a(c)},e,n);return c},setPath:function(t){return this.path=t,this}}),Object.assign(hc.prototype,{load:function(t,r,e,n){var i=this,a=new or,o=new sc(this.manager);return o.setResponseType("arraybuffer"),o.load(t,function(t){var e=i._parser(t);e&&(void 0!==e.image?a.image=e.image:void 0!==e.data&&(a.image.width=e.width,a.image.height=e.height,a.image.data=e.data),a.wrapS=void 0!==e.wrapS?e.wrapS:At,a.wrapT=void 0!==e.wrapT?e.wrapT:At,a.magFilter=void 0!==e.magFilter?e.magFilter:Ot,a.minFilter=void 0!==e.minFilter?e.minFilter:Nt,a.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(a.format=e.format),void 0!==e.type&&(a.type=e.type),void 0!==e.mipmaps&&(a.mipmaps=e.mipmaps),1===e.mipmapCount&&(a.minFilter=Ot),a.needsUpdate=!0,r&&r(a,e))},e,n),a}}),Object.assign(lc.prototype,{crossOrigin:"anonymous",load:function(e,t,r,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=nc.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),nc.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),n&&n(t),i.manager.itemEnd(e),i.manager.itemError(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(uc.prototype,{crossOrigin:"anonymous",load:function(t,r,e,n){var i=new Ri,a=new lc(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(e){a.load(t[e],function(t){i.images[e]=t,6===++o&&(i.needsUpdate=!0,r&&r(i))},void 0,n)}for(var c=0;c<t.length;++c)s(c);return i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(pc.prototype,{crossOrigin:"anonymous",load:function(r,n,t,e){var i=new rr,a=new lc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(r,function(t){i.image=t;var e=0<r.search(/\.(jpg|jpeg)$/)||0===r.search(/^data\:image\/jpeg/);i.format=e?Yt:Jt,i.needsUpdate=!0,void 0!==n&&n(i)},t,e),i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(dc.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var r=this.getUtoTmapping(t);return this.getPoint(r,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,n=[],i=this.getPoint(0),a=0;for(n.push(0),r=1;r<=t;r++)a+=(e=this.getPoint(r/t)).distanceTo(i),n.push(a),i=e;return this.cacheArcLengths=n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,n=this.getLengths(),i=0,a=n.length;r=e||t*n[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=n[i=Math.floor(s+(c-s)/2)]-r)<0)s=i+1;else{if(!(0<o)){c=i;break}c=i-1}if(n[i=c]===r)return i/(a-1);var h=n[i];return(i+(r-h)/(n[i+1]-h))/(a-1)},getTangent:function(t){var e=t-1e-4,r=t+1e-4;e<0&&(e=0),1<r&&(r=1);var n=this.getPoint(e);return this.getPoint(r).clone().sub(n).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var r,n,i,a=new We,o=[],s=[],c=[],h=new We,l=new ke;for(r=0;r<=t;r++)n=r/t,o[r]=this.getTangentAt(n),o[r].normalize();s[0]=new We,c[0]=new We;var u=Number.MAX_VALUE,p=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(p<=u&&(u=p,a.set(1,0,0)),d<=u&&(u=d,a.set(0,1,0)),f<=u&&a.set(0,0,1),h.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],h),c[0].crossVectors(o[0],s[0]),r=1;r<=t;r++)s[r]=s[r-1].clone(),c[r]=c[r-1].clone(),h.crossVectors(o[r-1],o[r]),h.length()>Number.EPSILON&&(h.normalize(),i=Math.acos(He.clamp(o[r-1].dot(o[r]),-1,1)),s[r].applyMatrix4(l.makeRotationAxis(h,i))),c[r].crossVectors(o[r],s[r]);if(!0===e)for(i=Math.acos(He.clamp(s[0].dot(s[t]),-1,1)),i/=t,0<o[0].dot(h.crossVectors(s[0],s[t]))&&(i=-i),r=1;r<=t;r++)s[r].applyMatrix4(l.makeRotationAxis(o[r],i*r)),c[r].crossVectors(o[r],s[r]);return{tangents:o,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),((fc.prototype=Object.create(dc.prototype)).constructor=fc).prototype.isEllipseCurve=!0,fc.prototype.getPoint=function(t,e){for(var r=e||new Ve,n=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=n;for(;n<i;)i-=n;i<Number.EPSILON&&(i=a?0:n),!0!==this.aClockwise||a||(i===n?i=-n:i-=n);var o=this.aStartAngle+t*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var h=Math.cos(this.aRotation),l=Math.sin(this.aRotation),u=s-this.aX,p=c-this.aY;s=u*h-p*l+this.aX,c=u*l+p*h+this.aY}return r.set(s,c)},fc.prototype.copy=function(t){return dc.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},fc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},fc.prototype.fromJSON=function(t){return dc.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},((mc.prototype=Object.create(fc.prototype)).constructor=mc).prototype.isArcCurve=!0;var vc=new We,yc=new gc,xc=new gc,bc=new gc;function wc(t,e,r,n){dc.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=r||"centripetal",this.tension=n||.5}function _c(t,e,r,n,i){var a=.5*(n-e),o=.5*(i-r),s=t*t;return(2*r-2*n+a+o)*(t*s)+(-3*r+3*n-2*a-o)*s+a*t+r}function Mc(t,e,r,n){return(o=1-t)*o*e+2*(1-(a=t))*a*r+(i=t)*i*n;var i,a,o}function Ec(t,e,r,n,i){return(h=1-t)*h*h*e+3*(c=1-(s=t))*c*s*r+3*(1-(o=t))*o*o*n+(a=t)*a*a*i;var a,o,s,c,h}function Tc(t,e,r,n){dc.call(this),this.type="CubicBezierCurve",this.v0=t||new Ve,this.v1=e||new Ve,this.v2=r||new Ve,this.v3=n||new Ve}function Sc(t,e,r,n){dc.call(this),this.type="CubicBezierCurve3",this.v0=t||new We,this.v1=e||new We,this.v2=r||new We,this.v3=n||new We}function Ac(t,e){dc.call(this),this.type="LineCurve",this.v1=t||new Ve,this.v2=e||new Ve}function Lc(t,e){dc.call(this),this.type="LineCurve3",this.v1=t||new We,this.v2=e||new We}function Rc(t,e,r){dc.call(this),this.type="QuadraticBezierCurve",this.v0=t||new Ve,this.v1=e||new Ve,this.v2=r||new Ve}function Pc(t,e,r){dc.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new We,this.v1=e||new We,this.v2=r||new We}function Cc(t){dc.call(this),this.type="SplineCurve",this.points=t||[]}((wc.prototype=Object.create(dc.prototype)).constructor=wc).prototype.isCatmullRomCurve3=!0,wc.prototype.getPoint=function(t,e){var r,n,i,a,o=e||new We,s=this.points,c=s.length,h=(c-(this.closed?0:1))*t,l=Math.floor(h),u=h-l;if(this.closed?l+=0<l?0:(Math.floor(Math.abs(l)/c)+1)*c:0===u&&l===c-1&&(l=c-2,u=1),this.closed||0<l?r=s[(l-1)%c]:(vc.subVectors(s[0],s[1]).add(s[0]),r=vc),n=s[l%c],i=s[(l+1)%c],this.closed||l+2<c?a=s[(l+2)%c]:(vc.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=vc),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(r.distanceToSquared(n),p),f=Math.pow(n.distanceToSquared(i),p),m=Math.pow(i.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),yc.initNonuniformCatmullRom(r.x,n.x,i.x,a.x,d,f,m),xc.initNonuniformCatmullRom(r.y,n.y,i.y,a.y,d,f,m),bc.initNonuniformCatmullRom(r.z,n.z,i.z,a.z,d,f,m)}else"catmullrom"===this.curveType&&(yc.initCatmullRom(r.x,n.x,i.x,a.x,this.tension),xc.initCatmullRom(r.y,n.y,i.y,a.y,this.tension),bc.initCatmullRom(r.z,n.z,i.z,a.z,this.tension));return o.set(yc.calc(u),xc.calc(u),bc.calc(u)),o},wc.prototype.copy=function(t){dc.prototype.copy.call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},wc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);t.points=[];for(var e=0,r=this.points.length;e<r;e++){var n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},wc.prototype.fromJSON=function(t){dc.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var n=t.points[e];this.points.push((new We).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},((Tc.prototype=Object.create(dc.prototype)).constructor=Tc).prototype.isCubicBezierCurve=!0,Tc.prototype.getPoint=function(t,e){var r=e||new Ve,n=this.v0,i=this.v1,a=this.v2,o=this.v3;return r.set(Ec(t,n.x,i.x,a.x,o.x),Ec(t,n.y,i.y,a.y,o.y)),r},Tc.prototype.copy=function(t){return dc.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Tc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Tc.prototype.fromJSON=function(t){return dc.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},((Sc.prototype=Object.create(dc.prototype)).constructor=Sc).prototype.isCubicBezierCurve3=!0,Sc.prototype.getPoint=function(t,e){var r=e||new We,n=this.v0,i=this.v1,a=this.v2,o=this.v3;return r.set(Ec(t,n.x,i.x,a.x,o.x),Ec(t,n.y,i.y,a.y,o.y),Ec(t,n.z,i.z,a.z,o.z)),r},Sc.prototype.copy=function(t){return dc.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Sc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Sc.prototype.fromJSON=function(t){return dc.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},((Ac.prototype=Object.create(dc.prototype)).constructor=Ac).prototype.isLineCurve=!0,Ac.prototype.getPoint=function(t,e){var r=e||new Ve;return 1===t?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(t).add(this.v1)),r},Ac.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Ac.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Ac.prototype.copy=function(t){return dc.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ac.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ac.prototype.fromJSON=function(t){return dc.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((Lc.prototype=Object.create(dc.prototype)).constructor=Lc).prototype.isLineCurve3=!0,Lc.prototype.getPoint=function(t,e){var r=e||new We;return 1===t?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(t).add(this.v1)),r},Lc.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Lc.prototype.copy=function(t){return dc.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Lc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Lc.prototype.fromJSON=function(t){return dc.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((Rc.prototype=Object.create(dc.prototype)).constructor=Rc).prototype.isQuadraticBezierCurve=!0,Rc.prototype.getPoint=function(t,e){var r=e||new Ve,n=this.v0,i=this.v1,a=this.v2;return r.set(Mc(t,n.x,i.x,a.x),Mc(t,n.y,i.y,a.y)),r},Rc.prototype.copy=function(t){return dc.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Rc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Rc.prototype.fromJSON=function(t){return dc.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((Pc.prototype=Object.create(dc.prototype)).constructor=Pc).prototype.isQuadraticBezierCurve3=!0,Pc.prototype.getPoint=function(t,e){var r=e||new We,n=this.v0,i=this.v1,a=this.v2;return r.set(Mc(t,n.x,i.x,a.x),Mc(t,n.y,i.y,a.y),Mc(t,n.z,i.z,a.z)),r},Pc.prototype.copy=function(t){return dc.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Pc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Pc.prototype.fromJSON=function(t){return dc.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((Cc.prototype=Object.create(dc.prototype)).constructor=Cc).prototype.isSplineCurve=!0,Cc.prototype.getPoint=function(t,e){var r=e||new Ve,n=this.points,i=(n.length-1)*t,a=Math.floor(i),o=i-a,s=n[0===a?a:a-1],c=n[a],h=n[a>n.length-2?n.length-1:a+1],l=n[a>n.length-3?n.length-1:a+2];return r.set(_c(o,s.x,c.x,h.x,l.x),_c(o,s.y,c.y,h.y,l.y)),r},Cc.prototype.copy=function(t){dc.prototype.copy.call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var n=t.points[e];this.points.push(n.clone())}return this},Cc.prototype.toJSON=function(){var t=dc.prototype.toJSON.call(this);t.points=[];for(var e=0,r=this.points.length;e<r;e++){var n=this.points[e];t.points.push(n.toArray())}return t},Cc.prototype.fromJSON=function(t){dc.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var n=t.points[e];this.points.push((new Ve).fromArray(n))}return this};var Oc=Object.freeze({ArcCurve:mc,CatmullRomCurve3:wc,CubicBezierCurve:Tc,CubicBezierCurve3:Sc,EllipseCurve:fc,LineCurve:Ac,LineCurve3:Lc,QuadraticBezierCurve:Rc,QuadraticBezierCurve3:Pc,SplineCurve:Cc});function Ic(){dc.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Nc(t){Ic.call(this),this.type="Path",this.currentPoint=new Ve,t&&this.setFromPoints(t)}function Dc(t){Nc.call(this,t),this.uuid=He.generateUUID(),this.type="Shape",this.holes=[]}function Uc(t,e){$r.call(this),this.type="Light",this.color=new Tr(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Bc(t,e,r){Uc.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy($r.DefaultUp),this.updateMatrix(),this.groundColor=new Tr(e)}function Fc(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new Ve(512,512),this.map=null,this.matrix=new ke}function zc(){Fc.call(this,new co(50,1,.5,500))}function Gc(t,e,r,n,i,a){Uc.call(this,t,e),this.type="SpotLight",this.position.copy($r.DefaultUp),this.updateMatrix(),this.target=new $r,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new zc}function Hc(t,e,r,n){Uc.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new Fc(new co(90,1,.5,500))}function Vc(){Fc.call(this,new en(-5,5,5,-5,.5,500))}function kc(t,e){Uc.call(this,t,e),this.type="DirectionalLight",this.position.copy($r.DefaultUp),this.updateMatrix(),this.target=new $r,this.shadow=new Vc}function jc(t,e){Uc.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Wc(t,e,r,n){Uc.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==r?r:10,this.height=void 0!==n?n:10}Ic.prototype=Object.assign(Object.create(dc.prototype),{constructor:Ic,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ac(e,t))},getPoint:function(t){for(var e=t*this.getLength(),r=this.getCurveLengths(),n=0;n<r.length;){if(r[n]>=e){var i=r[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.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 t=[],e=0,r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,r=[],n=0,i=this.curves;n<i.length;n++)for(var a=i[n],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var h=s[c];e&&e.equals(h)||(r.push(h),e=h)}return this.autoClose&&1<r.length&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r},copy:function(t){dc.prototype.copy.call(this,t),this.curves=[];for(var e=0,r=t.curves.length;e<r;e++){var n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){var t=dc.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,r=this.curves.length;e<r;e++){var n=this.curves[e];t.curves.push(n.toJSON())}return t},fromJSON:function(t){dc.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,r=t.curves.length;e<r;e++){var n=t.curves[e];this.curves.push((new Oc[n.type]).fromJSON(n))}return this}}),Nc.prototype=Object.assign(Object.create(Ic.prototype),{constructor:Nc,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var r=new Ac(this.currentPoint.clone(),new Ve(t,e));this.curves.push(r),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,r,n){var i=new Rc(this.currentPoint.clone(),new Ve(t,e),new Ve(r,n));this.curves.push(i),this.currentPoint.set(r,n)},bezierCurveTo:function(t,e,r,n,i,a){var o=new Tc(this.currentPoint.clone(),new Ve(t,e),new Ve(r,n),new Ve(i,a));this.curves.push(o),this.currentPoint.set(i,a)},splineThru:function(t){var e=new Cc([this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,r,n,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,r,n,i,a)},absarc:function(t,e,r,n,i,a){this.absellipse(t,e,r,r,n,i,a)},ellipse:function(t,e,r,n,i,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,r,n,i,a,o,s)},absellipse:function(t,e,r,n,i,a,o,s){var c=new fc(t,e,r,n,i,a,o,s);if(0<this.curves.length){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)},copy:function(t){return Ic.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Ic.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Ic.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Dc.prototype=Object.assign(Object.create(Nc.prototype),{constructor:Dc,getPointsHoles:function(t){for(var e=[],r=0,n=this.holes.length;r<n;r++)e[r]=this.holes[r].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){Nc.prototype.copy.call(this,t),this.holes=[];for(var e=0,r=t.holes.length;e<r;e++){var n=t.holes[e];this.holes.push(n.clone())}return this},toJSON:function(){var t=Nc.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,r=this.holes.length;e<r;e++){var n=this.holes[e];t.holes.push(n.toJSON())}return t},fromJSON:function(t){Nc.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,r=t.holes.length;e<r;e++){var n=t.holes[e];this.holes.push((new Nc).fromJSON(n))}return this}}),Uc.prototype=Object.assign(Object.create($r.prototype),{constructor:Uc,isLight:!0,copy:function(t){return $r.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=$r.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Bc.prototype=Object.assign(Object.create(Uc.prototype),{constructor:Bc,isHemisphereLight:!0,copy:function(t){return Uc.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Fc.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),zc.prototype=Object.assign(Object.create(Fc.prototype),{constructor:zc,isSpotLightShadow:!0,update:function(t){var e=this.camera,r=2*He.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;r===e.fov&&n===e.aspect&&i===e.far||(e.fov=r,e.aspect=n,e.far=i,e.updateProjectionMatrix())}}),Gc.prototype=Object.assign(Object.create(Uc.prototype),{constructor:Gc,isSpotLight:!0,copy:function(t){return Uc.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Hc.prototype=Object.assign(Object.create(Uc.prototype),{constructor:Hc,isPointLight:!0,copy:function(t){return Uc.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Vc.prototype=Object.assign(Object.create(Fc.prototype),{constructor:Vc}),kc.prototype=Object.assign(Object.create(Uc.prototype),{constructor:kc,isDirectionalLight:!0,copy:function(t){return Uc.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),jc.prototype=Object.assign(Object.create(Uc.prototype),{constructor:jc,isAmbientLight:!0}),Wc.prototype=Object.assign(Object.create(Uc.prototype),{constructor:Wc,isRectAreaLight:!0,copy:function(t){return Uc.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Uc.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var Xc={arraySlice:function(t,e,r){return Xc.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==r?r:t.length)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(r){for(var t=r.length,e=new Array(t),n=0;n!==t;++n)e[n]=n;return e.sort(function(t,e){return r[t]-r[e]}),e},sortedArray:function(t,e,r){for(var n=t.length,i=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=r[a]*e,c=0;c!==e;++c)i[o++]=t[s+c];return i},flattenJSON:function(t,e,r,n){for(var i=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[i++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[n])&&(e.push(a.time),r.push.apply(r,o)),void 0!==(a=t[i++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[n])&&(e.push(a.time),o.toArray(r,r.length)),void 0!==(a=t[i++]););else for(;void 0!==(o=a[n])&&(e.push(a.time),r.push(o)),void 0!==(a=t[i++]););}}};function qc(t,e,r,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(r),this.sampleValues=e,this.valueSize=r}function Yc(t,e,r,n){qc.call(this,t,e,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Jc(t,e,r,n){qc.call(this,t,e,r,n)}function Zc(t,e,r,n){qc.call(this,t,e,r,n)}function Qc(t,e,r,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Xc.convertArray(e,this.TimeBufferType),this.values=Xc.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function Kc(t,e,r){Qc.call(this,t,e,r)}function $c(t,e,r,n){Qc.call(this,t,e,r,n)}function th(t,e,r,n){Qc.call(this,t,e,r,n)}function eh(t,e,r,n){qc.call(this,t,e,r,n)}function rh(t,e,r,n){Qc.call(this,t,e,r,n)}function nh(t,e,r,n){Qc.call(this,t,e,r,n)}function ih(t,e,r,n){Qc.call(this,t,e,r,n)}function ah(t,e,r){this.name=t,this.tracks=r,this.duration=void 0!==e?e:-1,this.uuid=He.generateUUID(),this.duration<0&&this.resetDuration()}function oh(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return th;case"vector":case"vector2":case"vector3":case"vector4":return ih;case"color":return $c;case"quaternion":return rh;case"bool":case"boolean":return Kc;case"string":return nh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var r=[],n=[];Xc.flattenJSON(t.keys,r,n,"value"),t.times=r,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function sh(t){this.manager=void 0!==t?t:ac,this.textures={}}function ch(t){this.manager=void 0!==t?t:ac}Object.assign(qc.prototype,{evaluate:function(t){var e=this.parameterPositions,r=this._cachedIndex,n=e[r],i=e[r-1];t:{e:{var a;r:{n:if(!(t<n)){for(var o=r+2;;){if(void 0===n){if(t<i)break n;return r=e.length,this._cachedIndex=r,this.afterEnd_(r-1,t,i)}if(r===o)break;if(i=n,t<(n=e[++r]))break e}a=e.length;break r}if(i<=t)break t;var s=e[1];t<s&&(r=2,i=s);for(o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(r===o)break;if(n=i,(i=e[--r-1])<=t)break e}a=r,r=0}for(;r<a;){var c=r+a>>>1;t<e[c]?a=c:r=c+1}if(n=e[r],void 0===(i=e[r-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return r=e.length,this._cachedIndex=r,this.afterEnd_(r-1,i,t)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=t*n,a=0;a!==n;++a)e[a]=r[i+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(qc.prototype,{beforeStart_:qc.prototype.copySampleValue_,afterEnd_:qc.prototype.copySampleValue_}),Yc.prototype=Object.assign(Object.create(qc.prototype),{constructor:Yc,DefaultSettings_:{endingStart:Se,endingEnd:Se},intervalChanged_:function(t,e,r){var n=this.parameterPositions,i=t-2,a=t+1,o=n[i],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case Ae:i=t,o=2*e-r;break;case Le:o=e+n[i=n.length-2]-n[i+1];break;default:i=t,o=r}if(void 0===s)switch(this.getSettings_().endingEnd){case Ae:a=t,s=2*r-e;break;case Le:s=r+n[a=1]-n[0];break;default:a=t-1,s=e}var c=.5*(r-e),h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-r),this._offsetPrev=i*h,this._offsetNext=a*h},interpolate_:function(t,e,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(r-e)/(n-e),f=d*d,m=f*d,g=-u*m+2*u*f-u*d,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)i[b]=g*a[h+b]+v*a[c+b]+y*a[s+b]+x*a[l+b];return i}}),Jc.prototype=Object.assign(Object.create(qc.prototype),{constructor:Jc,interpolate_:function(t,e,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=(r-e)/(n-e),l=1-h,u=0;u!==o;++u)i[u]=a[c+u]*l+a[s+u]*h;return i}}),Zc.prototype=Object.assign(Object.create(qc.prototype),{constructor:Zc,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Qc,{toJSON:function(t){var e,r=t.constructor;if(void 0!==r.toJSON)e=r.toJSON(t);else{e={name:t.name,times:Xc.convertArray(t.times,Array),values:Xc.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e}}),Object.assign(Qc.prototype,{constructor:Qc,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Te,InterpolantFactoryMethodDiscrete:function(t){return new Zc(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Jc(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Yc(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case Ee:e=this.InterpolantFactoryMethodDiscrete;break;case Te:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ee;case this.InterpolantFactoryMethodLinear:return Te;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,r=0,n=e.length;r!==n;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,n=e.length;r!==n;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,n=r.length,i=0,a=n-1;i!==n&&r[i]<t;)++i;for(;-1!==a&&r[a]>e;)--a;if(++a,0!==i||a!==n){a<=i&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Xc.arraySlice(r,i,a),this.values=Xc.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var r=this.times,n=this.values,i=r.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==i;o++){var s=r[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&s<a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==n&&Xc.isTypedArray(n)){o=0;for(var c=n.length;o!==c;++o){var h=n[o];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,h),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),n=2302===this.getInterpolation(),i=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o];if(c!==t[o+1]&&(1!==o||c!==c[0]))if(n)s=!0;else for(var h=o*r,l=h-r,u=h+r,p=0;p!==r;++p){var d=e[h+p];if(d!==e[l+p]||d!==e[u+p]){s=!0;break}}if(s){if(o!==i){t[i]=t[o];var f=o*r,m=i*r;for(p=0;p!==r;++p)e[m+p]=e[f+p]}++i}}if(0<a){t[i]=t[a];for(f=a*r,m=i*r,p=0;p!==r;++p)e[m+p]=e[f+p];++i}return i!==t.length&&(this.times=Xc.arraySlice(t,0,i),this.values=Xc.arraySlice(e,0,i*r)),this}}),Kc.prototype=Object.assign(Object.create(Qc.prototype),{constructor:Kc,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Ee,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),$c.prototype=Object.assign(Object.create(Qc.prototype),{constructor:$c,ValueTypeName:"color"}),th.prototype=Object.assign(Object.create(Qc.prototype),{constructor:th,ValueTypeName:"number"}),eh.prototype=Object.assign(Object.create(qc.prototype),{constructor:eh,interpolate_:function(t,e,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=(r-e)/(n-e),h=s+o;s!==h;s+=4)je.slerpFlat(i,0,a,s-o,a,s,c);return i}}),rh.prototype=Object.assign(Object.create(Qc.prototype),{constructor:rh,ValueTypeName:"quaternion",DefaultInterpolation:Te,InterpolantFactoryMethodLinear:function(t){return new eh(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),nh.prototype=Object.assign(Object.create(Qc.prototype),{constructor:nh,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Ee,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ih.prototype=Object.assign(Object.create(Qc.prototype),{constructor:ih,ValueTypeName:"vector"}),Object.assign(ah,{parse:function(t){for(var e=[],r=t.tracks,n=1/(t.fps||1),i=0,a=r.length;i!==a;++i)e.push(oh(r[i]).scale(n));return new ah(t.name,t.duration,e)},toJSON:function(t){for(var e=[],r=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},i=0,a=r.length;i!==a;++i)e.push(Qc.toJSON(r[i]));return n},CreateFromMorphTargetSequence:function(t,e,r,n){for(var i=e.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var h=Xc.getKeyframeOrder(s);s=Xc.sortedArray(s,1,h),c=Xc.sortedArray(c,1,h),n||0!==s[0]||(s.push(i),c.push(c[0])),a.push(new th(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/r))}return new ah(t,-1,a)},findByName:function(t,e){var r=t;if(!Array.isArray(t)){var n=t;r=n.geometry&&n.geometry.animations||n.animations}for(var i=0;i<r.length;i++)if(r[i].name===e)return r[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,r){for(var n={},i=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(i);if(c&&1<c.length){var h=n[u=c[1]];h||(n[u]=h=[]),h.push(s)}}var l=[];for(var u in n)l.push(ah.CreateFromMorphTargetSequence(u,n[u],e,r));return l},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var r=function(t,e,r,n,i){if(0!==r.length){var a=[],o=[];Xc.flattenJSON(r,a,o,n),0!==a.length&&i.push(new t(e,a,o))}},n=[],i=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var l={},u=0;u<h.length;u++)if(h[u].morphTargets)for(var p=0;p<h[u].morphTargets.length;p++)l[h[u].morphTargets[p]]=-1;for(var d in l){var f=[],m=[];for(p=0;p!==h[u].morphTargets.length;++p){var g=h[u];f.push(g.time),m.push(g.morphTarget===d?1:0)}n.push(new th(".morphTargetInfluence["+d+"]",f,m))}a=l.length*(o||1)}else{var v=".bones["+e[c].name+"]";r(ih,v+".position",h,"pos",n),r(rh,v+".quaternion",h,"rot",n),r(ih,v+".scale",h,"scl",n)}}return 0===n.length?null:new ah(i,a,n)}}),Object.assign(ah.prototype,{resetDuration:function(){for(var t=0,e=0,r=this.tracks.length;e!==r;++e){var n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(sh.prototype,{load:function(t,e,r,n){var i=this;new sc(i.manager).load(t,function(t){e(i.parse(JSON.parse(t)))},r,n)},setTextures:function(t){this.textures=t},parse:function(t){var e=this.textures;function r(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var n=new rc[t.type];if(void 0!==t.uuid&&(n.uuid=t.uuid),void 0!==t.name&&(n.name=t.name),void 0!==t.color&&n.color.setHex(t.color),void 0!==t.roughness&&(n.roughness=t.roughness),void 0!==t.metalness&&(n.metalness=t.metalness),void 0!==t.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&n.specular.setHex(t.specular),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.clearCoat&&(n.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(n.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(n.uniforms=t.uniforms),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(n.vertexColors=t.vertexColors),void 0!==t.fog&&(n.fog=t.fog),void 0!==t.flatShading&&(n.flatShading=t.flatShading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.side&&(n.side=t.side),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.alphaTest&&(n.alphaTest=t.alphaTest),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(n.colorWrite=t.colorWrite),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(n.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(n.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(n.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(n.rotation=t.rotation),1!==t.linewidth&&(n.linewidth=t.linewidth),void 0!==t.dashSize&&(n.dashSize=t.dashSize),void 0!==t.gapSize&&(n.gapSize=t.gapSize),void 0!==t.scale&&(n.scale=t.scale),void 0!==t.polygonOffset&&(n.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(n.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(n.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(n.skinning=t.skinning),void 0!==t.morphTargets&&(n.morphTargets=t.morphTargets),void 0!==t.dithering&&(n.dithering=t.dithering),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.shading&&(n.flatShading=1===t.shading),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=r(t.map)),void 0!==t.alphaMap&&(n.alphaMap=r(t.alphaMap),n.transparent=!0),void 0!==t.bumpMap&&(n.bumpMap=r(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=r(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){var i=t.normalScale;!1===Array.isArray(i)&&(i=[i,i]),n.normalScale=(new Ve).fromArray(i)}return void 0!==t.displacementMap&&(n.displacementMap=r(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=r(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=r(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=r(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=r(t.specularMap)),void 0!==t.envMap&&(n.envMap=r(t.envMap)),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.lightMap&&(n.lightMap=r(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=r(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=r(t.gradientMap)),n}}),Object.assign(ch.prototype,{load:function(t,e,r,n){var i=this;new sc(i.manager).load(t,function(t){e(i.parse(JSON.parse(t)))},r,n)},parse:function(t){var e=new Un,r=t.data.index;if(void 0!==r){var n=new dh[r.type](r.array);e.setIndex(new dn(n,1))}var i=t.data.attributes;for(var a in i){var o=i[a];n=new dh[o.type](o.array);e.addAttribute(a,new dn(n,o.itemSize,o.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,h=s.length;c!==h;++c){var l=s[c];e.addGroup(l.start,l.count,l.materialIndex)}var u=t.data.boundingSphere;if(void 0!==u){var p=new We;void 0!==u.center&&p.fromArray(u.center),e.boundingSphere=new yr(p,u.radius)}return e}});var hh,lh,uh,ph,dh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function fh(){}fh.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,n=e.length;r<n;r+=2){var i=e[r],a=e[r+1];if(i.test(t))return a}return null}},Object.assign(fh.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(t,e,r){for(var n=[],i=0;i<t.length;++i)n[i]=this.createMaterial(t[i],e,r);return n},createMaterial:(hh={NoBlending:J,NormalBlending:Z,AdditiveBlending:Q,SubtractiveBlending:K,MultiplyBlending:$,CustomBlending:tt},lh=new Tr,uh=new pc,ph=new sh,function(t,h,l){var u={};function e(t,e,r,n,i){var a,o=h+t,s=fh.Handlers.get(o);null!==s?a=s.load(o):(uh.setCrossOrigin(l),a=uh.load(o)),void 0!==e&&(a.repeat.fromArray(e),1!==e[0]&&(a.wrapS=St),1!==e[1]&&(a.wrapT=St)),void 0!==r&&a.offset.fromArray(r),void 0!==n&&("repeat"===n[0]&&(a.wrapS=St),"mirror"===n[0]&&(a.wrapS=Lt),"repeat"===n[1]&&(a.wrapT=St),"mirror"===n[1]&&(a.wrapT=Lt)),void 0!==i&&(a.anisotropy=i);var c=He.generateUUID();return u[c]=a,c}var r={uuid:He.generateUUID(),type:"MeshLambertMaterial"};for(var n in t){var i=t[n];switch(n){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":r.name=i;break;case"blending":r.blending=hh[i];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",n,"is no longer supported.");break;case"colorDiffuse":r.color=lh.fromArray(i).getHex();break;case"colorSpecular":r.specular=lh.fromArray(i).getHex();break;case"colorEmissive":r.emissive=lh.fromArray(i).getHex();break;case"specularCoef":r.shininess=i;break;case"shading":"basic"===i.toLowerCase()&&(r.type="MeshBasicMaterial"),"phong"===i.toLowerCase()&&(r.type="MeshPhongMaterial"),"standard"===i.toLowerCase()&&(r.type="MeshStandardMaterial");break;case"mapDiffuse":r.map=e(i,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":r.emissiveMap=e(i,t.mapEmissiveRepeat,t.mapEmissiveOffset,t.mapEmissiveWrap,t.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":r.lightMap=e(i,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":r.aoMap=e(i,t.mapAORepeat,t.mapAOOffset,t.mapAOWrap,t.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":r.bumpMap=e(i,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy);break;case"mapBumpScale":r.bumpScale=i;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":r.normalMap=e(i,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy);break;case"mapNormalFactor":r.normalScale=i;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":r.specularMap=e(i,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":r.metalnessMap=e(i,t.mapMetalnessRepeat,t.mapMetalnessOffset,t.mapMetalnessWrap,t.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":r.roughnessMap=e(i,t.mapRoughnessRepeat,t.mapRoughnessOffset,t.mapRoughnessWrap,t.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":r.alphaMap=e(i,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":r.side=Mt;break;case"doubleSided":r.side=et;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),r.opacity=i;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":r[n]=i;break;case"vertexColors":!0===i&&(r.vertexColors=T),"face"===i&&(r.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",n,i)}}return"MeshBasicMaterial"===r.type&&delete r.emissive,"MeshPhongMaterial"!==r.type&&delete r.specular,r.opacity<1&&(r.transparent=!0),ph.setTextures(u),ph.parse(r)})});var mh={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",r=0,n=t.length;r<n;r++)e+=String.fromCharCode(t[r]);return decodeURIComponent(escape(e))},extractUrlBase:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function gh(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:ac,this.withCredentials=!1}function vh(t){this.manager=void 0!==t?t:ac,this.texturePath=""}Object.assign(gh.prototype,{crossOrigin:"anonymous",load:function(a,o,t,e){var s=this,c=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:mh.extractUrlBase(a),r=new sc(this.manager);r.setWithCredentials(this.withCredentials),r.load(a,function(t){var e=JSON.parse(t),r=e.metadata;if(void 0!==r){var n=r.type;if(void 0!==n&&"object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.")}var i=s.parse(e,c);o(i.geometry,i.materials)},t,e)},setCrossOrigin:function(t){return this.crossOrigin=t,this},setTexturePath:function(t){return this.texturePath=t,this},parse:function(t,e){void 0!==t.data&&(t=t.data),void 0!==t.scale?t.scale=1/t.scale:t.scale=1;var r=new pn;return function(t,e){function r(t,e){return t&1<<e}var n,i,a,o,s,c,h,l,u,p,d,f,m,g,v,y,x,b,w,_,M,E,T,S,A,L=t.faces,R=t.vertices,P=t.normals,C=t.colors,O=t.scale,I=0;if(void 0!==t.uvs){for(n=0;n<t.uvs.length;n++)t.uvs[n].length&&I++;for(n=0;n<I;n++)e.faceVertexUvs[n]=[]}for(o=0,s=R.length;o<s;)(b=new We).x=R[o++]*O,b.y=R[o++]*O,b.z=R[o++]*O,e.vertices.push(b);for(o=0,s=L.length;o<s;)if(d=r(p=L[o++],0),f=r(p,1),m=r(p,3),g=r(p,4),v=r(p,5),y=r(p,6),x=r(p,7),d){if((_=new rn).a=L[o],_.b=L[o+1],_.c=L[o+3],(M=new rn).a=L[o+1],M.b=L[o+2],M.c=L[o+3],o+=4,f&&(u=L[o++],_.materialIndex=u,M.materialIndex=u),a=e.faces.length,m)for(n=0;n<I;n++)for(S=t.uvs[n],e.faceVertexUvs[n][a]=[],e.faceVertexUvs[n][a+1]=[],i=0;i<4;i++)A=new Ve(S[2*(l=L[o++])],S[2*l+1]),2!==i&&e.faceVertexUvs[n][a].push(A),0!==i&&e.faceVertexUvs[n][a+1].push(A);if(g&&(h=3*L[o++],_.normal.set(P[h++],P[h++],P[h]),M.normal.copy(_.normal)),v)for(n=0;n<4;n++)h=3*L[o++],T=new We(P[h++],P[h++],P[h]),2!==n&&_.vertexNormals.push(T),0!==n&&M.vertexNormals.push(T);if(y&&(E=C[c=L[o++]],_.color.setHex(E),M.color.setHex(E)),x)for(n=0;n<4;n++)E=C[c=L[o++]],2!==n&&_.vertexColors.push(new Tr(E)),0!==n&&M.vertexColors.push(new Tr(E));e.faces.push(_),e.faces.push(M)}else{if((w=new rn).a=L[o++],w.b=L[o++],w.c=L[o++],f&&(u=L[o++],w.materialIndex=u),a=e.faces.length,m)for(n=0;n<I;n++)for(S=t.uvs[n],e.faceVertexUvs[n][a]=[],i=0;i<3;i++)A=new Ve(S[2*(l=L[o++])],S[2*l+1]),e.faceVertexUvs[n][a].push(A);if(g&&(h=3*L[o++],w.normal.set(P[h++],P[h++],P[h])),v)for(n=0;n<3;n++)h=3*L[o++],T=new We(P[h++],P[h++],P[h]),w.vertexNormals.push(T);if(y&&(c=L[o++],w.color.setHex(C[c])),x)for(n=0;n<3;n++)c=L[o++],w.vertexColors.push(new Tr(C[c]));e.faces.push(w)}}(t,r),function(t,e){var r=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var n=0,i=t.skinWeights.length;n<i;n+=r){var a=t.skinWeights[n],o=1<r?t.skinWeights[n+1]:0,s=2<r?t.skinWeights[n+2]:0,c=3<r?t.skinWeights[n+3]:0;e.skinWeights.push(new nr(a,o,s,c))}if(t.skinIndices)for(n=0,i=t.skinIndices.length;n<i;n+=r){var h=t.skinIndices[n],l=1<r?t.skinIndices[n+1]:0,u=2<r?t.skinIndices[n+2]:0,p=3<r?t.skinIndices[n+3]:0;e.skinIndices.push(new nr(h,l,u,p))}e.bones=t.bones,e.bones&&0<e.bones.length&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}(t,r),function(t,e){var r=t.scale;if(void 0!==t.morphTargets)for(var n=0,i=t.morphTargets.length;n<i;n++){e.morphTargets[n]={},e.morphTargets[n].name=t.morphTargets[n].name,e.morphTargets[n].vertices=[];for(var a=e.morphTargets[n].vertices,o=t.morphTargets[n].vertices,s=0,c=o.length;s<c;s+=3){var h=new We;h.x=o[s]*r,h.y=o[s+1]*r,h.z=o[s+2]*r,a.push(h)}}if(void 0!==t.morphColors&&0<t.morphColors.length){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var l=e.faces,u=t.morphColors[0].colors;for(n=0,i=l.length;n<i;n++)l[n].color.fromArray(u,3*n)}}(t,r),function(t,e){var r=[],n=[];void 0!==t.animation&&n.push(t.animation),void 0!==t.animations&&(t.animations.length?n=n.concat(t.animations):n.push(t.animations));for(var i=0;i<n.length;i++){var a=ah.parseAnimation(n[i],e.bones);a&&r.push(a)}if(e.morphTargets){var o=ah.CreateClipsFromMorphTargetSequences(e.morphTargets,10);r=r.concat(o)}0<r.length&&(e.animations=r)}(t,r),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:r}:{geometry:r,materials:fh.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}),Object.assign(vh.prototype,{crossOrigin:"anonymous",load:function(n,i,t,a){""===this.texturePath&&(this.texturePath=n.substring(0,n.lastIndexOf("/")+1));var o=this;new sc(o.manager).load(n,function(t){var e=null;try{e=JSON.parse(t)}catch(t){return void 0!==a&&a(t),void console.error("THREE:ObjectLoader: Can't parse "+n+".",t.message)}var r=e.metadata;void 0!==r&&void 0!==r.type&&"geometry"!==r.type.toLowerCase()?o.parse(e,i):console.error("THREE.ObjectLoader: Can't load "+n+". Use THREE.JSONLoader instead.")},t,a)},setTexturePath:function(t){return this.texturePath=t,this},setCrossOrigin:function(t){return this.crossOrigin=t,this},parse:function(t,e){var r=this.parseShape(t.shapes),n=this.parseGeometries(t.geometries,r),i=this.parseImages(t.images,function(){void 0!==e&&e(s)}),a=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,a),s=this.parseObject(t.object,n,o);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var r=0,n=t.length;r<n;r++){var i=(new Dc).fromJSON(t[r]);e[i.uuid]=i}return e},parseGeometries:function(t,e){var r={};if(void 0!==t)for(var n=new gh,i=new ch,a=0,o=t.length;a<o;a++){var s,c=t[a];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Xs[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Xs[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Xs[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Xs[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Xs[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Xs[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Xs[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Xs[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Xs[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Xs[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Xs[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Xs[c.type](c.vertices,c.indices,c.radius,c.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var h=[],l=0,u=c.shapes.length;l<u;l++){var p=e[c.shapes[l]];h.push(p)}s=new Xs[c.type](h,c.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(h=[],l=0,u=c.shapes.length;l<u;l++){p=e[c.shapes[l]];h.push(p)}var d=c.options.extrudePath;void 0!==d&&(c.options.extrudePath=(new Oc[d.type]).fromJSON(d)),s=new Xs[c.type](h,c.options);break;case"BufferGeometry":s=i.parse(c);break;case"Geometry":s=n.parse(c,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),!0===s.isBufferGeometry&&void 0!==c.userData&&(s.userData=c.userData),r[c.uuid]=s}return r},parseMaterials:function(t,e){var r={};if(void 0!==t){var n=new sh;n.setTextures(e);for(var i=0,a=t.length;i<a;i++){var o=t[i];if("MultiMaterial"===o.type){for(var s=[],c=0;c<o.materials.length;c++)s.push(n.parse(o.materials[c]));r[o.uuid]=s}else r[o.uuid]=n.parse(o)}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r],i=ah.parse(n);void 0!==n.uuid&&(i.uuid=n.uuid),e.push(i)}return e},parseImages:function(t,e){var r=this,n={};function i(t){return r.manager.itemStart(t),a.load(t,function(){r.manager.itemEnd(t)},void 0,function(){r.manager.itemEnd(t),r.manager.itemError(t)})}if(void 0!==t&&0<t.length){var a=new lc(new ic(e));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var c=t[o],h=c.url;if(Array.isArray(h)){n[c.uuid]=[];for(var l=0,u=h.length;l<u;l++){var p=h[l],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:r.texturePath+p;n[c.uuid].push(i(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:r.texturePath+c.url;n[c.uuid]=i(d)}}}return n},parseTextures:function(t,e){function r(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var n={};if(void 0!==t)for(var i=0,a=t.length;i<a;i++){var o,s=t[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(e[s.image])?new Ri(e[s.image]):new rr(e[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=r(s.mapping,xh)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=r(s.wrap[0],bh),o.wrapT=r(s.wrap[1],bh)),void 0!==s.format&&(o.format=s.format),void 0!==s.minFilter&&(o.minFilter=r(s.minFilter,wh)),void 0!==s.magFilter&&(o.magFilter=r(s.magFilter,wh)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),n[s.uuid]=o}return n},parseObject:function(t,e,a){var r;function n(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function i(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];void 0===a[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),e.push(a[i])}return e}return void 0===a[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),a[t]}}switch(t.type){case"Scene":r=new go,void 0!==t.background&&Number.isInteger(t.background)&&(r.background=new Tr(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new mo(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new fo(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":r=new co(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new en(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"AmbientLight":r=new jc(t.color,t.intensity);break;case"DirectionalLight":r=new kc(t.color,t.intensity);break;case"PointLight":r=new Hc(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new Wc(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new Gc(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":r=new Bc(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=n(t.geometry),s=i(t.material);r=o.bones&&0<o.bones.length?new Eo(o,s):new vi(o,s);break;case"LOD":r=new wo;break;case"Line":r=new So(n(t.geometry),i(t.material),t.mode);break;case"LineLoop":r=new Lo(n(t.geometry),i(t.material));break;case"LineSegments":r=new Ao(n(t.geometry),i(t.material));break;case"PointCloud":case"Points":r=new Po(n(t.geometry),i(t.material));break;case"Sprite":r=new bo(i(t.material));break;case"Group":r=new so;break;default:r=new $r}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),void 0!==t.children)for(var c=t.children,h=0;h<c.length;h++)r.add(this.parseObject(c[h],e,a));if("LOD"===t.type)for(var l=t.levels,u=0;u<l.length;u++){var p=l[u],d=r.getObjectByProperty("uuid",p.object);void 0!==d&&r.addLevel(d,p.distance)}return r}});var yh,xh={UVMapping:300,CubeReflectionMapping:gt,CubeRefractionMapping:vt,EquirectangularReflectionMapping:yt,EquirectangularRefractionMapping:xt,SphericalReflectionMapping:bt,CubeUVReflectionMapping:wt,CubeUVRefractionMapping:Tt},bh={RepeatWrapping:St,ClampToEdgeWrapping:At,MirroredRepeatWrapping:Lt},wh={NearestFilter:Rt,NearestMipMapNearestFilter:Pt,NearestMipMapLinearFilter:Ct,LinearFilter:Ot,LinearMipMapNearestFilter:It,LinearMipMapLinearFilter:Nt};function _h(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==t?t:ac,this.options=void 0}function Mh(){this.type="ShapePath",this.color=new Tr,this.subPaths=[],this.currentPath=null}function Eh(t){this.type="Font",this.data=t}function Th(t,e,r,n,i){var a=i.glyphs[t]||i.glyphs["?"];if(a){var o,s,c,h,l,u,p,d,f=new Mh;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,v=m.length;g<v;){switch(m[g++]){case"m":o=m[g++]*e+r,s=m[g++]*e+n,f.moveTo(o,s);break;case"l":o=m[g++]*e+r,s=m[g++]*e+n,f.lineTo(o,s);break;case"q":c=m[g++]*e+r,h=m[g++]*e+n,l=m[g++]*e+r,u=m[g++]*e+n,f.quadraticCurveTo(l,u,c,h);break;case"b":c=m[g++]*e+r,h=m[g++]*e+n,l=m[g++]*e+r,u=m[g++]*e+n,p=m[g++]*e+r,d=m[g++]*e+n,f.bezierCurveTo(l,u,p,d,c,h)}}return{offsetX:a.ha*e,path:f}}}function Sh(t){this.manager=void 0!==t?t:ac}_h.prototype={constructor:_h,setOptions:function(t){return this.options=t,this},load:function(e,r,t,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=nc.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){r&&r(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,i.options)}).then(function(t){nc.add(e,t),r&&r(t),i.manager.itemEnd(e)}).catch(function(t){n&&n(t),i.manager.itemEnd(e),i.manager.itemError(e)})},setCrossOrigin:function(){return this},setPath:function(t){return this.path=t,this}},Object.assign(Mh.prototype,{moveTo:function(t,e){this.currentPath=new Nc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,r,n){this.currentPath.quadraticCurveTo(t,e,r,n)},bezierCurveTo:function(t,e,r,n,i,a){this.currentPath.bezierCurveTo(t,e,r,n,i,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function r(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r],a=new Dc;a.curves=i.curves,e.push(a)}return e}function n(t,e){for(var r=e.length,n=!1,i=r-1,a=0;a<r;i=a++){var o=e[i],s=e[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[i],h=-h),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n}var i=ws.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return r(a);var o,s,c,h=[];if(1===a.length)return s=a[0],(c=new Dc).curves=s.curves,h.push(c),h;var l=!i(a[0].getPoints());l=t?!l:l;var u,p,d=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v<y;v++)o=i(u=(s=a[v]).getPoints()),(o=t?!o:o)?(!l&&f[g]&&g++,f[g]={s:new Dc,p:u},f[g].s.curves=s.curves,l&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return r(a);if(1<f.length){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],E=0;E<M.length;E++){for(var T=M[E],S=!0,A=0;A<f.length;A++)n(T.p,f[A].p)&&(w!==A&&b.push({froms:w,tos:A,hole:E}),S?(S=!1,d[A].push(T)):x=!0);S&&d[w].push(T)}0<b.length&&(x||(m=d))}v=0;for(var L=f.length;v<L;v++){c=f[v].s,h.push(c);for(var R=0,P=(p=m[v]).length;R<P;R++)c.holes.push(p[R].h)}return h}}),Object.assign(Eh.prototype,{isFont:!0,generateShapes:function(t,e){void 0===e&&(e=100);for(var r=[],n=function(t,e,r){for(var n=Array.from?Array.from(t):String(t).split(""),i=e/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*i,o=[],s=0,c=0,h=0;h<n.length;h++){var l=n[h];if("\n"===l)s=0,c-=a;else{var u=Th(l,i,s,c,r);s+=u.offsetX,o.push(u.path)}}return o}(t,e,this.data),i=0,a=n.length;i<a;i++)Array.prototype.push.apply(r,n[i].toShapes());return r}}),Object.assign(Sh.prototype,{load:function(t,n,e,r){var i=this,a=new sc(this.manager);a.setPath(this.path),a.load(t,function(e){var r;try{r=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(e.substring(65,e.length-2))}var t=i.parse(r);n&&n(t)},e,r)},parse:function(t){return new Eh(t)},setPath:function(t){return this.path=t,this}});var Ah,Lh,Rh,Ph,Ch,Oh,Ih,Nh,Dh,Uh,Bh,Fh,zh,Gh,Hh,Vh,kh,jh,Wh={getContext:function(){return void 0===yh&&(yh=new(window.AudioContext||window.webkitAudioContext)),yh},setContext:function(t){yh=t}};function Xh(t){this.manager=void 0!==t?t:ac}function qh(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new co,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new co,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Yh(t,e,r){$r.call(this),this.type="CubeCamera";var i=new co(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new We(1,0,0)),this.add(i);var a=new co(90,1,t,e);a.up.set(0,-1,0),a.lookAt(new We(-1,0,0)),this.add(a);var o=new co(90,1,t,e);o.up.set(0,0,1),o.lookAt(new We(0,1,0)),this.add(o);var s=new co(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new We(0,-1,0)),this.add(s);var c=new co(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new We(0,0,1)),this.add(c);var h=new co(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new We(0,0,-1)),this.add(h);var n={format:Yt,magFilter:Ot,minFilter:Ot};this.renderTarget=new ar(r,r,n),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,n=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,i,r),r.activeCubeFace=1,t.render(e,a,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,s,r),r.activeCubeFace=4,t.render(e,c,r),r.texture.generateMipmaps=n,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)},this.clear=function(t,e,r,n){for(var i=this.renderTarget,a=0;a<6;a++)i.activeCubeFace=a,t.setRenderTarget(i),t.clear(e,r,n);t.setRenderTarget(null)}}function Jh(){$r.call(this),this.type="AudioListener",this.context=Wh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Zh(t){$r.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Qh(t){Zh.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Kh(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function $h(t,e,r){this.binding=t,this.valueSize=r;var n,i=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":i=Array,n=this._select;break;default:n=this._lerp}this.buffer=new i(4*r),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(Xh.prototype,{load:function(t,r,e,n){var i=new sc(this.manager);i.setResponseType("arraybuffer"),i.load(t,function(t){var e=t.slice(0);Wh.getContext().decodeAudioData(e,function(t){r(t)})},e,n)}}),Object.assign(qh.prototype,{update:(Dh=new ke,Uh=new ke,function(t){if(Ah!==this||Lh!==t.focus||Rh!==t.fov||Ph!==t.aspect*this.aspect||Ch!==t.near||Oh!==t.far||Ih!==t.zoom||Nh!==this.eyeSep){Ah=this,Lh=t.focus,Rh=t.fov,Ph=t.aspect*this.aspect,Ch=t.near,Oh=t.far,Ih=t.zoom;var e,r,n=t.projectionMatrix.clone(),i=(Nh=this.eyeSep/2)*Ch/Lh,a=Ch*Math.tan(He.DEG2RAD*Rh*.5)/Ih;Uh.elements[12]=-Nh,Dh.elements[12]=Nh,e=-a*Ph+i,r=a*Ph+i,n.elements[0]=2*Ch/(r-e),n.elements[8]=(r+e)/(r-e),this.cameraL.projectionMatrix.copy(n),e=-a*Ph-i,r=a*Ph-i,n.elements[0]=2*Ch/(r-e),n.elements[8]=(r+e)/(r-e),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Uh),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Dh)})}),(Yh.prototype=Object.create($r.prototype)).constructor=Yh,Jh.prototype=Object.assign(Object.create($r.prototype),{constructor:Jh,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},updateMatrixWorld:(Bh=new We,Fh=new je,zh=new We,Gh=new We,function(t){$r.prototype.updateMatrixWorld.call(this,t);var e=this.context.listener,r=this.up;this.matrixWorld.decompose(Bh,Fh,zh),Gh.set(0,0,-1).applyQuaternion(Fh),e.positionX?(e.positionX.setValueAtTime(Bh.x,this.context.currentTime),e.positionY.setValueAtTime(Bh.y,this.context.currentTime),e.positionZ.setValueAtTime(Bh.z,this.context.currentTime),e.forwardX.setValueAtTime(Gh.x,this.context.currentTime),e.forwardY.setValueAtTime(Gh.y,this.context.currentTime),e.forwardZ.setValueAtTime(Gh.z,this.context.currentTime),e.upX.setValueAtTime(r.x,this.context.currentTime),e.upY.setValueAtTime(r.y,this.context.currentTime),e.upZ.setValueAtTime(r.z,this.context.currentTime)):(e.setPosition(Bh.x,Bh.y,Bh.z),e.setOrientation(Gh.x,Gh.y,Gh.z,r.x,r.y,r.z))})}),Zh.prototype=Object.assign(Object.create($r.prototype),{constructor:Zh,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setMediaElementSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),this.startTime=this.context.currentTime,t.start(this.startTime,this.offset),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}),Qh.prototype=Object.assign(Object.create(Zh.prototype),{constructor:Qh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){return this.panner.refDistance=t,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){return this.panner.rolloffFactor=t,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){return this.panner.distanceModel=t,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){return this.panner.maxDistance=t,this},setDirectionalCone:function(t,e,r){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=r,this},updateMatrixWorld:(Hh=new We,Vh=new je,kh=new We,jh=new We,function(t){$r.prototype.updateMatrixWorld.call(this,t);var e=this.panner;this.matrixWorld.decompose(Hh,Vh,kh),jh.set(0,0,1).applyQuaternion(Vh),e.setPosition(Hh.x,Hh.y,Hh.z),e.setOrientation(jh.x,jh.y,jh.z)})}),Object.assign(Kh.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),r=0;r<e.length;r++)t+=e[r];return t/e.length}}),Object.assign($h.prototype,{accumulate:function(t,e){var r=this.buffer,n=this.valueSize,i=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)r[i+o]=r[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(r,i,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,r=this.buffer,n=t*e+e,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*e;this._mixBufferRegion(r,n,o,1-i,e)}for(var s=e,c=e+e;s!==c;++s)if(r[s]!==r[s+e]){a.setValue(r,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,r=this.valueSize,n=3*r;t.getValue(e,n);for(var i=r,a=n;i!==a;++i)e[i]=e[n+i%r];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,r,n,i){if(.5<=n)for(var a=0;a!==i;++a)t[e+a]=t[r+a]},_slerp:function(t,e,r,n){je.slerpFlat(t,e,t,e,t,r,n)},_lerp:function(t,e,r,n,i){for(var a=1-n,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[r+o]*n}}});var tl,el,rl,nl,il,al,ol,sl,cl,hl,ll,ul,pl,dl,fl,ml,gl,vl,yl,xl,bl,wl,_l,Ml,El,Tl,Sl,Al,Ll,Rl,Pl,Cl,Ol,Il,Nl,Dl="\\[\\]\\.:\\/";function Ul(t,e,r){var n=r||Bl.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function Bl(t,e,r){this.path=e,this.parsedPath=r||Bl.parseTrackName(e),this.node=Bl.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Fl(){this.uuid=He.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,r=arguments.length;e!==r;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function zl(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null;for(var n=e.tracks,i=n.length,a=new Array(i),o={endingStart:Se,endingEnd:Se},s=0;s!==i;++s){var c=n[s].createInterpolant(null);(a[s]=c).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Gl(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Hl(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Vl(){Un.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function kl(t,e,r){vo.call(this,t,e),this.meshPerAttribute=r||1}function jl(t,e,r){dn.call(this,t,e),this.meshPerAttribute=r||1}function Wl(t,e,r,n){this.ray=new mi(t,e),this.near=r||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Xl(t,e){return t.distance-e.distance}function ql(t,e,r,n){if(!1!==t.visible&&(t.raycast(e,r),!0===n))for(var i=t.children,a=0,o=i.length;a<o;a++)ql(i[a],e,r,!0)}function Yl(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Jl(t,e,r){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==r?r:0,this}function Zl(t,e,r){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==r?r:0,this}function Ql(t,e){this.min=void 0!==t?t:new Ve(1/0,1/0),this.max=void 0!==e?e:new Ve(-1/0,-1/0)}function Kl(t,e){this.start=void 0!==t?t:new We,this.end=void 0!==e?e:new We}function $l(t){$r.call(this),this.material=t,this.render=function(){}}function tu(t,e,r,n){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==r?r:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new Un,h=new wn(2*o*3,3);c.addAttribute("position",h),Ao.call(this,c,new To({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function eu(t,e){$r.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var r=new Un,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}r.addAttribute("position",new wn(n,3));var c=new To({fog:!1});this.cone=new Ao(r,c),this.add(this.cone),this.update()}function ru(t){for(var e=function t(e){var r=[];e&&e.isBone&&r.push(e);for(var n=0;n<e.children.length;n++)r.push.apply(r,t(e.children[n]));return r}(t),r=new Un,n=[],i=[],a=new Tr(0,0,1),o=new Tr(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}r.addAttribute("position",new wn(n,3)),r.addAttribute("color",new wn(i,3));var h=new To({vertexColors:T,depthTest:!1,depthWrite:!1,transparent:!0});Ao.call(this,r,h),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}function nu(t,e,r){this.light=t,this.light.updateMatrixWorld(),this.color=r;var n=new Cs(e,4,2),i=new di({wireframe:!0,fog:!1});vi.call(this,n,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function iu(t,e){$r.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;var r=new To({fog:!1}),n=new Un;n.addAttribute("position",new dn(new Float32Array(15),3)),this.line=new So(n,r),this.add(this.line),this.update()}function au(t,e,r){$r.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=r;var n=new ko(e);n.rotateY(.5*Math.PI),this.material=new di({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=T);var i=n.getAttribute("position"),a=new Float32Array(3*i.count);n.addAttribute("color",new dn(a,3)),this.add(new vi(n,this.material)),this.update()}function ou(t,e,r,n){t=t||10,e=e||10,r=new Tr(void 0!==r?r:4473924),n=new Tr(void 0!==n?n:8947848);for(var i=e/2,a=t/e,o=t/2,s=[],c=[],h=0,l=0,u=-o;h<=e;h++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=h===i?r:n;p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3}var d=new Un;d.addAttribute("position",new wn(s,3)),d.addAttribute("color",new wn(c,3));var f=new To({vertexColors:T});Ao.call(this,d,f)}function su(t,e,r,n,i,a){t=t||10,e=e||16,r=r||8,n=n||64,i=new Tr(void 0!==i?i:4473924),a=new Tr(void 0!==a?a:8947848);var o,s,c,h,l,u,p,d=[],f=[];for(h=0;h<=e;h++)c=h/e*(2*Math.PI),o=Math.sin(c)*t,s=Math.cos(c)*t,d.push(0,0,0),d.push(o,0,s),p=1&h?i:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(h=0;h<=r;h++)for(p=1&h?i:a,u=t-t/r*h,l=0;l<n;l++)c=l/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b),c=(l+1)/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new Un;m.addAttribute("position",new wn(d,3)),m.addAttribute("color",new wn(f,3));var g=new To({vertexColors:T});Ao.call(this,m,g)}function cu(t,e,r,n){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==r?r:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Un,h=new wn(2*o*3,3);c.addAttribute("position",h),Ao.call(this,c,new To({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function hu(t,e,r){$r.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,void 0===e&&(e=1);var n=new Un;n.addAttribute("position",new wn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new To({fog:!1});this.lightPlane=new So(n,i),this.add(this.lightPlane),(n=new Un).addAttribute("position",new wn([0,0,0,0,0,1],3)),this.targetLine=new So(n,i),this.add(this.targetLine),this.update()}function lu(t){var e=new Un,r=new To({color:16777215,vertexColors:1}),n=[],i=[],a={},o=new Tr(16755200),s=new Tr(16711680),c=new Tr(43775),h=new Tr(16777215),l=new Tr(3355443);function u(t,e,r){p(t,r),p(e,r)}function p(t,e){n.push(0,0,0),i.push(e.r,e.g,e.b),void 0===a[t]&&(a[t]=[]),a[t].push(n.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c),u("c","t",h),u("p","c",l),u("cn1","cn2",l),u("cn3","cn4",l),u("cf1","cf2",l),u("cf3","cf4",l),e.addAttribute("position",new wn(n,3)),e.addAttribute("color",new wn(i,3)),Ao.call(this,e,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function uu(t,e){this.object=t,void 0===e&&(e=16776960);var r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),i=new Un;i.setIndex(new dn(r,1)),i.addAttribute("position",new dn(n,3)),Ao.call(this,i,new To({color:e})),this.matrixAutoUpdate=!1,this.update()}function pu(t,e){this.type="Box3Helper",this.box=t;var r=void 0!==e?e:16776960,n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Un;i.setIndex(new dn(n,1)),i.addAttribute("position",new wn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),Ao.call(this,i,new To({color:r})),this.geometry.computeBoundingSphere()}function du(t,e,r){this.type="PlaneHelper",this.plane=t,this.size=void 0===e?1:e;var n=void 0!==r?r:16776960,i=new Un;i.addAttribute("position",new wn([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,0,1,0,0,0],3)),i.computeBoundingSphere(),So.call(this,i,new To({color:n}));var a=new Un;a.addAttribute("position",new wn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new vi(a,new di({color:n,opacity:.2,transparent:!0,depthWrite:!1})))}function fu(t,e,r,n,i,a){$r.call(this),void 0===n&&(n=16776960),void 0===r&&(r=1),void 0===i&&(i=.2*r),void 0===a&&(a=.2*i),void 0===Cl&&((Cl=new Un).addAttribute("position",new wn([0,0,0,0,1,0],3)),(Ol=new Hs(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new So(Cl,new To({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new vi(Ol,new di({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(r,i,a)}function mu(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],r=new Un;r.addAttribute("position",new wn(e,3)),r.addAttribute("color",new wn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new To({vertexColors:T});Ao.call(this,r,n)}Object.assign(Ul.prototype,{getValue:function(t,e){this.bind();var r=this._targetGroup.nCachedObjects_,n=this._bindings[r];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}}),Object.assign(Bl,{Composite:Ul,create:function(t,e,r){return t&&t.isAnimationObjectGroup?new Bl.Composite(t,e,r):new Bl(t,e,r)},sanitizeNodeName:(cl=new RegExp("["+Dl+"]","g"),function(t){return t.replace(/\s/g,"_").replace(cl,"")}),parseTrackName:(tl="[^"+Dl+"]",el="[^"+Dl.replace("\\.","")+"]",rl=/((?:WC+[\/:])*)/.source.replace("WC",tl),nl=/(WCOD+)?/.source.replace("WCOD",el),il=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tl),al=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tl),ol=new RegExp("^"+rl+nl+il+al+"$"),sl=["material","materials","bones"],function(t){var e=ol.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var r={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var i=r.nodeName.substring(n+1);-1!==sl.indexOf(i)&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=i)}if(null===r.propertyName||0===r.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return r}),findNode:function(t,i){if(!i||""===i||"root"===i||"."===i||-1===i||i===t.name||i===t.uuid)return t;if(t.skeleton){var e=t.skeleton.getBoneByName(i);if(void 0!==e)return e}if(t.children){var a=function(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.name===i||r.uuid===i)return r;var n=a(r.children);if(n)return n}return null},r=a(t.children);if(r)return r}return null}}),Object.assign(Bl.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)t[e++]=r[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++]},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,n=e.propertyName,i=e.propertyIndex;if(t||(t=Bl.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var a=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==a){if(void 0===t[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[a]}}var s=t[n];if(void 0!==s){var c=this.Versioning.None;void 0!==t.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var h=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(t.geometry.morphAttributes.position[o].name===i){i=o;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===i){i=o;break}}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}else{var l=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+n+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Bl.prototype,{_getValue_unbound:Bl.prototype.getValue,_setValue_unbound:Bl.prototype.setValue}),Object.assign(Fl.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=n[p];if(void 0===d){d=e++,n[p]=d,t.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new Bl(u,i[f],a[f]))}else if(d<r){c=t[d];var g=--r,v=t[g];t[n[v.uuid]=d]=v,t[n[p]=g]=u;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[g],b=y[d];y[d]=x,void 0===b&&(b=new Bl(u,i[f],a[f])),y[g]=b}}else t[d]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=r},remove:function(){for(var t=this._objects,e=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,i=n.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,h=r[c];if(void 0!==h&&e<=h){var l=e++,u=t[l];t[r[u.uuid]=h]=u,t[r[c]=l]=s;for(var p=0,d=i;p!==d;++p){var f=n[p],m=f[l],g=f[h];f[h]=m,f[l]=g}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,h=n[c];if(void 0!==h)if(delete n[c],h<r){var l=--r,u=t[l],p=t[v=--e];t[n[u.uuid]=h]=u,t[n[p.uuid]=l]=p,t.pop();for(var d=0,f=a;d!==f;++d){var m=(y=i[d])[l],g=y[v];y[h]=m,y[l]=g,y.pop()}}else{var v;t[n[(p=t[v=--e]).uuid]=h]=p,t.pop();for(d=0,f=a;d!==f;++d){var y;(y=i[d])[h]=y[v],y.pop()}}}this.nCachedObjects_=r},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,n=r[t],i=this._bindings;if(void 0!==n)return i[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,l=new Array(c);n=i.length,r[t]=n,a.push(t),o.push(e),i.push(l);for(var u=h,p=s.length;u!==p;++u){var d=s[u];l[u]=new Bl(d,t,e)}return l},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var n=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];a[e[t[o]]=r]=s,a.pop(),i[r]=i[o],i.pop(),n[r]=n[o],n.pop()}}}),Object.assign(zl.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){var n=this._clip.duration,i=t._clip.duration,a=i/n,o=n/i;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,r){var n=this._mixer,i=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+r,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,n){if(this.enabled){var i=this._startTime;if(null!==i){var a=(t-i)*r;if(a<0||0===r)return;this._startTime=null,e=r*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(0<s)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var r=this._weightInterpolant;if(null!==r){var n=r.evaluate(t)[0];e*=n,t>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r)e*=r.evaluate(t)[0],t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e},_updateTime:function(t){var e=this.time+t,r=this._clip.duration,n=this.loop,i=this._loopCount,a=2202===n;if(0===t)return-1===i?e:a&&1==(1&i)?r-e:e;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r<=e)e=r;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(0<=t?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r<=e||e<0){var o=Math.floor(e/r);e-=r*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0<t?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&i))return r-(this.time=e)}return this.time=e},_setEndings:function(t,e,r){var n=this._interpolantSettings;r?(n.endingStart=Ae,n.endingEnd=Ae):(n.endingStart=t?this.zeroSlopeAtStart?Ae:Se:Le,n.endingEnd=e?this.zeroSlopeAtEnd?Ae:Se:Le)},_scheduleFading:function(t,e,r){var n=this._mixer,i=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=e,o[1]=i+t,s[1]=r,this}}),Gl.prototype=Object.assign(Object.create(e.prototype),{constructor:Gl,_bindAction:function(t,e){var r=t._localRoot||this._root,n=t._clip.tracks,i=n.length,a=t._propertyBindings,o=t._interpolants,s=r.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==i;++l){var u=n[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(void 0!==(d=a[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;++(d=new $h(Bl.create(r,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.uuid,n=this._actionsByClip[r];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,r,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,n=e.length;r!==n;++r){var i=e[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,r){var n=this._actions,i=this._actionsByClip,a=i[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=this._actions,r=e[e.length-1],n=t._cacheIndex;e[r._cacheIndex=n]=r,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],h=t._byClipCacheIndex;s[c._byClipCacheIndex=h]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,r=0,n=e.length;r!==n;++r){var i=e[r];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,n=this._nActiveActions++,i=e[n];e[t._cacheIndex=n]=t,e[i._cacheIndex=r]=i},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,n=--this._nActiveActions,i=e[n];e[t._cacheIndex=n]=t,e[i._cacheIndex=r]=i},_addInactiveBinding:function(t,e,r){var n=this._bindingsByRootAndName,i=n[e],a=this._bindings;void 0===i&&(i={},n[e]=i),(i[r]=t)._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=t.binding,n=r.rootNode.uuid,i=r.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;e[s._cacheIndex=c]=s,e.pop(),delete o[i];t:{for(var h in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,n=this._nActiveBindings++,i=e[n];e[t._cacheIndex=n]=t,e[i._cacheIndex=r]=i},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,n=--this._nActiveBindings,i=e[n];e[t._cacheIndex=n]=t,e[i._cacheIndex=r]=i},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&(t[(r=new Jc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,n=--this._nActiveControlInterpolants,i=e[n];e[t.__cacheIndex=n]=t,e[i.__cacheIndex=r]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var r=e||this._root,n=r.uuid,i="string"==typeof t?ah.findByName(r,t):t,a=null!==i?i.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var h=new zl(this,i,e);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(t,e){var r=e||this._root,n=r.uuid,i="string"==typeof t?ah.findByName(r,t):t,a=i?i.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,r=this._bindings,n=this._nActiveBindings;this._nActiveActions=0;for(var i=this._nActiveBindings=0;i!==e;++i)t[i].reset();for(i=0;i!==n;++i)r[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,n=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==r;++o){e[o]._update(n,t,i,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,r=t.uuid,n=this._actionsByClip,i=n[r];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,e[l._cacheIndex=h]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[r]}},uncacheRoot:function(t){var e=t.uuid,r=this._actionsByClip;for(var n in r){var i=r[n].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[e];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),Hl.prototype.clone=function(){return new Hl(void 0===this.value.clone?this.value:this.value.clone())},Vl.prototype=Object.assign(Object.create(Un.prototype),{constructor:Vl,isInstancedBufferGeometry:!0,copy:function(t){return Un.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),kl.prototype=Object.assign(Object.create(vo.prototype),{constructor:kl,isInstancedInterleavedBuffer:!0,copy:function(t){return vo.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),jl.prototype=Object.assign(Object.create(dn.prototype),{constructor:jl,isInstancedBufferAttribute:!0,copy:function(t){return dn.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(Wl.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e,r){var n=r||[];return ql(t,this,n,e),n.sort(Xl),n},intersectObjects:function(t,e,r){var n=r||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var i=0,a=t.length;i<a;i++)ql(t[i],this,n,e);return n.sort(Xl),n}}),Object.assign(Yl.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(Jl.prototype,{set:function(t,e,r){return this.radius=t,this.phi=e,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(He.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(Zl.prototype,{set:function(t,e,r){return this.radius=t,this.theta=e,this.y=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),Object.assign(Ql.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:(ll=new Ve,function(t,e){var r=ll.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new Ve),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new Ve),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new Ve),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new Ve),e.copy(t).clamp(this.min,this.max)},distanceToPoint:(hl=new Ve,function(t){return hl.copy(t).clamp(this.min,this.max).sub(t).length()}),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Kl.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new We),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new We),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new We),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(ul=new We,pl=new We,function(t,e){ul.subVectors(t,this.start),pl.subVectors(this.end,this.start);var r=pl.dot(pl),n=pl.dot(ul)/r;return e&&(n=He.clamp(n,0,1)),n}),closestPointToPoint:function(t,e,r){var n=this.closestPointToPointParameter(t,e);return void 0===r&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),r=new We),this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),(($l.prototype=Object.create($r.prototype)).constructor=$l).prototype.isImmediateRenderObject=!0,((tu.prototype=Object.create(Ao.prototype)).constructor=tu).prototype.update=(dl=new We,fl=new We,ml=new Xe,function(){var t=["a","b","c"];this.object.updateMatrixWorld(!0),ml.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,r=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)for(var i=n.vertices,a=n.faces,o=0,s=0,c=a.length;s<c;s++)for(var h=a[s],l=0,u=h.vertexNormals.length;l<u;l++){var p=i[h[t[l]]],d=h.vertexNormals[l];dl.copy(p).applyMatrix4(e),fl.copy(d).applyMatrix3(ml).normalize().multiplyScalar(this.size).add(dl),r.setXYZ(o,dl.x,dl.y,dl.z),o+=1,r.setXYZ(o,fl.x,fl.y,fl.z),o+=1}else if(n&&n.isBufferGeometry){var f=n.attributes.position,m=n.attributes.normal;for(l=o=0,u=f.count;l<u;l++)dl.set(f.getX(l),f.getY(l),f.getZ(l)).applyMatrix4(e),fl.set(m.getX(l),m.getY(l),m.getZ(l)),fl.applyMatrix3(ml).normalize().multiplyScalar(this.size).add(dl),r.setXYZ(o,dl.x,dl.y,dl.z),o+=1,r.setXYZ(o,fl.x,fl.y,fl.z),o+=1}r.needsUpdate=!0}),((eu.prototype=Object.create($r.prototype)).constructor=eu).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},eu.prototype.update=(gl=new We,vl=new We,function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),gl.setFromMatrixPosition(this.light.matrixWorld),vl.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(vl.sub(gl)),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}),((ru.prototype=Object.create(Ao.prototype)).constructor=ru).prototype.updateMatrixWorld=(yl=new We,xl=new ke,bl=new ke,function(t){var e=this.bones,r=this.geometry,n=r.getAttribute("position");bl.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<e.length;i++){var o=e[i];o.parent&&o.parent.isBone&&(xl.multiplyMatrices(bl,o.matrixWorld),yl.setFromMatrixPosition(xl),n.setXYZ(a,yl.x,yl.y,yl.z),xl.multiplyMatrices(bl,o.parent.matrixWorld),yl.setFromMatrixPosition(xl),n.setXYZ(a+1,yl.x,yl.y,yl.z),a+=2)}r.getAttribute("position").needsUpdate=!0,$r.prototype.updateMatrixWorld.call(this,t)}),((nu.prototype=Object.create(vi.prototype)).constructor=nu).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},nu.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},((iu.prototype=Object.create($r.prototype)).constructor=iu).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},iu.prototype.update=function(){var t=.5*this.light.width,e=.5*this.light.height,r=this.line.geometry.attributes.position,n=r.array;n[0]=t,n[1]=-e,n[2]=0,n[3]=t,n[4]=e,n[5]=0,n[6]=-t,n[7]=e,n[8]=0,n[9]=-t,n[10]=-e,n[11]=0,n[12]=t,n[13]=-e,n[14]=0,r.needsUpdate=!0,void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)},((au.prototype=Object.create($r.prototype)).constructor=au).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},au.prototype.update=(wl=new We,_l=new Tr,Ml=new Tr,function(){var t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var e=t.geometry.getAttribute("color");_l.copy(this.light.color),Ml.copy(this.light.groundColor);for(var r=0,n=e.count;r<n;r++){var i=r<n/2?_l:Ml;e.setXYZ(r,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(wl.setFromMatrixPosition(this.light.matrixWorld).negate())}),(ou.prototype=Object.create(Ao.prototype)).constructor=ou,(su.prototype=Object.create(Ao.prototype)).constructor=su,((cu.prototype=Object.create(Ao.prototype)).constructor=cu).prototype.update=(El=new We,Tl=new We,Sl=new Xe,function(){this.object.updateMatrixWorld(!0),Sl.getNormalMatrix(this.object.matrixWorld);for(var t=this.object.matrixWorld,e=this.geometry.attributes.position,r=this.object.geometry,n=r.vertices,i=r.faces,a=0,o=0,s=i.length;o<s;o++){var c=i[o],h=c.normal;El.copy(n[c.a]).add(n[c.b]).add(n[c.c]).divideScalar(3).applyMatrix4(t),Tl.copy(h).applyMatrix3(Sl).normalize().multiplyScalar(this.size).add(El),e.setXYZ(a,El.x,El.y,El.z),a+=1,e.setXYZ(a,Tl.x,Tl.y,Tl.z),a+=1}e.needsUpdate=!0}),((hu.prototype=Object.create($r.prototype)).constructor=hu).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},hu.prototype.update=(Al=new We,Ll=new We,Rl=new We,function(){Al.setFromMatrixPosition(this.light.matrixWorld),Ll.setFromMatrixPosition(this.light.target.matrixWorld),Rl.subVectors(Ll,Al),this.lightPlane.lookAt(Rl),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Rl),this.targetLine.scale.z=Rl.length()}),((lu.prototype=Object.create(Ao.prototype)).constructor=lu).prototype.update=function(){var c,h,l=new We,u=new tn;function t(t,e,r,n){l.set(e,r,n).unproject(u);var i=h[t];if(void 0!==i)for(var a=c.getAttribute("position"),o=0,s=i.length;o<s;o++)a.setXYZ(i[o],l.x,l.y,l.z)}return function(){c=this.geometry,h=this.pointMap;u.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),c.getAttribute("position").needsUpdate=!0}}(),((uu.prototype=Object.create(Ao.prototype)).constructor=uu).prototype.update=(Pl=new sr,function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Pl.setFromObject(this.object),!Pl.isEmpty()){var e=Pl.min,r=Pl.max,n=this.geometry.attributes.position,i=n.array;i[0]=r.x,i[1]=r.y,i[2]=r.z,i[3]=e.x,i[4]=r.y,i[5]=r.z,i[6]=e.x,i[7]=e.y,i[8]=r.z,i[9]=r.x,i[10]=e.y,i[11]=r.z,i[12]=r.x,i[13]=r.y,i[14]=e.z,i[15]=e.x,i[16]=r.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=r.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}}),uu.prototype.setFromObject=function(t){return this.object=t,this.update(),this},((pu.prototype=Object.create(Ao.prototype)).constructor=pu).prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),$r.prototype.updateMatrixWorld.call(this,t))},((du.prototype=Object.create(So.prototype)).constructor=du).prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?Mt:D,this.lookAt(this.plane.normal),$r.prototype.updateMatrixWorld.call(this,t)},((fu.prototype=Object.create($r.prototype)).constructor=fu).prototype.setDirection=(Nl=new We,function(t){.99999<t.y?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(Nl.set(t.z,0,-t.x).normalize(),Il=Math.acos(t.y),this.quaternion.setFromAxisAngle(Nl,Il))}),fu.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},fu.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},(mu.prototype=Object.create(Ao.prototype)).constructor=mu;var gu;function vu(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),wc.call(this,t),this.type="catmullrom",this.closed=!0}function yu(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),wc.call(this,t),this.type="catmullrom"}function xu(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),wc.call(this,t),this.type="catmullrom"}dc.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(dc.prototype),(t.prototype.constructor=t).prototype.getPoint=e,t},Object.assign(Ic.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new pn,r=0,n=t.length;r<n;r++){var i=t[r];e.vertices.push(new We(i.x,i.y,i.z||0))}return e}}),Object.assign(Nc.prototype,{fromPoints:function(t){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),vu.prototype=Object.create(wc.prototype),yu.prototype=Object.create(wc.prototype),xu.prototype=Object.create(wc.prototype),Object.assign(xu.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),ou.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},ru.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(fh.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),mh.extractUrlBase(t)}}),Object.assign(Ql.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(sr.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Kl.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(He,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),He.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),He.ceilPowerOfTwo(t)}}),Object.assign(Xe.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(ke.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return void 0===gu&&(gu=new We),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),gu.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.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(t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,r,n,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,r,i,a)}}),xr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},je.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(mi.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(gi.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(gi,{barycoordFromPoint:function(t,e,r,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),gi.getBarycoord(t,e,r,n,i)},normal:function(t,e,r,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),gi.getNormal(t,e,r,n)}}),Object.assign(Dc.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Es(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Us(this,t)}}),Object.assign(Ve.prototype,{fromAttribute:function(t,e,r){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(We.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(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,r){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(nr.prototype,{fromAttribute:function(t,e,r){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(pn.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}}),Object.assign($r.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties($r.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(wo.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(_o.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(dc.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),co.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Uc.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(dn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}}),Object.assign(Un.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Un.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.assign(Ts.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(Hl.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(pi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Tr}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}}}),Object.defineProperties(Qs.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(fi.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(po.prototype,{animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},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.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")}}),Object.defineProperties(po.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(no.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(ir.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(lo.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}}}),Zh.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Xh).load(t,function(t){e.setBuffer(t)}),this},Kh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Yh.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)};var bu={merge:function(t,e,r){var n;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}};tr.crossOrigin=void 0,tr.loadTexture=function(t,e,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new pc;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,r,void 0,n);return e&&(a.mapping=e),a},tr.loadTextureCube=function(t,e,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new uc;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,r,void 0,n);return e&&(a.mapping=e),a},tr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},tr.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var wu={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};t.WebGLRenderTargetCube=ar,t.WebGLRenderTarget=ir,t.WebGLRenderer=po,t.ShaderLib=Rr,t.UniformsLib=Lr,t.UniformsUtils=Mr,t.ShaderChunk=_r,t.FogExp2=fo,t.Fog=mo,t.Scene=go,t.Sprite=bo,t.LOD=wo,t.SkinnedMesh=Eo,t.Skeleton=_o,t.Bone=Mo,t.Mesh=vi,t.LineSegments=Ao,t.LineLoop=Lo,t.Line=So,t.Points=Po,t.Group=so,t.VideoTexture=Co,t.DataTexture=or,t.CompressedTexture=Oo,t.CubeTexture=Ri,t.CanvasTexture=Io,t.DepthTexture=No,t.Texture=rr,t.CompressedTextureLoader=cc,t.DataTextureLoader=hc,t.CubeTextureLoader=uc,t.TextureLoader=pc,t.ObjectLoader=vh,t.MaterialLoader=sh,t.BufferGeometryLoader=ch,t.DefaultLoadingManager=ac,t.LoadingManager=ic,t.JSONLoader=gh,t.ImageLoader=lc,t.ImageBitmapLoader=_h,t.FontLoader=Sh,t.FileLoader=sc,t.Loader=fh,t.LoaderUtils=mh,t.Cache=nc,t.AudioLoader=Xh,t.SpotLightShadow=zc,t.SpotLight=Gc,t.PointLight=Hc,t.RectAreaLight=Wc,t.HemisphereLight=Bc,t.DirectionalLightShadow=Vc,t.DirectionalLight=kc,t.AmbientLight=jc,t.LightShadow=Fc,t.Light=Uc,t.StereoCamera=qh,t.PerspectiveCamera=co,t.OrthographicCamera=en,t.CubeCamera=Yh,t.ArrayCamera=ho,t.Camera=tn,t.AudioListener=Jh,t.PositionalAudio=Qh,t.AudioContext=Wh,t.AudioAnalyser=Kh,t.Audio=Zh,t.VectorKeyframeTrack=ih,t.StringKeyframeTrack=nh,t.QuaternionKeyframeTrack=rh,t.NumberKeyframeTrack=th,t.ColorKeyframeTrack=$c,t.BooleanKeyframeTrack=Kc,t.PropertyMixer=$h,t.PropertyBinding=Bl,t.KeyframeTrack=Qc,t.AnimationUtils=Xc,t.AnimationObjectGroup=Fl,t.AnimationMixer=Gl,t.AnimationClip=ah,t.Uniform=Hl,t.InstancedBufferGeometry=Vl,t.BufferGeometry=Un,t.Geometry=pn,t.InterleavedBufferAttribute=yo,t.InstancedInterleavedBuffer=kl,t.InterleavedBuffer=vo,t.InstancedBufferAttribute=jl,t.Face3=rn,t.Object3D=$r,t.Raycaster=Wl,t.Layers=Ir,t.EventDispatcher=e,t.Clock=Yl,t.QuaternionLinearInterpolant=eh,t.LinearInterpolant=Jc,t.DiscreteInterpolant=Zc,t.CubicInterpolant=Yc,t.Interpolant=qc,t.Triangle=gi,t.Math=He,t.Spherical=Jl,t.Cylindrical=Zl,t.Plane=xr,t.Frustum=br,t.Sphere=yr,t.Ray=mi,t.Matrix4=ke,t.Matrix3=Xe,t.Box3=sr,t.Box2=Ql,t.Line3=Kl,t.Euler=Or,t.Vector4=nr,t.Vector3=We,t.Vector2=Ve,t.Quaternion=je,t.Color=Tr,t.ImmediateRenderObject=$l,t.VertexNormalsHelper=tu,t.SpotLightHelper=eu,t.SkeletonHelper=ru,t.PointLightHelper=nu,t.RectAreaLightHelper=iu,t.HemisphereLightHelper=au,t.GridHelper=ou,t.PolarGridHelper=su,t.FaceNormalsHelper=cu,t.DirectionalLightHelper=hu,t.CameraHelper=lu,t.BoxHelper=uu,t.Box3Helper=pu,t.PlaneHelper=du,t.ArrowHelper=fu,t.AxesHelper=mu,t.Shape=Dc,t.Path=Nc,t.ShapePath=Mh,t.Font=Eh,t.CurvePath=Ic,t.Curve=dc,t.ImageUtils=tr,t.ShapeUtils=ws,t.WebGLUtils=oo,t.WireframeGeometry=Do,t.ParametricGeometry=Uo,t.ParametricBufferGeometry=Bo,t.TetrahedronGeometry=Go,t.TetrahedronBufferGeometry=Ho,t.OctahedronGeometry=Vo,t.OctahedronBufferGeometry=ko,t.IcosahedronGeometry=jo,t.IcosahedronBufferGeometry=Wo,t.DodecahedronGeometry=Xo,t.DodecahedronBufferGeometry=qo,t.PolyhedronGeometry=Fo,t.PolyhedronBufferGeometry=zo,t.TubeGeometry=Yo,t.TubeBufferGeometry=Jo,t.TorusKnotGeometry=Zo,t.TorusKnotBufferGeometry=Qo,t.TorusGeometry=Ko,t.TorusBufferGeometry=$o,t.TextGeometry=Ls,t.TextBufferGeometry=Rs,t.SphereGeometry=Ps,t.SphereBufferGeometry=Cs,t.RingGeometry=Os,t.RingBufferGeometry=Is,t.PlaneGeometry=zn,t.PlaneBufferGeometry=Gn,t.LatheGeometry=Ns,t.LatheBufferGeometry=Ds,t.ShapeGeometry=Us,t.ShapeBufferGeometry=Bs,t.ExtrudeGeometry=Es,t.ExtrudeBufferGeometry=Ts,t.EdgesGeometry=zs,t.ConeGeometry=Vs,t.ConeBufferGeometry=ks,t.CylinderGeometry=Gs,t.CylinderBufferGeometry=Hs,t.CircleGeometry=js,t.CircleBufferGeometry=Ws,t.BoxGeometry=Bn,t.BoxBufferGeometry=Fn,t.ShadowMaterial=qs,t.SpriteMaterial=xo,t.RawShaderMaterial=Ys,t.ShaderMaterial=fi,t.PointsMaterial=Ro,t.MeshPhysicalMaterial=Zs,t.MeshStandardMaterial=Js,t.MeshPhongMaterial=Qs,t.MeshToonMaterial=Ks,t.MeshNormalMaterial=$s,t.MeshLambertMaterial=tc,t.MeshDepthMaterial=eo,t.MeshDistanceMaterial=ro,t.MeshBasicMaterial=di,t.LineDashedMaterial=ec,t.LineBasicMaterial=To,t.Material=pi,t.Float64BufferAttribute=_n,t.Float32BufferAttribute=wn,t.Uint32BufferAttribute=bn,t.Int32BufferAttribute=xn,t.Uint16BufferAttribute=yn,t.Int16BufferAttribute=vn,t.Uint8ClampedBufferAttribute=gn,t.Uint8BufferAttribute=mn,t.Int8BufferAttribute=fn,t.BufferAttribute=dn,t.ArcCurve=mc,t.CatmullRomCurve3=wc,t.CubicBezierCurve=Tc,t.CubicBezierCurve3=Sc,t.EllipseCurve=fc,t.LineCurve=Ac,t.LineCurve3=Lc,t.QuadraticBezierCurve=Rc,t.QuadraticBezierCurve3=Pc,t.SplineCurve=Cc,t.REVISION=_t,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},t.CullFaceNone=X,t.CullFaceBack=q,t.CullFaceFront=Y,t.CullFaceFrontBack=3,t.FrontFaceDirectionCW=0,t.FrontFaceDirectionCCW=1,t.BasicShadowMap=0,t.PCFShadowMap=G,t.PCFSoftShadowMap=H,t.FrontSide=D,t.BackSide=Mt,t.DoubleSide=et,t.FlatShading=1,t.SmoothShading=2,t.NoColors=E,t.FaceColors=1,t.VertexColors=T,t.NoBlending=J,t.NormalBlending=Z,t.AdditiveBlending=Q,t.SubtractiveBlending=K,t.MultiplyBlending=$,t.CustomBlending=tt,t.AddEquation=rt,t.SubtractEquation=S,t.ReverseSubtractEquation=A,t.MinEquation=L,t.MaxEquation=R,t.ZeroFactor=P,t.OneFactor=C,t.SrcColorFactor=O,t.OneMinusSrcColorFactor=I,t.SrcAlphaFactor=N,t.OneMinusSrcAlphaFactor=U,t.DstAlphaFactor=B,t.OneMinusDstAlphaFactor=F,t.DstColorFactor=z,t.OneMinusDstColorFactor=V,t.SrcAlphaSaturateFactor=k,t.NeverDepth=nt,t.AlwaysDepth=it,t.LessDepth=at,t.LessEqualDepth=ot,t.EqualDepth=st,t.GreaterEqualDepth=ct,t.GreaterDepth=ht,t.NotEqualDepth=lt,t.MultiplyOperation=j,t.MixOperation=W,t.AddOperation=ut,t.NoToneMapping=pt,t.LinearToneMapping=Et,t.ReinhardToneMapping=dt,t.Uncharted2ToneMapping=ft,t.CineonToneMapping=mt,t.UVMapping=300,t.CubeReflectionMapping=gt,t.CubeRefractionMapping=vt,t.EquirectangularReflectionMapping=yt,t.EquirectangularRefractionMapping=xt,t.SphericalReflectionMapping=bt,t.CubeUVReflectionMapping=wt,t.CubeUVRefractionMapping=Tt,t.RepeatWrapping=St,t.ClampToEdgeWrapping=At,t.MirroredRepeatWrapping=Lt,t.NearestFilter=Rt,t.NearestMipMapNearestFilter=Pt,t.NearestMipMapLinearFilter=Ct,t.LinearFilter=Ot,t.LinearMipMapNearestFilter=It,t.LinearMipMapLinearFilter=Nt,t.UnsignedByteType=Dt,t.ByteType=Ut,t.ShortType=Bt,t.UnsignedShortType=Ft,t.IntType=zt,t.UnsignedIntType=Gt,t.FloatType=Ht,t.HalfFloatType=Vt,t.UnsignedShort4444Type=kt,t.UnsignedShort5551Type=jt,t.UnsignedShort565Type=Wt,t.UnsignedInt248Type=Xt,t.AlphaFormat=qt,t.RGBFormat=Yt,t.RGBAFormat=Jt,t.LuminanceFormat=Zt,t.LuminanceAlphaFormat=Qt,t.RGBEFormat=Kt,t.DepthFormat=$t,t.DepthStencilFormat=te,t.RGB_S3TC_DXT1_Format=ee,t.RGBA_S3TC_DXT1_Format=re,t.RGBA_S3TC_DXT3_Format=ne,t.RGBA_S3TC_DXT5_Format=ie,t.RGB_PVRTC_4BPPV1_Format=ae,t.RGB_PVRTC_2BPPV1_Format=oe,t.RGBA_PVRTC_4BPPV1_Format=se,t.RGBA_PVRTC_2BPPV1_Format=ce,t.RGB_ETC1_Format=he,t.RGBA_ASTC_4x4_Format=le,t.RGBA_ASTC_5x4_Format=ue,t.RGBA_ASTC_5x5_Format=pe,t.RGBA_ASTC_6x5_Format=de,t.RGBA_ASTC_6x6_Format=fe,t.RGBA_ASTC_8x5_Format=me,t.RGBA_ASTC_8x6_Format=ge,t.RGBA_ASTC_8x8_Format=ve,t.RGBA_ASTC_10x5_Format=ye,t.RGBA_ASTC_10x6_Format=xe,t.RGBA_ASTC_10x8_Format=be,t.RGBA_ASTC_10x10_Format=we,t.RGBA_ASTC_12x10_Format=_e,t.RGBA_ASTC_12x12_Format=Me,t.LoopOnce=2200,t.LoopRepeat=2201,t.LoopPingPong=2202,t.InterpolateDiscrete=Ee,t.InterpolateLinear=Te,t.InterpolateSmooth=2302,t.ZeroCurvatureEnding=Se,t.ZeroSlopeEnding=Ae,t.WrapAroundEnding=Le,t.TrianglesDrawMode=Re,t.TriangleStripDrawMode=1,t.TriangleFanDrawMode=2,t.LinearEncoding=Pe,t.sRGBEncoding=Ce,t.GammaEncoding=Oe,t.RGBEEncoding=Ie,t.LogLuvEncoding=3003,t.RGBM7Encoding=Ne,t.RGBM16Encoding=De,t.RGBDEncoding=Ue,t.BasicDepthPacking=Be,t.RGBADepthPacking=Fe,t.TangentSpaceNormalMap=ze,t.ObjectSpaceNormalMap=Ge,t.CubeGeometry=Bn,t.Face4=function(t,e,r,n,i,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new rn(t,e,r,i,a,o)},t.LineStrip=0,t.LinePieces=1,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MultiMaterial=function(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,(t.materials=t).clone=function(){return t.slice()},t},t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Po(t,e)},t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new bo(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Po(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Ro(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Ro(t)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Ro(t)},t.Vertex=function(t,e,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new We(t,e,r)},t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new dn(t,e).setDynamic(!0)},t.Int8Attribute=function(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new fn(t,e)},t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new mn(t,e)},t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new gn(t,e)},t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new vn(t,e)},t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new yn(t,e)},t.Int32Attribute=function(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new xn(t,e)},t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new bn(t,e)},t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new wn(t,e)},t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new _n(t,e)},t.ClosedSplineCurve3=vu,t.SplineCurve3=yu,t.Spline=xu,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new mu(t)},t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new uu(t,e)},t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Ao(new zs(t.geometry),new To({color:void 0!==e?e:16777215}))},t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Ao(new Do(t.geometry),new To({color:void 0!==e?e:16777215}))},t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new sc(t)},t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new hc(t)},t.GeometryUtils=bu,t.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},t.SceneUtils=wu,t.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")},Object.defineProperty(t,"__esModule",{value:!0})});