1 |
- "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function a(o,s,c){function l(t,e){if(!s[t]){if(!o[t]){var i="function"==typeof require&&require;if(!e&&i)return i(t,!0);if(h)return h(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var n=s[t]={exports:{}};o[t][0].call(n.exports,function(e){return l(o[t][1][e]||e)},n,n.exports,a,o,s,c)}return s[t].exports}for(var h="function"==typeof require&&require,e=0;e<c.length;e++)l(c[e]);return l}({1:[function(e,t,i){window.Threebox=e("./src/Threebox"),window.Threebox.ThreeboxConstants=e("./src/constants.js"),window.THREE=e("three"),window.THREE.GLTFLoader=e("./src/Loaders/GLTFLoader"),window.THREE.LegacyGLTFLoader=e("./src/Loaders/LegacyGLTFLoader"),window.THREE.FBXLoader=e("./src/Loaders/FBXLoader"),window.THREE.JSONLoader=e("./src/Loaders/JSONLoader"),window.THREE.LineSegmentsGeometry=e("./src/ext/LineSegmentsGeometry"),window.THREE.LineGeometry=e("./src/ext/LineGeometry"),window.THREE.LineMaterial=e("./src/ext/LineMaterial"),window.THREE.LineSegments2=e("./src/ext/LineSegments2"),window.THREE.Line2=e("./src/ext/Line2"),window.THREE.GeoExtrudeGeometry=e("./src/three64").ExtrudeGeometry},{"./src/Loaders/FBXLoader":5,"./src/Loaders/GLTFLoader":6,"./src/Loaders/JSONLoader":7,"./src/Loaders/LegacyGLTFLoader":8,"./src/Threebox":11,"./src/constants.js":14,"./src/ext/Line2":15,"./src/ext/LineGeometry":16,"./src/ext/LineMaterial":17,"./src/ext/LineSegments2":18,"./src/ext/LineSegmentsGeometry":19,"./src/three64":20,three:2}],2:[function(e,t,i){var r,n;r=this,n=function(e){function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:0<e?1:+e}),"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(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}),Object.assign(t.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners[e];if(void 0!==i){var r=i.indexOf(t);-1!==r&&i.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var i=t.slice(0),r=0,n=i.length;r<n;r++)i[r].call(this,e)}}}});var i,r,h,u,n,a,o,s,c,l,p,d,f,m,g,v,y,x,b,w,_,M,X=0,q=1,Y=2,z=1,G=2,N=0,_e=1,Z=2,E=0,T=2,J=0,K=1,Q=2,$=3,ee=4,te=5,ie=100,S=101,L=102,A=103,R=104,P=200,C=201,I=202,O=203,D=204,U=205,F=206,B=207,H=208,k=209,V=210,re=0,ne=1,ae=2,oe=3,se=4,ce=5,le=6,he=7,j=0,W=1,ue=2,pe=0,Me=1,de=2,fe=3,me=4,ge=5,ve=301,ye=302,xe=303,be=304,we=305,Ee=306,Te=307,Se=1e3,Le=1001,Ae=1002,Re=1003,Pe=1004,Ce=1005,Ie=1006,Oe=1007,De=1008,Ne=1009,Ue=1010,Fe=1011,Be=1012,ze=1013,Ge=1014,He=1015,ke=1016,Ve=1017,je=1018,We=1019,Xe=1020,qe=1021,Ye=1022,Ze=1023,Je=1024,Ke=1025,Qe=Ze,$e=1026,et=1027,tt=1028,it=33776,rt=33777,nt=33778,at=33779,ot=35840,st=35841,ct=35842,lt=35843,ht=36196,ut=37808,pt=37809,dt=37810,ft=37811,mt=37812,gt=37813,vt=37814,yt=37815,xt=37816,bt=37817,wt=37818,_t=37819,Mt=37820,Et=37821,Tt=2300,St=2301,Lt=2400,At=2401,Rt=2402,Pt=0,Ct=3e3,It=3001,Ot=3007,Dt=3002,Nt=3004,Ut=3005,Ft=3006,Bt=3200,zt=3201,Gt=0,Ht=1,kt={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var n=[],e=0;e<256;e++)n[e]=(e<16?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(n[255&e]+n[e>>8&255]+n[e>>16&255]+n[e>>24&255]+"-"+n[255&t]+n[t>>8&255]+"-"+n[t>>16&15|64]+n[t>>24&255]+"-"+n[63&i|128]+n[i>>8&255]+"-"+n[i>>16&255]+n[i>>24&255]+n[255&r]+n[r>>8&255]+n[r>>16&255]+n[r>>24&255]).toUpperCase()}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},lerp:function(e,t,i){return(1-i)*e+i*t},smoothstep:function(e,t,i){return e<=t?0:i<=e?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:i<=e?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*kt.DEG2RAD},radToDeg:function(e){return e*kt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function Vt(e,t){this.x=e||0,this.y=t||0}function jt(){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 Wt(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==r?r:1}function Xt(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}function qt(){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(Vt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Vt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(i=new Vt,r=new Vt,function(e,t){return i.set(e,e),r.set(t,t),this.clamp(i,r)}),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},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(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.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 e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*i-a*r+e.x,this.y=n*r+a*i+e.y,this}}),Object.assign(jt.prototype,{isMatrix4:!0,set:function(e,t,i,r,n,a,o,s,c,l,h,u,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=h,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 jt).fromArray(this.elements)},copy:function(e){var t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:(p=new Xt,function(e){var t=this.elements,i=e.elements,r=1/p.setFromMatrixColumn(e,0).length(),n=1/p.setFromMatrixColumn(e,1).length(),a=1/p.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,r=e.y,n=e.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(r),c=Math.sin(r),l=Math.cos(n),h=Math.sin(n);if("XYZ"===e.order){var u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=p+d*c,t[5]=u-f*c,t[9]=-o*s,t[2]=f-u*c,t[6]=d+p*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,g=s*h,v=c*l,y=c*h;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*c,t[1]=a*h,t[5]=a*l,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*l,g=s*h,v=c*l,y=c*h;t[0]=m-y*o,t[4]=-a*h,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=d*c-p,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=x*h+_,t[5]=a*l,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*l,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:(c=new Xt(0,0,0),l=new Xt(1,1,1),function(e){return this.compose(c,e,l)}),lookAt:(a=new Xt,o=new Xt,s=new Xt,function(e,t,i){var r=this.elements;return s.subVectors(e,t),0===s.lengthSq()&&(s.z=1),s.normalize(),a.crossVectors(i,s),0===a.lengthSq()&&(1===Math.abs(i.z)?s.x+=1e-4:s.z+=1e-4,s.normalize(),a.crossVectors(i,s)),a.normalize(),o.crossVectors(s,a),r[0]=a.x,r[4]=o.x,r[8]=s.x,r[1]=a.y,r[5]=o.y,r[9]=s.y,r[2]=a.z,r[6]=o.z,r[10]=s.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,n=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],l=i[1],h=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],w=r[0],_=r[4],M=r[8],E=r[12],T=r[1],S=r[5],L=r[9],A=r[13],R=r[2],P=r[6],C=r[10],I=r[14],O=r[3],D=r[7],N=r[11],U=r[15];return n[0]=a*w+o*T+s*R+c*O,n[4]=a*_+o*S+s*P+c*D,n[8]=a*M+o*L+s*C+c*N,n[12]=a*E+o*A+s*I+c*U,n[1]=l*w+h*T+u*R+p*O,n[5]=l*_+h*S+u*P+p*D,n[9]=l*M+h*L+u*C+p*N,n[13]=l*E+h*A+u*I+p*U,n[2]=d*w+f*T+m*R+g*O,n[6]=d*_+f*S+m*P+g*D,n[10]=d*M+f*L+m*C+g*N,n[14]=d*E+f*A+m*I+g*U,n[3]=v*w+y*T+x*R+b*O,n[7]=v*_+y*S+x*P+b*D,n[11]=v*M+y*L+x*C+b*N,n[15]=v*E+y*A+x*I+b*U,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:(n=new Xt,function(e){for(var t=0,i=e.count;t<i;t++)n.x=e.getX(t),n.y=e.getY(t),n.z=e.getZ(t),n.applyMatrix4(this),e.setXYZ(t,n.x,n.y,n.z);return e}),determinant:function(){var e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],p=e[14];return e[3]*(n*s*h-r*c*h-n*o*u+i*c*u+r*o*p-i*s*p)+e[7]*(t*s*p-t*c*u+n*a*u-r*a*p+r*c*l-n*s*l)+e[11]*(t*c*h-t*o*p-n*a*h+i*a*p+n*o*l-i*c*l)+e[15]*(-r*o*l-t*s*h+t*o*u+r*a*h-i*a*u+i*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,r=e.elements,n=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],h=r[6],u=r[7],p=r[8],d=r[9],f=r[10],m=r[11],g=r[12],v=r[13],y=r[14],x=r[15],b=d*y*u-v*f*u+v*h*m-l*y*m-d*h*x+l*f*x,w=g*f*u-p*y*u-g*h*m+c*y*m+p*h*x-c*f*x,_=p*v*u-g*d*u+g*l*m-c*v*m-p*l*x+c*d*x,M=g*d*h-p*v*h-g*l*f+c*v*f+p*l*y-c*d*y,E=n*b+a*w+o*_+s*M;if(0==E){var T="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return i[0]=b*S,i[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*S,i[2]=(l*y*s-v*h*s+v*o*u-a*y*u-l*o*x+a*h*x)*S,i[3]=(d*h*s-l*f*s-d*o*u+a*f*u+l*o*m-a*h*m)*S,i[4]=w*S,i[5]=(p*y*s-g*f*s+g*o*m-n*y*m-p*o*x+n*f*x)*S,i[6]=(g*h*s-c*y*s-g*o*u+n*y*u+c*o*x-n*h*x)*S,i[7]=(c*f*s-p*h*s+p*o*u-n*f*u-c*o*m+n*h*m)*S,i[8]=_*S,i[9]=(g*d*s-p*v*s-g*a*m+n*v*m+p*a*x-n*d*x)*S,i[10]=(c*v*s-g*l*s+g*a*u-n*v*u-c*a*x+n*l*x)*S,i[11]=(p*l*s-c*d*s-p*a*u+n*d*u+c*a*m-n*l*m)*S,i[12]=M*S,i[13]=(p*v*o-g*d*o+g*a*f-n*v*f-p*a*y+n*d*y)*S,i[14]=(g*l*o-c*v*o-g*a*h+n*v*h+c*a*y-n*l*y)*S,i[15]=(c*d*o-p*l*o+p*a*h-n*d*h-c*a*f+n*l*f)*S,this},scale:function(e){var t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=1-i,a=e.x,o=e.y,s=e.z,c=n*a,l=n*o;return this.set(c*a+i,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+i,l*s-r*a,0,c*s-r*o,l*s+r*a,n*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(e,t,i){return this.set(1,t,i,0,e,1,i,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,i){var r=this.elements,n=t._x,a=t._y,o=t._z,s=t._w,c=n+n,l=a+a,h=o+o,u=n*c,p=n*l,d=n*h,f=a*l,m=a*h,g=o*h,v=s*c,y=s*l,x=s*h,b=i.x,w=i.y,_=i.z;return r[0]=(1-(f+g))*b,r[1]=(p+x)*b,r[2]=(d-y)*b,r[3]=0,r[4]=(p-x)*w,r[5]=(1-(u+g))*w,r[6]=(m+v)*w,r[7]=0,r[8]=(d+y)*_,r[9]=(m-v)*_,r[10]=(1-(u+f))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:(h=new Xt,u=new jt,function(e,t,i){var r=this.elements,n=h.set(r[0],r[1],r[2]).length(),a=h.set(r[4],r[5],r[6]).length(),o=h.set(r[8],r[9],r[10]).length();this.determinant()<0&&(n=-n),e.x=r[12],e.y=r[13],e.z=r[14],u.copy(this);var s=1/n,c=1/a,l=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]*=l,u.elements[9]*=l,u.elements[10]*=l,t.setFromRotationMatrix(u),i.x=n,i.y=a,i.z=o,this}),makePerspective:function(e,t,i,r,n,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*n/(t-e),c=2*n/(i-r),l=(t+e)/(t-e),h=(i+r)/(i-r),u=-(a+n)/(a-n),p=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=h,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(e,t,i,r,n,a){var o=this.elements,s=1/(t-e),c=1/(i-r),l=1/(a-n),h=(t+e)*s,u=(i+r)*c,p=(a+n)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,i=e.elements,r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;i<16;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}),Object.assign(Wt,{slerp:function(e,t,i,r){return i.copy(e).slerp(t,r)},slerpFlat:function(e,t,i,r,n,a,o){var s=i[r+0],c=i[r+1],l=i[r+2],h=i[r+3],u=n[a+0],p=n[a+1],d=n[a+2],f=n[a+3];if(h!==f||s!==u||c!==p||l!==d){var m=1-o,g=s*u+c*p+l*d+h*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,l=l*m+d*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=_,c*=_,l*=_,h*=_}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h}}),Object.defineProperties(Wt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(Wt.prototype,{isQuaternion:!0,set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=e._x,r=e._y,n=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(i/2),l=o(r/2),h=o(n/2),u=s(i/2),p=s(r/2),d=s(n/2);return"XYZ"===a?(this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d):"YXZ"===a?(this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d):"ZXY"===a?(this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d):"ZYX"===a?(this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d):"YZX"===a?(this._x=u*l*h+c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h-u*p*d):"XZY"===a&&(this._x=u*l*h-c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h+u*p*d),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],c=i[9],l=i[2],h=i[6],u=i[10],p=r+s+u;return 0<p?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(h-c)*t,this._y=(a-l)*t,this._z=(o-n)*t):s<r&&u<r?(t=2*Math.sqrt(1+r-s-u),this._w=(h-c)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(a+l)/t):u<s?(t=2*Math.sqrt(1+s-r-u),this._w=(a-l)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(c+h)/t):(t=2*Math.sqrt(1+u-r-s),this._w=(o-n)/t,this._x=(a+l)/t,this._y=(c+h)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:(f=new Xt,function(e,t){return void 0===f&&(f=new Xt),(d=e.dot(t)+1)<1e-6?(d=0,Math.abs(e.x)>Math.abs(e.z)?f.set(-e.y,e.x,0):f.set(0,-e.z,e.y)):f.crossVectors(e,t),this._x=f.x,this._y=f.y,this._z=f.z,this._w=d,this.normalize()}),angleTo:function(e){return 2*Math.acos(Math.abs(kt.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var i=this.angleTo(e);if(0===i)return this;var r=Math.min(1,t/i);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,r=e._y,n=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=i*l+a*o+r*c-n*s,this._y=r*l+a*s+n*o-i*c,this._z=n*l+a*c+i*s-r*o,this._w=a*l-i*o-r*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,r=this._y,n=this._z,a=this._w,o=a*e._w+i*e._x+r*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o)return this._w=a,this._x=i,this._y=r,this._z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*i+t*this._x,this._y=c*r+t*this._y,this._z=c*n+t*this._z,this.normalize()}var l=Math.sqrt(s),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,p=Math.sin(t*h)/l;return this._w=a*u+this._w*p,this._x=i*u+this._x*p,this._y=r*u+this._y*p,this._z=n*u+this._z*p,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Xt.prototype,{isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(w=new Wt,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(w.setFromEuler(e))}),applyAxisAngle:(b=new Wt,function(e,t){return this.applyQuaternion(b.setFromAxisAngle(e,t))}),applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements,a=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*a,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*a,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*i,l=s*i+o*t-n*r,h=s*r+n*i-a*t,u=-n*t-a*i-o*r;return this.x=c*s+u*-n+l*-o-h*-a,this.y=l*s+u*-a+h*-n-c*-o,this.z=h*s+u*-o+c*-a-l*-n,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:(x=new jt,function(e){return this.applyMatrix4(x.getInverse(e.projectionMatrix)).applyMatrix4(e.matrixWorld)}),transformDirection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:(v=new Xt,y=new Xt,function(e,t){return v.set(e,e,e),y.set(t,t,t),this.clamp(v,y)}),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},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(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(g=new Xt,function(e){return g.copy(this).projectOnVector(e),this.sub(g)}),reflect:(m=new Xt,function(e){return this.sub(m.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(kt.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,i){var r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(qt.prototype,{isMatrix3:!0,set:function(e,t,i,r,n,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=n,l[5]=s,l[6]=i,l[7]=a,l[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(e){var t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:(_=new Xt,function(e){for(var t=0,i=e.count;t<i;t++)_.x=e.getX(t),_.y=e.getY(t),_.z=e.getZ(t),_.applyMatrix3(this),e.setXYZ(t,_.x,_.y,_.z);return e}),multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,n=this.elements,a=i[0],o=i[3],s=i[6],c=i[1],l=i[4],h=i[7],u=i[2],p=i[5],d=i[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return n[0]=a*f+o*v+s*b,n[3]=a*m+o*y+s*w,n[6]=a*g+o*x+s*_,n[1]=c*f+l*v+h*b,n[4]=c*m+l*y+h*w,n[7]=c*g+l*x+h*_,n[2]=u*f+p*v+d*b,n[5]=u*m+p*y+d*w,n[8]=u*g+p*x+d*_,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-i*n*l+i*o*s+r*n*c-r*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var i=e.elements,r=this.elements,n=i[0],a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],p=i[8],d=p*c-l*u,f=l*h-p*s,m=u*s-c*h,g=n*d+a*f+o*m;if(0==g){var v="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return r[0]=d*y,r[1]=(o*u-p*a)*y,r[2]=(l*a-o*c)*y,r[3]=f*y,r[4]=(p*n-o*h)*y,r[5]=(o*s-l*n)*y,r[6]=m*y,r[7]=(a*h-u*n)*y,r[8]=(c*n-a*s)*y,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,i,r,n,a,o){var s=Math.cos(n),c=Math.sin(n);this.set(i*s,i*c,-i*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this},rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=this.elements,n=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*n+i*s,r[3]=t*a+i*c,r[6]=t*o+i*l,r[1]=-i*n+t*s,r[4]=-i*a+t*c,r[7]=-i*o+t*l,this},translate:function(e,t){var i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this},equals:function(e){for(var t=this.elements,i=e.elements,r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;i<9;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}});var Yt,Zt,Jt,Kt,Qt,$t,ei,ti,ii,ri,ni,ai,oi,si,ci,li,hi,ui,pi,di,fi,mi,gi,vi,yi,xi,bi,wi,_i,Mi,Ei={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===M&&(M=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),M.width=e.width,M.height=e.height;var i=M.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=M}return 2048<t.width||2048<t.height?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Ti=0;function Si(e,t,i,r,n,a,o,s,c,l){Object.defineProperty(this,"id",{value:Ti++}),this.uuid=kt.generateUUID(),this.name="",this.image=void 0!==e?e:Si.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:Si.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:Le,this.wrapT=void 0!==r?r:Le,this.magFilter=void 0!==n?n:Ie,this.minFilter=void 0!==a?a:De,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Ze,this.type=void 0!==s?s:Ne,this.offset=new Vt(0,0),this.repeat=new Vt(1,1),this.center=new Vt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new qt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:Ct,this.version=0,this.onUpdate=null}function Li(e,t,i,r){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==r?r:1}function Ai(e,t,i){this.width=e,this.height=t,this.scissor=new Li(0,0,e,t),this.scissorTest=!1,this.viewport=new Li(0,0,e,t),i=i||{},this.texture=new Si(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:Ie,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function Ri(e,t,i){Ai.call(this,e,t,i),this.samples=4}function Pi(e,t,i){Ai.call(this,e,t,i)}function Ci(e,t,i,r,n,a,o,s,c,l,h,u){Si.call(this,null,a,o,s,c,l,r,n,h,u),this.image={data:e,width:t,height:i},this.magFilter=void 0!==c?c:Re,this.minFilter=void 0!==l?l:Re,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function Ii(e,t){this.min=void 0!==e?e:new Xt(1/0,1/0,1/0),this.max=void 0!==t?t:new Xt(-1/0,-1/0,-1/0)}function Oi(e){var t,i;for(t=0,i=e.length-3;t<=i;t+=3){ai.fromArray(e,t);var r=si.x*Math.abs(ai.x)+si.y*Math.abs(ai.y)+si.z*Math.abs(ai.z),n=$t.dot(ai),a=ei.dot(ai),o=ti.dot(ai);if(Math.max(-Math.max(n,a,o),Math.min(n,a,o))>r)return!1}return!0}function Di(e){var t=e.geometry;if(void 0!==t)if(t.isGeometry){var i=t.vertices;for(ui=0,pi=i.length;ui<pi;ui++)di.copy(i[ui]),di.applyMatrix4(e.matrixWorld),hi.expandByPoint(di)}else if(t.isBufferGeometry){var r=t.attributes.position;if(void 0!==r)for(ui=0,pi=r.count;ui<pi;ui++)di.fromBufferAttribute(r,ui).applyMatrix4(e.matrixWorld),hi.expandByPoint(di)}}function Ni(e,t){this.center=void 0!==e?e:new Xt,this.radius=void 0!==t?t:0}function Ui(e,t){this.normal=void 0!==e?e:new Xt(1,0,0),this.constant=void 0!==t?t:0}function Fi(e,t,i,r,n,a){this.planes=[void 0!==e?e:new Ui,void 0!==t?t:new Ui,void 0!==i?i:new Ui,void 0!==r?r:new Ui,void 0!==n?n:new Ui,void 0!==a?a:new Ui]}Si.DEFAULT_IMAGE=void 0,Si.DEFAULT_MAPPING=300,Si.prototype=Object.assign(Object.create(t.prototype),{constructor:Si,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(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var i={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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=kt.generateUUID()),!t&&void 0===e.images[r.uuid]){var n;if(Array.isArray(r)){n=[];for(var a=0,o=r.length;a<o;a++)n.push(Ei.getDataURL(r[a]))}else n=Ei.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:n}}i.image=r.uuid}return t||(e.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||1<e.x)switch(this.wrapS){case Se:e.x=e.x-Math.floor(e.x);break;case Le:e.x=e.x<0?0:1;break;case Ae:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||1<e.y)switch(this.wrapT){case Se:e.y=e.y-Math.floor(e.y);break;case Le:e.y=e.y<0?0:1;break;case Ae:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(Si.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Li.prototype,{isVector4:!0,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,r,n,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],h=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,g=(h+1)/2,v=(f+1)/2,y=(s+l)/4,x=(c+p)/4,b=(u+d)/4;return g<m&&v<m?n=m<.01?(i=0,r=.707106781):(r=y/(i=Math.sqrt(m)),x/i):v<g?n=g<.01?(r=0,i=.707106781):(i=y/(r=Math.sqrt(g)),b/r):v<.01?(r=i=.707106781,n=0):(i=x/(n=Math.sqrt(v)),r=b/n),this.set(i,r,n,t),this}var w=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(l-s)*(l-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(c-p)/w,this.z=(l-s)/w,this.w=Math.acos((o+h+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===Yt&&(Yt=new Li,Zt=new Li),Yt.set(e,e,e,e),Zt.set(t,t,t,t),this.clamp(Yt,Zt)},clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Ai.prototype=Object.assign(Object.create(t.prototype),{constructor:Ai,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ri.prototype=Object.assign(Object.create(Ai.prototype),{constructor:Ri,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Ai.prototype.copy.call(this,e),this.samples=e.samples,this}}),((Pi.prototype=Object.create(Ai.prototype)).constructor=Pi).prototype.isWebGLRenderTargetCube=!0,((Ci.prototype=Object.create(Si.prototype)).constructor=Ci).prototype.isDataTexture=!0,Object.assign(Ii.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],h=e[s+1],u=e[s+2];l<t&&(t=l),h<i&&(i=h),u<r&&(r=u),n<l&&(n=l),a<h&&(a=h),o<u&&(o=u)}return this.min.set(t,i,r),this.max.set(n,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),h=e.getY(s),u=e.getZ(s);l<t&&(t=l),h<i&&(i=h),u<r&&(r=u),n<l&&(n=l),a<h&&(a=h),o<u&&(o=u)}return this.min.set(t,i,r),this.max.set(n,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(fi=new Xt,function(e,t){var i=fi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new Xt),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new Xt),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:(di=new Xt,function(e){return hi=this,e.updateMatrixWorld(!0),e.traverse(Di),this}),containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Xt),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:(li=new Xt,function(e){return this.clampPoint(e.center,li),li.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,i;return i=0<e.normal.x?(t=e.normal.x*this.min.x,e.normal.x*this.max.x):(t=e.normal.x*this.max.x,e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant},intersectsTriangle:($t=new Xt,ei=new Xt,ti=new Xt,ii=new Xt,ri=new Xt,ni=new Xt,ai=new Xt,oi=new Xt,si=new Xt,ci=new Xt,function(e){if(this.isEmpty())return!1;this.getCenter(oi),si.subVectors(this.max,oi),$t.subVectors(e.a,oi),ei.subVectors(e.b,oi),ti.subVectors(e.c,oi),ii.subVectors(ei,$t),ri.subVectors(ti,ei),ni.subVectors($t,ti);var t=[0,-ii.z,ii.y,0,-ri.z,ri.y,0,-ni.z,ni.y,ii.z,0,-ii.x,ri.z,0,-ri.x,ni.z,0,-ni.x,-ii.y,ii.x,0,-ri.y,ri.x,0,-ni.y,ni.x,0];return!!Oi(t)&&!!Oi(t=[1,0,0,0,1,0,0,0,1])&&(ci.crossVectors(ii,ri),Oi(t=[ci.x,ci.y,ci.z]))}),clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Xt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(Qt=new Xt,function(e){return Qt.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(Kt=new Xt,function(e){return void 0===e&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),e=new Ni),this.getCenter(e.center),e.radius=.5*this.getSize(Kt).length(),e}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(Jt=[new Xt,new Xt,new Xt,new Xt,new Xt,new Xt,new Xt,new Xt],function(e){return this.isEmpty()||(Jt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Jt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Jt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Jt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Jt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Jt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Jt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Jt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Jt)),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(Ni.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(mi=new Ii,function(e,t){var i=this.center;void 0!==t?i.copy(t):mi.setFromPoints(e).getCenter(i);for(var r=0,n=0,a=e.length;n<a;n++)r=Math.max(r,i.distanceToSquared(e[n]));return this.radius=Math.sqrt(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var i=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new Xt),t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Ii),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(Ui.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(xi=new Xt,bi=new Xt,function(e,t,i){var r=xi.subVectors(i,t).cross(bi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new Xt),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:(yi=new Xt,function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new Xt);var i=e.delta(yi),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var n=-(e.start.dot(this.normal)+this.constant)/r;return n<0||1<n?void 0:t.copy(i).multiplyScalar(n).add(e.start)}),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&0<i||i<0&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Xt),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(gi=new Xt,vi=new qt,function(e,t){var i=t||vi.getNormalMatrix(e),r=this.coplanarPoint(gi).applyMatrix4(e),n=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(n),this}),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(Fi.prototype,{set:function(e,t,i,r,n,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(n),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,i=0;i<6;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,r=i[0],n=i[1],a=i[2],o=i[3],s=i[4],c=i[5],l=i[6],h=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(o-r,h-s,f-u,y-m).normalize(),t[1].setComponents(o+r,h+s,f+u,y+m).normalize(),t[2].setComponents(o+n,h+c,f+p,y+g).normalize(),t[3].setComponents(o-n,h-c,f-p,y-g).normalize(),t[4].setComponents(o-a,h-l,f-d,y-v).normalize(),t[5].setComponents(o+a,h+l,f+d,y+v).normalize(),this},intersectsObject:(Mi=new Ni,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Mi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Mi)}),intersectsSprite:(_i=new Ni,function(e){return _i.center.set(0,0,0),_i.radius=.7071067811865476,_i.applyMatrix4(e.matrixWorld),this.intersectsSphere(_i)}),intersectsSphere:function(e){for(var t=this.planes,i=e.center,r=-e.radius,n=0;n<6;n++){if(t[n].distanceToPoint(i)<r)return!1}return!0},intersectsBox:(wi=new Xt,function(e){for(var t=this.planes,i=0;i<6;i++){var r=t[i];if(wi.x=0<r.normal.x?e.max.x:e.min.x,wi.y=0<r.normal.y?e.max.y:e.min.y,wi.z=0<r.normal.z?e.max.z:e.min.z,r.distanceToPoint(wi)<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}});var Bi={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\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.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\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.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\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;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\t#ifdef USE_TANGENT\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy = normalScale * mapN.xy;\n\t\t\tnormal = normalize( vTBN * mapN );\n\t\t#else\n\t\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t\t#endif\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#if defined( DITHERING )\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\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 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\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 )\n\tvarying vec2 vUv;\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 )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",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 )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"};function zi(e){var t={};for(var i in e)for(var r in t[i]={},e[i]){var n=e[i][r];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture)?t[i][r]=n.clone():Array.isArray(n)?t[i][r]=n.slice():t[i][r]=n}return t}function Gi(e){for(var t={},i=0;i<e.length;i++){var r=zi(e[i]);for(var n in r)t[n]=r[n]}return t}var Hi,ki,Vi,ji={clone:zi,merge:Gi},Wi={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 Xi(e,t,i){return void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}function qi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function Yi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Zi(e,t,i){return i<0&&(i+=1),1<i&&--i,i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}Object.assign(Xi.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(e,t,i){if(e=kt.euclideanModulo(e,1),t=kt.clamp(t,0,1),i=kt.clamp(i,0,1),0===t)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+t):i+t-i*t,n=2*i-r;this.r=Zi(n,r,e+1/3),this.g=Zi(n,r,e),this.b=Zi(n,r,e-1/3)}return this},setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l,h=(l=i[1]).length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}t&&0<t.length&&(void 0!==(l=Wi[t])?this.setHex(l):console.warn("THREE.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=0<t?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=Yi(e.r),this.g=Yi(e.g),this.b=Yi(e.b),this},copyLinearToSRGB:function(e){return this.r=qi(e.r),this.g=qi(e.g),this.b=qi(e.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(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,i,r=this.r,n=this.g,a=this.b,o=Math.max(r,n,a),s=Math.min(r,n,a),c=(s+o)/2;if(s===o)i=t=0;else{var l=o-s;switch(i=c<=.5?l/(o+s):l/(2-o-s),o){case r:t=(n-a)/l+(n<a?6:0);break;case n:t=(a-r)/l+2;break;case a:t=(r-n)/l+4}t/=6}return e.h=t,e.s=i,e.l=c,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(Vi={},function(e,t,i){return this.getHSL(Vi),Vi.h+=e,Vi.s+=t,Vi.l+=i,this.setHSL(Vi.h,Vi.s,Vi.l),this}),add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:(Hi={h:0,s:0,l:0},ki={h:0,s:0,l:0},function(e,t){this.getHSL(Hi),e.getHSL(ki);var i=kt.lerp(Hi.h,ki.h,t),r=kt.lerp(Hi.s,ki.s,t),n=kt.lerp(Hi.l,ki.l,t);return this.setHSL(i,r,n),this}),equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}});var Ji,Ki,Qi={common:{diffuse:{value:new Xi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new qt},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 Vt(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 Xi(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 Xi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new qt}},sprite:{diffuse:{value:new Xi(15658734)},opacity:{value:1},center:{value:new Vt(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new qt}}},$i={basic:{uniforms:Gi([Qi.common,Qi.specularmap,Qi.envmap,Qi.aomap,Qi.lightmap,Qi.fog]),vertexShader:Bi.meshbasic_vert,fragmentShader:Bi.meshbasic_frag},lambert:{uniforms:Gi([Qi.common,Qi.specularmap,Qi.envmap,Qi.aomap,Qi.lightmap,Qi.emissivemap,Qi.fog,Qi.lights,{emissive:{value:new Xi(0)}}]),vertexShader:Bi.meshlambert_vert,fragmentShader:Bi.meshlambert_frag},phong:{uniforms:Gi([Qi.common,Qi.specularmap,Qi.envmap,Qi.aomap,Qi.lightmap,Qi.emissivemap,Qi.bumpmap,Qi.normalmap,Qi.displacementmap,Qi.gradientmap,Qi.fog,Qi.lights,{emissive:{value:new Xi(0)},specular:{value:new Xi(1118481)},shininess:{value:30}}]),vertexShader:Bi.meshphong_vert,fragmentShader:Bi.meshphong_frag},standard:{uniforms:Gi([Qi.common,Qi.envmap,Qi.aomap,Qi.lightmap,Qi.emissivemap,Qi.bumpmap,Qi.normalmap,Qi.displacementmap,Qi.roughnessmap,Qi.metalnessmap,Qi.fog,Qi.lights,{emissive:{value:new Xi(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Bi.meshphysical_vert,fragmentShader:Bi.meshphysical_frag},matcap:{uniforms:Gi([Qi.common,Qi.bumpmap,Qi.normalmap,Qi.displacementmap,Qi.fog,{matcap:{value:null}}]),vertexShader:Bi.meshmatcap_vert,fragmentShader:Bi.meshmatcap_frag},points:{uniforms:Gi([Qi.points,Qi.fog]),vertexShader:Bi.points_vert,fragmentShader:Bi.points_frag},dashed:{uniforms:Gi([Qi.common,Qi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bi.linedashed_vert,fragmentShader:Bi.linedashed_frag},depth:{uniforms:Gi([Qi.common,Qi.displacementmap]),vertexShader:Bi.depth_vert,fragmentShader:Bi.depth_frag},normal:{uniforms:Gi([Qi.common,Qi.bumpmap,Qi.normalmap,Qi.displacementmap,{opacity:{value:1}}]),vertexShader:Bi.normal_vert,fragmentShader:Bi.normal_frag},sprite:{uniforms:Gi([Qi.sprite,Qi.fog]),vertexShader:Bi.sprite_vert,fragmentShader:Bi.sprite_frag},background:{uniforms:{uvTransform:{value:new qt},t2D:{value:null}},vertexShader:Bi.background_vert,fragmentShader:Bi.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Bi.cube_vert,fragmentShader:Bi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bi.equirect_vert,fragmentShader:Bi.equirect_frag},distanceRGBA:{uniforms:Gi([Qi.common,Qi.displacementmap,{referencePosition:{value:new Xt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bi.distanceRGBA_vert,fragmentShader:Bi.distanceRGBA_frag},shadow:{uniforms:Gi([Qi.lights,Qi.fog,{color:{value:new Xi(0)},opacity:{value:1}}]),vertexShader:Bi.shadow_vert,fragmentShader:Bi.shadow_frag}};function er(){var i=null,r=!1,n=null;function a(e,t){!1!==r&&(n(e,t),i.requestAnimationFrame(a))}return{start:function(){!0!==r&&null!==n&&(i.requestAnimationFrame(a),r=!0)},stop:function(){r=!1},setAnimationLoop:function(e){n=e},setContext:function(e){i=e}}}function tr(c){var l=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),l.get(e)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var t=l.get(e);t&&(c.deleteBuffer(t.buffer),l.delete(e))},update:function(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var i,r,n,a,o,s=l.get(e);void 0===s?l.set(e,function(e,t){var i=e.array,r=e.dynamic?35048:35044,n=c.createBuffer();c.bindBuffer(t,n),c.bufferData(t,i,r),e.onUploadCallback();var a=5126;return i instanceof Float32Array?a=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?a=5123:i instanceof Int16Array?a=5122:i instanceof Uint32Array?a=5125:i instanceof Int32Array?a=5124:i instanceof Int8Array?a=5120:i instanceof Uint8Array&&(a=5121),{buffer:n,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,t)):s.version<e.version&&(i=s.buffer,n=t,a=(r=e).array,o=r.updateRange,c.bindBuffer(n,i),!1===r.dynamic?c.bufferData(n,a,35044):-1===o.count?c.bufferSubData(n,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(n,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),s.version=e.version)}}}function ir(e,t,i,r,n,a){this.a=e,this.b=t,this.c=i,this.normal=r&&r.isVector3?r:new Xt,this.vertexNormals=Array.isArray(r)?r:[],this.color=n&&n.isColor?n:new Xi,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==a?a:0}function rr(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._order=r||rr.DefaultOrder}function nr(){this.mask=1}$i.physical={uniforms:Gi([$i.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Bi.meshphysical_vert,fragmentShader:Bi.meshphysical_frag},Object.assign(ir.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,i=e.vertexNormals.length;t<i;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,i=e.vertexColors.length;t<i;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}),rr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],rr.DefaultOrder="XYZ",Object.defineProperties(rr.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(rr.prototype,{isEuler:!0,set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var r=kt.clamp,n=e.elements,a=n[0],o=n[4],s=n[8],c=n[1],l=n[5],h=n[9],u=n[2],p=n[6],d=n[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-r(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,l))):"YZX"===t?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:(Ki=new jt,function(e,t,i){return Ki.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ki,t,i)}),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Ji=new Wt,function(e){return Ji.setFromEuler(this),this.setFromQuaternion(Ji,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Xt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(nr.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},test:function(e){return 0!=(this.mask&e.mask)}});var ar,or,sr,cr,lr,hr,ur,pr,dr,fr,mr,gr,vr,yr,xr,br,wr,_r,Mr=0;function Er(){Object.defineProperty(this,"id",{value:Mr++}),this.uuid=kt.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Er.DefaultUp.clone();var e=new Xt,t=new rr,i=new Wt,r=new Xt(1,1,1);t.onChange(function(){i.setFromEuler(t,!1)}),i.onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new jt},normalMatrix:{value:new qt}}),this.matrix=new jt,this.matrixWorld=new jt,this.matrixAutoUpdate=Er.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new nr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}Er.DefaultUp=new Xt(0,1,0),Er.DefaultMatrixAutoUpdate=!0,Er.prototype=Object.assign(Object.create(t.prototype),{constructor:Er,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(_r=new Wt,function(e,t){return _r.setFromAxisAngle(e,t),this.quaternion.multiply(_r),this}),rotateOnWorldAxis:(wr=new Wt,function(e,t){return wr.setFromAxisAngle(e,t),this.quaternion.premultiply(wr),this}),rotateX:(br=new Xt(1,0,0),function(e){return this.rotateOnAxis(br,e)}),rotateY:(xr=new Xt(0,1,0),function(e){return this.rotateOnAxis(xr,e)}),rotateZ:(yr=new Xt(0,0,1),function(e){return this.rotateOnAxis(yr,e)}),translateOnAxis:(vr=new Xt,function(e,t){return vr.copy(e).applyQuaternion(this.quaternion),this.position.add(vr.multiplyScalar(t)),this}),translateX:(gr=new Xt(1,0,0),function(e){return this.translateOnAxis(gr,e)}),translateY:(mr=new Xt(0,1,0),function(e){return this.translateOnAxis(mr,e)}),translateZ:(fr=new Xt(0,0,1),function(e){return this.translateOnAxis(fr,e)}),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(dr=new jt,function(e){return e.applyMatrix4(dr.getInverse(this.matrixWorld))}),lookAt:(lr=new Wt,hr=new jt,ur=new Xt,pr=new Xt,function(e,t,i){e.isVector3?ur.copy(e):ur.set(e,t,i);var r=this.parent;this.updateWorldMatrix(!0,!1),pr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?hr.lookAt(pr,ur,this.up):hr.lookAt(ur,pr,this.up),this.quaternion.setFromRotationMatrix(hr),r&&(hr.extractRotation(r.matrixWorld),lr.setFromRotationMatrix(hr),this.quaternion.premultiply(lr.inverse()))}),add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this},remove:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var i=this.children.indexOf(e);return-1!==i&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(i,1)),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var i=0,r=this.children.length;i<r;i++){var n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new Xt),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(sr=new Xt,cr=new Xt,function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new Wt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(sr,e,cr),e}),getWorldScale:(ar=new Xt,or=new Wt,function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new Xt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(ar,or,e),e}),getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new Xt),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,i=0,r=t.length;i<r;i++)t[i].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var r=this.children,n=0,a=r.length;n<a;n++)r[n].updateWorldMatrix(!1,!0)},toJSON:function(i){var e=void 0===i||"string"==typeof i,t={};e&&(i={geometries:{},materials:{},textures:{},images:{},shapes:{}},t.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function n(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(i)),t.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isMesh&&this.drawMode!==Pt&&(r.drawMode=this.drawMode),this.isMesh||this.isLine||this.isPoints){r.geometry=n(i.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 l=o[s];n(i.shapes,l)}else n(i.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,c=this.material.length;s<c;s++)h.push(n(i.materials,this.material[s]));r.material=h}else r.material=n(i.materials,this.material);if(0<this.children.length){r.children=[];for(s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(i).object)}if(e){var u=m(i.geometries),p=m(i.materials),d=m(i.textures),f=m(i.images);o=m(i.shapes);0<u.length&&(t.geometries=u),0<p.length&&(t.materials=p),0<d.length&&(t.textures=d),0<f.length&&(t.images=f),0<o.length&&(t.shapes=o)}return t.object=r,t;function m(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var i=0;i<e.children.length;i++){var r=e.children[i];this.add(r.clone())}return this}});var Tr,Sr,Lr,Ar,Rr,Pr,Cr,Ir=0;function Or(){Object.defineProperty(this,"id",{value:Ir+=2}),this.uuid=kt.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 Dr(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===i,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Nr(e,t,i){Dr.call(this,new Int8Array(e),t,i)}function Ur(e,t,i){Dr.call(this,new Uint8Array(e),t,i)}function Fr(e,t,i){Dr.call(this,new Uint8ClampedArray(e),t,i)}function Br(e,t,i){Dr.call(this,new Int16Array(e),t,i)}function zr(e,t,i){Dr.call(this,new Uint16Array(e),t,i)}function Gr(e,t,i){Dr.call(this,new Int32Array(e),t,i)}function Hr(e,t,i){Dr.call(this,new Uint32Array(e),t,i)}function kr(e,t,i){Dr.call(this,new Float32Array(e),t,i)}function Vr(e,t,i){Dr.call(this,new Float64Array(e),t,i)}function jr(){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 Wr(e){if(0===e.length)return-1/0;for(var t=e[0],i=1,r=e.length;i<r;++i)e[i]>t&&(t=e[i]);return t}Or.prototype=Object.assign(Object.create(t.prototype),{constructor:Or,isGeometry:!0,applyMatrix:function(e){for(var t=(new qt).getNormalMatrix(e),i=0,r=this.vertices.length;i<r;i++){this.vertices[i].applyMatrix4(e)}for(i=0,r=this.faces.length;i<r;i++){var n=this.faces[i];n.normal.applyMatrix3(t).normalize();for(var a=0,o=n.vertexNormals.length;a<o;a++)n.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:(Cr=new jt,function(e){return Cr.makeRotationX(e),this.applyMatrix(Cr),this}),rotateY:(Pr=new jt,function(e){return Pr.makeRotationY(e),this.applyMatrix(Pr),this}),rotateZ:(Rr=new jt,function(e){return Rr.makeRotationZ(e),this.applyMatrix(Rr),this}),translate:(Ar=new jt,function(e,t,i){return Ar.makeTranslation(e,t,i),this.applyMatrix(Ar),this}),scale:(Lr=new jt,function(e,t,i){return Lr.makeScale(e,t,i),this.applyMatrix(Lr),this}),lookAt:(Sr=new Er,function(e){Sr.lookAt(e),Sr.updateMatrix(),this.applyMatrix(Sr.matrix)}),fromBufferGeometry:function(e){var o=this,t=null!==e.index?e.index.array:void 0,i=e.attributes,r=i.position.array,s=void 0!==i.normal?i.normal.array:void 0,c=void 0!==i.color?i.color.array:void 0,l=void 0!==i.uv?i.uv.array:void 0,h=void 0!==i.uv2?i.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var n=0,a=0;n<r.length;n+=3,a+=2)o.vertices.push((new Xt).fromArray(r,n)),void 0!==c&&o.colors.push((new Xi).fromArray(c,n));function u(e,t,i,r){var n=void 0===c?[]:[o.colors[e].clone(),o.colors[t].clone(),o.colors[i].clone()],a=new ir(e,t,i,void 0===s?[]:[(new Xt).fromArray(s,3*e),(new Xt).fromArray(s,3*t),(new Xt).fromArray(s,3*i)],n,r);o.faces.push(a),void 0!==l&&o.faceVertexUvs[0].push([(new Vt).fromArray(l,2*e),(new Vt).fromArray(l,2*t),(new Vt).fromArray(l,2*i)]),void 0!==h&&o.faceVertexUvs[1].push([(new Vt).fromArray(h,2*e),(new Vt).fromArray(h,2*t),(new Vt).fromArray(h,2*i)])}var p=e.groups;if(0<p.length)for(n=0;n<p.length;n++)for(var d=p[n],f=d.start,m=(a=f,f+d.count);a<m;a+=3)void 0!==t?u(t[a],t[a+1],t[a+2],d.materialIndex):u(a,a+1,a+2,d.materialIndex);else if(void 0!==t)for(n=0;n<t.length;n+=3)u(t[n],t[n+1],t[n+2]);else for(n=0;n<r.length/3;n+=3)u(n,n+1,n+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:(Tr=new Xt,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Tr).negate(),this.translate(Tr.x,Tr.y,Tr.z),this}),normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,r=new jt;return r.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new Xt,t=new Xt,i=0,r=this.faces.length;i<r;i++){var n=this.faces[i],a=this.vertices[n.a],o=this.vertices[n.b],s=this.vertices[n.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),n.normal.copy(e)}},computeVertexNormals:function(e){var t,i,r,n,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,i=this.vertices.length;t<i;t++)o[t]=new Xt;if(e){var s,c,l,h=new Xt,u=new Xt;for(r=0,n=this.faces.length;r<n;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],h.subVectors(l,c),u.subVectors(s,c),h.cross(u),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(this.computeFaceNormals(),r=0,n=this.faces.length;r<n;r++)o[(a=this.faces[r]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,i=this.vertices.length;t<i;t++)o[t].normalize();for(r=0,n=this.faces.length;r<n;r++){var p=(a=this.faces[r]).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 e,t,i;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var r=(i=this.faces[e]).vertexNormals;3===r.length?(r[0].copy(i.normal),r[1].copy(i.normal),r[2].copy(i.normal)):(r[0]=i.normal.clone(),r[1]=i.normal.clone(),r[2]=i.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,r,n;for(i=0,r=this.faces.length;i<r;i++)for((n=this.faces[i]).__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;e<t;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var a=new Or;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(i=0,r=this.faces.length;i<r;i++)c=new Xt,l={a:new Xt,b:new Xt,c:new Xt},o.push(c),s.push(l)}var c,l,h=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),i=0,r=this.faces.length;i<r;i++)n=this.faces[i],c=h.faceNormals[i],l=h.vertexNormals[i],c.copy(n.normal),l.a.copy(n.vertexNormals[0]),l.b.copy(n.vertexNormals[1]),l.c.copy(n.vertexNormals[2])}for(i=0,r=this.faces.length;i<r;i++)(n=this.faces[i]).normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ii),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ni),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(e&&e.isGeometry){var r,n=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.faceVertexUvs[0],h=e.faceVertexUvs[0],u=this.colors,p=e.colors;void 0===i&&(i=0),void 0!==t&&(r=(new qt).getNormalMatrix(t));for(var d=0,f=o.length;d<f;d++){var m=o[d].clone();void 0!==t&&m.applyMatrix4(t),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 ir(x.a+n,x.b+n,x.c+n)).normal.copy(x.normal),void 0!==r&&g.normal.applyMatrix3(r).normalize();for(var _=0,M=b.length;_<M;_++)v=b[_].clone(),void 0!==r&&v.applyMatrix3(r).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+i,s.push(g)}for(d=0,f=h.length;d<f;d++){var E=h[d],T=[];if(void 0!==E){for(_=0,M=E.length;_<M;_++)T.push(E[_].clone());l.push(T)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,i,r,n,a,o,s,c={},l=[],h=[],u=Math.pow(10,4);for(i=0,r=this.vertices.length;i<r;i++)e=this.vertices[i],void 0===c[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(c[t]=i,l.push(this.vertices[i]),h[i]=l.length-1):h[i]=h[c[t]];var p=[];for(i=0,r=this.faces.length;i<r;i++){(n=this.faces[i]).a=h[n.a],n.b=h[n.b],n.c=h[n.c],a=[n.a,n.b,n.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(i);break}}for(i=p.length-1;0<=i;i--){var f=p[i];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-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,i=e.length;t<i;t++){var r=e[t];this.vertices.push(new Xt(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,i=0;i<t;i++)e[i]._id=i;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var r,n,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(r=[]),o&&o.length===t&&(n=[]);for(i=0;i<t;i++){var s=e[i]._id;r&&r.push(a[s]),n&&n.push(o[s])}r&&(this.faceVertexUvs[0]=r),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}for(var r=[],n=0;n<this.vertices.length;n++){var a=this.vertices[n];r.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],h={},u=[],p={};for(n=0;n<this.faces.length;n++){var d=this.faces[n],f=void 0!==this.faceVertexUvs[0][n],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,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var b=this.faceVertexUvs[0][n];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(e,t,i){return i?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]||(c[t]=s.length/3,s.push(e.x,e.y,e.z)),c[t]}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=l.length,l.push(e.getHex())),h[t]}function S(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]||(p[t]=u.length/2,u.push(e.x,e.y)),p[t]}return e.data={},e.data.vertices=r,e.data.normals=s,0<l.length&&(e.data.colors=l),0<u.length&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new Or).copy(this)},copy:function(e){var t,i,r,n,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=e.name;var s=e.vertices;for(t=0,i=s.length;t<i;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,i=c.length;t<i;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,i=l.length;t<i;t++)this.faces.push(l[t].clone());for(t=0,i=e.faceVertexUvs.length;t<i;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),r=0,n=h.length;r<n;r++){var u=h[r],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}var f=e.morphTargets;for(t=0,i=f.length;t<i;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],r=0,n=f[t].vertices.length;r<n;r++)m.vertices.push(f[t].vertices[r].clone());if(void 0!==f[t].normals)for(m.normals=[],r=0,n=f[t].normals.length;r<n;r++)m.normals.push(f[t].normals[r].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(t=0,i=g.length;t<i;t++){var v={};if(void 0!==g[t].vertexNormals)for(v.vertexNormals=[],r=0,n=g[t].vertexNormals.length;r<n;r++){var y=g[t].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[t].faceNormals)for(v.faceNormals=[],r=0,n=g[t].faceNormals.length;r<n;r++)v.faceNormals.push(g[t].faceNormals[r].clone());this.morphNormals.push(v)}var b=e.skinWeights;for(t=0,i=b.length;t<i;t++)this.skinWeights.push(b[t].clone());var w=e.skinIndices;for(t=0,i=w.length;t<i;t++)this.skinIndices.push(w[t].clone());var _=e.lineDistances;for(t=0,i=_.length;t<i;t++)this.lineDistances.push(_[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=e.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Dr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Dr.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.itemSize:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.itemSize,i*=t.itemSize;for(var r=0,n=this.itemSize;r<n;r++)this.array[e+r]=t.array[i+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new Xi),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new Vt),t[i++]=a.x,t[i++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Xt),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new Li),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this},setXYZ:function(e,t,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this},setXYZW:function(e,t,i,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(Nr.prototype=Object.create(Dr.prototype)).constructor=Nr,(Ur.prototype=Object.create(Dr.prototype)).constructor=Ur,(Fr.prototype=Object.create(Dr.prototype)).constructor=Fr,(Br.prototype=Object.create(Dr.prototype)).constructor=Br,(zr.prototype=Object.create(Dr.prototype)).constructor=zr,(Gr.prototype=Object.create(Dr.prototype)).constructor=Gr,(Hr.prototype=Object.create(Dr.prototype)).constructor=Hr,(kr.prototype=Object.create(Dr.prototype)).constructor=kr,(Vr.prototype=Object.create(Dr.prototype)).constructor=Vr,Object.assign(jr.prototype,{computeGroups:function(e){for(var t,i=[],r=void 0,n=e.faces,a=0;a<n.length;a++){var o=n[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,i.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,i=e.faces,r=e.vertices,n=e.faceVertexUvs,a=n[0]&&0<n[0].length,o=n[1]&&0<n[1].length,s=e.morphTargets,c=s.length;if(0<c){t=[];for(var l=0;l<c;l++)t[l]={name:s[l].name,data:[]};this.morphTargets.position=t}var h,u=e.morphNormals,p=u.length;if(0<p){h=[];for(l=0;l<p;l++)h[l]={name:u[l].name,data:[]};this.morphTargets.normal=h}var d=e.skinIndices,f=e.skinWeights,m=d.length===r.length,g=f.length===r.length;0<r.length&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<i.length;l++){var v=i[l];this.vertices.push(r[v.a],r[v.b],r[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=n[0][l])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new Vt,new Vt,new Vt));if(!0===o)void 0!==(b=n[1][l])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new Vt,new Vt,new Vt));for(var M=0;M<c;M++){var E=s[M].vertices;t[M].data.push(E[v.a],E[v.b],E[v.c])}for(M=0;M<p;M++){var T=u[M].vertexNormals[l];h[M].data.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(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}});var Xr,qr,Yr,Zr,Jr,Kr,Qr,$r,en,tn,rn=1;function nn(){Object.defineProperty(this,"id",{value:rn+=2}),this.uuid=kt.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 an(e,t,i,r,n,a){Or.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a},this.fromBufferGeometry(new on(e,t,i,r,n,a)),this.mergeVertices()}function on(e,t,i,r,n,a){nn.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a};var R=this;e=e||1,t=t||1,i=i||1,r=Math.floor(r)||1,n=Math.floor(n)||1,a=Math.floor(a)||1;var P=[],C=[],I=[],O=[],D=0,N=0;function o(e,t,i,r,n,a,o,s,c,l,h){var u,p,d=a/c,f=o/l,m=a/2,g=o/2,v=s/2,y=c+1,x=l+1,b=0,w=0,_=new Xt;for(p=0;p<x;p++){var M=p*f-g;for(u=0;u<y;u++){var E=u*d-m;_[e]=E*r,_[t]=M*n,_[i]=v,C.push(_.x,_.y,_.z),_[e]=0,_[t]=0,_[i]=0<s?1:-1,I.push(_.x,_.y,_.z),O.push(u/c),O.push(1-p/l),b+=1}}for(p=0;p<l;p++)for(u=0;u<c;u++){var T=D+u+y*p,S=D+u+y*(p+1),L=D+(u+1)+y*(p+1),A=D+(u+1)+y*p;P.push(T,S,A),P.push(S,L,A),w+=6}R.addGroup(N,w,h),N+=w,D+=b}o("z","y","x",-1,-1,i,t,e,a,n,0),o("z","y","x",1,-1,i,t,-e,a,n,1),o("x","z","y",1,1,e,i,t,r,a,2),o("x","z","y",1,-1,e,i,-t,r,a,3),o("x","y","z",1,-1,e,t,i,r,n,4),o("x","y","z",-1,-1,e,t,-i,r,n,5),this.setIndex(P),this.addAttribute("position",new kr(C,3)),this.addAttribute("normal",new kr(I,3)),this.addAttribute("uv",new kr(O,2))}function sn(e,t,i,r){Or.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r},this.fromBufferGeometry(new cn(e,t,i,r)),this.mergeVertices()}function cn(e,t,i,r){nn.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};var n,a,o=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(i)||1,l=Math.floor(r)||1,h=c+1,u=l+1,p=e/c,d=t/l,f=[],m=[],g=[],v=[];for(a=0;a<u;a++){var y=a*d-s;for(n=0;n<h;n++){var x=n*p-o;m.push(x,-y,0),g.push(0,0,1),v.push(n/c),v.push(1-a/l)}}for(a=0;a<l;a++)for(n=0;n<c;n++){var b=n+h*a,w=n+h*(a+1),_=n+1+h*(a+1),M=n+1+h*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.addAttribute("position",new kr(m,3)),this.addAttribute("normal",new kr(g,3)),this.addAttribute("uv",new kr(v,2))}nn.prototype=Object.assign(Object.create(t.prototype),{constructor:nn,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(65535<Wr(e)?Hr:zr)(e,1):this.index=e},addAttribute:function(e,t,i){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?("index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)):this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new Dr(t,i)))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new qt).getNormalMatrix(e).applyToBufferAttribute(i),i.needsUpdate=!0);var r=this.attributes.tangent;void 0!==r&&((new qt).getNormalMatrix(e).applyToBufferAttribute(r),r.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(tn=new jt,function(e){return tn.makeRotationX(e),this.applyMatrix(tn),this}),rotateY:(en=new jt,function(e){return en.makeRotationY(e),this.applyMatrix(en),this}),rotateZ:($r=new jt,function(e){return $r.makeRotationZ(e),this.applyMatrix($r),this}),translate:(Qr=new jt,function(e,t,i){return Qr.makeTranslation(e,t,i),this.applyMatrix(Qr),this}),scale:(Kr=new jt,function(e,t,i){return Kr.makeScale(e,t,i),this.applyMatrix(Kr),this}),lookAt:(Jr=new Er,function(e){Jr.lookAt(e),Jr.updateMatrix(),this.applyMatrix(Jr.matrix)}),center:(Zr=new Xt,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.z),this}),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var i=new kr(3*t.vertices.length,3),r=new kr(3*t.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var n=new kr(t.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],i=0,r=e.length;i<r;i++){var n=e[i];t.push(n.x,n.y,n.z||0)}return this.addAttribute("position",new kr(t,3)),this},updateFromObject:function(e){var t,i=e.geometry;if(e.isMesh){var r=i.__directGeometry;if(!0===i.elementsNeedUpdate&&(r=void 0,i.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(i);r.verticesNeedUpdate=i.verticesNeedUpdate,r.normalsNeedUpdate=i.normalsNeedUpdate,r.colorsNeedUpdate=i.colorsNeedUpdate,r.uvsNeedUpdate=i.uvsNeedUpdate,r.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=!1,i.normalsNeedUpdate=!1,i.colorsNeedUpdate=!1,i.uvsNeedUpdate=!1,i.groupsNeedUpdate=!1,i=r}return!0===i.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(i.vertices),t.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(i.normals),t.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(i.colors),t.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(i.uvs),t.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(i.lineDistances),t.needsUpdate=!0),i.lineDistancesNeedUpdate=!1),i.groupsNeedUpdate&&(i.computeGroups(e.geometry),this.groups=i.groups,i.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new jr).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new Dr(t,3).copyVector3sArray(e.vertices)),0<e.normals.length){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Dr(i,3).copyVector3sArray(e.normals))}if(0<e.colors.length){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new Dr(r,3).copyColorsArray(e.colors))}if(0<e.uvs.length){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Dr(n,2).copyVector2sArray(e.uvs))}if(0<e.uvs2.length){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Dr(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,h=c.length;l<h;l++){var u=c[l],p=new kr(3*u.data.length,3);p.name=u.name,s.push(p.copyVector3sArray(u.data))}this.morphAttributes[o]=s}if(0<e.skinIndices.length){var d=new kr(4*e.skinIndices.length,4);this.addAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(0<e.skinWeights.length){var f=new kr(4*e.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ii);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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:(qr=new Ii,Yr=new Xt,function(){null===this.boundingSphere&&(this.boundingSphere=new Ni);var e=this.attributes.position;if(e){var t=this.boundingSphere.center;qr.setFromBufferAttribute(e),qr.getCenter(t);for(var i=0,r=0,n=e.count;r<n;r++)Yr.x=e.getX(r),Yr.y=e.getY(r),Yr.z=e.getZ(r),i=Math.max(i,t.distanceToSquared(Yr));this.boundingSphere.radius=Math.sqrt(i),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 e=this.index,t=this.attributes;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new Dr(new Float32Array(i.length),3));else for(var r=t.normal.array,n=0,a=r.length;n<a;n++)r[n]=0;var o,s,c,l=t.normal.array,h=new Xt,u=new Xt,p=new Xt,d=new Xt,f=new Xt;if(e){var m=e.array;for(n=0,a=e.count;n<a;n+=3)o=3*m[n+0],s=3*m[n+1],c=3*m[n+2],h.fromArray(i,o),u.fromArray(i,s),p.fromArray(i,c),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),l[o]+=d.x,l[1+o]+=d.y,l[2+o]+=d.z,l[s]+=d.x,l[1+s]+=d.y,l[2+s]+=d.z,l[c]+=d.x,l[1+c]+=d.y,l[2+c]+=d.z}else for(n=0,a=i.length;n<a;n+=9)h.fromArray(i,n),u.fromArray(i,n+3),p.fromArray(i,n+6),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),l[n]=d.x,l[n+1]=d.y,l[n+2]=d.z,l[n+3]=d.x,l[n+4]=d.y,l[n+5]=d.z,l[n+6]=d.x,l[n+7]=d.y,l[n+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var i=this.attributes;for(var r in i)if(void 0!==e.attributes[r])for(var n=i[r].array,a=e.attributes[r],o=a.array,s=0,c=a.itemSize*t;s<o.length;s++,c++)n[c]=o[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:(Xr=new Xt,function(){for(var e=this.attributes.normal,t=0,i=e.count;t<i;t++)Xr.x=e.getX(t),Xr.y=e.getY(t),Xr.z=e.getZ(t),Xr.normalize(),e.setXYZ(t,Xr.x,Xr.y,Xr.z)}),toNonIndexed:function(){function e(e,t){for(var i=e.array,r=e.itemSize,n=new i.constructor(t.length*r),a=0,o=0,s=0,c=t.length;s<c;s++){a=t[s]*r;for(var l=0;l<r;l++)n[o++]=i[a++]}return new Dr(n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new nn,i=this.index.array,r=this.attributes;for(var n in r){var a=e(r[n],i);t.addAttribute(n,a)}var o=this.morphAttributes;for(n in o){for(var s=[],c=o[n],l=0,h=c.length;l<h;l++){a=e(c[l],i);s.push(a)}t.morphAttributes[n]=s}for(var u=this.groups,p=(l=0,u.length);l<p;l++){var d=u[l];t.addGroup(d.start,d.count,d.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var n=this.attributes;for(var i in n){var a={itemSize:(p=n[i]).itemSize,type:p.array.constructor.name,array:Array.prototype.slice.call(p.array),normalized:p.normalized};""!==p.name&&(a.name=p.name),e.data.attributes[i]=a}var o={},s=!1;for(var i in this.morphAttributes){for(var c=this.morphAttributes[i],l=[],h=0,u=c.length;h<u;h++){var p;a={itemSize:(p=c[h]).itemSize,type:p.array.constructor.name,array:Array.prototype.slice.call(p.array),normalized:p.normalized};""!==p.name&&(a.name=p.name),l.push(a)}0<l.length&&(o[i]=l,s=!0)}s&&(e.data.morphAttributes=o);var d=this.groups;0<d.length&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new nn).copy(this)},copy:function(e){var t,i,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(i=0,r=l.length;i<r;i++)c.push(l[i].clone());this.morphAttributes[t]=c}var h=e.groups;for(i=0,r=h.length;i<r;i++){var u=h[i];this.addGroup(u.start,u.count,u.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(an.prototype=Object.create(Or.prototype)).constructor=an,(on.prototype=Object.create(nn.prototype)).constructor=on,(sn.prototype=Object.create(Or.prototype)).constructor=sn,(cn.prototype=Object.create(nn.prototype)).constructor=cn;var ln=0;function hn(){Object.defineProperty(this,"id",{value:ln++}),this.uuid=kt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=K,this.side=N,this.flatShading=!1,this.vertexTangents=!1,this.vertexColors=E,this.opacity=1,this.transparent=!1,this.blendSrc=D,this.blendDst=U,this.blendEquation=ie,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=oe,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.visible=!0,this.userData={},this.needsUpdate=!0}hn.prototype=Object.assign(Object.create(t.prototype),{constructor:hn,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i)if("shading"!==t){var r=this[t];void 0!==r?r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i:console.warn("THREE."+this.type+": '"+t+"' 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===i;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearCoat&&(i.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(i.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,i.reflectivity=this.reflectivity,void 0!==this.combine&&(i.combine=this.combine),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==K&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),this.side!==N&&(i.side=this.side),this.vertexColors!==E&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),t){var n=r(e.textures),a=r(e.images);0<n.length&&(i.textures=n),0<a.length&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,i=null;if(null!==t){var r=t.length;i=new Array(r);for(var n=0;n!==r;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this.shadowSide=e.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var un,pn,dn,fn,mn,gn,vn,yn,xn,bn,wn,_n,Mn,En,Tn,Sn,Ln,An,Rn,Pn,Cn,In,On,Dn,Nn,Un,Fn,Bn,zn,Gn,Hn,kn,Vn,jn,Wn,Xn,qn,Yn,Zn,Jn="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",Kn="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function Qn(e){hn.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Jn,this.fragmentShader=Kn,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!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function $n(e,t){this.origin=void 0!==e?e:new Xt,this.direction=void 0!==t?t:new Xt}function ea(e,t,i){this.a=void 0!==e?e:new Xt,this.b=void 0!==t?t:new Xt,this.c=void 0!==i?i:new Xt}function ta(e){hn.call(this),this.type="MeshBasicMaterial",this.color=new Xi(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(e)}function ia(e,t){Er.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new nn,this.material=void 0!==t?t:new ta({color:16777215*Math.random()}),this.drawMode=Pt,this.updateMorphTargets()}function ra(e,t,i,r,n,a,o,s){if(null===(t.side===_e?r.intersectTriangle(o,a,n,!0,s):r.intersectTriangle(n,a,o,t.side!==Z,s)))return null;Zn.copy(s),Zn.applyMatrix4(e.matrixWorld);var c=i.ray.origin.distanceTo(Zn);return c<i.near||c>i.far?null:{distance:c,point:Zn.clone(),object:e}}function na(e,t,i,r,n,a,o,s,c){zn.fromBufferAttribute(n,o),Gn.fromBufferAttribute(n,s),Hn.fromBufferAttribute(n,c);var l=ra(e,t,i,r,zn,Gn,Hn,Yn);if(l){a&&(Wn.fromBufferAttribute(a,o),Xn.fromBufferAttribute(a,s),qn.fromBufferAttribute(a,c),l.uv=ea.getUV(Yn,zn,Gn,Hn,Wn,Xn,qn,new Vt));var h=new ir(o,s,c);ea.getNormal(zn,Gn,Hn,h.normal),l.face=h}return l}function aa(o,i,s,r){var c,l,h=new Xi(0),u=0,p=null,d=0;function f(e,t){i.buffers.color.setClear(e.r,e.g,e.b,t,r)}return{getClearColor:function(){return h},setClearColor:function(e,t){h.set(e),f(h,u=void 0!==t?t:1)},getClearAlpha:function(){return u},setClearAlpha:function(e){f(h,u=e)},render:function(e,t,i,r){var n=t.background;if(null===n?(f(h,u),p=null,d=0):n&&n.isColor&&(f(n,1),r=!0,p=null,d=0),(o.autoClear||r)&&o.clear(o.autoClearColor,o.autoClearDepth,o.autoClearStencil),n&&(n.isCubeTexture||n.isWebGLRenderTargetCube)){void 0===l&&((l=new ia(new on(1,1,1),new Qn({type:"BackgroundCubeMaterial",uniforms:zi($i.cube.uniforms),vertexShader:$i.cube.vertexShader,fragmentShader:$i.cube.fragmentShader,side:_e,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),l.geometry.removeAttribute("uv"),l.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.tCube.value}}),s.update(l));var a=n.isWebGLRenderTargetCube?n.texture:n;l.material.uniforms.tCube.value=a,l.material.uniforms.tFlip.value=n.isWebGLRenderTargetCube?1:-1,p===n&&d===a.version||(l.material.needsUpdate=!0,p=n,d=a.version),e.unshift(l,l.geometry,l.material,0,0,null)}else n&&n.isTexture&&(void 0===c&&((c=new ia(new cn(2,2),new Qn({type:"BackgroundMaterial",uniforms:zi($i.background.uniforms),vertexShader:$i.background.vertexShader,fragmentShader:$i.background.fragmentShader,side:N,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),!0===(c.material.uniforms.t2D.value=n).matrixAutoUpdate&&n.updateMatrix(),c.material.uniforms.uvTransform.value.copy(n.matrix),p===n&&d===n.version||(c.material.needsUpdate=!0,d=(p=n).version),e.unshift(c,c.geometry,c.material,0,0,null))}}}function oa(n,a,o,s){var c;this.setMode=function(e){c=e},this.render=function(e,t){n.drawArrays(c,e,t),o.update(t,c)},this.renderInstances=function(e,t,i){var r;if(s.isWebGL2)r=n;else if(null===(r=a.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[s.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](c,t,i,e.maxInstancedCount),o.update(i,c,e.maxInstancedCount)}}function sa(t,i,e){var r;function n(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(35633,36338).precision&&0<t.getShaderPrecisionFormat(35632,36338).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(35633,36337).precision&&0<t.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,o=void 0!==e.precision?e.precision:"highp",s=n(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===e.logarithmicDepthBuffer,l=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=0<h,y=a||!!i.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;var e=i.get("EXT_texture_filter_anisotropic");return r=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?t.getParameter(36183):0}}function ca(){var h=this,u=null,p=0,d=!1,f=!1,m=new Ui,g=new qt,v={value:null,needsUpdate:!1};function y(){v.value!==u&&(v.value=u,v.needsUpdate=0<p),h.numPlanes=p,h.numIntersection=0}function x(e,t,i,r){var n=null!==e?e.length:0,a=null;if(0!==n){if(a=v.value,!0!==r||null===a){var o=i+4*n,s=t.matrixWorldInverse;g.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var c=0,l=i;c!==n;++c,l+=4)m.copy(e[c]).applyMatrix4(s,g),m.normal.toArray(a,l),a[l+3]=m.constant}v.value=a,v.needsUpdate=!0}return h.numPlanes=n,a}this.uniform=v,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,i){var r=0!==e.length||t||0!==p||d;return d=t,u=x(e,i,0),p=e.length,r},this.beginShadows=function(){f=!0,x(null)},this.endShadows=function(){f=!1,y()},this.setState=function(e,t,i,r,n,a){if(!d||null===e||0===e.length||f&&!i)f?x(null):y();else{var o=f?0:p,s=4*o,c=n.clippingState||null;v.value=c,c=x(e,r,s,a);for(var l=0;l!==s;++l)c[l]=u[l];n.clippingState=c,this.numIntersection=t?this.numPlanes:0,this.numPlanes+=o}}}function la(i){var r={};return{get:function(e){if(void 0!==r[e])return r[e];var t;switch(e){case"WEBGL_depth_texture":t=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:t=i.getExtension(e)}return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),r[e]=t}}}function ha(e,u,a){var o={},p={};function s(e){var t=e.target,i=o[t.id];for(var r in null!==i.index&&u.remove(i.index),i.attributes)u.remove(i.attributes[r]);t.removeEventListener("dispose",s),delete o[t.id];var n=p[i.id];n&&(u.remove(n),delete p[i.id]),a.memory.geometries--}return{get:function(e,t){var i=o[t.id];return i||(t.addEventListener("dispose",s),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new nn).setFromObject(e)),i=t._bufferGeometry),o[t.id]=i,a.memory.geometries++,i)},update:function(e){var t=e.index,i=e.attributes;for(var r in null!==t&&u.update(t,34963),i)u.update(i[r],34962);var n=e.morphAttributes;for(var r in n)for(var a=n[r],o=0,s=a.length;o<s;o++)u.update(a[o],34962)},getWireframeAttribute:function(e){var t=p[e.id];if(t)return t;var i,r=[],n=e.index,a=e.attributes;if(null!==n)for(var o=0,s=(i=n.array).length;o<s;o+=3){var c=i[o+0],l=i[o+1],h=i[o+2];r.push(c,l,l,h,h,c)}else for(o=0,s=(i=a.position.array).length/3-1;o<s;o+=3){c=o+0,l=o+1,h=o+2;r.push(c,l,l,h,h,c)}return t=new(65535<Wr(r)?Hr:zr)(r,1),u.update(t,34963),p[e.id]=t}}}function ua(n,a,o,s){var c,l,h;this.setMode=function(e){c=e},this.setIndex=function(e){l=e.type,h=e.bytesPerElement},this.render=function(e,t){n.drawElements(c,t,l,e*h),o.update(t,c)},this.renderInstances=function(e,t,i){var r;if(s.isWebGL2)r=n;else if(null===(r=a.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[s.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](c,i,l,t*h,e.maxInstancedCount),o.update(i,c,e.maxInstancedCount)}}function pa(e){var r={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:r,programs:null,autoReset:!0,reset:function(){r.frame++,r.calls=0,r.triangles=0,r.points=0,r.lines=0},update:function(e,t,i){switch(i=i||1,r.calls++,t){case 4:r.triangles+=i*(e/3);break;case 5:case 6:r.triangles+=i*(e-2);break;case 1:r.lines+=i*(e/2);break;case 3:r.lines+=i*(e-1);break;case 2:r.lines+=i*e;break;case 0:r.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",t)}}}}function da(e,t){return Math.abs(t[1])-Math.abs(e[1])}function fa(d){var f={},m=new Float32Array(8);return{update:function(e,t,i,r){var n=e.morphTargetInfluences,a=n.length,o=f[t.id];if(void 0===o){o=[];for(var s=0;s<a;s++)o[s]=[s,0];f[t.id]=o}var c=i.morphTargets&&t.morphAttributes.position,l=i.morphNormals&&t.morphAttributes.normal;for(s=0;s<a;s++){0!==(h=o[s])[1]&&(c&&t.removeAttribute("morphTarget"+s),l&&t.removeAttribute("morphNormal"+s))}for(s=0;s<a;s++){(h=o[s])[0]=s,h[1]=n[s]}for(o.sort(da),s=0;s<8;s++){var h;if(h=o[s]){var u=h[0],p=h[1];if(p){c&&t.addAttribute("morphTarget"+s,c[u]),l&&t.addAttribute("morphNormal"+s,l[u]),m[s]=p;continue}}m[s]=0}r.getUniforms().setValue(d,"morphTargetInfluences",m)}}}function ma(n,a){var o={};return{update:function(e){var t=a.render.frame,i=e.geometry,r=n.get(e,i);return o[r.id]!==t&&(i.isGeometry&&r.updateFromObject(e),n.update(r),o[r.id]=t),r},dispose:function(){o={}}}}function ga(e,t,i,r,n,a,o,s,c,l){Si.call(this,e=void 0!==e?e:[],t=void 0!==t?t:ve,i,r,n,a,o=void 0!==o?o:Ye,s,c,l),this.flipY=!1}function va(e,t,i,r){Si.call(this,null),this.image={data:e,width:t,height:i,depth:r},this.magFilter=Re,this.minFilter=Re,this.wrapR=Le,this.generateMipmaps=!1,this.flipY=!1}((Qn.prototype=Object.create(hn.prototype)).constructor=Qn).prototype.isShaderMaterial=!0,Qn.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=zi(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Qn.prototype.toJSON=function(e){var t=hn.prototype.toJSON.call(this,e);for(var i in t.uniforms={},this.uniforms){var r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}0<Object.keys(this.defines).length&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var n={};for(var a in this.extensions)!0===this.extensions[a]&&(n[a]=!0);return 0<Object.keys(n).length&&(t.extensions=n),t},Object.assign($n.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Xt),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:(wn=new Xt,function(e){return this.origin.copy(this.at(e,wn)),this}),closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Xt),t.subVectors(e,this.origin);var i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:(bn=new Xt,function(e){var t=bn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bn.copy(this.direction).multiplyScalar(t).add(this.origin),bn.distanceToSquared(e))}),distanceSqToSegment:(vn=new Xt,yn=new Xt,xn=new Xt,function(e,t,i,r){vn.copy(e).add(t).multiplyScalar(.5),yn.copy(t).sub(e).normalize(),xn.copy(this.origin).sub(vn);var n,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(yn),h=xn.dot(this.direction),u=-xn.dot(yn),p=xn.lengthSq(),d=Math.abs(1-l*l);if(0<d)if(a=l*h-u,s=c*d,0<=(n=l*u-h))if(-s<=a)if(a<=s){var f=1/d;o=(n*=f)*(n+l*(a*=f)+2*h)+a*(l*n+a+2*u)+p}else a=c,o=-(n=Math.max(0,-(l*a+h)))*n+a*(a+2*u)+p;else a=-c,o=-(n=Math.max(0,-(l*a+h)))*n+a*(a+2*u)+p;else o=a<=-s?-(n=Math.max(0,-(-l*c+h)))*n+(a=0<n?-c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p:a<=s?(n=0,(a=Math.min(Math.max(-c,-u),c))*(a+2*u)+p):-(n=Math.max(0,-(l*c+h)))*n+(a=0<n?c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p;else a=0<l?-c:c,o=-(n=Math.max(0,-(l*a+h)))*n+a*(a+2*u)+p;return i&&i.copy(this.direction).multiplyScalar(n).add(this.origin),r&&r.copy(yn).multiplyScalar(a).add(vn),o}),intersectSphere:(gn=new Xt,function(e,t){gn.subVectors(e.center,this.origin);var i=gn.dot(this.direction),r=gn.dot(gn)-i*i,n=e.radius*e.radius;if(n<r)return null;var a=Math.sqrt(n-r),o=i-a,s=i+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}),intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=i?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var i,r,n,a,o,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return r=0<=c?(i=(e.min.x-u.x)*c,(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,(e.min.x-u.x)*c),(a=0<=l?(n=(e.min.y-u.y)*l,(e.max.y-u.y)*l):(n=(e.max.y-u.y)*l,(e.min.y-u.y)*l))<i||r<n?null:((i<n||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(s=0<=h?(o=(e.min.z-u.z)*h,(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,(e.min.z-u.z)*h))<i||r<o?null:((i<o||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(0<=i?i:r,t)))},intersectsBox:(mn=new Xt,function(e){return null!==this.intersectBox(e,mn)}),intersectTriangle:(un=new Xt,pn=new Xt,dn=new Xt,fn=new Xt,function(e,t,i,r,n){pn.subVectors(t,e),dn.subVectors(i,e),fn.crossVectors(pn,dn);var a,o=this.direction.dot(fn);if(0<o){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}un.subVectors(this.origin,e);var s=a*this.direction.dot(dn.crossVectors(un,dn));if(s<0)return null;var c=a*this.direction.dot(pn.cross(un));if(c<0)return null;if(o<s+c)return null;var l=-a*un.dot(fn);return l<0?null:this.at(l/o,n)}),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(ea,{getNormal:(Ln=new Xt,function(e,t,i,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Xt),r.subVectors(i,t),Ln.subVectors(e,t),r.cross(Ln);var n=r.lengthSq();return 0<n?r.multiplyScalar(1/Math.sqrt(n)):r.set(0,0,0)}),getBarycoord:(En=new Xt,Tn=new Xt,Sn=new Xt,function(e,t,i,r,n){En.subVectors(r,t),Tn.subVectors(i,t),Sn.subVectors(e,t);var a=En.dot(En),o=En.dot(Tn),s=En.dot(Sn),c=Tn.dot(Tn),l=Tn.dot(Sn),h=a*c-o*o;if(void 0===n&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),n=new Xt),0==h)return n.set(-2,-1,-1);var u=1/h,p=(c*s-o*l)*u,d=(a*l-o*s)*u;return n.set(1-p-d,d,p)}),containsPoint:(Mn=new Xt,function(e,t,i,r){return ea.getBarycoord(e,t,i,r,Mn),0<=Mn.x&&0<=Mn.y&&Mn.x+Mn.y<=1}),getUV:(_n=new Xt,function(e,t,i,r,n,a,o,s){return this.getBarycoord(e,t,i,r,_n),s.set(0,0),s.addScaledVector(n,_n.x),s.addScaledVector(a,_n.y),s.addScaledVector(o,_n.z),s})}),Object.assign(ea.prototype,{set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:(Dn=new Xt,Nn=new Xt,function(){return Dn.subVectors(this.c,this.b),Nn.subVectors(this.a,this.b),.5*Dn.cross(Nn).length()}),getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Xt),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return ea.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Xt),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return ea.getBarycoord(e,this.a,this.b,this.c,t)},containsPoint:function(e){return ea.containsPoint(e,this.a,this.b,this.c)},getUV:function(e,t,i,r,n){return ea.getUV(e,this.a,this.b,this.c,t,i,r,n)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:(An=new Xt,Rn=new Xt,Pn=new Xt,Cn=new Xt,In=new Xt,On=new Xt,function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Xt);var i,r,n=this.a,a=this.b,o=this.c;An.subVectors(a,n),Rn.subVectors(o,n),Cn.subVectors(e,n);var s=An.dot(Cn),c=Rn.dot(Cn);if(s<=0&&c<=0)return t.copy(n);In.subVectors(e,a);var l=An.dot(In),h=Rn.dot(In);if(0<=l&&h<=l)return t.copy(a);var u=s*h-l*c;if(u<=0&&0<=s&&l<=0)return i=s/(s-l),t.copy(n).addScaledVector(An,i);On.subVectors(e,o);var p=An.dot(On),d=Rn.dot(On);if(0<=d&&p<=d)return t.copy(o);var f=p*c-s*d;if(f<=0&&0<=c&&d<=0)return r=c/(c-d),t.copy(n).addScaledVector(Rn,r);var m=l*d-p*h;if(m<=0&&0<=h-l&&0<=p-d)return Pn.subVectors(o,a),r=(h-l)/(h-l+(p-d)),t.copy(a).addScaledVector(Pn,r);var g=1/(m+f+u);return i=f*g,r=u*g,t.copy(n).addScaledVector(An,i).addScaledVector(Rn,r)}),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),((ta.prototype=Object.create(hn.prototype)).constructor=ta).prototype.isMeshBasicMaterial=!0,ta.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},ia.prototype=Object.assign(Object.create(Er.prototype),{constructor:ia,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return Er.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,i,r=this.geometry;if(r.isBufferGeometry){var n=r.morphAttributes,a=Object.keys(n);if(0<a.length){var o=n[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)i=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}else{var s=r.morphTargets;void 0!==s&&0<s.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:(Un=new jt,Fn=new $n,Bn=new Ni,zn=new Xt,Gn=new Xt,Hn=new Xt,kn=new Xt,Vn=new Xt,jn=new Xt,Wn=new Vt,Xn=new Vt,qn=new Vt,Yn=new Xt,Zn=new Xt,function(e,t){var i,r=this.geometry,n=this.material,a=this.matrixWorld;if(void 0!==n&&(null===r.boundingSphere&&r.computeBoundingSphere(),Bn.copy(r.boundingSphere),Bn.applyMatrix4(a),!1!==e.ray.intersectsSphere(Bn)&&(Un.getInverse(a),Fn.copy(e.ray).applyMatrix4(Un),null===r.boundingBox||!1!==Fn.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o,s,c,l,h,u,p,d,f,m=r.index,g=r.attributes.position,v=r.attributes.uv,y=r.groups,x=r.drawRange;if(null!==m)if(Array.isArray(n))for(l=0,u=y.length;l<u;l++)for(f=n[(d=y[l]).materialIndex],h=Math.max(d.start,x.start),p=Math.min(d.start+d.count,x.start+x.count);h<p;h+=3)o=m.getX(h),s=m.getX(h+1),c=m.getX(h+2),(i=na(this,f,e,Fn,g,v,o,s,c))&&(i.faceIndex=Math.floor(h/3),i.face.materialIndex=d.materialIndex,t.push(i));else for(l=Math.max(0,x.start),u=Math.min(m.count,x.start+x.count);l<u;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(i=na(this,n,e,Fn,g,v,o,s,c))&&(i.faceIndex=Math.floor(l/3),t.push(i));else if(void 0!==g)if(Array.isArray(n))for(l=0,u=y.length;l<u;l++)for(f=n[(d=y[l]).materialIndex],h=Math.max(d.start,x.start),p=Math.min(d.start+d.count,x.start+x.count);h<p;h+=3)(i=na(this,f,e,Fn,g,v,o=h,s=h+1,c=h+2))&&(i.faceIndex=Math.floor(h/3),i.face.materialIndex=d.materialIndex,t.push(i));else for(l=Math.max(0,x.start),u=Math.min(g.count,x.start+x.count);l<u;l+=3)(i=na(this,n,e,Fn,g,v,o=l,s=l+1,c=l+2))&&(i.faceIndex=Math.floor(l/3),t.push(i))}else if(r.isGeometry){var b,w,_,M,E=Array.isArray(n),T=r.vertices,S=r.faces,L=r.faceVertexUvs[0];0<L.length&&(M=L);for(var A=0,R=S.length;A<R;A++){var P=S[A],C=E?n[P.materialIndex]:n;if(void 0!==C){if(b=T[P.a],w=T[P.b],_=T[P.c],!0===C.morphTargets){var I=r.morphTargets,O=this.morphTargetInfluences;zn.set(0,0,0),Gn.set(0,0,0),Hn.set(0,0,0);for(var D=0,N=I.length;D<N;D++){var U=O[D];if(0!==U){var F=I[D].vertices;zn.addScaledVector(kn.subVectors(F[P.a],b),U),Gn.addScaledVector(Vn.subVectors(F[P.b],w),U),Hn.addScaledVector(jn.subVectors(F[P.c],_),U)}}zn.add(b),Gn.add(w),Hn.add(_),b=zn,w=Gn,_=Hn}if(i=ra(this,C,e,Fn,b,w,_,Yn)){if(M&&M[A]){var B=M[A];Wn.copy(B[0]),Xn.copy(B[1]),qn.copy(B[2]),i.uv=ea.getUV(Yn,b,w,_,Wn,Xn,qn,new Vt)}i.face=P,i.faceIndex=A,t.push(i)}}}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((ga.prototype=Object.create(Si.prototype)).constructor=ga).prototype.isCubeTexture=!0,Object.defineProperty(ga.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),((va.prototype=Object.create(Si.prototype)).constructor=va).prototype.isDataTexture3D=!0;var ya=new Si,xa=new va,ba=new ga;function wa(){this.seq=[],this.map={}}var _a=[],Ma=[],Ea=new Float32Array(16),Ta=new Float32Array(9),Sa=new Float32Array(4);function La(e,t,i){var r=e[0];if(r<=0||0<r)return e;var n=t*i,a=_a[n];if(void 0===a&&(a=new Float32Array(n),_a[n]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=i,e[o].toArray(a,s)}return a}function Aa(e,t){if(e.length!==t.length)return!1;for(var i=0,r=e.length;i<r;i++)if(e[i]!==t[i])return!1;return!0}function Ra(e,t){for(var i=0,r=t.length;i<r;i++)e[i]=t[i]}function Pa(e,t){var i=Ma[t];void 0===i&&(i=new Int32Array(t),Ma[t]=i);for(var r=0;r!==t;++r)i[r]=e.allocTextureUnit();return i}function Ca(e,t){var i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function Ia(e,t){var i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function Oa(e,t){var i=this.cache;if(void 0!==t.x)i[0]===t.x&&i[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(Aa(i,t))return;e.uniform2fv(this.addr,t),Ra(i,t)}}function Da(e,t){var i=this.cache;if(void 0!==t.x)i[0]===t.x&&i[1]===t.y&&i[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)i[0]===t.r&&i[1]===t.g&&i[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(Aa(i,t))return;e.uniform3fv(this.addr,t),Ra(i,t)}}function Na(e,t){var i=this.cache;if(void 0!==t.x)i[0]===t.x&&i[1]===t.y&&i[2]===t.z&&i[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(Aa(i,t))return;e.uniform4fv(this.addr,t),Ra(i,t)}}function Ua(e,t){var i=this.cache,r=t.elements;if(void 0===r){if(Aa(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ra(i,t)}else{if(Aa(i,r))return;Sa.set(r),e.uniformMatrix2fv(this.addr,!1,Sa),Ra(i,r)}}function Fa(e,t){var i=this.cache,r=t.elements;if(void 0===r){if(Aa(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ra(i,t)}else{if(Aa(i,r))return;Ta.set(r),e.uniformMatrix3fv(this.addr,!1,Ta),Ra(i,r)}}function Ba(e,t){var i=this.cache,r=t.elements;if(void 0===r){if(Aa(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ra(i,t)}else{if(Aa(i,r))return;Ea.set(r),e.uniformMatrix4fv(this.addr,!1,Ea),Ra(i,r)}}function za(e,t,i){var r=this.cache,n=i.allocTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture2D(t||ya,n)}function Ga(e,t,i){var r=this.cache,n=i.allocTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture3D(t||xa,n)}function Ha(e,t,i){var r=this.cache,n=i.allocTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTextureCube(t||ba,n)}function ka(e,t){var i=this.cache;Aa(i,t)||(e.uniform2iv(this.addr,t),Ra(i,t))}function Va(e,t){var i=this.cache;Aa(i,t)||(e.uniform3iv(this.addr,t),Ra(i,t))}function ja(e,t){var i=this.cache;Aa(i,t)||(e.uniform4iv(this.addr,t),Ra(i,t))}function Wa(e,t){var i=this.cache;Aa(i,t)||(e.uniform1fv(this.addr,t),Ra(i,t))}function Xa(e,t){var i=this.cache;Aa(i,t)||(e.uniform1iv(this.addr,t),Ra(i,t))}function qa(e,t){var i=this.cache,r=La(t,this.size,2);Aa(i,r)||(e.uniform2fv(this.addr,r),this.updateCache(r))}function Ya(e,t){var i=this.cache,r=La(t,this.size,3);Aa(i,r)||(e.uniform3fv(this.addr,r),this.updateCache(r))}function Za(e,t){var i=this.cache,r=La(t,this.size,4);Aa(i,r)||(e.uniform4fv(this.addr,r),this.updateCache(r))}function Ja(e,t){var i=this.cache,r=La(t,this.size,4);Aa(i,r)||(e.uniformMatrix2fv(this.addr,!1,r),this.updateCache(r))}function Ka(e,t){var i=this.cache,r=La(t,this.size,9);Aa(i,r)||(e.uniformMatrix3fv(this.addr,!1,r),this.updateCache(r))}function Qa(e,t){var i=this.cache,r=La(t,this.size,16);Aa(i,r)||(e.uniformMatrix4fv(this.addr,!1,r),this.updateCache(r))}function $a(e,t,i){var r=this.cache,n=t.length,a=Pa(i,n);!1===Aa(r,a)&&(e.uniform1iv(this.addr,a),Ra(r,a));for(var o=0;o!==n;++o)i.setTexture2D(t[o]||ya,a[o])}function eo(e,t,i){var r=this.cache,n=t.length,a=Pa(i,n);!1===Aa(r,a)&&(e.uniform1iv(this.addr,a),Ra(r,a));for(var o=0;o!==n;++o)i.setTextureCube(t[o]||ba,a[o])}function to(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=function(e){switch(e){case 5126:return Ca;case 35664:return Oa;case 35665:return Da;case 35666:return Na;case 35674:return Ua;case 35675:return Fa;case 35676:return Ba;case 35678:case 36198:return za;case 35679:return Ga;case 35680:return Ha;case 5124:case 35670:return Ia;case 35667:case 35671:return ka;case 35668:case 35672:return Va;case 35669:case 35673:return ja}}(t.type)}function io(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Wa;case 35664:return qa;case 35665:return Ya;case 35666:return Za;case 35674:return Ja;case 35675:return Ka;case 35676:return Qa;case 35678:return $a;case 35680:return eo;case 5124:case 35670:return Xa;case 35667:case 35671:return ka;case 35668:case 35672:return Va;case 35669:case 35673:return ja}}(t.type)}function ro(e){this.id=e,wa.call(this)}io.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ra(t,e)},ro.prototype.setValue=function(e,t,i){for(var r=this.seq,n=0,a=r.length;n!==a;++n){var o=r[n];o.setValue(e,t[o.id],i)}};var no=/([\w\d_]+)(\])?(\[|\.)?/g;function ao(e,t){e.seq.push(t),e.map[t.id]=t}function oo(e,t,i){var r=e.name,n=r.length;for(no.lastIndex=0;;){var a=no.exec(r),o=no.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===n){ao(i,void 0===l?new to(s,e,t):new io(s,e,t));break}var h=i.map[s];void 0===h&&ao(i,h=new ro(s)),i=h}}function so(e,t,i){wa.call(this),this.renderer=i;for(var r=e.getProgramParameter(t,35718),n=0;n<r;++n){var a=e.getActiveUniform(t,n);oo(a,e.getUniformLocation(t,a.name),this)}}function co(e,t,i){var r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),!1===e.getShaderParameter(r,35713)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",35633===t?"vertex":"fragment",e.getShaderInfoLog(r),function(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")}(i)),r}so.prototype.setValue=function(e,t,i){var r=this.map[t];void 0!==r&&r.setValue(e,i,this.renderer)},so.prototype.setOptional=function(e,t,i){var r=t[i];void 0!==r&&this.setValue(e,i,r)},so.upload=function(e,t,i,r){for(var n=0,a=t.length;n!==a;++n){var o=t[n],s=i[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},so.seqWithValue=function(e,t){for(var i=[],r=0,n=e.length;r!==n;++r){var a=e[r];a.id in t&&i.push(a)}return i};var lo=0;function ho(e){switch(e){case Ct:return["Linear","( value )"];case It:return["sRGB","( value )"];case Dt:return["RGBE","( value )"];case Nt:return["RGBM","( value, 7.0 )"];case Ut:return["RGBM","( value, 16.0 )"];case Ft:return["RGBD","( value, 256.0 )"];case Ot:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function uo(e,t){var i=ho(t);return"vec4 "+e+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function po(e){return""!==e}function fo(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function mo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function go(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(e,t){var i=Bi[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return go(i)})}function vo(e){return e.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,i,r){for(var n="",a=parseInt(t);a<parseInt(i);a++)n+=r.replace(/\[ i \]/g,"[ "+a+" ]");return n})}function yo(e,t,i,r,n,a,o){var s=e.context,c=r.defines,l=n.vertexShader,h=n.fragmentShader,u="SHADOWMAP_TYPE_BASIC";a.shadowMapType===z?u="SHADOWMAP_TYPE_PCF":a.shadowMapType===G&&(u="SHADOWMAP_TYPE_PCF_SOFT");var p="ENVMAP_TYPE_CUBE",d="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(r.envMap.mapping){case ve:case ye:p="ENVMAP_TYPE_CUBE";break;case Ee:case Te:p="ENVMAP_TYPE_CUBE_UV";break;case xe:case be:p="ENVMAP_TYPE_EQUIREC";break;case we:p="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case ye:case be:d="ENVMAP_MODE_REFRACTION"}switch(r.combine){case j:f="ENVMAP_BLENDING_MULTIPLY";break;case W:f="ENVMAP_BLENDING_MIX";break;case ue:f="ENVMAP_BLENDING_ADD"}}var m,g,v,y,x,b,w,_,M=0<e.gammaFactor?e.gammaFactor:1,E=o.isWebGL2?"":(m=r.extensions,g=a,v=t,[(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(po).join("\n")),T=function(e){var t=[];for(var i in e){var r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join("\n")}(c),S=s.createProgram();if(r.isRawShaderMaterial?(0<(y=[T].filter(po).join("\n")).length&&(y+="\n"),0<(x=[E,T].filter(po).join("\n")).length&&(x+="\n")):(y=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+n.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.vertexTangents?"#define USE_TANGENT":"",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||t.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_TANGENT","\tattribute vec4 tangent;","#endif","#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(po).join("\n"),x=[E,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+n.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.matcap?"#define USE_MATCAP":"",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.vertexTangents?"#define USE_TANGENT":"",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||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==pe?"#define TONE_MAPPING":"",a.toneMapping!==pe?Bi.tonemapping_pars_fragment:"",a.toneMapping!==pe?function(e,t){var i;switch(t){case Me:i="Linear";break;case de:i="Reinhard";break;case fe:i="Uncharted2";break;case me:i="OptimizedCineon";break;case ge:i="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Bi.encodings_pars_fragment:"",a.mapEncoding?uo("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?uo("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?uo("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?uo("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(b="linearToOutputTexel",w=a.outputEncoding,_=ho(w),"vec4 "+b+"( vec4 value ) { return LinearTo"+_[0]+_[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(po).join("\n")),l=mo(l=fo(l=go(l),a),a),h=mo(h=fo(h=go(h),a),a),l=vo(l),h=vo(h),o.isWebGL2&&!r.isRawShaderMaterial){var L=!1,A=/^\s*#version\s+300\s+es\s*\n/;r.isShaderMaterial&&null!==l.match(A)&&null!==h.match(A)&&(L=!0,l=l.replace(A,""),h=h.replace(A,"")),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",L?"":"out highp vec4 pc_fragColor;",L?"":"#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=x+h,P=co(s,35633,y+l),C=co(s,35632,R);s.attachShader(S,P),s.attachShader(S,C),void 0!==r.index0AttributeName?s.bindAttribLocation(S,0,r.index0AttributeName):!0===a.morphTargets&&s.bindAttribLocation(S,0,"position"),s.linkProgram(S);var I,O,D=s.getProgramInfoLog(S).trim(),N=s.getShaderInfoLog(P).trim(),U=s.getShaderInfoLog(C).trim(),F=!0,B=!0;return!1===s.getProgramParameter(S,35714)?(F=!1,console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(S,35715),"gl.getProgramInfoLog",D,N,U)):""!==D?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",D):""!==N&&""!==U||(B=!1),B&&(this.diagnostics={runnable:F,material:r,programLog:D,vertexShader:{log:N,prefix:y},fragmentShader:{log:U,prefix:x}}),s.deleteShader(P),s.deleteShader(C),this.getUniforms=function(){return void 0===I&&(I=new so(s,S,e)),I},this.getAttributes=function(){return void 0===O&&(O=function(e,t){for(var i={},r=e.getProgramParameter(t,35721),n=0;n<r;n++){var a=e.getActiveAttrib(t,n).name;i[a]=e.getAttribLocation(t,a)}return i}(s,S)),O},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=n.name,this.id=lo++,this.code=i,this.usedTimes=1,this.program=S,this.vertexShader=P,this.fragmentShader=C,this}function xo(u,c,p){var l=[],d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},a=["precision","supportsVertexTextures","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","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(e,t){var i;return e?e.isTexture?i=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=e.texture.encoding):i=Ct,i===Ct&&t&&(i=Ot),i}this.getParameters=function(e,t,i,r,n,a,o){var s=d[e.type],c=o.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(p.floatVertexTextures)return 1024;var i=p.maxVertexUniforms,r=Math.floor((i-20)/4),n=Math.min(r,t.length);return n<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+n+"."),0):n}(o):0,l=p.precision;null!==e.precision&&(l=p.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",l,"instead.");var h=u.getRenderTarget();return{shaderID:s,precision:l,supportsVertexTextures:p.vertexTextures,outputEncoding:f(h?h.texture:null,u.gammaOutput),map:!!e.map,mapEncoding:f(e.map,u.gammaInput),matcap:!!e.matcap,matcapEncoding:f(e.matcap,u.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:f(e.envMap,u.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===Ee||e.envMap.mapping===Te),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:f(e.emissiveMap,u.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===Ht,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexTangents:e.normalMap&&e.vertexTangents,vertexColors:e.vertexColors,fog:!!r,useFog:e.fog,fogExp:r&&r.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:p.logarithmicDepthBuffer,skinning:e.skinning&&0<c,maxBones:c,useVertexTexture:p.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:u.maxMorphTargets,maxMorphNormals:u.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numClippingPlanes:n,numClipIntersection:a,dithering:e.dithering,shadowMapEnabled:u.shadowMap.enabled&&o.receiveShadow&&0<i.length,shadowMapType:u.shadowMap.type,toneMapping:u.toneMapping,physicallyCorrectLights:u.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===Z,flipSided:e.side===_e,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,t){var i=[];if(t.shaderID?i.push(t.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)i.push(r),i.push(e.defines[r]);for(var n=0;n<a.length;n++)i.push(t[a[n]]);return i.push(e.onBeforeCompile.toString()),i.push(u.gammaOutput),i.push(u.gammaFactor),i.join()},this.acquireProgram=function(e,t,i,r){for(var n,a=0,o=l.length;a<o;a++){var s=l[a];if(s.code===r){++(n=s).usedTimes;break}}return void 0===n&&(n=new yo(u,c,r,e,t,i,p),l.push(n)),n},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=l.indexOf(e);l[t]=l[l.length-1],l.pop(),e.destroy()}},this.programs=l}function bo(){var r=new WeakMap;return{get:function(e){var t=r.get(e);return void 0===t&&(t={},r.set(e,t)),t},remove:function(e){r.delete(e)},update:function(e,t,i){r.get(e)[t]=i},dispose:function(){r=new WeakMap}}}function wo(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program&&t.program&&e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function _o(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Mo(){var s=[],c=0,l=[],h=[];function u(e,t,i,r,n,a){var o=s[c];return void 0===o?(o={id:e.id,object:e,geometry:t,material:i,program:i.program,groupOrder:r,renderOrder:e.renderOrder,z:n,group:a},s[c]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=i,o.program=i.program,o.groupOrder=r,o.renderOrder=e.renderOrder,o.z=n,o.group=a),c++,o}return{opaque:l,transparent:h,init:function(){c=0,l.length=0,h.length=0},push:function(e,t,i,r,n,a){var o=u(e,t,i,r,n,a);(!0===i.transparent?h:l).push(o)},unshift:function(e,t,i,r,n,a){var o=u(e,t,i,r,n,a);(!0===i.transparent?h:l).unshift(o)},sort:function(){1<l.length&&l.sort(wo),1<h.length&&h.sort(_o)}}}function Eo(){var n={};function a(e){var t=e.target;t.removeEventListener("dispose",a),delete n[t.id]}return{get:function(e,t){var i,r=n[e.id];return void 0===r?(i=new Mo,n[e.id]={},n[e.id][t.id]=i,e.addEventListener("dispose",a)):void 0===(i=r[t.id])&&(i=new Mo,r[t.id]=i),i},dispose:function(){n={}}}}function To(){var i={};return{get:function(e){if(void 0!==i[e.id])return i[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new Xt,color:new Xi,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Vt};break;case"SpotLight":t={position:new Xt,direction:new Xt,color:new Xi,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Vt};break;case"PointLight":t={position:new Xt,color:new Xi,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Vt,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":t={direction:new Xt,skyColor:new Xi,groundColor:new Xi};break;case"RectAreaLight":t={color:new Xi,position:new Xt,halfWidth:new Xt,halfHeight:new Xt}}return i[e.id]=t}}}var So=0;function Lo(){var w=new To,_={id:So++,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 Xt,E=new jt,T=new jt;return{setup:function(e,t,i){for(var r=0,n=0,a=0,o=0,s=0,c=0,l=0,h=0,u=i.matrixWorldInverse,p=0,d=e.length;p<d;p++){var f=e[p],m=f.color,g=f.intensity,v=f.distance,y=f.shadow&&f.shadow.map?f.shadow.map.texture:null;if(f.isAmbientLight)r+=m.r*g,n+=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){if((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=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[l]=b,l++}else if(f.isPointLight){if((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=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[h]=b,h++}}_.ambient[0]=r,_.ambient[1]=n,_.ambient[2]=a,_.directional.length=o,_.spot.length=c,_.rectArea.length=l,_.point.length=s,_.hemi.length=h,_.hash.stateID=_.id,_.hash.directionalLength=o,_.hash.pointLength=s,_.hash.spotLength=c,_.hash.rectAreaLength=l,_.hash.hemiLength=h,_.hash.shadowsLength=t.length},state:_}}function Ao(){var t=new Lo,i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:function(e){t.setup(i,r,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){r.push(e)}}}function Ro(){var r={};function n(e){var t=e.target;t.removeEventListener("dispose",n),delete r[t.id]}return{get:function(e,t){var i;return void 0===r[e.id]?(i=new Ao,r[e.id]={},r[e.id][t.id]=i,e.addEventListener("dispose",n)):void 0===r[e.id][t.id]?(i=new Ao,r[e.id][t.id]=i):i=r[e.id][t.id],i},dispose:function(){r={}}}}function Po(e){hn.call(this),this.type="MeshDepthMaterial",this.depthPacking=Bt,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(e)}function Co(e){hn.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Xt,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(e)}function Io(x,m,e){for(var b=new Fi,w=new jt,_=new Vt,M=new Vt(e,e),E=new Xt,T=new Xt,v=1,y=2,t=1+(v|y),S=new Array(t),L=new Array(t),A={},R={0:_e,1:N,2:Z},P=[new Xt(1,0,0),new Xt(-1,0,0),new Xt(0,0,1),new Xt(0,0,-1),new Xt(0,1,0),new Xt(0,-1,0)],C=[new Xt(0,1,0),new Xt(0,1,0),new Xt(0,1,0),new Xt(0,1,0),new Xt(0,0,1),new Xt(0,0,-1)],I=[new Li,new Li,new Li,new Li,new Li,new Li],i=0;i!==t;++i){var r=0!=(i&v),n=0!=(i&y),a=new Po({depthPacking:zt,morphTargets:r,skinning:n});S[i]=a;var o=new Co({morphTargets:r,skinning:n});L[i]=o}var O=this;function g(e,t,i,r,n,a){var o=e.geometry,s=null,c=S,l=e.customDepthMaterial;if(i&&(c=L,l=e.customDistanceMaterial),l)s=l;else{var h=!1;t.morphTargets&&(o&&o.isBufferGeometry?h=o.morphAttributes&&o.morphAttributes.position&&0<o.morphAttributes.position.length:o&&o.isGeometry&&(h=o.morphTargets&&0<o.morphTargets.length)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var u=e.isSkinnedMesh&&t.skinning,p=0;h&&(p|=v),u&&(p|=y),s=c[p]}if(x.localClippingEnabled&&!0===t.clipShadows&&0!==t.clippingPlanes.length){var d=s.uuid,f=t.uuid,m=A[d];void 0===m&&(m={},A[d]=m);var g=m[f];void 0===g&&(g=s.clone(),m[f]=g),s=g}return s.visible=t.visible,s.wireframe=t.wireframe,s.side=null!=t.shadowSide?t.shadowSide:R[t.side],s.clipShadows=t.clipShadows,s.clippingPlanes=t.clippingPlanes,s.clipIntersection=t.clipIntersection,s.wireframeLinewidth=t.wireframeLinewidth,s.linewidth=t.linewidth,i&&s.isMeshDistanceMaterial&&(s.referencePosition.copy(r),s.nearDistance=n,s.farDistance=a),s}function D(e,t,i,r){if(!1!==e.visible){if(e.layers.test(t.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||b.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld);var n=m.update(e),a=e.material;if(Array.isArray(a))for(var o=n.groups,s=0,c=o.length;s<c;s++){var l=o[s],h=a[l.materialIndex];if(h&&h.visible){var u=g(e,h,r,T,i.near,i.far);x.renderBufferDirect(i,null,n,u,e,l)}}else if(a.visible){u=g(e,a,r,T,i.near,i.far);x.renderBufferDirect(i,null,n,u,e,null)}}for(var p=e.children,d=0,f=p.length;d<f;d++)D(p[d],t,i,r)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=z,this.render=function(e,t,i){if(!1!==O.enabled&&(!1!==O.autoUpdate||!1!==O.needsUpdate)&&0!==e.length){var r,n=x.getRenderTarget(),a=x.state;a.setBlending(J),a.buffers.color.setClear(1,1,1,1),a.buffers.depth.setTest(!0),a.setScissorTest(!1);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.shadow,h=c&&c.isPointLight;if(void 0!==l){var u=l.camera;if(_.copy(l.mapSize),_.min(M),h){var p=_.x,d=_.y;I[0].set(2*p,d,p,d),I[1].set(0,d,p,d),I[2].set(3*p,d,p,d),I[3].set(p,d,p,d),I[4].set(3*p,0,p,d),I[5].set(p,0,p,d),_.x*=4,_.y*=2}if(null===l.map){var f={minFilter:Re,magFilter:Re,format:Ze};l.map=new Ai(_.x,_.y,f),l.map.texture.name=c.name+".shadowMap",u.updateProjectionMatrix()}l.isSpotLightShadow&&l.update(c);var m=l.map,g=l.matrix;T.setFromMatrixPosition(c.matrixWorld),u.position.copy(T),h?(r=6,g.makeTranslation(-T.x,-T.y,-T.z)):(r=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<r;v++){if(h){E.copy(u.position),E.add(P[v]),u.up.copy(C[v]),u.lookAt(E),u.updateMatrixWorld();var y=I[v];a.viewport(y)}w.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),b.setFromMatrix(w),D(t,i,u,h)}}else console.warn("THREE.WebGLShadowMap:",c,"has no shadow.")}O.needsUpdate=!1,x.setRenderTarget(n)}}}function Oo(h,i,c,r){var n=new function(){var t=!1,a=new Li,i=null,o=new Li(0,0,0,0);return{setMask:function(e){i===e||t||(h.colorMask(e,e,e,e),i=e)},setLocked:function(e){t=e},setClear:function(e,t,i,r,n){!0===n&&(e*=r,t*=r,i*=r),a.set(e,t,i,r),!1===o.equals(a)&&(h.clearColor(e,t,i,r),o.copy(a))},reset:function(){t=!1,i=null,o.set(-1,0,0,0)}}},a=new function(){var t=!1,i=null,r=null,n=null;return{setTest:function(e){e?z(2929):G(2929)},setMask:function(e){i===e||t||(h.depthMask(e),i=e)},setFunc:function(e){if(r!==e){if(e)switch(e){case re:h.depthFunc(512);break;case ne:h.depthFunc(519);break;case ae:h.depthFunc(513);break;case oe:h.depthFunc(515);break;case se:h.depthFunc(514);break;case ce:h.depthFunc(518);break;case le:h.depthFunc(516);break;case he:h.depthFunc(517);break;default:h.depthFunc(515)}else h.depthFunc(515);r=e}},setLocked:function(e){t=e},setClear:function(e){n!==e&&(h.clearDepth(e),n=e)},reset:function(){t=!1,n=r=i=null}}},t=new function(){var t=!1,i=null,r=null,n=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){e?z(2960):G(2960)},setMask:function(e){i===e||t||(h.stencilMask(e),i=e)},setFunc:function(e,t,i){r===e&&n===t&&a===i||(h.stencilFunc(e,t,i),r=e,n=t,a=i)},setOp:function(e,t,i){o===e&&s===t&&c===i||(h.stencilOp(e,t,i),o=e,s=t,c=i)},setLocked:function(e){t=e},setClear:function(e){l!==e&&(h.clearStencil(e),l=e)},reset:function(){t=!1,l=c=s=o=a=n=r=i=null}}},e=h.getParameter(34921),o=new Uint8Array(e),s=new Uint8Array(e),l=new Uint8Array(e),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,L=null,A=h.getParameter(35661),R=!1,P=0,C=h.getParameter(7938);-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 I=null,O={},D=new Li,N=new Li;function U(e,t,i){var r=new Uint8Array(4),n=h.createTexture();h.bindTexture(e,n),h.texParameteri(e,10241,9728),h.texParameteri(e,10240,9728);for(var a=0;a<i;a++)h.texImage2D(t+a,0,6408,1,1,0,6408,5121,r);return n}var F={};function B(e,t){o[e]=1,0===s[e]&&(h.enableVertexAttribArray(e),s[e]=1),l[e]!==t&&((r.isWebGL2?h:i.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](e,t),l[e]=t)}function z(e){!0!==u[e]&&(h.enable(e),u[e]=!0)}function G(e){!1!==u[e]&&(h.disable(e),u[e]=!1)}function H(e,t,i,r,n,a,o,s){if(e!==J){if(f||(z(3042),f=!0),e===te)n=n||t,a=a||i,o=o||r,t===g&&n===x||(h.blendEquationSeparate(c.convert(t),c.convert(n)),g=t,x=n),i===v&&r===y&&a===b&&o===w||(h.blendFuncSeparate(c.convert(i),c.convert(r),c.convert(a),c.convert(o)),v=i,y=r,b=a,w=o),m=e,_=null;else if(e!==m||s!==_){if(g===ie&&x===ie||(h.blendEquation(32774),x=g=ie),s)switch(e){case K:h.blendFuncSeparate(1,771,1,771);break;case Q:h.blendFunc(1,1);break;case $:h.blendFuncSeparate(0,0,769,771);break;case ee:h.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case K:h.blendFuncSeparate(770,771,1,771);break;case Q:h.blendFunc(770,1);break;case $:h.blendFunc(0,769);break;case ee:h.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}w=b=y=v=null,m=e,_=s}}else f&&(G(3042),f=!1)}function k(e){M!==e&&(e?h.frontFace(2304):h.frontFace(2305),M=e)}function V(e){e!==X?(z(2884),e!==E&&(e===q?h.cullFace(1029):e===Y?h.cullFace(1028):h.cullFace(1032))):G(2884),E=e}function j(e,t,i){e?(z(32823),S===t&&L===i||(h.polygonOffset(t,i),S=t,L=i)):G(32823)}function W(e){void 0===e&&(e=33984+A-1),I!==e&&(h.activeTexture(e),I=e)}return F[3553]=U(3553,3553,1),F[34067]=U(34067,34069,6),n.setClear(0,0,0,1),a.setClear(1),t.setClear(0),z(2929),a.setFunc(oe),k(!1),V(q),z(2884),H(J),{buffers:{color:n,depth:a,stencil:t},initAttributes:function(){for(var e=0,t=o.length;e<t;e++)o[e]=0},enableAttribute:function(e){B(e,0)},enableAttributeAndDivisor:B,disableUnusedAttributes:function(){for(var e=0,t=s.length;e!==t;++e)s[e]!==o[e]&&(h.disableVertexAttribArray(e),s[e]=0)},enable:z,disable:G,getCompressedTextureFormats:function(){if(null===p&&(p=[],i.get("WEBGL_compressed_texture_pvrtc")||i.get("WEBGL_compressed_texture_s3tc")||i.get("WEBGL_compressed_texture_etc1")||i.get("WEBGL_compressed_texture_astc")))for(var e=h.getParameter(34467),t=0;t<e.length;t++)p.push(e[t]);return p},useProgram:function(e){return d!==e&&(h.useProgram(e),d=e,!0)},setBlending:H,setMaterial:function(e,t){e.side===Z?G(2884):z(2884);var i=e.side===_e;t&&(i=!i),k(i),e.blending===K&&!1===e.transparent?H(J):H(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),n.setMask(e.colorWrite),j(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:k,setCullFace:V,setLineWidth:function(e){e!==T&&(R&&h.lineWidth(e),T=e)},setPolygonOffset:j,setScissorTest:function(e){e?z(3089):G(3089)},activeTexture:W,bindTexture:function(e,t){null===I&&W();var i=O[I];void 0===i&&(i={type:void 0,texture:void 0},O[I]=i),i.type===e&&i.texture===t||(h.bindTexture(e,t||F[e]),i.type=e,i.texture=t)},compressedTexImage2D:function(){try{h.compressedTexImage2D.apply(h,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{h.texImage2D.apply(h,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{h.texImage3D.apply(h,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===D.equals(e)&&(h.scissor(e.x,e.y,e.z,e.w),D.copy(e))},viewport:function(e){!1===N.equals(e)&&(h.viewport(e.x,e.y,e.z,e.w),N.copy(e))},reset:function(){for(var e=0;e<s.length;e++)1===s[e]&&(h.disableVertexAttribArray(e),s[e]=0);u={},O={},E=M=m=d=I=p=null,n.reset(),a.reset(),t.reset()}}}function Do(g,n,v,y,x,b,l){var h,s={},u="undefined"!=typeof OffscreenCanvas;function p(e,t){return u?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function w(e,t,i,r){var n=1;if((e.width>r||e.height>r)&&(n=r/Math.max(e.width,e.height)),n<1||!0===t){if(e instanceof ImageBitmap||e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var a=t?kt.floorPowerOfTwo:Math.floor,o=a(n*e.width),s=a(n*e.height);void 0===h&&(h=p(o,s));var c=i?p(o,s):h;return c.width=o,c.height=s,c.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),u?c.transferToImageBitmap():c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function _(e){return kt.isPowerOfTwo(e.width)&&kt.isPowerOfTwo(e.height)}function M(e,t){return e.generateMipmaps&&t&&e.minFilter!==Re&&e.minFilter!==Ie}function E(e,t,i,r){g.generateMipmap(e),y.get(t).__maxMipLevel=Math.log(Math.max(i,r))*Math.LOG2E}function T(e,t){if(!x.isWebGL2)return e;var i=e;return 6403===e&&(5126===t&&(i=33326),5131===t&&(i=33325),5121===t&&(i=33321)),6407===e&&(5126===t&&(i=34837),5131===t&&(i=34843),5121===t&&(i=32849)),6408===e&&(5126===t&&(i=34836),5131===t&&(i=34842),5121===t&&(i=32856)),33325===i||33326===i||34842===i||34836===i?n.get("EXT_color_buffer_float"):34843!==i&&34837!==i||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),i}function a(e){return e===Re||e===Pe||e===Ce?9728:9729}function i(e){var t=e.target;t.removeEventListener("dispose",i),function(e){var t=y.get(e);if(void 0===t.__webglInit)return;g.deleteTexture(t.__webglTexture),y.remove(e)}(t),t.isVideoTexture&&delete s[t.id],l.memory.textures--}function d(e){var t=e.target;t.removeEventListener("dispose",d),function(e){var t=y.get(e),i=y.get(e.texture);if(!e)return;void 0!==i.__webglTexture&&g.deleteTexture(i.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var r=0;r<6;r++)g.deleteFramebuffer(t.__webglFramebuffer[r]),t.__webglDepthbuffer&&g.deleteRenderbuffer(t.__webglDepthbuffer[r]);else g.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&g.deleteRenderbuffer(t.__webglDepthbuffer);y.remove(e.texture),y.remove(e)}(t),l.memory.textures--}function o(e,t){var i,r,n,a=y.get(e);if(e.isVideoTexture&&(r=(i=e).id,n=l.render.frame,s[r]!==n&&(s[r]=n,i.update())),0<e.version&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void c(a,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}v.activeTexture(33984+t),v.bindTexture(3553,a.__webglTexture)}function S(e,t,i){var r;if(i?(g.texParameteri(e,10242,b.convert(t.wrapS)),g.texParameteri(e,10243,b.convert(t.wrapT)),32879===e&&g.texParameteri(e,32882,b.convert(t.wrapR)),g.texParameteri(e,10240,b.convert(t.magFilter)),g.texParameteri(e,10241,b.convert(t.minFilter))):(g.texParameteri(e,10242,33071),g.texParameteri(e,10243,33071),32879===e&&g.texParameteri(e,32882,33071),t.wrapS===Le&&t.wrapT===Le||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),g.texParameteri(e,10240,a(t.magFilter)),g.texParameteri(e,10241,a(t.minFilter)),t.minFilter!==Re&&t.minFilter!==Ie&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),r=n.get("EXT_texture_filter_anisotropic")){if(t.type===He&&null===n.get("OES_texture_float_linear"))return;if(t.type===ke&&null===(x.isWebGL2||n.get("OES_texture_half_float_linear")))return;(1<t.anisotropy||y.get(t).__currentAnisotropy)&&(g.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,x.getMaxAnisotropy())),y.get(t).__currentAnisotropy=t.anisotropy)}}function L(e,t){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",i),e.__webglTexture=g.createTexture(),l.memory.textures++)}function c(e,t,i){var r=t.isDataTexture3D?32879:3553;L(e,t),v.activeTexture(33984+i),v.bindTexture(r,e.__webglTexture),g.pixelStorei(37440,t.flipY),g.pixelStorei(37441,t.premultiplyAlpha),g.pixelStorei(3317,t.unpackAlignment);var n,a=(n=t,!x.isWebGL2&&(n.wrapS!==Le||n.wrapT!==Le||n.minFilter!==Re&&n.minFilter!==Ie)&&!1===_(t.image)),o=w(t.image,a,!1,x.maxTextureSize),s=_(o)||x.isWebGL2,c=b.convert(t.format),l=b.convert(t.type),h=T(c,l);S(r,t,s);var u,p=t.mipmaps;if(t.isDepthTexture){if(h=6402,t.type===He){if(!x.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");h=36012}else x.isWebGL2&&(h=33189);t.format===$e&&6402===h&&t.type!==Be&&t.type!==Ge&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),t.type=Be,l=b.convert(t.type)),t.format===et&&(h=34041,t.type!==Xe&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),t.type=Xe,l=b.convert(t.type))),v.texImage2D(3553,0,h,o.width,o.height,0,c,l,null)}else if(t.isDataTexture)if(0<p.length&&s){for(var d=0,f=p.length;d<f;d++)u=p[d],v.texImage2D(3553,d,h,u.width,u.height,0,c,l,u.data);t.generateMipmaps=!1,e.__maxMipLevel=p.length-1}else v.texImage2D(3553,0,h,o.width,o.height,0,c,l,o.data),e.__maxMipLevel=0;else if(t.isCompressedTexture){for(d=0,f=p.length;d<f;d++)u=p[d],t.format!==Ze&&t.format!==Ye?-1<v.getCompressedTextureFormats().indexOf(c)?v.compressedTexImage2D(3553,d,h,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v.texImage2D(3553,d,h,u.width,u.height,0,c,l,u.data);e.__maxMipLevel=p.length-1}else if(t.isDataTexture3D)v.texImage3D(32879,0,h,o.width,o.height,o.depth,0,c,l,o.data),e.__maxMipLevel=0;else if(0<p.length&&s){for(d=0,f=p.length;d<f;d++)u=p[d],v.texImage2D(3553,d,h,c,l,u);t.generateMipmaps=!1,e.__maxMipLevel=p.length-1}else v.texImage2D(3553,0,h,c,l,o),e.__maxMipLevel=0;M(t,s)&&E(3553,t,o.width,o.height),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function f(e,t,i,r){var n=b.convert(t.texture.format),a=b.convert(t.texture.type),o=T(n,a);v.texImage2D(r,0,o,t.width,t.height,0,n,a,null),g.bindFramebuffer(36160,e),g.framebufferTexture2D(36160,i,r,y.get(t.texture).__webglTexture,0),g.bindFramebuffer(36160,null)}function m(e,t,i){if(g.bindRenderbuffer(36161,e),t.depthBuffer&&!t.stencilBuffer){if(i){var r=R(t);g.renderbufferStorageMultisample(36161,r,33189,t.width,t.height)}else g.renderbufferStorage(36161,33189,t.width,t.height);g.framebufferRenderbuffer(36160,36096,36161,e)}else if(t.depthBuffer&&t.stencilBuffer){if(i){r=R(t);g.renderbufferStorageMultisample(36161,r,34041,t.width,t.height)}else g.renderbufferStorage(36161,34041,t.width,t.height);g.framebufferRenderbuffer(36160,33306,36161,e)}else{var n=T(b.convert(t.texture.format),b.convert(t.texture.type));if(i){r=R(t);g.renderbufferStorageMultisample(36161,r,n,t.width,t.height)}else g.renderbufferStorage(36161,n,t.width,t.height)}g.bindRenderbuffer(36161,null)}function A(e){var t=y.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,t){if(t&&t.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(g.bindFramebuffer(36160,e),!t.depthTexture||!t.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");y.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),o(t.depthTexture,0);var i=y.get(t.depthTexture).__webglTexture;if(t.depthTexture.format===$e)g.framebufferTexture2D(36160,36096,3553,i,0);else{if(t.depthTexture.format!==et)throw new Error("Unknown depthTexture format");g.framebufferTexture2D(36160,33306,3553,i,0)}}(t.__webglFramebuffer,e)}else if(i){t.__webglDepthbuffer=[];for(var r=0;r<6;r++)g.bindFramebuffer(36160,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=g.createRenderbuffer(),m(t.__webglDepthbuffer[r],e)}else g.bindFramebuffer(36160,t.__webglFramebuffer),t.__webglDepthbuffer=g.createRenderbuffer(),m(t.__webglDepthbuffer,e);g.bindFramebuffer(36160,null)}function R(e){return x.isWebGL2&&e.isWebGLMultisampleRenderTarget?Math.min(x.maxSamples,e.samples):0}this.setTexture2D=o,this.setTexture3D=function(e,t){var i=y.get(e);0<e.version&&i.__version!==e.version?c(i,e,t):(v.activeTexture(33984+t),v.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(e,t){var i=y.get(e);if(6===e.image.length)if(0<e.version&&i.__version!==e.version){L(i,e),v.activeTexture(33984+t),v.bindTexture(34067,i.__webglTexture),g.pixelStorei(37440,e.flipY);for(var r=e&&e.isCompressedTexture,n=e.image[0]&&e.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=r||n?n?e.image[o].image:e.image[o]:w(e.image[o],!1,!0,x.maxCubemapSize);var s=a[0],c=_(s)||x.isWebGL2,l=b.convert(e.format),h=b.convert(e.type),u=T(l,h);S(34067,e,c);for(o=0;o<6;o++)if(r)for(var p,d=a[o].mipmaps,f=0,m=d.length;f<m;f++)p=d[f],e.format!==Ze&&e.format!==Ye?-1<v.getCompressedTextureFormats().indexOf(l)?v.compressedTexImage2D(34069+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(34069+o,f,u,p.width,p.height,0,l,h,p.data);else n?v.texImage2D(34069+o,0,u,a[o].width,a[o].height,0,l,h,a[o].data):v.texImage2D(34069+o,0,u,l,h,a[o]);i.__maxMipLevel=r?d.length-1:0,M(e,c)&&E(34067,e,s.width,s.height),i.__version=e.version,e.onUpdate&&e.onUpdate(e)}else v.activeTexture(33984+t),v.bindTexture(34067,i.__webglTexture)},this.setTextureCubeDynamic=function(e,t){v.activeTexture(33984+t),v.bindTexture(34067,y.get(e).__webglTexture)},this.setupRenderTarget=function(e){var t=y.get(e),i=y.get(e.texture);e.addEventListener("dispose",d),i.__webglTexture=g.createTexture(),l.memory.textures++;var r=!0===e.isWebGLRenderTargetCube,n=!0===e.isWebGLMultisampleRenderTarget,a=_(e)||x.isWebGL2;if(r){t.__webglFramebuffer=[];for(var o=0;o<6;o++)t.__webglFramebuffer[o]=g.createFramebuffer()}else if(t.__webglFramebuffer=g.createFramebuffer(),n)if(x.isWebGL2){t.__webglMultisampledFramebuffer=g.createFramebuffer(),t.__webglColorRenderbuffer=g.createRenderbuffer(),g.bindRenderbuffer(36161,t.__webglColorRenderbuffer);var s=T(b.convert(e.texture.format),b.convert(e.texture.type)),c=R(e);g.renderbufferStorageMultisample(36161,c,s,e.width,e.height),g.bindFramebuffer(36160,t.__webglMultisampledFramebuffer),g.framebufferRenderbuffer(36160,36064,36161,t.__webglColorRenderbuffer),g.bindRenderbuffer(36161,null),e.depthBuffer&&(t.__webglDepthRenderbuffer=g.createRenderbuffer(),m(t.__webglDepthRenderbuffer,e,!0)),g.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(r){v.bindTexture(34067,i.__webglTexture),S(34067,e.texture,a);for(o=0;o<6;o++)f(t.__webglFramebuffer[o],e,36064,34069+o);M(e.texture,a)&&E(34067,e.texture,e.width,e.height),v.bindTexture(34067,null)}else v.bindTexture(3553,i.__webglTexture),S(3553,e.texture,a),f(t.__webglFramebuffer,e,36064,3553),M(e.texture,a)&&E(3553,e.texture,e.width,e.height),v.bindTexture(3553,null);e.depthBuffer&&A(e)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(M(t,_(e)||x.isWebGL2)){var i=e.isWebGLRenderTargetCube?34067:3553,r=y.get(t).__webglTexture;v.bindTexture(i,r),E(i,t,e.width,e.height),v.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(x.isWebGL2){var t=y.get(e);g.bindFramebuffer(36008,t.__webglMultisampledFramebuffer),g.bindFramebuffer(36009,t.__webglFramebuffer);var i=e.width,r=e.height,n=16384;e.depthBuffer&&(n|=256),e.stencilBuffer&&(n|=1024),g.blitFramebuffer(0,0,i,r,0,0,i,r,n,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}}function No(e,i,r){return{convert:function(e){var t;if(e===Se)return 10497;if(e===Le)return 33071;if(e===Ae)return 33648;if(e===Re)return 9728;if(e===Pe)return 9984;if(e===Ce)return 9986;if(e===Ie)return 9729;if(e===Oe)return 9985;if(e===De)return 9987;if(e===Ne)return 5121;if(e===Ve)return 32819;if(e===je)return 32820;if(e===We)return 33635;if(e===Ue)return 5120;if(e===Fe)return 5122;if(e===Be)return 5123;if(e===ze)return 5124;if(e===Ge)return 5125;if(e===He)return 5126;if(e===ke){if(r.isWebGL2)return 5131;if(null!==(t=i.get("OES_texture_half_float")))return t.HALF_FLOAT_OES}if(e===qe)return 6406;if(e===Ye)return 6407;if(e===Ze)return 6408;if(e===Je)return 6409;if(e===Ke)return 6410;if(e===$e)return 6402;if(e===et)return 34041;if(e===tt)return 6403;if(e===ie)return 32774;if(e===S)return 32778;if(e===L)return 32779;if(e===P)return 0;if(e===C)return 1;if(e===I)return 768;if(e===O)return 769;if(e===D)return 770;if(e===U)return 771;if(e===F)return 772;if(e===B)return 773;if(e===H)return 774;if(e===k)return 775;if(e===V)return 776;if((e===it||e===rt||e===nt||e===at)&&null!==(t=i.get("WEBGL_compressed_texture_s3tc"))){if(e===it)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===rt)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===nt)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===at)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===ot||e===st||e===ct||e===lt)&&null!==(t=i.get("WEBGL_compressed_texture_pvrtc"))){if(e===ot)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===st)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===ct)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===lt)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===ht&&null!==(t=i.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===ut||e===pt||e===dt||e===ft||e===mt||e===gt||e===vt||e===yt||e===xt||e===bt||e===wt||e===_t||e===Mt||e===Et)&&null!==(t=i.get("WEBGL_compressed_texture_astc")))return e;if(e===A||e===R){if(r.isWebGL2){if(e===A)return 32775;if(e===R)return 32776}if(null!==(t=i.get("EXT_blend_minmax"))){if(e===A)return t.MIN_EXT;if(e===R)return t.MAX_EXT}}if(e===Xe){if(r.isWebGL2)return 34042;if(null!==(t=i.get("WEBGL_depth_texture")))return t.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Uo(){Er.call(this),this.type="Group"}function Fo(){Er.call(this),this.type="Camera",this.matrixWorldInverse=new jt,this.projectionMatrix=new jt,this.projectionMatrixInverse=new jt}function Bo(e,t,i,r){Fo.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function zo(e){Bo.call(this),this.cameras=e||[]}((Po.prototype=Object.create(hn.prototype)).constructor=Po).prototype.isMeshDepthMaterial=!0,Po.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},((Co.prototype=Object.create(hn.prototype)).constructor=Co).prototype.isMeshDistanceMaterial=!0,Co.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Uo.prototype=Object.assign(Object.create(Er.prototype),{constructor:Uo,isGroup:!0}),Fo.prototype=Object.assign(Object.create(Er.prototype),{constructor:Fo,isCamera:!0,copy:function(e,t){return Er.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Xt),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Er.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Bo.prototype=Object.assign(Object.create(Fo.prototype),{constructor:Bo,isPerspectiveCamera:!0,copy:function(e,t){return Fo.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*kt.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*kt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*kt.RAD2DEG*Math.atan(Math.tan(.5*kt.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(e,t,i,r,n,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*kt.DEG2RAD*this.fov)/this.zoom,i=2*t,r=this.aspect*i,n=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;n+=a.offsetX*r/o,t-=a.offsetY*i/s,r*=a.width/o,i*=a.height/s}var c=this.filmOffset;0!==c&&(n+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+r,t,t-i,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Er.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),zo.prototype=Object.assign(Object.create(Bo.prototype),{constructor:zo,isArrayCamera:!0});var Go,Ho,ko,Vo,jo,Wo,Xo,qo,Yo,Zo,Jo,Ko,Qo,$o,es,ts,is,rs,ns,as,os,ss,cs,ls,hs,us,ps,ds,fs=new Xt,ms=new Xt;function gs(e,t,i){fs.setFromMatrixPosition(t.matrixWorld),ms.setFromMatrixPosition(i.matrixWorld);var r=fs.distanceTo(ms),n=t.projectionMatrix.elements,a=i.projectionMatrix.elements,o=n[14]/(n[10]-1),s=n[14]/(n[10]+1),c=(n[9]+1)/n[5],l=(n[9]-1)/n[5],h=(n[8]-1)/n[0],u=(a[8]+1)/a[0],p=o*h,d=o*u,f=r/(u-h),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+f,v=s+f,y=p-m,x=r-m+d,b=c*s/v*g,w=l*s/v*g;e.projectionMatrix.makePerspective(y,x,b,w,g,v)}function vs(r){var n=this,c=null,l=null,h=null,u=[],p=new jt,d=new jt,a=1,f="stage";"undefined"!=typeof window&&"VRFrameData"in window&&(l=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",e,!1));var m=new jt,g=new Wt,v=new Xt,y=new Bo;y.bounds=new Li(0,0,.5,1),y.layers.enable(1);var x=new Bo;x.bounds=new Li(.5,0,.5,1),x.layers.enable(2);var b=new zo([y,x]);function w(){return null!==c&&!0===c.isPresenting}b.layers.enable(1),b.layers.enable(2);var o,s=new Vt;function e(){if(w()){var e=c.getEyeParameters("left"),t=e.renderWidth*a,i=e.renderHeight*a;o=r.getPixelRatio(),r.getSize(s),r.setDrawingBufferSize(2*t,i,1),E.start()}else n.enabled&&r.setDrawingBufferSize(s.width,s.height,o),E.stop()}var _=[];function M(e){for(var t=navigator.getGamepads&&navigator.getGamepads(),i=0,r=0,n=t.length;i<n;i++){var a=t[i];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(r===e)return a;r++}}}this.enabled=!1,this.getController=function(e){var t=u[e];return void 0===t&&((t=new Uo).matrixAutoUpdate=!1,t.visible=!1,u[e]=t),t},this.getDevice=function(){return c},this.setDevice=function(e){void 0!==e&&(c=e),E.setContext(e)},this.setFramebufferScaleFactor=function(e){a=e},this.setFrameOfReferenceType=function(e){f=e},this.setPoseTarget=function(e){void 0!==e&&(h=e)},this.getCamera=function(e){var t="stage"===f?1.6:0;if(!1===w())return e.position.set(0,t,0),e.rotation.set(0,0,0),e;if(c.depthNear=e.near,c.depthFar=e.far,c.getFrameData(l),"stage"===f){var i=c.stageParameters;i?p.fromArray(i.sittingToStandingTransform):p.makeTranslation(0,t,0)}var r=l.pose,n=null!==h?h:e;n.matrix.copy(p),n.matrix.decompose(n.position,n.quaternion,n.scale),null!==r.orientation&&(g.fromArray(r.orientation),n.quaternion.multiply(g)),null!==r.position&&(g.setFromRotationMatrix(p),v.fromArray(r.position),v.applyQuaternion(g),n.position.add(v)),n.updateMatrixWorld(),y.near=e.near,x.near=e.near,y.far=e.far,x.far=e.far,y.matrixWorldInverse.fromArray(l.leftViewMatrix),x.matrixWorldInverse.fromArray(l.rightViewMatrix),d.getInverse(p),"stage"===f&&(y.matrixWorldInverse.multiply(d),x.matrixWorldInverse.multiply(d));var a=n.parent;null!==a&&(m.getInverse(a.matrixWorld),y.matrixWorldInverse.multiply(m),x.matrixWorldInverse.multiply(m)),y.matrixWorld.getInverse(y.matrixWorldInverse),x.matrixWorld.getInverse(x.matrixWorldInverse),y.projectionMatrix.fromArray(l.leftProjectionMatrix),x.projectionMatrix.fromArray(l.rightProjectionMatrix),gs(b,y,x);var o=c.getLayers();if(o.length){var s=o[0];null!==s.leftBounds&&4===s.leftBounds.length&&y.bounds.fromArray(s.leftBounds),null!==s.rightBounds&&4===s.rightBounds.length&&x.bounds.fromArray(s.rightBounds)}return function(){for(var e=0;e<u.length;e++){var t=u[e],i=M(e);if(void 0!==i&&void 0!==i.pose){if(null===i.pose)return;var r=i.pose;!1===r.hasPosition&&t.position.set(.2,-.6,-.05),null!==r.position&&t.position.fromArray(r.position),null!==r.orientation&&t.quaternion.fromArray(r.orientation),t.matrix.compose(t.position,t.quaternion,t.scale),t.matrix.premultiply(p),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0,t.visible=!0;var n="Daydream Controller"===i.id?0:1;_[e]!==i.buttons[n].pressed&&(_[e]=i.buttons[n].pressed,!0===_[e]?t.dispatchEvent({type:"selectstart"}):(t.dispatchEvent({type:"selectend"}),t.dispatchEvent({type:"select"})))}else t.visible=!1}}(),b},this.getStandingMatrix=function(){return p},this.isPresenting=w;var E=new er;this.setAnimationLoop=function(e){E.setAnimationLoop(e)},this.submitFrame=function(){w()&&c.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function ys(t){var i=t.context,r=null,p=null,n=1,d=null,a="stage",f=null,m=[],g=[];function o(){return null!==p&&null!==d}var s=new Bo;s.layers.enable(1),s.viewport=new Li;var c=new Bo;c.layers.enable(2),c.viewport=new Li;var v=new zo([s,c]);function l(e){var t=m[g.indexOf(e.inputSource)];t&&t.dispatchEvent({type:e.type})}function h(){t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),x.stop()}function u(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}v.layers.enable(1),v.layers.enable(2),this.enabled=!1,this.getController=function(e){var t=m[e];return void 0===t&&((t=new Uo).matrixAutoUpdate=!1,t.visible=!1,m[e]=t),t},this.getDevice=function(){return r},this.setDevice=function(e){void 0!==e&&(r=e),e instanceof XRDevice&&i.setCompatibleXRDevice(e)},this.setFramebufferScaleFactor=function(e){n=e},this.setFrameOfReferenceType=function(e){a=e},this.setSession=function(e){null!==(p=e)&&(p.addEventListener("select",l),p.addEventListener("selectstart",l),p.addEventListener("selectend",l),p.addEventListener("end",h),p.baseLayer=new XRWebGLLayer(p,i,{framebufferScaleFactor:n}),p.requestFrameOfReference(a).then(function(e){d=e,t.setFramebuffer(p.baseLayer.framebuffer),x.setContext(p),x.start()}),g=p.getInputSources(),p.addEventListener("inputsourceschange",function(){g=p.getInputSources(),console.log(g);for(var e=0;e<m.length;e++){m[e].userData.inputSource=g[e]}}))},this.getCamera=function(e){if(o()){var t=e.parent,i=v.cameras;u(v,t);for(var r=0;r<i.length;r++)u(i[r],t);e.matrixWorld.copy(v.matrixWorld);for(var n=e.children,a=(r=0,n.length);r<a;r++)n[r].updateMatrixWorld(!0);return gs(v,s,c),v}return e},this.isPresenting=o;var y=null;var x=new er;x.setAnimationLoop(function(e,t){if(null!==(f=t.getDevicePose(d)))for(var i=p.baseLayer,r=t.views,n=0;n<r.length;n++){var a=r[n],o=i.getViewport(a),s=f.getViewMatrix(a),c=v.cameras[n];c.matrix.fromArray(s).getInverse(c.matrix),c.projectionMatrix.fromArray(a.projectionMatrix),c.viewport.set(o.x,o.y,o.width,o.height),0===n&&v.matrix.copy(c.matrix)}for(n=0;n<m.length;n++){var l=m[n],h=g[n];if(h){var u=t.getInputPose(h,d);if(null!==u){"targetRay"in u?l.matrix.elements=u.targetRay.transformMatrix:"pointerMatrix"in u&&(l.matrix.elements=u.pointerMatrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.visible=!0;continue}}l.visible=!1}y&&y(e)}),this.setAnimationLoop=function(e){y=e},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new THREE.Matrix4},this.submitFrame=function(){}}function xs(e){console.log("THREE.WebGLRenderer","102");var r=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,n=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",f=null,H=null;this.domElement=r,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=Me,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var k,M,V,j,h,W,u,E,T,m,y,p,d,g,S,L,A,v,X=this,x=!1,b=null,w=null,_=null,q=-1,R={geometry:null,program:null,wireframe:!1},Y=null,P=null,C=new Li,I=new Li,O=null,Z=0,D=r.width,J=r.height,K=1,N=new Li(0,0,D,J),U=new Li(0,0,D,J),F=!1,B=new Fi,Q=new ca,$=!1,ee=!1,z=new jt,te=new Xt;function G(){return null===w?K:1}try{var ie={alpha:i,depth:n,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l};if(r.addEventListener("webglcontextlost",oe,!1),r.addEventListener("webglcontextrestored",se,!1),null===(k=t||r.getContext("webgl",ie)||r.getContext("experimental-webgl",ie)))throw null!==r.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===k.getShaderPrecisionFormat&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function re(){M=new la(k),(V=new sa(k,M,e)).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 No(k,M,V),(j=new Oo(k,M,v,V)).scissor(I.copy(U).multiplyScalar(K)),j.viewport(C.copy(N).multiplyScalar(K)),h=new pa(k),W=new bo,u=new Do(k,M,j,W,V,v,h),E=new tr(k),T=new ha(k,E,h),m=new ma(T,h),S=new fa(k),y=new xo(X,M,V),p=new Eo,d=new Ro,g=new aa(X,j,m,s),L=new oa(k,M,h,V),A=new ua(k,M,h,V),h.programs=y.programs,X.context=k,X.capabilities=V,X.extensions=M,X.properties=W,X.renderLists=p,X.state=j,X.info=h}re();var ne=null;"undefined"!=typeof navigator&&(ne="xr"in navigator?new ys(X):new vs(X)),this.vr=ne;var ae=new Io(X,m,V.maxTextureSize);function oe(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function se(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1,re()}function ce(e){var t,i=e.target;i.removeEventListener("dispose",ce),le(t=i),W.remove(t)}function le(e){var t=W.get(e).program;(e.program=void 0)!==t&&y.releaseProgram(t)}this.shadowMap=ae,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){var e=M.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=M.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return K},this.setPixelRatio=function(e){void 0!==e&&(K=e,this.setSize(D,J,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new Vt),e.set(D,J)},this.setSize=function(e,t,i){ne.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(D=e,J=t,r.width=e*K,r.height=t*K,!1!==i&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new Vt),e.set(D*K,J*K)},this.setDrawingBufferSize=function(e,t,i){D=e,J=t,K=i,r.width=e*i,r.height=t*i,this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Li),e.copy(C)},this.getViewport=function(e){return e.copy(N)},this.setViewport=function(e,t,i,r){e.isVector4?N.set(e.x,e.y,e.z,e.w):N.set(e,t,i,r),j.viewport(C.copy(N).multiplyScalar(K))},this.getScissor=function(e){return e.copy(U)},this.setScissor=function(e,t,i,r){e.isVector4?U.set(e.x,e.y,e.z,e.w):U.set(e,t,i,r),j.scissor(I.copy(U).multiplyScalar(K))},this.getScissorTest=function(){return F},this.setScissorTest=function(e){j.setScissorTest(F=e)},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(e,t,i){var r=0;void 0!==e&&!e||(r|=16384),void 0!==t&&!t||(r|=256),void 0!==i&&!i||(r|=1024),k.clear(r)},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.dispose=function(){r.removeEventListener("webglcontextlost",oe,!1),r.removeEventListener("webglcontextrestored",se,!1),p.dispose(),d.dispose(),W.dispose(),m.dispose(),ne.dispose(),fe.stop()},this.renderBufferImmediate=function(e,t){j.initAttributes();var i=W.get(e);e.hasPositions&&!i.position&&(i.position=k.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=k.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=k.createBuffer()),e.hasColors&&!i.color&&(i.color=k.createBuffer());var r=t.getAttributes();e.hasPositions&&(k.bindBuffer(34962,i.position),k.bufferData(34962,e.positionArray,35048),j.enableAttribute(r.position),k.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(k.bindBuffer(34962,i.normal),k.bufferData(34962,e.normalArray,35048),j.enableAttribute(r.normal),k.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(k.bindBuffer(34962,i.uv),k.bufferData(34962,e.uvArray,35048),j.enableAttribute(r.uv),k.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(k.bindBuffer(34962,i.color),k.bufferData(34962,e.colorArray,35048),j.enableAttribute(r.color),k.vertexAttribPointer(r.color,3,5126,!1,0,0)),j.disableUnusedAttributes(),k.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,i,r,n,a){var o=n.isMesh&&n.matrixWorld.determinant()<0;j.setMaterial(r,o);var s=ye(e,t,r,n),c=!1;R.geometry===i.id&&R.program===s.id&&R.wireframe===(!0===r.wireframe)||(R.geometry=i.id,R.program=s.id,R.wireframe=!0===r.wireframe,c=!0),n.morphTargetInfluences&&(S.update(n,i,r,s),c=!0);var l,h=i.index,u=i.attributes.position,p=1;!0===r.wireframe&&(h=T.getWireframeAttribute(i),p=2);var d=L;null!==h&&(l=E.get(h),(d=A).setIndex(l)),c&&(function(e,t,i){if(i&&i.isInstancedBufferGeometry&&!V.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 r=i.attributes,n=t.getAttributes(),a=e.defaultAttributeValues;for(var o in n){var s=n[o];if(0<=s){var c=r[o];if(void 0!==c){var l=c.normalized,h=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===i.maxInstancedCount&&(i.maxInstancedCount=m.meshPerAttribute*m.count)):j.enableAttribute(s),k.bindBuffer(34962,p),k.vertexAttribPointer(s,h,d,l,g*f,v*f)}else c.isInstancedBufferAttribute?(j.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=c.meshPerAttribute*c.count)):j.enableAttribute(s),k.bindBuffer(34962,p),k.vertexAttribPointer(s,h,d,l,0,0)}else if(void 0!==a){var y=a[o];if(void 0!==y)switch(y.length){case 2:k.vertexAttrib2fv(s,y);break;case 3:k.vertexAttrib3fv(s,y);break;case 4:k.vertexAttrib4fv(s,y);break;default:k.vertexAttrib1fv(s,y)}}}}j.disableUnusedAttributes()}(r,s,i),null!==h&&k.bindBuffer(34963,l.buffer));var f=1/0;null!==h?f=h.count:void 0!==u&&(f=u.count);var m=i.drawRange.start*p,g=i.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(n.isMesh)if(!0===r.wireframe)j.setLineWidth(r.wireframeLinewidth*G()),d.setMode(1);else switch(n.drawMode){case Pt:d.setMode(4);break;case 1:d.setMode(5);break;case 2:d.setMode(6)}else if(n.isLine){var _=r.linewidth;void 0===_&&(_=1),j.setLineWidth(_*G()),n.isLineSegments?d.setMode(1):n.isLineLoop?d.setMode(2):d.setMode(3)}else n.isPoints?d.setMode(0):n.isSprite&&d.setMode(4);i&&i.isInstancedBufferGeometry?0<i.maxInstancedCount&&d.renderInstances(i,x,w):d.render(x,w)}},this.compile=function(i,e){(H=d.get(i,e)).init(),i.traverse(function(e){e.isLight&&(H.pushLight(e),e.castShadow&&H.pushShadow(e))}),H.setupLights(e),i.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var t=0;t<e.material.length;t++)ve(e.material[t],i.fog,e);else ve(e.material,i.fog,e)})};var he=null;var ue,pe,de,fe=new er;function me(e,t,i,r){for(var n=0,a=e.length;n<a;n++){var o=e[n],s=o.object,c=o.geometry,l=void 0===r?o.material:r,h=o.group;if(i.isArrayCamera)for(var u=(P=i).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(C.copy(f.viewport));else{var m=f.bounds,g=m.x*D,v=m.y*J,y=m.z*D,x=m.w*J;j.viewport(C.set(g,v,y,x).multiplyScalar(K))}H.setupLights(f),ge(s,t,f,c,l,h)}}else P=null,ge(s,t,i,c,l,h)}}function ge(e,t,i,r,n,a){if(e.onBeforeRender(X,t,i,r,n,a),H=d.get(t,P||i),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){j.setMaterial(n);var o=ye(i,t.fog,n,e);R.geometry=null,R.program=null,R.wireframe=!1,s=o,e.render(function(e){X.renderBufferImmediate(e,s)})}else X.renderBufferDirect(i,t.fog,r,n,e,a);var s;e.onAfterRender(X,t,i,r,n,a),H=d.get(t,P||i)}function ve(e,t,i){var r=W.get(e),n=H.state.lights,a=H.state.shadowsArray,o=r.lightsHash,s=n.state.hash,c=y.getParameters(e,n.state,a,t,Q.numPlanes,Q.numIntersection,i),l=y.getProgramCode(e,c),h=r.program,u=!0;if(void 0===h)e.addEventListener("dispose",ce);else if(h.code!==l)le(e);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=$i[c.shaderID];r.shader={name:e.type,uniforms:zi(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}}else r.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.onBeforeCompile(r.shader,X),l=y.getProgramCode(e,c),h=y.acquireProgram(e,r.shader,c,l),r.program=h,e.program=h}var d=h.getAttributes();if(e.morphTargets)for(var f=e.numSupportedMorphTargets=0;f<X.maxMorphTargets;f++)0<=d["morphTarget"+f]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(f=e.numSupportedMorphNormals=0;f<X.maxMorphNormals;f++)0<=d["morphNormal"+f]&&e.numSupportedMorphNormals++;var m=r.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=Q.numPlanes,r.numIntersection=Q.numIntersection,m.clippingPlanes=Q.uniform),r.fog=t,void 0===o&&(r.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,e.lights&&(m.ambientLightColor.value=n.state.ambient,m.directionalLights.value=n.state.directional,m.spotLights.value=n.state.spot,m.rectAreaLights.value=n.state.rectArea,m.pointLights.value=n.state.point,m.hemisphereLights.value=n.state.hemi,m.directionalShadowMap.value=n.state.directionalShadowMap,m.directionalShadowMatrix.value=n.state.directionalShadowMatrix,m.spotShadowMap.value=n.state.spotShadowMap,m.spotShadowMatrix.value=n.state.spotShadowMatrix,m.pointShadowMap.value=n.state.pointShadowMap,m.pointShadowMatrix.value=n.state.pointShadowMatrix);var g=r.program.getUniforms(),v=so.seqWithValue(g.seq,m);r.uniformsList=v}function ye(e,t,i,r){Z=0;var n=W.get(i),a=H.state.lights,o=n.lightsHash,s=a.state.hash;if($&&(ee||e!==Y)){var c=e===Y&&i.id===q;Q.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,e,n,c)}!1===i.needsUpdate&&(void 0===n.program?i.needsUpdate=!0:i.fog&&n.fog!==t?i.needsUpdate=!0:(!i.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===n.numClippingPlanes||n.numClippingPlanes===Q.numPlanes&&n.numIntersection===Q.numIntersection)||(i.needsUpdate=!0)),i.needsUpdate&&(ve(i,t,r),i.needsUpdate=!1);var l,h,u,p,d,f,m,g,v,y,x,b,w,_,M,E,T,S,L,A,R=!1,P=!1,C=!1,I=n.program,O=I.getUniforms(),D=n.shader.uniforms;if(j.useProgram(I.program)&&(C=P=R=!0),i.id!==q&&(q=i.id,P=!0),R||Y!==e){if(O.setValue(k,"projectionMatrix",e.projectionMatrix),V.logarithmicDepthBuffer&&O.setValue(k,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),Y!==e&&(Y=e,C=P=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var N=O.map.cameraPosition;void 0!==N&&N.setValue(k,te.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&O.setValue(k,"viewMatrix",e.matrixWorldInverse)}if(i.skinning){O.setOptional(k,r,"bindMatrix"),O.setOptional(k,r,"bindMatrixInverse");var U=r.skeleton;if(U){var F=U.bones;if(V.floatVertexTextures){if(void 0===U.boneTexture){var B=Math.sqrt(4*F.length);B=kt.ceilPowerOfTwo(B),B=Math.max(B,4);var z=new Float32Array(B*B*4);z.set(U.boneMatrices);var G=new Ci(z,B,B,Ze,He);G.needsUpdate=!0,U.boneMatrices=z,U.boneTexture=G,U.boneTextureSize=B}O.setValue(k,"boneTexture",U.boneTexture),O.setValue(k,"boneTextureSize",U.boneTextureSize)}else O.setOptional(k,U,"boneMatrices")}}return P&&(O.setValue(k,"toneMappingExposure",X.toneMappingExposure),O.setValue(k,"toneMappingWhitePoint",X.toneMappingWhitePoint),i.lights&&(A=C,(L=D).ambientLightColor.needsUpdate=A,L.directionalLights.needsUpdate=A,L.pointLights.needsUpdate=A,L.spotLights.needsUpdate=A,L.rectAreaLights.needsUpdate=A,L.hemisphereLights.needsUpdate=A),t&&i.fog&&(S=t,(T=D).fogColor.value=S.color,S.isFog?(T.fogNear.value=S.near,T.fogFar.value=S.far):S.isFogExp2&&(T.fogDensity.value=S.density)),i.isMeshBasicMaterial?xe(D,i):i.isMeshLambertMaterial?(xe(D,i),M=D,(E=i).emissiveMap&&(M.emissiveMap.value=E.emissiveMap)):i.isMeshPhongMaterial?(xe(D,i),i.isMeshToonMaterial?(be(w=D,_=i),_.gradientMap&&(w.gradientMap.value=_.gradientMap)):be(D,i)):i.isMeshStandardMaterial?(xe(D,i),i.isMeshPhysicalMaterial?(we(x=D,b=i),x.reflectivity.value=b.reflectivity,x.clearCoat.value=b.clearCoat,x.clearCoatRoughness.value=b.clearCoatRoughness):we(D,i)):i.isMeshMatcapMaterial?(xe(D,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===_e&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===_e&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(D,i)):i.isMeshDepthMaterial?(xe(D,i),v=D,(y=i).displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias)):i.isMeshDistanceMaterial?(xe(D,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(D,i)):i.isMeshNormalMaterial?(xe(D,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===_e&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===_e&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(D,i)):i.isLineBasicMaterial?(g=i,(m=D).diffuse.value=g.color,m.opacity.value=g.opacity,i.isLineDashedMaterial&&(f=i,(d=D).dashSize.value=f.dashSize,d.totalSize.value=f.dashSize+f.gapSize,d.scale.value=f.scale)):i.isPointsMaterial?(p=i,(u=D).diffuse.value=p.color,u.opacity.value=p.opacity,u.size.value=p.size*K,u.scale.value=.5*J,u.map.value=p.map,null!==p.map&&(!0===p.map.matrixAutoUpdate&&p.map.updateMatrix(),u.uvTransform.value.copy(p.map.matrix))):i.isSpriteMaterial?(h=i,(l=D).diffuse.value=h.color,l.opacity.value=h.opacity,l.rotation.value=h.rotation,l.map.value=h.map,null!==h.map&&(!0===h.map.matrixAutoUpdate&&h.map.updateMatrix(),l.uvTransform.value.copy(h.map.matrix))):i.isShadowMaterial&&(D.color.value=i.color,D.opacity.value=i.opacity),void 0!==D.ltc_1&&(D.ltc_1.value=Qi.LTC_1),void 0!==D.ltc_2&&(D.ltc_2.value=Qi.LTC_2),so.upload(k,n.uniformsList,D,X)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(so.upload(k,n.uniformsList,D,X),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&O.setValue(k,"center",r.center),O.setValue(k,"modelViewMatrix",r.modelViewMatrix),O.setValue(k,"normalMatrix",r.normalMatrix),O.setValue(k,"modelMatrix",r.matrixWorld),I}function xe(e,t){var i;e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=W.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}function be(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===_e&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===_e&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function we(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===_e&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===_e&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}fe.setAnimationLoop(function(e){ne.isPresenting()||he&&he(e)}),"undefined"!=typeof window&&fe.setContext(window),this.setAnimationLoop=function(e){he=e,ne.setAnimationLoop(e),fe.start()},this.render=function(e,t){var i,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),i=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),t&&t.isCamera){if(!x){R.geometry=null,R.program=null,R.wireframe=!1,q=-1,!(Y=null)===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ne.enabled&&(t=ne.getCamera(t)),(H=d.get(e,t)).init(),e.onBeforeRender(X,e,t,i||w),z.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),B.setFromMatrix(z),ee=this.localClippingEnabled,$=Q.init(this.clippingPlanes,ee,t),(f=p.get(e,t)).init(),function e(t,i,r,n){if(!1===t.visible)return;var a=t.layers.test(i.layers);if(a)if(t.isGroup)r=t.renderOrder;else if(t.isLight)H.pushLight(t),t.castShadow&&H.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||B.intersectsSprite(t)){n&&te.setFromMatrixPosition(t.matrixWorld).applyMatrix4(z);var o=m.update(t),s=t.material;f.push(t,o,s,r,te.z,null)}}else if(t.isImmediateRenderObject)n&&te.setFromMatrixPosition(t.matrixWorld).applyMatrix4(z),f.push(t,null,t.material,r,te.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||B.intersectsObject(t))){n&&te.setFromMatrixPosition(t.matrixWorld).applyMatrix4(z);var o=m.update(t),s=t.material;if(Array.isArray(s))for(var c=o.groups,l=0,h=c.length;l<h;l++){var u=c[l],p=s[u.materialIndex];p&&p.visible&&f.push(t,o,p,r,te.z,u)}else s.visible&&f.push(t,o,s,r,te.z,null)}var d=t.children;for(var l=0,h=d.length;l<h;l++)e(d[l],i,r,n)}(e,t,0,X.sortObjects),!0===X.sortObjects&&f.sort(),$&&Q.beginShadows();var n=H.state.shadowsArray;ae.render(n,e,t),H.setupLights(t),$&&Q.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),g.render(f,e,t,r);var a=f.opaque,o=f.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&me(a,e,t,s),o.length&&me(o,e,t,s)}else a.length&&me(a,e,t),o.length&&me(o,e,t);null!==w&&(u.updateRenderTargetMipmap(w),u.updateMultisampleRenderTarget(w)),j.buffers.depth.setTest(!0),j.buffers.depth.setMask(!0),j.buffers.color.setMask(!0),j.setPolygonOffset(!1),e.onAfterRender(X,e,t),ne.enabled&&ne.submitFrame(),H=f=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.allocTextureUnit=function(){var e=Z;return e>=V.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+V.maxTextures),Z+=1,e},this.setTexture2D=(ue=!1,function(e,t){e&&e.isWebGLRenderTarget&&(ue||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),ue=!0),e=e.texture),u.setTexture2D(e,t)}),this.setTexture3D=function(e,t){u.setTexture3D(e,t)},this.setTexture=(pe=!1,function(e,t){pe||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),pe=!0),u.setTexture2D(e,t)}),this.setTextureCube=(de=!1,function(e,t){e&&e.isWebGLRenderTargetCube&&(de||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),de=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?u.setTextureCube(e,t):u.setTextureCubeDynamic(e,t)}),this.setFramebuffer=function(e){b=e},this.getRenderTarget=function(){return w},this.setRenderTarget=function(e,t,i){(w=e)&&void 0===W.get(e).__webglFramebuffer&&u.setupRenderTarget(e);var r=b,n=!1;if(e){var a=W.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(r=a[t||0],n=!0):r=e.isWebGLMultisampleRenderTarget?W.get(e).__webglMultisampledFramebuffer:a,C.copy(e.viewport),I.copy(e.scissor),O=e.scissorTest}else C.copy(N).multiplyScalar(K),I.copy(U).multiplyScalar(K),O=F;if(_!==r&&(k.bindFramebuffer(36160,r),_=r),j.viewport(C),j.scissor(I),j.setScissorTest(O),n){var o=W.get(e.texture);k.framebufferTexture2D(36160,36064,34069+t||0,o.__webglTexture,i||0)}},this.readRenderTargetPixels=function(e,t,i,r,n,a){if(e&&e.isWebGLRenderTarget){var o=W.get(e).__webglFramebuffer;if(o){var s=!1;o!==_&&(k.bindFramebuffer(36160,o),s=!0);try{var c=e.texture,l=c.format,h=c.type;if(l!==Ze&&v.convert(l)!==k.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Ne||v.convert(h)===k.getParameter(35738)||h===He&&(V.isWebGL2||M.get("OES_texture_float")||M.get("WEBGL_color_buffer_float"))||h===ke&&(V.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.");36053===k.checkFramebufferStatus(36160)?0<=t&&t<=e.width-r&&0<=i&&i<=e.height-n&&k.readPixels(t,i,r,n,v.convert(l),v.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&k.bindFramebuffer(36160,_)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,i){var r=t.image.width,n=t.image.height,a=v.convert(t.format);this.setTexture2D(t,0),k.copyTexImage2D(3553,i||0,a,e.x,e.y,r,n,0)},this.copyTextureToTexture=function(e,t,i,r){var n=t.image.width,a=t.image.height,o=v.convert(i.format),s=v.convert(i.type);this.setTexture2D(i,0),t.isDataTexture?k.texSubImage2D(3553,r||0,e.x,e.y,n,a,o,s,t.image.data):k.texSubImage2D(3553,r||0,e.x,e.y,o,s,t.image)}}function bs(e,t){this.name="",this.color=new Xi(e),this.density=void 0!==t?t:25e-5}function ws(e,t,i){this.name="",this.color=new Xi(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function _s(){Er.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Ms(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Es(e,t,i,r){this.data=e,this.itemSize=t,this.offset=i,this.normalized=!0===r}function Ts(e){hn.call(this),this.type="SpriteMaterial",this.color=new Xi(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}function Ss(e){if(Er.call(this),this.type="Sprite",void 0===Go){Go=new nn;var t=new Ms(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Go.setIndex([0,1,2,0,2,3]),Go.addAttribute("position",new Es(t,3,0,!1)),Go.addAttribute("uv",new Es(t,2,3,!1))}this.geometry=Go,this.material=void 0!==e?e:new Ts,this.center=new Vt(.5,.5)}function Ls(e,t,i,r,n,a){jo.subVectors(e,i).addScalar(.5).multiply(r),void 0!==n?(Wo.x=a*jo.x-n*jo.y,Wo.y=n*jo.x+a*jo.y):Wo.copy(jo),e.copy(t),e.x+=Wo.x,e.y+=Wo.y,e.applyMatrix4(Xo)}function As(){Er.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Rs(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ia.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new jt,this.bindMatrixInverse=new jt}function Ps(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new jt)}}function Cs(){Er.call(this),this.type="Bone"}function Is(e){hn.call(this),this.type="LineBasicMaterial",this.color=new Xi(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function Os(e,t,i){1===i&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),Er.call(this),this.type="Line",this.geometry=void 0!==e?e:new nn,this.material=void 0!==t?t:new Is({color:16777215*Math.random()})}function Ds(e,t){Os.call(this,e,t),this.type="LineSegments"}function Ns(e,t){Os.call(this,e,t),this.type="LineLoop"}function Us(e){hn.call(this),this.type="PointsMaterial",this.color=new Xi(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function Fs(e,t){Er.call(this),this.type="Points",this.geometry=void 0!==e?e:new nn,this.material=void 0!==t?t:new Us({color:16777215*Math.random()})}function Bs(e,t,i,r,n,a,o,s,c){Si.call(this,e,t,i,r,n,a,o,s,c),this.format=void 0!==o?o:Ye,this.minFilter=void 0!==a?a:Ie,this.magFilter=void 0!==n?n:Ie,this.generateMipmaps=!1}function zs(e,t,i,r,n,a,o,s,c,l,h,u){Si.call(this,null,a,o,s,c,l,r,n,h,u),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Gs(e,t,i,r,n,a,o,s,c){Si.call(this,e,t,i,r,n,a,o,s,c),this.needsUpdate=!0}function Hs(e,t,i,r,n,a,o,s,c,l){if((l=void 0!==l?l:$e)!==$e&&l!==et)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&l===$e&&(i=Be),void 0===i&&l===et&&(i=Xe),Si.call(this,null,r,n,a,o,s,l,i,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:Re,this.minFilter=void 0!==s?s:Re,this.flipY=!1,this.generateMipmaps=!1}function ks(e){nn.call(this),this.type="WireframeGeometry";var t,i,r,n,a,o,s,c,l,h,u=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,r=m.length;t<r;t++){var g=m[t];for(i=0;i<3;i++)s=g[f[i]],c=g[f[(i+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[l=p[0]+","+p[1]]&&(d[l]={index1:p[0],index2:p[1]})}for(l in d)o=d[l],h=e.vertices[o.index1],u.push(h.x,h.y,h.z),h=e.vertices[o.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var v,y,x,b,w,_;if(h=new Xt,null!==e.index){for(v=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),n=0,a=x.length;n<a;++n)for(r=(t=(b=x[n]).start)+b.count;t<r;t+=3)for(i=0;i<3;i++)s=y.getX(t+i),c=y.getX(t+(i+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[l=p[0]+","+p[1]]&&(d[l]={index1:p[0],index2:p[1]});for(l in d)o=d[l],h.fromBufferAttribute(v,o.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(v,o.index2),u.push(h.x,h.y,h.z)}else for(t=0,r=(v=e.attributes.position).count/3;t<r;t++)for(i=0;i<3;i++)w=3*t+i,h.fromBufferAttribute(v,w),u.push(h.x,h.y,h.z),_=3*t+(i+1)%3,h.fromBufferAttribute(v,_),u.push(h.x,h.y,h.z)}this.addAttribute("position",new kr(u,3))}function Vs(e,t,i){Or.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:i},this.fromBufferGeometry(new js(e,t,i)),this.mergeVertices()}function js(e,t,i){nn.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:i};var r,n,a=[],o=[],s=[],c=[],l=new Xt,h=new Xt,u=new Xt,p=new Xt,d=new Xt;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=t+1;for(r=0;r<=i;r++){var m=r/i;for(n=0;n<=t;n++){var g=n/t;e(g,m,h),o.push(h.x,h.y,h.z),0<=g-1e-5?(e(g-1e-5,m,u),p.subVectors(h,u)):(e(1e-5+g,m,u),p.subVectors(u,h)),0<=m-1e-5?(e(g,m-1e-5,u),d.subVectors(h,u)):(e(g,1e-5+m,u),d.subVectors(u,h)),l.crossVectors(p,d).normalize(),s.push(l.x,l.y,l.z),c.push(g,m)}}for(r=0;r<i;r++)for(n=0;n<t;n++){var v=r*f+n,y=r*f+n+1,x=(r+1)*f+n+1,b=(r+1)*f+n;a.push(v,y,b),a.push(y,x,b)}this.setIndex(a),this.addAttribute("position",new kr(o,3)),this.addAttribute("normal",new kr(s,3)),this.addAttribute("uv",new kr(c,2))}function Ws(e,t,i,r){Or.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r},this.fromBufferGeometry(new Xs(e,t,i,r)),this.mergeVertices()}function Xs(r,a,e,t){nn.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:r,indices:a,radius:e,detail:t},e=e||1;var h=[],u=[];function o(e,t,i,r){var n,a,o=Math.pow(2,r),s=[];for(n=0;n<=o;n++){s[n]=[];var c=e.clone().lerp(i,n/o),l=t.clone().lerp(i,n/o),h=o-n;for(a=0;a<=h;a++)s[n][a]=0===a&&n===o?c:c.clone().lerp(l,a/h)}for(n=0;n<o;n++)for(a=0;a<2*(o-n)-1;a++){var u=Math.floor(a/2);a%2==0?(p(s[n][u+1]),p(s[n+1][u]),p(s[n][u])):(p(s[n][u+1]),p(s[n+1][u+1]),p(s[n+1][u]))}}function p(e){h.push(e.x,e.y,e.z)}function s(e,t){var i=3*e;t.x=r[0+i],t.y=r[1+i],t.z=r[2+i]}function d(e,t,i,r){r<0&&1===e.x&&(u[t]=e.x-1),0===i.x&&0===i.z&&(u[t]=r/2/Math.PI+.5)}function f(e){return Math.atan2(e.z,-e.x)}!function(e){for(var t=new Xt,i=new Xt,r=new Xt,n=0;n<a.length;n+=3)s(a[n+0],t),s(a[n+1],i),s(a[n+2],r),o(t,i,r,e)}(t=t||0),function(e){for(var t=new Xt,i=0;i<h.length;i+=3)t.x=h[i+0],t.y=h[i+1],t.z=h[i+2],t.normalize().multiplyScalar(e),h[i+0]=t.x,h[i+1]=t.y,h[i+2]=t.z}(e),function(){for(var e=new Xt,t=0;t<h.length;t+=3){e.x=h[t+0],e.y=h[t+1],e.z=h[t+2];var i=f(e)/2/Math.PI+.5,r=(n=e,Math.atan2(-n.y,Math.sqrt(n.x*n.x+n.z*n.z))/Math.PI+.5);u.push(i,1-r)}var n;(function(){for(var e=new Xt,t=new Xt,i=new Xt,r=new Xt,n=new Vt,a=new Vt,o=new Vt,s=0,c=0;s<h.length;s+=9,c+=6){e.set(h[s+0],h[s+1],h[s+2]),t.set(h[s+3],h[s+4],h[s+5]),i.set(h[s+6],h[s+7],h[s+8]),n.set(u[c+0],u[c+1]),a.set(u[c+2],u[c+3]),o.set(u[c+4],u[c+5]),r.copy(e).add(t).add(i).divideScalar(3);var l=f(r);d(n,c+0,e,l),d(a,c+2,t,l),d(o,c+4,i,l)}})(),function(){for(var e=0;e<u.length;e+=6){var t=u[e+0],i=u[e+2],r=u[e+4],n=Math.max(t,i,r),a=Math.min(t,i,r);.9<n&&a<.1&&(t<.2&&(u[e+0]+=1),i<.2&&(u[e+2]+=1),r<.2&&(u[e+4]+=1))}}()}(),this.addAttribute("position",new kr(h,3)),this.addAttribute("normal",new kr(h.slice(),3)),this.addAttribute("uv",new kr(u,2)),0===t?this.computeVertexNormals():this.normalizeNormals()}function qs(e,t){Or.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ys(e,t)),this.mergeVertices()}function Ys(e,t){Xs.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Zs(e,t){Or.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Js(e,t)),this.mergeVertices()}function Js(e,t){Xs.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ks(e,t){Or.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Qs(e,t)),this.mergeVertices()}function Qs(e,t){var i=(1+Math.sqrt(5))/2;Xs.call(this,[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function $s(e,t){Or.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ec(e,t)),this.mergeVertices()}function ec(e,t){var i=(1+Math.sqrt(5))/2,r=1/i;Xs.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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function tc(e,t,i,r,n,a){Or.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:n},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new ic(e,t,i,r,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function ic(o,s,c,l,e){nn.call(this),this.type="TubeBufferGeometry",this.parameters={path:o,tubularSegments:s,radius:c,radialSegments:l,closed:e},s=s||64,c=c||1,l=l||8,e=e||!1;var h=o.computeFrenetFrames(s,e);this.tangents=h.tangents,this.normals=h.normals,this.binormals=h.binormals;var n,u,p=new Xt,d=new Xt,t=new Vt,f=new Xt,m=[],g=[],i=[],a=[];function r(e){f=o.getPointAt(e/s,f);var t=h.normals[e],i=h.binormals[e];for(u=0;u<=l;u++){var r=u/l*Math.PI*2,n=Math.sin(r),a=-Math.cos(r);d.x=a*t.x+n*i.x,d.y=a*t.y+n*i.y,d.z=a*t.z+n*i.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(n=0;n<s;n++)r(n);r(!1===e?s:0),function(){for(n=0;n<=s;n++)for(u=0;u<=l;u++)t.x=n/s,t.y=u/l,i.push(t.x,t.y)}(),function(){for(u=1;u<=s;u++)for(n=1;n<=l;n++){var e=(l+1)*(u-1)+(n-1),t=(l+1)*u+(n-1),i=(l+1)*u+n,r=(l+1)*(u-1)+n;a.push(e,t,r),a.push(t,i,r)}}()}(),this.setIndex(a),this.addAttribute("position",new kr(m,3)),this.addAttribute("normal",new kr(g,3)),this.addAttribute("uv",new kr(i,2))}function rc(e,t,i,r,n,a,o){Or.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:n,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new nc(e,t,i,r,n,a)),this.mergeVertices()}function nc(e,t,i,r,n,a){nn.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:n,q:a},e=e||1,t=t||.4,i=Math.floor(i)||64,r=Math.floor(r)||8,n=n||2,a=a||3;var o,s,c=[],l=[],h=[],u=[],p=new Xt,d=new Xt,f=new Xt,m=new Xt,g=new Xt,v=new Xt,y=new Xt;for(o=0;o<=i;++o){var x=o/i*n*Math.PI*2;for(L(x,n,a,e,f),L(.01+x,n,a,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=r;++s){var b=s/r*Math.PI*2,w=-t*Math.cos(b),_=t*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),l.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),h.push(d.x,d.y,d.z),u.push(o/i),u.push(s/r)}}for(s=1;s<=i;s++)for(o=1;o<=r;o++){var M=(r+1)*(s-1)+(o-1),E=(r+1)*s+(o-1),T=(r+1)*s+o,S=(r+1)*(s-1)+o;c.push(M,E,S),c.push(E,T,S)}function L(e,t,i,r,n){var a=Math.cos(e),o=Math.sin(e),s=i/t*e,c=Math.cos(s);n.x=r*(2+c)*.5*a,n.y=r*(2+c)*o*.5,n.z=r*Math.sin(s)*.5}this.setIndex(c),this.addAttribute("position",new kr(l,3)),this.addAttribute("normal",new kr(h,3)),this.addAttribute("uv",new kr(u,2))}function ac(e,t,i,r,n){Or.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:n},this.fromBufferGeometry(new oc(e,t,i,r,n)),this.mergeVertices()}function oc(e,t,i,r,n){nn.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:n},e=e||1,t=t||.4,i=Math.floor(i)||8,r=Math.floor(r)||6,n=n||2*Math.PI;var a,o,s=[],c=[],l=[],h=[],u=new Xt,p=new Xt,d=new Xt;for(a=0;a<=i;a++)for(o=0;o<=r;o++){var f=o/r*n,m=a/i*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(f),p.y=(e+t*Math.cos(m))*Math.sin(f),p.z=t*Math.sin(m),c.push(p.x,p.y,p.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),d.subVectors(p,u).normalize(),l.push(d.x,d.y,d.z),h.push(o/r),h.push(a/i)}for(a=1;a<=i;a++)for(o=1;o<=r;o++){var g=(r+1)*a+o-1,v=(r+1)*(a-1)+o-1,y=(r+1)*(a-1)+o,x=(r+1)*a+o;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.addAttribute("position",new kr(c,3)),this.addAttribute("normal",new kr(l,3)),this.addAttribute("uv",new kr(h,2))}Object.assign(bs.prototype,{isFogExp2:!0,clone:function(){return new bs(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(ws.prototype,{isFog:!0,clone:function(){return new ws(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),_s.prototype=Object.assign(Object.create(Er.prototype),{constructor:_s,isScene:!0,copy:function(e,t){return Er.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=Er.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Ms.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Ms.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.stride:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.stride,i*=t.stride;for(var r=0,n=this.stride;r<n;r++)this.array[e+r]=t.array[i+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Object.defineProperties(Es.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Es.prototype,{isInterleavedBufferAttribute:!0,setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this},setXYZ:function(e,t,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this},setXYZW:function(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}}),((Ts.prototype=Object.create(hn.prototype)).constructor=Ts).prototype.isSpriteMaterial=!0,Ts.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},Ss.prototype=Object.assign(Object.create(Er.prototype),{constructor:Ss,isSprite:!0,raycast:(Ho=new Xt,ko=new Xt,Vo=new Xt,jo=new Vt,Wo=new Vt,Xo=new jt,qo=new Xt,Yo=new Xt,Zo=new Xt,Jo=new Vt,Ko=new Vt,Qo=new Vt,function(e,t){ko.setFromMatrixScale(this.matrixWorld),Xo.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),Vo.setFromMatrixPosition(this.modelViewMatrix);var i,r,n=this.material.rotation;0!==n&&(r=Math.cos(n),i=Math.sin(n));var a=this.center;Ls(qo.set(-.5,-.5,0),Vo,a,ko,i,r),Ls(Yo.set(.5,-.5,0),Vo,a,ko,i,r),Ls(Zo.set(.5,.5,0),Vo,a,ko,i,r),Jo.set(0,0),Ko.set(1,0),Qo.set(1,1);var o=e.ray.intersectTriangle(qo,Yo,Zo,!1,Ho);if(null!==o||(Ls(Yo.set(-.5,.5,0),Vo,a,ko,i,r),Ko.set(0,1),null!==(o=e.ray.intersectTriangle(qo,Zo,Yo,!1,Ho)))){var s=e.ray.origin.distanceTo(Ho);s<e.near||s>e.far||t.push({distance:s,point:Ho.clone(),uv:ea.getUV(Ho,qo,Yo,Zo,Jo,Ko,Qo,new Vt),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Er.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),As.prototype=Object.assign(Object.create(Er.prototype),{constructor:As,copy:function(e){Er.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,r=t.length;i<r;i++){var n=t[i];this.addLevel(n.object.clone(),n.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=this.levels,r=0;r<i.length&&!(t<i[r].distance);r++);i.splice(r,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,i=1,r=t.length;i<r&&!(e<t[i].distance);i++);return t[i-1].object},raycast:(ts=new Xt,function(e,t){ts.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(ts);this.getObjectForDistance(i).raycast(e,t)}),update:($o=new Xt,es=new Xt,function(e){var t=this.levels;if(1<t.length){$o.setFromMatrixPosition(e.matrixWorld),es.setFromMatrixPosition(this.matrixWorld);var i=$o.distanceTo(es);t[0].object.visible=!0;for(var r=1,n=t.length;r<n&&i>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(;r<n;r++)t[r].object.visible=!1}}),toJSON:function(e){var t=Er.prototype.toJSON.call(this,e);t.object.levels=[];for(var i=this.levels,r=0,n=i.length;r<n;r++){var a=i[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Rs.prototype=Object.assign(Object.create(ia.prototype),{constructor:Rs,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Li,t=this.geometry.attributes.skinWeight,i=0,r=t.count;i<r;i++){e.x=t.getX(i),e.y=t.getY(i),e.z=t.getZ(i),e.w=t.getW(i);var n=1/e.manhattanLength();n!=1/0?e.multiplyScalar(n):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){ia.prototype.updateMatrixWorld.call(this,e),"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)}}),Object.assign(Ps.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var i=new jt;this.bones[e]&&i.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(i)}},pose:function(){var e,t,i;for(t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:(is=new jt,rs=new jt,function(){for(var e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture,n=0,a=e.length;n<a;n++){var o=e[n]?e[n].matrixWorld:rs;is.multiplyMatrices(o,t[n]),is.toArray(i,16*n)}void 0!==r&&(r.needsUpdate=!0)}),clone:function(){return new Ps(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,i=this.bones.length;t<i;t++){var r=this.bones[t];if(r.name===e)return r}}}),Cs.prototype=Object.assign(Object.create(Er.prototype),{constructor:Cs,isBone:!0}),((Is.prototype=Object.create(hn.prototype)).constructor=Is).prototype.isLineBasicMaterial=!0,Is.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},Os.prototype=Object.assign(Object.create(Er.prototype),{constructor:Os,isLine:!0,computeLineDistances:(ss=new Xt,cs=new Xt,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,i=[0],r=1,n=t.count;r<n;r++)ss.fromBufferAttribute(t,r-1),cs.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=ss.distanceTo(cs);e.addAttribute("lineDistance",new kr(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for((i=e.lineDistances)[0]=0,r=1,n=a.length;r<n;r++)i[r]=i[r-1],i[r]+=a[r-1].distanceTo(a[r])}return this}),raycast:(ns=new jt,as=new $n,os=new Ni,function(e,t){var i=e.linePrecision,r=this.geometry,n=this.matrixWorld;if(null===r.boundingSphere&&r.computeBoundingSphere(),os.copy(r.boundingSphere),os.applyMatrix4(n),os.radius+=i,!1!==e.ray.intersectsSphere(os)){ns.getInverse(n),as.copy(e.ray).applyMatrix4(ns);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Xt,c=new Xt,l=new Xt,h=new Xt,u=this&&this.isLineSegments?2:1;if(r.isBufferGeometry){var p=r.index,d=r.attributes.position.array;if(null!==p)for(var f=p.array,m=0,g=f.length-1;m<g;m+=u){var v=f[m],y=f[m+1];s.fromArray(d,3*v),c.fromArray(d,3*y),o<as.distanceSqToSegment(s,c,h,l)||(h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else for(m=0,g=d.length/3-1;m<g;m+=u)s.fromArray(d,3*m),c.fromArray(d,3*m+3),o<as.distanceSqToSegment(s,c,h,l)||(h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else if(r.isGeometry){var x=r.vertices,b=x.length;for(m=0;m<b-1;m+=u){var w;o<as.distanceSqToSegment(x[m],x[m+1],h,l)||(h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}}}}),copy:function(e){return Er.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Ds.prototype=Object.assign(Object.create(Os.prototype),{constructor:Ds,isLineSegments:!0,computeLineDistances:(ls=new Xt,hs=new Xt,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,i=[],r=0,n=t.count;r<n;r+=2)ls.fromBufferAttribute(t,r),hs.fromBufferAttribute(t,r+1),i[r]=0===r?0:i[r-1],i[r+1]=i[r]+ls.distanceTo(hs);e.addAttribute("lineDistance",new kr(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(i=e.lineDistances,r=0,n=a.length;r<n;r+=2)ls.copy(a[r]),hs.copy(a[r+1]),i[r]=0===r?0:i[r-1],i[r+1]=i[r]+ls.distanceTo(hs)}return this})}),Ns.prototype=Object.assign(Object.create(Os.prototype),{constructor:Ns,isLineLoop:!0}),((Us.prototype=Object.create(hn.prototype)).constructor=Us).prototype.isPointsMaterial=!0,Us.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},Fs.prototype=Object.assign(Object.create(Er.prototype),{constructor:Fs,isPoints:!0,raycast:(us=new jt,ps=new $n,ds=new Ni,function(n,a){var o=this,e=this.geometry,s=this.matrixWorld,t=n.params.Points.threshold;if(null===e.boundingSphere&&e.computeBoundingSphere(),ds.copy(e.boundingSphere),ds.applyMatrix4(s),ds.radius+=t,!1!==n.ray.intersectsSphere(ds)){us.getInverse(s),ps.copy(n.ray).applyMatrix4(us);var i=t/((this.scale.x+this.scale.y+this.scale.z)/3),c=i*i,r=new Xt,l=new Xt;if(e.isBufferGeometry){var h=e.index,u=e.attributes.position.array;if(null!==h)for(var p=h.array,d=0,f=p.length;d<f;d++){var m=p[d];r.fromArray(u,3*m),y(r,m)}else{d=0;for(var g=u.length/3;d<g;d++)r.fromArray(u,3*d),y(r,d)}}else{var v=e.vertices;for(d=0,g=v.length;d<g;d++)y(v[d],d)}}function y(e,t){var i=ps.distanceSqToPoint(e);if(i<c){ps.closestPointToPoint(e,l),l.applyMatrix4(s);var r=n.ray.origin.distanceTo(l);if(r<n.near||r>n.far)return;a.push({distance:r,distanceToRay:Math.sqrt(i),point:l.clone(),index:t,face:null,object:o})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Bs.prototype=Object.assign(Object.create(Si.prototype),{constructor:Bs,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((zs.prototype=Object.create(Si.prototype)).constructor=zs).prototype.isCompressedTexture=!0,((Gs.prototype=Object.create(Si.prototype)).constructor=Gs).prototype.isCanvasTexture=!0,((Hs.prototype=Object.create(Si.prototype)).constructor=Hs).prototype.isDepthTexture=!0,(ks.prototype=Object.create(nn.prototype)).constructor=ks,(Vs.prototype=Object.create(Or.prototype)).constructor=Vs,(js.prototype=Object.create(nn.prototype)).constructor=js,(Ws.prototype=Object.create(Or.prototype)).constructor=Ws,(Xs.prototype=Object.create(nn.prototype)).constructor=Xs,(qs.prototype=Object.create(Or.prototype)).constructor=qs,(Ys.prototype=Object.create(Xs.prototype)).constructor=Ys,(Zs.prototype=Object.create(Or.prototype)).constructor=Zs,(Js.prototype=Object.create(Xs.prototype)).constructor=Js,(Ks.prototype=Object.create(Or.prototype)).constructor=Ks,(Qs.prototype=Object.create(Xs.prototype)).constructor=Qs,($s.prototype=Object.create(Or.prototype)).constructor=$s,(ec.prototype=Object.create(Xs.prototype)).constructor=ec,(tc.prototype=Object.create(Or.prototype)).constructor=tc,((ic.prototype=Object.create(nn.prototype)).constructor=ic).prototype.toJSON=function(){var e=nn.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},(rc.prototype=Object.create(Or.prototype)).constructor=rc,(nc.prototype=Object.create(nn.prototype)).constructor=nc,(ac.prototype=Object.create(Or.prototype)).constructor=ac,(oc.prototype=Object.create(nn.prototype)).constructor=oc;var sc=function(e,t,i){i=i||2;var r,n,a,o,s,c,l,h=t&&t.length,u=h?t[0]*i:e.length,p=cc(e,0,u,i,!0),d=[];if(!p)return d;if(h&&(p=function(e,t,i,r){var n,a,o,s,c,l=[];for(n=0,a=t.length;n<a;n++)o=t[n]*r,s=n<a-1?t[n+1]*r:e.length,(c=cc(e,o,s,r,!1))===c.next&&(c.steiner=!0),l.push(yc(c));for(l.sort(mc),n=0;n<l.length;n++)gc(l[n],i),i=lc(i,i.next);return i}(e,t,p,i)),e.length>80*i){r=a=e[0],n=o=e[1];for(var f=i;f<u;f+=i)(s=e[f])<r&&(r=s),(c=e[f+1])<n&&(n=c),a<s&&(a=s),o<c&&(o=c);l=0!==(l=Math.max(a-r,o-n))?1/l:0}return hc(p,d,i,r,n,l),d};function cc(e,t,i,r,n){var a,o;if(n===0<function(e,t,i,r){for(var n=0,a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}(e,t,i,r))for(a=t;a<i;a+=r)o=Tc(a,e[a],e[a+1],o);else for(a=i-r;t<=a;a-=r)o=Tc(a,e[a],e[a+1],o);return o&&wc(o,o.next)&&(Sc(o),o=o.next),o}function lc(e,t){if(!e)return e;t=t||e;var i,r=e;do{if(i=!1,r.steiner||!wc(r,r.next)&&0!==bc(r.prev,r,r.next))r=r.next;else{if(Sc(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function hc(e,t,i,r,n,a,o){if(e){!o&&a&&function(e,t,i,r){var n=e;for(;null===n.z&&(n.z=vc(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next,n!==e;);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,a,o,s,c,l=1;do{for(i=e,a=e=null,o=0;i;){for(o++,r=i,t=s=0;t<l&&(s++,r=r.nextZ);t++);for(c=l;0<s||0<c&&r;)0!==s&&(0===c||!r||i.z<=r.z)?(i=(n=i).nextZ,s--):(r=(n=r).nextZ,c--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;i=r}a.nextZ=null,l*=2}while(1<o)}(n)}(e,r,n,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?pc(e,r,n,a):uc(e))t.push(s.i/i),t.push(e.i/i),t.push(c.i/i),Sc(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?hc(e=dc(e,t,i),t,i,r,n,a,2):2===o&&fc(e,t,i,r,n,a):hc(lc(e),t,i,r,n,a,1);break}}}function uc(e){var t=e.prev,i=e,r=e.next;if(0<=bc(t,i,r))return!1;for(var n=e.next.next;n!==e.prev;){if(xc(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&0<=bc(n.prev,n,n.next))return!1;n=n.next}return!0}function pc(e,t,i,r){var n=e.prev,a=e,o=e.next;if(0<=bc(n,a,o))return!1;for(var s=n.x<a.x?n.x<o.x?n.x:o.x:a.x<o.x?a.x:o.x,c=n.y<a.y?n.y<o.y?n.y:o.y:a.y<o.y?a.y:o.y,l=n.x>a.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,h=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,u=vc(s,c,t,i,r),p=vc(l,h,t,i,r),d=e.nextZ;d&&d.z<=p;){if(d!==e.prev&&d!==e.next&&xc(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=bc(d.prev,d,d.next))return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&xc(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=bc(d.prev,d,d.next))return!1;d=d.prevZ}return!0}function dc(e,t,i){var r=e;do{var n=r.prev,a=r.next.next;!wc(n,a)&&_c(n,r,r.next,a)&&Mc(n,a)&&Mc(a,n)&&(t.push(n.i/i),t.push(r.i/i),t.push(a.i/i),Sc(r),Sc(r.next),r=e=a),r=r.next}while(r!==e);return r}function fc(e,t,i,r,n,a){var o,s,c=e;do{for(var l=c.next.next;l!==c.prev;){if(c.i!==l.i&&(s=l,(o=c).next.i!==s.i&&o.prev.i!==s.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&_c(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(o,s)&&Mc(o,s)&&Mc(s,o)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;for(;i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next,i!==e;);return r}(o,s))){var h=Ec(c,l);return c=lc(c,c.next),h=lc(h,h.next),hc(c,t,i,r,n,a),void hc(h,t,i,r,n,a)}l=l.next}c=c.next}while(c!==e)}function mc(e,t){return e.x-t.x}function gc(e,t){if(t=function(e,t){var i,r=t,n=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&o<s){if((o=s)===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!i)return null;if(n===o)return i.prev;var c,l=i,h=i.x,u=i.y,p=1/0;r=i.next;for(;r!==l;)n>=r.x&&r.x>=h&&n!==r.x&&xc(a<u?n:o,a,h,u,a<u?o:n,a,r.x,r.y)&&((c=Math.abs(a-r.y)/(n-r.x))<p||c===p&&r.x>i.x)&&Mc(r,e)&&(i=r,p=c),r=r.next;return i}(e,t)){var i=Ec(t,e);lc(i,i.next)}}function vc(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function yc(e){for(var t=e,i=e;t.x<i.x&&(i=t),(t=t.next)!==e;);return i}function xc(e,t,i,r,n,a,o,s){return 0<=(n-o)*(t-s)-(e-o)*(a-s)&&0<=(e-o)*(r-s)-(i-o)*(t-s)&&0<=(i-o)*(a-s)-(n-o)*(r-s)}function bc(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function wc(e,t){return e.x===t.x&&e.y===t.y}function _c(e,t,i,r){return!!(wc(e,t)&&wc(i,r)||wc(e,r)&&wc(i,t))||0<bc(e,t,i)!=0<bc(e,t,r)&&0<bc(i,r,e)!=0<bc(i,r,t)}function Mc(e,t){return bc(e.prev,e,e.next)<0?0<=bc(e,t,e.next)&&0<=bc(e,e.prev,t):bc(e,t,e.prev)<0||bc(e,e.next,t)<0}function Ec(e,t){var i=new Lc(e.i,e.x,e.y),r=new Lc(t.i,t.x,t.y),n=e.next,a=t.prev;return(e.next=t).prev=e,(i.next=n).prev=i,(r.next=i).prev=r,(a.next=r).prev=a,r}function Tc(e,t,i,r){var n=new Lc(e,t,i);return r?(n.next=r.next,(n.prev=r).next.prev=n,r.next=n):(n.prev=n).next=n,n}function Sc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Lc(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Ac={area:function(e){for(var t=e.length,i=0,r=t-1,n=0;n<t;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return.5*i},isClockWise:function(e){return Ac.area(e)<0},triangulateShape:function(e,t){var i=[],r=[],n=[];Rc(e),Pc(i,e);var a=e.length;t.forEach(Rc);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Pc(i,t[o]);var s=sc(i,r);for(o=0;o<s.length;o+=3)n.push(s.slice(o,o+3));return n}};function Rc(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function Pc(e,t){for(var i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}function Cc(e,t){Or.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Ic(e,t)),this.mergeVertices()}function Ic(e,J){nn.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:J},e=Array.isArray(e)?e:[e];for(var K=this,Q=[],$=[],t=0,i=e.length;t<i;t++){r(e[t])}function r(e){var r=[],t=void 0!==J.curveSegments?J.curveSegments:12,c=void 0!==J.steps?J.steps:1,i=void 0!==J.depth?J.depth:100,n=void 0===J.bevelEnabled||J.bevelEnabled,a=void 0!==J.bevelThickness?J.bevelThickness:6,o=void 0!==J.bevelSize?J.bevelSize:a-2,l=void 0!==J.bevelSegments?J.bevelSegments:3,s=J.extrudePath,h=void 0!==J.UVGenerator?J.UVGenerator:Oc;void 0!==J.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),i=J.amount);var u,p,d,f,m,g,v,y,x=!1;s&&(u=s.getSpacedPoints(c),n=!(x=!0),p=s.computeFrenetFrames(c,!1),d=new Xt,f=new Xt,m=new Xt),n||(o=a=l=0);var b=e.extractPoints(t),w=b.shape,_=b.holes;if(!Ac.isClockWise(w))for(w=w.reverse(),v=0,y=_.length;v<y;v++)g=_[v],Ac.isClockWise(g)&&(_[v]=g.reverse());var M=Ac.triangulateShape(w,_),E=w;for(v=0,y=_.length;v<y;v++)g=_[v],w=w.concat(g);function T(e,t,i){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(i).add(e)}var S,L,A,R,P,C,I=w.length,O=M.length;function D(e,t,i){var r,n,a,o=e.x-t.x,s=e.y-t.y,c=i.x-e.x,l=i.y-e.y,h=o*o+s*s,u=o*l-s*c;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(c*c+l*l),f=t.x-s/p,m=t.y+o/p,g=((i.x-l/d-f)*l-(i.y+c/d-m)*c)/(o*l-s*c),v=(r=f+o*g-e.x)*r+(n=m+s*g-e.y)*n;if(v<=2)return new Vt(r,n);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(l)&&(y=!0),a=y?(r=-s,n=o,Math.sqrt(h)):(r=o,n=s,Math.sqrt(h/2))}return new Vt(r/a,n/a)}for(var N=[],U=0,F=E.length,B=F-1,z=U+1;U<F;U++,B++,z++)B===F&&(B=0),z===F&&(z=0),N[U]=D(E[U],E[B],E[z]);var G,H,k=[],V=N.concat();for(v=0,y=_.length;v<y;v++){for(g=_[v],G=[],U=0,B=(F=g.length)-1,z=U+1;U<F;U++,B++,z++)B===F&&(B=0),z===F&&(z=0),G[U]=D(g[U],g[B],g[z]);k.push(G),V=V.concat(G)}for(S=0;S<l;S++){for(A=S/l,R=a*Math.cos(A*Math.PI/2),L=o*Math.sin(A*Math.PI/2),U=0,F=E.length;U<F;U++)W((P=T(E[U],N[U],L)).x,P.y,-R);for(v=0,y=_.length;v<y;v++)for(g=_[v],G=k[v],U=0,F=g.length;U<F;U++)W((P=T(g[U],G[U],L)).x,P.y,-R)}for(L=o,U=0;U<I;U++)P=n?T(w[U],V[U],L):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<I;U++)P=n?T(w[U],V[U],L):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,i/c*H);for(S=l-1;0<=S;S--){for(A=S/l,R=a*Math.cos(A*Math.PI/2),L=o*Math.sin(A*Math.PI/2),U=0,F=E.length;U<F;U++)W((P=T(E[U],N[U],L)).x,P.y,i+R);for(v=0,y=_.length;v<y;v++)for(g=_[v],G=k[v],U=0,F=g.length;U<F;U++)P=T(g[U],G[U],L),x?W(P.x,P.y+u[c-1].y,u[c-1].x+R):W(P.x,P.y,i+R)}function j(e,t){var i,r;for(U=e.length;0<=--U;){(r=(i=U)-1)<0&&(r=e.length-1);var n=0,a=c+2*l;for(n=0;n<a;n++){var o=I*n,s=I*(n+1);q(t+i+o,t+r+o,t+r+s,t+i+s)}}}function W(e,t,i){r.push(e),r.push(t),r.push(i)}function X(e,t,i){Y(e),Y(t),Y(i);var r=Q.length/3,n=h.generateTopUV(K,Q,r-3,r-2,r-1);Z(n[0]),Z(n[1]),Z(n[2])}function q(e,t,i,r){Y(e),Y(t),Y(r),Y(t),Y(i),Y(r);var n=Q.length/3,a=h.generateSideWallUV(K,Q,n-6,n-3,n-2,n-1);Z(a[0]),Z(a[1]),Z(a[3]),Z(a[1]),Z(a[2]),Z(a[3])}function Y(e){Q.push(r[3*e+0]),Q.push(r[3*e+1]),Q.push(r[3*e+2])}function Z(e){$.push(e.x),$.push(e.y)}!function(){var e=Q.length/3;if(n){var t=0,i=I*t;for(U=0;U<O;U++)X((C=M[U])[2]+i,C[1]+i,C[0]+i);for(i=I*(t=c+2*l),U=0;U<O;U++)X((C=M[U])[0]+i,C[1]+i,C[2]+i)}else{for(U=0;U<O;U++)X((C=M[U])[2],C[1],C[0]);for(U=0;U<O;U++)X((C=M[U])[0]+I*c,C[1]+I*c,C[2]+I*c)}K.addGroup(e,Q.length/3-e,0)}(),function(){var e=Q.length/3,t=0;for(j(E,t),t+=E.length,v=0,y=_.length;v<y;v++)j(g=_[v],t),t+=g.length;K.addGroup(e,Q.length/3-e,1)}()}this.addAttribute("position",new kr(Q,3)),this.addAttribute("uv",new kr($,2)),this.computeVertexNormals()}((Cc.prototype=Object.create(Or.prototype)).constructor=Cc).prototype.toJSON=function(){var e=Or.prototype.toJSON.call(this);return Dc(this.parameters.shapes,this.parameters.options,e)},((Ic.prototype=Object.create(nn.prototype)).constructor=Ic).prototype.toJSON=function(){var e=nn.prototype.toJSON.call(this);return Dc(this.parameters.shapes,this.parameters.options,e)};var Oc={generateTopUV:function(e,t,i,r,n){var a=t[3*i],o=t[3*i+1],s=t[3*r],c=t[3*r+1],l=t[3*n],h=t[3*n+1];return[new Vt(a,o),new Vt(s,c),new Vt(l,h)]},generateSideWallUV:function(e,t,i,r,n,a){var o=t[3*i],s=t[3*i+1],c=t[3*i+2],l=t[3*r],h=t[3*r+1],u=t[3*r+2],p=t[3*n],d=t[3*n+1],f=t[3*n+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(s-h)<.01?[new Vt(o,1-c),new Vt(l,1-u),new Vt(p,1-f),new Vt(m,1-v)]:[new Vt(s,1-c),new Vt(h,1-u),new Vt(d,1-f),new Vt(g,1-v)]}};function Dc(e,t,i){if(i.shapes=[],Array.isArray(e))for(var r=0,n=e.length;r<n;r++){var a=e[r];i.shapes.push(a.uuid)}else i.shapes.push(e.uuid);return void 0!==t.extrudePath&&(i.options.extrudePath=t.extrudePath.toJSON()),i}function Nc(e,t){Or.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Uc(e,t)),this.mergeVertices()}function Uc(e,t){var i=(t=t||{}).font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Or;var r=i.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Ic.call(this,r,t),this.type="TextBufferGeometry"}function Fc(e,t,i,r,n,a,o){Or.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Bc(e,t,i,r,n,a,o)),this.mergeVertices()}function Bc(e,t,i,r,n,a,o){nn.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),i=Math.max(2,Math.floor(i)||6),r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var s,c,l=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),h=0,u=[],p=new Xt,d=new Xt,f=[],m=[],g=[],v=[];for(c=0;c<=i;c++){var y=[],x=c/i;for(s=0;s<=t;s++){var b=s/t;p.x=-e*Math.cos(r+b*n)*Math.sin(a+x*o),p.y=e*Math.cos(a+x*o),p.z=e*Math.sin(r+b*n)*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(h++)}u.push(y)}for(c=0;c<i;c++)for(s=0;s<t;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!==i-1||l<Math.PI)&&f.push(_,M,E)}this.setIndex(f),this.addAttribute("position",new kr(m,3)),this.addAttribute("normal",new kr(g,3)),this.addAttribute("uv",new kr(v,2))}function zc(e,t,i,r,n,a){Or.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:n,thetaLength:a},this.fromBufferGeometry(new Gc(e,t,i,r,n,a)),this.mergeVertices()}function Gc(e,t,i,r,n,a){nn.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:n,thetaLength:a},e=e||.5,t=t||1,n=void 0!==n?n:0,a=void 0!==a?a:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var o,s,c,l=[],h=[],u=[],p=[],d=e,f=(t-e)/(r=void 0!==r?Math.max(1,r):1),m=new Xt,g=new Vt;for(s=0;s<=r;s++){for(c=0;c<=i;c++)o=n+c/i*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),h.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,p.push(g.x,g.y);d+=f}for(s=0;s<r;s++){var v=s*(i+1);for(c=0;c<i;c++){var y=o=c+v,x=o+i+1,b=o+i+2,w=o+1;l.push(y,x,w),l.push(x,b,w)}}this.setIndex(l),this.addAttribute("position",new kr(h,3)),this.addAttribute("normal",new kr(u,3)),this.addAttribute("uv",new kr(p,2))}function Hc(e,t,i,r){Or.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},this.fromBufferGeometry(new kc(e,t,i,r)),this.mergeVertices()}function kc(e,t,i,r){nn.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t)||12,i=i||0,r=r||2*Math.PI,r=kt.clamp(r,0,2*Math.PI);var n,a,o,s=[],c=[],l=[],h=1/t,u=new Xt,p=new Vt;for(a=0;a<=t;a++){var d=i+a*h*r,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=e.length-1;o++)u.x=e[o].x*f,u.y=e[o].y,u.z=e[o].x*m,c.push(u.x,u.y,u.z),p.x=a/t,p.y=o/(e.length-1),l.push(p.x,p.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var g=n=o+a*e.length,v=n+e.length,y=n+e.length+1,x=n+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.addAttribute("position",new kr(c,3)),this.addAttribute("uv",new kr(l,2)),this.computeVertexNormals(),r===2*Math.PI){var b=this.attributes.normal.array,w=new Xt,_=new Xt,M=new Xt;for(n=t*e.length*3,o=a=0;a<e.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[n+o+0],_.y=b[n+o+1],_.z=b[n+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[n+o+0]=M.x,b[o+1]=b[n+o+1]=M.y,b[o+2]=b[n+o+2]=M.z}}function Vc(e,t){Or.call(this),this.type="ShapeGeometry","object"===(void 0===t?"undefined":_typeof(t))&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new jc(e,t)),this.mergeVertices()}function jc(e,f){nn.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:f},f=f||12;var m=[],g=[],v=[],y=[],t=0,x=0;if(!1===Array.isArray(e))r(e);else for(var i=0;i<e.length;i++)r(e[i]),this.addGroup(t,x,i),t+=x,x=0;function r(e){var t,i,r,n=g.length/3,a=e.extractPoints(f),o=a.shape,s=a.holes;for(!1===Ac.isClockWise(o)&&(o=o.reverse()),t=0,i=s.length;t<i;t++)r=s[t],!0===Ac.isClockWise(r)&&(s[t]=r.reverse());var c=Ac.triangulateShape(o,s);for(t=0,i=s.length;t<i;t++)r=s[t],o=o.concat(r);for(t=0,i=o.length;t<i;t++){var l=o[t];g.push(l.x,l.y,0),v.push(0,0,1),y.push(l.x,l.y)}for(t=0,i=c.length;t<i;t++){var h=c[t],u=h[0]+n,p=h[1]+n,d=h[2]+n;m.push(u,p,d),x+=3}}this.setIndex(m),this.addAttribute("position",new kr(g,3)),this.addAttribute("normal",new kr(v,3)),this.addAttribute("uv",new kr(y,2))}function Wc(e,t){if(t.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var n=e[i];t.shapes.push(n.uuid)}else t.shapes.push(e.uuid);return t}function Xc(e,t){nn.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var i,r,n,a,o=[],s=Math.cos(kt.DEG2RAD*t),c=[0,0],l={},h=["a","b","c"];e.isBufferGeometry?(a=new Or).fromBufferGeometry(e):a=e.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++)i=m[h[g]],r=m[h[(g+1)%3]],c[0]=Math.min(i,r),c[1]=Math.max(i,r),void 0===l[n=c[0]+","+c[1]]?l[n]={index1:c[0],index2:c[1],face1:d,face2:void 0}:l[n].face2=d;for(n in l){var v=l[n];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 kr(o,3))}function qc(e,t,i,r,n,a,o,s){Or.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:n,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Yc(e,t,i,r,n,a,o,s)),this.mergeVertices()}function Yc(v,y,x,b,w,e,_,M){nn.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:v,radiusBottom:y,height:x,radialSegments:b,heightSegments:w,openEnded:e,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,e=void 0!==e&&e,_=void 0!==_?_:0,M=void 0!==M?M:2*Math.PI;var T=[],S=[],L=[],A=[],R=0,P=[],C=x/2,I=0;function t(e){var t,i,r,n=new Vt,a=new Xt,o=0,s=!0===e?v:y,c=!0===e?1:-1;for(i=R,t=1;t<=b;t++)S.push(0,C*c,0),L.push(0,c,0),A.push(.5,.5),R++;for(r=R,t=0;t<=b;t++){var l=t/b*M+_,h=Math.cos(l),u=Math.sin(l);a.x=s*u,a.y=C*c,a.z=s*h,S.push(a.x,a.y,a.z),L.push(0,c,0),n.x=.5*h+.5,n.y=.5*u*c+.5,A.push(n.x,n.y),R++}for(t=0;t<b;t++){var p=i+t,d=r+t;!0===e?T.push(d,d+1,p):T.push(d+1,d,p),o+=3}E.addGroup(I,o,!0===e?1:2),I+=o}!function(){var e,t,i=new Xt,r=new Xt,n=0,a=(y-v)/x;for(t=0;t<=w;t++){var o=[],s=t/w,c=s*(y-v)+v;for(e=0;e<=b;e++){var l=e/b,h=l*M+_,u=Math.sin(h),p=Math.cos(h);r.x=c*u,r.y=-s*x+C,r.z=c*p,S.push(r.x,r.y,r.z),i.set(u,a,p).normalize(),L.push(i.x,i.y,i.z),A.push(l,1-s),o.push(R++)}P.push(o)}for(e=0;e<b;e++)for(t=0;t<w;t++){var d=P[t][e],f=P[t+1][e],m=P[t+1][e+1],g=P[t][e+1];T.push(d,f,g),T.push(f,m,g),n+=6}E.addGroup(I,n,0),I+=n}(),!1===e&&(0<v&&t(!0),0<y&&t(!1)),this.setIndex(T),this.addAttribute("position",new kr(S,3)),this.addAttribute("normal",new kr(L,3)),this.addAttribute("uv",new kr(A,2))}function Zc(e,t,i,r,n,a,o){qc.call(this,0,e,t,i,r,n,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o}}function Jc(e,t,i,r,n,a,o){Yc.call(this,0,e,t,i,r,n,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o}}function Kc(e,t,i,r){Or.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},this.fromBufferGeometry(new Qc(e,t,i,r)),this.mergeVertices()}function Qc(e,t,i,r){nn.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var n,a,o=[],s=[],c=[],l=[],h=new Xt,u=new Vt;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,n=3;a<=t;a++,n+=3){var p=i+a/t*r;h.x=e*Math.cos(p),h.y=e*Math.sin(p),s.push(h.x,h.y,h.z),c.push(0,0,1),u.x=(s[n]/e+1)/2,u.y=(s[n+1]/e+1)/2,l.push(u.x,u.y)}for(n=1;n<=t;n++)o.push(n,n+1,0);this.setIndex(o),this.addAttribute("position",new kr(s,3)),this.addAttribute("normal",new kr(c,3)),this.addAttribute("uv",new kr(l,2))}(Nc.prototype=Object.create(Or.prototype)).constructor=Nc,(Uc.prototype=Object.create(Ic.prototype)).constructor=Uc,(Fc.prototype=Object.create(Or.prototype)).constructor=Fc,(Bc.prototype=Object.create(nn.prototype)).constructor=Bc,(zc.prototype=Object.create(Or.prototype)).constructor=zc,(Gc.prototype=Object.create(nn.prototype)).constructor=Gc,(Hc.prototype=Object.create(Or.prototype)).constructor=Hc,(kc.prototype=Object.create(nn.prototype)).constructor=kc,((Vc.prototype=Object.create(Or.prototype)).constructor=Vc).prototype.toJSON=function(){var e=Or.prototype.toJSON.call(this);return Wc(this.parameters.shapes,e)},((jc.prototype=Object.create(nn.prototype)).constructor=jc).prototype.toJSON=function(){var e=nn.prototype.toJSON.call(this);return Wc(this.parameters.shapes,e)},(Xc.prototype=Object.create(nn.prototype)).constructor=Xc,(qc.prototype=Object.create(Or.prototype)).constructor=qc,(Yc.prototype=Object.create(nn.prototype)).constructor=Yc,(Zc.prototype=Object.create(qc.prototype)).constructor=Zc,(Jc.prototype=Object.create(Yc.prototype)).constructor=Jc,(Kc.prototype=Object.create(Or.prototype)).constructor=Kc,(Qc.prototype=Object.create(nn.prototype)).constructor=Qc;var $c=Object.freeze({WireframeGeometry:ks,ParametricGeometry:Vs,ParametricBufferGeometry:js,TetrahedronGeometry:qs,TetrahedronBufferGeometry:Ys,OctahedronGeometry:Zs,OctahedronBufferGeometry:Js,IcosahedronGeometry:Ks,IcosahedronBufferGeometry:Qs,DodecahedronGeometry:$s,DodecahedronBufferGeometry:ec,PolyhedronGeometry:Ws,PolyhedronBufferGeometry:Xs,TubeGeometry:tc,TubeBufferGeometry:ic,TorusKnotGeometry:rc,TorusKnotBufferGeometry:nc,TorusGeometry:ac,TorusBufferGeometry:oc,TextGeometry:Nc,TextBufferGeometry:Uc,SphereGeometry:Fc,SphereBufferGeometry:Bc,RingGeometry:zc,RingBufferGeometry:Gc,PlaneGeometry:sn,PlaneBufferGeometry:cn,LatheGeometry:Hc,LatheBufferGeometry:kc,ShapeGeometry:Vc,ShapeBufferGeometry:jc,ExtrudeGeometry:Cc,ExtrudeBufferGeometry:Ic,EdgesGeometry:Xc,ConeGeometry:Zc,ConeBufferGeometry:Jc,CylinderGeometry:qc,CylinderBufferGeometry:Yc,CircleGeometry:Kc,CircleBufferGeometry:Qc,BoxGeometry:an,BoxBufferGeometry:on});function el(e){hn.call(this),this.type="ShadowMaterial",this.color=new Xi(0),this.transparent=!0,this.setValues(e)}function tl(e){Qn.call(this,e),this.type="RawShaderMaterial"}function il(e){hn.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Xi(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 Xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gt,this.normalScale=new Vt(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(e)}function rl(e){il.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function nl(e){hn.call(this),this.type="MeshPhongMaterial",this.color=new Xi(16777215),this.specular=new Xi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gt,this.normalScale=new Vt(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(e)}function al(e){nl.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function ol(e){hn.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gt,this.normalScale=new Vt(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(e)}function sl(e){hn.call(this),this.type="MeshLambertMaterial",this.color=new Xi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xi(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(e)}function cl(e){hn.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gt,this.normalScale=new Vt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e)}function ll(e){Is.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}((el.prototype=Object.create(hn.prototype)).constructor=el).prototype.isShadowMaterial=!0,el.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.color.copy(e.color),this},((tl.prototype=Object.create(Qn.prototype)).constructor=tl).prototype.isRawShaderMaterial=!0,((il.prototype=Object.create(hn.prototype)).constructor=il).prototype.isMeshStandardMaterial=!0,il.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((rl.prototype=Object.create(il.prototype)).constructor=rl).prototype.isMeshPhysicalMaterial=!0,rl.prototype.copy=function(e){return il.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},((nl.prototype=Object.create(hn.prototype)).constructor=nl).prototype.isMeshPhongMaterial=!0,nl.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((al.prototype=Object.create(nl.prototype)).constructor=al).prototype.isMeshToonMaterial=!0,al.prototype.copy=function(e){return nl.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},((ol.prototype=Object.create(hn.prototype)).constructor=ol).prototype.isMeshNormalMaterial=!0,ol.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((sl.prototype=Object.create(hn.prototype)).constructor=sl).prototype.isMeshLambertMaterial=!0,sl.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((cl.prototype=Object.create(hn.prototype)).constructor=cl).prototype.isMeshMatcapMaterial=!0,cl.prototype.copy=function(e){return hn.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((ll.prototype=Object.create(Is.prototype)).constructor=ll).prototype.isLineDashedMaterial=!0,ll.prototype.copy=function(e){return Is.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var hl=Object.freeze({ShadowMaterial:el,SpriteMaterial:Ts,RawShaderMaterial:tl,ShaderMaterial:Qn,PointsMaterial:Us,MeshPhysicalMaterial:rl,MeshStandardMaterial:il,MeshPhongMaterial:nl,MeshToonMaterial:al,MeshNormalMaterial:ol,MeshLambertMaterial:sl,MeshDepthMaterial:Po,MeshDistanceMaterial:Co,MeshBasicMaterial:ta,MeshMatcapMaterial:cl,LineDashedMaterial:ll,LineBasicMaterial:Is,Material:hn}),ul={arraySlice:function(e,t,i){return ul.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==i?i:e.length)):e.slice(t,i)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(i){for(var e=i.length,t=new Array(e),r=0;r!==e;++r)t[r]=r;return t.sort(function(e,t){return i[e]-i[t]}),t},sortedArray:function(e,t,i){for(var r=e.length,n=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=i[a]*t,c=0;c!==t;++c)n[o++]=e[s+c];return n},flattenJSON:function(e,t,i,r){for(var n=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[n++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[r])&&(t.push(a.time),i.push.apply(i,o)),void 0!==(a=e[n++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[r])&&(t.push(a.time),o.toArray(i,i.length)),void 0!==(a=e[n++]););else for(;void 0!==(o=a[r])&&(t.push(a.time),i.push(o)),void 0!==(a=e[n++]););}}};function pl(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i}function dl(e,t,i,r){pl.call(this,e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function fl(e,t,i,r){pl.call(this,e,t,i,r)}function ml(e,t,i,r){pl.call(this,e,t,i,r)}function gl(e,t,i,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ul.convertArray(t,this.TimeBufferType),this.values=ul.convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function vl(e,t,i){gl.call(this,e,t,i)}function yl(e,t,i,r){gl.call(this,e,t,i,r)}function xl(e,t,i,r){gl.call(this,e,t,i,r)}function bl(e,t,i,r){pl.call(this,e,t,i,r)}function wl(e,t,i,r){gl.call(this,e,t,i,r)}function _l(e,t,i,r){gl.call(this,e,t,i,r)}function Ml(e,t,i,r){gl.call(this,e,t,i,r)}function El(e,t,i){this.name=e,this.tracks=i,this.duration=void 0!==t?t:-1,this.uuid=kt.generateUUID(),this.duration<0&&this.resetDuration()}function Tl(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xl;case"vector":case"vector2":case"vector3":case"vector4":return Ml;case"color":return yl;case"quaternion":return wl;case"bool":case"boolean":return vl;case"string":return _l}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var i=[],r=[];ul.flattenJSON(e.keys,i,r,"value"),e.times=i,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(pl.prototype,{evaluate:function(e){var t=this.parameterPositions,i=this._cachedIndex,r=t[i],n=t[i-1];e:{t:{var a;i:{r:if(!(e<r)){for(var o=i+2;;){if(void 0===r){if(e<n)break r;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,n)}if(i===o)break;if(n=r,e<(r=t[++i]))break t}a=t.length;break i}if(n<=e)break e;var s=t[1];e<s&&(i=2,n=s);for(o=i-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(i===o)break;if(r=n,(n=t[--i-1])<=e)break t}a=i,i=0}for(;i<a;){var c=i+a>>>1;e<t[c]?a=c:i=1+c}if(r=t[i],void 0===(n=t[i-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,n,e)}this._cachedIndex=i,this.intervalChanged_(i,n,r)}return this.interpolate_(i,n,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r,a=0;a!==r;++a)t[a]=i[n+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(pl.prototype,{beforeStart_:pl.prototype.copySampleValue_,afterEnd_:pl.prototype.copySampleValue_}),dl.prototype=Object.assign(Object.create(pl.prototype),{constructor:dl,DefaultSettings_:{endingStart:Lt,endingEnd:Lt},intervalChanged_:function(e,t,i){var r=this.parameterPositions,n=e-2,a=e+1,o=r[n],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case At:n=e,o=2*t-i;break;case Rt:o=t+r[n=r.length-2]-r[n+1];break;default:n=e,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case At:a=e,s=2*i-t;break;case Rt:s=i+r[a=1]-r[0];break;default:a=e-1,s=t}var c=.5*(i-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-i),this._offsetPrev=n*l,this._offsetNext=a*l},interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-t)/(r-t),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)n[b]=g*a[l+b]+v*a[c+b]+y*a[s+b]+x*a[h+b];return n}}),fl.prototype=Object.assign(Object.create(pl.prototype),{constructor:fl,interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(i-t)/(r-t),h=1-l,u=0;u!==o;++u)n[u]=a[c+u]*h+a[s+u]*l;return n}}),ml.prototype=Object.assign(Object.create(pl.prototype),{constructor:ml,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(gl,{toJSON:function(e){var t,i=e.constructor;if(void 0!==i.toJSON)t=i.toJSON(e);else{t={name:e.name,times:ul.convertArray(e.times,Array),values:ul.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(gl.prototype,{constructor:gl,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:St,InterpolantFactoryMethodDiscrete:function(e){return new ml(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new fl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new dl(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Tt:t=this.InterpolantFactoryMethodDiscrete;break;case St:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)return this.createInterpolant=t,this;var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",i),this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Tt;case this.InterpolantFactoryMethodLinear:return St;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]*=e;return this},trim:function(e,t){for(var i=this.times,r=i.length,n=0,a=r-1;n!==r&&i[n]<e;)++n;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==n||a!==r){a<=n&&(n=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=ul.arraySlice(i,n,a),this.values=ul.arraySlice(this.values,n*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var i=this.times,r=this.values,n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==n;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&s<a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&ul.isTypedArray(r)){o=0;for(var c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),r=2302===this.getInterpolation(),n=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(r)s=!0;else for(var l=o*i,h=l-i,u=l+i,p=0;p!==i;++p){var d=t[l+p];if(d!==t[h+p]||d!==t[u+p]){s=!0;break}}if(s){if(o!==n){e[n]=e[o];var f=o*i,m=n*i;for(p=0;p!==i;++p)t[m+p]=t[f+p]}++n}}if(0<a){e[n]=e[a];for(f=a*i,m=n*i,p=0;p!==i;++p)t[m+p]=t[f+p];++n}return n!==e.length&&(this.times=ul.arraySlice(e,0,n),this.values=ul.arraySlice(t,0,n*i)),this},clone:function(){var e=ul.arraySlice(this.times,0),t=ul.arraySlice(this.values,0),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}),vl.prototype=Object.assign(Object.create(gl.prototype),{constructor:vl,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Tt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),yl.prototype=Object.assign(Object.create(gl.prototype),{constructor:yl,ValueTypeName:"color"}),xl.prototype=Object.assign(Object.create(gl.prototype),{constructor:xl,ValueTypeName:"number"}),bl.prototype=Object.assign(Object.create(pl.prototype),{constructor:bl,interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(i-t)/(r-t),l=s+o;s!==l;s+=4)Wt.slerpFlat(n,0,a,s-o,a,s,c);return n}}),wl.prototype=Object.assign(Object.create(gl.prototype),{constructor:wl,ValueTypeName:"quaternion",DefaultInterpolation:St,InterpolantFactoryMethodLinear:function(e){return new bl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),_l.prototype=Object.assign(Object.create(gl.prototype),{constructor:_l,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Tt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ml.prototype=Object.assign(Object.create(gl.prototype),{constructor:Ml,ValueTypeName:"vector"}),Object.assign(El,{parse:function(e){for(var t=[],i=e.tracks,r=1/(e.fps||1),n=0,a=i.length;n!==a;++n)t.push(Tl(i[n]).scale(r));return new El(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},n=0,a=i.length;n!==a;++n)t.push(gl.toJSON(i[n]));return r},CreateFromMorphTargetSequence:function(e,t,i,r){for(var n=t.length,a=[],o=0;o<n;o++){var s=[],c=[];s.push((o+n-1)%n,o,(o+1)%n),c.push(0,1,0);var l=ul.getKeyframeOrder(s);s=ul.sortedArray(s,1,l),c=ul.sortedArray(c,1,l),r||0!==s[0]||(s.push(n),c.push(c[0])),a.push(new xl(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/i))}return new El(e,-1,a)},findByName:function(e,t){var i=e;if(!Array.isArray(e)){i=e.geometry&&e.geometry.animations||e.animations}for(var r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,i){for(var r={},n=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(n);if(c&&1<c.length){var l=r[u=c[1]];l||(r[u]=l=[]),l.push(s)}}var h=[];for(var u in r)h.push(El.CreateFromMorphTargetSequence(u,r[u],t,i));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(e,t,i,r,n){if(0!==i.length){var a=[],o=[];ul.flattenJSON(i,a,o,r),0!==a.length&&n.push(new e(t,a,o))}},r=[],n=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var h={},u=0;u<l.length;u++)if(l[u].morphTargets)for(var p=0;p<l[u].morphTargets.length;p++)h[l[u].morphTargets[p]]=-1;for(var d in h){var f=[],m=[];for(p=0;p!==l[u].morphTargets.length;++p){var g=l[u];f.push(g.time),m.push(g.morphTarget===d?1:0)}r.push(new xl(".morphTargetInfluence["+d+"]",f,m))}a=h.length*(o||1)}else{var v=".bones["+t[c].name+"]";i(Ml,v+".position",l,"pos",r),i(wl,v+".quaternion",l,"rot",r),i(Ml,v+".scale",l,"scl",r)}}return 0===r.length?null:new El(n,a,r)}}),Object.assign(El.prototype,{resetDuration:function(){for(var e=0,t=0,i=this.tracks.length;t!==i;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new El(this.name,this.duration,e)}});var Sl={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Ll(e,t,i){var r=this,n=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++,!1===n&&void 0!==r.onStart&&r.onStart(e,a,o),n=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(n=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this}}var Al=new Ll,Rl={};function Pl(e){this.manager=void 0!==e?e:Al}function Cl(e){this.manager=void 0!==e?e:Al}function Il(e){this.manager=void 0!==e?e:Al,this._parser=null}function Ol(e){this.manager=void 0!==e?e:Al,this._parser=null}function Dl(e){this.manager=void 0!==e?e:Al}function Nl(e){this.manager=void 0!==e?e:Al}function Ul(e){this.manager=void 0!==e?e:Al}function Fl(){this.type="Curve",this.arcLengthDivisions=200}function Bl(e,t,i,r,n,a,o,s){Fl.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=i||1,this.yRadius=r||1,this.aStartAngle=n||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function zl(e,t,i,r,n,a){Bl.call(this,e,t,i,i,r,n,a),this.type="ArcCurve"}function Gl(){var n=0,a=0,o=0,s=0;function l(e,t,i,r){o=-3*(n=e)+3*t-2*(a=i)-r,s=2*e-2*t+i+r}return{initCatmullRom:function(e,t,i,r,n){l(t,i,n*(i-e),n*(r-t))},initNonuniformCatmullRom:function(e,t,i,r,n,a,o){var s=(t-e)/n-(i-e)/(n+a)+(i-t)/a,c=(i-t)/a-(r-t)/(a+o)+(r-i)/o;l(t,i,s*=a,c*=a)},calc:function(e){var t=e*e;return n+a*e+o*t+s*(t*e)}}}Object.assign(Pl.prototype,{load:function(o,e,t,i){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,r=Sl.get(o);if(void 0!==r)return s.manager.itemStart(o),setTimeout(function(){e&&e(r),s.manager.itemEnd(o)},0),r;if(void 0===Rl[o]){var n=o.match(/^data:(.*?)(;base64)?,(.*)$/);if(n){var a=n[1],c=!!n[2],l=n[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var p=new Uint8Array(l.length),d=0;d<l.length;d++)p[d]=l.charCodeAt(d);h="blob"===u?new Blob([p.buffer],{type:a}):p.buffer;break;case"document":var f=new DOMParser;h=f.parseFromString(l,a);break;case"json":h=JSON.parse(l);break;default:h=l}setTimeout(function(){e&&e(h),s.manager.itemEnd(o)},0)}catch(e){setTimeout(function(){i&&i(e),s.manager.itemError(o),s.manager.itemEnd(o)},0)}}else{Rl[o]=[],Rl[o].push({onLoad:e,onProgress:t,onError:i});var m=new XMLHttpRequest;for(var g in m.open("GET",o,!0),m.addEventListener("load",function(e){var t=this.response;Sl.add(o,t);var i=Rl[o];if(delete Rl[o],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var r=0,n=i.length;r<n;r++){(a=i[r]).onLoad&&a.onLoad(t)}s.manager.itemEnd(o)}else{for(r=0,n=i.length;r<n;r++){var a;(a=i[r]).onError&&a.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)}},!1),m.addEventListener("progress",function(e){for(var t=Rl[o],i=0,r=t.length;i<r;i++){var n=t[i];n.onProgress&&n.onProgress(e)}},!1),m.addEventListener("error",function(e){var t=Rl[o];delete Rl[o];for(var i=0,r=t.length;i<r;i++){var n=t[i];n.onError&&n.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),m.addEventListener("abort",function(e){var t=Rl[o];delete Rl[o];for(var i=0,r=t.length;i<r;i++){var n=t[i];n.onError&&n.onError(e)}s.manager.itemError(o),s.manager.itemEnd(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}Rl[o].push({onLoad:e,onProgress:t,onError:i})},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Object.assign(Cl.prototype,{load:function(e,t,i,r){var n=this,a=new Pl(n.manager);a.setPath(n.path),a.load(e,function(e){t(n.parse(JSON.parse(e)))},i,r)},parse:function(e,t){for(var i=[],r=0;r<e.length;r++){var n=El.parse(e[r]);i.push(n)}t(i)},setPath:function(e){return this.path=e,this}}),Object.assign(Il.prototype,{load:function(e,a,t,r){var o=this,s=[],c=new zs;c.image=s;var n=new Pl(this.manager);function i(i){n.load(e[i],function(e){var t=o._parser(e,!0);s[i]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(l+=1)&&(1===t.mipmapCount&&(c.minFilter=Ie),c.format=t.format,c.needsUpdate=!0,a&&a(c))},t,r)}if(n.setPath(this.path),n.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,h=0,u=e.length;h<u;++h)i(h);else n.load(e,function(e){var t=o._parser(e,!0);if(t.isCubemap)for(var i=t.mipmaps.length/t.mipmapCount,r=0;r<i;r++){s[r]={mipmaps:[]};for(var n=0;n<t.mipmapCount;n++)s[r].mipmaps.push(t.mipmaps[r*t.mipmapCount+n]),s[r].format=t.format,s[r].width=t.width,s[r].height=t.height}else c.image.width=t.width,c.image.height=t.height,c.mipmaps=t.mipmaps;1===t.mipmapCount&&(c.minFilter=Ie),c.format=t.format,c.needsUpdate=!0,a&&a(c)},t,r);return c},setPath:function(e){return this.path=e,this}}),Object.assign(Ol.prototype,{load:function(e,i,t,r){var n=this,a=new Ci,o=new Pl(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(e){var t=n._parser(e);t&&(void 0!==t.image?a.image=t.image:void 0!==t.data&&(a.image.width=t.width,a.image.height=t.height,a.image.data=t.data),a.wrapS=void 0!==t.wrapS?t.wrapS:Le,a.wrapT=void 0!==t.wrapT?t.wrapT:Le,a.magFilter=void 0!==t.magFilter?t.magFilter:Ie,a.minFilter=void 0!==t.minFilter?t.minFilter:De,a.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(a.format=t.format),void 0!==t.type&&(a.type=t.type),void 0!==t.mipmaps&&(a.mipmaps=t.mipmaps),1===t.mipmapCount&&(a.minFilter=Ie),a.needsUpdate=!0,i&&i(a,t))},t,r),a},setPath:function(e){return this.path=e,this}}),Object.assign(Dl.prototype,{crossOrigin:"anonymous",load:function(t,e,i,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var n=this,a=Sl.get(t);if(void 0!==a)return n.manager.itemStart(t),setTimeout(function(){e&&e(a),n.manager.itemEnd(t)},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),Sl.add(t,this),e&&e(this),n.manager.itemEnd(t)}function c(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),r&&r(e),n.manager.itemError(t),n.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),n.manager.itemStart(t),o.src=t,o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Nl.prototype,{crossOrigin:"anonymous",load:function(e,i,t,r){var n=new ga,a=new Dl(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(t){a.load(e[t],function(e){n.images[t]=e,6===++o&&(n.needsUpdate=!0,i&&i(n))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Ul.prototype,{crossOrigin:"anonymous",load:function(i,r,e,t){var n=new Si,a=new Dl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(i,function(e){n.image=e;var t=0<i.search(/\.jpe?g($|\?)/i)||0===i.search(/^data\:image\/jpeg/);n.format=t?Ye:Ze,n.needsUpdate=!0,void 0!==r&&r(n)},e,t),n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Fl.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var i=this.getUtoTmapping(e);return this.getPoint(i,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,r=[],n=this.getPoint(0),a=0;for(r.push(0),i=1;i<=e;i++)a+=(t=this.getPoint(i/e)).distanceTo(n),r.push(a),n=t;return this.cacheArcLengths=r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,r=this.getLengths(),n=0,a=r.length;i=t||e*r[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=r[n=Math.floor(s+(c-s)/2)]-i)<0)s=n+1;else{if(!(0<o)){c=n;break}c=n-1}if(r[n=c]===i)return n/(a-1);var l=r[n];return(n+(i-l)/(r[n+1]-l))/(a-1)},getTangent:function(e){var t=e-1e-4,i=e+1e-4;t<0&&(t=0),1<i&&(i=1);var r=this.getPoint(t);return this.getPoint(i).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var i,r,n,a=new Xt,o=[],s=[],c=[],l=new Xt,h=new jt;for(i=0;i<=e;i++)r=i/e,o[i]=this.getTangentAt(r),o[i].normalize();s[0]=new Xt,c[0]=new Xt;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),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),i=1;i<=e;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),l.crossVectors(o[i-1],o[i]),l.length()>Number.EPSILON&&(l.normalize(),n=Math.acos(kt.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(h.makeRotationAxis(l,n))),c[i].crossVectors(o[i],s[i]);if(!0===t)for(n=Math.acos(kt.clamp(s[0].dot(s[e]),-1,1)),n/=e,0<o[0].dot(l.crossVectors(s[0],s[e]))&&(n=-n),i=1;i<=e;i++)s[i].applyMatrix4(h.makeRotationAxis(o[i],n*i)),c[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),((Bl.prototype=Object.create(Fl.prototype)).constructor=Bl).prototype.isEllipseCurve=!0,Bl.prototype.getPoint=function(e,t){for(var i=t||new Vt,r=2*Math.PI,n=this.aEndAngle-this.aStartAngle,a=Math.abs(n)<Number.EPSILON;n<0;)n+=r;for(;r<n;)n-=r;n<Number.EPSILON&&(n=a?0:r),!0!==this.aClockwise||a||(n===r?n=-r:n-=r);var o=this.aStartAngle+e*n,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,p=c-this.aY;s=u*l-p*h+this.aX,c=u*h+p*l+this.aY}return i.set(s,c)},Bl.prototype.copy=function(e){return Fl.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Bl.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Bl.prototype.fromJSON=function(e){return Fl.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},((zl.prototype=Object.create(Bl.prototype)).constructor=zl).prototype.isArcCurve=!0;var Hl=new Xt,kl=new Gl,Vl=new Gl,jl=new Gl;function Wl(e,t,i,r){Fl.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=i||"centripetal",this.tension=r||.5}function Xl(e,t,i,r,n){var a=.5*(r-t),o=.5*(n-i),s=e*e;return(2*i-2*r+a+o)*(e*s)+(-3*i+3*r-2*a-o)*s+a*e+i}function ql(e,t,i,r){return(o=1-e)*o*t+2*(1-(a=e))*a*i+(n=e)*n*r;var n,a,o}function Yl(e,t,i,r,n){return(l=1-e)*l*l*t+3*(c=1-(s=e))*c*s*i+3*(1-(o=e))*o*o*r+(a=e)*a*a*n;var a,o,s,c,l}function Zl(e,t,i,r){Fl.call(this),this.type="CubicBezierCurve",this.v0=e||new Vt,this.v1=t||new Vt,this.v2=i||new Vt,this.v3=r||new Vt}function Jl(e,t,i,r){Fl.call(this),this.type="CubicBezierCurve3",this.v0=e||new Xt,this.v1=t||new Xt,this.v2=i||new Xt,this.v3=r||new Xt}function Kl(e,t){Fl.call(this),this.type="LineCurve",this.v1=e||new Vt,this.v2=t||new Vt}function Ql(e,t){Fl.call(this),this.type="LineCurve3",this.v1=e||new Xt,this.v2=t||new Xt}function $l(e,t,i){Fl.call(this),this.type="QuadraticBezierCurve",this.v0=e||new Vt,this.v1=t||new Vt,this.v2=i||new Vt}function eh(e,t,i){Fl.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Xt,this.v1=t||new Xt,this.v2=i||new Xt}function th(e){Fl.call(this),this.type="SplineCurve",this.points=e||[]}((Wl.prototype=Object.create(Fl.prototype)).constructor=Wl).prototype.isCatmullRomCurve3=!0,Wl.prototype.getPoint=function(e,t){var i,r,n,a,o=t||new Xt,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,h=Math.floor(l),u=l-h;if(this.closed?h+=0<h?0:(Math.floor(Math.abs(h)/c)+1)*c:0===u&&h===c-1&&(h=c-2,u=1),i=this.closed||0<h?s[(h-1)%c]:(Hl.subVectors(s[0],s[1]).add(s[0]),Hl),r=s[h%c],n=s[(h+1)%c],a=this.closed||h+2<c?s[(h+2)%c]:(Hl.subVectors(s[c-1],s[c-2]).add(s[c-1]),Hl),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(i.distanceToSquared(r),p),f=Math.pow(r.distanceToSquared(n),p),m=Math.pow(n.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),kl.initNonuniformCatmullRom(i.x,r.x,n.x,a.x,d,f,m),Vl.initNonuniformCatmullRom(i.y,r.y,n.y,a.y,d,f,m),jl.initNonuniformCatmullRom(i.z,r.z,n.z,a.z,d,f,m)}else"catmullrom"===this.curveType&&(kl.initCatmullRom(i.x,r.x,n.x,a.x,this.tension),Vl.initCatmullRom(i.y,r.y,n.y,a.y,this.tension),jl.initCatmullRom(i.z,r.z,n.z,a.z,this.tension));return o.set(kl.calc(u),Vl.calc(u),jl.calc(u)),o},Wl.prototype.copy=function(e){Fl.prototype.copy.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Wl.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Wl.prototype.fromJSON=function(e){Fl.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push((new Xt).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},((Zl.prototype=Object.create(Fl.prototype)).constructor=Zl).prototype.isCubicBezierCurve=!0,Zl.prototype.getPoint=function(e,t){var i=t||new Vt,r=this.v0,n=this.v1,a=this.v2,o=this.v3;return i.set(Yl(e,r.x,n.x,a.x,o.x),Yl(e,r.y,n.y,a.y,o.y)),i},Zl.prototype.copy=function(e){return Fl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Zl.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Zl.prototype.fromJSON=function(e){return Fl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Jl.prototype=Object.create(Fl.prototype)).constructor=Jl).prototype.isCubicBezierCurve3=!0,Jl.prototype.getPoint=function(e,t){var i=t||new Xt,r=this.v0,n=this.v1,a=this.v2,o=this.v3;return i.set(Yl(e,r.x,n.x,a.x,o.x),Yl(e,r.y,n.y,a.y,o.y),Yl(e,r.z,n.z,a.z,o.z)),i},Jl.prototype.copy=function(e){return Fl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Jl.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Jl.prototype.fromJSON=function(e){return Fl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Kl.prototype=Object.create(Fl.prototype)).constructor=Kl).prototype.isLineCurve=!0,Kl.prototype.getPoint=function(e,t){var i=t||new Vt;return 1===e?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i},Kl.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Kl.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Kl.prototype.copy=function(e){return Fl.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Kl.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Kl.prototype.fromJSON=function(e){return Fl.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Ql.prototype=Object.create(Fl.prototype)).constructor=Ql).prototype.isLineCurve3=!0,Ql.prototype.getPoint=function(e,t){var i=t||new Xt;return 1===e?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i},Ql.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Ql.prototype.copy=function(e){return Fl.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ql.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ql.prototype.fromJSON=function(e){return Fl.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},(($l.prototype=Object.create(Fl.prototype)).constructor=$l).prototype.isQuadraticBezierCurve=!0,$l.prototype.getPoint=function(e,t){var i=t||new Vt,r=this.v0,n=this.v1,a=this.v2;return i.set(ql(e,r.x,n.x,a.x),ql(e,r.y,n.y,a.y)),i},$l.prototype.copy=function(e){return Fl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},$l.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},$l.prototype.fromJSON=function(e){return Fl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((eh.prototype=Object.create(Fl.prototype)).constructor=eh).prototype.isQuadraticBezierCurve3=!0,eh.prototype.getPoint=function(e,t){var i=t||new Xt,r=this.v0,n=this.v1,a=this.v2;return i.set(ql(e,r.x,n.x,a.x),ql(e,r.y,n.y,a.y),ql(e,r.z,n.z,a.z)),i},eh.prototype.copy=function(e){return Fl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},eh.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},eh.prototype.fromJSON=function(e){return Fl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((th.prototype=Object.create(Fl.prototype)).constructor=th).prototype.isSplineCurve=!0,th.prototype.getPoint=function(e,t){var i=t||new Vt,r=this.points,n=(r.length-1)*e,a=Math.floor(n),o=n-a,s=r[0===a?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return i.set(Xl(o,s.x,c.x,l.x,h.x),Xl(o,s.y,c.y,l.y,h.y)),i},th.prototype.copy=function(e){Fl.prototype.copy.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push(r.clone())}return this},th.prototype.toJSON=function(){var e=Fl.prototype.toJSON.call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var r=this.points[t];e.points.push(r.toArray())}return e},th.prototype.fromJSON=function(e){Fl.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push((new Vt).fromArray(r))}return this};var ih=Object.freeze({ArcCurve:zl,CatmullRomCurve3:Wl,CubicBezierCurve:Zl,CubicBezierCurve3:Jl,EllipseCurve:Bl,LineCurve:Kl,LineCurve3:Ql,QuadraticBezierCurve:$l,QuadraticBezierCurve3:eh,SplineCurve:th});function rh(){Fl.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function nh(e){rh.call(this),this.type="Path",this.currentPoint=new Vt,e&&this.setFromPoints(e)}function ah(e){nh.call(this,e),this.uuid=kt.generateUUID(),this.type="Shape",this.holes=[]}function oh(e,t){Er.call(this),this.type="Light",this.color=new Xi(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function sh(e,t,i){oh.call(this,e,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Er.DefaultUp),this.updateMatrix(),this.groundColor=new Xi(t)}function ch(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new Vt(512,512),this.map=null,this.matrix=new jt}function lh(){ch.call(this,new Bo(50,1,.5,500))}function hh(e,t,i,r,n,a){oh.call(this,e,t),this.type="SpotLight",this.position.copy(Er.DefaultUp),this.updateMatrix(),this.target=new Er,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==n?n:0,this.decay=void 0!==a?a:1,this.shadow=new lh}function uh(e,t,i,r){oh.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==r?r:1,this.shadow=new ch(new Bo(90,1,.5,500))}function ph(e,t,i,r,n,a){Fo.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==i?i:1,this.bottom=void 0!==r?r:-1,this.near=void 0!==n?n:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function dh(){ch.call(this,new ph(-5,5,5,-5,.5,500))}function fh(e,t){oh.call(this,e,t),this.type="DirectionalLight",this.position.copy(Er.DefaultUp),this.updateMatrix(),this.target=new Er,this.shadow=new dh}function mh(e,t){oh.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function gh(e,t,i,r){oh.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==i?i:10,this.height=void 0!==r?r:10}function vh(e){this.manager=void 0!==e?e:Al,this.textures={}}rh.prototype=Object.assign(Object.create(Fl.prototype),{constructor:rh,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Kl(t,e))},getPoint:function(e){for(var t=e*this.getLength(),i=this.getCurveLengths(),r=0;r<i.length;){if(i[r]>=t){var n=i[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-n/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.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 e=[],t=0,i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,i=[],r=0,n=this.curves;r<n.length;r++)for(var a=n[r],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(i.push(l),t=l)}return this.autoClose&&1<i.length&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(e){Fl.prototype.copy.call(this,e),this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Fl.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,i=this.curves.length;t<i;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Fl.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var r=e.curves[t];this.curves.push((new ih[r.type]).fromJSON(r))}return this}}),nh.prototype=Object.assign(Object.create(rh.prototype),{constructor:nh,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var i=new Kl(this.currentPoint.clone(),new Vt(e,t));this.curves.push(i),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,i,r){var n=new $l(this.currentPoint.clone(),new Vt(e,t),new Vt(i,r));this.curves.push(n),this.currentPoint.set(i,r)},bezierCurveTo:function(e,t,i,r,n,a){var o=new Zl(this.currentPoint.clone(),new Vt(e,t),new Vt(i,r),new Vt(n,a));this.curves.push(o),this.currentPoint.set(n,a)},splineThru:function(e){var t=new th([this.currentPoint.clone()].concat(e));this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,i,r,n,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,i,r,n,a)},absarc:function(e,t,i,r,n,a){this.absellipse(e,t,i,i,r,n,a)},ellipse:function(e,t,i,r,n,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(e+c,t+l,i,r,n,a,o,s)},absellipse:function(e,t,i,r,n,a,o,s){var c=new Bl(e,t,i,r,n,a,o,s);if(0<this.curves.length){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)},copy:function(e){return rh.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=rh.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return rh.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),ah.prototype=Object.assign(Object.create(nh.prototype),{constructor:ah,getPointsHoles:function(e){for(var t=[],i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){nh.prototype.copy.call(this,e),this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=nh.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,i=this.holes.length;t<i;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){nh.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var r=e.holes[t];this.holes.push((new nh).fromJSON(r))}return this}}),oh.prototype=Object.assign(Object.create(Er.prototype),{constructor:oh,isLight:!0,copy:function(e){return Er.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Er.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),sh.prototype=Object.assign(Object.create(oh.prototype),{constructor:sh,isHemisphereLight:!0,copy:function(e){return oh.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(ch.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),lh.prototype=Object.assign(Object.create(ch.prototype),{constructor:lh,isSpotLightShadow:!0,update:function(e){var t=this.camera,i=2*kt.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;i===t.fov&&r===t.aspect&&n===t.far||(t.fov=i,t.aspect=r,t.far=n,t.updateProjectionMatrix())}}),hh.prototype=Object.assign(Object.create(oh.prototype),{constructor:hh,isSpotLight:!0,copy:function(e){return oh.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),uh.prototype=Object.assign(Object.create(oh.prototype),{constructor:uh,isPointLight:!0,copy:function(e){return oh.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),ph.prototype=Object.assign(Object.create(Fo.prototype),{constructor:ph,isOrthographicCamera:!0,copy:function(e,t){return Fo.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,i,r,n,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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,n=i-e,a=i+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var c=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),h=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;a=(n+=h*(this.view.offsetX/c))+h*(this.view.width/c),s=(o-=u*(this.view.offsetY/l))-u*(this.view.height/l)}this.projectionMatrix.makeOrthographic(n,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Er.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),dh.prototype=Object.assign(Object.create(ch.prototype),{constructor:dh}),fh.prototype=Object.assign(Object.create(oh.prototype),{constructor:fh,isDirectionalLight:!0,copy:function(e){return oh.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),mh.prototype=Object.assign(Object.create(oh.prototype),{constructor:mh,isAmbientLight:!0}),gh.prototype=Object.assign(Object.create(oh.prototype),{constructor:gh,isRectAreaLight:!0,copy:function(e){return oh.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=oh.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(vh.prototype,{load:function(e,t,i,r){var n=this,a=new Pl(n.manager);a.setPath(n.path),a.load(e,function(e){t(n.parse(JSON.parse(e)))},i,r)},parse:function(e){var t=this.textures;function i(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var r=new hl[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearCoat&&(r.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(r.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.vertexColors&&(r.vertexColors=e.vertexColors),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.uniforms)for(var n in e.uniforms){var a=e.uniforms[n];switch(r.uniforms[n]={},a.type){case"t":r.uniforms[n].value=i(a.value);break;case"c":r.uniforms[n].value=(new Xi).setHex(a.value);break;case"v2":r.uniforms[n].value=(new Vt).fromArray(a.value);break;case"v3":r.uniforms[n].value=(new Xt).fromArray(a.value);break;case"v4":r.uniforms[n].value=(new Li).fromArray(a.value);break;case"m3":r.uniforms[n].value=(new qt).fromArray(a.value);case"m4":r.uniforms[n].value=(new jt).fromArray(a.value);break;default:r.uniforms[n].value=a.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=i(e.map)),void 0!==e.alphaMap&&(r.alphaMap=i(e.alphaMap),r.transparent=!0),void 0!==e.bumpMap&&(r.bumpMap=i(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=i(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new Vt).fromArray(s)}return void 0!==e.displacementMap&&(r.displacementMap=i(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=i(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=i(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=i(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=i(e.specularMap)),void 0!==e.envMap&&(r.envMap=i(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.lightMap&&(r.lightMap=i(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=i(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=i(e.gradientMap)),r},setPath:function(e){return this.path=e,this},setTextures:function(e){return this.textures=e,this}});var yh={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);return decodeURIComponent(escape(t))},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function xh(e){this.manager=void 0!==e?e:Al}Object.assign(xh.prototype,{load:function(e,t,i,r){var n=this,a=new Pl(n.manager);a.setPath(n.path),a.load(e,function(e){t(n.parse(JSON.parse(e)))},i,r)},parse:function(e){var t=new nn,i=e.data.index;if(void 0!==i){var r=new bh[i.type](i.array);t.setIndex(new Dr(r,1))}var n=e.data.attributes;for(var a in n){var o=n[a],s=new Dr(r=new bh[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),t.addAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],h=[],u=0,p=l.length;u<p;u++){o=l[u],s=new Dr(r=new bh[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),h.push(s)}t.morphAttributes[a]=h}var d=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==d){u=0;for(var f=d.length;u!==f;++u){var m=d[u];t.addGroup(m.start,m.count,m.materialIndex)}}var g=e.data.boundingSphere;if(void 0!==g){var v=new Xt;void 0!==g.center&&v.fromArray(g.center),t.boundingSphere=new Ni(v,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t},setPath:function(e){return this.path=e,this}});var bh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function wh(e){this.manager=void 0!==e?e:Al,this.resourcePath=""}Object.assign(wh.prototype,{crossOrigin:"anonymous",load:function(r,n,e,a){var o=this,t=void 0===this.path?yh.extractUrlBase(r):this.path;this.resourcePath=this.resourcePath||t;var i=new Pl(o.manager);i.setPath(this.path),i.load(r,function(e){var t=null;try{t=JSON.parse(e)}catch(e){return void 0!==a&&a(e),void console.error("THREE:ObjectLoader: Can't parse "+r+".",e.message)}var i=t.metadata;void 0!==i&&void 0!==i.type&&"geometry"!==i.type.toLowerCase()?o.parse(t,n):console.error("THREE.ObjectLoader: Can't load "+r)},e,a)},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){var i=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,i),n=this.parseImages(e.images,function(){void 0!==t&&t(s)}),a=this.parseTextures(e.textures,n),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var i=0,r=e.length;i<r;i++){var n=(new ah).fromJSON(e[i]);t[n.uuid]=n}return t},parseGeometries:function(e,t){var i={};if(void 0!==e)for(var r=new xh,n=0,a=e.length;n<a;n++){var o,s=e[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new $c[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new $c[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new $c[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new $c[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new $c[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new $c[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new $c[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new $c[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new $c[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new $c[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new $c[s.type]((new ih[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new $c[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new $c[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],l=0,h=s.shapes.length;l<h;l++){var u=t[s.shapes[l]];c.push(u)}o=new $c[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,h=s.shapes.length;l<h;l++){u=t[s.shapes[l]];c.push(u)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new ih[p.type]).fromJSON(p)),o=new $c[s.type](c,s.options);break;case"BufferGeometry":o=r.parse(s);break;case"Geometry":if("THREE"in window&&"LegacyJSONLoader"in THREE)o=(new THREE.LegacyJSONLoader).parse(s,this.resourcePath).geometry;else console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),i[s.uuid]=o}return i},parseMaterials:function(e,t){var i={},r={};if(void 0!==e){var n=new vh;n.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var h=s.materials[l];void 0===i[h.uuid]&&(i[h.uuid]=n.parse(h)),c.push(i[h.uuid])}r[s.uuid]=c}else void 0===i[s.uuid]&&(i[s.uuid]=n.parse(s)),r[s.uuid]=i[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],i=0;i<e.length;i++){var r=e[i],n=El.parse(r);void 0!==r.uuid&&(n.uuid=r.uuid),t.push(n)}return t},parseImages:function(e,t){var i=this,r={};function n(e){return i.manager.itemStart(e),a.load(e,function(){i.manager.itemEnd(e)},void 0,function(){i.manager.itemError(e),i.manager.itemEnd(e)})}if(void 0!==e&&0<e.length){var a=new Dl(new Ll(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var h=0,u=l.length;h<u;h++){var p=l[h],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:i.resourcePath+p;r[c.uuid].push(n(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.resourcePath+c.url;r[c.uuid]=n(d)}}}return r},parseTextures:function(e,t){function i(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var n=0,a=e.length;n<a;n++){var o,s=e[n];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new ga(t[s.image]):new Si(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=i(s.mapping,Lh)),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=i(s.wrap[0],Ah),o.wrapT=i(s.wrap[1],Ah)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=i(s.minFilter,Rh)),void 0!==s.magFilter&&(o.magFilter=i(s.magFilter,Rh)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),r[s.uuid]=o}return r},parseObject:function(e,t,a){var i;function r(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function n(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],i=0,r=e.length;i<r;i++){var n=e[i];void 0===a[n]&&console.warn("THREE.ObjectLoader: Undefined material",n),t.push(a[n])}return t}return void 0===a[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),a[e]}}switch(e.type){case"Scene":i=new _s,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new Xi(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new ws(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new bs(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new Bo(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new ph(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new mh(e.color,e.intensity);break;case"DirectionalLight":i=new fh(e.color,e.intensity);break;case"PointLight":i=new uh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new gh(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new hh(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new sh(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=r(e.geometry),s=n(e.material);i=o.bones&&0<o.bones.length?new Rs(o,s):new ia(o,s),void 0!==e.drawMode&&i.setDrawMode(e.drawMode);break;case"LOD":i=new As;break;case"Line":i=new Os(r(e.geometry),n(e.material),e.mode);break;case"LineLoop":i=new Ns(r(e.geometry),n(e.material));break;case"LineSegments":i=new Ds(r(e.geometry),n(e.material));break;case"PointCloud":case"Points":i=new Fs(r(e.geometry),n(e.material));break;case"Sprite":i=new Ss(n(e.material));break;case"Group":i=new Uo;break;default:i=new Er}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children)for(var c=e.children,l=0;l<c.length;l++)i.add(this.parseObject(c[l],t,a));if("LOD"===e.type)for(var h=e.levels,u=0;u<h.length;u++){var p=h[u],d=i.getObjectByProperty("uuid",p.object);void 0!==d&&i.addLevel(d,p.distance)}return i}});var _h,Mh,Eh,Th,Sh,Lh={UVMapping:300,CubeReflectionMapping:ve,CubeRefractionMapping:ye,EquirectangularReflectionMapping:xe,EquirectangularRefractionMapping:be,SphericalReflectionMapping:we,CubeUVReflectionMapping:Ee,CubeUVRefractionMapping:Te},Ah={RepeatWrapping:Se,ClampToEdgeWrapping:Le,MirroredRepeatWrapping:Ae},Rh={NearestFilter:Re,NearestMipMapNearestFilter:Pe,NearestMipMapLinearFilter:Ce,LinearFilter:Ie,LinearMipMapNearestFilter:Oe,LinearMipMapLinearFilter:De};function Ph(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:Al,this.options=void 0}function Ch(){this.type="ShapePath",this.color=new Xi,this.subPaths=[],this.currentPath=null}function Ih(e){this.type="Font",this.data=e}function Oh(e,t,i,r,n){var a=n.glyphs[e]||n.glyphs["?"];if(a){var o,s,c,l,h,u,p,d,f=new Ch;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++]*t+i,s=m[g++]*t+r,f.moveTo(o,s);break;case"l":o=m[g++]*t+i,s=m[g++]*t+r,f.lineTo(o,s);break;case"q":c=m[g++]*t+i,l=m[g++]*t+r,h=m[g++]*t+i,u=m[g++]*t+r,f.quadraticCurveTo(h,u,c,l);break;case"b":c=m[g++]*t+i,l=m[g++]*t+r,h=m[g++]*t+i,u=m[g++]*t+r,p=m[g++]*t+i,d=m[g++]*t+r,f.bezierCurveTo(h,u,p,d,c,l)}}return{offsetX:a.ha*t,path:f}}}function Dh(e){this.manager=void 0!==e?e:Al}function Nh(){}Ph.prototype={constructor:Ph,setOptions:function(e){return this.options=e,this},load:function(t,i,e,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var n=this,a=Sl.get(t);if(void 0!==a)return n.manager.itemStart(t),setTimeout(function(){i&&i(a),n.manager.itemEnd(t)},0),a;fetch(t).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,n.options)}).then(function(e){Sl.add(t,e),i&&i(e),n.manager.itemEnd(t)}).catch(function(e){r&&r(e),n.manager.itemError(t),n.manager.itemEnd(t)}),n.manager.itemStart(t)},setCrossOrigin:function(){return this},setPath:function(e){return this.path=e,this}},Object.assign(Ch.prototype,{moveTo:function(e,t){this.currentPath=new nh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,i,r){this.currentPath.quadraticCurveTo(e,t,i,r)},bezierCurveTo:function(e,t,i,r,n,a){this.currentPath.bezierCurveTo(e,t,i,r,n,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function i(e){for(var t=[],i=0,r=e.length;i<r;i++){var n=e[i],a=new ah;a.curves=n.curves,t.push(a)}return t}function r(e,t){for(var i=t.length,r=!1,n=i-1,a=0;a<i;n=a++){var o=t[n],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[n],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=l*(e.x-o.x)-c*(e.y-o.y);if(0==h)return!0;if(h<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var n=Ac.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return i(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new ah).curves=s.curves,l.push(c),l;var h=!n(a[0].getPoints());h=e?!h:h;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=n(u=(s=a[v]).getPoints()),(o=e?!o:o)?(!h&&f[g]&&g++,f[g]={s:new ah,p:u},f[g].s.curves=s.curves,h&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return i(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,L=0;L<f.length;L++)r(T.p,f[L].p)&&(w!==L&&b.push({froms:w,tos:L,hole:E}),S?(S=!1,d[L].push(T)):x=!0);S&&d[w].push(T)}0<b.length&&(x||(m=d))}v=0;for(var A=f.length;v<A;v++){c=f[v].s,l.push(c);for(var R=0,P=(p=m[v]).length;R<P;R++)c.holes.push(p[R].h)}return l}}),Object.assign(Ih.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var i=[],r=function(e,t,i){for(var r=Array.from?Array.from(e):String(e).split(""),n=t/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*n,o=[],s=0,c=0,l=0;l<r.length;l++){var h=r[l];if("\n"===h)s=0,c-=a;else{var u=Oh(h,n,s,c,i);s+=u.offsetX,o.push(u.path)}}return o}(e,t,this.data),n=0,a=r.length;n<a;n++)Array.prototype.push.apply(i,r[n].toShapes());return i}}),Object.assign(Dh.prototype,{load:function(e,r,t,i){var n=this,a=new Pl(this.manager);a.setPath(this.path),a.load(e,function(t){var i;try{i=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(t.substring(65,t.length-2))}var e=n.parse(i);r&&r(e)},t,i)},parse:function(e){return new Ih(e)},setPath:function(e){return this.path=e,this}}),Nh.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,i=0,r=t.length;i<r;i+=2){var n=t[i],a=t[i+1];if(n.test(e))return a}return null}},Object.assign(Nh.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,i){for(var r=[],n=0;n<e.length;++n)r[n]=this.createMaterial(e[n],t,i);return r},createMaterial:(_h={NoBlending:J,NormalBlending:K,AdditiveBlending:Q,SubtractiveBlending:$,MultiplyBlending:ee,CustomBlending:te},Mh=new Xi,Eh=new Ul,Th=new vh,function(e,l,h){var u={};function t(e,t,i,r,n){var a,o=l+e,s=Nh.Handlers.get(o);a=null!==s?s.load(o):(Eh.setCrossOrigin(h),Eh.load(o)),void 0!==t&&(a.repeat.fromArray(t),1!==t[0]&&(a.wrapS=Se),1!==t[1]&&(a.wrapT=Se)),void 0!==i&&a.offset.fromArray(i),void 0!==r&&("repeat"===r[0]&&(a.wrapS=Se),"mirror"===r[0]&&(a.wrapS=Ae),"repeat"===r[1]&&(a.wrapT=Se),"mirror"===r[1]&&(a.wrapT=Ae)),void 0!==n&&(a.anisotropy=n);var c=kt.generateUUID();return u[c]=a,c}var i={uuid:kt.generateUUID(),type:"MeshLambertMaterial"};for(var r in e){var n=e[r];switch(r){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":i.name=n;break;case"blending":i.blending=_h[n];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",r,"is no longer supported.");break;case"colorDiffuse":i.color=Mh.fromArray(n).getHex();break;case"colorSpecular":i.specular=Mh.fromArray(n).getHex();break;case"colorEmissive":i.emissive=Mh.fromArray(n).getHex();break;case"specularCoef":i.shininess=n;break;case"shading":"basic"===n.toLowerCase()&&(i.type="MeshBasicMaterial"),"phong"===n.toLowerCase()&&(i.type="MeshPhongMaterial"),"standard"===n.toLowerCase()&&(i.type="MeshStandardMaterial");break;case"mapDiffuse":i.map=t(n,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":i.emissiveMap=t(n,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":i.lightMap=t(n,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":i.aoMap=t(n,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":i.bumpMap=t(n,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":i.bumpScale=n;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":i.normalMap=t(n,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":i.normalScale=n;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":i.specularMap=t(n,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":i.metalnessMap=t(n,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":i.roughnessMap=t(n,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":i.alphaMap=t(n,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":i.side=_e;break;case"doubleSided":i.side=Z;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),i.opacity=n;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":i[r]=n;break;case"vertexColors":!0===n&&(i.vertexColors=T),"face"===n&&(i.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",r,n)}}return"MeshBasicMaterial"===i.type&&delete i.emissive,"MeshPhongMaterial"!==i.type&&delete i.specular,i.opacity<1&&(i.transparent=!0),Th.setTextures(u),Th.parse(i)})});var Uh,Fh,Bh,zh,Gh,Hh,kh,Vh,jh,Wh,Xh,qh,Yh,Zh,Jh,Kh,Qh,$h,eu,tu={getContext:function(){return void 0===Sh&&(Sh=new(window.AudioContext||window.webkitAudioContext)),Sh},setContext:function(e){Sh=e}};function iu(e){this.manager=void 0!==e?e:Al}function ru(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Bo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Bo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function nu(e,t,i,r){Er.call(this),this.type="CubeCamera";var a=new Bo(90,1,e,t);a.up.set(0,-1,0),a.lookAt(new Xt(1,0,0)),this.add(a);var o=new Bo(90,1,e,t);o.up.set(0,-1,0),o.lookAt(new Xt(-1,0,0)),this.add(o);var s=new Bo(90,1,e,t);s.up.set(0,0,1),s.lookAt(new Xt(0,1,0)),this.add(s);var c=new Bo(90,1,e,t);c.up.set(0,0,-1),c.lookAt(new Xt(0,-1,0)),this.add(c);var l=new Bo(90,1,e,t);l.up.set(0,-1,0),l.lookAt(new Xt(0,0,1)),this.add(l);var h=new Bo(90,1,e,t);h.up.set(0,-1,0),h.lookAt(new Xt(0,0,-1)),this.add(h),r=r||{format:Ye,magFilter:Ie,minFilter:Ie},this.renderTarget=new Pi(i,i,r),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var i=e.getRenderTarget(),r=this.renderTarget,n=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,a),e.setRenderTarget(r,1),e.render(t,o),e.setRenderTarget(r,2),e.render(t,s),e.setRenderTarget(r,3),e.render(t,c),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=n,e.setRenderTarget(r,5),e.render(t,h),e.setRenderTarget(i)},this.clear=function(e,t,i,r){for(var n=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)a.activeCubeFace=o,e.setRenderTarget(a),e.clear(t,i,r);e.setRenderTarget(n)}}function au(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function ou(){Er.call(this),this.type="AudioListener",this.context=tu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0}function su(e){Er.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function cu(e){su.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function lu(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function hu(e,t,i){this.binding=e,this.valueSize=i;var r,n=Float64Array;switch(t){case"quaternion":r=this._slerp;break;case"string":case"bool":n=Array,r=this._select;break;default:r=this._lerp}this.buffer=new n(4*i),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(iu.prototype,{load:function(e,i,t,r){var n=new Pl(this.manager);n.setResponseType("arraybuffer"),n.setPath(this.path),n.load(e,function(e){var t=e.slice(0);tu.getContext().decodeAudioData(t,function(e){i(e)})},t,r)},setPath:function(e){return this.path=e,this}}),Object.assign(ru.prototype,{update:(jh=new jt,Wh=new jt,function(e){if(Uh!==this||Fh!==e.focus||Bh!==e.fov||zh!==e.aspect*this.aspect||Gh!==e.near||Hh!==e.far||kh!==e.zoom||Vh!==this.eyeSep){Uh=this,Fh=e.focus,Bh=e.fov,zh=e.aspect*this.aspect,Gh=e.near,Hh=e.far,kh=e.zoom;var t,i,r=e.projectionMatrix.clone(),n=(Vh=this.eyeSep/2)*Gh/Fh,a=Gh*Math.tan(kt.DEG2RAD*Bh*.5)/kh;Wh.elements[12]=-Vh,jh.elements[12]=Vh,t=-a*zh+n,i=a*zh+n,r.elements[0]=2*Gh/(i-t),r.elements[8]=(i+t)/(i-t),this.cameraL.projectionMatrix.copy(r),t=-a*zh-n,i=a*zh-n,r.elements[0]=2*Gh/(i-t),r.elements[8]=(i+t)/(i-t),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Wh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(jh)})}),(nu.prototype=Object.create(Er.prototype)).constructor=nu,Object.assign(au.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 e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),ou.prototype=Object.assign(Object.create(Er.prototype),{constructor:ou,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(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:(Xh=new Xt,qh=new Wt,Yh=new Xt,Zh=new Xt,Jh=new au,function(e){Er.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,i=this.up;if(this.timeDelta=Jh.getDelta(),this.matrixWorld.decompose(Xh,qh,Yh),Zh.set(0,0,-1).applyQuaternion(qh),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Xh.x,r),t.positionY.linearRampToValueAtTime(Xh.y,r),t.positionZ.linearRampToValueAtTime(Xh.z,r),t.forwardX.linearRampToValueAtTime(Zh.x,r),t.forwardY.linearRampToValueAtTime(Zh.y,r),t.forwardZ.linearRampToValueAtTime(Zh.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(Xh.x,Xh.y,Xh.z),t.setOrientation(Zh.x,Zh.y,Zh.z,i.x,i.y,i.z)})}),su.prototype=Object.assign(Object.create(Er.prototype),{constructor:su,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),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 e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);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 e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e=e||[],!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),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(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!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(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),cu.prototype=Object.assign(Object.create(su.prototype),{constructor:cu,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this},updateMatrixWorld:(Kh=new Xt,Qh=new Wt,$h=new Xt,eu=new Xt,function(e){if(Er.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Kh,Qh,$h),eu.set(0,0,1).applyQuaternion(Qh);var t=this.panner;if(t.positionX){var i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Kh.x,i),t.positionY.linearRampToValueAtTime(Kh.y,i),t.positionZ.linearRampToValueAtTime(Kh.z,i),t.orientationX.linearRampToValueAtTime(eu.x,i),t.orientationY.linearRampToValueAtTime(eu.y,i),t.orientationZ.linearRampToValueAtTime(eu.z,i)}else t.setPosition(Kh.x,Kh.y,Kh.z),t.setOrientation(eu.x,eu.y,eu.z)}})}),Object.assign(lu.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),i=0;i<t.length;i++)e+=t[i];return e/t.length}}),Object.assign(hu.prototype,{accumulate:function(e,t){var i=this.buffer,r=this.valueSize,n=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)i[n+o]=i[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(i,n,0,s,r)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,i=this.buffer,r=e*t+t,n=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,n<1){var o=3*t;this._mixBufferRegion(i,r,o,1-n,t)}for(var s=t,c=t+t;s!==c;++s)if(i[s]!==i[s+t]){a.setValue(i,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,i=this.valueSize,r=3*i;e.getValue(t,r);for(var n=i,a=r;n!==a;++n)t[n]=t[r+n%i];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,i,r,n){if(.5<=r)for(var a=0;a!==n;++a)e[t+a]=e[i+a]},_slerp:function(e,t,i,r){Wt.slerpFlat(e,t,e,t,e,i,r)},_lerp:function(e,t,i,r,n){for(var a=1-r,o=0;o!==n;++o){var s=t+o;e[s]=e[s]*a+e[i+o]*r}}});var uu,pu,du,fu,mu,gu,vu,yu,xu,bu,wu,_u,Mu,Eu,Tu,Su,Lu,Au,Ru,Pu,Cu,Iu,Ou,Du,Nu,Uu,Fu,Bu,zu,Gu,Hu,ku,Vu,ju,Wu,Xu,qu,Yu,Zu="\\[\\]\\.:\\/";function Ju(e,t,i){var r=i||Ku.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Ku(e,t,i){this.path=t,this.parsedPath=i||Ku.parseTrackName(t),this.node=Ku.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Qu(){this.uuid=kt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,i=arguments.length;t!==i;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function $u(e,t,i){this._mixer=e,this._clip=t,this._localRoot=i||null;for(var r=t.tracks,n=r.length,a=new Array(n),o={endingStart:Lt,endingEnd:Lt},s=0;s!==n;++s){var c=r[s].createInterpolant(null);(a[s]=c).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(n),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 ep(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function tp(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function ip(){nn.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function rp(e,t,i){Ms.call(this,e,t),this.meshPerAttribute=i||1}function np(e,t,i,r){"number"==typeof i&&(r=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Dr.call(this,e,t,i),this.meshPerAttribute=r||1}function ap(e,t,i,r){this.ray=new $n(e,t),this.near=i||0,this.far=r||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 op(e,t){return e.distance-t.distance}function sp(e,t,i,r){if(!1!==e.visible&&(e.raycast(t,i),!0===r))for(var n=e.children,a=0,o=n.length;a<o;a++)sp(n[a],t,i,!0)}function cp(e,t,i){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==i?i:0,this}function lp(e,t,i){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==i?i:0,this}function hp(e,t){this.min=void 0!==e?e:new Vt(1/0,1/0),this.max=void 0!==t?t:new Vt(-1/0,-1/0)}function up(e,t){this.start=void 0!==e?e:new Xt,this.end=void 0!==t?t:new Xt}function pp(e){Er.call(this),this.material=e,this.render=function(){}}function dp(e,t,i,r){this.object=e,this.size=void 0!==t?t:1;var n=void 0!==i?i:16711680,a=void 0!==r?r: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 nn,l=new kr(2*o*3,3);c.addAttribute("position",l),Ds.call(this,c,new Is({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function fp(e,t){Er.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var i=new nn,r=[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],n=0,a=1;n<32;n++,a++){var o=n/32*Math.PI*2,s=a/32*Math.PI*2;r.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}i.addAttribute("position",new kr(r,3));var c=new Is({fog:!1});this.cone=new Ds(i,c),this.add(this.cone),this.update()}function mp(e){for(var t=function e(t){var i=[];t&&t.isBone&&i.push(t);for(var r=0;r<t.children.length;r++)i.push.apply(i,e(t.children[r]));return i}(e),i=new nn,r=[],n=[],a=new Xi(0,0,1),o=new Xi(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),n.push(a.r,a.g,a.b),n.push(o.r,o.g,o.b))}i.addAttribute("position",new kr(r,3)),i.addAttribute("color",new kr(n,3));var l=new Is({vertexColors:T,depthTest:!1,depthWrite:!1,transparent:!0});Ds.call(this,i,l),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function gp(e,t,i){this.light=e,this.light.updateMatrixWorld(),this.color=i;var r=new Bc(t,4,2),n=new ta({wireframe:!0,fog:!1});ia.call(this,r,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function vp(e,t){this.type="RectAreaLightHelper",this.light=e,this.color=t;var i=new nn;i.addAttribute("position",new kr([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere();var r=new Is({fog:!1});Os.call(this,i,r);var n=new nn;n.addAttribute("position",new kr([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),n.computeBoundingSphere(),this.add(new ia(n,new ta({side:_e,fog:!1}))),this.update()}function yp(e,t,i){Er.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;var r=new Js(t);r.rotateY(.5*Math.PI),this.material=new ta({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=T);var n=r.getAttribute("position"),a=new Float32Array(3*n.count);r.addAttribute("color",new Dr(a,3)),this.add(new ia(r,this.material)),this.update()}function xp(e,t,i,r){e=e||10,t=t||10,i=new Xi(void 0!==i?i:4473924),r=new Xi(void 0!==r?r:8947848);for(var n=t/2,a=e/t,o=e/2,s=[],c=[],l=0,h=0,u=-o;l<=t;l++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=l===n?i:r;p.toArray(c,h),h+=3,p.toArray(c,h),h+=3,p.toArray(c,h),h+=3,p.toArray(c,h),h+=3}var d=new nn;d.addAttribute("position",new kr(s,3)),d.addAttribute("color",new kr(c,3));var f=new Is({vertexColors:T});Ds.call(this,d,f)}function bp(e,t,i,r,n,a){e=e||10,t=t||16,i=i||8,r=r||64,n=new Xi(void 0!==n?n:4473924),a=new Xi(void 0!==a?a:8947848);var o,s,c,l,h,u,p,d=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,d.push(0,0,0),d.push(o,0,s),p=1&l?n:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(l=0;l<=i;l++)for(p=1&l?n:a,u=e-e/i*l,h=0;h<r;h++)c=h/r*(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=(h+1)/r*(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 nn;m.addAttribute("position",new kr(d,3)),m.addAttribute("color",new kr(f,3));var g=new Is({vertexColors:T});Ds.call(this,m,g)}function wp(e,t,i,r){this.audio=e,this.range=t||1,this.divisionsInnerAngle=i||16,this.divisionsOuterAngle=r||2;var n=new nn,a=this.divisionsInnerAngle+2*this.divisionsOuterAngle,o=new Float32Array(3*(3*a+3));n.addAttribute("position",new Dr(o,3));var s=new Is({color:65280}),c=new Is({color:16776960});Os.call(this,n,[c,s]),this.update()}function _p(e,t,i,r){this.object=e,this.size=void 0!==t?t:1;var n=void 0!==i?i:16776960,a=void 0!==r?r: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 nn,l=new kr(2*o*3,3);c.addAttribute("position",l),Ds.call(this,c,new Is({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Mp(e,t,i){Er.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,void 0===t&&(t=1);var r=new nn;r.addAttribute("position",new kr([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var n=new Is({fog:!1});this.lightPlane=new Os(r,n),this.add(this.lightPlane),(r=new nn).addAttribute("position",new kr([0,0,0,0,0,1],3)),this.targetLine=new Os(r,n),this.add(this.targetLine),this.update()}function Ep(e){var t=new nn,i=new Is({color:16777215,vertexColors:1}),r=[],n=[],a={},o=new Xi(16755200),s=new Xi(16711680),c=new Xi(43775),l=new Xi(16777215),h=new Xi(3355443);function u(e,t,i){p(e,i),p(t,i)}function p(e,t){r.push(0,0,0),n.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.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",l),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.addAttribute("position",new kr(r,3)),t.addAttribute("color",new kr(n,3)),Ds.call(this,t,i),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Tp(e,t,i,r){ku.set(t,i,r).unproject(Vu);var n=Hu[e];if(void 0!==n)for(var a=Gu.getAttribute("position"),o=0,s=n.length;o<s;o++)a.setXYZ(n[o],ku.x,ku.y,ku.z)}function Sp(e,t){this.object=e,void 0===t&&(t=16776960);var i=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]),r=new Float32Array(24),n=new nn;n.setIndex(new Dr(i,1)),n.addAttribute("position",new Dr(r,3)),Ds.call(this,n,new Is({color:t})),this.matrixAutoUpdate=!1,this.update()}function Lp(e,t){this.type="Box3Helper",this.box=e;var i=void 0!==t?t:16776960,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 nn;n.setIndex(new Dr(r,1)),n.addAttribute("position",new kr([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)),Ds.call(this,n,new Is({color:i})),this.geometry.computeBoundingSphere()}function Ap(e,t,i){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;var r=void 0!==i?i:16776960,n=new nn;n.addAttribute("position",new kr([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)),n.computeBoundingSphere(),Os.call(this,n,new Is({color:r}));var a=new nn;a.addAttribute("position",new kr([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new ia(a,new ta({color:r,opacity:.2,transparent:!0,depthWrite:!1})))}function Rp(e,t,i,r,n,a){Er.call(this),void 0===e&&(e=new Xt(0,0,1)),void 0===t&&(t=new Xt(0,0,0)),void 0===i&&(i=1),void 0===r&&(r=16776960),void 0===n&&(n=.2*i),void 0===a&&(a=.2*n),void 0===Wu&&((Wu=new nn).addAttribute("position",new kr([0,0,0,0,1,0],3)),(Xu=new Yc(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Os(Wu,new Is({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ia(Xu,new ta({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,n,a)}function Pp(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=new nn;i.addAttribute("position",new kr(t,3)),i.addAttribute("color",new kr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new Is({vertexColors:T});Ds.call(this,i,r)}Object.assign(Ju.prototype,{getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}),Object.assign(Ku,{Composite:Ju,create:function(e,t,i){return e&&e.isAnimationObjectGroup?new Ku.Composite(e,t,i):new Ku(e,t,i)},sanitizeNodeName:(xu=new RegExp("["+Zu+"]","g"),function(e){return e.replace(/\s/g,"_").replace(xu,"")}),parseTrackName:(uu="[^"+Zu+"]",pu="[^"+Zu.replace("\\.","")+"]",du=/((?:WC+[\/:])*)/.source.replace("WC",uu),fu=/(WCOD+)?/.source.replace("WCOD",pu),mu=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uu),gu=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uu),vu=new RegExp("^"+du+fu+mu+gu+"$"),yu=["material","materials","bones"],function(e){var t=vu.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var n=i.nodeName.substring(r+1);-1!==yu.indexOf(n)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=n)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}),findNode:function(e,a){if(!a||""===a||"root"===a||"."===a||-1===a||a===e.name||a===e.uuid)return e;if(e.skeleton){var t=e.skeleton.getBoneByName(a);if(void 0!==t)return t}if(e.children){var i=function e(t){for(var i=0;i<t.length;i++){var r=t[i];if(r.name===a||r.uuid===a)return r;var n=e(r.children);if(n)return n}return null}(e.children);if(i)return i}return null}}),Object.assign(Ku.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(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)e[t++]=i[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++]},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,n=t.propertyIndex;if(e||(e=Ku.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(i){var a=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[r];if(void 0!==s){var c=this.Versioning.None;void 0!==(this.targetObject=e).needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.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(e.geometry.morphAttributes.position[o].name===n){n=o;break}}else{if(!e.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(e.geometry.morphTargets[o].name===n){n=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=n}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+r+" but it wasn't found.",e)}}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(Ku.prototype,{_getValue_unbound:Ku.prototype.getValue,_setValue_unbound:Ku.prototype.setValue}),Object.assign(Qu.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,h=arguments.length;l!==h;++l){var u=arguments[l],p=u.uuid,d=r[p];if(void 0===d){d=t++,r[p]=d,e.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new Ku(u,n[f],a[f]))}else if(d<i){c=e[d];var g=--i,v=e[g];e[r[v.uuid]=d]=v,e[r[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 Ku(u,n[f],a[f])),y[g]=b}}else e[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_=i},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,n=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=i[c];if(void 0!==l&&t<=l){var h=t++,u=e[h];e[i[u.uuid]=l]=u,e[i[c]=h]=s;for(var p=0,d=n;p!==d;++p){var f=r[p],m=f[h],g=f[l];f[l]=m,f[h]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,a=n.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=r[c];if(void 0!==l)if(delete r[c],l<i){var h=--i,u=e[h],p=e[v=--t];e[r[u.uuid]=l]=u,e[r[p.uuid]=h]=p,e.pop();for(var d=0,f=a;d!==f;++d){var m=(y=n[d])[h],g=y[v];y[l]=m,y[h]=g,y.pop()}}else{var v;e[r[(p=e[v=--t]).uuid]=l]=p,e.pop();for(d=0,f=a;d!==f;++d){var y;(y=n[d])[l]=y[v],y.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){var i=this._bindingsIndicesByPath,r=i[e],n=this._bindings;if(void 0!==r)return n[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c);r=n.length,i[e]=r,a.push(e),o.push(t),n.push(h);for(var u=l,p=s.length;u!==p;++u){var d=s[u];h[u]=new Ku(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,i=t[e];if(void 0!==i){var r=this._paths,n=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];a[t[e[o]]=i]=s,a.pop(),n[i]=n[o],n.pop(),r[i]=r[o],r.pop()}}}),Object.assign($u.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(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){var r=this._clip.duration,n=e._clip.duration,a=n/r,o=r/n;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,i){return e.crossFadeFrom(this,t,i)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,i){var r=this._mixer,n=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=n,s[1]=n+i,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,i,r){if(this.enabled){var n=this._startTime;if(null!==n){var a=(e-n)*i;if(a<0||0===i)return;this._startTime=null,t=i*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(0<s)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e,i=this._clip.duration,r=this.loop,n=this._loopCount,a=2202===r;if(0===e)return-1===n?t:a&&1==(1&n)?i-t:t;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i<=t)t=i;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===n&&(0<=e?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i<=t||t<0){var o=Math.floor(t/i);t-=i*o,n+=Math.abs(o);var s=this.repetitions-n;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=0<e?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1});else{if(1==s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&n))return i-(this.time=t)}return this.time=t},_setEndings:function(e,t,i){var r=this._interpolantSettings;i?(r.endingStart=At,r.endingEnd=At):(r.endingStart=e?this.zeroSlopeAtStart?At:Lt:Rt,r.endingEnd=t?this.zeroSlopeAtEnd?At:Lt:Rt)},_scheduleFading:function(e,t,i){var r=this._mixer,n=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=n,s[0]=t,o[1]=n+e,s[1]=i,this}}),ep.prototype=Object.assign(Object.create(t.prototype),{constructor:ep,_bindAction:function(e,t){var i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,a=e._propertyBindings,o=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==n;++h){var u=r[h],p=u.name,d=l[p];if(void 0!==d)a[h]=d;else{if(void 0!==(d=a[h])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(d=new hu(Ku.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[h]=d}o[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,a=0,o=n.length;a!==o;++a){var s=n[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,i){var r=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e},_removeInactiveAction:function(e){var t=this._actions,i=t[t.length-1],r=e._cacheIndex;t[i._cacheIndex=r]=i,t.pop(),e._cacheIndex=null;var n=e._clip.uuid,a=this._actionsByClip,o=a[n],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;s[c._byClipCacheIndex=l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[n],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){var t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_takeBackAction:function(e){var t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_addInactiveBinding:function(e,t,i){var r=this._bindingsByRootAndName,n=r[t],a=this._bindings;void 0===n&&(n={},r[t]=n),(n[i]=e)._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,i=e.binding,r=i.rootNode.uuid,n=i.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;t[s._cacheIndex=c]=s,t.pop(),delete o[n];e:{for(var l in o)break e;delete a[r]}},_lendBinding:function(e){var t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_takeBackBinding:function(e){var t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&(e[(i=new fl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=i),i},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,n=t[r];t[e.__cacheIndex=r]=e,t[n.__cacheIndex=i]=n},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var i=t||this._root,r=i.uuid,n="string"==typeof e?El.findByName(i,e):e,a=null!==n?n.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[r];if(void 0!==c)return c;s=o.knownActions[0],null===n&&(n=s._clip)}if(null===n)return null;var l=new $u(this,n,t);return this._bindAction(l,s),this._addInactiveAction(l,a,r),l},existingAction:function(e,t){var i=t||this._root,r=i.uuid,n="string"==typeof e?El.findByName(i,e):e,a=n?n.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,i=this._bindings,r=this._nActiveBindings;this._nActiveActions=0;for(var n=this._nActiveBindings=0;n!==t;++n)e[n].reset();for(n=0;n!==r;++n)i[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,i=this._nActiveActions,r=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1,o=0;o!==i;++o){t[o]._update(r,e,n,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(e){var t=this._actions,i=e.uuid,r=this._actionsByClip,n=r[i];if(void 0!==n){for(var a=n.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,t[h._cacheIndex=l]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}},uncacheRoot:function(e){var t=e.uuid,i=this._actionsByClip;for(var r in i){var n=i[r].actionByRoot[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),tp.prototype.clone=function(){return new tp(void 0===this.value.clone?this.value:this.value.clone())},ip.prototype=Object.assign(Object.create(nn.prototype),{constructor:ip,isInstancedBufferGeometry:!0,copy:function(e){return nn.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),rp.prototype=Object.assign(Object.create(Ms.prototype),{constructor:rp,isInstancedInterleavedBuffer:!0,copy:function(e){return Ms.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),np.prototype=Object.assign(Object.create(Dr.prototype),{constructor:np,isInstancedBufferAttribute:!0,copy:function(e){return Dr.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(ap.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,i){var r=i||[];return sp(e,this,r,t),r.sort(op),r},intersectObjects:function(e,t,i){var r=i||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var n=0,a=e.length;n<a;n++)sp(e[n],this,r,t);return r.sort(op),r}}),Object.assign(cp.prototype,{set:function(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(kt.clamp(t/this.radius,-1,1))),this}}),Object.assign(lp.prototype,{set:function(e,t,i){return this.radius=e,this.theta=t,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}}),Object.assign(hp.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(wu=new Vt,function(e,t){var i=wu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new Vt),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new Vt),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Vt),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Vt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(bu=new Vt,function(e){return bu.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(up.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Xt),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Xt),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Xt),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(_u=new Xt,Mu=new Xt,function(e,t){_u.subVectors(e,this.start),Mu.subVectors(this.end,this.start);var i=Mu.dot(Mu),r=Mu.dot(_u)/i;return t&&(r=kt.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,i){var r=this.closestPointToPointParameter(e,t);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new Xt),this.delta(i).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),((pp.prototype=Object.create(Er.prototype)).constructor=pp).prototype.isImmediateRenderObject=!0,((dp.prototype=Object.create(Ds.prototype)).constructor=dp).prototype.update=(Eu=new Xt,Tu=new Xt,Su=new qt,function(){var e=["a","b","c"];this.object.updateMatrixWorld(!0),Su.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,i=this.geometry.attributes.position,r=this.object.geometry;if(r&&r.isGeometry)for(var n=r.vertices,a=r.faces,o=0,s=0,c=a.length;s<c;s++)for(var l=a[s],h=0,u=l.vertexNormals.length;h<u;h++){var p=n[l[e[h]]],d=l.vertexNormals[h];Eu.copy(p).applyMatrix4(t),Tu.copy(d).applyMatrix3(Su).normalize().multiplyScalar(this.size).add(Eu),i.setXYZ(o,Eu.x,Eu.y,Eu.z),o+=1,i.setXYZ(o,Tu.x,Tu.y,Tu.z),o+=1}else if(r&&r.isBufferGeometry){var f=r.attributes.position,m=r.attributes.normal;for(h=o=0,u=f.count;h<u;h++)Eu.set(f.getX(h),f.getY(h),f.getZ(h)).applyMatrix4(t),Tu.set(m.getX(h),m.getY(h),m.getZ(h)),Tu.applyMatrix3(Su).normalize().multiplyScalar(this.size).add(Eu),i.setXYZ(o,Eu.x,Eu.y,Eu.z),o+=1,i.setXYZ(o,Tu.x,Tu.y,Tu.z),o+=1}i.needsUpdate=!0}),((fp.prototype=Object.create(Er.prototype)).constructor=fp).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},fp.prototype.update=(Lu=new Xt,function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Lu.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Lu),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}),((mp.prototype=Object.create(Ds.prototype)).constructor=mp).prototype.updateMatrixWorld=(Au=new Xt,Ru=new jt,Pu=new jt,function(e){var t=this.bones,i=this.geometry,r=i.getAttribute("position");Pu.getInverse(this.root.matrixWorld);for(var n=0,a=0;n<t.length;n++){var o=t[n];o.parent&&o.parent.isBone&&(Ru.multiplyMatrices(Pu,o.matrixWorld),Au.setFromMatrixPosition(Ru),r.setXYZ(a,Au.x,Au.y,Au.z),Ru.multiplyMatrices(Pu,o.parent.matrixWorld),Au.setFromMatrixPosition(Ru),r.setXYZ(a+1,Au.x,Au.y,Au.z),a+=2)}i.getAttribute("position").needsUpdate=!0,Er.prototype.updateMatrixWorld.call(this,e)}),((gp.prototype=Object.create(ia.prototype)).constructor=gp).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},gp.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},((vp.prototype=Object.create(Os.prototype)).constructor=vp).prototype.update=function(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var e=this.material.color,t=Math.max(e.r,e.g,e.b);1<t&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},vp.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},((yp.prototype=Object.create(Er.prototype)).constructor=yp).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},yp.prototype.update=(Cu=new Xt,Iu=new Xi,Ou=new Xi,function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Iu.copy(this.light.color),Ou.copy(this.light.groundColor);for(var i=0,r=t.count;i<r;i++){var n=i<r/2?Iu:Ou;t.setXYZ(i,n.r,n.g,n.b)}t.needsUpdate=!0}e.lookAt(Cu.setFromMatrixPosition(this.light.matrixWorld).negate())}),(xp.prototype=Object.create(Ds.prototype)).constructor=xp,(bp.prototype=Object.create(Ds.prototype)).constructor=bp,((wp.prototype=Object.create(Os.prototype)).constructor=wp).prototype.update=function(){var a,o,e=this.audio,s=this.range,t=this.divisionsInnerAngle,i=this.divisionsOuterAngle,r=kt.degToRad(e.panner.coneInnerAngle),n=kt.degToRad(e.panner.coneOuterAngle),c=r/2,l=n/2,h=0,u=0,p=this.geometry,d=p.attributes.position;function f(e,t,i,r){var n=(t-e)/i;for(d.setXYZ(h,0,0,0),u++,a=e;a<t;a+=n)o=h+u,d.setXYZ(o,Math.sin(a)*s,0,Math.cos(a)*s),d.setXYZ(o+1,Math.sin(Math.min(a+n,t))*s,0,Math.cos(Math.min(a+n,t))*s),d.setXYZ(o+2,0,0,0),u+=3;p.addGroup(h,u,r),h+=u,u=0}p.clearGroups(),f(-l,-c,i,0),f(-c,c,t,1),f(c,l,i,0),d.needsUpdate=!0,r===n&&(this.material[0].visible=!1)},wp.prototype.dispose=function(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()},((_p.prototype=Object.create(Ds.prototype)).constructor=_p).prototype.update=(Du=new Xt,Nu=new Xt,Uu=new qt,function(){this.object.updateMatrixWorld(!0),Uu.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,t=this.geometry.attributes.position,i=this.object.geometry,r=i.vertices,n=i.faces,a=0,o=0,s=n.length;o<s;o++){var c=n[o],l=c.normal;Du.copy(r[c.a]).add(r[c.b]).add(r[c.c]).divideScalar(3).applyMatrix4(e),Nu.copy(l).applyMatrix3(Uu).normalize().multiplyScalar(this.size).add(Du),t.setXYZ(a,Du.x,Du.y,Du.z),a+=1,t.setXYZ(a,Nu.x,Nu.y,Nu.z),a+=1}t.needsUpdate=!0}),((Mp.prototype=Object.create(Er.prototype)).constructor=Mp).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Mp.prototype.update=(Fu=new Xt,Bu=new Xt,zu=new Xt,function(){Fu.setFromMatrixPosition(this.light.matrixWorld),Bu.setFromMatrixPosition(this.light.target.matrixWorld),zu.subVectors(Bu,Fu),this.lightPlane.lookAt(Bu),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(Bu),this.targetLine.scale.z=zu.length()}),((Ep.prototype=Object.create(Ds.prototype)).constructor=Ep).prototype.update=(ku=new Xt,Vu=new Fo,function(){Gu=this.geometry,Hu=this.pointMap,Vu.projectionMatrix.copy(this.camera.projectionMatrix),Tp("c",0,0,-1),Tp("t",0,0,1),Tp("n1",-1,-1,-1),Tp("n2",1,-1,-1),Tp("n3",-1,1,-1),Tp("n4",1,1,-1),Tp("f1",-1,-1,1),Tp("f2",1,-1,1),Tp("f3",-1,1,1),Tp("f4",1,1,1),Tp("u1",.7,1.1,-1),Tp("u2",-.7,1.1,-1),Tp("u3",0,2,-1),Tp("cf1",-1,0,1),Tp("cf2",1,0,1),Tp("cf3",0,-1,1),Tp("cf4",0,1,1),Tp("cn1",-1,0,-1),Tp("cn2",1,0,-1),Tp("cn3",0,-1,-1),Tp("cn4",0,1,-1),Gu.getAttribute("position").needsUpdate=!0}),((Sp.prototype=Object.create(Ds.prototype)).constructor=Sp).prototype.update=(ju=new Ii,function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&ju.setFromObject(this.object),!ju.isEmpty()){var t=ju.min,i=ju.max,r=this.geometry.attributes.position,n=r.array;n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=t.x,n[4]=i.y,n[5]=i.z,n[6]=t.x,n[7]=t.y,n[8]=i.z,n[9]=i.x,n[10]=t.y,n[11]=i.z,n[12]=i.x,n[13]=i.y,n[14]=t.z,n[15]=t.x,n[16]=i.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=i.x,n[22]=t.y,n[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}),Sp.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Sp.prototype.copy=function(e){return Ds.prototype.copy.call(this,e),this.object=e.object,this},Sp.prototype.clone=function(){return(new this.constructor).copy(this)},((Lp.prototype=Object.create(Ds.prototype)).constructor=Lp).prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Er.prototype.updateMatrixWorld.call(this,e))},((Ap.prototype=Object.create(Os.prototype)).constructor=Ap).prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?_e:N,this.lookAt(this.plane.normal),Er.prototype.updateMatrixWorld.call(this,e)},((Rp.prototype=Object.create(Er.prototype)).constructor=Rp).prototype.setDirection=(Yu=new Xt,function(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Yu.set(e.z,0,-e.x).normalize(),qu=Math.acos(e.y),this.quaternion.setFromAxisAngle(Yu,qu))}),Rp.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},Rp.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},Rp.prototype.copy=function(e){return Er.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Rp.prototype.clone=function(){return(new this.constructor).copy(this)},(Pp.prototype=Object.create(Ds.prototype)).constructor=Pp;var Cp;function Ip(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Wl.call(this,e),this.type="catmullrom",this.closed=!0}function Op(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Wl.call(this,e),this.type="catmullrom"}function Dp(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Wl.call(this,e),this.type="catmullrom"}Fl.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Fl.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(rh.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Or,i=0,r=e.length;i<r;i++){var n=e[i];t.vertices.push(new Xt(n.x,n.y,n.z||0))}return t}}),Object.assign(nh.prototype,{fromPoints:function(e){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Ip.prototype=Object.create(Wl.prototype),Op.prototype=Object.create(Wl.prototype),Dp.prototype=Object.create(Wl.prototype),Object.assign(Dp.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.")}}),xp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},mp.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Nh.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),yh.extractUrlBase(e)}}),Object.assign(wh.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(hp.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Ii.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),up.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(kt,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),kt.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),kt.ceilPowerOfTwo(e)}}),Object.assign(qt.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(jt.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return void 0===Cp&&(Cp=new Xt),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),Cp.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.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(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,i,r,n,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,i,n,a)}}),Ui.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Wt.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign($n.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(ea.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(ea,{barycoordFromPoint:function(e,t,i,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ea.getBarycoord(e,t,i,r,n)},normal:function(e,t,i,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),ea.getNormal(e,t,i,r)}}),Object.assign(ah.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Cc(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Vc(this,e)}}),Object.assign(Vt.prototype,{fromAttribute:function(e,t,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Xt.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(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Li.prototype,{fromAttribute:function(e,t,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Or.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(Er.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties(Er.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},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(As.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Ps.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Rs.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Fl.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),Bo.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(oh.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Dr.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(nn.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},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(nn.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(Ic.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(tp.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(hn.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}}}),Object.defineProperties(nl.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(Qn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(xs.prototype,{clearTarget:function(e,t,i,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,i,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},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(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},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(xs.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},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(Io.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(Pi.prototype,{activeCubeFace:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeCubeFace has been removed. It is now the second parameter of WebGLRenderer.setRenderTarget().")}},activeMipMapLevel:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeMipMapLevel has been removed. It is now the third parameter of WebGLRenderer.setRenderTarget().")}}}),Object.defineProperties(Ai.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(vs.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}}),su.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new iu).load(e,function(e){t.setBuffer(e)}),this},lu.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},nu.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var Np={merge:function(e,t,i){var r;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,i)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};Ei.crossOrigin=void 0,Ei.loadTexture=function(e,t,i,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new Ul;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,i,void 0,r);return t&&(a.mapping=t),a},Ei.loadTextureCube=function(e,t,i,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new Nl;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,i,void 0,r);return t&&(a.mapping=t),a},Ei.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Ei.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Up={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")}};e.WebGLMultisampleRenderTarget=Ri,e.WebGLRenderTargetCube=Pi,e.WebGLRenderTarget=Ai,e.WebGLRenderer=xs,e.ShaderLib=$i,e.UniformsLib=Qi,e.UniformsUtils=ji,e.ShaderChunk=Bi,e.FogExp2=bs,e.Fog=ws,e.Scene=_s,e.Sprite=Ss,e.LOD=As,e.SkinnedMesh=Rs,e.Skeleton=Ps,e.Bone=Cs,e.Mesh=ia,e.LineSegments=Ds,e.LineLoop=Ns,e.Line=Os,e.Points=Fs,e.Group=Uo,e.VideoTexture=Bs,e.DataTexture=Ci,e.DataTexture3D=va,e.CompressedTexture=zs,e.CubeTexture=ga,e.CanvasTexture=Gs,e.DepthTexture=Hs,e.Texture=Si,e.AnimationLoader=Cl,e.CompressedTextureLoader=Il,e.DataTextureLoader=Ol,e.CubeTextureLoader=Nl,e.TextureLoader=Ul,e.ObjectLoader=wh,e.MaterialLoader=vh,e.BufferGeometryLoader=xh,e.DefaultLoadingManager=Al,e.LoadingManager=Ll,e.ImageLoader=Dl,e.ImageBitmapLoader=Ph,e.FontLoader=Dh,e.FileLoader=Pl,e.Loader=Nh,e.LoaderUtils=yh,e.Cache=Sl,e.AudioLoader=iu,e.SpotLightShadow=lh,e.SpotLight=hh,e.PointLight=uh,e.RectAreaLight=gh,e.HemisphereLight=sh,e.DirectionalLightShadow=dh,e.DirectionalLight=fh,e.AmbientLight=mh,e.LightShadow=ch,e.Light=oh,e.StereoCamera=ru,e.PerspectiveCamera=Bo,e.OrthographicCamera=ph,e.CubeCamera=nu,e.ArrayCamera=zo,e.Camera=Fo,e.AudioListener=ou,e.PositionalAudio=cu,e.AudioContext=tu,e.AudioAnalyser=lu,e.Audio=su,e.VectorKeyframeTrack=Ml,e.StringKeyframeTrack=_l,e.QuaternionKeyframeTrack=wl,e.NumberKeyframeTrack=xl,e.ColorKeyframeTrack=yl,e.BooleanKeyframeTrack=vl,e.PropertyMixer=hu,e.PropertyBinding=Ku,e.KeyframeTrack=gl,e.AnimationUtils=ul,e.AnimationObjectGroup=Qu,e.AnimationMixer=ep,e.AnimationClip=El,e.Uniform=tp,e.InstancedBufferGeometry=ip,e.BufferGeometry=nn,e.Geometry=Or,e.InterleavedBufferAttribute=Es,e.InstancedInterleavedBuffer=rp,e.InterleavedBuffer=Ms,e.InstancedBufferAttribute=np,e.Face3=ir,e.Object3D=Er,e.Raycaster=ap,e.Layers=nr,e.EventDispatcher=t,e.Clock=au,e.QuaternionLinearInterpolant=bl,e.LinearInterpolant=fl,e.DiscreteInterpolant=ml,e.CubicInterpolant=dl,e.Interpolant=pl,e.Triangle=ea,e.Math=kt,e.Spherical=cp,e.Cylindrical=lp,e.Plane=Ui,e.Frustum=Fi,e.Sphere=Ni,e.Ray=$n,e.Matrix4=jt,e.Matrix3=qt,e.Box3=Ii,e.Box2=hp,e.Line3=up,e.Euler=rr,e.Vector4=Li,e.Vector3=Xt,e.Vector2=Vt,e.Quaternion=Wt,e.Color=Xi,e.ImmediateRenderObject=pp,e.VertexNormalsHelper=dp,e.SpotLightHelper=fp,e.SkeletonHelper=mp,e.PointLightHelper=gp,e.RectAreaLightHelper=vp,e.HemisphereLightHelper=yp,e.GridHelper=xp,e.PolarGridHelper=bp,e.PositionalAudioHelper=wp,e.FaceNormalsHelper=_p,e.DirectionalLightHelper=Mp,e.CameraHelper=Ep,e.BoxHelper=Sp,e.Box3Helper=Lp,e.PlaneHelper=Ap,e.ArrowHelper=Rp,e.AxesHelper=Pp,e.Shape=ah,e.Path=nh,e.ShapePath=Ch,e.Font=Ih,e.CurvePath=rh,e.Curve=Fl,e.ImageUtils=Ei,e.ShapeUtils=Ac,e.WebGLUtils=No,e.WireframeGeometry=ks,e.ParametricGeometry=Vs,e.ParametricBufferGeometry=js,e.TetrahedronGeometry=qs,e.TetrahedronBufferGeometry=Ys,e.OctahedronGeometry=Zs,e.OctahedronBufferGeometry=Js,e.IcosahedronGeometry=Ks,e.IcosahedronBufferGeometry=Qs,e.DodecahedronGeometry=$s,e.DodecahedronBufferGeometry=ec,e.PolyhedronGeometry=Ws,e.PolyhedronBufferGeometry=Xs,e.TubeGeometry=tc,e.TubeBufferGeometry=ic,e.TorusKnotGeometry=rc,e.TorusKnotBufferGeometry=nc,e.TorusGeometry=ac,e.TorusBufferGeometry=oc,e.TextGeometry=Nc,e.TextBufferGeometry=Uc,e.SphereGeometry=Fc,e.SphereBufferGeometry=Bc,e.RingGeometry=zc,e.RingBufferGeometry=Gc,e.PlaneGeometry=sn,e.PlaneBufferGeometry=cn,e.LatheGeometry=Hc,e.LatheBufferGeometry=kc,e.ShapeGeometry=Vc,e.ShapeBufferGeometry=jc,e.ExtrudeGeometry=Cc,e.ExtrudeBufferGeometry=Ic,e.EdgesGeometry=Xc,e.ConeGeometry=Zc,e.ConeBufferGeometry=Jc,e.CylinderGeometry=qc,e.CylinderBufferGeometry=Yc,e.CircleGeometry=Kc,e.CircleBufferGeometry=Qc,e.BoxGeometry=an,e.CubeGeometry=an,e.BoxBufferGeometry=on,e.ShadowMaterial=el,e.SpriteMaterial=Ts,e.RawShaderMaterial=tl,e.ShaderMaterial=Qn,e.PointsMaterial=Us,e.MeshPhysicalMaterial=rl,e.MeshStandardMaterial=il,e.MeshPhongMaterial=nl,e.MeshToonMaterial=al,e.MeshNormalMaterial=ol,e.MeshLambertMaterial=sl,e.MeshDepthMaterial=Po,e.MeshDistanceMaterial=Co,e.MeshBasicMaterial=ta,e.MeshMatcapMaterial=cl,e.LineDashedMaterial=ll,e.LineBasicMaterial=Is,e.Material=hn,e.Float64BufferAttribute=Vr,e.Float32BufferAttribute=kr,e.Uint32BufferAttribute=Hr,e.Int32BufferAttribute=Gr,e.Uint16BufferAttribute=zr,e.Int16BufferAttribute=Br,e.Uint8ClampedBufferAttribute=Fr,e.Uint8BufferAttribute=Ur,e.Int8BufferAttribute=Nr,e.BufferAttribute=Dr,e.ArcCurve=zl,e.CatmullRomCurve3=Wl,e.CubicBezierCurve=Zl,e.CubicBezierCurve3=Jl,e.EllipseCurve=Bl,e.LineCurve=Kl,e.LineCurve3=Ql,e.QuadraticBezierCurve=$l,e.QuadraticBezierCurve3=eh,e.SplineCurve=th,e.REVISION="102",e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=X,e.CullFaceBack=q,e.CullFaceFront=Y,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=z,e.PCFSoftShadowMap=G,e.FrontSide=N,e.BackSide=_e,e.DoubleSide=Z,e.FlatShading=1,e.SmoothShading=2,e.NoColors=E,e.FaceColors=1,e.VertexColors=T,e.NoBlending=J,e.NormalBlending=K,e.AdditiveBlending=Q,e.SubtractiveBlending=$,e.MultiplyBlending=ee,e.CustomBlending=te,e.AddEquation=ie,e.SubtractEquation=S,e.ReverseSubtractEquation=L,e.MinEquation=A,e.MaxEquation=R,e.ZeroFactor=P,e.OneFactor=C,e.SrcColorFactor=I,e.OneMinusSrcColorFactor=O,e.SrcAlphaFactor=D,e.OneMinusSrcAlphaFactor=U,e.DstAlphaFactor=F,e.OneMinusDstAlphaFactor=B,e.DstColorFactor=H,e.OneMinusDstColorFactor=k,e.SrcAlphaSaturateFactor=V,e.NeverDepth=re,e.AlwaysDepth=ne,e.LessDepth=ae,e.LessEqualDepth=oe,e.EqualDepth=se,e.GreaterEqualDepth=ce,e.GreaterDepth=le,e.NotEqualDepth=he,e.MultiplyOperation=j,e.MixOperation=W,e.AddOperation=ue,e.NoToneMapping=pe,e.LinearToneMapping=Me,e.ReinhardToneMapping=de,e.Uncharted2ToneMapping=fe,e.CineonToneMapping=me,e.ACESFilmicToneMapping=ge,e.UVMapping=300,e.CubeReflectionMapping=ve,e.CubeRefractionMapping=ye,e.EquirectangularReflectionMapping=xe,e.EquirectangularRefractionMapping=be,e.SphericalReflectionMapping=we,e.CubeUVReflectionMapping=Ee,e.CubeUVRefractionMapping=Te,e.RepeatWrapping=Se,e.ClampToEdgeWrapping=Le,e.MirroredRepeatWrapping=Ae,e.NearestFilter=Re,e.NearestMipMapNearestFilter=Pe,e.NearestMipMapLinearFilter=Ce,e.LinearFilter=Ie,e.LinearMipMapNearestFilter=Oe,e.LinearMipMapLinearFilter=De,e.UnsignedByteType=Ne,e.ByteType=Ue,e.ShortType=Fe,e.UnsignedShortType=Be,e.IntType=ze,e.UnsignedIntType=Ge,e.FloatType=He,e.HalfFloatType=ke,e.UnsignedShort4444Type=Ve,e.UnsignedShort5551Type=je,e.UnsignedShort565Type=We,e.UnsignedInt248Type=Xe,e.AlphaFormat=qe,e.RGBFormat=Ye,e.RGBAFormat=Ze,e.LuminanceFormat=Je,e.LuminanceAlphaFormat=Ke,e.RGBEFormat=Qe,e.DepthFormat=$e,e.DepthStencilFormat=et,e.RedFormat=tt,e.RGB_S3TC_DXT1_Format=it,e.RGBA_S3TC_DXT1_Format=rt,e.RGBA_S3TC_DXT3_Format=nt,e.RGBA_S3TC_DXT5_Format=at,e.RGB_PVRTC_4BPPV1_Format=ot,e.RGB_PVRTC_2BPPV1_Format=st,e.RGBA_PVRTC_4BPPV1_Format=ct,e.RGBA_PVRTC_2BPPV1_Format=lt,e.RGB_ETC1_Format=ht,e.RGBA_ASTC_4x4_Format=ut,e.RGBA_ASTC_5x4_Format=pt,e.RGBA_ASTC_5x5_Format=dt,e.RGBA_ASTC_6x5_Format=ft,e.RGBA_ASTC_6x6_Format=mt,e.RGBA_ASTC_8x5_Format=gt,e.RGBA_ASTC_8x6_Format=vt,e.RGBA_ASTC_8x8_Format=yt,e.RGBA_ASTC_10x5_Format=xt,e.RGBA_ASTC_10x6_Format=bt,e.RGBA_ASTC_10x8_Format=wt,e.RGBA_ASTC_10x10_Format=_t,e.RGBA_ASTC_12x10_Format=Mt,e.RGBA_ASTC_12x12_Format=Et,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=Tt,e.InterpolateLinear=St,e.InterpolateSmooth=2302,e.ZeroCurvatureEnding=Lt,e.ZeroSlopeEnding=At,e.WrapAroundEnding=Rt,e.TrianglesDrawMode=Pt,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=Ct,e.sRGBEncoding=It,e.GammaEncoding=Ot,e.RGBEEncoding=Dt,e.LogLuvEncoding=3003,e.RGBM7Encoding=Nt,e.RGBM16Encoding=Ut,e.RGBDEncoding=Ft,e.BasicDepthPacking=Bt,e.RGBADepthPacking=zt,e.TangentSpaceNormalMap=Gt,e.ObjectSpaceNormalMap=Ht,e.Face4=function(e,t,i,r,n,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ir(e,t,i,n,a,o)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,(e.materials=e).clone=function(){return e.slice()},e},e.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Fs(e,t)},e.Particle=function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Ss(e)},e.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Fs(e,t)},e.PointCloudMaterial=function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Us(e)},e.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Us(e)},e.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Us(e)},e.Vertex=function(e,t,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Xt(e,t,i)},e.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Dr(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Nr(e,t)},e.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ur(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Fr(e,t)},e.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Br(e,t)},e.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new zr(e,t)},e.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Gr(e,t)},e.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Hr(e,t)},e.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new kr(e,t)},e.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Vr(e,t)},e.ClosedSplineCurve3=Ip,e.SplineCurve3=Op,e.Spline=Dp,e.AxisHelper=function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Pp(e)},e.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Sp(e,t)},e.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Ds(new Xc(e.geometry),new Is({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Ds(new ks(e.geometry),new Is({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Pl(e)},e.BinaryTextureLoader=function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Ol(e)},e.GeometryUtils=Np,e.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},e.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},e.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")},e.SceneUtils=Up,e.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")},Object.defineProperty(e,"__esModule",{value:!0})},"object"===(void 0===i?"undefined":_typeof(i))&&void 0!==t?n(i):"function"==typeof define&&define.amd?define(["exports"],n):n((r=r||self).THREE={})},{}],3:[function(e,t,i){var m=e("three"),g=(e("../Threebox.js"),e("../Utils/Utils.js")),v=e("../constants.js");function r(e,t,i){this.map=e,this.camera=t,this.active=!0,this.camera.matrixAutoUpdate=!1,this.world=i||new m.Group,this.world.position.x=this.world.position.y=v.WORLD_SIZE/2,this.world.matrixAutoUpdate=!1;var r=this;this.map.on("move",function(){r.updateCamera()}),this.updateCamera()}r.prototype={updateCamera:function(){if(this.camera){var e=.6435011087932844,t=.5/Math.tan(e/2)*this.map.transform.height,i=e/2,r=Math.PI/2+this.map.transform._pitch,n=Math.sin(i)*t/Math.sin(Math.PI-r-i),a=1.01*(Math.cos(Math.PI/2-this.map.transform._pitch)*n+t);this.camera.projectionMatrix=g.makePerspectiveMatrix(e,this.map.transform.width/this.map.transform.height,1,a);var o=new m.Matrix4,s=(new m.Matrix4).makeTranslation(0,0,t),c=(new m.Matrix4).makeRotationX(this.map.transform._pitch),l=(new m.Matrix4).makeRotationZ(this.map.transform.angle);o.premultiply(s).premultiply(c).premultiply(l),this.camera.matrixWorld.copy(o);var h=this.map.transform.scale,u=new m.Matrix4,p=new m.Matrix4,d=new m.Matrix4,f=new m.Matrix4;u.makeScale(h,h,h),this.map._tileExtent?p.makeTranslation(-this.map._tileExtent[0]*v.WORLD_SIZE/(this.map._tileExtent[2]-this.map._tileExtent[0]),-this.map._tileExtent[3]*v.WORLD_SIZE/(this.map._tileExtent[3]-this.map._tileExtent[1]),0):p.makeTranslation(v.WORLD_SIZE/2,-v.WORLD_SIZE/2,0),d.makeTranslation(-this.map.transform.x||-this.map.transform.point.x,this.map.transform.y||this.map.transform.point.y,0),f.makeRotationZ(Math.PI),this.world.matrix=new m.Matrix4,this.world.matrix.premultiply(f).premultiply(p).premultiply(u).premultiply(d)}else console.log("nocamera")}},t.exports=r},{"../Threebox.js":11,"../Utils/Utils.js":12,"../constants.js":14,three:2}],4:[function(e,t,i){var o=e("three"),r=(e("../constants.js"),e("../Utils/Utils.js"),e("../Utils/ValueGenerator.js")),s=e("../Loaders/OBJLoader.js"),c=e("../Loaders/MTLLoader.js");function n(e,t){var i=this;if(void 0===t)return console.error("Invalid options provided to SymbolLayer3D");(void 0===t.scale&&(t.scale=1),void 0===t.rotation&&(t.rotation=0),void 0===t.scaleWithMapProjection&&(t.scaleWithMapProjection=!0),(void 0===t.key||""===t.key||"object"===_typeof(t.key)&&void 0===t.key.property&&void 0===t.key.generator)&&(t.key={generator:function(e,t){return t}},console.warn("Using array index for SymbolLayer3D key property.")),this.parent=e,this.id=t.id,this.keyGen=r(t.key),"string"==typeof t.source?this.sourcePath=t.source:this.source=t.source,this.modelDirectoryGen=r(t.modelDirectory),this.modelNameGen=r(t.modelName),this.rotationGen=r(t.rotation),this.scaleGen=r(t.scale),this.models=Object.create(null),this.features=Object.create(null),this.scaleWithMapProjection=t.scaleWithMapProjection,this.loaded=!1,this.sourcePath)?(new o.FileLoader).load(this.sourcePath,function(e){i.source=JSON.parse(e),i._initialize()},function(){return null},function(e){return console.error("Could not load SymbolLayer3D source file.")}):this._initialize()}n.prototype={updateSourceData:function(e,t){var a=this,o={};if(!e.features)return console.error("updateSourceData expects a GeoJSON FeatureCollection with a 'features' property");if(e.features.forEach(function(e,t){var i=a.keyGen(e,t);if(i in a.features)a.features[i].geojson=e,o[i]=e;else{var r=a.modelDirectoryGen(e,t),n=a.modelNameGen(e,t);a.features[i]={geojson:e,model:r+n}}}),this._addOrUpdateFeatures(this.features),t)for(key in this.features)!key in o&&this.removeFeature(key);this.source=e},removeFeature:function(e){this.parent.remove(this.features[e].rawObject),delete this.features[e]},_initialize:function(){var a=this,o=[];if(!this.modelNameGen)return console.error("Invalid model name definition provided to SymbolLayer3D");if(!this.modelDirectoryGen)return console.error("Invalid model directory definition provided to SymbolLayer3D");this.source.features.forEach(function(e,t){var i=a.keyGen(e,t);void 0!==a.features[i]&&console.warn("Features with duplicate key: "+i);var r=a.modelDirectoryGen(e,t),n=a.modelNameGen(e,t);a.features[i]={geojson:e,model:r+n},o.push({directory:r,name:n})}),o.forEach(function(e){return a.models[e.directory+e.name]={directory:e.directory,name:e.name,loaded:!1}});var r=Object.keys(this.models).length;console.log("Loading "+r+" models",this.models);function e(){var i,t=new s,e=new c;i=m,n=function(e){if(e){for(material in e.preload(),e.materials)e.materials[material].shininess/=50;t.setMaterials(e)}t.setPath(a.models[i].directory),console.log("Loading model ",i),t.load(a.models[i].name+".obj",function(e){var t;a.models[i].obj=e,a.models[i].isMesh=e.isMesh,a.models[i].loaded=!0,t=i,console.log("Model complete!",t),0==--r&&(a.loaded=!0,a._addOrUpdateFeatures(a.features))},function(){return null},function(e){console.error("Could not load SymbolLayer3D model file.")})},e.setPath(a.models[m].directory),e.load(a.models[m].name+".mtl",n,function(){return null},function(e){console.warn("No material file found for SymbolLayer3D model "+m),n()})}for(m in this.models){var n;e()}},_addOrUpdateFeatures:function(e){for(key in e){var t,i=e[key],r=i.geojson.geometry.coordinates,n=this.scaleGen(i.geojson),a=this.rotationGen(i.geojson);i.rawObject?(t=i.rawObject,this.parent.moveToCoordinate(t,r,{scaleToLatitude:this.scaleWithMapProjection,preScale:n})):(t=i.model&&this.models[i.model]&&this.models[i.model].obj&&this.models[i.model].loaded?this.models[i.model].obj.clone():(console.warn("Model not loaded: "+i.model),new o.Group),i.rawObject=t,this.parent.addAtCoordinate(t,r,{scaleToLatitude:this.scaleWithMapProjection,preScale:n})),t.rotation.copy(a)}}},t.exports=n},{"../Loaders/MTLLoader.js":9,"../Loaders/OBJLoader.js":10,"../Utils/Utils.js":12,"../Utils/ValueGenerator.js":13,"../constants.js":14,three:2}],5:[function(e,t,i){var B=e("three");!function(){function x(e){var t,i=e.Content,r=e.RelativeFilename||e.Filename,n=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(n){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;default:return void console.warn('FBXLoader: Image type "'+n+'" is not supported.')}if("string"==typeof i)return"data:"+t+";base64,"+i;var a=new Uint8Array(i);return window.URL.createObjectURL(new Blob([a],{type:t}))}function b(e,t,i,r){var n=function(e,t,i,r){var n,a=t.path,o=r.get(e.id).children;void 0!==o&&0<o.length&&void 0!==i[o[0].ID]&&(0!==(n=i[o[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||t.setPath(void 0));var s=t.load(n);return t.setPath(a),s}(e,t,i,r);n.ID=e.id,n.name=e.attrName;var a=e.WrapModeU,o=e.WrapModeV,s=void 0!==a?a.value:0,c=void 0!==o?o.value:0;if(n.wrapS=0===s?B.RepeatWrapping:B.ClampToEdgeWrapping,n.wrapT=0===c?B.RepeatWrapping:B.ClampToEdgeWrapping,"Scaling"in e){var l=e.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}return n}function w(e,t,i,r){var n=t.id,a=t.attrName,o=t.ShadingModel;if("object"===(void 0===o?"undefined":_typeof(o))&&(o=o.value),!r.has(n))return null;var s,c=function(i,e,r,t,n){var a={};e.BumpFactor&&(a.bumpScale=e.BumpFactor.value);e.Diffuse?a.color=(new B.Color).fromArray(e.Diffuse.value):e.DiffuseColor&&"Color"===e.DiffuseColor.type&&(a.color=(new B.Color).fromArray(e.DiffuseColor.value));e.DisplacementFactor&&(a.displacementScale=e.DisplacementFactor.value);e.Emissive?a.emissive=(new B.Color).fromArray(e.Emissive.value):e.EmissiveColor&&"Color"===e.EmissiveColor.type&&(a.emissive=(new B.Color).fromArray(e.EmissiveColor.value));e.EmissiveFactor&&(a.emissiveIntensity=parseFloat(e.EmissiveFactor.value));e.Opacity&&(a.opacity=parseFloat(e.Opacity.value));a.opacity<1&&(a.transparent=!0);e.ReflectionFactor&&(a.reflectivity=e.ReflectionFactor.value);e.Shininess&&(a.shininess=e.Shininess.value);e.Specular?a.specular=(new B.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(a.specular=(new B.Color).fromArray(e.SpecularColor.value));return n.get(t).children.forEach(function(e){var t=e.relationship;switch(t){case"Bump":a.bumpMap=r.get(e.ID);break;case"DiffuseColor":a.map=l(i,r,e.ID,n);break;case"DisplacementColor":a.displacementMap=l(i,r,e.ID,n);break;case"EmissiveColor":a.emissiveMap=l(i,r,e.ID,n);break;case"NormalMap":a.normalMap=l(i,r,e.ID,n);break;case"ReflectionColor":a.envMap=l(i,r,e.ID,n),a.envMap.mapping=B.EquirectangularReflectionMapping;break;case"SpecularColor":a.specularMap=l(i,r,e.ID,n);break;case"TransparentColor":a.alphaMap=l(i,r,e.ID,n),a.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",t)}}),a}(e,t,i,n,r);switch(o.toLowerCase()){case"phong":s=new B.MeshPhongMaterial;break;case"lambert":s=new B.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),s=new B.MeshPhongMaterial({color:3342591})}return s.setValues(c),s.name=a,s}function l(e,t,i,r){return"LayeredTexture"in e.Objects&&i in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),i=r.get(i).children[0].ID),t.get(i)}function _(e,r){var n=[];return e.children.forEach(function(e){var t=r[e.ID];if("Cluster"===t.attrType){var i={ID:e.ID,indices:[],weights:[],transform:(new B.Matrix4).fromArray(t.Transform.a),transformLink:(new B.Matrix4).fromArray(t.TransformLink.a),linkMode:t.Mode};"Indexes"in t&&(i.indices=t.Indexes.a,i.weights=t.Weights.a),n.push(i)}}),{rawBones:n,bones:[]}}function M(e,t,i,r){switch(i.attrType){case"Mesh":return function(t,e,i,r){var n=e.parents.map(function(e){return t.Objects.Model[e.ID]});if(0===n.length)return;var a=e.children.reduce(function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e},null),o=new B.Matrix4,s=n[0];if("GeometricRotation"in s){var c=s.GeometricRotation.value.map(B.Math.degToRad);c[3]="ZYX",o.makeRotationFromEuler((new B.Euler).fromArray(c))}"GeometricTranslation"in s&&o.setPosition((new B.Vector3).fromArray(s.GeometricTranslation.value));"GeometricScaling"in s&&o.scale((new B.Vector3).fromArray(s.GeometricScaling.value));return function(e,h,t){var u=e.Vertices.a,p=e.PolygonVertexIndex.a,d=[],f=[],m=[],g=[],v=[],y=[],x=[];if(e.LayerElementColor)var b=function(e){var t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Colors.a,n=[];"IndexToDirect"===i&&(n=e.ColorIndex.a);return{dataSize:4,buffer:r,indices:n,mappingType:t,referenceType:i}}(e.LayerElementColor[0]);if(e.LayerElementMaterial)var w=function(e){var t=e.MappingInformationType,i=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};for(var r=e.Materials.a,n=[],a=0;a<r.length;++a)n.push(a);return{dataSize:1,buffer:r,indices:n,mappingType:t,referenceType:i}}(e.LayerElementMaterial[0]);if(e.LayerElementNormal)var _=function(e){var t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Normals.a,n=[];"IndexToDirect"===i&&("NormalIndex"in e?n=e.NormalIndex.a:"NormalsIndex"in e&&(n=e.NormalsIndex.a));return{dataSize:3,buffer:r,indices:n,mappingType:t,referenceType:i}}(e.LayerElementNormal[0]);if(e.LayerElementUV)for(var M=[],i=0;e.LayerElementUV[i];)M.push(D(e.LayerElementUV[i])),i++;var E={};null!==h&&h.rawBones.forEach(function(i,r){i.indices.forEach(function(e,t){void 0===E[e]&&(E[e]=[]),E[e].push({id:r,weight:i.weights[t]})})});var T=0,S=0,L=!1,A=[],R=[],P=[],C=[],I=[],O=[];p.forEach(function(r,n){var e=!1;r<0&&(r^=-1,p[n]=r,e=!0);var i=[],t=[];if(A.push(3*r,3*r+1,3*r+2),b){var a=N(n,T,r,b);P.push(a[0],a[1],a[2])}if(h){if(void 0!==E[r]&&E[r].forEach(function(e){t.push(e.weight),i.push(e.id)}),4<t.length){L||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),L=!0);var o=[0,0,0,0],s=[0,0,0,0];t.forEach(function(e,t){var n=e,a=i[t];s.forEach(function(e,t,i){if(e<n){i[t]=n,n=e;var r=o[t];o[t]=a,a=r}})}),i=o,t=s}for(;t.length<4;)t.push(0),i.push(0);for(var c=0;c<4;++c)I.push(t[c]),O.push(i[c])}if(_){a=N(n,T,r,_);R.push(a[0],a[1],a[2])}if(w&&"AllSame"!==w.mappingType)var l=N(n,T,r,w)[0];if(M&&M.forEach(function(e,t){var i=N(n,T,r,e);void 0===C[t]&&(C[t]=[]),C[t].push(i[0]),C[t].push(i[1])}),S++,e){for(c=2;c<S;c++)d.push(u[A[0]]),d.push(u[A[1]]),d.push(u[A[2]]),d.push(u[A[3*(c-1)]]),d.push(u[A[3*(c-1)+1]]),d.push(u[A[3*(c-1)+2]]),d.push(u[A[3*c]]),d.push(u[A[3*c+1]]),d.push(u[A[3*c+2]]),h&&(y.push(I[0]),y.push(I[1]),y.push(I[2]),y.push(I[3]),y.push(I[4*(c-1)]),y.push(I[4*(c-1)+1]),y.push(I[4*(c-1)+2]),y.push(I[4*(c-1)+3]),y.push(I[4*c]),y.push(I[4*c+1]),y.push(I[4*c+2]),y.push(I[4*c+3]),x.push(O[0]),x.push(O[1]),x.push(O[2]),x.push(O[3]),x.push(O[4*(c-1)]),x.push(O[4*(c-1)+1]),x.push(O[4*(c-1)+2]),x.push(O[4*(c-1)+3]),x.push(O[4*c]),x.push(O[4*c+1]),x.push(O[4*c+2]),x.push(O[4*c+3])),b&&(m.push(P[0]),m.push(P[1]),m.push(P[2]),m.push(P[3*(c-1)]),m.push(P[3*(c-1)+1]),m.push(P[3*(c-1)+2]),m.push(P[3*c]),m.push(P[3*c+1]),m.push(P[3*c+2])),w&&"AllSame"!==w.mappingType&&(v.push(l),v.push(l),v.push(l)),_&&(f.push(R[0]),f.push(R[1]),f.push(R[2]),f.push(R[3*(c-1)]),f.push(R[3*(c-1)+1]),f.push(R[3*(c-1)+2]),f.push(R[3*c]),f.push(R[3*c+1]),f.push(R[3*c+2])),M&&M.forEach(function(e,t){void 0===g[t]&&(g[t]=[]),g[t].push(C[t][0]),g[t].push(C[t][1]),g[t].push(C[t][2*(c-1)]),g[t].push(C[t][2*(c-1)+1]),g[t].push(C[t][2*c]),g[t].push(C[t][2*c+1])});T++,S=0,A=[],R=[],P=[],C=[],I=[],O=[]}});var r=new B.BufferGeometry;r.name=e.name;var n=new B.Float32BufferAttribute(d,3);t.applyToBufferAttribute(n),r.addAttribute("position",n),0<m.length&&r.addAttribute("color",new B.Float32BufferAttribute(m,3));h&&(r.addAttribute("skinIndex",new B.Uint16BufferAttribute(x,4)),r.addAttribute("skinWeight",new B.Float32BufferAttribute(y,4)),r.FBX_Deformer=h);if(0<f.length){var a=new B.Float32BufferAttribute(f,3);(new B.Matrix3).getNormalMatrix(t).applyToBufferAttribute(a),r.addAttribute("normal",a)}if(g.forEach(function(e,t){var i="uv"+(t+1).toString();0===t&&(i="uv"),r.addAttribute(i,new B.Float32BufferAttribute(g[t],2))}),w&&"AllSame"!==w.mappingType){var o=v[0],s=0;if(v.forEach(function(e,t){e!==o&&(r.addGroup(s,t-s,o),o=e,s=t)}),0<r.groups.length){var c=r.groups[r.groups.length-1],l=c.start+c.count;l!==v.length&&r.addGroup(l,v.length-l,o)}0===r.groups.length&&r.addGroup(0,v.length,v[0])}return r}(i,a,o)}(e,t,i,r);case"NurbsCurve":return function(e){if(void 0===B.NURBSCurve)return console.error("THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new B.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new B.BufferGeometry;for(var i,r,n=t-1,a=e.KnotVector.a,o=[],s=e.Points.a,c=0,l=s.length;c<l;c+=4)o.push((new B.Vector4).fromArray(s,c));if("Closed"===e.Form)o.push(o[0]);else if("Periodic"===e.Form){i=n,r=a.length-1-i;for(c=0;c<n;++c)o.push(o[c])}var h=new B.NURBSCurve(n,a,o,i,r).getPoints(7*o.length),u=new Float32Array(3*h.length);h.forEach(function(e,t){e.toArray(u,3*t)});var p=new B.BufferGeometry;return p.addAttribute("position",new B.BufferAttribute(u,3)),p}(i)}}function D(e){var t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.UV.a,n=[];return"IndexToDirect"===i&&(n=e.UVIndex.a),{dataSize:2,buffer:r,indices:n,mappingType:t,referenceType:i}}B.FBXLoader=function(e){this.manager=void 0!==e?e:B.DefaultLoadingManager},Object.assign(B.FBXLoader.prototype,{load:function(i,r,e,n){var a=this,o=B.LoaderUtils.extractUrlBase(i),t=new B.FileLoader(this.manager);t.setResponseType("arraybuffer"),t.load(i,function(e){try{var t=a.parse(e,o);r(t)}catch(e){window.setTimeout(function(){n&&n(e),a.manager.itemError(i)},0)}},e,n)},parse:function(e,t){var i,r,n;if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===F(r,0,n.length))i=(new I).parse(e);else{var a=F(e);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],i=0;for(var r=0;r<t.length;++r){if((a=e[(n=1)-1],e=e.slice(i+n),i++,a)===t[r])return!1}var n,a;return!0}(a))throw new Error("THREE.FBXLoader: Unknown format.");if(O(a)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+O(a));i=(new C).parse(a)}var o,s,c,l,h,u,p,d,f=function(e){var o=new Map;if("Connections"in e){e.Connections.connections.forEach(function(e){var t=e[0],i=e[1],r=e[2];o.has(t)||o.set(t,{parents:[],children:[]});var n={ID:i,relationship:r};o.get(t).parents.push(n),o.has(i)||o.set(i,{parents:[],children:[]});var a={ID:t,relationship:r};o.get(i).children.push(a)})}return o}(i),m=function(e){var t={},i={};if("Video"in e.Objects){var r=e.Objects.Video;for(var n in r){var a=r[n],o=parseInt(n);if(t[o]=a.Filename,"Content"in a){var s=a.Content instanceof ArrayBuffer&&0<a.Content.byteLength,c="string"==typeof a.Content&&""!==a.Content;if(s||c){var l=x(r[n]);i[a.Filename]=l}}}}for(var o in t){var h=t[o];void 0!==i[h]?t[o]=i[h]:t[o]=t[o].split("\\").pop()}return t}(i),g=function(e,t,i){var r=new Map;if("Material"in e.Objects){var n=e.Objects.Material;for(var a in n){var o=w(e,n[a],t,i);null!==o&&r.set(parseInt(a),o)}}return r}(i,function(e,t,i,r){var n=new Map;if("Texture"in e.Objects){var a=e.Objects.Texture;for(var o in a){var s=b(a[o],t,i,r);n.set(parseInt(o),s)}}return n}(i,new B.TextureLoader(this.manager).setPath(t),m,f),f),v=function(e,t){var i={};if("Deformer"in e.Objects){var r=e.Objects.Deformer;for(var n in r){if("Skin"===r[n].attrType){var a=t.get(parseInt(n)),o=_(a,r);o.ID=n,1<a.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,i[n]=o}}}return i}(i,f),y=function(e,t,i){var r=new Map;if("Geometry"in e.Objects){var n=e.Objects.Geometry;for(var a in n){var o=t.get(parseInt(a)),s=M(e,o,n[a],i);r.set(parseInt(a),s)}}return r}(i,f,v);return o=i,s=f,c=v,l=y,h=g,u=new B.Group,p=function(e,t,i,r,n){var a=new Map,o=e.Objects.Model;for(var s in o){var c=parseInt(s),l=o[s],h=n.get(c),u=E(h,t,c,l.attrName);if(!u){switch(l.attrType){case"Camera":u=T(e,h);break;case"Light":u=S(e,h);break;case"Mesh":u=L(e,h,i,r);break;case"NurbsCurve":u=A(h,i);break;case"LimbNode":case"Null":default:u=new B.Group}u.name=B.PropertyBinding.sanitizeNodeName(l.attrName),u.ID=c}R(e,u,l),a.set(c,u)}return a}(o,c,l,h,s),d=o.Objects.Model,p.forEach(function(i){var e=d[i.ID];!function(r,n,e,t,a){"LookAtProperty"in e&&t.get(n.ID).children.forEach(function(e){if("LookAtProperty"===e.relationship){var t=r.Objects.Model[e.ID];if("Lcl_Translation"in t){var i=t.Lcl_Translation.value;void 0!==n.target?(n.target.position.fromArray(i),a.add(n.target)):n.lookAt((new B.Vector3).fromArray(i))}}})}(o,i,e,s,u),s.get(i.ID).parents.forEach(function(e){var t=p.get(e.ID);void 0!==t&&t.add(i)}),null===i.parent&&u.add(i)}),function(e,t,i,r,n){var a=function(e){var t={};if("Pose"in e.Objects){var i=e.Objects.Pose;for(var r in i)if("BindPose"===i[r].attrType){var n=i[r].PoseNode;Array.isArray(n)?n.forEach(function(e){t[e.Node]=(new B.Matrix4).fromArray(e.Matrix.a)}):t[n.Node]=(new B.Matrix4).fromArray(n.Matrix.a)}}return t}(e);for(var o in t){var s=t[o];n.get(parseInt(s.ID)).parents.forEach(function(e){if(i.has(e.ID)){var t=e.ID;n.get(t).parents.forEach(function(e){r.has(e.ID)&&r.get(e.ID).bind(new B.Skeleton(s.bones),a[e.ID])})}})}}(o,c,l,p,s),function(e,t,i){i.animations=[];var r=function(e,t){if(void 0!==e.Objects.AnimationCurve){var i=function(e){var t=e.Objects.AnimationCurveNode,i=new Map;for(var r in t){var n=t[r];if(null!==n.attrName.match(/S|R|T/)){var a={id:n.id,attr:n.attrName,curves:{}};i.set(a.id,a)}}return i}(e);!function(e,t,i){var r=e.Objects.AnimationCurve;for(var n in r){for(var a={id:r[n].id,times:r[n].KeyTime.a.map(U),values:r[n].KeyValueFloat.a},o=a.times[0],s=0;s<a.times.length;s++)a.times[s]-=o;var c=t.get(a.id);if(void 0!==c){var l=c.parents[0].ID,h=c.parents[0].relationship,u="";if(h.match(/X/))u="x";else if(h.match(/Y/))u="y";else{if(!h.match(/Z/))continue;u="z"}i.get(l).curves[u]=a}}}(e,t,i);var r=function(o,s,c){var e=o.Objects.AnimationLayer,t=new Map;for(var i in e){var l=[],r=s.get(parseInt(i));void 0!==r&&(r.children.forEach(function(e,t){if(c.has(e.ID)){var i=c.get(e.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===l[t]){var r;s.get(e.ID).parents.forEach(function(e){void 0!==e.relationship&&(r=e.ID)});var n=o.Objects.Model[r.toString()],a={modelName:B.PropertyBinding.sanitizeNodeName(n.attrName),initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};"Lcl_Translation"in n&&(a.initialPosition=n.Lcl_Translation.value),"Lcl_Rotation"in n&&(a.initialRotation=n.Lcl_Rotation.value),"Lcl_Scaling"in n&&(a.initialScale=n.Lcl_Scaling.value),"PreRotation"in n&&(a.preRotations=n.PreRotation.value),l[t]=a}l[t][i.attr]=i}}}),t.set(parseInt(i),l))}return t}(e,t,i);return function(e,t,i){var r=e.Objects.AnimationStack,n={};for(var a in r){var o=t.get(parseInt(a)).children;1<o.length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var s=i.get(o[0].ID);n[a]={name:r[a].attrName,layer:s}}return n}(e,t,r)}}(e,t);if(void 0!==r)for(var n in r){var a=P(r[n]);i.animations.push(a)}}(o,s,u),function(e,t){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var i=e.GlobalSettings.AmbientColor.value,r=i[0],n=i[1],a=i[2];if(0!==r||0!==n||0!==a){var o=new B.Color(r,n,a);t.add(new B.AmbientLight(o,1))}}}(o,u),u}});var s=[];function N(e,t,i,r){var n;switch(r.mappingType){case"ByPolygonVertex":n=e;break;case"ByPolygon":n=t;break;case"ByVertice":n=i;break;case"AllSame":n=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(n=r.indices[n]);var a=n*r.dataSize,o=a+r.dataSize;return function(e,t,i,r){for(var n=i,a=0;n<r;n++,a++)e[a]=t[n];return e}(s,r.buffer,a,o)}function E(e,t,a,o){var s=null;return e.parents.forEach(function(r){for(var e in t){var n=t[e];n.rawBones.forEach(function(e,t){if(e.ID===r.ID){var i=s;(s=new B.Bone).matrixWorld.copy(e.transformLink),s.name=B.PropertyBinding.sanitizeNodeName(o),s.ID=a,n.bones[t]=s,null!==i&&s.add(i)}})}}),s}function T(i,e){var t,r;if(e.children.forEach(function(e){var t=i.Objects.NodeAttribute[e.ID];void 0!==t&&(r=t)}),void 0===r)t=new B.Object3D;else{var n=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1);var a=1;void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3);var o=1e3;void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3);var s=window.innerWidth,c=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,c=r.AspectHeight.value);var l=s/c,h=45;void 0!==r.FieldOfView&&(h=r.FieldOfView.value);var u=r.FocalLength?r.FocalLength.value:null;switch(n){case 0:t=new B.PerspectiveCamera(h,l,a,o),null!==u&&t.setFocalLength(u);break;case 1:t=new B.OrthographicCamera(-s/2,s/2,c/2,-c/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new B.Object3D}}return t}function S(i,e){var t,r;if(e.children.forEach(function(e){var t=i.Objects.NodeAttribute[e.ID];void 0!==t&&(r=t)}),void 0===r)t=new B.Object3D;else{var n;n=void 0===r.LightType?0:r.LightType.value;var a=16777215;void 0!==r.Color&&(a=(new B.Color).fromArray(r.Color.value));var o=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(o=0);var s=0;void 0!==r.FarAttenuationEnd&&(s=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(n){case 0:t=new B.PointLight(a,o,s,1);break;case 1:t=new B.DirectionalLight(a,o);break;case 2:var c=Math.PI/3;void 0!==r.InnerAngle&&(c=B.Math.degToRad(r.InnerAngle.value));var l=0;void 0!==r.OuterAngle&&(l=B.Math.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new B.SpotLight(a,o,s,c,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a THREE.PointLight."),t=new B.PointLight(a,o)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}function L(e,t,i,r){var n=null,a=null,o=[];return t.children.forEach(function(e){i.has(e.ID)&&(n=i.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))}),1<o.length?a=o:0<o.length?a=o[0]:(a=new B.MeshPhongMaterial({color:13421772}),o.push(a)),"color"in n.attributes&&o.forEach(function(e){e.vertexColors=B.VertexColors}),n.FBX_Deformer?(o.forEach(function(e){e.skinning=!0}),new B.SkinnedMesh(n,a)):new B.Mesh(n,a)}function A(e,i){var t=e.children.reduce(function(e,t){return i.has(t.ID)&&(e=i.get(t.ID)),e},null),r=new B.LineBasicMaterial({color:3342591,linewidth:1});return new B.Line(t,r)}function R(e,t,i){if("RotationOrder"in i){var r=parseInt(i.RotationOrder.value,10);0<r&&r<6?console.warn("THREE.FBXLoader: unsupported Euler Order: %s. Currently only XYZ order is supported. Animations and rotations may be incorrect.",["XYZ","XZY","YZX","ZXY","YXZ","ZYX","SphericXYZ"][r]):6===r&&console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.")}if("Lcl_Translation"in i&&t.position.fromArray(i.Lcl_Translation.value),"Lcl_Rotation"in i){var n=i.Lcl_Rotation.value.map(B.Math.degToRad);n.push("ZYX"),t.quaternion.setFromEuler((new B.Euler).fromArray(n))}if("Lcl_Scaling"in i&&t.scale.fromArray(i.Lcl_Scaling.value),"PreRotation"in i){var a=i.PreRotation.value.map(B.Math.degToRad);a[3]="ZYX";var o=(new B.Euler).fromArray(a);o=(new B.Quaternion).setFromEuler(o),t.quaternion.premultiply(o)}}function P(e){var t=[];return e.layer.forEach(function(e){t=t.concat(function(e){var t=[];if(void 0!==e.T&&0<Object.keys(e.T.curves).length){var i=a(e.modelName,e.T.curves,e.initialPosition,"position");void 0!==i&&t.push(i)}if(void 0!==e.R&&0<Object.keys(e.R.curves).length){var r=function(e,t,i,r){void 0!==t.x&&(t.x.values=t.x.values.map(B.Math.degToRad));void 0!==t.y&&(t.y.values=t.y.values.map(B.Math.degToRad));void 0!==t.z&&(t.z.values=t.z.values.map(B.Math.degToRad));var n=u(t),a=h(n,t,i);void 0!==r&&((r=r.map(B.Math.degToRad)).push("ZYX"),r=(new B.Euler).fromArray(r),r=(new B.Quaternion).setFromEuler(r));for(var o=new B.Quaternion,s=new B.Euler,c=[],l=0;l<a.length;l+=3)s.set(a[l],a[l+1],a[l+2],"ZYX"),o.setFromEuler(s),void 0!==r&&o.premultiply(r),o.toArray(c,l/3*4);return new B.QuaternionKeyframeTrack(e+".quaternion",n,c)}(e.modelName,e.R.curves,e.initialRotation,e.preRotations);void 0!==r&&t.push(r)}if(void 0!==e.S&&0<Object.keys(e.S.curves).length){var n=a(e.modelName,e.S.curves,e.initialScale,"scale");void 0!==n&&t.push(n)}return t}(e))}),new B.AnimationClip(e.name,-1,t)}function a(e,t,i,r){var n=u(t),a=h(n,t,i);return new B.VectorKeyframeTrack(e+"."+r,n,a)}function h(e,n,t){var a=t,o=[],s=-1,c=-1,l=-1;return e.forEach(function(e){if(n.x&&(s=n.x.times.indexOf(e)),n.y&&(c=n.y.times.indexOf(e)),n.z&&(l=n.z.times.indexOf(e)),-1!==s){var t=n.x.values[s];o.push(t),a[0]=t}else o.push(a[0]);if(-1!==c){var i=n.y.values[c];o.push(i),a[1]=i}else o.push(a[1]);if(-1!==l){var r=n.z.values[l];o.push(r),a[2]=r}else o.push(a[2])}),o}function u(e){var t=[];return void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}).filter(function(e,t,i){return i.indexOf(e)==t})}function C(){}function I(){}function c(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function o(){}function O(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function U(e){return e/46186158e3}function p(e){return e.split(",").map(function(e){return parseFloat(e)})}function F(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=e.byteLength),B.LoaderUtils.decodeText(new Uint8Array(e,t,i))}Object.assign(C.prototype,{getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),--this.currentIndent},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,this.allNodes=new o,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var s=this,c=e.split("\n");return c.forEach(function(e,t){var i=e.match(/^[\s\t]*;/),r=e.match(/^[\s\t]*$/);if(!i&&!r){var n=e.match("^\\t{"+s.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+s.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),o=e.match("^\\t{"+(s.currentIndent-1)+"}}");n?s.parseNodeBegin(e,n):a?s.parseNodeProperty(e,a,c[++t]):o?s.popStack():e.match(/^[^\s\t}]/)&&s.parseNodePropertyContinued(e)}}),this.allNodes},parseNodeBegin:function(e,t){var i=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")}),n={name:i},a=this.parseNodeAttr(r),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(i,n):i in o?("PoseNode"===i?o.PoseNode.push(n):void 0!==o[i].id&&(o[i]={},o[i][o[i].id]=o[i]),""!==a.id&&(o[i][a.id]=n)):"number"==typeof a.id?(o[i]={},o[i][a.id]=n):"Properties70"!==i&&(o[i]="PoseNode"===i?[n]:n),"number"==typeof a.id&&(n.id=a.id),""!==a.name&&(n.attrName=a.name),""!==a.type&&(n.attrType=a.type),this.pushStack(n)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var i="",r="";return 1<e.length&&(i=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:i,type:r}},parseNodeProperty:function(e,t,i){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),n=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===n&&(n=i.replace(/"/g,"").replace(/,$/,"").trim());var a=this.getCurrentNode();if("Properties70"!==a.name){if("C"===r){var o=n.split(",").slice(1),s=parseInt(o[0]),c=parseInt(o[1]),l=n.split(",").slice(3);r="connections",function(e,t){for(var i=0,r=e.length,n=t.length;i<n;i++,r++)e[r]=t[i]}(n=[s,c],l=l.map(function(e){return e.trim().replace(/^"/,"")})),void 0===a[r]&&(a[r]=[])}"Node"===r&&(a.id=n),r in a&&Array.isArray(a[r])?a[r].push(n):"a"!==r?a[r]=n:a.a=n,this.setCurrentProp(a,r),"a"===r&&","!==n.slice(-1)&&(a.a=p(n))}else this.parseNodeSpecialProperty(e,r,n)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=p(t.a))},parseNodeSpecialProperty:function(e,t,i){var r=i.split('",').map(function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}),n=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=p(c)}this.getPrevNode()[n]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),n)}}),Object.assign(I.prototype,{parse:function(e){var t=new c(e);t.skip(23);var i=t.getUint32();console.log("THREE.FBXLoader: FBX binary version: "+i);for(var r=new o;!this.endOfContent(t);){var n=this.parseNode(t,i);null!==n&&r.add(n.name,n)}return r},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var i={},r=7500<=t?e.getUint64():e.getUint32(),n=7500<=t?e.getUint64():e.getUint32(),a=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),o=e.getString(a);if(0===r)return null;for(var s=[],c=0;c<n;c++)s.push(this.parseProperty(e));var l=0<s.length?s[0]:"",h=1<s.length?s[1]:"",u=2<s.length?s[2]:"";for(i.singleProperty=1===n&&e.getOffset()===r;r>e.getOffset();){var p=this.parseNode(e,t);null!==p&&this.parseSubNode(o,i,p)}return i.propertyList=s,"number"==typeof l&&(i.id=l),""!==h&&(i.attrName=h),""!==u&&(i.attrType=u),""!==o&&(i.name=o),i},parseSubNode:function(e,t,i){if(!0===i.singleProperty){var r=i.propertyList[0];Array.isArray(r)?(t[i.name]=i).a=r:t[i.name]=r}else if("Connections"===e&&"C"===i.name){var n=[];i.propertyList.forEach(function(e,t){0!==t&&n.push(e)}),void 0===t.connections&&(t.connections=[]),t.connections.push(n)}else if("Properties70"===i.name){Object.keys(i).forEach(function(e){t[e]=i[e]})}else if("Properties70"===e&&"P"===i.name){var a,o=i.propertyList[0],s=i.propertyList[1],c=i.propertyList[2],l=i.propertyList[3];0===o.indexOf("Lcl ")&&(o=o.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),a="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:i.propertyList[4],t[o]={type:s,type2:c,flag:l,value:a}}else void 0===t[i.name]?"number"==typeof i.id?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:"PoseNode"===i.name?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):void 0===t[i.name][i.id]&&(t[i.name][i.id]=i)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":var i=e.getUint32();return e.getArrayBuffer(i);case"S":i=e.getUint32();return e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===window.Zlib&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var o=new c(new Zlib.Inflate(new Uint8Array(e.getArrayBuffer(a))).decompress().buffer);switch(t){case"b":case"c":return o.getBooleanArray(r);case"d":return o.getFloat64Array(r);case"f":return o.getFloat32Array(r);case"i":return o.getInt32Array(r);case"l":return o.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}),Object.assign(c.prototype,{getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e},getInt64Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=new Uint8Array(e),i=0;i<e;i++)t[i]=this.getUint8();var r=t.indexOf(0);return 0<=r&&(t=t.slice(0,r)),B.LoaderUtils.decodeText(t)}}),Object.assign(o.prototype,{add:function(e,t){this[e]=t}})}(),t.exports=B.FBXLoader},{three:2}],6:[function(e,t,i){var V=e("three");V.GLTFLoader=function(){function e(e){this.manager=void 0!==e?e:V.DefaultLoadingManager,this.dracoLoader=null}function r(){var i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}e.prototype={constructor:e,crossOrigin:"Anonymous",load:function(e,t,i,r){var n=this,a=void 0!==this.path?this.path:V.LoaderUtils.extractUrlBase(e),o=new V.FileLoader(n.manager);o.setResponseType("arraybuffer"),o.load(e,function(e){try{n.parse(e,a,t,r)}catch(e){if(void 0===r)throw e;r(e)}},i,r)},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setDRACOLoader:function(e){return this.dracoLoader=e,this},parse:function(e,t,a,i){var r,n={};if("string"==typeof e)r=e;else if(V.LoaderUtils.decodeText(new Uint8Array(e,0,4))===l){try{n[w.KHR_BINARY_GLTF]=new p(e)}catch(e){return void(i&&i(e))}r=n[w.KHR_BINARY_GLTF].content}else r=V.LoaderUtils.decodeText(new Uint8Array(e));var o=JSON.parse(r);void 0===o.asset||o.asset.version[0]<2?i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead.")):(o.extensionsUsed&&(0<=o.extensionsUsed.indexOf(w.KHR_LIGHTS)&&(n[w.KHR_LIGHTS]=new s(o)),0<=o.extensionsUsed.indexOf(w.KHR_MATERIALS_UNLIT)&&(n[w.KHR_MATERIALS_UNLIT]=new c(o)),0<=o.extensionsUsed.indexOf(w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS)&&(n[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]=new f),0<=o.extensionsUsed.indexOf(w.KHR_DRACO_MESH_COMPRESSION)&&(n[w.KHR_DRACO_MESH_COMPRESSION]=new d(this.dracoLoader))),console.time("GLTFLoader"),new G(o,n,{path:t||this.path||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(function(e,t,i,r,n){console.timeEnd("GLTFLoader"),a({scene:e,scenes:t,cameras:i,animations:r,asset:n})},i))}};var w={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS:"KHR_lights",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit"};function s(e){this.name=w.KHR_LIGHTS,this.lights={};var t=(e.extensions&&e.extensions[w.KHR_LIGHTS]||{}).lights||{};for(var i in t){var r,n=t[i],a=(new V.Color).fromArray(n.color);switch(n.type){case"directional":(r=new V.DirectionalLight(a)).target.position.set(0,0,1),r.add(r.target);break;case"point":r=new V.PointLight(a);break;case"spot":r=new V.SpotLight(a),n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,r.angle=n.spot.outerConeAngle,r.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,r.target.position.set(0,0,1),r.add(r.target);break;case"ambient":r=new V.AmbientLight(a)}r&&(r.decay=2,void 0!==n.intensity&&(r.intensity=n.intensity),r.name=n.name||"light_"+i,this.lights[i]=r)}}function c(e){this.name=w.KHR_MATERIALS_UNLIT}c.prototype.getMaterialType=function(e){return V.MeshBasicMaterial},c.prototype.extendParams=function(e,t,i){var r=[];e.color=new V.Color(1,1,1),e.opacity=1;var n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){var a=n.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==n.baseColorTexture&&r.push(i.assignTexture(e,"map",n.baseColorTexture.index))}return Promise.all(r)};var l="glTF",h=12,u={JSON:1313821514,BIN:5130562};function p(e){this.name=w.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,h);if(this.header={magic:V.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.");for(var i=new DataView(e,h),r=0;r<i.byteLength;){var n=i.getUint32(r,!0);r+=4;var a=i.getUint32(r,!0);if(r+=4,a===u.JSON){var o=new Uint8Array(e,h+r,n);this.content=V.LoaderUtils.decodeText(o)}else if(a===u.BIN){var s=h+r;this.body=e.slice(s,s+n)}r+=n}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function d(e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=w.KHR_DRACO_MESH_COMPRESSION,this.dracoLoader=e}function f(){return{name:w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return V.ShaderMaterial},extendParams:function(e,t,i){var r=t.extensions[this.name],n=V.ShaderLib.standard,a=V.UniformsUtils.clone(n.uniforms),o=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),s=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),c=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),l=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),h=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),u=n.fragmentShader.replace("#include <specularmap_fragment>","").replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",o).replace("#include <metalnessmap_pars_fragment>",s).replace("#include <roughnessmap_fragment>",c).replace("#include <metalnessmap_fragment>",l).replace("#include <lights_physical_fragment>",h);delete a.roughness,delete a.metalness,delete a.roughnessMap,delete a.metalnessMap,a.specular={value:(new V.Color).setHex(1118481)},a.glossiness={value:.5},a.specularMap={value:null},a.glossinessMap={value:null},e.vertexShader=n.vertexShader,e.fragmentShader=u,e.uniforms=a,e.defines={STANDARD:""},e.color=new V.Color(1,1,1),e.opacity=1;var p=[];if(Array.isArray(r.diffuseFactor)){var d=r.diffuseFactor;e.color.fromArray(d),e.opacity=d[3]}if(void 0!==r.diffuseTexture&&p.push(i.assignTexture(e,"map",r.diffuseTexture.index)),e.emissive=new V.Color(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new V.Color(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var f=r.specularGlossinessTexture.index;p.push(i.assignTexture(e,"glossinessMap",f)),p.push(i.assignTexture(e,"specularMap",f))}return Promise.all(p)},createMaterial:function(e){var t=new V.ShaderMaterial({defines:e.defines,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,fog:!0,lights:!0,opacity:e.opacity,transparent:e.transparent});return t.isGLTFSpecularGlossinessMaterial=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t.extensions.derivatives=!0,t},cloneMaterial:function(e){var t=e.clone();t.isGLTFSpecularGlossinessMaterial=!0;for(var i=this.specularGlossinessParams,r=0,n=i.length;r<n;r++)t[i[r]]=e[i[r]];return t},refreshUniforms:function(e,t,i,r,n){if(!0===n.isGLTFSpecularGlossinessMaterial){var a,o,s,c=n.uniforms,l=n.defines;if(c.opacity.value=n.opacity,c.diffuse.value.copy(n.color),c.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),c.map.value=n.map,c.specularMap.value=n.specularMap,c.alphaMap.value=n.alphaMap,c.lightMap.value=n.lightMap,c.lightMapIntensity.value=n.lightMapIntensity,c.aoMap.value=n.aoMap,c.aoMapIntensity.value=n.aoMapIntensity,n.map?a=n.map:n.specularMap?a=n.specularMap:n.displacementMap?a=n.displacementMap:n.normalMap?a=n.normalMap:n.bumpMap?a=n.bumpMap:n.glossinessMap?a=n.glossinessMap:n.alphaMap?a=n.alphaMap:n.emissiveMap&&(a=n.emissiveMap),void 0!==a)if(a.isWebGLRenderTarget&&(a=a.texture),void 0!==a.matrix){if(!0===a.matrixAutoUpdate){o=a.offset,s=a.repeat;var h=a.rotation,u=a.center;a.matrix.setUvTransform(o.x,o.y,s.x,s.y,h,u.x,u.y)}c.uvTransform.value.copy(a.matrix)}else o=a.offset,s=a.repeat,c.offsetRepeat.value.set(o.x,o.y,s.x,s.y);c.envMap.value=n.envMap,c.envMapIntensity.value=n.envMapIntensity,c.flipEnvMap.value=n.envMap&&n.envMap.isCubeTexture?-1:1,c.refractionRatio.value=n.refractionRatio,c.specular.value.copy(n.specular),c.glossiness.value=n.glossiness,c.glossinessMap.value=n.glossinessMap,c.emissiveMap.value=n.emissiveMap,c.bumpMap.value=n.bumpMap,c.normalMap.value=n.normalMap,c.displacementMap.value=n.displacementMap,c.displacementScale.value=n.displacementScale,c.displacementBias.value=n.displacementBias,null!==c.glossinessMap.value&&void 0===l.USE_GLOSSINESSMAP&&(l.USE_GLOSSINESSMAP="",l.USE_ROUGHNESSMAP=""),null===c.glossinessMap.value&&void 0!==l.USE_GLOSSINESSMAP&&(delete l.USE_GLOSSINESSMAP,delete l.USE_ROUGHNESSMAP)}}}}function _(e,t,i,r){V.Interpolant.call(this,e,t,i,r)}d.prototype.decodePrimitive=function(e,t){var i=this.dracoLoader,r=e.extensions[this.name].bufferView,n=e.extensions[this.name].attributes,a={};for(var o in n)o in x&&(a[x[o]]=n[o]);return t.getDependency("bufferView",r).then(function(t){return new Promise(function(e){i.decodeDracoFile(t,e,a)})})},((_.prototype=Object.create(V.Interpolant.prototype)).constructor=_).prototype.interpolate_=function(e,t,i,r){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,c=3*o,l=r-t,h=(i-t)/l,u=h*h,p=u*h,d=e*c,f=d-c,m=2*p-3*u+1,g=p-2*u+h,v=-2*p+3*u,y=p-u,x=0;x!==o;x++){var b=a[f+x+o],w=a[f+x+s]*l,_=a[d+x+o],M=a[d+x]*l;n[x]=m*b+g*w+v*_+y*M}return n};var M=0,E=1,T=2,S=3,L=4,A=5,R=6,P=(Number,V.Matrix3,V.Matrix4,V.Vector2,V.Vector3,V.Vector4,V.Texture,{5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array}),m={9728:V.NearestFilter,9729:V.LinearFilter,9984:V.NearestMipMapNearestFilter,9985:V.LinearMipMapNearestFilter,9986:V.NearestMipMapLinearFilter,9987:V.LinearMipMapLinearFilter},g={33071:V.ClampToEdgeWrapping,33648:V.MirroredRepeatWrapping,10497:V.RepeatWrapping},v={6406:V.AlphaFormat,6407:V.RGBFormat,6408:V.RGBAFormat,6409:V.LuminanceFormat,6410:V.LuminanceAlphaFormat},y={5121:V.UnsignedByteType,32819:V.UnsignedShort4444Type,32820:V.UnsignedShort5551Type,33635:V.UnsignedShort565Type},C=(V.BackSide,V.FrontSide,V.NeverDepth,V.LessDepth,V.EqualDepth,V.LessEqualDepth,V.GreaterEqualDepth,V.NotEqualDepth,V.GreaterEqualDepth,V.AlwaysDepth,V.AddEquation,V.SubtractEquation,V.ReverseSubtractEquation,V.ZeroFactor,V.OneFactor,V.SrcColorFactor,V.OneMinusSrcColorFactor,V.SrcAlphaFactor,V.OneMinusSrcAlphaFactor,V.DstAlphaFactor,V.OneMinusDstAlphaFactor,V.DstColorFactor,V.OneMinusDstColorFactor,V.SrcAlphaSaturateFactor,{SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}),x={POSITION:"position",NORMAL:"normal",TEXCOORD_0:"uv",TEXCOORD0:"uv",TEXCOORD:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",COLOR0:"color",COLOR:"color",WEIGHTS_0:"skinWeight",WEIGHT:"skinWeight",JOINTS_0:"skinIndex",JOINT:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},O={CUBICSPLINE:V.InterpolateSmooth,LINEAR:V.InterpolateLinear,STEP:V.InterpolateDiscrete},b="OPAQUE",D="MASK",N="BLEND";function U(e,t){return"string"!=typeof e||""===e?"":/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e}function F(e,t,i,r){var n=e.geometry,a=e.material,o=i.targets,s=n.morphAttributes;s.position=[],s.normal=[],a.morphTargets=!0;for(var c=0,l=o.length;c<l;c++){var h,u,p=o[c],d="morphTarget"+c;if(void 0!==p.POSITION){h=z(r[p.POSITION]);for(var f=n.attributes.position,m=0,g=h.count;m<g;m++)h.setXYZ(m,h.getX(m)+f.getX(m),h.getY(m)+f.getY(m),h.getZ(m)+f.getZ(m))}else n.attributes.position&&(h=z(n.attributes.position));if(void 0!==h&&(h.name=d,s.position.push(h)),void 0!==p.NORMAL){a.morphNormals=!0,u=z(r[p.NORMAL]);var v=n.attributes.normal;for(m=0,g=u.count;m<g;m++)u.setXYZ(m,u.getX(m)+v.getX(m),u.getY(m)+v.getY(m),u.getZ(m)+v.getZ(m))}else void 0!==n.attributes.normal&&(u=z(n.attributes.normal));void 0!==u&&(u.name=d,s.normal.push(u))}if(e.updateMorphTargets(),void 0!==t.weights)for(c=0,l=t.weights.length;c<l;c++)e.morphTargetInfluences[c]=t.weights[c];if(t.extras&&Array.isArray(t.extras.targetNames))for(c=0,l=t.extras.targetNames.length;c<l;c++)e.morphTargetDictionary[t.extras.targetNames[c]]=c}function a(e,t){if(e.indices!==t.indices)return!1;var i=e.attributes||{},r=t.attributes||{},n=Object.keys(i),a=Object.keys(r);if(n.length!==a.length)return!1;for(var o=0,s=n.length;o<s;o++){var c=n[o];if(i[c]!==r[c])return!1}return!0}function B(e,t){for(var i=0,r=e.length;i<r;i++){var n=e[i];if(a(n.primitive,t))return n.promise}return null}function z(e){if(e.isInterleavedBufferAttribute){for(var t=e.count,i=e.itemSize,r=e.array.slice(0,t*i),n=0;n<t;++n)r[n]=e.getX(n),2<=i&&(r[n+1]=e.getY(n)),3<=i&&(r[n+2]=e.getZ(n)),4<=i&&(r[n+3]=e.getW(n));return new V.BufferAttribute(r,i,e.normalized)}return e.clone()}function G(e,t,i){this.json=e||{},this.extensions=t||{},this.options=i||{},this.cache=new r,this.primitiveCache=[],this.textureLoader=new V.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new V.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer")}function H(e,t,i){var r=t.attributes;for(var n in r){var a=x[n],o=i[r[n]];a&&(a in e.attributes||e.addAttribute(a,o))}void 0===t.indices||e.index||e.setIndex(i[t.indices])}function k(e,t,i,r,n){var a=r[e],o=i.nodes[e];if(void 0!==o.skin)for(var s=!0===a.isGroup?a.children:[a],c=0,l=s.length;c<l;c++){for(var h=s[c],u=n[o.skin],p=[],d=[],f=0,m=u.joints.length;f<m;f++){var g=u.joints[f],v=r[g];if(v){p.push(v);var y=new V.Matrix4;void 0!==u.inverseBindMatrices&&y.fromArray(u.inverseBindMatrices.array,16*f),d.push(y)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',g)}h.bind(new V.Skeleton(p,d),h.matrixWorld)}if(t.add(a),o.children){var x=o.children;for(c=0,l=x.length;c<l;c++){k(x[c],a,i,r,n)}}}return G.prototype.parse=function(o,e){var s=this.json;this.cache.removeAll(),this.markDefs(),this.getMultiDependencies(["scene","animation","camera"]).then(function(e){var t=e.scenes||[],i=t[s.scene||0],r=e.animations||[],n=s.asset,a=e.cameras||[];o(i,t,a,r,n)}).catch(e)},G.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[],r={},n={},a=0,o=t.length;a<o;a++)for(var s=t[a].joints,c=0,l=s.length;c<l;c++)e[s[c]].isBone=!0;for(var h=0,u=e.length;h<u;h++){var p=e[h];void 0!==p.mesh&&(void 0===r[p.mesh]&&(r[p.mesh]=n[p.mesh]=0),r[p.mesh]++,void 0!==p.skin&&(i[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=n},G.prototype.getDependency=function(e,t){var i=e+":"+t,r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this.loadMesh(t);break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this.loadBufferView(t);break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this.loadMaterial(t);break;case"texture":r=this.loadTexture(t);break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,r)}return r},G.prototype.getDependencies=function(i){var e=this.cache.get(i);if(!e){var r=this,t=this.json[i+("mesh"===i?"es":"s")]||[];e=Promise.all(t.map(function(e,t){return r.getDependency(i,t)})),this.cache.add(i,e)}return e},G.prototype.getMultiDependencies=function(e){for(var i={},t=[],r=0,n=e.length;r<n;r++){var a=e[r],o=this.getDependencies(a);o=o.then(function(e,t){i[e]=t}.bind(this,a+("mesh"===a?"es":"s"))),t.push(o)}return Promise.all(t).then(function(){return i})},G.prototype.loadBuffer=function(e){var i=this.json.buffers[e],r=this.fileLoader;if(i.type&&"arraybuffer"!==i.type)throw new Error("THREE.GLTFLoader: "+i.type+" buffer type is not supported.");if(void 0===i.uri&&0===e)return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);var n=this.options;return new Promise(function(e,t){r.load(U(i.uri,n.path),e,void 0,function(){t(new Error('THREE.GLTFLoader: Failed to load buffer "'+i.uri+'".'))})})},G.prototype.loadBufferView=function(e){var r=this.json.bufferViews[e];return this.getDependency("buffer",r.buffer).then(function(e){var t=r.byteLength||0,i=r.byteOffset||0;return e.slice(i,i+t)})},G.prototype.loadAccessor=function(e){var _=this,M=this.json,E=this.json.accessors[e];if(void 0===E.bufferView&&void 0===E.sparse)return null;var t=[];return void 0!==E.bufferView?t.push(this.getDependency("bufferView",E.bufferView)):t.push(null),void 0!==E.sparse&&(t.push(this.getDependency("bufferView",E.sparse.indices.bufferView)),t.push(this.getDependency("bufferView",E.sparse.values.bufferView))),Promise.all(t).then(function(e){var t,i,r=e[0],n=C[E.type],a=P[E.componentType],o=a.BYTES_PER_ELEMENT,s=o*n,c=E.byteOffset||0,l=M.bufferViews[E.bufferView].byteStride,h=!0===E.normalized;if(l&&l!==s){var u="InterleavedBuffer:"+E.bufferView+":"+E.componentType,p=_.cache.get(u);p||(t=new a(r),p=new V.InterleavedBuffer(t,l/o),_.cache.add(u,p)),i=new V.InterleavedBufferAttribute(p,n,c/o,h)}else t=null===r?new a(E.count*n):new a(r,c,E.count*n),i=new V.BufferAttribute(t,n,h);if(void 0!==E.sparse){var d=C.SCALAR,f=P[E.sparse.indices.componentType],m=E.sparse.indices.byteOffset||0,g=E.sparse.values.byteOffset||0,v=new f(e[1],m,E.sparse.count*d),y=new a(e[2],g,E.sparse.count*n);null!==r&&i.setArray(i.array.slice());for(var x=0,b=v.length;x<b;x++){var w=v[x];if(i.setX(w,y[x*n]),2<=n&&i.setY(w,y[x*n+1]),3<=n&&i.setZ(w,y[x*n+2]),4<=n&&i.setW(w,y[x*n+3]),5<=n)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i})},G.prototype.loadTexture=function(e){var i=this.json,n=this.options,t=this.textureLoader,r=window.URL||window.webkitURL,a=i.textures[e],o=i.images[a.source],s=o.uri,c=!1;return void 0!==o.bufferView&&(s=this.getDependency("bufferView",o.bufferView).then(function(e){c=!0;var t=new Blob([e],{type:o.mimeType});return s=r.createObjectURL(t)})),Promise.resolve(s).then(function(i){var r=V.Loader.Handlers.get(i)||t;return new Promise(function(e,t){r.load(U(i,n.path),e,void 0,t)})}).then(function(e){!0===c&&r.revokeObjectURL(s),e.flipY=!1,void 0!==a.name&&(e.name=a.name),e.format=void 0!==a.format?v[a.format]:V.RGBAFormat,void 0!==a.internalFormat&&e.format!==v[a.internalFormat]&&console.warn("THREE.GLTFLoader: Three.js does not support texture internalFormat which is different from texture format. internalFormat will be forced to be the same value as format."),e.type=void 0!==a.type?y[a.type]:V.UnsignedByteType;var t=(i.samplers||{})[a.sampler]||{};return e.magFilter=m[t.magFilter]||V.LinearFilter,e.minFilter=m[t.minFilter]||V.LinearMipMapLinearFilter,e.wrapS=g[t.wrapS]||V.RepeatWrapping,e.wrapT=g[t.wrapT]||V.RepeatWrapping,e})},G.prototype.assignTexture=function(t,i,e){return this.getDependency("texture",e).then(function(e){t[i]=e})},G.prototype.loadMaterial=function(e){this.json;var t,i=this.extensions,r=this.json.materials[e],n={},a=r.extensions||{},o=[];if(a[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var s=i[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=s.getMaterialType(r),o.push(s.extendParams(n,r,this))}else if(a[w.KHR_MATERIALS_UNLIT]){var c=i[w.KHR_MATERIALS_UNLIT];t=c.getMaterialType(r),o.push(c.extendParams(n,r,this))}else{t=V.MeshStandardMaterial;var l=r.pbrMetallicRoughness||{};if(n.color=new V.Color(1,1,1),n.opacity=1,Array.isArray(l.baseColorFactor)){var h=l.baseColorFactor;n.color.fromArray(h),n.opacity=h[3]}if(void 0!==l.baseColorTexture&&o.push(this.assignTexture(n,"map",l.baseColorTexture.index)),n.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,n.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture){var u=l.metallicRoughnessTexture.index;o.push(this.assignTexture(n,"metalnessMap",u)),o.push(this.assignTexture(n,"roughnessMap",u))}}!0===r.doubleSided&&(n.side=V.DoubleSide);var p=r.alphaMode||b;return p===N?n.transparent=!0:(n.transparent=!1,p===D&&(n.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&t!==V.MeshBasicMaterial&&(o.push(this.assignTexture(n,"normalMap",r.normalTexture.index)),n.normalScale=new V.Vector2(1,1),void 0!==r.normalTexture.scale&&n.normalScale.set(r.normalTexture.scale,r.normalTexture.scale)),void 0!==r.occlusionTexture&&t!==V.MeshBasicMaterial&&(o.push(this.assignTexture(n,"aoMap",r.occlusionTexture.index)),void 0!==r.occlusionTexture.strength&&(n.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&t!==V.MeshBasicMaterial&&(n.emissive=(new V.Color).fromArray(r.emissiveFactor)),void 0!==r.emissiveTexture&&t!==V.MeshBasicMaterial&&o.push(this.assignTexture(n,"emissiveMap",r.emissiveTexture.index)),Promise.all(o).then(function(){var e;return e=t===V.ShaderMaterial?i[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(n):new t(n),void 0!==r.name&&(e.name=r.name),e.normalScale&&(e.normalScale.y=-e.normalScale.y),e.map&&(e.map.encoding=V.sRGBEncoding),e.emissiveMap&&(e.emissiveMap.encoding=V.sRGBEncoding),r.extras&&(e.userData=r.extras),e})},G.prototype.loadGeometries=function(c){var l=this,h=this.extensions,u=this.primitiveCache;return this.getDependencies("accessor").then(function(t){for(var e=[],i=0,r=c.length;i<r;i++){var n=c[i],a=B(u,n);if(a)e.push(a);else if(n.extensions&&n.extensions[w.KHR_DRACO_MESH_COMPRESSION]){var o=h[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(n,l).then(function(e){return H(e,n,t),e});u.push({primitive:n,promise:o}),e.push(o)}else{var s=new V.BufferGeometry;H(s,n,t);o=Promise.resolve(s);u.push({primitive:n,promise:o}),e.push(o)}}return Promise.all(e)})},G.prototype.loadMesh=function(v){var y=this,x=(this.json,this.extensions),b=this.json.meshes[v];return this.getMultiDependencies(["accessor","material"]).then(function(f){var m=new V.Group,g=b.primitives;return y.loadGeometries(g).then(function(e){for(var t=0,i=g.length;t<i;t++){var r=g[t],n=e[t],a=void 0===r.material?new V.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:V.FrontSide}):f.materials[r.material];a.aoMap&&void 0===n.attributes.uv2&&void 0!==n.attributes.uv&&(console.log("THREE.GLTFLoader: Duplicating UVs to support aoMap."),n.addAttribute("uv2",new V.BufferAttribute(n.attributes.uv.array,2)));var o,s=void 0!==n.attributes.color,c=void 0===n.attributes.normal,l=!0===b.isSkinnedMesh,h=void 0!==r.targets;if(s||c||l||h)if(a.isGLTFSpecularGlossinessMaterial)a=x[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(a);else a=a.clone();if(s&&(a.vertexColors=V.VertexColors,a.needsUpdate=!0),c&&(a.flatShading=!0),r.mode===L||r.mode===A||r.mode===R||void 0===r.mode)l?(o=new V.SkinnedMesh(n,a),a.skinning=!0):o=new V.Mesh(n,a),r.mode===A?o.drawMode=V.TriangleStripDrawMode:r.mode===R&&(o.drawMode=V.TriangleFanDrawMode);else if(r.mode===E||r.mode===S||r.mode===T){var u="LineBasicMaterial:"+a.uuid,p=y.cache.get(u);p||(p=new V.LineBasicMaterial,V.Material.prototype.copy.call(p,a),p.color.copy(a.color),p.lights=!1,y.cache.add(u,p)),a=p,o=r.mode===E?new V.LineSegments(n,a):r.mode===S?new V.Line(n,a):new V.LineLoop(n,a)}else{if(r.mode!==M)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+r.mode);u="PointsMaterial:"+a.uuid;var d=y.cache.get(u);d||(d=new V.PointsMaterial,V.Material.prototype.copy.call(d,a),d.color.copy(a.color),d.map=a.map,d.lights=!1,y.cache.add(u,d)),a=d,o=new V.Points(n,a)}if(o.name=b.name||"mesh_"+v,h&&F(o,b,r,f.accessors),void 0!==b.extras&&(o.userData=b.extras),void 0!==r.extras&&(o.geometry.userData=r.extras),!0===a.isGLTFSpecularGlossinessMaterial&&(o.onBeforeRender=x[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms),!(1<g.length))return o;o.name+="_"+t,m.add(o)}return m})})},G.prototype.loadCamera=function(e){var t,i=this.json.cameras[e],r=i[i.type];if(r)return"perspective"===i.type?t=new V.PerspectiveCamera(V.Math.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===i.type&&(t=new V.OrthographicCamera(r.xmag/-2,r.xmag/2,r.ymag/2,r.ymag/-2,r.znear,r.zfar)),void 0!==i.name&&(t.name=i.name),i.extras&&(t.userData=i.extras),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},G.prototype.loadSkin=function(e){var t=this.json.skins[e],i={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(i):this.getDependency("accessor",t.inverseBindMatrices).then(function(e){return i.inverseBindMatrices=e,i})},G.prototype.loadAnimation=function(b){this.json;var w=this.json.animations[b];return this.getMultiDependencies(["accessor","node"]).then(function(e){for(var t=[],i=0,r=w.channels.length;i<r;i++){var n=w.channels[i],a=w.samplers[n.sampler];if(a){var o=n.target,s=void 0!==o.node?o.node:o.id,c=void 0!==w.parameters?w.parameters[a.input]:a.input,l=void 0!==w.parameters?w.parameters[a.output]:a.output,h=e.accessors[c],u=e.accessors[l],p=e.nodes[s];if(p){var d;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,I[o.path]){case I.weights:d=V.NumberKeyframeTrack;break;case I.rotation:d=V.QuaternionKeyframeTrack;break;case I.position:case I.scale:default:d=V.VectorKeyframeTrack}var f=p.name?p.name:p.uuid,m=void 0!==a.interpolation?O[a.interpolation]:V.InterpolateLinear,g=[];I[o.path]===I.weights?p.traverse(function(e){!0===e.isMesh&&!0===e.material.morphTargets&&g.push(e.name?e.name:e.uuid)}):g.push(f);for(var v=0,y=g.length;v<y;v++){var x=new d(g[v]+"."+I[o.path],V.AnimationUtils.arraySlice(h.array,0),V.AnimationUtils.arraySlice(u.array,0),m);"CUBICSPLINE"===a.interpolation&&(x.createInterpolant=function(e){return new _(this.times,this.values,this.getValueSize()/3,e)},x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),t.push(x)}}}}s=void 0!==w.name?w.name:"animation_"+b;return new V.AnimationClip(s,void 0,t)})},G.prototype.loadNode=function(e){this.json;var s=this.extensions,c=this.json.meshReferences,l=this.json.meshUses,h=this.json.nodes[e];return this.getMultiDependencies(["mesh","skin","camera","light"]).then(function(e){var t;if(!0===h.isBone)t=new V.Bone;else if(void 0!==h.mesh){var i=e.meshes[h.mesh];if(t=i.clone(),!0===i.isGroup)for(var r=0,n=i.children.length;r<n;r++){var a=i.children[r];a.material&&!0===a.material.isGLTFSpecularGlossinessMaterial&&(t.children[r].onBeforeRender=a.onBeforeRender)}else i.material&&!0===i.material.isGLTFSpecularGlossinessMaterial&&(t.onBeforeRender=i.onBeforeRender);1<c[h.mesh]&&(t.name+="_instance_"+l[h.mesh]++)}else if(void 0!==h.camera)t=e.cameras[h.camera];else if(h.extensions&&h.extensions[w.KHR_LIGHTS]&&void 0!==h.extensions[w.KHR_LIGHTS].light){t=s[w.KHR_LIGHTS].lights[h.extensions[w.KHR_LIGHTS].light]}else t=new V.Object3D;if(void 0!==h.name&&(t.name=V.PropertyBinding.sanitizeNodeName(h.name)),h.extras&&(t.userData=h.extras),void 0!==h.matrix){var o=new V.Matrix4;o.fromArray(h.matrix),t.applyMatrix(o)}else void 0!==h.translation&&t.position.fromArray(h.translation),void 0!==h.rotation&&t.quaternion.fromArray(h.rotation),void 0!==h.scale&&t.scale.fromArray(h.scale);return t})},G.prototype.loadScene=function(e){var o=this.json,s=this.extensions,c=this.json.scenes[e];return this.getMultiDependencies(["node","skin"]).then(function(e){var t=new V.Scene;void 0!==c.name&&(t.name=c.name),c.extras&&(t.userData=c.extras);for(var i=c.nodes||[],r=0,n=i.length;r<n;r++)k(i[r],t,o,e.nodes,e.skins);if(c.extensions&&c.extensions[w.KHR_LIGHTS]&&void 0!==c.extensions[w.KHR_LIGHTS].light){var a=s[w.KHR_LIGHTS].lights;t.add(a[c.extensions[w.KHR_LIGHTS].light])}return t})},e}(),t.exports=V.GLTFLoader},{three:2}],7:[function(e,t,i){var U=e("three");U.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:U.DefaultLoadingManager,this.withCredentials=!1},Object.assign(U.JSONLoader.prototype,{load:function(a,o,e,t){var s=this,c=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:U.LoaderUtils.extractUrlBase(a),i=new U.FileLoader(this.manager);i.setWithCredentials(this.withCredentials),i.load(a,function(e){var t=JSON.parse(e),i=t.metadata;if(void 0!==i){var r=i.type;if(void 0!==r&&"object"===r.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.")}var n=s.parse(t,c);o(n.geometry,n.materials)},e,t)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==e.data&&(e=e.data),void 0!==e.scale?e.scale=1/e.scale:e.scale=1;var i=new U.Geometry;return function(e,t){function i(e,t){return e&1<<t}var r,n,a,o,s,c,l,h,u,p,d,f,m,g,v,y,x,b,w,_,M,E,T,S,L,A,R,P=e.faces,C=e.vertices,I=e.normals,O=e.colors,D=e.scale,N=0;if(void 0!==e.uvs){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&N++;for(r=0;r<N;r++)t.faceVertexUvs[r]=[]}for(o=0,s=C.length;o<s;)(b=new U.Vector3).x=C[o++]*D,b.y=C[o++]*D,b.z=C[o++]*D,t.vertices.push(b);for(o=0,s=P.length;o<s;)if(d=i(p=P[o++],0),f=i(p,1),m=i(p,3),g=i(p,4),v=i(p,5),y=i(p,6),x=i(p,7),d){if((_=new U.Face3).a=P[o],_.b=P[o+1],_.c=P[o+3],(M=new U.Face3).a=P[o+1],M.b=P[o+2],M.c=P[o+3],o+=4,f&&(u=P[o++],_.materialIndex=u,M.materialIndex=u),a=t.faces.length,m)for(r=0;r<N;r++)for(S=e.uvs[r],t.faceVertexUvs[r][a]=[],t.faceVertexUvs[r][a+1]=[],n=0;n<4;n++)A=S[2*(h=P[o++])],R=S[2*h+1],L=new U.Vector2(A,R),2!==n&&t.faceVertexUvs[r][a].push(L),0!==n&&t.faceVertexUvs[r][a+1].push(L);if(g&&(l=3*P[o++],_.normal.set(I[l++],I[l++],I[l]),M.normal.copy(_.normal)),v)for(r=0;r<4;r++)l=3*P[o++],T=new U.Vector3(I[l++],I[l++],I[l]),2!==r&&_.vertexNormals.push(T),0!==r&&M.vertexNormals.push(T);if(y&&(E=O[c=P[o++]],_.color.setHex(E),M.color.setHex(E)),x)for(r=0;r<4;r++)E=O[c=P[o++]],2!==r&&_.vertexColors.push(new U.Color(E)),0!==r&&M.vertexColors.push(new U.Color(E));t.faces.push(_),t.faces.push(M)}else{if((w=new U.Face3).a=P[o++],w.b=P[o++],w.c=P[o++],f&&(u=P[o++],w.materialIndex=u),a=t.faces.length,m)for(r=0;r<N;r++)for(S=e.uvs[r],t.faceVertexUvs[r][a]=[],n=0;n<3;n++)A=S[2*(h=P[o++])],R=S[2*h+1],L=new U.Vector2(A,R),t.faceVertexUvs[r][a].push(L);if(g&&(l=3*P[o++],w.normal.set(I[l++],I[l++],I[l])),v)for(r=0;r<3;r++)l=3*P[o++],T=new U.Vector3(I[l++],I[l++],I[l]),w.vertexNormals.push(T);if(y&&(c=P[o++],w.color.setHex(O[c])),x)for(r=0;r<3;r++)c=P[o++],w.vertexColors.push(new U.Color(O[c]));t.faces.push(w)}}(e,i),function(e,t){var i=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,n=e.skinWeights.length;r<n;r+=i){var a=e.skinWeights[r],o=1<i?e.skinWeights[r+1]:0,s=2<i?e.skinWeights[r+2]:0,c=3<i?e.skinWeights[r+3]:0;t.skinWeights.push(new Vector4(a,o,s,c))}if(e.skinIndices)for(r=0,n=e.skinIndices.length;r<n;r+=i){var l=e.skinIndices[r],h=1<i?e.skinIndices[r+1]:0,u=2<i?e.skinIndices[r+2]:0,p=3<i?e.skinIndices[r+3]:0;t.skinIndices.push(new Vector4(l,h,u,p))}t.bones=e.bones,t.bones&&0<t.bones.length&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,i),function(e,t){var i=e.scale;if(void 0!==e.morphTargets)for(var r=0,n=e.morphTargets.length;r<n;r++){t.morphTargets[r]={},t.morphTargets[r].name=e.morphTargets[r].name,t.morphTargets[r].vertices=[];for(var a=t.morphTargets[r].vertices,o=e.morphTargets[r].vertices,s=0,c=o.length;s<c;s+=3){var l=new Vector3;l.x=o[s]*i,l.y=o[s+1]*i,l.z=o[s+2]*i,a.push(l)}}if(void 0!==e.morphColors&&0<e.morphColors.length){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var h=t.faces,u=e.morphColors[0].colors;for(r=0,n=h.length;r<n;r++)h[r].color.fromArray(u,3*r)}}(e,i),function(e,t){var i=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var n=0;n<r.length;n++){var a=U.AnimationClip.parseAnimation(r[n],t.bones);a&&i.push(a)}if(t.morphTargets){var o=U.AnimationClip.CreateClipsFromMorphTargetSequences(t.morphTargets,10);i=i.concat(o)}0<i.length&&(t.animations=i)}(e,i),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:i}:{geometry:i,materials:U.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}),t.exports=U.JSONLoader},{three:2}],8:[function(e,t,i){var W=e("three");W.LegacyGLTFLoader=function(){function e(e){this.manager=void 0!==e?e:W.DefaultLoadingManager}function r(){var n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}},update:function(e,t){for(var i in n){var r=n[i];r.update&&r.update(e,t)}}}}function o(e,t){var i={},r=e.material.uniforms;for(var n in r){var a=r[n];if(a.semantic){var o=a.node,s=e;o&&(s=t[o]),i[n]={semantic:a.semantic,sourceNode:s,targetNode:e,uniform:a}}}this.boundUniforms=i,this._m4=new W.Matrix4}e.prototype={constructor:e,crossOrigin:"Anonymous",load:function(e,t,i,r){var n=this,a=this.path&&"string"==typeof this.path?this.path:W.LoaderUtils.extractUrlBase(e),o=new W.FileLoader(n.manager);o.setResponseType("arraybuffer"),o.load(e,function(e){n.parse(e,a,t)},i,r)},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e},parse:function(e,t,n){var i,r={};i=W.LoaderUtils.decodeText(new Uint8Array(e,0,4))===c.magic?(r[U.KHR_BINARY_GLTF]=new h(e),r[U.KHR_BINARY_GLTF].content):W.LoaderUtils.decodeText(new Uint8Array(e));var a=JSON.parse(i);a.extensionsUsed&&0<=a.extensionsUsed.indexOf(U.KHR_MATERIALS_COMMON)&&(r[U.KHR_MATERIALS_COMMON]=new s(a)),console.time("LegacyGLTFLoader"),new w(a,r,{path:t||this.path,crossOrigin:this.crossOrigin}).parse(function(e,t,i,r){console.timeEnd("LegacyGLTFLoader"),n({scene:e,scenes:t,cameras:i,animations:r})})}},e.Shaders={update:function(){console.warn("THREE.LegacyGLTFLoader.Shaders has been deprecated, and now updates automatically.")}},o.prototype.update=function(e,t){var i=this.boundUniforms;for(var r in i){var n=i[r];switch(n.semantic){case"MODELVIEW":n.uniform.value.multiplyMatrices(t.matrixWorldInverse,n.sourceNode.matrixWorld);break;case"MODELVIEWINVERSETRANSPOSE":var a=n.uniform.value;this._m4.multiplyMatrices(t.matrixWorldInverse,n.sourceNode.matrixWorld),a.getNormalMatrix(this._m4);break;case"PROJECTION":n.uniform.value.copy(t.projectionMatrix);break;case"JOINTMATRIX":for(var o=n.uniform.value,s=0;s<o.length;s++)o[s].getInverse(n.sourceNode.matrixWorld).multiply(n.targetNode.skeleton.bones[s].matrixWorld).multiply(n.targetNode.skeleton.boneInverses[s]).multiply(n.targetNode.bindMatrix);break;default:console.warn("Unhandled shader semantic: "+n.semantic)}}},e.Animations={update:function(){console.warn("THREE.LegacyGLTFLoader.Animation has been deprecated. Use THREE.AnimationMixer instead.")}};var U={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_MATERIALS_COMMON:"KHR_materials_common"};function s(e){this.name=U.KHR_MATERIALS_COMMON,this.lights={};var t=(e.extensions&&e.extensions[U.KHR_MATERIALS_COMMON]||{}).lights||{};for(var i in t){var r,n=t[i],a=n[n.type],o=(new W.Color).fromArray(a.color);switch(n.type){case"directional":(r=new W.DirectionalLight(o)).position.set(0,0,1);break;case"point":r=new W.PointLight(o);break;case"spot":(r=new W.SpotLight(o)).position.set(0,0,1);break;case"ambient":r=new W.AmbientLight(o)}r&&(this.lights[i]=r)}}var c={magic:"glTF",version:1,contentFormat:0},l=20;function h(e){this.name=U.KHR_BINARY_GLTF;var t=new DataView(e,0,l),i={magic:W.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0),contentLength:t.getUint32(12,!0),contentFormat:t.getUint32(16,!0)};for(var r in c){var n=c[r];if(i[r]!==n)throw new Error('Unsupported glTF-Binary header: Expected "%s" to be "%s".',r,n)}var a=new Uint8Array(e,l,i.contentLength);this.header=i,this.content=W.LoaderUtils.decodeText(a),this.body=e.slice(l+i.contentLength,i.length)}h.prototype.loadShader=function(e,t){var i=t[e.extensions[U.KHR_BINARY_GLTF].bufferView],r=new Uint8Array(i);return W.LoaderUtils.decodeText(r)};var F={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,TRIANGLES:4,LINES:1,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,VERTEX_SHADER:35633,FRAGMENT_SHADER:35632},B={5126:Number,35675:W.Matrix3,35676:W.Matrix4,35664:W.Vector2,35665:W.Vector3,35666:W.Vector4,35678:W.Texture},u={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},p={9728:W.NearestFilter,9729:W.LinearFilter,9984:W.NearestMipMapNearestFilter,9985:W.LinearMipMapNearestFilter,9986:W.NearestMipMapLinearFilter,9987:W.LinearMipMapLinearFilter},d={33071:W.ClampToEdgeWrapping,33648:W.MirroredRepeatWrapping,10497:W.RepeatWrapping},f={6406:W.AlphaFormat,6407:W.RGBFormat,6408:W.RGBAFormat,6409:W.LuminanceFormat,6410:W.LuminanceAlphaFormat},m={5121:W.UnsignedByteType,32819:W.UnsignedShort4444Type,32820:W.UnsignedShort5551Type,33635:W.UnsignedShort565Type},z={1028:W.BackSide,1029:W.FrontSide},G={512:W.NeverDepth,513:W.LessDepth,514:W.EqualDepth,515:W.LessEqualDepth,516:W.GreaterEqualDepth,517:W.NotEqualDepth,518:W.GreaterEqualDepth,519:W.AlwaysDepth},H={32774:W.AddEquation,32778:W.SubtractEquation,32779:W.ReverseSubtractEquation},k={0:W.ZeroFactor,1:W.OneFactor,768:W.SrcColorFactor,769:W.OneMinusSrcColorFactor,770:W.SrcAlphaFactor,771:W.OneMinusSrcAlphaFactor,772:W.DstAlphaFactor,773:W.OneMinusDstAlphaFactor,774:W.DstColorFactor,775:W.OneMinusDstColorFactor,776:W.SrcAlphaSaturateFactor},g={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},v={scale:"scale",translation:"position",rotation:"quaternion"},y={LINEAR:W.InterpolateLinear,STEP:W.InterpolateDiscrete},V={2884:"CULL_FACE",2929:"DEPTH_TEST",3042:"BLEND",3089:"SCISSOR_TEST",32823:"POLYGON_OFFSET_FILL",32926:"SAMPLE_ALPHA_TO_COVERAGE"};function x(e,t,i){if(!e)return Promise.resolve();var r,n=[];if("[object Array]"===Object.prototype.toString.call(e)){r=[];for(var a=e.length,o=0;o<a;o++){(c=t.call(i||this,e[o],o))&&(n.push(c),c instanceof Promise?c.then(function(e,t){r[e]=t}.bind(this,o)):r[o]=c)}}else for(var s in r={},e){var c;if(e.hasOwnProperty(s))(c=t.call(i||this,e[s],s))&&(n.push(c),c instanceof Promise?c.then(function(e,t){r[e]=t}.bind(this,s)):r[s]=c)}return Promise.all(n).then(function(){return r})}function b(e,t){return"string"!=typeof e||""===e?"":/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:(t||"")+e}function j(e){this.isDeferredShaderMaterial=!0,this.params=e}function w(e,t,i){this.json=e||{},this.extensions=t||{},this.options=i||{},this.cache=new r}return j.prototype.create=function(){var e=W.UniformsUtils.clone(this.params.uniforms);for(var t in this.params.uniforms){var i=this.params.uniforms[t];i.value instanceof W.Texture&&(e[t].value=i.value,e[t].value.needsUpdate=!0),e[t].semantic=i.semantic,e[t].node=i.node}return this.params.uniforms=e,new W.RawShaderMaterial(this.params)},w.prototype._withDependencies=function(e){for(var t={},i=0;i<e.length;i++){var r=e[i],n="load"+r.charAt(0).toUpperCase()+r.slice(1),a=this.cache.get(r);if(void 0!==a)t[r]=a;else if(this[n]){var o=this[n]();this.cache.add(r,o),t[r]=o}}return x(t,function(e){return e})},w.prototype.parse=function(s){var c=this.json;this.cache.removeAll(),this._withDependencies(["scenes","cameras","animations"]).then(function(e){var t=[];for(var i in e.scenes)t.push(e.scenes[i]);var r=void 0!==c.scene?e.scenes[c.scene]:t[0],n=[];for(var i in e.cameras){var a=e.cameras[i];n.push(a)}var o=[];for(var i in e.animations)o.push(e.animations[i]);s(r,t,n,o)})},w.prototype.loadShaders=function(){var t=this.json,r=this.extensions,n=this.options;return this._withDependencies(["bufferViews"]).then(function(e){return x(t.shaders,function(i){return i.extensions&&i.extensions[U.KHR_BINARY_GLTF]?r[U.KHR_BINARY_GLTF].loadShader(i,e.bufferViews):new Promise(function(t){var e=new W.FileLoader;e.setResponseType("text"),e.load(b(i.uri,n.path),function(e){t(e)})})})})},w.prototype.loadBuffers=function(){var e=this.json,t=this.extensions,r=this.options;return x(e.buffers,function(i,e){return"binary_glTF"===e?t[U.KHR_BINARY_GLTF].body:"arraybuffer"===i.type||void 0===i.type?new Promise(function(t){var e=new W.FileLoader;e.setResponseType("arraybuffer"),e.load(b(i.uri,r.path),function(e){t(e)})}):void console.warn("THREE.LegacyGLTFLoader: "+i.type+" buffer type is not supported")})},w.prototype.loadBufferViews=function(){var e=this.json;return this._withDependencies(["buffers"]).then(function(r){return x(e.bufferViews,function(e){var t=r.buffers[e.buffer],i=void 0!==e.byteLength?e.byteLength:0;return t.slice(e.byteOffset,e.byteOffset+i)})})},w.prototype.loadAccessors=function(){var e=this.json;return this._withDependencies(["bufferViews"]).then(function(c){return x(e.accessors,function(e){var t=c.bufferViews[e.bufferView],i=g[e.type],r=u[e.componentType],n=r.BYTES_PER_ELEMENT,a=n*i;if(e.byteStride&&e.byteStride!==a){var o=new r(t),s=new W.InterleavedBuffer(o,e.byteStride/n);return new W.InterleavedBufferAttribute(s,i,e.byteOffset/n)}return o=new r(t,e.byteOffset,e.count*i),new W.BufferAttribute(o,i)})})},w.prototype.loadTextures=function(){var h=this.json,u=(this.extensions,this.options);return this._withDependencies(["bufferViews"]).then(function(l){return x(h.textures,function(c){if(c.source)return new Promise(function(i){var e=h.images[c.source],r=e.uri,n=!1;if(e.extensions&&e.extensions[U.KHR_BINARY_GLTF]){var t=e.extensions[U.KHR_BINARY_GLTF],a=l.bufferViews[t.bufferView],o=new Blob([a],{type:t.mimeType});r=URL.createObjectURL(o),n=!0}var s=W.Loader.Handlers.get(r);null===s&&(s=new W.TextureLoader),s.setCrossOrigin(u.crossOrigin),s.load(b(r,u.path),function(e){if(n&&URL.revokeObjectURL(r),e.flipY=!1,void 0!==c.name&&(e.name=c.name),e.format=void 0!==c.format?f[c.format]:W.RGBAFormat,void 0!==c.internalFormat&&e.format!==f[c.internalFormat]&&console.warn("THREE.LegacyGLTFLoader: Three.js doesn't support texture internalFormat which is different from texture format. internalFormat will be forced to be the same value as format."),e.type=void 0!==c.type?m[c.type]:W.UnsignedByteType,c.sampler){var t=h.samplers[c.sampler];e.magFilter=p[t.magFilter]||W.LinearFilter,e.minFilter=p[t.minFilter]||W.NearestMipMapLinearFilter,e.wrapS=d[t.wrapS]||W.RepeatWrapping,e.wrapT=d[t.wrapT]||W.RepeatWrapping}i(e)},void 0,function(){n&&URL.revokeObjectURL(r),i()})})})})},w.prototype.loadMaterials=function(){var N=this.json;return this._withDependencies(["shaders","textures"]).then(function(D){return x(N.materials,function(e){var t,i,r={},n={};if(e.extensions&&e.extensions[U.KHR_MATERIALS_COMMON]&&(i=e.extensions[U.KHR_MATERIALS_COMMON]),i){var a=["ambient","emission","transparent","transparency","doubleSided"];switch(i.technique){case"BLINN":case"PHONG":t=W.MeshPhongMaterial,a.push("diffuse","specular","shininess");break;case"LAMBERT":t=W.MeshLambertMaterial,a.push("diffuse");break;case"CONSTANT":default:t=W.MeshBasicMaterial}a.forEach(function(e){void 0!==i.values[e]&&(r[e]=i.values[e])}),(i.doubleSided||r.doubleSided)&&(n.side=W.DoubleSide),(i.transparent||r.transparent)&&(n.transparent=!0,n.opacity=void 0!==r.transparency?r.transparency:1)}else if(void 0===e.technique)t=W.MeshPhongMaterial,Object.assign(r,e.values);else{t=j;var o=N.techniques[e.technique];n.uniforms={};var s=N.programs[o.program];if(s){n.fragmentShader=D.shaders[s.fragmentShader],n.fragmentShader||(console.warn("ERROR: Missing fragment shader definition:",s.fragmentShader),t=W.MeshPhongMaterial);var c=D.shaders[s.vertexShader];c||(console.warn("ERROR: Missing vertex shader definition:",s.vertexShader),t=W.MeshPhongMaterial),n.vertexShader=function(e,t){var i={};for(var r in t.attributes){var n=t.attributes[r],a=(u=t.parameters[n]).type,o=u.semantic;i[r]={type:a,semantic:o}}var s=t.parameters,c=t.attributes,l={};for(var r in i){var h=s[n=c[r]];(o=h.semantic)&&(l[r]=h)}for(var n in l){o=(u=l[n]).semantic;var u,p=new RegExp("\\b"+n+"\\b","g");switch(o){case"POSITION":e=e.replace(p,"position");break;case"NORMAL":e=e.replace(p,"normal");break;case"TEXCOORD_0":case"TEXCOORD0":case"TEXCOORD":e=e.replace(p,"uv");break;case"TEXCOORD_1":e=e.replace(p,"uv2");break;case"COLOR_0":case"COLOR0":case"COLOR":e=e.replace(p,"color");break;case"WEIGHT":e=e.replace(p,"skinWeight");break;case"JOINT":e=e.replace(p,"skinIndex")}}return e}(c,o);var l=o.uniforms;for(var h in l){var u=l[h],p=o.parameters[u],d=p.type;if(!B[d])throw new Error("Unknown shader uniform param type: "+d);var f,m=p.count;void 0!==e.values&&(f=e.values[u]);var g=new B[d],v=p.semantic,y=p.node;switch(d){case F.FLOAT:g=p.value,"transparency"==u&&(n.transparent=!0),void 0!==f&&(g=f);break;case F.FLOAT_VEC2:case F.FLOAT_VEC3:case F.FLOAT_VEC4:case F.FLOAT_MAT3:p&&p.value&&g.fromArray(p.value),f&&g.fromArray(f);break;case F.FLOAT_MAT2:console.warn("FLOAT_MAT2 is not a supported uniform type");break;case F.FLOAT_MAT4:if(m){g=new Array(m);for(var x=0;x<m;x++)g[x]=new B[d];if(p&&p.value){var b=p.value;g.fromArray(b)}f&&g.fromArray(f)}else{if(p&&p.value){var w=p.value;g.fromArray(w)}f&&g.fromArray(f)}break;case F.SAMPLER_2D:g=void 0!==f?D.textures[f]:void 0!==p.value?D.textures[p.value]:null}n.uniforms[h]={value:g,semantic:v,node:y}}for(var _=o.states||{},M=_.enable||[],E=_.functions||{},T=!1,S=!1,L=!1,A=0,R=M.length;A<R;A++){var P=M[A];switch(V[P]){case"CULL_FACE":T=!0;break;case"DEPTH_TEST":S=!0;break;case"BLEND":L=!0;break;case"SCISSOR_TEST":case"POLYGON_OFFSET_FILL":case"SAMPLE_ALPHA_TO_COVERAGE":break;default:throw new Error("Unknown technique.states.enable: "+P)}}n.side=T?void 0!==E.cullFace?z[E.cullFace]:W.FrontSide:W.DoubleSide,n.depthTest=S,n.depthFunc=void 0!==E.depthFunc?G[E.depthFunc]:W.LessDepth,n.depthWrite=void 0===E.depthMask||E.depthMask[0],n.blending=L?W.CustomBlending:W.NoBlending,n.transparent=L;var C=E.blendEquationSeparate;void 0!==C?(n.blendEquation=H[C[0]],n.blendEquationAlpha=H[C[1]]):(n.blendEquation=W.AddEquation,n.blendEquationAlpha=W.AddEquation);var I=E.blendFuncSeparate;void 0!==I?(n.blendSrc=k[I[0]],n.blendDst=k[I[1]],n.blendSrcAlpha=k[I[2]],n.blendDstAlpha=k[I[3]]):(n.blendSrc=W.OneFactor,n.blendDst=W.ZeroFactor,n.blendSrcAlpha=W.OneFactor,n.blendDstAlpha=W.ZeroFactor)}}Array.isArray(r.diffuse)?n.color=(new W.Color).fromArray(r.diffuse):"string"==typeof r.diffuse&&(n.map=D.textures[r.diffuse]),delete n.diffuse,"string"==typeof r.reflective&&(n.envMap=D.textures[r.reflective]),"string"==typeof r.bump&&(n.bumpMap=D.textures[r.bump]),Array.isArray(r.emission)?t===W.MeshBasicMaterial?n.color=(new W.Color).fromArray(r.emission):n.emissive=(new W.Color).fromArray(r.emission):"string"==typeof r.emission&&(t===W.MeshBasicMaterial?n.map=D.textures[r.emission]:n.emissiveMap=D.textures[r.emission]),Array.isArray(r.specular)?n.specular=(new W.Color).fromArray(r.specular):"string"==typeof r.specular&&(n.specularMap=D.textures[r.specular]),void 0!==r.shininess&&(n.shininess=r.shininess);var O=new t(n);return void 0!==e.name&&(O.name=e.name),O})})},w.prototype.loadMeshes=function(){var m=this.json;return this._withDependencies(["accessors","materials"]).then(function(f){return x(m.meshes,function(e){var t=new W.Group;void 0!==e.name&&(t.name=e.name),e.extras&&(t.userData=e.extras);var i=e.primitives||[];for(var r in i){var n=i[r];if(n.mode===F.TRIANGLES||void 0===n.mode){var a=new W.BufferGeometry,o=n.attributes;for(var s in o){if(!(p=o[s]))return;var c=f.accessors[p];switch(s){case"POSITION":a.addAttribute("position",c);break;case"NORMAL":a.addAttribute("normal",c);break;case"TEXCOORD_0":case"TEXCOORD0":case"TEXCOORD":a.addAttribute("uv",c);break;case"TEXCOORD_1":a.addAttribute("uv2",c);break;case"COLOR_0":case"COLOR0":case"COLOR":a.addAttribute("color",c);break;case"WEIGHT":a.addAttribute("skinWeight",c);break;case"JOINT":a.addAttribute("skinIndex",c);break;default:if(!n.material)break;if(!(u=m.materials[n.material]).technique)break;var l=m.techniques[u.technique].parameters||{};for(var h in l)l[h].semantic===s&&a.addAttribute(h,c)}}n.indices&&a.setIndex(f.accessors[n.indices]);var u=void 0!==f.materials?f.materials[n.material]:new W.MeshPhongMaterial({color:0,emissive:8947848,specular:0,shininess:0,transparent:!1,depthTest:!0,side:W.FrontSide});(d=new W.Mesh(a,u)).castShadow=!0,d.name="0"===r?t.name:t.name+r,n.extras&&(d.userData=n.extras),t.add(d)}else if(n.mode===F.LINES){a=new W.BufferGeometry,o=n.attributes;for(var s in o){var p;if(!(p=o[s]))return;c=f.accessors[p];switch(s){case"POSITION":a.addAttribute("position",c);break;case"COLOR_0":case"COLOR0":case"COLOR":a.addAttribute("color",c)}}var d;u=f.materials[n.material];(d=n.indices?(a.setIndex(f.accessors[n.indices]),new W.LineSegments(a,u)):new W.Line(a,u)).name="0"===r?t.name:t.name+r,n.extras&&(d.userData=n.extras),t.add(d)}else console.warn("Only triangular and line primitives are supported")}return t})})},w.prototype.loadCameras=function(){return x(this.json.cameras,function(e){if("perspective"==e.type&&e.perspective){var t=e.perspective.yfov,i=void 0!==e.perspective.aspectRatio?e.perspective.aspectRatio:1,r=t*i,n=new W.PerspectiveCamera(W.Math.radToDeg(r),i,e.perspective.znear||1,e.perspective.zfar||2e6);return void 0!==e.name&&(n.name=e.name),e.extras&&(n.userData=e.extras),n}if("orthographic"==e.type&&e.orthographic){n=new W.OrthographicCamera(window.innerWidth/-2,window.innerWidth/2,window.innerHeight/2,window.innerHeight/-2,e.orthographic.znear,e.orthographic.zfar);return void 0!==e.name&&(n.name=e.name),e.extras&&(n.userData=e.extras),n}})},w.prototype.loadSkins=function(){var e=this.json;return this._withDependencies(["accessors"]).then(function(i){return x(e.skins,function(e){var t=new W.Matrix4;return void 0!==e.bindShapeMatrix&&t.fromArray(e.bindShapeMatrix),{bindShapeMatrix:t,jointNames:e.jointNames,inverseBindMatrices:i.accessors[e.inverseBindMatrices]}})})},w.prototype.loadAnimations=function(){var e=this.json;return this._withDependencies(["accessors","nodes"]).then(function(g){return x(e.animations,function(e,t){var i=[];for(var r in e.channels){var n=e.channels[r],a=e.samplers[n.sampler];if(a){var o=n.target,s=o.id,c=void 0!==e.parameters?e.parameters[a.input]:a.input,l=void 0!==e.parameters?e.parameters[a.output]:a.output,h=g.accessors[c],u=g.accessors[l],p=g.nodes[s];if(p){p.updateMatrix(),p.matrixAutoUpdate=!0;var d=v[o.path]===v.rotation?W.QuaternionKeyframeTrack:W.VectorKeyframeTrack,f=p.name?p.name:p.uuid,m=void 0!==a.interpolation?y[a.interpolation]:W.InterpolateLinear;i.push(new d(f+"."+v[o.path],W.AnimationUtils.arraySlice(h.array,0),W.AnimationUtils.arraySlice(u.array,0),m))}}}s=void 0!==e.name?e.name:"animation_"+t;return new W.AnimationClip(s,void 0,i)})})},w.prototype.loadNodes=function(){var A=this.json,R=this.extensions,e=this;return x(A.nodes,function(e){var t,i=new W.Matrix4;return e.jointName?((t=new W.Bone).name=void 0!==e.name?e.name:e.jointName,t.jointName=e.jointName):(t=new W.Object3D,void 0!==e.name&&(t.name=e.name)),e.extras&&(t.userData=e.extras),void 0!==e.matrix?(i.fromArray(e.matrix),t.applyMatrix(i)):(void 0!==e.translation&&t.position.fromArray(e.translation),void 0!==e.rotation&&t.quaternion.fromArray(e.rotation),void 0!==e.scale&&t.scale.fromArray(e.scale)),t}).then(function(L){return e._withDependencies(["meshes","skins","cameras"]).then(function(S){return x(L,function(e,t){var i=A.nodes[t];if(void 0!==i.meshes)for(var r in i.meshes){var n=i.meshes[r],a=S.meshes[n];if(void 0!==a)for(var o in a.children){var s,c=a.children[o],l=c.material,h=c.geometry,u=c.userData,p=c.name;switch(l.isDeferredShaderMaterial?l=d=l.create():d=l,c.type){case"LineSegments":c=new W.LineSegments(h,d);break;case"LineLoop":c=new W.LineLoop(h,d);break;case"Line":c=new W.Line(h,d);break;default:c=new W.Mesh(h,d)}if(c.castShadow=!0,c.userData=u,c.name=p,i.skin&&(s=S.skins[i.skin]),s){var d,f=function(e){for(var t=Object.keys(L),i=0,r=t.length;i<r;i++){var n=L[t[i]];if(n.jointName===e)return n}return null},m=h;(d=l).skinning=!0,(c=new W.SkinnedMesh(m,d)).castShadow=!0,c.userData=u,c.name=p;for(var g=[],v=[],y=0,x=s.jointNames.length;y<x;y++){var b=s.jointNames[y],w=f(b);if(w){g.push(w);var _=s.inverseBindMatrices.array,M=(new W.Matrix4).fromArray(_,16*y);v.push(M)}else console.warn("WARNING: joint: '"+b+"' could not be found")}c.bind(new W.Skeleton(g,v),s.bindShapeMatrix);!function e(t,i,r){var n=t[r];if(void 0!==n)for(var a=0,o=n.length;a<o;a++){var s=n[a],c=L[s],l=A.nodes[s];void 0!==c&&!0===c.isBone&&void 0!==l&&(i.add(c),e(l,c,"children"))}}(i,c,"skeletons")}e.add(c)}else console.warn("LegacyGLTFLoader: Couldn't find node \""+n+'".')}if(void 0!==i.camera){var E=S.cameras[i.camera];e.add(E)}if(i.extensions&&i.extensions[U.KHR_MATERIALS_COMMON]&&i.extensions[U.KHR_MATERIALS_COMMON].light){var T=R[U.KHR_MATERIALS_COMMON].lights[i.extensions[U.KHR_MATERIALS_COMMON].light];e.add(T)}return e})})})},w.prototype.loadScenes=function(){var c=this.json;function l(e,t,i){var r=i[e];t.add(r);var n=c.nodes[e];if(n.children)for(var a=n.children,o=0,s=a.length;o<s;o++){l(a[o],r,i)}}return this._withDependencies(["nodes"]).then(function(a){return x(c.scenes,function(e){var t=new W.Scene;void 0!==e.name&&(t.name=e.name),e.extras&&(t.userData=e.extras);for(var i=e.nodes||[],r=0,n=i.length;r<n;r++){l(i[r],t,a.nodes)}return t.traverse(function(e){e.material&&e.material.isRawShaderMaterial&&(e.gltfShader=new o(e,a.nodes),e.onBeforeRender=function(e,t,i){this.gltfShader.update(t,i)})}),t})})},e}(),t.exports=W.LegacyGLTFLoader},{three:2}],9:[function(e,t,i){function p(e){this.manager=void 0!==e?e:c.DefaultLoadingManager}var c=e("three");p.prototype={constructor:p,load:function(e,t,i,r){var n=this,a=new c.FileLoader(this.manager);a.setPath(this.path),a.load(e,function(e){t(n.parse(e))},i,r)},setPath:function(e){this.path=e},setTexturePath:function(e){this.texturePath=e},setBaseUrl:function(e){console.warn("THREE.MTLLoader: .setBaseUrl() is deprecated. Use .setTexturePath( path ) for texture path or .setPath( path ) for general base path instead."),this.setTexturePath(e)},setCrossOrigin:function(e){this.crossOrigin=e},setMaterialOptions:function(e){this.materialOptions=e},parse:function(e){for(var t=e.split("\n"),i={},r=/\s+/,n={},a=0;a<t.length;a++){var o=t[a];if(0!==(o=o.trim()).length&&"#"!==o.charAt(0)){var s=o.indexOf(" "),c=0<=s?o.substring(0,s):o;c=c.toLowerCase();var l=0<=s?o.substring(s+1):"";if(l=l.trim(),"newmtl"===c)i={name:l},n[l]=i;else if(i)if("ka"===c||"kd"===c||"ks"===c){var h=l.split(r,3);i[c]=[parseFloat(h[0]),parseFloat(h[1]),parseFloat(h[2])]}else i[c]=l}}var u=new p.MaterialCreator(this.texturePath||this.path,this.materialOptions);return u.setCrossOrigin(this.crossOrigin),u.setManager(this.manager),u.setMaterials(n),u}},(p.MaterialCreator=function(e,t){this.baseUrl=e||"",this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:c.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:c.RepeatWrapping}).prototype={constructor:p.MaterialCreator,setCrossOrigin:function(e){this.crossOrigin=e},setManager:function(e){this.manager=e},setMaterials:function(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(e){if(!this.options)return e;var t={};for(var i in e){var r=e[i],n={};for(var a in t[i]=n,r){var o=!0,s=r[a],c=a.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(s=[s[0]/255,s[1]/255,s[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===s[0]&&0===s[1]&&0===s[2]&&(o=!1)}o&&(n[c]=s)}}return t},preload:function(){for(var e in this.materialsInfo)this.create(e)},getIndex:function(e){return this.nameLookup[e]},getAsArray:function(){var e=0;for(var t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray},create:function(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]},createMaterial_:function(e){var o=this,t=this.materialsInfo[e],s={name:e,side:this.side};function i(e,t){if(!s[e]){var i,r,n=o.getTextureParams(t,s),a=o.loadTexture((i=o.baseUrl,"string"!=typeof(r=n.url)||""===r?"":/^https?:\/\//i.test(r)?r:i+r));a.repeat.copy(n.scale),a.offset.copy(n.offset),a.wrapS=o.wrap,a.wrapT=o.wrap,s[e]=a}}for(var r in t){var n=t[r];if(""!==n)switch(r.toLowerCase()){case"kd":s.color=(new c.Color).fromArray(n);break;case"ks":s.specular=(new c.Color).fromArray(n);break;case"map_kd":i("map",n);break;case"map_ks":i("specularMap",n);break;case"map_bump":case"bump":i("bumpMap",n);break;case"ns":s.shininess=parseFloat(n);break;case"d":n<1&&(s.opacity=n,s.transparent=!0);break;case"Tr":0<n&&(s.opacity=1-n,s.transparent=!0)}}return this.materials[e]=new c.MeshPhongMaterial(s),this.materials[e]},getTextureParams:function(e,t){var i,r={scale:new c.Vector2(1,1),offset:new c.Vector2(0,0)},n=e.split(/\s+/);return 0<=(i=n.indexOf("-bm"))&&(t.bumpScale=parseFloat(n[i+1]),n.splice(i,2)),0<=(i=n.indexOf("-s"))&&(r.scale.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),0<=(i=n.indexOf("-o"))&&(r.offset.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),r.url=n.join(" ").trim(),r},loadTexture:function(e,t,i,r,n){var a,o=c.Loader.Handlers.get(e),s=void 0!==this.manager?this.manager:c.DefaultLoadingManager;return null===o&&(o=new c.TextureLoader(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin),a=o.load(e,i,r,n),void 0!==t&&(a.mapping=t),a}},t.exports=p},{three:2}],10:[function(e,t,i){function r(e){this.manager=void 0!==e?e:I.DefaultLoadingManager,this.materials=null,this.regexp={vertex_pattern:/^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}}var I=e("three");r.prototype={constructor:r,load:function(e,t,i,r){var n=this,a=new I.FileLoader(n.manager);a.setPath(this.path),a.load(e,function(e){t(n.parse(e))},i,r)},setPath:function(e){this.path=e},setMaterials:function(e){this.materials=e},_createParserState:function(){var e={objects:[],object:{},vertices:[],normals:[],uvs:[],materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var i=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],uvs:[]},materials:[],smooth:!0,startMaterial:function(e,t){var i=this._finalize(!1);i&&(i.inherited||i.groupCount<=0)&&this.materials.splice(i.index,1);var r={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:void 0!==i?i.smooth:this.smooth,groupStart:void 0!==i?i.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var i=this.materials.length-1;0<=i;i--)this.materials[i].groupCount<=0&&this.materials.splice(i,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},i&&i.name&&"function"==typeof i.clone){var r=i.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var i=parseInt(e,10);return 3*(0<=i?i-1:i+t/3)},parseNormalIndex:function(e,t){var i=parseInt(e,10);return 3*(0<=i?i-1:i+t/3)},parseUVIndex:function(e,t){var i=parseInt(e,10);return 2*(0<=i?i-1:i+t/2)},addVertex:function(e,t,i){var r=this.vertices,n=this.object.geometry.vertices;n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addVertexLine:function(e){var t=this.vertices,i=this.object.geometry.vertices;i.push(t[e+0]),i.push(t[e+1]),i.push(t[e+2])},addNormal:function(e,t,i){var r=this.normals,n=this.object.geometry.normals;n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addUV:function(e,t,i){var r=this.uvs,n=this.object.geometry.uvs;n.push(r[e+0]),n.push(r[e+1]),n.push(r[t+0]),n.push(r[t+1]),n.push(r[i+0]),n.push(r[i+1])},addUVLine:function(e){var t=this.uvs,i=this.object.geometry.uvs;i.push(t[e+0]),i.push(t[e+1])},addFace:function(e,t,i,r,n,a,o,s,c,l,h,u){var p,d=this.vertices.length,f=this.parseVertexIndex(e,d),m=this.parseVertexIndex(t,d),g=this.parseVertexIndex(i,d);if(void 0===r?this.addVertex(f,m,g):(p=this.parseVertexIndex(r,d),this.addVertex(f,m,p),this.addVertex(m,g,p)),void 0!==n){var v=this.uvs.length;f=this.parseUVIndex(n,v),m=this.parseUVIndex(a,v),g=this.parseUVIndex(o,v),void 0===r?this.addUV(f,m,g):(p=this.parseUVIndex(s,v),this.addUV(f,m,p),this.addUV(m,g,p))}if(void 0!==c){var y=this.normals.length;f=this.parseNormalIndex(c,y),m=c===l?f:this.parseNormalIndex(l,y),g=c===h?f:this.parseNormalIndex(h,y),void 0===r?this.addNormal(f,m,g):(p=this.parseNormalIndex(u,y),this.addNormal(f,m,p),this.addNormal(m,g,p))}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var i=this.vertices.length,r=this.uvs.length,n=0,a=e.length;n<a;n++)this.addVertexLine(this.parseVertexIndex(e[n],i));var o=0;for(a=t.length;o<a;o++)this.addUVLine(this.parseUVIndex(t[o],r))}};return e.startObject("",!1),e},parse:function(e){var t=this._createParserState();-1!==e.indexOf("\r\n")&&(e=e.replace(/\r\n/g,"\n")),-1!==e.indexOf("\\\n")&&(e=e.replace(/\\\n/g,""));for(var i=e.split("\n"),r="",n="",a="",o=[],s="function"==typeof"".trimLeft,c=0,l=i.length;c<l;c++)if(r=i[c],0!==(r=s?r.trimLeft():r.trim()).length&&"#"!==(n=r.charAt(0)))if("v"===n)if(" "===(a=r.charAt(1))&&null!==(o=this.regexp.vertex_pattern.exec(r)))t.vertices.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));else if("n"===a&&null!==(o=this.regexp.normal_pattern.exec(r)))t.normals.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));else{if("t"!==a||null===(o=this.regexp.uv_pattern.exec(r)))throw new Error("Unexpected vertex/normal/uv line: '"+r+"'");t.uvs.push(parseFloat(o[1]),parseFloat(o[2]))}else if("f"===n)if(null!==(o=this.regexp.face_vertex_uv_normal.exec(r)))t.addFace(o[1],o[4],o[7],o[10],o[2],o[5],o[8],o[11],o[3],o[6],o[9],o[12]);else if(null!==(o=this.regexp.face_vertex_uv.exec(r)))t.addFace(o[1],o[3],o[5],o[7],o[2],o[4],o[6],o[8]);else if(null!==(o=this.regexp.face_vertex_normal.exec(r)))t.addFace(o[1],o[3],o[5],o[7],void 0,void 0,void 0,void 0,o[2],o[4],o[6],o[8]);else{if(null===(o=this.regexp.face_vertex.exec(r)))throw new Error("Unexpected face line: '"+r+"'");t.addFace(o[1],o[2],o[3],o[4])}else if("l"===n){var h=r.substring(1).trim().split(" "),u=[],p=[];if(-1===r.indexOf("/"))u=h;else for(var d=0,f=h.length;d<f;d++){var m=h[d].split("/");""!==m[0]&&u.push(m[0]),""!==m[1]&&p.push(m[1])}t.addLineGeometry(u,p)}else if(null!==(o=this.regexp.object_pattern.exec(r))){var g=(" "+o[0].substr(1).trim()).substr(1);t.startObject(g)}else if(this.regexp.material_use_pattern.test(r))t.object.startMaterial(r.substring(7).trim(),t.materialLibraries);else if(this.regexp.material_library_pattern.test(r))t.materialLibraries.push(r.substring(7).trim());else{if(null===(o=this.regexp.smoothing_pattern.exec(r))){if("\0"===r)continue;throw new Error("Unexpected line: '"+r+"'")}var v=o[1].trim().toLowerCase();t.object.smooth="1"===v||"on"===v,(R=t.object.currentMaterial())&&(R.smooth=t.object.smooth)}t.finalize();var y=new I.Group;y.materialLibraries=[].concat(t.materialLibraries);for(c=0,l=t.objects.length;c<l;c++){var x=t.objects[c],b=x.geometry,w=x.materials,_="Line"===b.type;if(0!==b.vertices.length){var M=new I.BufferGeometry;M.addAttribute("position",new I.BufferAttribute(new Float32Array(b.vertices),3)),0<b.normals.length?M.addAttribute("normal",new I.BufferAttribute(new Float32Array(b.normals),3)):M.computeVertexNormals(),0<b.uvs.length&&M.addAttribute("uv",new I.BufferAttribute(new Float32Array(b.uvs),2));for(var E,T=[],S=0,L=w.length;S<L;S++){var A=w[S],R=void 0;if(null!==this.materials&&(R=this.materials.create(A.name),_&&R&&!(R instanceof I.LineBasicMaterial))){var P=new I.LineBasicMaterial;P.copy(R),P.lights=!1,R=P}R||((R=_?new I.LineBasicMaterial:new I.MeshPhongMaterial).name=A.name),R.shading=A.smooth?I.SmoothShading:I.FlatShading,T.push(R)}if(1<T.length){for(S=0,L=w.length;S<L;S++){A=w[S];M.addGroup(A.groupStart,A.groupCount,S)}var C=new I.MultiMaterial(T);E=_?new I.LineSegments(M,C):new I.Mesh(M,C)}else E=_?new I.LineSegments(M,T[0]):new I.Mesh(M,T[0]);E.name=x.name,y.add(E)}}return y}},t.exports=r},{three:2}],11:[function(e,t,i){var o=e("three"),a=e("./constants.js"),r=e("./Camera/CameraSync.js"),n=(e("./Utils/Utils.js"),e("./Layers/SymbolLayer3D.js"));function s(e,t){this.map=e,this.mapContext=t,this.WORLD_SIZE=e.projection.getTileSize(),this.PROJECTION_WORLD_SIZE=this.WORLD_SIZE/(a.MERCATOR_A*Math.PI)/2,t&&t instanceof WebGLRenderingContext?(this.renderer=new o.WebGLRenderer({alpha:!0,antialias:!0,canvas:e.getCanvas(),context:t}),this.renderer.shadowMap.enabled=!0,this.renderer.autoClear=!1):(this.renderer=new o.WebGLRenderer({alpha:!0,antialias:!0}),this.renderer.setSize(this.map.transform.width,this.map.transform.height),this.renderer.shadowMap.enabled=!0,t?t.appendChild(this.renderer.domElement):(this.map._container.appendChild(this.renderer.domElement),this.renderer.domElement.style.position="relative",this.renderer.domElement.style["pointer-events"]="none",this.renderer.domElement.style["z-index"]=1e3));var i=this;this.map.on("resize",function(){i.renderer.setSize(i.map.transform.width,i.map.transform.height)}),this.scene=new o.Scene,this.camera=new o.PerspectiveCamera(28,window.innerWidth/window.innerHeight,1e-6,5e9),this.layers=[],this.world=new o.Group,this.scene.add(this.world),this.cameraSynchronizer=new r(this.map,this.camera,this.world),this.world2=new o.Group,this.scene.add(this.world2),this.matrix=this.getWorldMatrix(),this.raycaster=new o.Raycaster,t instanceof WebGLRenderingContext||["load","zoom","rotate","drag","pitch","move","resize"].forEach(function(e){i.map.on(e,function(e){i.render()})})}s.prototype={SymbolLayer3D:n,update:function(){this.render();var t=this;requestAnimationFrame(function(e){t.update(e)})},render:function(){this.matrixTransformWorld2(),this.renderer.state.reset(),this.renderer.render(this.scene,this.camera)},queryRenderedFeatures:function(e){var t=new o.Vector2;return t.x=e.x/this.map.transform.width*2-1,t.y=-e.y/this.map.transform.height*2+1,this.raycaster.setFromCamera(t,this.camera),this.raycaster.intersectObjects(this.scene.children,!0)},applyInverseOfWorldMatrix:function(e){var t=new o.Matrix4;return t.getInverse(this.world.matrixWorld),e.applyMatrix4(t)},applyWorldMatrix:function(e){return e.applyMatrix4(this.world.matrixWorld)},matrixTransformWorld2:function(){var e=this.world2.children;if(!(e.length<1)){var t=this.matrix.clone(),i=t.getInverse(t);this.matrix=this.getWorldMatrix();for(var r=0,n=e.length;r<n;r++)if(!1!==e[r].visible&&e[r]instanceof o.Group&&e[r].userData.isGeoGroup&&(e[r].children[0]&&e[r].children[0].geometry&&(e[r].children[0].geometry.applyMatrix(i),e[r].children[0].geometry.applyMatrix(this.matrix)),e[r].children[0]&&e[r].children[0]instanceof o.Group&&e[r].children[0].userData.attributes)){var a=this;e[r].children[0].children.forEach(function(e){e.geometry&&(e.geometry.applyMatrix(i),e.geometry.applyMatrix(a.matrix))})}}},getWorldMatrix:function(){var e=this.map.transform.scale,t=new o.Matrix4,i=new o.Matrix4,r=new o.Matrix4,n=new o.Matrix4;t.makeScale(e,e,e),this.map._tileExtent?i.makeTranslation(-this.map._tileExtent[0]*this.WORLD_SIZE/(this.map._tileExtent[2]-this.map._tileExtent[0]),-this.map._tileExtent[3]*this.WORLD_SIZE/(this.map._tileExtent[3]-this.map._tileExtent[1]),0):i.makeTranslation(this.WORLD_SIZE/2,-this.WORLD_SIZE/2,0),r.makeTranslation(-this.map.transform.x||-this.map.transform.point.x,this.map.transform.y||this.map.transform.point.y,0),n.makeRotationZ(Math.PI);var a=new o.Matrix4;return a.premultiply(n).premultiply(i).premultiply(t).premultiply(r),a},projectToWorld:function(e){if("m"==(this.map.units&&"m"===this.map.units?"m":"degrees"))return this.projectToWorldIn80(e);if(this.map._tileExtent[3]-this.map._tileExtent[0]<721)return this.projectToWorldIn2000(e);var t=[-a.MERCATOR_A*e[0]*a.DEG2RAD*this.PROJECTION_WORLD_SIZE,-a.MERCATOR_A*Math.log(Math.tan(.25*Math.PI+.5*e[1]*a.DEG2RAD))*this.PROJECTION_WORLD_SIZE],i=this.PROJECTION_WORLD_SIZE,r=e[2]||0;return t.push(r*i),new o.Vector3(t[0],t[1],t[2])},projectedUnitsPerMeter:function(e){return"m"==(this.map.units&&"m"===this.map.units?"m":"degrees")?this.projectedUnitsPerMeterIn80():this.map._tileExtent[3]-this.map._tileExtent[0]<721?this.projectedUnitsPerMeterIn2000():Math.abs(this.WORLD_SIZE*(1/Math.cos(e*Math.PI/180))/a.EARTH_CIRCUMFERENCE)},projectedUnitsPerMeterInScale:function(e){return"m"==(this.map.units&&"m"===this.map.units?"m":"degrees")?this.projectedUnitsPerMeterIn80():Math.abs(this.WORLD_SIZE*(1/Math.cos(e*Math.PI/180))/a.EARTH_CIRCUMFERENCE)},distaneToWorld:function(e){if("m"==(this.map.units&&"m"===this.map.units?"m":"degrees"))return(e=e||0)*this.projectedUnitsPerMeterIn80();if(this.map._tileExtent[3]-this.map._tileExtent[0]<721)return(e=e||0)*(360/(2*Math.PI*a.MERCATOR_A))*this.projectedUnitsPerMeterIn2000();e=e||0;return this.PROJECTION_WORLD_SIZE*e},_scaleVerticesToMeters:function(e,t){for(var i=this.projectedUnitsPerMeter(e[1]),r=(this.projectToWorld(e),0);r<t.length;r++)t[r].multiplyScalar(i);return t},projectToScreen:function(){console.log("WARNING: Projecting to screen coordinates is not yet implemented")},unprojectFromScreen:function(){console.log("WARNING: unproject is not yet implemented")},unprojectFromWorld:function(e){if("m"==(this.map.units&&"m"===this.map.units?"m":"degrees"))return this.unprojectFromWorldIn80(e);if(this.map._tileExtent[3]-this.map._tileExtent[0]<721)return this.unprojectFromWorldIn2000(e);var t=[-e.x/(a.MERCATOR_A*a.DEG2RAD*this.PROJECTION_WORLD_SIZE),2*(Math.atan(Math.exp(e.y/(this.PROJECTION_WORLD_SIZE*-a.MERCATOR_A)))-Math.PI/4)/a.DEG2RAD],i=s.this.PROJECTION_WORLD_SIZE,r=e.z||0;return t.push(r/i),t},_flipMaterialSides:function(){},addAtCoordinate:function(e,t,i){var r=new o.Group;return r.userData.isGeoGroup=!0,r.add(e),this._flipMaterialSides(e),this.world.add(r),this.moveToCoordinate(e,t,i),e},moveToCoordinate:function(e,t,i){void 0===i&&(i={}),void 0===i.preScale&&(i.preScale=1),void 0!==i.scaleToLatitude&&!e.userData.scaleToLatitude||(i.scaleToLatitude=!0),e.userData.scaleToLatitude=i.scaleToLatitude,"number"==typeof i.preScale?i.preScale=new o.Vector3(i.preScale,i.preScale,i.preScale):i.preScale.constructor===Array&&3===i.preScale.length?i.preScale=new o.Vector3(i.preScale[0],i.preScale[1],i.preScale[2]):i.preScale.constructor!==o.Vector3&&(console.warn("Invalid preScale value: number, Array with length 3, or THREE.Vector3 expected. Defaulting to [1,1,1]"),i.preScale=new o.Vector3(1,1,1));var r,n=i.preScale;if(e.userData.isGeoGroup)r=e;else{if(!e.parent||!e.parent.userData.isGeoGroup)return console.error("Cannot set geographic coordinates of object that does not have an associated GeoGroup. Object must be added to scene with 'addAtCoordinate()'.");r=e.parent}if(i.scaleToLatitude){var a=this.projectedUnitsPerMeterInScale(t[1]);n.multiplyScalar(a)}return r.scale.copy(n),r.position.copy(this.projectToWorld(t)),e.coordinates=t,e},addGeoreferencedMesh:function(e){var t=new o.Group;return t.userData.isGeoGroup=!0,t.add(e),this.world.add(t),e},addGeoreferencedMeshToWorld2:function(e){if(e.geometry&&e.geometry.applyMatrix(this.matrix),e instanceof o.Group){var t=this;e.children.forEach(function(e){e.geometry&&e.geometry.applyMatrix(t.matrix)})}var i=new o.Group;return i.userData.isGeoGroup=!0,i.add(e),this.world2.add(i),e},addSymbolLayer:function(e){var t=new n(this,e);return this.layers.push(t),t},getDataLayer:function(e){for(var t=0;t<this.layers.length;t++)if(this.layer.id===e)return layer},remove:function(e){this.world.remove(e)},setupDefaultLights:function(){this.scene.add(new o.AmbientLight(13421772));var e=new o.DirectionalLight(16777215,.5);e.position.set(0,800,1e3),e.matrixWorldNeedsUpdate=!0,this.world.add(e)},projectToWorldIn80:function(e){var t=this.projectedUnitsPerMeterIn80(),i=[-e[0]*t,-e[1]*t],r=e[2]||0;return i.push(r*t),new o.Vector3(i[0],i[1],i[2])},projectToWorldIn2000:function(e){var t=this.projectedUnitsPerMeterIn2000(),i=[-e[0]*t,-e[1]*t],r=(e[2]||0)*(360/(2*Math.PI*a.MERCATOR_A));return i.push(r*t),new o.Vector3(i[0],i[1],i[2])},unprojectFromWorldIn80:function(e){var t=this.projectedUnitsPerMeterIn80(),i=[-e.x/t,-e.y/t],r=e.z||0;return i.push(r/t),i},unprojectFromWorldIn2000:function(e){var t=this.projectedUnitsPerMeterIn2000(),i=[-e.x/t,-e.y/t],r=(e.z||0)/t,n=2*Math.PI*a.MERCATOR_A/360;return i.push(r*n),i},projectedUnitsPerMeterIn80:function(){return this.map._tileExtent?1/((this.map._tileExtent[2]-this.map._tileExtent[0])/this.WORLD_SIZE):(console.error("mapCRS not defined topTileExtent"),1e-5)},projectedUnitsPerMeterIn2000:function(){return this.map._tileExtent?1/((this.map._tileExtent[2]-this.map._tileExtent[0])/this.WORLD_SIZE):(console.error("mapCRS not defined topTileExtent"),1e-5)}},t.exports=s},{"./Camera/CameraSync.js":3,"./Layers/SymbolLayer3D.js":4,"./Utils/Utils.js":12,"./constants.js":14,three:2}],12:[function(e,t,i){var s=e("three");t.exports.prettyPrintMatrix=function(e){for(var t=0;t<4;t++){var i=[e[t],e[t+4],e[t+8],e[t+12]];console.log(i.map(function(e){return e.toFixed(4)}))}},t.exports.makePerspectiveMatrix=function(e,t,i,r){var n=new s.Matrix4,a=1/Math.tan(e/2),o=1/(i-r);return n.elements[0]=a/t,n.elements[1]=0,n.elements[2]=0,n.elements[3]=0,n.elements[4]=0,n.elements[5]=a,n.elements[6]=0,n.elements[7]=0,n.elements[8]=0,n.elements[9]=0,n.elements[10]=(r+i)*o,n.elements[11]=-1,n.elements[12]=0,n.elements[13]=0,n.elements[14]=2*r*i*o,n.elements[15]=0,n},t.exports.radify=function(e){return"object"===(void 0===e?"undefined":_typeof(e))?e.map(function(e){return 2*Math.PI*e/360}):2*Math.PI*e/360},t.exports.degreeify=function(e){return 360*e/(2*Math.PI)}},{three:2}],13:[function(e,t,i){t.exports=function(t){return"object"===(void 0===t?"undefined":_typeof(t))&&void 0!==t.property?function(e){return e.properties[t.property]}:"object"===(void 0===t?"undefined":_typeof(t))&&void 0!==t.generator?t.generator:function(){return t}}},{}],14:[function(e,t,i){t.exports={WORLD_SIZE:512,PROJECTION_WORLD_SIZE:512/(6378137*Math.PI)/2,MERCATOR_A:6378137,DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,EARTH_CIRCUMFERENCE:40075e3}},{}],15:[function(e,t,i){var r=e("three");r.Line2=function(e,t){r.LineSegments2.call(this),this.type="Line2",this.geometry=void 0!==e?e:new r.LineGeometry,this.material=void 0!==t?t:new r.LineMaterial({color:16777215*Math.random()})},r.Line2.prototype=Object.assign(Object.create(r.LineSegments2.prototype),{constructor:r.Line2,isLine2:!0,copy:function(){return this}}),t.exports=r.Line2},{three:2}],16:[function(e,t,i){var n=e("three");n.LineGeometry=function(){n.LineSegmentsGeometry.call(this),this.type="LineGeometry"},n.LineGeometry.prototype=Object.assign(Object.create(n.LineSegmentsGeometry.prototype),{constructor:n.LineGeometry,isLineGeometry:!0,setPositions:function(e){for(var t=e.length-3,i=new Float32Array(2*t),r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return n.LineSegmentsGeometry.prototype.setPositions.call(this,i),this},setColors:function(e){for(var t=e.length-3,i=new Float32Array(2*t),r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return n.LineSegmentsGeometry.prototype.setColors.call(this,i),this},fromLine:function(e){var t=e.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this},copy:function(){return this}}),t.exports=n.LineGeometry},{three:2}],17:[function(e,t,i){var r=e("three");r.UniformsLib.line={linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},r.ShaderLib.line={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\t\tvarying vec2 vUv;\n\t\t#ifdef USE_DASH\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\t\t#endif\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\t\t}\n\t\tvoid main() {\n\t\t\t#ifdef USE_COLOR\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\t\t\t#endif\n\t\t\t#ifdef USE_DASH\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t#endif\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\t\t\tvUv = uv;\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\t\t\tif ( perspective ) {\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\t\t\t\t\ttrimSegment( start, end );\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\t\t\t\t\ttrimSegment( end, start );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\t\t\t\toffset += - dir;\n\t\t\t} else if ( position.y > 1.0 ) {\n\t\t\t\toffset += dir;\n\t\t\t}\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\t\t\tclip.xy += offset;\n\t\t\tgl_Position = clip;\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\t#ifdef USE_DASH\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\t\t#endif\n\t\tvarying float vLineDistance;\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <clipping_planes_fragment>\n\t\t\t#ifdef USE_DASH\n\t\t\t\tif ( vUv.y < 0.5 || vUv.y > 0.5 ) discard; // discard endcaps\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\t\t\t#endif\n\t\t\tif ( vUv.y < 0.5 || vUv.y > 0.5 ) {\n\t\t\t\tfloat a = vUv.x - 0.5;\n\t\t\t\tfloat b = vUv.y - 0.5;\n\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\tif ( len2 > 0.25 ) discard;\n\t\t\t}\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\t\t\t#include <premultiplied_alpha_fragment>\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t}\n\t\t"},r.LineMaterial=function(e){r.ShaderMaterial.call(this,{type:"LineMaterial",uniforms:r.UniformsUtils.clone(r.ShaderLib.line.uniforms),vertexShader:r.ShaderLib.line.vertexShader,fragmentShader:r.ShaderLib.line.fragmentShader}),this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)},r.LineMaterial.prototype=Object.create(r.ShaderMaterial.prototype),r.LineMaterial.prototype.constructor=r.LineMaterial,r.LineMaterial.prototype.isLineMaterial=!0,r.LineMaterial.prototype.copy=function(e){return r.ShaderMaterial.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.resolution=e.resolution,this},t.exports=r.LineMaterial},{three:2}],18:[function(e,t,i){var c,l,h=e("three");h.LineSegments2=function(e,t){h.Mesh.call(this),this.type="LineSegments2",this.geometry=void 0!==e?e:new h.LineSegmentsGeometry,this.material=void 0!==t?t:new h.LineMaterial({color:16777215*Math.random()})},h.LineSegments2.prototype=Object.assign(Object.create(h.Mesh.prototype),{constructor:h.LineSegments2,isLineSegments2:!0,computeLineDistances:(c=new h.Vector3,l=new h.Vector3,function(){for(var e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.data.count),n=0,a=0,o=t.data.count;n<o;n++,a+=2)c.fromBufferAttribute(t,n),l.fromBufferAttribute(i,n),r[a]=0===a?0:r[a-1],r[a+1]=r[a]+c.distanceTo(l);var s=new h.InstancedInterleavedBuffer(r,2,1);return e.addAttribute("instanceDistanceStart",new h.InterleavedBufferAttribute(s,1,0)),e.addAttribute("instanceDistanceEnd",new h.InterleavedBufferAttribute(s,1,1)),this}),copy:function(){return this}}),t.exports=h.LineSegments2},{three:2}],19:[function(e,t,i){var o,r,s=e("three");s.LineSegmentsGeometry=function(){s.InstancedBufferGeometry.call(this),this.type="LineSegmentsGeometry";new s.BufferGeometry;this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.addAttribute("position",new s.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.addAttribute("uv",new s.Float32BufferAttribute([0,1,1,1,0,.5,1,.5,0,.5,1,.5,0,0,1,0],2))},s.LineSegmentsGeometry.prototype=Object.assign(Object.create(s.InstancedBufferGeometry.prototype),{constructor:s.LineSegmentsGeometry,isLineSegmentsGeometry:!0,applyMatrix:function(e){var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==t&&(e.applyToBufferAttribute(t),e.applyToBufferAttribute(i),t.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},setPositions:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var i=new s.InstancedInterleavedBuffer(t,6,1);return this.addAttribute("instanceStart",new s.InterleavedBufferAttribute(i,3,0)),this.addAttribute("instanceEnd",new s.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},setColors:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var i=new s.InstancedInterleavedBuffer(t,6,1);return this.addAttribute("instanceColorStart",new s.InterleavedBufferAttribute(i,3,0)),this.addAttribute("instanceColorEnd",new s.InterleavedBufferAttribute(i,3,3)),this},fromWireframeGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromEdgesGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromMesh:function(e){return this.fromWireframeGeometry(new s.WireframeGeometry(e.geometry)),this},fromLineSegements:function(e){var t=e.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this},computeBoundingBox:(r=new s.Box3,function(){null===this.boundingBox&&(this.boundingBox=new s.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),r.setFromBufferAttribute(t),this.boundingBox.union(r))}),computeBoundingSphere:(o=new s.Vector3,function(){null===this.boundingSphere&&(this.boundingSphere=new s.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,n=0,a=e.count;n<a;n++)o.fromBufferAttribute(e,n),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(t,n),r=Math.max(r,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}),toJSON:function(){},clone:function(){},copy:function(){return this}}),t.exports=s.LineSegmentsGeometry},{three:2}],20:[function(e,t,i){var r,n;r=this,n=function(e){function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:0<e?1:+e}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}),t.prototype={addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners[e];if(void 0!==i){var r=i.indexOf(t);-1!==r&&i.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;var i=[],r=0,n=t.length;for(r=0;r<n;r++)i[r]=t[r];for(r=0;r<n;r++)i[r].call(this,e)}}}};var i,r,n,a,o,s,k=0,V=1,j=2,Y=1,U=2,w=0,Ue=1,Fe=2,Be=1,c=2,ze=0,Ge=0,W=1,X=2,q=3,Z=4,J=5,He=100,ke=204,Ve=205,K=0,Q=1,$=2,ee=3,te=4,ie=5,re=6,ne=7,F=0,B=1,z=2,G=0,je=1,H=2,ae=3,oe=4,se=301,ce=302,le=303,he=304,ue=305,pe=306,de=307,We=1001,Xe=1003,qe=1004,Ye=1005,Ze=1006,Je=1008,Ke=1009,Qe=1012,$e=1014,et=1015,tt=1016,it=1020,rt=1022,nt=1023,l=nt,at=1026,ot=1027,st=0,f=3e3,h=3001,m=3007,u=3002,p=3004,d=3005,g=3006,v=3200,_=3201,A={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),function(){for(var e=0;e<36;e++)8===e||13===e||18===e||23===e?n[e]="-":14===e?n[e]="4":(a<=2&&(a=33554432+16777216*Math.random()|0),i=15&a,a>>=4,n[e]=r[19===e?3&i|8:i]);return n.join("")}),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},lerp:function(e,t,i){return(1-i)*e+i*t},smoothstep:function(e,t,i){return e<=t?0:i<=e?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:i<=e?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*A.DEG2RAD},radToDeg:function(e){return e*A.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}};function fe(e,t){this.x=e||0,this.y=t||0}fe.prototype={constructor:fe,isVector2:!(a=0),get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return void 0===o&&(o=new fe,s=new fe),o.set(e,e),s.set(t,t),this.clamp(o,s)},clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},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(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*i-a*r+e.x,this.y=n*r+a*i+e.y,this}};var y,x,b,M,E,T,S,L,R,P,C,I,O,D,N,me,ge,ve,ye,xe=0;function be(e,t,i,r,n,a,o,s,c,l){Object.defineProperty(this,"id",{value:xe++}),this.uuid=A.generateUUID(),this.name="",this.image=void 0!==e?e:be.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:be.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:We,this.wrapT=void 0!==r?r:We,this.magFilter=void 0!==n?n:Ze,this.minFilter=void 0!==a?a:Je,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:nt,this.type=void 0!==s?s:Ke,this.offset=new fe(0,0),this.repeat=new fe(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:f,this.version=0,this.onUpdate=null}function ct(e,t,i,r){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==r?r:1}function we(e,t,i){this.uuid=A.generateUUID(),this.width=e,this.height=t,this.scissor=new ct(0,0,e,t),this.scissorTest=!1,this.viewport=new ct(0,0,e,t),void 0===(i=i||{}).minFilter&&(i.minFilter=Ze),this.texture=new be(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function _e(e,t,i){we.call(this,e,t,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function Me(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==r?r:1}function lt(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}function ht(){this.elements=new Float64Array([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 Ee(e,t,i,r,n,a,o,s,c,l){be.call(this,e=void 0!==e?e:[],t=void 0!==t?t:se,i,r,n,a,o,s,c,l),this.flipY=!1}be.DEFAULT_IMAGE=void 0,be.DEFAULT_MAPPING=300,be.prototype={constructor:be,isTexture:!0,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t,i,r={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=A.generateUUID()),void 0===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:(void 0!==(t=n).toDataURL?i=t:((i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=t.width,i.height=t.height,i.getContext("2d").drawImage(t,0,0,t.width,t.height)),2048<i.width||2048<i.height?i.toDataURL("image/jpeg",.6):i.toDataURL("image/png"))}),r.image=n.uuid}return e.textures[this.uuid]=r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||1<e.x)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case We:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||1<e.y)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case We:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(be.prototype,t.prototype),ct.prototype={constructor:ct,isVector4:!0,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,r,n,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],h=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,g=(h+1)/2,v=(f+1)/2,y=(s+l)/4,x=(c+p)/4,b=(u+d)/4;return g<m&&v<m?n=m<.01?(i=0,r=.707106781):(r=y/(i=Math.sqrt(m)),x/i):v<g?n=g<.01?(r=0,i=.707106781):(i=y/(r=Math.sqrt(g)),b/r):v<.01?(r=i=.707106781,n=0):(i=x/(n=Math.sqrt(v)),r=b/n),this.set(i,r,n,t),this}var w=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(l-s)*(l-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(c-p)/w,this.z=(l-s)/w,this.w=Math.acos((o+h+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===y&&(y=new ct,x=new ct),y.set(e,e,e,e),x.set(t,t,t,t),this.clamp(y,x)},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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},we.prototype={constructor:we,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(we.prototype,t.prototype),((_e.prototype=Object.create(we.prototype)).constructor=_e).prototype.isWebGLRenderTargetCube=!0,Me.prototype={constructor:Me,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1===(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=Math.cos(e._x/2),r=Math.cos(e._y/2),n=Math.cos(e._z/2),a=Math.sin(e._x/2),o=Math.sin(e._y/2),s=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(this._x=a*r*n+i*o*s,this._y=i*o*n-a*r*s,this._z=i*r*s+a*o*n,this._w=i*r*n-a*o*s):"YXZ"===c?(this._x=a*r*n+i*o*s,this._y=i*o*n-a*r*s,this._z=i*r*s-a*o*n,this._w=i*r*n+a*o*s):"ZXY"===c?(this._x=a*r*n-i*o*s,this._y=i*o*n+a*r*s,this._z=i*r*s+a*o*n,this._w=i*r*n-a*o*s):"ZYX"===c?(this._x=a*r*n-i*o*s,this._y=i*o*n+a*r*s,this._z=i*r*s-a*o*n,this._w=i*r*n+a*o*s):"YZX"===c?(this._x=a*r*n+i*o*s,this._y=i*o*n+a*r*s,this._z=i*r*s-a*o*n,this._w=i*r*n-a*o*s):"XZY"===c&&(this._x=a*r*n-i*o*s,this._y=i*o*n-a*r*s,this._z=i*r*s+a*o*n,this._w=i*r*n+a*o*s),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],c=i[9],l=i[2],h=i[6],u=i[10],p=r+s+u;return 0<p?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(h-c)*t,this._y=(a-l)*t,this._z=(o-n)*t):s<r&&u<r?(t=2*Math.sqrt(1+r-s-u),this._w=(h-c)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(a+l)/t):u<s?(t=2*Math.sqrt(1+s-r-u),this._w=(a-l)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(c+h)/t):(t=2*Math.sqrt(1+u-r-s),this._w=(o-n)/t,this._x=(a+l)/t,this._y=(c+h)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(e,t){return void 0===b&&(b=new lt),(M=e.dot(t)+1)<1e-6?(M=0,Math.abs(e.x)>Math.abs(e.z)?b.set(-e.y,e.x,0):b.set(0,-e.z,e.y)):b.crossVectors(e,t),this._x=b.x,this._y=b.y,this._z=b.z,this._w=M,this.normalize()},inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,r=e._y,n=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=i*l+a*o+r*c-n*s,this._y=r*l+a*s+n*o-i*c,this._z=n*l+a*c+i*s-r*o,this._w=a*l-i*o-r*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,r=this._y,n=this._z,a=this._w,o=a*e._w+i*e._x+r*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o)return this._w=a,this._x=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,o),l=Math.sin((1-t)*c)/s,h=Math.sin(t*c)/s;return this._w=a*l+this._w*h,this._x=i*l+this._x*h,this._y=r*l+this._y*h,this._z=n*l+this._z*h,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(Me,{slerp:function(e,t,i,r){return i.copy(e).slerp(t,r)},slerpFlat:function(e,t,i,r,n,a,o){var s=i[r+0],c=i[r+1],l=i[r+2],h=i[r+3],u=n[a+0],p=n[a+1],d=n[a+2],f=n[a+3];if(h!==f||s!==u||c!==p||l!==d){var m=1-o,g=s*u+c*p+l*d+h*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,l=l*m+d*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=_,c*=_,l*=_,h*=_}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h}}),lt.prototype={constructor:lt,isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===I&&(I=new Me),this.applyQuaternion(I.setFromEuler(e))},applyAxisAngle:function(e,t){return void 0===C&&(C=new Me),this.applyQuaternion(C.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r+n[12],this.y=n[1]*t+n[5]*i+n[9]*r+n[13],this.z=n[2]*t+n[6]*i+n[10]*r+n[14],this},applyProjection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements,a=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*a,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*a,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*i,l=s*i+o*t-n*r,h=s*r+n*i-a*t,u=-n*t-a*i-o*r;return this.x=c*s+u*-n+l*-o-h*-a,this.y=l*s+u*-a+h*-n-c*-o,this.z=h*s+u*-o+c*-a-l*-n,this},project:function(e){return void 0===P&&(P=new ht),P.multiplyMatrices(e.projectionMatrix,P.getInverse(e.matrixWorld)),this.applyProjection(P)},unproject:function(e){return void 0===R&&(R=new ht),R.multiplyMatrices(e.matrixWorld,R.getInverse(e.projectionMatrix)),this.applyProjection(R)},transformDirection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return void 0===S&&(S=new lt,L=new lt),S.set(e,e,e),L.set(t,t,t),this.clamp(S,L)},clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var i=this.x,r=this.y,n=this.z;return this.x=r*e.z-n*e.y,this.y=n*e.x-i*e.z,this.z=i*e.y-r*e.x,this},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(e){return void 0===T&&(T=new lt),T.copy(this).projectOnVector(e),this.sub(T)},reflect:function(e){return void 0===E&&(E=new lt),this.sub(E.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(A.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=e;e=t,t=i}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},ht.prototype={constructor:ht,isMatrix4:!0,set:function(e,t,i,r,n,a,o,s,c,l,h,u,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=h,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 ht).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:function(e){void 0===ye&&(ye=new lt);var t=this.elements,i=e.elements,r=1/ye.setFromMatrixColumn(e,0).length(),n=1/ye.setFromMatrixColumn(e,1).length(),a=1/ye.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,this},makeRotationFromEuler:function(e){!1===(e&&e.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,r=e.y,n=e.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(r),c=Math.sin(r),l=Math.cos(n),h=Math.sin(n);if("XYZ"===e.order){var u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=p+d*c,t[5]=u-f*c,t[9]=-o*s,t[2]=f-u*c,t[6]=d+p*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,g=s*h,v=c*l,y=c*h;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*c,t[1]=a*h,t[5]=a*l,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*l,g=s*h,v=c*l,y=c*h;t[0]=m-y*o,t[4]=-a*h,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=d*c-p,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=x*h+_,t[5]=a*l,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*l,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,r=e.y,n=e.z,a=e.w,o=i+i,s=r+r,c=n+n,l=i*o,h=i*s,u=i*c,p=r*s,d=r*c,f=n*c,m=a*o,g=a*s,v=a*c;return t[0]=1-(p+f),t[4]=h-v,t[8]=u+g,t[1]=h+v,t[5]=1-(l+f),t[9]=d-m,t[2]=u-g,t[6]=d+m,t[10]=1-(l+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(e,t,i){void 0===me&&(me=new lt,ge=new lt,ve=new lt);var r=this.elements;return ve.subVectors(e,t).normalize(),0===ve.lengthSq()&&(ve.z=1),me.crossVectors(i,ve).normalize(),0===me.lengthSq()&&(ve.z+=1e-4,me.crossVectors(i,ve).normalize()),ge.crossVectors(ve,me),r[0]=me.x,r[4]=ge.x,r[8]=ve.x,r[1]=me.y,r[5]=ge.y,r[9]=ve.y,r[2]=me.z,r[6]=ge.z,r[10]=ve.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,n=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],l=i[1],h=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],w=r[0],_=r[4],M=r[8],E=r[12],T=r[1],S=r[5],L=r[9],A=r[13],R=r[2],P=r[6],C=r[10],I=r[14],O=r[3],D=r[7],N=r[11],U=r[15];return n[0]=a*w+o*T+s*R+c*O,n[4]=a*_+o*S+s*P+c*D,n[8]=a*M+o*L+s*C+c*N,n[12]=a*E+o*A+s*I+c*U,n[1]=l*w+h*T+u*R+p*O,n[5]=l*_+h*S+u*P+p*D,n[9]=l*M+h*L+u*C+p*N,n[13]=l*E+h*A+u*I+p*U,n[2]=d*w+f*T+m*R+g*O,n[6]=d*_+f*S+m*P+g*D,n[10]=d*M+f*L+m*C+g*N,n[14]=d*E+f*A+m*I+g*U,n[3]=v*w+y*T+x*R+b*O,n[7]=v*_+y*S+x*P+b*D,n[11]=v*M+y*L+x*C+b*N,n[15]=v*E+y*A+x*I+b*U,this},multiplyToArray:function(e,t,i){var r=this.elements;return this.multiplyMatrices(e,t),i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(e){void 0===N&&(N=new lt);for(var t=0,i=e.count;t<i;t++)N.x=e.getX(t),N.y=e.getY(t),N.z=e.getZ(t),N.applyMatrix4(this),e.setXYZ(t,N.x,N.y,N.z);return e},determinant:function(){var e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],p=e[14];return e[3]*(n*s*h-r*c*h-n*o*u+i*c*u+r*o*p-i*s*p)+e[7]*(t*s*p-t*c*u+n*a*u-r*a*p+r*c*l-n*s*l)+e[11]*(t*c*h-t*o*p-n*a*h+i*a*p+n*o*l-i*c*l)+e[15]*(-r*o*l-t*s*h+t*o*u+r*a*h-i*a*u+i*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,r=e.elements,n=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],h=r[6],u=r[7],p=r[8],d=r[9],f=r[10],m=r[11],g=r[12],v=r[13],y=r[14],x=r[15],b=d*y*u-v*f*u+v*h*m-l*y*m-d*h*x+l*f*x,w=g*f*u-p*y*u-g*h*m+c*y*m+p*h*x-c*f*x,_=p*v*u-g*d*u+g*l*m-c*v*m-p*l*x+c*d*x,M=g*d*h-p*v*h-g*l*f+c*v*f+p*l*y-c*d*y,E=n*b+a*w+o*_+s*M;if(0==E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===t)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return i[0]=b*S,i[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*S,i[2]=(l*y*s-v*h*s+v*o*u-a*y*u-l*o*x+a*h*x)*S,i[3]=(d*h*s-l*f*s-d*o*u+a*f*u+l*o*m-a*h*m)*S,i[4]=w*S,i[5]=(p*y*s-g*f*s+g*o*m-n*y*m-p*o*x+n*f*x)*S,i[6]=(g*h*s-c*y*s-g*o*u+n*y*u+c*o*x-n*h*x)*S,i[7]=(c*f*s-p*h*s+p*o*u-n*f*u-c*o*m+n*h*m)*S,i[8]=_*S,i[9]=(g*d*s-p*v*s-g*a*m+n*v*m+p*a*x-n*d*x)*S,i[10]=(c*v*s-g*l*s+g*a*u-n*v*u-c*a*x+n*l*x)*S,i[11]=(p*l*s-c*d*s-p*a*u+n*d*u+c*a*m-n*l*m)*S,i[12]=M*S,i[13]=(p*v*o-g*d*o+g*a*f-n*v*f-p*a*y+n*d*y)*S,i[14]=(g*l*o-c*v*o-g*a*h+n*v*h+c*a*y-n*l*y)*S,i[15]=(c*d*o-p*l*o+p*a*h-n*d*h-c*a*f+n*l*f)*S,this},scale:function(e){var t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=1-i,a=e.x,o=e.y,s=e.z,c=n*a,l=n*o;return this.set(c*a+i,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+i,l*s-r*a,0,c*s-r*o,l*s+r*a,n*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(e,t,i){return this.set(1,t,i,0,e,1,i,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,i){return this.makeRotationFromQuaternion(t),this.scale(i),this.setPosition(e),this},decompose:function(e,t,i){void 0===O&&(O=new lt,D=new ht);var r=this.elements,n=O.set(r[0],r[1],r[2]).length(),a=O.set(r[4],r[5],r[6]).length(),o=O.set(r[8],r[9],r[10]).length();this.determinant()<0&&(n=-n),e.x=r[12],e.y=r[13],e.z=r[14],D.elements.set(this.elements);var s=1/n,c=1/a,l=1/o;return D.elements[0]*=s,D.elements[1]*=s,D.elements[2]*=s,D.elements[4]*=c,D.elements[5]*=c,D.elements[6]*=c,D.elements[8]*=l,D.elements[9]*=l,D.elements[10]*=l,t.setFromRotationMatrix(D),i.x=n,i.y=a,i.z=o,this},makePerspective:function(e,t,i,r,n,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*n/(t-e),c=2*n/(i-r),l=(t+e)/(t-e),h=(i+r)/(i-r),u=-(a+n)/(a-n),p=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=h,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(e,t,i,r,n,a){var o=this.elements,s=1/(t-e),c=1/(i-r),l=1/(a-n),h=(t+e)*s,u=(i+r)*c,p=(a+n)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,i=e.elements,r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;i<16;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},((Ee.prototype=Object.create(be.prototype)).constructor=Ee).prototype.isCubeTexture=!0,Object.defineProperty(Ee.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var Te=new be,Se=new Ee;function Le(){this.seq=[],this.map={}}var Ae=[],Re=[];function Pe(e,t,i){var r=e[0];if(r<=0||0<r)return e;var n=t*i,a=Ae[n];if(void 0===a&&(a=new Float32Array(n),Ae[n]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=i,e[o].toArray(a,s)}return a}function Ce(e,t){var i=Re[t];void 0===i&&(i=new Int32Array(t),Re[t]=i);for(var r=0;r!==t;++r)i[r]=e.allocTextureUnit();return i}function Ie(e,t){e.uniform1f(this.addr,t)}function Oe(e,t){e.uniform1i(this.addr,t)}function De(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function Ne(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function ut(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function pt(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function dt(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function ft(e,t){e.uniformMatrix4fv(this.addr,!1,new Float32Array(t.elements)||new Float32Array(t))}function mt(e,t,i){var r=i.allocTextureUnit();e.uniform1i(this.addr,r),i.setTexture2D(t||Te,r)}function gt(e,t,i){var r=i.allocTextureUnit();e.uniform1i(this.addr,r),i.setTextureCube(t||Se,r)}function vt(e,t){e.uniform2iv(this.addr,t)}function yt(e,t){e.uniform3iv(this.addr,t)}function xt(e,t){e.uniform4iv(this.addr,t)}function bt(e,t){e.uniform1fv(this.addr,t)}function wt(e,t){e.uniform1iv(this.addr,t)}function _t(e,t){e.uniform2fv(this.addr,Pe(t,this.size,2))}function Mt(e,t){e.uniform3fv(this.addr,Pe(t,this.size,3))}function Et(e,t){e.uniform4fv(this.addr,Pe(t,this.size,4))}function Tt(e,t){e.uniformMatrix2fv(this.addr,!1,Pe(t,this.size,4))}function St(e,t){e.uniformMatrix3fv(this.addr,!1,Pe(t,this.size,9))}function Lt(e,t){e.uniformMatrix4fv(this.addr,!1,Pe(t,this.size,16))}function At(e,t,i){var r=t.length,n=Ce(i,r);e.uniform1iv(this.addr,n);for(var a=0;a!==r;++a)i.setTexture2D(t[a]||Te,n[a])}function Rt(e,t,i){var r=t.length,n=Ce(i,r);e.uniform1iv(this.addr,n);for(var a=0;a!==r;++a)i.setTextureCube(t[a]||Se,n[a])}function Pt(e,t,i){this.id=e,this.addr=i,this.setValue=function(e){switch(e){case 5126:return Ie;case 35664:return De;case 35665:return Ne;case 35666:return ut;case 35674:return pt;case 35675:return dt;case 35676:return ft;case 35678:return mt;case 35680:return gt;case 5124:case 35670:return Oe;case 35667:case 35671:return vt;case 35668:case 35672:return yt;case 35669:case 35673:return xt}}(t.type)}function Ct(e,t,i){this.id=e,this.addr=i,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return bt;case 35664:return _t;case 35665:return Mt;case 35666:return Et;case 35674:return Tt;case 35675:return St;case 35676:return Lt;case 35678:return At;case 35680:return Rt;case 5124:case 35670:return wt;case 35667:case 35671:return vt;case 35668:case 35672:return yt;case 35669:case 35673:return xt}}(t.type)}function It(e){this.id=e,Le.call(this)}It.prototype.setValue=function(e,t){for(var i=this.seq,r=0,n=i.length;r!==n;++r){var a=i[r];a.setValue(e,t[a.id])}};var Ot=/([\w\d_]+)(\])?(\[|\.)?/g;function Dt(e,t){e.seq.push(t),e.map[t.id]=t}function Nt(e,t,i){var r=e.name,n=r.length;for(Ot.lastIndex=0;;){var a=Ot.exec(r),o=Ot.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===n){Dt(i,void 0===l?new Pt(s,e,t):new Ct(s,e,t));break}var h=i.map[s];void 0===h&&Dt(i,h=new It(s)),i=h}}function Ut(e,t,i){Le.call(this),this.renderer=i;for(var r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n!==r;++n){var a=e.getActiveUniform(t,n),o=a.name;Nt(a,e.getUniformLocation(t,o),this)}}Ut.prototype.setValue=function(e,t,i){var r=this.map[t];void 0!==r&&r.setValue(e,i,this.renderer)},Ut.prototype.set=function(e,t,i){var r=this.map[i];void 0!==r&&r.setValue(e,t[i],this.renderer)},Ut.prototype.setOptional=function(e,t,i){var r=t[i];void 0!==r&&this.setValue(e,i,r)},Ut.upload=function(e,t,i,r){for(var n=0,a=t.length;n!==a;++n){var o=t[n],s=i[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},Ut.seqWithValue=function(e,t){for(var i=[],r=0,n=e.length;r!==n;++r){var a=e[r];a.id in t&&i.push(a)}return i};var Ft={merge:function(e){for(var t={},i=0;i<e.length;i++){var r=this.clone(e[i]);for(var n in r)t[n]=r[n]}return t},clone:function(e){var t={};for(var i in e)for(var r in t[i]={},e[i]){var n=e[i][r];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture)?t[i][r]=n.clone():Array.isArray(n)?t[i][r]=n.slice():t[i][r]=n}return t}},Bt={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return 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 );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return 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 );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 matDiffColor = material.diffuseColor;\n vec3 matSpecColor = material.specularColor;\n vec3 lightColor = rectAreaLight.color;\n float roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n vec3 spec = Rect_Area_Light_Specular_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n roughness,\n ltcMat, ltcMag );\n vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n reflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n reflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n }\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 matDiffColor = material.diffuseColor;\n vec3 matSpecColor = material.specularColor;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 spec = Rect_Area_Light_Specular_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n roughness,\n ltcMat, ltcMag );\n vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n reflectedLight.directSpecular += lightColor * matSpecColor * spec;\n reflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n #if NUM_RECT_AREA_LIGHTS > 0\n #endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n #if NUM_RECT_AREA_LIGHTS > 0\n #endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n #if NUM_RECT_AREA_LIGHTS > 0\n #endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\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 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\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 )\n\tvarying vec2 vUv;\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 )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\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 )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#include <premultiplied_alpha_fragment>\n\t#include <encodings_fragment>\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"};function zt(e,t,i){return void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}function Gt(e,t,i){return i<0&&(i+=1),1<i&&--i,i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}zt.prototype={constructor:zt,isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(e,t,i){if(e=A.euclideanModulo(e,1),t=A.clamp(t,0,1),i=A.clamp(i,0,1),0===t)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+t):i+t-i*t,n=2*i-r;this.r=Gt(n,r,e+1/3),this.g=Gt(n,r,e),this.b=Gt(n,r,e-1/3)}return this},setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l,h=(l=i[1]).length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}t&&0<t.length&&(void 0!==(l=Ht[t])?this.setHex(l):console.warn("THREE.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=0<t?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),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(e){var t,i,r=e||{h:0,s:0,l:0},n=this.r,a=this.g,o=this.b,s=Math.max(n,a,o),c=Math.min(n,a,o),l=(c+s)/2;if(c===s)i=t=0;else{var h=s-c;switch(i=l<=.5?h/(s+c):h/(2-s-c),s){case n:t=(a-o)/h+(a<o?6:0);break;case a:t=(o-n)/h+2;break;case o:t=(n-a)/h+4}t/=6}return r.h=t,r.s=i,r.l=l,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,i){var r=this.getHSL();return r.h+=e,r.s+=t,r.l+=i,this.setHSL(r.h,r.s,r.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}};var Ht={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function kt(e,t,i,r,n,a,o,s,c,l,h,u){be.call(this,null,a,o,s,c,l,r,n,h,u),this.image={data:e,width:t,height:i},this.magFilter=void 0!==c?c:Xe,this.minFilter=void 0!==l?l:Xe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}((kt.prototype=Object.create(be.prototype)).constructor=kt).prototype.isDataTexture=!0;var Vt,jt,Wt={common:{diffuse:{value:new zt(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new ct(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},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 fe(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 zt(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:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new zt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new ct(0,0,1,1)}}},Xt={basic:{uniforms:Ft.merge([Wt.common,Wt.aomap,Wt.lightmap,Wt.fog]),vertexShader:Bt.meshbasic_vert,fragmentShader:Bt.meshbasic_frag},lambert:{uniforms:Ft.merge([Wt.common,Wt.aomap,Wt.lightmap,Wt.emissivemap,Wt.fog,Wt.lights,{emissive:{value:new zt(0)}}]),vertexShader:Bt.meshlambert_vert,fragmentShader:Bt.meshlambert_frag},phong:{uniforms:Ft.merge([Wt.common,Wt.aomap,Wt.lightmap,Wt.emissivemap,Wt.bumpmap,Wt.normalmap,Wt.displacementmap,Wt.gradientmap,Wt.fog,Wt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30}}]),vertexShader:Bt.meshphong_vert,fragmentShader:Bt.meshphong_frag},standard:{uniforms:Ft.merge([Wt.common,Wt.aomap,Wt.lightmap,Wt.emissivemap,Wt.bumpmap,Wt.normalmap,Wt.displacementmap,Wt.roughnessmap,Wt.metalnessmap,Wt.fog,Wt.lights,{emissive:{value:new zt(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bt.meshphysical_vert,fragmentShader:Bt.meshphysical_frag},points:{uniforms:Ft.merge([Wt.points,Wt.fog]),vertexShader:Bt.points_vert,fragmentShader:Bt.points_frag},dashed:{uniforms:Ft.merge([Wt.common,Wt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bt.linedashed_vert,fragmentShader:Bt.linedashed_frag},depth:{uniforms:Ft.merge([Wt.common,Wt.displacementmap]),vertexShader:Bt.depth_vert,fragmentShader:Bt.depth_frag},normal:{uniforms:Ft.merge([Wt.common,Wt.bumpmap,Wt.normalmap,Wt.displacementmap,{opacity:{value:1}}]),vertexShader:Bt.normal_vert,fragmentShader:Bt.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Bt.cube_vert,fragmentShader:Bt.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Bt.equirect_vert,fragmentShader:Bt.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new lt}},vertexShader:Bt.distanceRGBA_vert,fragmentShader:Bt.distanceRGBA_frag}};function qt(e,t){this.min=void 0!==e?e:new fe(1/0,1/0),this.max=void 0!==t?t:new fe(-1/0,-1/0)}function Yt(y,x){var b,w,s,_,M,E,T,S,L=y.context,A=y.state;function R(){var e,t,i,r,n,a=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),o=new Uint16Array([0,1,2,0,2,3]);b=L.createBuffer(),w=L.createBuffer(),L.bindBuffer(L.ARRAY_BUFFER,b),L.bufferData(L.ARRAY_BUFFER,a,L.STATIC_DRAW),L.bindBuffer(L.ELEMENT_ARRAY_BUFFER,w),L.bufferData(L.ELEMENT_ARRAY_BUFFER,o,L.STATIC_DRAW),T=L.createTexture(),S=L.createTexture(),A.bindTexture(L.TEXTURE_2D,T),L.texImage2D(L.TEXTURE_2D,0,L.RGB,16,16,0,L.RGB,L.UNSIGNED_BYTE,null),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.NEAREST),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.NEAREST),A.bindTexture(L.TEXTURE_2D,S),L.texImage2D(L.TEXTURE_2D,0,L.RGBA,16,16,0,L.RGBA,L.UNSIGNED_BYTE,null),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.NEAREST),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},e=s,t=L.createProgram(),i=L.createShader(L.FRAGMENT_SHADER),r=L.createShader(L.VERTEX_SHADER),n="precision "+y.getPrecision()+" float;\n",L.shaderSource(i,n+e.fragmentShader),L.shaderSource(r,n+e.vertexShader),L.compileShader(i),L.compileShader(r),L.attachShader(t,i),L.attachShader(t,r),L.linkProgram(t),_=t,M={vertex:L.getAttribLocation(_,"position"),uv:L.getAttribLocation(_,"uv")},E={renderType:L.getUniformLocation(_,"renderType"),map:L.getUniformLocation(_,"map"),occlusionMap:L.getUniformLocation(_,"occlusionMap"),opacity:L.getUniformLocation(_,"opacity"),color:L.getUniformLocation(_,"color"),scale:L.getUniformLocation(_,"scale"),rotation:L.getUniformLocation(_,"rotation"),screenPosition:L.getUniformLocation(_,"screenPosition")}}this.render=function(e,t,i){if(0!==x.length){var r=new lt,n=i.w/i.z,a=.5*i.z,o=.5*i.w,s=16/i.w,c=new fe(s*n,s),l=new lt(1,1,0),h=new fe(1,1),u=new qt;u.min.set(i.x,i.y),u.max.set(i.x+(i.z-16),i.y+(i.w-16)),void 0===_&&R(),L.useProgram(_),A.initAttributes(),A.enableAttribute(M.vertex),A.enableAttribute(M.uv),A.disableUnusedAttributes(),L.uniform1i(E.occlusionMap,0),L.uniform1i(E.map,1),L.bindBuffer(L.ARRAY_BUFFER,b),L.vertexAttribPointer(M.vertex,2,L.FLOAT,!1,16,0),L.vertexAttribPointer(M.uv,2,L.FLOAT,!1,16,8),L.bindBuffer(L.ELEMENT_ARRAY_BUFFER,w),A.disable(L.CULL_FACE),A.setDepthWrite(!1);for(var p=0,d=x.length;p<d;p++){s=16/i.w,c.set(s*n,s);var f=x[p];if(r.set(f.matrixWorld.elements[12],f.matrixWorld.elements[13],f.matrixWorld.elements[14]),r.applyMatrix4(t.matrixWorldInverse),r.applyProjection(t.projectionMatrix),l.copy(r),h.x=i.x+l.x*a+a-8,h.y=i.y+l.y*o+o-8,!0===u.containsPoint(h)){A.activeTexture(L.TEXTURE0),A.bindTexture(L.TEXTURE_2D,null),A.activeTexture(L.TEXTURE1),A.bindTexture(L.TEXTURE_2D,T),L.copyTexImage2D(L.TEXTURE_2D,0,L.RGB,h.x,h.y,16,16,0),L.uniform1i(E.renderType,0),L.uniform2f(E.scale,c.x,c.y),L.uniform3f(E.screenPosition,l.x,l.y,l.z),A.disable(L.BLEND),A.enable(L.DEPTH_TEST),L.drawElements(L.TRIANGLES,6,L.UNSIGNED_SHORT,0),A.activeTexture(L.TEXTURE0),A.bindTexture(L.TEXTURE_2D,S),L.copyTexImage2D(L.TEXTURE_2D,0,L.RGBA,h.x,h.y,16,16,0),L.uniform1i(E.renderType,1),A.disable(L.DEPTH_TEST),A.activeTexture(L.TEXTURE1),A.bindTexture(L.TEXTURE_2D,T),L.drawElements(L.TRIANGLES,6,L.UNSIGNED_SHORT,0),f.positionScreen.copy(l),f.customUpdateCallback?f.customUpdateCallback(f):f.updateLensFlares(),L.uniform1i(E.renderType,2),A.enable(L.BLEND);for(var m=0,g=f.lensFlares.length;m<g;m++){var v=f.lensFlares[m];.001<v.opacity&&.001<v.scale&&(l.x=v.x,l.y=v.y,l.z=v.z,s=v.size*v.scale/i.w,c.x=s*n,c.y=s,L.uniform3f(E.screenPosition,l.x,l.y,l.z),L.uniform2f(E.scale,c.x,c.y),L.uniform1f(E.rotation,v.rotation),L.uniform1f(E.opacity,v.opacity),L.uniform3f(E.color,v.color.r,v.color.g,v.color.b),A.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst),y.setTexture2D(v.texture,1),L.drawElements(L.TRIANGLES,6,L.UNSIGNED_SHORT,0))}}}A.enable(L.CULL_FACE),A.enable(L.DEPTH_TEST),A.setDepthWrite(!0),y.resetGLState()}}}function Zt(u,p){var d,f,m,g,v,y,x=u.context,b=u.state,w=new lt,_=new Me,M=new lt;function E(){var e,t,i,r=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),n=new Uint16Array([0,1,2,0,2,3]);d=x.createBuffer(),f=x.createBuffer(),x.bindBuffer(x.ARRAY_BUFFER,d),x.bufferData(x.ARRAY_BUFFER,r,x.STATIC_DRAW),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,f),x.bufferData(x.ELEMENT_ARRAY_BUFFER,n,x.STATIC_DRAW),e=x.createProgram(),t=x.createShader(x.VERTEX_SHADER),i=x.createShader(x.FRAGMENT_SHADER),x.shaderSource(t,["precision "+u.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),x.shaderSource(i,["precision "+u.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),x.compileShader(t),x.compileShader(i),x.attachShader(e,t),x.attachShader(e,i),x.linkProgram(e),m=e,g={position:x.getAttribLocation(m,"position"),uv:x.getAttribLocation(m,"uv")},v={uvOffset:x.getUniformLocation(m,"uvOffset"),uvScale:x.getUniformLocation(m,"uvScale"),rotation:x.getUniformLocation(m,"rotation"),scale:x.getUniformLocation(m,"scale"),color:x.getUniformLocation(m,"color"),map:x.getUniformLocation(m,"map"),opacity:x.getUniformLocation(m,"opacity"),modelViewMatrix:x.getUniformLocation(m,"modelViewMatrix"),projectionMatrix:x.getUniformLocation(m,"projectionMatrix"),fogType:x.getUniformLocation(m,"fogType"),fogDensity:x.getUniformLocation(m,"fogDensity"),fogNear:x.getUniformLocation(m,"fogNear"),fogFar:x.getUniformLocation(m,"fogFar"),fogColor:x.getUniformLocation(m,"fogColor"),alphaTest:x.getUniformLocation(m,"alphaTest")};var a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");a.width=8,a.height=8;var o=a.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),(y=new be(a)).needsUpdate=!0}function T(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(e,t){if(0!==p.length){void 0===m&&E(),x.useProgram(m),b.initAttributes(),b.enableAttribute(g.position),b.enableAttribute(g.uv),b.disableUnusedAttributes(),b.disable(x.CULL_FACE),b.enable(x.BLEND),x.bindBuffer(x.ARRAY_BUFFER,d),x.vertexAttribPointer(g.position,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(g.uv,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,f),x.uniformMatrix4fv(v.projectionMatrix,!1,t.projectionMatrix.elements),b.activeTexture(x.TEXTURE0),x.uniform1i(v.map,0);var i=0,r=0,n=e.fog;n?(x.uniform3f(v.fogColor,n.color.r,n.color.g,n.color.b),n.isFog?(x.uniform1f(v.fogNear,n.near),x.uniform1f(v.fogFar,n.far),x.uniform1i(v.fogType,1),r=i=1):n.isFogExp2&&(x.uniform1f(v.fogDensity,n.density),x.uniform1i(v.fogType,2),r=i=2)):(x.uniform1i(v.fogType,0),r=i=0);for(var a=0,o=p.length;a<o;a++){(c=p[a]).modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,c.matrixWorld),c.z=-c.modelViewMatrix.elements[14]}p.sort(T);var s=[];for(a=0,o=p.length;a<o;a++){var c,l=(c=p[a]).material;if(!1!==l.visible){x.uniform1f(v.alphaTest,l.alphaTest),x.uniformMatrix4fv(v.modelViewMatrix,!1,c.modelViewMatrix.elements),c.matrixWorld.decompose(w,_,M),s[0]=M.x,s[1]=M.y;var h=0;e.fog&&l.fog&&(h=r),i!==h&&(x.uniform1i(v.fogType,h),i=h),null!==l.map?(x.uniform2f(v.uvOffset,l.map.offset.x,l.map.offset.y),x.uniform2f(v.uvScale,l.map.repeat.x,l.map.repeat.y)):(x.uniform2f(v.uvOffset,0,0),x.uniform2f(v.uvScale,1,1)),x.uniform1f(v.opacity,l.opacity),x.uniform3f(v.color,l.color.r,l.color.g,l.color.b),x.uniform1f(v.rotation,l.rotation),x.uniform2fv(v.scale,s),b.setBlending(l.blending,l.blendEquation,l.blendSrc,l.blendDst),b.setDepthTest(l.depthTest),b.setDepthWrite(l.depthWrite),l.map?u.setTexture2D(l.map,0):u.setTexture2D(y,0),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}}b.enable(x.CULL_FACE),u.resetGLState()}}}Xt.physical={uniforms:Ft.merge([Xt.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Bt.meshphysical_vert,fragmentShader:Bt.meshphysical_frag},qt.prototype={constructor:qt,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(jt=new fe,function(e,t){var i=jt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){var t=e||new fe;return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new fe;return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new fe).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return(t||new fe).copy(e).clamp(this.min,this.max)},distanceToPoint:(Vt=new fe,function(e){return Vt.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};var Jt,Kt,Qt,$t,ei,ti,ii,ri,ni,ai,oi,si,ci,li,hi,ui,pi,di,fi,mi,gi,vi,yi,xi,bi,wi,_i,Mi,Ei,Ti,Si=0;function Li(){Object.defineProperty(this,"id",{value:Si++}),this.uuid=A.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=W,this.side=w,this.shading=c,this.vertexColors=ze,this.opacity=1,this.transparent=!1,this.blendSrc=ke,this.blendDst=Ve,this.blendEquation=He,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ee,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Ai(e){Li.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)!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function Ri(e){Li.call(this),this.type="MeshDepthMaterial",this.depthPacking=v,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(e)}function Pi(e,t){this.min=void 0!==e?e:new lt(1/0,1/0,1/0),this.max=void 0!==t?t:new lt(-1/0,-1/0,-1/0)}function Ci(e,t){this.center=void 0!==e?e:new lt,this.radius=void 0!==t?t:0}function Ii(){this.elements=new Float32Array([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.")}function Oi(e,t){this.normal=void 0!==e?e:new lt(1,0,0),this.constant=void 0!==t?t:0}function Di(e,t,i,r,n,a){this.planes=[void 0!==e?e:new Oi,void 0!==t?t:new Oi,void 0!==i?i:new Oi,void 0!==r?r:new Oi,void 0!==n?n:new Oi,void 0!==a?a:new Oi]}function Ni(P,e,C,t){var I=P.context,O=P.state,D=new Di,N=new ht,U=e.shadows,F=new fe,B=new fe(t.maxTextureSize,t.maxTextureSize),z=new lt,G=new lt,H=[],g=1,v=2,i=1+(g|v),y=new Array(i),x=new Array(i),b={},k=[new lt(1,0,0),new lt(-1,0,0),new lt(0,0,1),new lt(0,0,-1),new lt(0,1,0),new lt(0,-1,0)],V=[new lt(0,1,0),new lt(0,1,0),new lt(0,1,0),new lt(0,1,0),new lt(0,0,1),new lt(0,0,-1)],j=[new ct,new ct,new ct,new ct,new ct,new ct],r=new Ri;r.depthPacking=_,r.clipping=!0;for(var n=Xt.distanceRGBA,a=Ft.clone(n.uniforms),o=0;o!==i;++o){var s=0!=(o&g),c=0!=(o&v),l=r.clone();l.morphTargets=s,l.skinning=c,y[o]=l;var h=new Ai({defines:{USE_SHADOWMAP:""},uniforms:a,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,morphTargets:s,skinning:c,clipping:!0});x[o]=h}var W=this;function X(e,t,i,r){var n=e.geometry,a=null,o=y,s=e.customDepthMaterial;if(i&&(o=x,s=e.customDistanceMaterial),s)a=s;else{var c=!1;t.morphTargets&&(n&&n.isBufferGeometry?c=n.morphAttributes&&n.morphAttributes.position&&0<n.morphAttributes.position.length:n&&n.isGeometry&&(c=n.morphTargets&&0<n.morphTargets.length));var l=e.isSkinnedMesh&&t.skinning,h=0;c&&(h|=g),l&&(h|=v),a=o[h]}if(P.localClippingEnabled&&!0===t.clipShadows&&0!==t.clippingPlanes.length){var u=a.uuid,p=t.uuid,d=b[u];void 0===d&&(d={},b[u]=d);var f=d[p];void 0===f&&(f=a.clone(),d[p]=f),a=f}a.visible=t.visible,a.wireframe=t.wireframe;var m=t.side;return W.renderSingleSided&&m==Fe&&(m=w),W.renderReverseSided&&(m===w?m=Ue:m===Ue&&(m=w)),a.side=m,a.clipShadows=t.clipShadows,a.clippingPlanes=t.clippingPlanes,a.wireframeLinewidth=t.wireframeLinewidth,a.linewidth=t.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function q(e,t,i){if(!1!==e.visible){if(0!=(e.layers.mask&t.layers.mask)&&(e.isMesh||e.isLine||e.isPoints))if(e.castShadow&&(!1===e.frustumCulled||!0===D.intersectsObject(e)))!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),H.push(e));for(var r=e.children,n=0,a=r.length;n<a;n++)q(r[n],t,i)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Y,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,t){if(!1!==W.enabled&&(!1!==W.autoUpdate||!1!==W.needsUpdate)&&0!==U.length){var i,r;O.buffers.color.setClear(1,1,1,1),O.disable(I.BLEND),O.setDepthTest(!0),O.setScissorTest(!1);for(var n=0,a=U.length;n<a;n++){var o=U[n],s=o.shadow;if(void 0!==s){var c=s.camera;if(F.copy(s.mapSize),F.min(B),o&&o.isPointLight){i=6,r=!0;var l=F.x,h=F.y;j[0].set(2*l,h,l,h),j[1].set(0,h,l,h),j[2].set(3*l,h,l,h),j[3].set(l,h,l,h),j[4].set(3*l,0,l,h),j[5].set(l,0,l,h),F.x*=4,F.y*=2}else r=!(i=1);if(null===s.map){var u={minFilter:Xe,magFilter:Xe,format:nt};s.map=new we(F.x,F.y,u),c.updateProjectionMatrix()}s.isSpotLightShadow&&s.update(o),s&&s.isRectAreaLightShadow&&s.update(o);var p=s.map,d=s.matrix;G.setFromMatrixPosition(o.matrixWorld),c.position.copy(G),P.setRenderTarget(p),P.clear();for(var f=0;f<i;f++){if(r){z.copy(c.position),z.add(k[f]),c.up.copy(V[f]),c.lookAt(z);var m=j[f];O.viewport(m)}else z.setFromMatrixPosition(o.target.matrixWorld),c.lookAt(z);c.updateMatrixWorld(),c.matrixWorldInverse.getInverse(c.matrixWorld),d.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),d.multiply(c.projectionMatrix),d.multiply(c.matrixWorldInverse),N.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse),D.setFromMatrix(N),H.length=0,q(e,t,c);for(var g=0,v=H.length;g<v;g++){var y=H[g],x=C.update(y),b=y.material;if(b&&b.isMultiMaterial)for(var w=x.groups,_=b.materials,M=0,E=w.length;M<E;M++){var T=w[M],S=_[T.materialIndex];if(!0===S.visible){var L=X(y,S,r,G);P.renderBufferDirect(c,null,x,L,y,T)}}else{L=X(y,b,r,G);P.renderBufferDirect(c,null,x,L,y,null)}}}}else console.warn("THREE.WebGLShadowMap:",o,"has no shadow.")}var A=P.getClearColor(),R=P.getClearAlpha();P.setClearColor(A,R),W.needsUpdate=!1}}}function Ui(e,t){this.origin=void 0!==e?e:new lt,this.direction=void 0!==t?t:new lt}function Fi(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._order=r||Fi.DefaultOrder}function Bi(){this.mask=1}Li.prototype={constructor:Li,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i){var r=this[t];void 0!==r?r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]="overdraw"===t?Number(i):i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e;t&&(e={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearCoat&&(i.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(i.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,i.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==W&&(i.blending=this.blending),this.shading!==c&&(i.shading=this.shading),this.side!==w&&(i.side=this.side),this.vertexColors!==ze&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),i.skinning=this.skinning,i.morphTargets=this.morphTargets,t){var n=r(e.textures),a=r(e.images);0<n.length&&(i.textures=n),0<a.length&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,i=null;if(null!==t){var r=t.length;i=new Array(r);for(var n=0;n!==r;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(Li.prototype,t.prototype),((Ai.prototype=Object.create(Li.prototype)).constructor=Ai).prototype.isShaderMaterial=!0,Ai.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ft.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Ai.prototype.toJSON=function(e){var t=Li.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},((Ri.prototype=Object.create(Li.prototype)).constructor=Ri).prototype.isMeshDepthMaterial=!0,Ri.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Pi.prototype={constructor:Pi,isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],h=e[s+1],u=e[s+2];l<t&&(t=l),h<i&&(i=h),u<r&&(r=u),n<l&&(n=l),a<h&&(a=h),o<u&&(o=u)}this.min.set(t,i,r),this.max.set(n,a,o)},setFromBufferAttribute:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),h=e.getY(s),u=e.getZ(s);l<t&&(t=l),h<i&&(i=h),u<r&&(r=u),n<l&&(n=l),a<h&&(a=h),o<u&&(o=u)}this.min.set(t,i,r),this.max.set(n,a,o)},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(ti=new lt,function(e,t){var i=ti.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}),setFromObject:(ei=new lt,function(e){var o=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var t,i,r=e.geometry;if(void 0!==r)if(r.isGeometry){var n=r.vertices;for(t=0,i=n.length;t<i;t++)ei.copy(n[t]),ei.applyMatrix4(e.matrixWorld),o.expandByPoint(ei)}else if(r.isBufferGeometry){var a=r.attributes.position;if(void 0!==a)for(t=0,i=a.count;t<i;t++)ei.fromAttribute(a,t).applyMatrix4(e.matrixWorld),o.expandByPoint(ei)}}),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){var t=e||new lt;return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new lt;return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new lt).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return void 0===$t&&($t=new lt),this.clampPoint(e.center,$t),$t.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,i;return i=0<e.normal.x?(t=e.normal.x*this.min.x,e.normal.x*this.max.x):(t=e.normal.x*this.max.x,e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=e.constant&&i>=e.constant},clampPoint:function(e,t){return(t||new lt).copy(e).clamp(this.min,this.max)},distanceToPoint:(Qt=new lt,function(e){return Qt.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(Kt=new lt,function(e){var t=e||new Ci;return this.getCenter(t.center),t.radius=.5*this.getSize(Kt).length(),t}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(Jt=[new lt,new lt,new lt,new lt,new lt,new lt,new lt,new lt],function(e){return this.isEmpty()||(Jt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Jt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Jt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Jt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Jt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Jt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Jt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Jt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Jt)),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Ci.prototype={constructor:Ci,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(ii=new Pi,function(e,t){var i=this.center;void 0!==t?i.copy(t):ii.setFromPoints(e).getCenter(i);for(var r=0,n=0,a=e.length;n<a;n++)r=Math.max(r,i.distanceToSquared(e[n]));return this.radius=Math.sqrt(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var i=this.center.distanceToSquared(e),r=t||new lt;return r.copy(e),i>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new Pi;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},Ii.prototype={constructor:Ii,isMatrix3:!0,set:function(e,t,i,r,n,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=n,l[5]=s,l[6]=i,l[7]=a,l[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(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(e){void 0===ri&&(ri=new lt);for(var t=0,i=e.count;t<i;t++)ri.x=e.getX(t),ri.y=e.getY(t),ri.z=e.getZ(t),ri.applyMatrix3(this),e.setXYZ(t,ri.x,ri.y,ri.z);return e},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-i*n*l+i*o*s+r*n*c-r*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=e.elements,r=this.elements,n=i[0],a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],p=i[8],d=p*c-l*u,f=l*h-p*s,m=u*s-c*h,g=n*d+a*f+o*m;if(0==g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===t)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return r[0]=d*y,r[1]=(o*u-p*a)*y,r[2]=(l*a-o*c)*y,r[3]=f*y,r[4]=(p*n-o*h)*y,r[5]=(o*s-l*n)*y,r[6]=m*y,r[7]=(a*h-u*n)*y,r[8]=(c*n-a*s)*y,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;i<9;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}},Oi.prototype={constructor:Oi,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(si=new lt,ci=new lt,function(e,t,i){var r=si.subVectors(i,t).cross(ci.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var i=this.distanceToPoint(e);return(t||new lt).copy(this.normal).multiplyScalar(i)},intersectLine:(oi=new lt,function(e,t){var i=t||new lt,r=e.delta(oi),n=this.normal.dot(r);if(0===n)return 0===this.distanceToPoint(e.start)?i.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/n;return a<0||1<a?void 0:i.copy(r).multiplyScalar(a).add(e.start)}),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&0<i||i<0&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new lt).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(ni=new lt,ai=new Ii,function(e,t){var i=this.coplanarPoint(ni).applyMatrix4(e),r=t||ai.getNormalMatrix(e),n=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(n),this}),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},Di.prototype={constructor:Di,set:function(e,t,i,r,n,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(n),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,i=0;i<6;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,r=i[0],n=i[1],a=i[2],o=i[3],s=i[4],c=i[5],l=i[6],h=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(o-r,h-s,f-u,y-m).normalize(),t[1].setComponents(o+r,h+s,f+u,y+m).normalize(),t[2].setComponents(o+n,h+c,f+p,y+g).normalize(),t[3].setComponents(o-n,h-c,f-p,y-g).normalize(),t[4].setComponents(o-a,h-l,f-d,y-v).normalize(),t[5].setComponents(o+a,h+l,f+d,y+v).normalize(),this},intersectsObject:(pi=new Ci,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),pi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(pi)}),intersectsSprite:(ui=new Ci,function(e){return ui.center.set(0,0,0),ui.radius=.7071067811865476,ui.applyMatrix4(e.matrixWorld),this.intersectsSphere(ui)}),intersectsSphere:function(e){for(var t=this.planes,i=e.center,r=-e.radius,n=0;n<6;n++){if(t[n].distanceToPoint(i)<r)return!1}return!0},intersectsBox:(li=new lt,hi=new lt,function(e){for(var t=this.planes,i=0;i<6;i++){var r=t[i];li.x=0<r.normal.x?e.min.x:e.max.x,hi.x=0<r.normal.x?e.max.x:e.min.x,li.y=0<r.normal.y?e.min.y:e.max.y,hi.y=0<r.normal.y?e.max.y:e.min.y,li.z=0<r.normal.z?e.min.z:e.max.z,hi.z=0<r.normal.z?e.max.z:e.min.z;var n=r.distanceToPoint(li),a=r.distanceToPoint(hi);if(n<0&&a<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}},Ui.prototype={constructor:Ui,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new lt).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:(Mi=new lt,function(e){return this.origin.copy(this.at(e,Mi)),this}),closestPointToPoint:function(e,t){var i=t||new lt;i.subVectors(e,this.origin);var r=i.dot(this.direction);return r<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:(_i=new lt,function(e){var t=_i.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_i.copy(this.direction).multiplyScalar(t).add(this.origin),_i.distanceToSquared(e))}),distanceSqToSegment:(xi=new lt,bi=new lt,wi=new lt,function(e,t,i,r){xi.copy(e).add(t).multiplyScalar(.5),bi.copy(t).sub(e).normalize(),wi.copy(this.origin).sub(xi);var n,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(bi),h=wi.dot(this.direction),u=-wi.dot(bi),p=wi.lengthSq(),d=Math.abs(1-l*l);if(0<d)if(a=l*h-u,s=c*d,0<=(n=l*u-h))if(-s<=a)if(a<=s){var f=1/d;o=(n*=f)*(n+l*(a*=f)+2*h)+a*(l*n+a+2*u)+p}else a=c,o=-(n=Math.max(0,-(l*a+h)))*n+a*(a+2*u)+p;else a=-c,o=-(n=Math.max(0,-(l*a+h)))*n+a*(a+2*u)+p;else o=a<=-s?-(n=Math.max(0,-(-l*c+h)))*n+(a=0<n?-c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p:a<=s?(n=0,(a=Math.min(Math.max(-c,-u),c))*(a+2*u)+p):-(n=Math.max(0,-(l*c+h)))*n+(a=0<n?c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p;else a=0<l?-c:c,o=-(n=Math.max(0,-(l*a+h)))*n+a*(a+2*u)+p;return i&&i.copy(this.direction).multiplyScalar(n).add(this.origin),r&&r.copy(bi).multiplyScalar(a).add(xi),o}),intersectSphere:(yi=new lt,function(e,t){yi.subVectors(e.center,this.origin);var i=yi.dot(this.direction),r=yi.dot(yi)-i*i,n=e.radius*e.radius;if(n<r)return null;var a=Math.sqrt(n-r),o=i-a,s=i+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=i?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var i,r,n,a,o,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return r=0<=c?(i=(e.min.x-u.x)*c,(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,(e.min.x-u.x)*c),(a=0<=l?(n=(e.min.y-u.y)*l,(e.max.y-u.y)*l):(n=(e.max.y-u.y)*l,(e.min.y-u.y)*l))<i||r<n?null:((i<n||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(s=0<=h?(o=(e.min.z-u.z)*h,(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,(e.min.z-u.z)*h))<i||r<o?null:((i<o||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(0<=i?i:r,t)))},intersectsBox:(vi=new lt,function(e){return null!==this.intersectBox(e,vi)}),intersectTriangle:(di=new lt,fi=new lt,mi=new lt,gi=new lt,function(e,t,i,r,n){fi.subVectors(t,e),mi.subVectors(i,e),gi.crossVectors(fi,mi);var a,o=this.direction.dot(gi);if(0<o){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}di.subVectors(this.origin,e);var s=a*this.direction.dot(mi.crossVectors(di,mi));if(s<0)return null;var c=a*this.direction.dot(fi.cross(di));if(c<0)return null;if(o<s+c)return null;var l=-a*di.dot(gi);return l<0?null:this.at(l/o,n)}),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},Fi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Fi.DefaultOrder="XYZ",Fi.prototype={constructor:Fi,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var r=A.clamp,n=e.elements,a=n[0],o=n[4],s=n[8],c=n[1],l=n[5],h=n[9],u=n[2],p=n[6],d=n[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-r(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,l))):"YZX"===t?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(e,t,i){return void 0===Ti&&(Ti=new ht),Ti.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ti,t,i)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Ei=new Me,function(e){return Ei.setFromEuler(this),this.setFromQuaternion(Ei,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new lt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Bi.prototype={constructor:Bi,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!=(this.mask&e.mask)}};var zi,Gi,Hi,ki,Vi,ji,Wi,Xi,qi,Yi,Zi,Ji,Ki,Qi,$i,er,tr,ir,rr,nr,ar,or,sr,cr,lr,hr,ur,pr,dr,fr=0;function mr(){Object.defineProperty(this,"id",{value:fr++}),this.uuid=A.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mr.DefaultUp.clone();var e=new lt,t=new Fi,i=new Me,r=new lt(1,1,1);t.onChange(function(){i.setFromEuler(t,!1)}),i.onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:r},modelViewMatrix:{value:new ht},normalMatrix:{value:new Ii}}),this.matrix=new ht,this.matrixWorld=new ht,this.matrixAutoUpdate=mr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Bi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function gr(e,t){this.start=void 0!==e?e:new lt,this.end=void 0!==t?t:new lt}function vr(e,t,i){this.a=void 0!==e?e:new lt,this.b=void 0!==t?t:new lt,this.c=void 0!==i?i:new lt}function yr(e,t,i,r,n,a){this.a=e,this.b=t,this.c=i,this.normal=r&&r.isVector3?r:new lt,this.vertexNormals=Array.isArray(r)?r:[],this.color=n&&n.isColor?n:new zt,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==a?a:0}function xr(e){Li.call(this),this.type="MeshBasicMaterial",this.color=new zt(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=F,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(e)}function br(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=A.generateUUID(),this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===i,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function wr(e,t){br.call(this,new Int8Array(e),t)}function _r(e,t){br.call(this,new Uint8Array(e),t)}function Mr(e,t){br.call(this,new Uint8ClampedArray(e),t)}function Er(e,t){br.call(this,new Int16Array(e),t)}function Tr(e,t){br.call(this,new Uint16Array(e),t)}function Sr(e,t){br.call(this,new Int32Array(e),t)}function Lr(e,t){br.call(this,new Uint32Array(e),t)}function Ar(e,t){br.call(this,new Float32Array(e),t)}function Rr(e,t){br.call(this,new Float64Array(e),t)}function Pr(){this.indices=[],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}mr.DefaultUp=new lt(0,1,0),mr.DefaultMatrixAutoUpdate=!0,mr.prototype={constructor:mr,isObject3D:!0,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(er=new Me,function(e,t){return er.setFromAxisAngle(e,t),this.quaternion.multiply(er),this}),rotateX:($i=new lt(1,0,0),function(e){return this.rotateOnAxis($i,e)}),rotateY:(Qi=new lt(0,1,0),function(e){return this.rotateOnAxis(Qi,e)}),rotateZ:(Ki=new lt(0,0,1),function(e){return this.rotateOnAxis(Ki,e)}),translateOnAxis:(Ji=new lt,function(e,t){return Ji.copy(e).applyQuaternion(this.quaternion),this.position.add(Ji.multiplyScalar(t)),this}),translateX:(Zi=new lt(1,0,0),function(e){return this.translateOnAxis(Zi,e)}),translateY:(Yi=new lt(0,1,0),function(e){return this.translateOnAxis(Yi,e)}),translateZ:(qi=new lt(0,0,1),function(e){return this.translateOnAxis(qi,e)}),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(Xi=new ht,function(e){return e.applyMatrix4(Xi.getInverse(this.matrixWorld))}),lookAt:(Wi=new ht,function(e){Wi.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(Wi)}),add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this},remove:function(e){if(1<arguments.length)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var i=this.children.indexOf(e);-1!==i&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var i=0,r=this.children.length;i<r;i++){var n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}},getWorldPosition:function(e){var t=e||new lt;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(Vi=new lt,ji=new lt,function(e){var t=e||new Me;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(Vi,t,ji),t}),getWorldRotation:(ki=new Me,function(e){var t=e||new Fi;return this.getWorldQuaternion(ki),t.setFromQuaternion(ki,this.rotation.order,!1)}),getWorldScale:(Gi=new lt,Hi=new Me,function(e){var t=e||new lt;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(Gi,Hi,t),t}),getWorldDirection:(zi=new Me,function(e){var t=e||new lt;return this.getWorldQuaternion(zi),t.set(0,0,1).applyQuaternion(zi)}),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,i=0,r=t.length;i<r;i++)t[i].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==e||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)},toJSON:function(e){var t=void 0===e||""===e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var r={};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),r.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),r.material=this.material.uuid),0<this.children.length){r.children=[];for(var n=0;n<this.children.length;n++)r.children.push(this.children[n].toJSON(e).object)}if(t){var a=l(e.geometries),o=l(e.materials),s=l(e.textures),c=l(e.images);0<a.length&&(i.geometries=a),0<o.length&&(i.materials=o),0<s.length&&(i.textures=s),0<c.length&&(i.images=c)}return i.object=r,i;function l(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var i=0;i<e.children.length;i++){var r=e.children[i];this.add(r.clone())}return this}},Object.assign(mr.prototype,t.prototype),gr.prototype={constructor:gr,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return(e||new lt).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new lt).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new lt;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(tr=new lt,ir=new lt,function(e,t){tr.subVectors(e,this.start),ir.subVectors(this.end,this.start);var i=ir.dot(ir),r=ir.dot(tr)/i;return t&&(r=A.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,i){var r=this.closestPointToPointParameter(e,t),n=i||new lt;return this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},vr.normal=(rr=new lt,function(e,t,i,r){var n=r||new lt;n.subVectors(i,t),rr.subVectors(e,t),n.cross(rr);var a=n.lengthSq();return 0<a?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}),vr.barycoordFromPoint=(nr=new lt,ar=new lt,or=new lt,function(e,t,i,r,n){nr.subVectors(r,t),ar.subVectors(i,t),or.subVectors(e,t);var a=nr.dot(nr),o=nr.dot(ar),s=nr.dot(or),c=ar.dot(ar),l=ar.dot(or),h=a*c-o*o,u=n||new lt;if(0==h)return u.set(-2,-1,-1);var p=1/h,d=(c*s-o*l)*p,f=(a*l-o*s)*p;return u.set(1-d-f,f,d)}),vr.containsPoint=(sr=new lt,function(e,t,i,r){var n=vr.barycoordFromPoint(e,t,i,r,sr);return 0<=n.x&&0<=n.y&&n.x+n.y<=1}),vr.prototype={constructor:vr,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:(pr=new lt,dr=new lt,function(){return pr.subVectors(this.c,this.b),dr.subVectors(this.a,this.b),.5*pr.cross(dr).length()}),midpoint:function(e){return(e||new lt).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return vr.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new Oi).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return vr.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return vr.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(e,t){void 0===cr&&(cr=new Oi,lr=[new gr,new gr,new gr],hr=new lt,ur=new lt);var i=t||new lt,r=1/0;if(cr.setFromCoplanarPoints(this.a,this.b,this.c),cr.projectPoint(e,hr),!0===this.containsPoint(hr))i.copy(hr);else{lr[0].set(this.a,this.b),lr[1].set(this.b,this.c),lr[2].set(this.c,this.a);for(var n=0;n<lr.length;n++){lr[n].closestPointToPoint(hr,!0,ur);var a=hr.distanceToSquared(ur);a<r&&(r=a,i.copy(ur))}}return i},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},yr.prototype={constructor:yr,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,i=e.vertexNormals.length;t<i;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,i=e.vertexColors.length;t<i;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},((xr.prototype=Object.create(Li.prototype)).constructor=xr).prototype.isMeshBasicMaterial=!0,xr.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},br.prototype={constructor:br,isBufferAttribute:!0,set needsUpdate(e){!0===e&&this.version++},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.itemSize:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.itemSize,i*=t.itemSize;for(var r=0,n=this.itemSize;r<n;r++)this.array[e+r]=t.array[i+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new zt),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];t[i++]=a.a,t[i++]=a.b,t[i++]=a.c}return this},copyVector2sArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new fe),t[i++]=a.x,t[i++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new lt),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;r<n;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new ct),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this},setXYZ:function(e,t,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this},setXYZW:function(e,t,i,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return(new this.constructor).copy(this)}},(wr.prototype=Object.create(br.prototype)).constructor=wr,(_r.prototype=Object.create(br.prototype)).constructor=_r,(Mr.prototype=Object.create(br.prototype)).constructor=Mr,(Er.prototype=Object.create(br.prototype)).constructor=Er,(Tr.prototype=Object.create(br.prototype)).constructor=Tr,(Sr.prototype=Object.create(br.prototype)).constructor=Sr,(Lr.prototype=Object.create(br.prototype)).constructor=Lr,(Ar.prototype=Object.create(br.prototype)).constructor=Ar,(Rr.prototype=Object.create(br.prototype)).constructor=Rr,Object.assign(Pr.prototype,{computeGroups:function(e){for(var t,i=[],r=void 0,n=e.faces,a=0;a<n.length;a++){var o=n[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,i.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,i=e.faces,r=e.vertices,n=e.faceVertexUvs,a=n[0]&&0<n[0].length,o=n[1]&&0<n[1].length,s=e.morphTargets,c=s.length;if(0<c){t=[];for(var l=0;l<c;l++)t[l]=[];this.morphTargets.position=t}var h,u=e.morphNormals,p=u.length;if(0<p){h=[];for(l=0;l<p;l++)h[l]=[];this.morphTargets.normal=h}var d=e.skinIndices,f=e.skinWeights,m=d.length===r.length,g=f.length===r.length;for(l=0;l<i.length;l++){var v=i[l];this.vertices.push(r[v.a],r[v.b],r[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=n[0][l])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new fe,new fe,new fe));if(!0===o)void 0!==(b=n[1][l])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new fe,new fe,new fe));for(var M=0;M<c;M++){var E=s[M].vertices;t[M].push(E[v.a],E[v.b],E[v.c])}for(M=0;M<p;M++){var T=u[M].vertexNormals[l];h[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(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}});var Cr,Ir,Or,Dr,Nr,Ur,Fr,Br,zr,Gr,Hr,kr,Vr,jr,Wr,Xr,qr,Yr,Zr,Jr,Kr,Qr,$r,en,tn,rn,nn,an,on,sn,cn,ln=0;function hn(){return ln++}function un(){Object.defineProperty(this,"id",{value:hn()}),this.uuid=A.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 pn(){Object.defineProperty(this,"id",{value:hn()}),this.uuid=A.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}}function dn(e,t){mr.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new pn,this.material=void 0!==t?t:new xr({color:16777215*Math.random()}),this.drawMode=st,this.updateMorphTargets()}function fn(e,t,i,r,n,a,o){return vr.barycoordFromPoint(e,t,i,r,nn),n.multiplyScalar(nn.x),a.multiplyScalar(nn.y),o.multiplyScalar(nn.z),n.add(a).add(o),n.clone()}function mn(e,t,i,r,n,a,o){var s=e.material;if(null===(s.side===Ue?i.intersectTriangle(a,n,r,!0,o):i.intersectTriangle(r,n,a,s.side!==Fe,o)))return null;on.copy(o),on.applyMatrix4(e.matrixWorld);var c=t.ray.origin.distanceTo(on);return c<t.near||c>t.far?null:{distance:c,point:on.clone(),object:e}}function gn(e,t,i,r,n,a,o,s){Yr.fromArray(r,3*a),Zr.fromArray(r,3*o),Jr.fromArray(r,3*s);var c=mn(e,t,i,Yr,Zr,Jr,an);return c&&(n&&(en.fromArray(n,2*a),tn.fromArray(n,2*o),rn.fromArray(n,2*s),c.uv=fn(an,Yr,Zr,Jr,en,tn,rn)),c.face=new yr(a,o,s,vr.normal(Yr,Zr,Jr)),c.faceIndex=a),c}function vn(e,t,i,r,n,a){pn.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a};var R=this;r=Math.floor(r)||1,n=Math.floor(n)||1,a=Math.floor(a)||1;var o,s,c,l,h,u,p,d,f=(l=0,l+=((o=r)+1)*((s=n)+1)*2,l+=(o+1)*((c=a)+1)*2,l+=(c+1)*(s+1)*2),m=(d=0,d+=(h=r)*(u=n)*2,d+=h*(p=a)*2,6*(d+=p*u*2)),P=new(65535<m?Uint32Array:Uint16Array)(m),C=new Float32Array(3*f),I=new Float32Array(3*f),O=new Float32Array(2*f),D=0,N=0,U=0,F=0,B=0;function g(e,t,i,r,n,a,o,s,c,l,h){for(var u=a/c,p=o/l,d=a/2,f=o/2,m=s/2,g=c+1,v=l+1,y=0,x=0,b=new lt,w=0;w<v;w++)for(var _=w*p-f,M=0;M<g;M++){var E=M*u-d;b[e]=E*r,b[t]=_*n,b[i]=m,C[D]=b.x,C[D+1]=b.y,C[D+2]=b.z,b[e]=0,b[t]=0,b[i]=0<s?1:-1,I[D]=b.x,I[D+1]=b.y,I[D+2]=b.z,O[N]=M/c,O[N+1]=1-w/l,D+=3,N+=2,y+=1}for(w=0;w<l;w++)for(M=0;M<c;M++){var T=F+M+g*w,S=F+M+g*(w+1),L=F+(M+1)+g*(w+1),A=F+(M+1)+g*w;P[U]=T,P[U+1]=S,P[U+2]=A,P[U+3]=S,P[U+4]=L,P[U+5]=A,U+=6,x+=6}R.addGroup(B,x,h),B+=x,F+=y}g("z","y","x",-1,-1,i,t,e,a,n,0),g("z","y","x",1,-1,i,t,-e,a,n,1),g("x","z","y",1,1,e,i,t,r,a,2),g("x","z","y",1,-1,e,i,-t,r,a,3),g("x","y","z",1,-1,e,t,i,r,n,4),g("x","y","z",-1,-1,e,t,-i,r,n,5),this.setIndex(new br(P,1)),this.addAttribute("position",new br(C,3)),this.addAttribute("normal",new br(I,3)),this.addAttribute("uv",new br(O,2))}function yn(e,t,i,r){pn.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};for(var n=e/2,a=t/2,o=Math.floor(i)||1,s=Math.floor(r)||1,c=o+1,l=s+1,h=e/o,u=t/s,p=new Float32Array(c*l*3),d=new Float32Array(c*l*3),f=new Float32Array(c*l*2),m=0,g=0,v=0;v<l;v++)for(var y=v*u-a,x=0;x<c;x++){var b=x*h-n;p[m]=b,p[m+1]=-y,d[m+2]=1,f[g]=x/o,f[g+1]=1-v/s,m+=3,g+=2}m=0;var w=new(65535<p.length/3?Uint32Array:Uint16Array)(o*s*6);for(v=0;v<s;v++)for(x=0;x<o;x++){var _=x+c*v,M=x+c*(v+1),E=x+1+c*(v+1),T=x+1+c*v;w[m]=_,w[m+1]=M,w[m+2]=T,w[m+3]=M,w[m+4]=E,w[m+5]=T,m+=6}this.setIndex(new br(w,1)),this.addAttribute("position",new br(p,3)),this.addAttribute("normal",new br(d,3)),this.addAttribute("uv",new br(f,2))}function xn(){mr.call(this),this.type="Camera",this.matrixWorldInverse=new ht,this.projectionMatrix=new ht}function bn(e,t,i,r){xn.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function wn(e,t,i,r,n,a){xn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=void 0!==n?n:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function _n(n,a,o){var s,c,l;return{setMode:function(e){s=e},setIndex:function(e){l=e.array instanceof Uint32Array&&a.get("OES_element_index_uint")?(c=n.UNSIGNED_INT,4):e.array instanceof Uint16Array?(c=n.UNSIGNED_SHORT,2):(c=n.UNSIGNED_BYTE,1)},render:function(e,t){n.drawElements(s,t,c,e*l),o.calls++,o.vertices+=t,s===n.TRIANGLES&&(o.faces+=t/3)},renderInstances:function(e,t,i){var r=a.get("ANGLE_instanced_arrays");null!==r?(r.drawElementsInstancedANGLE(s,i,c,t*l,e.maxInstancedCount),o.calls++,o.vertices+=i*e.maxInstancedCount,s===n.TRIANGLES&&(o.faces+=e.maxInstancedCount*i/3)):console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}}function Mn(n,a,o){var s;return{setMode:function(e){s=e},render:function(e,t){n.drawArrays(s,e,t),o.calls++,o.vertices+=t,s===n.TRIANGLES&&(o.faces+=t/3)},renderInstances:function(e){var t=a.get("ANGLE_instanced_arrays");if(null!==t){var i=e.attributes.position,r=0;r=i.isInterleavedBufferAttribute?i.data.count:i.count,t.drawArraysInstancedANGLE(s,0,r,e.maxInstancedCount),o.calls++,o.vertices+=r*e.maxInstancedCount,s===n.TRIANGLES&&(o.faces+=e.maxInstancedCount*r/3)}else console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}}function En(){var i={};return{get:function(e){if(void 0!==i[e.id])return i[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new lt,color:new zt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"SpotLight":t={position:new lt,direction:new lt,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"PointLight":t={position:new lt,color:new zt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"HemisphereLight":t={direction:new lt,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new lt,halfWidth:new lt,halfHeight:new lt}}return i[e.id]=t}}}function Tn(e,t,i){var r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),!1===e.getShaderParameter(r,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(r),function(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")}(i)),r}un.prototype={constructor:un,isGeometry:!0,applyMatrix:function(e){for(var t=(new Ii).getNormalMatrix(e),i=0,r=this.vertices.length;i<r;i++){this.vertices[i].applyMatrix4(e)}for(i=0,r=this.faces.length;i<r;i++){var n=this.faces[i];n.normal.applyMatrix3(t).normalize();for(var a=0,o=n.vertexNormals.length;a<o;a++)n.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return void 0===Ur&&(Ur=new ht),Ur.makeRotationX(e),this.applyMatrix(Ur),this},rotateY:function(e){return void 0===Nr&&(Nr=new ht),Nr.makeRotationY(e),this.applyMatrix(Nr),this},rotateZ:function(e){return void 0===Dr&&(Dr=new ht),Dr.makeRotationZ(e),this.applyMatrix(Dr),this},translate:function(e,t,i){return void 0===Or&&(Or=new ht),Or.makeTranslation(e,t,i),this.applyMatrix(Or),this},scale:function(e,t,i){return void 0===Ir&&(Ir=new ht),Ir.makeScale(e,t,i),this.applyMatrix(Ir),this},lookAt:function(e){void 0===Cr&&(Cr=new mr),Cr.lookAt(e),Cr.updateMatrix(),this.applyMatrix(Cr.matrix)},fromBufferGeometry:function(e){var a=this,t=null!==e.index?e.index.array:void 0,i=e.attributes,r=i.position.array,o=void 0!==i.normal?i.normal.array:void 0,s=void 0!==i.color?i.color.array:void 0,c=void 0!==i.uv?i.uv.array:void 0,l=void 0!==i.uv2?i.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var h=[],u=[],p=[],n=0,d=0;n<r.length;n+=3,d+=2)a.vertices.push(new lt(r[n],r[n+1],r[n+2])),void 0!==o&&h.push(new lt(o[n],o[n+1],o[n+2])),void 0!==s&&a.colors.push(new zt(s[n],s[n+1],s[n+2])),void 0!==c&&u.push(new fe(c[d],c[d+1])),void 0!==l&&p.push(new fe(l[d],l[d+1]));function f(e,t,i,r){var n=new yr(e,t,i,void 0!==o?[h[e].clone(),h[t].clone(),h[i].clone()]:[],void 0!==s?[a.colors[e].clone(),a.colors[t].clone(),a.colors[i].clone()]:[],r);a.faces.push(n),void 0!==c&&a.faceVertexUvs[0].push([u[e].clone(),u[t].clone(),u[i].clone()]),void 0!==l&&a.faceVertexUvs[1].push([p[e].clone(),p[t].clone(),p[i].clone()])}if(void 0!==t){var m=e.groups;if(0<m.length)for(n=0;n<m.length;n++)for(var g=m[n],v=g.start,y=(d=v,v+g.count);d<y;d+=3)f(t[d],t[d+1],t[d+2],g.materialIndex);else for(n=0;n<t.length;n+=3)f(t[n],t[n+1],t[n+2])}else for(n=0;n<r.length/3;n+=3)f(n,n+1,n+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,r=new ht;return r.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new lt,t=new lt,i=0,r=this.faces.length;i<r;i++){var n=this.faces[i],a=this.vertices[n.a],o=this.vertices[n.b],s=this.vertices[n.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),n.normal.copy(e)}},computeVertexNormals:function(e){var t,i,r,n,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,i=this.vertices.length;t<i;t++)o[t]=new lt;if(e){var s,c,l,h=new lt,u=new lt;for(r=0,n=this.faces.length;r<n;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],h.subVectors(l,c),u.subVectors(s,c),h.cross(u),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(this.computeFaceNormals(),r=0,n=this.faces.length;r<n;r++)o[(a=this.faces[r]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,i=this.vertices.length;t<i;t++)o[t].normalize();for(r=0,n=this.faces.length;r<n;r++){var p=(a=this.faces[r]).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 e,t,i;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var r=(i=this.faces[e]).vertexNormals;3===r.length?(r[0].copy(i.normal),r[1].copy(i.normal),r[2].copy(i.normal)):(r[0]=i.normal.clone(),r[1]=i.normal.clone(),r[2]=i.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,r,n;for(i=0,r=this.faces.length;i<r;i++)for((n=this.faces[i]).__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;e<t;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var a=new un;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(i=0,r=this.faces.length;i<r;i++)c=new lt,l={a:new lt,b:new lt,c:new lt},o.push(c),s.push(l)}var c,l,h=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),i=0,r=this.faces.length;i<r;i++)n=this.faces[i],c=h.faceNormals[i],l=h.vertexNormals[i],c.copy(n.normal),l.a.copy(n.vertexNormals[0]),l.b.copy(n.vertexNormals[1]),l.c.copy(n.vertexNormals[2])}for(i=0,r=this.faces.length;i<r;i++)(n=this.faces[i]).normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeLineDistances:function(){for(var e=0,t=this.vertices,i=0,r=t.length;i<r;i++)0<i&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Pi),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ci),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(!1!==(e&&e.isGeometry)){var r,n=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.faceVertexUvs[0],h=e.faceVertexUvs[0],u=this.colors,p=e.colors;void 0===i&&(i=0),void 0!==t&&(r=(new Ii).getNormalMatrix(t));for(var d=0,f=o.length;d<f;d++){var m=o[d].clone();void 0!==t&&m.applyMatrix4(t),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 yr(x.a+n,x.b+n,x.c+n)).normal.copy(x.normal),void 0!==r&&g.normal.applyMatrix3(r).normalize();for(var _=0,M=b.length;_<M;_++)v=b[_].clone(),void 0!==r&&v.applyMatrix3(r).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+i,s.push(g)}for(d=0,f=h.length;d<f;d++){var E=h[d],T=[];if(void 0!==E){for(_=0,M=E.length;_<M;_++)T.push(E[_].clone());l.push(T)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){!1!==(e&&e.isMesh)?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,i,r,n,a,o,s,c={},l=[],h=[],u=Math.pow(10,4);for(i=0,r=this.vertices.length;i<r;i++)e=this.vertices[i],void 0===c[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(c[t]=i,l.push(this.vertices[i]),h[i]=l.length-1):h[i]=h[c[t]];var p=[];for(i=0,r=this.faces.length;i<r;i++){(n=this.faces[i]).a=h[n.a],n.b=h[n.b],n.c=h[n.c],a=[n.a,n.b,n.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(i);break}}for(i=p.length-1;0<=i;i--){var f=p[i];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-l.length;return this.vertices=l,m},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,i=0;i<t;i++)e[i]._id=i;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var r,n,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(r=[]),o&&o.length===t&&(n=[]);for(i=0;i<t;i++){var s=e[i]._id;r&&r.push(a[s]),n&&n.push(o[s])}r&&(this.faceVertexUvs[0]=r),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){var e={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}for(var r=[],n=0;n<this.vertices.length;n++){var a=this.vertices[n];r.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],h={},u=[],p={};for(n=0;n<this.faces.length;n++){var d=this.faces[n],f=void 0!==this.faceVertexUvs[0][n],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,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var b=this.faceVertexUvs[0][n];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(e,t,i){return i?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]||(c[t]=s.length/3,s.push(e.x,e.y,e.z)),c[t]}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=l.length,l.push(e.getHex())),h[t]}function S(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]||(p[t]=u.length/2,u.push(e.x,e.y)),p[t]}return e.data={},e.data.vertices=r,e.data.normals=s,0<l.length&&(e.data.colors=l),0<u.length&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new un).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var t=e.vertices,i=0,r=t.length;i<r;i++)this.vertices.push(t[i].clone());var n=e.colors;for(i=0,r=n.length;i<r;i++)this.colors.push(n[i].clone());var a=e.faces;for(i=0,r=a.length;i<r;i++)this.faces.push(a[i].clone());for(i=0,r=e.faceVertexUvs.length;i<r;i++){var o=e.faceVertexUvs[i];void 0===this.faceVertexUvs[i]&&(this.faceVertexUvs[i]=[]);for(var s=0,c=o.length;s<c;s++){for(var l=o[s],h=[],u=0,p=l.length;u<p;u++){var d=l[u];h.push(d.clone())}this.faceVertexUvs[i].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(un.prototype,t.prototype),pn.prototype={constructor:pn,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t,i){return!1===(t&&t.isBufferAttribute)&&!1===(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new br(t,i))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new Ii).getNormalMatrix(e).applyToBufferAttribute(i),i.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return void 0===jr&&(jr=new ht),jr.makeRotationX(e),this.applyMatrix(jr),this},rotateY:function(e){return void 0===Vr&&(Vr=new ht),Vr.makeRotationY(e),this.applyMatrix(Vr),this},rotateZ:function(e){return void 0===kr&&(kr=new ht),kr.makeRotationZ(e),this.applyMatrix(kr),this},translate:function(e,t,i){return void 0===Hr&&(Hr=new ht),Hr.makeTranslation(e,t,i),this.applyMatrix(Hr),this},scale:function(e,t,i){return void 0===Gr&&(Gr=new ht),Gr.makeScale(e,t,i),this.applyMatrix(Gr),this},lookAt:function(e){void 0===zr&&(zr=new mr),zr.lookAt(e),zr.updateMatrix(),this.applyMatrix(zr.matrix)},center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var i=new Ar(3*t.vertices.length,3),r=new Ar(3*t.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var n=new Ar(t.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t,i=e.geometry;if(e.isMesh){var r=i.__directGeometry;if(!0===i.elementsNeedUpdate&&(r=void 0,i.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(i);r.verticesNeedUpdate=i.verticesNeedUpdate,r.normalsNeedUpdate=i.normalsNeedUpdate,r.colorsNeedUpdate=i.colorsNeedUpdate,r.uvsNeedUpdate=i.uvsNeedUpdate,r.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=!1,i.normalsNeedUpdate=!1,i.colorsNeedUpdate=!1,i.uvsNeedUpdate=!1,i.groupsNeedUpdate=!1,i=r}return!0===i.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(i.vertices),t.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(i.normals),t.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(i.colors),t.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(i.uvs),t.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(i.lineDistances),t.needsUpdate=!0),i.lineDistancesNeedUpdate=!1),i.groupsNeedUpdate&&(i.computeGroups(e.geometry),this.groups=i.groups,i.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Pr).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new br(t,3).copyVector3sArray(e.vertices)),0<e.normals.length){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new br(i,3).copyVector3sArray(e.normals))}if(0<e.colors.length){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new br(r,3).copyColorsArray(e.colors))}if(0<e.uvs.length){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new br(n,2).copyVector2sArray(e.uvs))}if(0<e.uvs2.length){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new br(a,2).copyVector2sArray(e.uvs2))}if(0<e.indices.length){var o=new(65535<e.vertices.length?Uint32Array:Uint16Array)(3*e.indices.length);this.setIndex(new br(o,1).copyIndicesArray(e.indices))}for(var s in this.groups=e.groups,e.morphTargets){for(var c=[],l=e.morphTargets[s],h=0,u=l.length;h<u;h++){var p=l[h],d=new Ar(3*p.length,3);c.push(d.copyVector3sArray(p))}this.morphAttributes[s]=c}if(0<e.skinIndices.length){var f=new Ar(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(0<e.skinWeights.length){var m=new Ar(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Pi);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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:(Fr=new Pi,Br=new lt,function(){null===this.boundingSphere&&(this.boundingSphere=new Ci);var e=this.attributes.position;if(e){var t=this.boundingSphere.center;Fr.setFromBufferAttribute(e),Fr.getCenter(t);for(var i=0,r=0,n=e.count;r<n;r++)Br.x=e.getX(r),Br.y=e.getY(r),Br.z=e.getZ(r),i=Math.max(i,t.distanceToSquared(Br));this.boundingSphere.radius=Math.sqrt(i),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 e=this.index,t=this.attributes,i=this.groups;if(t.position){var r=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new br(new Float32Array(r.length),3));else for(var n=t.normal.array,a=0,o=n.length;a<o;a++)n[a]=0;var s,c,l,h=t.normal.array,u=new lt,p=new lt,d=new lt,f=new lt,m=new lt;if(e){var g=e.array;0===i.length&&this.addGroup(0,g.length);for(var v=0,y=i.length;v<y;++v){var x=i[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],l=3*g[a+2],u.fromArray(r,s),p.fromArray(r,c),d.fromArray(r,l),f.subVectors(d,p),m.subVectors(u,p),f.cross(m),h[s]+=f.x,h[1+s]+=f.y,h[2+s]+=f.z,h[c]+=f.x,h[1+c]+=f.y,h[2+c]+=f.z,h[l]+=f.x,h[1+l]+=f.y,h[2+l]+=f.z}}else for(a=0,o=r.length;a<o;a+=9)u.fromArray(r,a),p.fromArray(r,a+3),d.fromArray(r,a+6),f.subVectors(d,p),m.subVectors(u,p),f.cross(m),h[a]=f.x,h[a+1]=f.y,h[a+2]=f.z,h[a+3]=f.x,h[a+4]=f.y,h[a+5]=f.z,h[a+6]=f.x,h[a+7]=f.y,h[a+8]=f.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!1!==(e&&e.isBufferGeometry)){void 0===t&&(t=0);var i=this.attributes;for(var r in i)if(void 0!==e.attributes[r])for(var n=i[r].array,a=e.attributes[r],o=a.array,s=0,c=a.itemSize*t;s<o.length;s++,c++)n[c]=o[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e,t,i,r,n=this.attributes.normal.array,a=0,o=n.length;a<o;a+=3)e=n[a],t=n[a+1],i=n[a+2],r=1/Math.sqrt(e*e+t*t+i*i),n[a]*=r,n[a+1]*=r,n[a+2]*=r},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new pn,t=this.index.array,i=this.attributes;for(var r in i){for(var n=i[r],a=n.array,o=n.itemSize,s=new a.constructor(t.length*o),c=0,l=0,h=0,u=t.length;h<u;h++){c=t[h]*o;for(var p=0;p<o;p++)s[l++]=a[c++]}e.addAttribute(r,new br(s,o))}return e},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};var r=this.index;if(null!==r){var n=Array.prototype.slice.call(r.array);e.data.index={type:r.array.constructor.name,array:n}}var a=this.attributes;for(var i in a){var o=a[i];n=Array.prototype.slice.call(o.array);e.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:n,normalized:o.normalized}}var s=this.groups;0<s.length&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new pn).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var r in i){var n=i[r];this.addAttribute(r,n.clone())}for(var a=e.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},pn.MaxIndex=65535,Object.assign(pn.prototype,t.prototype),dn.prototype=Object.assign(Object.create(mr.prototype),{constructor:dn,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return mr.prototype.copy.call(this,e),this.drawMode=e.drawMode,this},updateMorphTargets:function(){var e=this.geometry.morphTargets;if(void 0!==e&&0<e.length){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,i=e.length;t<i;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[e[t].name]=t}},raycast:(Wr=new ht,Xr=new Ui,qr=new Ci,Yr=new lt,Zr=new lt,Jr=new lt,Kr=new lt,Qr=new lt,$r=new lt,en=new fe,tn=new fe,rn=new fe,nn=new lt,an=new lt,on=new lt,function(e,t){var i,r,n=this.geometry,a=this.material,o=this.matrixWorld;if(void 0!==a&&(null===n.boundingSphere&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(o),!1!==e.ray.intersectsSphere(qr)&&(Wr.getInverse(o),Xr.copy(e.ray).applyMatrix4(Wr),null===n.boundingBox||!1!==Xr.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var s,c,l,h=n.index,u=n.attributes,p=u.position.array;if(void 0!==u.uv&&(i=u.uv.array),null!==h)for(var d=h.array,f=0,m=d.length;f<m;f+=3)s=d[f],c=d[f+1],l=d[f+2],(r=gn(this,e,Xr,p,i,s,c,l))&&(r.faceIndex=Math.floor(f/3),t.push(r));else for(f=0,m=p.length;f<m;f+=9)(r=gn(this,e,Xr,p,i,s=f/3,c=s+1,l=s+2))&&(r.index=s,t.push(r))}else if(n.isGeometry){var g,v,y,x=a&&a.isMultiMaterial,b=!0===x?a.materials:null,w=n.vertices,_=n.faces,M=n.faceVertexUvs[0];0<M.length&&(i=M);for(var E=0,T=_.length;E<T;E++){var S=_[E],L=!0===x?b[S.materialIndex]:a;if(void 0!==L){if(g=w[S.a],v=w[S.b],y=w[S.c],!0===L.morphTargets){var A=n.morphTargets,R=this.morphTargetInfluences;Yr.set(0,0,0),Zr.set(0,0,0),Jr.set(0,0,0);for(var P=0,C=A.length;P<C;P++){var I=R[P];if(0!==I){var O=A[P].vertices;Yr.addScaledVector(Kr.subVectors(O[S.a],g),I),Zr.addScaledVector(Qr.subVectors(O[S.b],v),I),Jr.addScaledVector($r.subVectors(O[S.c],y),I)}}Yr.add(g),Zr.add(v),Jr.add(y),g=Yr,v=Zr,y=Jr}if(r=mn(this,e,Xr,g,v,y,an)){if(i){var D=i[E];en.copy(D[0]),tn.copy(D[1]),rn.copy(D[2]),r.uv=fn(an,g,v,y,en,tn,rn)}r.face=S,r.faceIndex=E,t.push(r)}}}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),(vn.prototype=Object.create(pn.prototype)).constructor=vn,(yn.prototype=Object.create(pn.prototype)).constructor=yn,((xn.prototype=Object.create(mr.prototype)).constructor=xn).prototype.isCamera=!0,xn.prototype.getWorldDirection=(sn=new Me,function(e){var t=e||new lt;return this.getWorldQuaternion(sn),t.set(0,0,-1).applyQuaternion(sn)}),xn.prototype.lookAt=(cn=new ht,function(e){cn.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(cn)}),xn.prototype.clone=function(){return(new this.constructor).copy(this)},xn.prototype.copy=function(e){return mr.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},bn.prototype=Object.assign(Object.create(xn.prototype),{constructor:bn,isPerspectiveCamera:!0,copy:function(e){return xn.prototype.copy.call(this,e),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*A.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*A.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*A.RAD2DEG*Math.atan(Math.tan(.5*A.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(e,t,i,r,n,a){this.aspect=e/t,this.view={fullWidth:e,fullHeight:t,offsetX:i,offsetY:r,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*A.DEG2RAD*this.fov)/this.zoom,i=2*t,r=this.aspect*i,n=-.5*r,a=this.view;if(null!==a){var o=a.fullWidth,s=a.fullHeight;n+=a.offsetX*r/o,t-=a.offsetY*i/s,r*=a.width/o,i*=a.height/s}var c=this.filmOffset;0!==c&&(n+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+r,t,t-i,e,this.far)},toJSON:function(e){var t=mr.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),wn.prototype=Object.assign(Object.create(xn.prototype),{constructor:wn,isOrthographicCamera:!0,copy:function(e){return xn.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,i,r,n,a){this.view={fullWidth:e,fullHeight:t,offsetX:i,offsetY:r,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,n=i-e,a=i+e,o=r+t,s=r-t;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),h=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;a=(n+=h*(this.view.offsetX/c))+h*(this.view.width/c),s=(o-=u*(this.view.offsetY/l))-u*(this.view.height/l)}this.projectionMatrix.makeOrthographic(n,a,o,s,this.near,this.far)},toJSON:function(e){var t=mr.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}});var Sn,Ln,An,Rn,Pn,Cn,In,On,Dn,Nn,Un,Fn=0;function Bn(e){switch(e){case f:return["Linear","( value )"];case h:return["sRGB","( value )"];case u:return["RGBE","( value )"];case p:return["RGBM","( value, 7.0 )"];case d:return["RGBM","( value, 16.0 )"];case g:return["RGBD","( value, 256.0 )"];case m:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function zn(e,t){var i=Bn(t);return"vec4 "+e+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Gn(e){return""!==e}function Hn(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function kn(e){return e.replace(/#include +<([\w\d.]+)>/g,function(e,t){var i=Bt[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return kn(i)})}function Vn(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,i,r){for(var n="",a=parseInt(t);a<parseInt(i);a++)n+=r.replace(/\[ i \]/g,"[ "+a+" ]");return n})}function jn(e,t,i,r){var n=e.context,a=i.extensions,o=i.defines,s=i.__webglShader.vertexShader,c=i.__webglShader.fragmentShader,l="SHADOWMAP_TYPE_BASIC";r.shadowMapType===Y?l="SHADOWMAP_TYPE_PCF":r.shadowMapType===U&&(l="SHADOWMAP_TYPE_PCF_SOFT");var h="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(r.envMap){switch(i.envMap.mapping){case se:case ce:h="ENVMAP_TYPE_CUBE";break;case pe:case de:h="ENVMAP_TYPE_CUBE_UV";break;case le:case he:h="ENVMAP_TYPE_EQUIREC";break;case ue:h="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case ce:case he:u="ENVMAP_MODE_REFRACTION"}switch(i.combine){case F:p="ENVMAP_BLENDING_MULTIPLY";break;case B:p="ENVMAP_BLENDING_MIX";break;case z:p="ENVMAP_BLENDING_ADD"}}var d,f,m,g,v,y,x,b,w=0<e.gammaFactor?e.gammaFactor:1,_=(d=a,f=r,m=e.extensions,[(d=d||{}).derivatives||f.envMapCubeUV||f.bumpMap||f.normalMap||f.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(d.fragDepth||f.logarithmicDepthBuffer)&&m.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",d.drawBuffers&&m.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(d.shaderTextureLOD||f.envMap)&&m.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Gn).join("\n")),M=function(e){var t=[];for(var i in e){var r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join("\n")}(o),E=n.createProgram();v=i.isRawShaderMaterial?(g=[M,"\n"].filter(Gn).join("\n"),[_,M,"\n"].filter(Gn).join("\n")):(g=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,M,r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+u:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+l:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&e.extensions.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(Gn).join("\n"),[_,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,M,r.alphaTest?"#define ALPHATEST "+r.alphaTest:"","#define GAMMA_FACTOR "+w,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+h:"",r.envMap?"#define "+u:"",r.envMap?"#define "+p:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(r.numClippingPlanes-r.numClipIntersection),r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+l:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==G?"#define TONE_MAPPING":"",r.toneMapping!==G?Bt.tonemapping_pars_fragment:"",r.toneMapping!==G?function(e,t){var i;switch(t){case je:i="Linear";break;case H:i="Reinhard";break;case ae:i="Uncharted2";break;case oe:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",r.toneMapping):"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?Bt.encodings_pars_fragment:"",r.mapEncoding?zn("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?zn("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?zn("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?(y="linearToOutputTexel",x=r.outputEncoding,b=Bn(x),"vec4 "+y+"( vec4 value ) { return LinearTo"+b[0]+b[1]+"; }"):"",r.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Gn).join("\n")),s=Hn(s=kn(s),r),c=Hn(c=kn(c),r),i.isShaderMaterial||(s=Vn(s),c=Vn(c));var T=g+s,S=v+c,L=Tn(n,n.VERTEX_SHADER,T),A=Tn(n,n.FRAGMENT_SHADER,S);n.attachShader(E,L),n.attachShader(E,A),void 0!==i.index0AttributeName?n.bindAttribLocation(E,0,i.index0AttributeName):!0===r.morphTargets&&n.bindAttribLocation(E,0,"position"),n.linkProgram(E);var R,P,C=n.getProgramInfoLog(E),I=n.getShaderInfoLog(L),O=n.getShaderInfoLog(A),D=!0,N=!0;return!1===n.getProgramParameter(E,n.LINK_STATUS)?(D=!1,console.error("THREE.WebGLProgram: shader error: ",n.getError(),"gl.VALIDATE_STATUS",n.getProgramParameter(E,n.VALIDATE_STATUS),"gl.getProgramInfoLog",C,I,O)):""!==C?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",C):""!==I&&""!==O||(N=!1),N&&(this.diagnostics={runnable:D,material:i,programLog:C,vertexShader:{log:I,prefix:g},fragmentShader:{log:O,prefix:v}}),n.deleteShader(L),n.deleteShader(A),this.getUniforms=function(){return void 0===R&&(R=new Ut(n,E,e)),R},this.getAttributes=function(){return void 0===P&&(P=function(e,t){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var a=e.getActiveAttrib(t,n).name;i[a]=e.getAttribLocation(t,a)}return i}(n,E)),P},this.destroy=function(){n.deleteProgram(E),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.id=Fn++,this.code=t,this.usedTimes=1,this.program=E,this.vertexShader=L,this.fragmentShader=A,this}function Wn(h,u){var s=[],p={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","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"];function d(e,t){var i;return e?e.isTexture?i=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=e.texture.encoding):i=f,i===f&&t&&(i=m),i}this.getParameters=function(e,t,i,r,n,a){var o=p[e.type],s=function(e){if(u.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var t=u.maxVertexUniforms,i=Math.floor((t-20)/4);return void 0!==e&&e&&e.isSkinnedMesh&&(i=Math.min(e.skeleton.bones.length,i))<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+i+" (try OpenGL instead of ANGLE)"),i}(a),c=h.getPrecision();null!==e.precision&&(c=u.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",c,"instead.");var l=h.getCurrentRenderTarget();return{shaderID:o,precision:c,supportsVertexTextures:u.vertexTextures,outputEncoding:d(l?l.texture:null,h.gammaOutput),map:!!e.map,mapEncoding:d(e.map,h.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:d(e.envMap,h.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===pe||e.envMap.mapping===de),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:d(e.emissiveMap,h.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexColors:e.vertexColors,fog:!!i,useFog:e.fog,fogExp:i&&i.isFogExp2,flatShading:e.shading===Be,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:u.logarithmicDepthBuffer,skinning:e.skinning,maxBones:s,useVertexTexture:u.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:h.maxMorphTargets,maxMorphNormals:h.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numClippingPlanes:r,numClipIntersection:n,shadowMapEnabled:h.shadowMap.enabled&&a.receiveShadow&&0<t.shadows.length,shadowMapType:h.shadowMap.type,toneMapping:h.toneMapping,physicallyCorrectLights:h.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===Fe,flipSided:e.side===Ue,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,t){var i=[];if(t.shaderID?i.push(t.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)i.push(r),i.push(e.defines[r]);for(var n=0;n<a.length;n++)i.push(t[a[n]]);return i.join()},this.acquireProgram=function(e,t,i){for(var r,n=0,a=s.length;n<a;n++){var o=s[n];if(o.code===i){++(r=o).usedTimes;break}}return void 0===r&&(r=new jn(h,i,e,t),s.push(r)),r},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=s.indexOf(e);s[t]=s[s.length-1],s.pop(),e.destroy()}},this.programs=s}function Xn(n,a,o){var s={};function c(e){var t=e.target,i=s[t.id];null!==i.index&&l(i.index),function(e){for(var t in e)l(e[t])}(i.attributes),t.removeEventListener("dispose",c),delete s[t.id];var r=a.get(t);r.wireframe&&l(r.wireframe),a.delete(t);var n=a.get(i);n.wireframe&&l(n.wireframe),a.delete(i),o.memory.geometries--}function l(e){var t,i,r=(t=e).isInterleavedBufferAttribute?a.get(t.data).__webglBuffer:a.get(t).__webglBuffer;void 0!==r&&(n.deleteBuffer(r),(i=e).isInterleavedBufferAttribute?a.delete(i.data):a.delete(i))}return{get:function(e){var t,i=e.geometry;return void 0!==s[i.id]?s[i.id]:(i.addEventListener("dispose",c),i.isBufferGeometry?t=i:i.isGeometry&&(void 0===i._bufferGeometry&&(i._bufferGeometry=(new pn).setFromObject(e)),t=i._bufferGeometry),s[i.id]=t,o.memory.geometries++,t)}}}function qn(d,f,e){var l=new Xn(d,f,e);function m(e,t){var i=e.isInterleavedBufferAttribute?e.data:e,r=f.get(i);void 0===r.__webglBuffer?function(e,t,i){e.__webglBuffer=d.createBuffer(),d.bindBuffer(i,e.__webglBuffer);var r=t.dynamic?d.DYNAMIC_DRAW:d.STATIC_DRAW;d.bufferData(i,t.array,r);var n=d.FLOAT,a=t.array;a instanceof Float32Array?n=d.FLOAT:a instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):a instanceof Uint16Array?n=d.UNSIGNED_SHORT:a instanceof Int16Array?n=d.SHORT:a instanceof Uint32Array?n=d.UNSIGNED_INT:a instanceof Int32Array?n=d.INT:a instanceof Int8Array?n=d.BYTE:a instanceof Uint8Array&&(n=d.UNSIGNED_BYTE);e.bytesPerElement=a.BYTES_PER_ELEMENT,e.type=n,e.version=t.version,t.onUploadCallback()}(r,i,t):r.version!==i.version&&function(e,t,i){d.bindBuffer(i,e.__webglBuffer),!1===t.dynamic?d.bufferData(i,t.array,d.STATIC_DRAW):-1===t.updateRange.count?d.bufferSubData(i,0,t.array):0===t.updateRange.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."):(d.bufferSubData(i,t.updateRange.offset*t.array.BYTES_PER_ELEMENT,t.array.subarray(t.updateRange.offset,t.updateRange.offset+t.updateRange.count)),t.updateRange.count=0);e.version=t.version}(r,i,t)}return{getAttributeBuffer:function(e){return e.isInterleavedBufferAttribute?f.get(e.data).__webglBuffer:f.get(e).__webglBuffer},getAttributeProperties:function(e){return e.isInterleavedBufferAttribute?f.get(e.data):f.get(e)},getWireframeAttribute:function(e){var t=f.get(e);if(void 0!==t.wireframe)return t.wireframe;var i,r=[],n=e.index,a=e.attributes,o=a.position;if(null!==n)for(var s=0,c=(i=n.array).length;s<c;s+=3){var l=i[s+0],h=i[s+1],u=i[s+2];r.push(l,h,h,u,u,l)}else for(s=0,c=(i=a.position.array).length/3-1;s<c;s+=3){l=s+0,h=s+1,u=s+2;r.push(l,h,h,u,u,l)}var p=new br(new(65535<o.count?Uint32Array:Uint16Array)(r),1);return m(p,d.ELEMENT_ARRAY_BUFFER),t.wireframe=p},update:function(e){var t=l.get(e);e.geometry.isGeometry&&t.updateFromObject(e);var i=t.index,r=t.attributes;for(var n in null!==i&&m(i,d.ELEMENT_ARRAY_BUFFER),r)m(r[n],d.ARRAY_BUFFER);var a=t.morphAttributes;for(var n in a)for(var o=a[n],s=0,c=o.length;s<c;s++)m(o[s],d.ARRAY_BUFFER);return t}}}function Yn(f,n,m,g,v,y,e){var x=e.memory,p="undefined"!=typeof WebGL2RenderingContext&&f instanceof WebGL2RenderingContext;function b(e,t){if(e.width>t||e.height>t){var i=t/Math.max(e.width,e.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.width=Math.floor(e.width*i),r.height=Math.floor(e.height*i),r.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height,e),r}return e}function w(e){return A.isPowerOfTwo(e.width)&&A.isPowerOfTwo(e.height)}function a(e){return e===Xe||e===qe||e===Ye?f.NEAREST:f.LINEAR}function _(e){var t=e.target;t.removeEventListener("dispose",_),function(e){var t=g.get(e);if(e.image&&t.__image__webglTextureCube)f.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;f.deleteTexture(t.__webglTexture)}g.delete(e)}(t),x.textures--}function o(e){var t=e.target;t.removeEventListener("dispose",o),function(e){var t=g.get(e),i=g.get(e.texture);if(!e)return;void 0!==i.__webglTexture&&f.deleteTexture(i.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var r=0;r<6;r++)f.deleteFramebuffer(t.__webglFramebuffer[r]),t.__webglDepthbuffer&&f.deleteRenderbuffer(t.__webglDepthbuffer[r]);else f.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&f.deleteRenderbuffer(t.__webglDepthbuffer);g.delete(e.texture),g.delete(e)}(t),x.textures--}function s(e,t){var i=g.get(e);if(0<e.version&&i.__version!==e.version){var r=e.image;if(void 0===r)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==r.complete)return void function(e,t,i){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",_),e.__webglTexture=f.createTexture(),x.textures++);m.activeTexture(f.TEXTURE0+i),m.bindTexture(f.TEXTURE_2D,e.__webglTexture),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,t.flipY),f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),f.pixelStorei(f.UNPACK_ALIGNMENT,t.unpackAlignment);var r=b(t.image,v.maxTextureSize);!function(e){return e.wrapS!==We||e.wrapT!==We||e.minFilter!==Xe&&e.minFilter!==Ze}(t)||!1!==w(r)||(r=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.width=A.nearestPowerOfTwo(e.width),t.height=A.nearestPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}(r));var n=w(r),a=y(t.format),o=y(t.type);M(f.TEXTURE_2D,t,n);var s,c=t.mipmaps;if(t.isDepthTexture){var l=f.DEPTH_COMPONENT;if(t.type===et){if(!p)throw new Error("Float Depth Texture only supported in WebGL2.0");l=f.DEPTH_COMPONENT32F}else p&&(l=f.DEPTH_COMPONENT16);t.format===at&&l===f.DEPTH_COMPONENT&&t.type!==Qe&&t.type!==$e&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),t.type=Qe,o=y(t.type)),t.format===ot&&(l=f.DEPTH_STENCIL,t.type!==it&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),t.type=it,o=y(t.type))),m.texImage2D(f.TEXTURE_2D,0,l,r.width,r.height,0,a,o,null)}else if(t.isDataTexture)if(0<c.length&&n){for(var h=0,u=c.length;h<u;h++)s=c[h],m.texImage2D(f.TEXTURE_2D,h,a,s.width,s.height,0,a,o,s.data);t.generateMipmaps=!1}else m.texImage2D(f.TEXTURE_2D,0,a,r.width,r.height,0,a,o,r.data);else if(t.isCompressedTexture)for(h=0,u=c.length;h<u;h++)s=c[h],t.format!==nt&&t.format!==rt?-1<m.getCompressedTextureFormats().indexOf(a)?m.compressedTexImage2D(f.TEXTURE_2D,h,a,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):m.texImage2D(f.TEXTURE_2D,h,a,s.width,s.height,0,a,o,s.data);else if(0<c.length&&n){for(h=0,u=c.length;h<u;h++)s=c[h],m.texImage2D(f.TEXTURE_2D,h,a,a,o,s);t.generateMipmaps=!1}else m.texImage2D(f.TEXTURE_2D,0,a,a,o,r);t.generateMipmaps&&n&&f.generateMipmap(f.TEXTURE_2D);e.__version=t.version,t.onUpdate&&t.onUpdate(t)}(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_2D,i.__webglTexture)}function M(e,t,i){var r;if(i?(f.texParameteri(e,f.TEXTURE_WRAP_S,y(t.wrapS)),f.texParameteri(e,f.TEXTURE_WRAP_T,y(t.wrapT)),f.texParameteri(e,f.TEXTURE_MAG_FILTER,y(t.magFilter)),f.texParameteri(e,f.TEXTURE_MIN_FILTER,y(t.minFilter))):(f.texParameteri(e,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(e,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),t.wrapS===We&&t.wrapT===We||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),f.texParameteri(e,f.TEXTURE_MAG_FILTER,a(t.magFilter)),f.texParameteri(e,f.TEXTURE_MIN_FILTER,a(t.minFilter)),t.minFilter!==Xe&&t.minFilter!==Ze&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),r=n.get("EXT_texture_filter_anisotropic")){if(t.type===et&&null===n.get("OES_texture_float_linear"))return;if(t.type===tt&&null===n.get("OES_texture_half_float_linear"))return;(1<t.anisotropy||g.get(t).__currentAnisotropy)&&(f.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,v.getMaxAnisotropy())),g.get(t).__currentAnisotropy=t.anisotropy)}}function c(e,t,i,r){var n=y(t.texture.format),a=y(t.texture.type);m.texImage2D(r,0,n,t.width,t.height,0,n,a,null),f.bindFramebuffer(f.FRAMEBUFFER,e),f.framebufferTexture2D(f.FRAMEBUFFER,i,r,g.get(t.texture).__webglTexture,0),f.bindFramebuffer(f.FRAMEBUFFER,null)}function l(e,t){f.bindRenderbuffer(f.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,t.width,t.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,t.width,t.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,e)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,t.width,t.height),f.bindRenderbuffer(f.RENDERBUFFER,null)}function h(e){var t=g.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,t){if(t&&t.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(f.bindFramebuffer(f.FRAMEBUFFER,e),!t.depthTexture||!t.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");g.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),s(t.depthTexture,0);var i=g.get(t.depthTexture).__webglTexture;if(t.depthTexture.format===at)f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.TEXTURE_2D,i,0);else{if(t.depthTexture.format!==ot)throw new Error("Unknown depthTexture format");f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,i,0)}}(t.__webglFramebuffer,e)}else if(i){t.__webglDepthbuffer=[];for(var r=0;r<6;r++)f.bindFramebuffer(f.FRAMEBUFFER,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=f.createRenderbuffer(),l(t.__webglDepthbuffer[r],e)}else f.bindFramebuffer(f.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=f.createRenderbuffer(),l(t.__webglDepthbuffer,e);f.bindFramebuffer(f.FRAMEBUFFER,null)}this.setTexture2D=s,this.setTextureCube=function(e,t){var i=g.get(e);if(6===e.image.length)if(0<e.version&&i.__version!==e.version){i.__image__webglTextureCube||(e.addEventListener("dispose",_),i.__image__webglTextureCube=f.createTexture(),x.textures++),m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_CUBE_MAP,i.__image__webglTextureCube),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var r=e&&e.isCompressedTexture,n=e.image[0]&&e.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=r||n?n?e.image[o].image:e.image[o]:b(e.image[o],v.maxCubemapSize);var s=w(a[0]),c=y(e.format),l=y(e.type);M(f.TEXTURE_CUBE_MAP,e,s);for(o=0;o<6;o++)if(r)for(var h,u=a[o].mipmaps,p=0,d=u.length;p<d;p++)h=u[p],e.format!==nt&&e.format!==rt?-1<m.getCompressedTextureFormats().indexOf(c)?m.compressedTexImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,p,c,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,p,c,h.width,h.height,0,c,l,h.data);else n?m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c,a[o].width,a[o].height,0,c,l,a[o].data):m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c,c,l,a[o]);e.generateMipmaps&&s&&f.generateMipmap(f.TEXTURE_CUBE_MAP),i.__version=e.version,e.onUpdate&&e.onUpdate(e)}else m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_CUBE_MAP,i.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,t){m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_CUBE_MAP,g.get(e).__webglTexture)},this.setupRenderTarget=function(e){var t=g.get(e),i=g.get(e.texture);e.addEventListener("dispose",o),i.__webglTexture=f.createTexture(),x.textures++;var r=!0===e.isWebGLRenderTargetCube,n=w(e);if(r){t.__webglFramebuffer=[];for(var a=0;a<6;a++)t.__webglFramebuffer[a]=f.createFramebuffer()}else t.__webglFramebuffer=f.createFramebuffer();if(r){m.bindTexture(f.TEXTURE_CUBE_MAP,i.__webglTexture),M(f.TEXTURE_CUBE_MAP,e.texture,n);for(a=0;a<6;a++)c(t.__webglFramebuffer[a],e,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+a);e.texture.generateMipmaps&&n&&f.generateMipmap(f.TEXTURE_CUBE_MAP),m.bindTexture(f.TEXTURE_CUBE_MAP,null)}else m.bindTexture(f.TEXTURE_2D,i.__webglTexture),M(f.TEXTURE_2D,e.texture,n),c(t.__webglFramebuffer,e,f.COLOR_ATTACHMENT0,f.TEXTURE_2D),e.texture.generateMipmaps&&n&&f.generateMipmap(f.TEXTURE_2D),m.bindTexture(f.TEXTURE_2D,null);e.depthBuffer&&h(e)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(t.generateMipmaps&&w(e)&&t.minFilter!==Xe&&t.minFilter!==Ze){var i=e&&e.isWebGLRenderTargetCube?f.TEXTURE_CUBE_MAP:f.TEXTURE_2D,r=g.get(t).__webglTexture;m.bindTexture(i,r),f.generateMipmap(i),m.bindTexture(i,null)}}}function Zn(){var r={};return{get:function(e){var t=e.uuid,i=r[t];return void 0===i&&(i={},r[t]=i),i},delete:function(e){delete r[e.uuid]},clear:function(){r={}}}}function Jn(h,i,c){var t=new function(){var t=!1,a=new ct,i=null,o=new ct;return{setMask:function(e){i===e||t||(h.colorMask(e,e,e,e),i=e)},setLocked:function(e){t=e},setClear:function(e,t,i,r,n){!0===n&&(e*=r,t*=r,i*=r),a.set(e,t,i,r),!1===o.equals(a)&&(h.clearColor(e,t,i,r),o.copy(a))},reset:function(){t=!1,i=null,o.set(0,0,0,1)}}},r=new function(){var t=!1,i=null,r=null,n=null;return{setTest:function(e){e?N(h.DEPTH_TEST):U(h.DEPTH_TEST)},setMask:function(e){i===e||t||(h.depthMask(e),i=e)},setFunc:function(e){if(r!==e){if(e)switch(e){case K:h.depthFunc(h.NEVER);break;case Q:h.depthFunc(h.ALWAYS);break;case $:h.depthFunc(h.LESS);break;case ee:h.depthFunc(h.LEQUAL);break;case te:h.depthFunc(h.EQUAL);break;case ie:h.depthFunc(h.GEQUAL);break;case re:h.depthFunc(h.GREATER);break;case ne:h.depthFunc(h.NOTEQUAL);break;default:h.depthFunc(h.LEQUAL)}else h.depthFunc(h.LEQUAL);r=e}},setLocked:function(e){t=e},setClear:function(e){n!==e&&(h.clearDepth(e),n=e)},reset:function(){t=!1,n=r=i=null}}},n=new function(){var t=!1,i=null,r=null,n=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){e?N(h.STENCIL_TEST):U(h.STENCIL_TEST)},setMask:function(e){i===e||t||(h.stencilMask(e),i=e)},setFunc:function(e,t,i){r===e&&n===t&&a===i||(h.stencilFunc(e,t,i),r=e,n=t,a=i)},setOp:function(e,t,i){o===e&&s===t&&c===i||(h.stencilOp(e,t,i),o=e,s=t,c=i)},setLocked:function(e){t=e},setClear:function(e){l!==e&&(h.clearStencil(e),l=e)},reset:function(){t=!1,l=c=s=o=a=n=r=i=null}}},e=h.getParameter(h.MAX_VERTEX_ATTRIBS),a=new Uint8Array(e),o=new Uint8Array(e),s=new Uint8Array(e),l={},u=null,p=null,d=null,f=null,m=null,g=null,v=null,y=null,x=!1,b=null,w=null,_=null,M=null,E=null,T=null,S=h.getParameter(h.MAX_TEXTURE_IMAGE_UNITS),L=parseFloat(/^WebGL\ ([0-9])/.exec(h.getParameter(h.VERSION))[1]),A=1<=parseFloat(L),R=null,P={},C=new ct,I=new ct;function O(e,t,i){var r=new Uint8Array(4),n=h.createTexture();h.bindTexture(e,n),h.texParameteri(e,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(e,h.TEXTURE_MAG_FILTER,h.NEAREST);for(var a=0;a<i;a++)h.texImage2D(t+a,0,h.RGBA,1,1,0,h.RGBA,h.UNSIGNED_BYTE,r);return n}var D={};function N(e){!0!==l[e]&&(h.enable(e),l[e]=!0)}function U(e){!1!==l[e]&&(h.disable(e),l[e]=!1)}function F(e,t,i,r,n,a,o,s){e!==Ge?N(h.BLEND):U(h.BLEND),e===p&&s===x||(e===X?s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ONE,h.ONE,h.ONE,h.ONE)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.SRC_ALPHA,h.ONE)):e===q?s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ZERO,h.ZERO,h.ONE_MINUS_SRC_COLOR,h.ONE_MINUS_SRC_ALPHA)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR)):e===Z?s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ZERO,h.SRC_COLOR,h.ZERO,h.SRC_ALPHA)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.ZERO,h.SRC_COLOR)):s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ONE,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)):(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)),p=e,x=s),e===J?(n=n||t,a=a||i,o=o||r,t===d&&n===g||(h.blendEquationSeparate(c(t),c(n)),d=t,g=n),i===f&&r===m&&a===v&&o===y||(h.blendFuncSeparate(c(i),c(r),c(a),c(o)),f=i,m=r,v=a,y=o)):y=v=g=m=f=d=null}function B(e){r.setFunc(e)}function z(e){b!==e&&(e?h.frontFace(h.CW):h.frontFace(h.CCW),b=e)}function G(e){e!==k?(N(h.CULL_FACE),e!==w&&(e===V?h.cullFace(h.BACK):e===j?h.cullFace(h.FRONT):h.cullFace(h.FRONT_AND_BACK))):U(h.CULL_FACE),w=e}function H(e){void 0===e&&(e=h.TEXTURE0+S-1),R!==e&&(h.activeTexture(e),R=e)}return D[h.TEXTURE_2D]=O(h.TEXTURE_2D,h.TEXTURE_2D,1),D[h.TEXTURE_CUBE_MAP]=O(h.TEXTURE_CUBE_MAP,h.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:t,depth:r,stencil:n},init:function(){t.setClear(0,0,0,1),r.setClear(1),n.setClear(0),N(h.DEPTH_TEST),B(ee),z(!1),G(V),N(h.CULL_FACE),N(h.BLEND),F(W)},initAttributes:function(){for(var e=0,t=a.length;e<t;e++)a[e]=0},enableAttribute:function(e){a[e]=1,0===o[e]&&(h.enableVertexAttribArray(e),o[e]=1),0!==s[e]&&(i.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(e,0),s[e]=0)},enableAttributeAndDivisor:function(e,t,i){a[e]=1,0===o[e]&&(h.enableVertexAttribArray(e),o[e]=1),s[e]!==t&&(i.vertexAttribDivisorANGLE(e,t),s[e]=t)},disableUnusedAttributes:function(){for(var e=0,t=o.length;e!==t;++e)o[e]!==a[e]&&(h.disableVertexAttribArray(e),o[e]=0)},enable:N,disable:U,getCompressedTextureFormats:function(){if(null===u&&(u=[],i.get("WEBGL_compressed_texture_pvrtc")||i.get("WEBGL_compressed_texture_s3tc")||i.get("WEBGL_compressed_texture_etc1")))for(var e=h.getParameter(h.COMPRESSED_TEXTURE_FORMATS),t=0;t<e.length;t++)u.push(e[t]);return u},setBlending:F,setColorWrite:function(e){t.setMask(e)},setDepthTest:function(e){r.setTest(e)},setDepthWrite:function(e){r.setMask(e)},setDepthFunc:B,setStencilTest:function(e){n.setTest(e)},setStencilWrite:function(e){n.setMask(e)},setStencilFunc:function(e,t,i){n.setFunc(e,t,i)},setStencilOp:function(e,t,i){n.setOp(e,t,i)},setFlipSided:z,setCullFace:G,setLineWidth:function(e){e!==_&&(A&&h.lineWidth(e),_=e)},setPolygonOffset:function(e,t,i){e?(N(h.POLYGON_OFFSET_FILL),M===t&&E===i||(h.polygonOffset(t,i),M=t,E=i)):U(h.POLYGON_OFFSET_FILL)},getScissorTest:function(){return T},setScissorTest:function(e){(T=e)?N(h.SCISSOR_TEST):U(h.SCISSOR_TEST)},activeTexture:H,bindTexture:function(e,t){null===R&&H();var i=P[R];void 0===i&&(i={type:void 0,texture:void 0},P[R]=i),i.type===e&&i.texture===t||(h.bindTexture(e,t||D[e]),i.type=e,i.texture=t)},compressedTexImage2D:function(){try{h.compressedTexImage2D.apply(h,arguments)}catch(e){console.error(e)}},texImage2D:function(){try{h.texImage2D.apply(h,arguments)}catch(e){console.error(e)}},scissor:function(e){!1===C.equals(e)&&(h.scissor(e.x,e.y,e.z,e.w),C.copy(e))},viewport:function(e){!1===I.equals(e)&&(h.viewport(e.x,e.y,e.z,e.w),I.copy(e))},reset:function(){for(var e=0;e<o.length;e++)1===o[e]&&(h.disableVertexAttribArray(e),o[e]=0);l={},P={},w=b=p=R=u=null,t.reset(),r.reset(),n.reset()}}}function Kn(t,i,e){var r;function n(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}var a=void 0!==e.precision?e.precision:"highp",o=n(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);var s=!0===e.logarithmicDepthBuffer&&!!i.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),u=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),d=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),f=t.getParameter(t.MAX_VARYING_VECTORS),m=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=0<l,v=!!i.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==r)return r;var e=i.get("EXT_texture_filter_anisotropic");return r=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:a,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:u,maxAttributes:p,maxVertexUniforms:d,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}function Qn(i){var r={};return{get:function(e){if(void 0!==r[e])return r[e];var t;switch(e){case"WEBGL_depth_texture":t=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":t=i.getExtension("WEBGL_compressed_texture_etc1");break;default:t=i.getExtension(e)}return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),r[e]=t}}}function $n(){var h=this,u=null,p=0,d=!1,f=!1,m=new Oi,g=new Ii,v={value:null,needsUpdate:!1};function y(){v.value!==u&&(v.value=u,v.needsUpdate=0<p),h.numPlanes=p,h.numIntersection=0}function x(e,t,i,r){var n=null!==e?e.length:0,a=null;if(0!==n){if(a=v.value,!0!==r||null===a){var o=i+4*n,s=t.matrixWorldInverse;g.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var c=0,l=i;c!==n;++c,l+=4)m.copy(e[c]).applyMatrix4(s,g),m.normal.toArray(a,l),a[l+3]=m.constant}v.value=a,v.needsUpdate=!0}return h.numPlanes=n,a}this.uniform=v,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,i){var r=0!==e.length||t||0!==p||d;return d=t,u=x(e,i,0),p=e.length,r},this.beginShadows=function(){f=!0,x(null)},this.endShadows=function(){f=!1,y()},this.setState=function(e,t,i,r,n,a){if(!d||null===e||0===e.length||f&&!i)f?x(null):y();else{var o=f?0:p,s=4*o,c=n.clippingState||null;v.value=c,c=x(e,r,s,a);for(var l=0;l!==s;++l)c[l]=u[l];n.clippingState=c,this.numIntersection=t?this.numPlanes:0,this.numPlanes+=o}}}function ea(e){console.log("THREE.WebGLRenderer","84dev");var r=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,n=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,d=[],l=[],h=-1,u=[],p=-1,R=new Float32Array(8),f=[],m=[];this.domElement=r,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=je,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var P,S=this,L=null,g=null,v=null,A=-1,C="",I=null,y=new ct,x=null,b=new ct,O=0,w=new zt(0),_=0,M=r.width,D=r.height,N=1,E=new ct(0,0,M,D),T=!1,U=new ct(0,0,M,D),F=new Di,B=new $n,z=!1,G=!1,H=new Ci,k=new ht,V=new lt,j=new ht,W=new ht,X={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},q={calls:0,vertices:0,faces:0,points:0};this.info={render:q,memory:{geometries:0,textures:0},programs:null};try{var Y={alpha:i,depth:n,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c};if(null===(P=t||r.getContext("webgl",Y)||r.getContext("experimental-webgl",Y)))throw null!==r.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===P.getShaderPrecisionFormat&&(P.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),r.addEventListener("webglcontextlost",xe,!1)}catch(e){console.error("THREE.WebGLRenderer: "+e)}var Z=new Qn(P);Z.get("WEBGL_depth_texture"),Z.get("OES_texture_float"),Z.get("OES_texture_float_linear"),Z.get("OES_texture_half_float"),Z.get("OES_texture_half_float_linear"),Z.get("OES_standard_derivatives"),Z.get("ANGLE_instanced_arrays"),Z.get("OES_element_index_uint")&&(pn.MaxIndex=4294967296);var J=new Kn(P,Z,e),K=new Jn(P,Z,Ne),Q=new Zn,$=new Yn(P,Z,K,Q,J,Ne,this.info),ee=new qn(P,Q,this.info),te=new Wn(this,J),ie=new En;this.info.programs=te.programs;var re=new Mn(P,Z,q),ne=new _n(P,Z,q),ae=new wn(-1,1,1,-1,0,1),oe=new bn,se=new dn(new yn(2,2),new xr({depthTest:!1,depthWrite:!1,fog:!1})),ce=Xt.cube,le=new dn(new vn(5,5,5),new Ai({uniforms:ce.uniforms,vertexShader:ce.vertexShader,fragmentShader:ce.fragmentShader,side:Ue,depthTest:!1,depthWrite:!1,fog:!1}));function he(){return null===g?N:1}function ue(){K.init(),K.scissor(y.copy(E).multiplyScalar(N)),K.viewport(b.copy(U).multiplyScalar(N)),K.buffers.color.setClear(w.r,w.g,w.b,_,s)}function pe(){I=L=null,C="",A=-1,K.reset()}ue(),this.context=P,this.capabilities=J,this.extensions=Z,this.properties=Q,this.state=K;var de=new Ni(this,X,ee,J);this.shadowMap=de;var fe,me,ge,ve=new Zt(this,f),ye=new Yt(this,m);function xe(e){e.preventDefault(),pe(),ue(),Q.clear()}function be(e){var t,i=e.target;i.removeEventListener("dispose",be),we(t=i),Q.delete(t)}function we(e){var t=Q.get(e).program;(e.program=void 0)!==t&&te.releaseProgram(t)}function _e(e,t){return Math.abs(t[0])-Math.abs(e[0])}function Me(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.program&&t.material.program&&e.material.program!==t.material.program?e.material.program.id-t.material.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Ee(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Te(e,t,i,r,n){var a,o;o=i.transparent?(a=u,++p):(a=l,++h);var s=a[o];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=i,s.z=V.z,s.group=n):(s={id:e.id,object:e,geometry:t,material:i,z:V.z,group:n},a.push(s))}function Se(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),H.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),Ae(H)}function Le(e){return H.center.set(0,0,0),H.radius=.7071067811865476,H.applyMatrix4(e.matrixWorld),Ae(H)}function Ae(e){if(!F.intersectsSphere(e))return!1;var t=B.numPlanes;if(0===t)return!0;var i=S.clippingPlanes,r=e.center,n=-e.radius,a=0;do{if(i[a].distanceToPoint(r)<n)return!1}while(++a!==t);return!0}function Re(e,t,i,r){for(var n=0,a=e.length;n<a;n++){var o=e[n],s=o.object,c=o.geometry,l=void 0===r?o.material:r,h=o.group;if(s.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.onBeforeRender(S,t,i,c,l,h),s.isImmediateRenderObject){Pe(l);var u=Ce(i,t.fog,l,s);C="",s.render(function(e){S.renderBufferImmediate(e,u,l)})}else S.renderBufferDirect(i,t.fog,c,l,s,h);s.onAfterRender(S,t,i,c,l,h)}}function Pe(e){e.side===Fe?K.disable(P.CULL_FACE):K.enable(P.CULL_FACE),K.setFlipSided(e.side===Ue),!0===e.transparent?K.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):K.setBlending(Ge),K.setDepthFunc(e.depthFunc),K.setDepthTest(e.depthTest),K.setDepthWrite(e.depthWrite),K.setColorWrite(e.colorWrite),K.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function Ce(e,t,i,r){O=0;var n=Q.get(i);if(z&&(G||e!==I)){var a=e===I&&i.id===A;B.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,e,n,a)}!1===i.needsUpdate&&(void 0===n.program?i.needsUpdate=!0:i.fog&&n.fog!==t?i.needsUpdate=!0:i.lights&&n.lightsHash!==X.hash?i.needsUpdate=!0:void 0===n.numClippingPlanes||n.numClippingPlanes===B.numPlanes&&n.numIntersection===B.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(function(e,t,i){var r=Q.get(e),n=te.getParameters(e,X,t,B.numPlanes,B.numIntersection,i),a=te.getProgramCode(e,n),o=r.program,s=!0;if(void 0===o)e.addEventListener("dispose",be);else if(o.code!==a)we(e);else{if(void 0!==n.shaderID)return;s=!1}if(s){if(n.shaderID){var c=Xt[n.shaderID];r.__webglShader={name:e.type,uniforms:Ft.clone(c.uniforms),vertexShader:c.vertexShader,fragmentShader:c.fragmentShader}}else r.__webglShader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.__webglShader=r.__webglShader,o=te.acquireProgram(e,n,a),r.program=o,e.program=o}var l=o.getAttributes();if(e.morphTargets)for(var h=e.numSupportedMorphTargets=0;h<S.maxMorphTargets;h++)0<=l["morphTarget"+h]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(h=e.numSupportedMorphNormals=0;h<S.maxMorphNormals;h++)0<=l["morphNormal"+h]&&e.numSupportedMorphNormals++;var u=r.__webglShader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=B.numPlanes,r.numIntersection=B.numIntersection,u.clippingPlanes=B.uniform),r.fog=t,r.lightsHash=X.hash,e.lights&&(u.ambientLightColor.value=X.ambient,u.directionalLights.value=X.directional,u.spotLights.value=X.spot,u.rectAreaLights.value=X.rectArea,u.pointLights.value=X.point,u.hemisphereLights.value=X.hemi,u.directionalShadowMap.value=X.directionalShadowMap,u.directionalShadowMatrix.value=X.directionalShadowMatrix,u.spotShadowMap.value=X.spotShadowMap,u.spotShadowMatrix.value=X.spotShadowMatrix,u.pointShadowMap.value=X.pointShadowMap,u.pointShadowMatrix.value=X.pointShadowMatrix);var p=r.program.getUniforms(),d=Ut.seqWithValue(p.seq,u);r.uniformsList=d}(i,t,r),i.needsUpdate=!1);var o,s,c,l,h,u,p,d,f,m,g,v,y=!1,x=!1,b=!1,w=n.program,_=w.getUniforms(),M=n.__webglShader.uniforms;if(w.id!==L&&(P.useProgram(w.program),L=w.id,b=x=y=!0),i.id!==A&&(A=i.id,x=!0),y||e!==I){if(_.set(P,e,"projectionMatrix"),J.logarithmicDepthBuffer&&_.setValue(P,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==I&&(I=e,b=x=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var E=_.map.cameraPosition;void 0!==E&&E.setValue(P,V.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&_.setValue(P,"viewMatrix",e.matrixWorldInverse),_.set(P,S,"toneMappingExposure"),_.set(P,S,"toneMappingWhitePoint")}if(i.skinning){_.setOptional(P,r,"bindMatrix"),_.setOptional(P,r,"bindMatrixInverse");var T=r.skeleton;T&&(J.floatVertexTextures&&T.useVertexTexture?(_.set(P,T,"boneTexture"),_.set(P,T,"boneTextureWidth"),_.set(P,T,"boneTextureHeight")):_.setOptional(P,T,"boneMatrices"))}return x&&(i.lights&&(v=b,(g=M).ambientLightColor.needsUpdate=v,g.directionalLights.needsUpdate=v,g.pointLights.needsUpdate=v,g.spotLights.needsUpdate=v,g.rectAreaLights.needsUpdate=v,g.hemisphereLights.needsUpdate=v),t&&i.fog&&(m=t,(f=M).fogColor.value=m.color,m.isFog?(f.fogNear.value=m.near,f.fogFar.value=m.far):m.isFogExp2&&(f.fogDensity.value=m.density)),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshNormalMaterial||i.isMeshDepthMaterial)&&function(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity);e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity);t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var i;t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap);if(void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var r=i.offset,n=i.repeat;e.offsetRepeat.value.set(r.x,r.y,n.x,n.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}(M,i),i.isLineBasicMaterial?Ie(M,i):i.isLineDashedMaterial?(Ie(M,i),d=i,(p=M).dashSize.value=d.dashSize,p.totalSize.value=d.dashSize+d.gapSize,p.scale.value=d.scale):i.isPointsMaterial?function(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*N,e.scale.value=.5*D,e.map.value=t.map,null!==t.map){var i=t.map.offset,r=t.map.repeat;e.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}}(M,i):i.isMeshLambertMaterial?(h=M,(u=i).emissiveMap&&(h.emissiveMap.value=u.emissiveMap)):i.isMeshToonMaterial?(Oe(c=M,l=i),l.gradientMap&&(c.gradientMap.value=l.gradientMap)):i.isMeshPhongMaterial?Oe(M,i):i.isMeshPhysicalMaterial?(s=i,(o=M).clearCoat.value=s.clearCoat,o.clearCoatRoughness.value=s.clearCoatRoughness,De(o,s)):i.isMeshStandardMaterial?De(M,i):i.isMeshDepthMaterial?i.displacementMap&&(M.displacementMap.value=i.displacementMap,M.displacementScale.value=i.displacementScale,M.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale);t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(M,i),void 0!==M.ltcMat&&(M.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==M.ltcMag&&(M.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),Ut.upload(P,n.uniformsList,M,S)),_.set(P,r,"modelViewMatrix"),_.set(P,r,"normalMatrix"),_.setValue(P,"modelMatrix",r.matrixWorld),w}function Ie(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function Oe(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function De(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function Ne(e){var t;if(1e3===e)return P.REPEAT;if(e===We)return P.CLAMP_TO_EDGE;if(1002===e)return P.MIRRORED_REPEAT;if(e===Xe)return P.NEAREST;if(e===qe)return P.NEAREST_MIPMAP_NEAREST;if(e===Ye)return P.NEAREST_MIPMAP_LINEAR;if(e===Ze)return P.LINEAR;if(1007===e)return P.LINEAR_MIPMAP_NEAREST;if(e===Je)return P.LINEAR_MIPMAP_LINEAR;if(e===Ke)return P.UNSIGNED_BYTE;if(1017===e)return P.UNSIGNED_SHORT_4_4_4_4;if(1018===e)return P.UNSIGNED_SHORT_5_5_5_1;if(1019===e)return P.UNSIGNED_SHORT_5_6_5;if(1010===e)return P.BYTE;if(1011===e)return P.SHORT;if(e===Qe)return P.UNSIGNED_SHORT;if(1013===e)return P.INT;if(e===$e)return P.UNSIGNED_INT;if(e===et)return P.FLOAT;if(e===tt&&null!==(t=Z.get("OES_texture_half_float")))return t.HALF_FLOAT_OES;if(1021===e)return P.ALPHA;if(e===rt)return P.RGB;if(e===nt)return P.RGBA;if(1024===e)return P.LUMINANCE;if(1025===e)return P.LUMINANCE_ALPHA;if(e===at)return P.DEPTH_COMPONENT;if(e===ot)return P.DEPTH_STENCIL;if(e===He)return P.FUNC_ADD;if(101===e)return P.FUNC_SUBTRACT;if(102===e)return P.FUNC_REVERSE_SUBTRACT;if(200===e)return P.ZERO;if(201===e)return P.ONE;if(202===e)return P.SRC_COLOR;if(203===e)return P.ONE_MINUS_SRC_COLOR;if(e===ke)return P.SRC_ALPHA;if(e===Ve)return P.ONE_MINUS_SRC_ALPHA;if(206===e)return P.DST_ALPHA;if(207===e)return P.ONE_MINUS_DST_ALPHA;if(208===e)return P.DST_COLOR;if(209===e)return P.ONE_MINUS_DST_COLOR;if(210===e)return P.SRC_ALPHA_SATURATE;if((2001===e||2002===e||2003===e||2004===e)&&null!==(t=Z.get("WEBGL_compressed_texture_s3tc"))){if(2001===e)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(2002===e)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(2003===e)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(2004===e)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((2100===e||2101===e||2102===e||2103===e)&&null!==(t=Z.get("WEBGL_compressed_texture_pvrtc"))){if(2100===e)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(2101===e)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(2102===e)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(2103===e)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(2151===e&&null!==(t=Z.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((103===e||104===e)&&null!==(t=Z.get("EXT_blend_minmax"))){if(103===e)return t.MIN_EXT;if(104===e)return t.MAX_EXT}return e===it&&null!==(t=Z.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:0}this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){Z.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return J.getMaxAnisotropy()},this.getPrecision=function(){return J.precision},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){void 0!==e&&(N=e,this.setSize(U.z,U.w,!1))},this.getSize=function(){return{width:M,height:D}},this.setSize=function(e,t,i){M=e,D=t,r.width=e*N,r.height=t*N,!1!==i&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,i,r){K.viewport(U.set(e,t,i,r))},this.setScissor=function(e,t,i,r){K.scissor(E.set(e,t,i,r))},this.setScissorTest=function(e){K.setScissorTest(T=e)},this.getClearColor=function(){return w},this.setClearColor=function(e,t){w.set(e),_=void 0!==t?t:1,K.buffers.color.setClear(w.r,w.g,w.b,_,s)},this.getClearAlpha=function(){return _},this.setClearAlpha=function(e){_=e,K.buffers.color.setClear(w.r,w.g,w.b,_,s)},this.clear=function(e,t,i){var r=0;void 0!==e&&!e||(r|=P.COLOR_BUFFER_BIT),void 0!==t&&!t||(r|=P.DEPTH_BUFFER_BIT),void 0!==i&&!i||(r|=P.STENCIL_BUFFER_BIT),P.clear(r)},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(e,t,i,r){this.setRenderTarget(e),this.clear(t,i,r)},this.resetGLState=pe,this.dispose=function(){u=[],l=[],h=p=-1,r.removeEventListener("webglcontextlost",xe,!1)},this.renderBufferImmediate=function(e,t,i){K.initAttributes();var r=Q.get(e);e.hasPositions&&!r.position&&(r.position=P.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=P.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=P.createBuffer()),e.hasColors&&!r.color&&(r.color=P.createBuffer());var n=t.getAttributes();if(e.hasPositions&&(P.bindBuffer(P.ARRAY_BUFFER,r.position),P.bufferData(P.ARRAY_BUFFER,e.positionArray,P.DYNAMIC_DRAW),K.enableAttribute(n.position),P.vertexAttribPointer(n.position,3,P.FLOAT,!1,0,0)),e.hasNormals){if(P.bindBuffer(P.ARRAY_BUFFER,r.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&!i.isMeshNormalMaterial&&i.shading===Be)for(var a=0,o=3*e.count;a<o;a+=9){var s=e.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,l=(s[a+1]+s[a+4]+s[a+7])/3,h=(s[a+2]+s[a+5]+s[a+8])/3;s[a+0]=c,s[a+1]=l,s[a+2]=h,s[a+3]=c,s[a+4]=l,s[a+5]=h,s[a+6]=c,s[a+7]=l,s[a+8]=h}P.bufferData(P.ARRAY_BUFFER,e.normalArray,P.DYNAMIC_DRAW),K.enableAttribute(n.normal),P.vertexAttribPointer(n.normal,3,P.FLOAT,!1,0,0)}e.hasUvs&&i.map&&(P.bindBuffer(P.ARRAY_BUFFER,r.uv),P.bufferData(P.ARRAY_BUFFER,e.uvArray,P.DYNAMIC_DRAW),K.enableAttribute(n.uv),P.vertexAttribPointer(n.uv,2,P.FLOAT,!1,0,0)),e.hasColors&&i.vertexColors!==ze&&(P.bindBuffer(P.ARRAY_BUFFER,r.color),P.bufferData(P.ARRAY_BUFFER,e.colorArray,P.DYNAMIC_DRAW),K.enableAttribute(n.color),P.vertexAttribPointer(n.color,3,P.FLOAT,!1,0,0)),K.disableUnusedAttributes(),P.drawArrays(P.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,i,r,n,a){Pe(r);var o=Ce(e,t,r,n),s=!1,c=i.id+"_"+o.id+"_"+r.wireframe;c!==C&&(C=c,s=!0);var l=n.morphTargetInfluences;if(void 0!==l){for(var h=[],u=0,p=l.length;u<p;u++){var d=l[u];h.push([d,u])}h.sort(_e),8<h.length&&(h.length=8);var f=i.morphAttributes;for(u=0,p=h.length;u<p;u++){d=h[u];if(R[u]=d[0],0!==d[0]){var m=d[1];!0===r.morphTargets&&f.position&&i.addAttribute("morphTarget"+u,f.position[m]),!0===r.morphNormals&&f.normal&&i.addAttribute("morphNormal"+u,f.normal[m])}else!0===r.morphTargets&&i.removeAttribute("morphTarget"+u),!0===r.morphNormals&&i.removeAttribute("morphNormal"+u)}u=h.length;for(var g=R.length;u<g;u++)R[u]=0;o.getUniforms().setValue(P,"morphTargetInfluences",R),s=!0}m=i.index;var v,y=i.attributes.position,x=1;!0===r.wireframe&&(m=ee.getWireframeAttribute(i),x=2),null!==m?(v=ne).setIndex(m):v=re,s&&(function(e,t,i,r){var n;if(i&&i.isInstancedBufferGeometry&&null===(n=Z.get("ANGLE_instanced_arrays")))return console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===r&&(r=0);K.initAttributes();var a=i.attributes,o=t.getAttributes(),s=e.defaultAttributeValues;for(var c in o){var l=o[c];if(0<=l){var h=a[c];if(void 0!==h){var u=h.normalized,p=h.itemSize,d=ee.getAttributeProperties(h),f=d.__webglBuffer,m=d.type,g=d.bytesPerElement;if(h.isInterleavedBufferAttribute){var v=h.data,y=v.stride,x=h.offset;v&&v.isInstancedInterleavedBuffer?(K.enableAttributeAndDivisor(l,v.meshPerAttribute,n),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):K.enableAttribute(l),P.bindBuffer(P.ARRAY_BUFFER,f),P.vertexAttribPointer(l,p,m,u,y*g,(r*y+x)*g)}else h.isInstancedBufferAttribute?(K.enableAttributeAndDivisor(l,h.meshPerAttribute,n),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):K.enableAttribute(l),P.bindBuffer(P.ARRAY_BUFFER,f),P.vertexAttribPointer(l,p,m,u,0,r*p*g)}else if(void 0!==s){var b=s[c];if(void 0!==b)switch(b.length){case 2:P.vertexAttrib2fv(l,b);break;case 3:P.vertexAttrib3fv(l,b);break;case 4:P.vertexAttrib4fv(l,b);break;default:P.vertexAttrib1fv(l,b)}}}}K.disableUnusedAttributes()}(r,o,i),null!==m&&P.bindBuffer(P.ELEMENT_ARRAY_BUFFER,ee.getAttributeBuffer(m)));var b=0;null!==m?b=m.count:void 0!==y&&(b=y.count);var w=i.drawRange.start*x,_=i.drawRange.count*x,M=null!==a?a.start*x:0,E=null!==a?a.count*x:1/0,T=Math.max(w,M),S=Math.min(b,w+_,M+E)-1,L=Math.max(0,S-T+1);if(0!==L){if(n.isMesh)if(!0===r.wireframe)K.setLineWidth(r.wireframeLinewidth*he()),v.setMode(P.LINES);else switch(n.drawMode){case st:v.setMode(P.TRIANGLES);break;case 1:v.setMode(P.TRIANGLE_STRIP);break;case 2:v.setMode(P.TRIANGLE_FAN)}else if(n.isLine){var A=r.linewidth;void 0===A&&(A=1),K.setLineWidth(A*he()),n.isLineSegments?v.setMode(P.LINES):v.setMode(P.LINE_STRIP)}else n.isPoints&&v.setMode(P.POINTS);i&&i.isInstancedBufferGeometry?0<i.maxInstancedCount&&v.renderInstances(i,T,L):v.render(T,L)}},this.render=function(e,t,i,r){if(void 0===t||!0===t.isCamera){C="",A=-1,!(I=null)===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),k.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromMatrix(k),d.length=0,p=h=-1,f.length=0,m.length=0,G=this.localClippingEnabled,z=B.init(this.clippingPlanes,G,t),function e(t,i){if(!1===t.visible)return;var r=0!=(t.layers.mask&i.layers.mask);if(r)if(t.isLight)d.push(t);else if(t.isSprite)!1!==t.frustumCulled&&!0!==Le(t)||f.push(t);else if(t.isLensFlare)m.push(t);else if(t.isImmediateRenderObject)!0===S.sortObjects&&(V.setFromMatrixPosition(t.matrixWorld),V.applyProjection(k)),Te(t,null,t.material,V.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!1===t.frustumCulled||!0===Se(t))){var n=t.material;if(!0===n.visible){!0===S.sortObjects&&(V.setFromMatrixPosition(t.matrixWorld),V.applyProjection(k));var a=ee.update(t);if(n.isMultiMaterial)for(var o=a.groups,s=n.materials,c=0,l=o.length;c<l;c++){var h=o[c],u=s[h.materialIndex];!0===u.visible&&Te(t,a,u,V.z,h)}else Te(t,a,n,V.z,null)}}var p=t.children;for(var c=0,l=p.length;c<l;c++)e(p[c],i)}(e,t),l.length=h+1,u.length=p+1,!0===S.sortObjects&&(l.sort(Me),u.sort(Ee)),z&&B.beginShadows(),function(e){for(var t=0,i=0,r=e.length;i<r;i++){var n=e[i];n.castShadow&&(X.shadows[t++]=n)}X.shadows.length=t}(d),de.render(e,t),function(e,t){var i,r,n,a,o,s,c,l=0,h=0,u=0,p=t.matrixWorldInverse,d=0,f=0,m=0,g=0,v=0;for(i=0,r=e.length;i<r;i++)if(n=e[i],a=n.color,o=n.intensity,s=n.distance,c=n.shadow&&n.shadow.map?n.shadow.map.texture:null,n.isAmbientLight)l+=a.r*o,h+=a.g*o,u+=a.b*o;else if(n.isDirectionalLight){(y=ie.get(n)).color.copy(n.color).multiplyScalar(n.intensity),y.direction.setFromMatrixPosition(n.matrixWorld),V.setFromMatrixPosition(n.target.matrixWorld),y.direction.sub(V),y.direction.transformDirection(p),y.shadow=n.castShadow,n.castShadow&&(y.shadowBias=n.shadow.bias,y.shadowRadius=n.shadow.radius,y.shadowMapSize=n.shadow.mapSize),X.directionalShadowMap[d]=c,X.directionalShadowMatrix[d]=n.shadow.matrix,X.directional[d++]=y}else if(n.isSpotLight){(y=ie.get(n)).position.setFromMatrixPosition(n.matrixWorld),y.position.applyMatrix4(p),y.color.copy(a).multiplyScalar(o),y.distance=s,y.direction.setFromMatrixPosition(n.matrixWorld),V.setFromMatrixPosition(n.target.matrixWorld),y.direction.sub(V),y.direction.transformDirection(p),y.coneCos=Math.cos(n.angle),y.penumbraCos=Math.cos(n.angle*(1-n.penumbra)),y.decay=0===n.distance?0:n.decay,y.shadow=n.castShadow,n.castShadow&&(y.shadowBias=n.shadow.bias,y.shadowRadius=n.shadow.radius,y.shadowMapSize=n.shadow.mapSize),X.spotShadowMap[m]=c,X.spotShadowMatrix[m]=n.shadow.matrix,X.spot[m++]=y}else if(n.isRectAreaLight){(y=ie.get(n)).color.copy(a).multiplyScalar(o/(n.width*n.height)),y.position.setFromMatrixPosition(n.matrixWorld),y.position.applyMatrix4(p),W.identity(),j.copy(n.matrixWorld),j.premultiply(p),W.extractRotation(j),y.halfWidth.set(.5*n.width,0,0),y.halfHeight.set(0,.5*n.height,0),y.halfWidth.applyMatrix4(W),y.halfHeight.applyMatrix4(W),X.rectArea[g++]=y}else if(n.isPointLight){(y=ie.get(n)).position.setFromMatrixPosition(n.matrixWorld),y.position.applyMatrix4(p),y.color.copy(n.color).multiplyScalar(n.intensity),y.distance=n.distance,y.decay=0===n.distance?0:n.decay,y.shadow=n.castShadow,n.castShadow&&(y.shadowBias=n.shadow.bias,y.shadowRadius=n.shadow.radius,y.shadowMapSize=n.shadow.mapSize),X.pointShadowMap[f]=c,void 0===X.pointShadowMatrix[f]&&(X.pointShadowMatrix[f]=new ht),V.setFromMatrixPosition(n.matrixWorld).negate(),X.pointShadowMatrix[f].identity().setPosition(V),X.point[f++]=y}else if(n.isHemisphereLight){var y;(y=ie.get(n)).direction.setFromMatrixPosition(n.matrixWorld),y.direction.transformDirection(p),y.direction.normalize(),y.skyColor.copy(n.color).multiplyScalar(o),y.groundColor.copy(n.groundColor).multiplyScalar(o),X.hemi[v++]=y}X.ambient[0]=l,X.ambient[1]=h,X.ambient[2]=u,X.directional.length=d,X.spot.length=m,X.rectArea.length=g,X.point.length=f,X.hemi.length=v,X.hash=d+","+f+","+m+","+g+","+v+","+X.shadows.length}(d,t),z&&B.endShadows(),q.calls=0,q.vertices=0,q.faces=0,void(q.points=0)===i&&(i=null),this.setRenderTarget(i);var n=e.background;if(null===n?K.buffers.color.setClear(w.r,w.g,w.b,_,s):n&&n.isColor&&(K.buffers.color.setClear(n.r,n.g,n.b,1,s),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),n&&n.isCubeTexture?(oe.projectionMatrix.copy(t.projectionMatrix),oe.matrixWorld.extractRotation(t.matrixWorld),oe.matrixWorldInverse.getInverse(oe.matrixWorld),le.material.uniforms.tCube.value=n,le.modelViewMatrix.multiplyMatrices(oe.matrixWorldInverse,le.matrixWorld),ee.update(le),S.renderBufferDirect(oe,null,le.geometry,le.material,le,null)):n&&n.isTexture&&(se.material.map=n,ee.update(se),S.renderBufferDirect(ae,null,se.geometry,se.material,se,null)),e.overrideMaterial){var a=e.overrideMaterial;Re(l,e,t,a),Re(u,e,t,a)}else K.setBlending(Ge),Re(l,e,t),Re(u,e,t);ve.render(e,t),ye.render(e,t,b),i&&$.updateRenderTargetMipmap(i),K.setDepthTest(!0),K.setDepthWrite(!0),K.setColorWrite(!0)}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(e,t){K.setCullFace(e),K.setFlipSided(0===t)},this.allocTextureUnit=function(){var e=O;return e>=J.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+J.maxTextures),O+=1,e},this.setTexture2D=(fe=!1,function(e,t){e&&e.isWebGLRenderTarget&&(fe||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),fe=!0),e=e.texture),$.setTexture2D(e,t)}),this.setTexture=(me=!1,function(e,t){me||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),me=!0),$.setTexture2D(e,t)}),this.setTextureCube=(ge=!1,function(e,t){e&&e.isWebGLRenderTargetCube&&(ge||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),ge=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?$.setTextureCube(e,t):$.setTextureCubeDynamic(e,t)}),this.getCurrentRenderTarget=function(){return g},this.setRenderTarget=function(e){(g=e)&&void 0===Q.get(e).__webglFramebuffer&&$.setupRenderTarget(e);var t,i=e&&e.isWebGLRenderTargetCube;if(e){var r=Q.get(e);t=i?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,y.copy(e.scissor),x=e.scissorTest,b.copy(e.viewport)}else t=null,y.copy(E).multiplyScalar(N),x=T,b.copy(U).multiplyScalar(N);if(v!==t&&(P.bindFramebuffer(P.FRAMEBUFFER,t),v=t),K.scissor(y),K.setScissorTest(x),K.viewport(b),i){var n=Q.get(e.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,n.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,i,r,n,a){if(!1!==(e&&e.isWebGLRenderTarget)){var o=Q.get(e).__webglFramebuffer;if(o){var s=!1;o!==v&&(P.bindFramebuffer(P.FRAMEBUFFER,o),s=!0);try{var c=e.texture,l=c.format,h=c.type;if(l!==nt&&Ne(l)!==P.getParameter(P.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Ke||Ne(h)===P.getParameter(P.IMPLEMENTATION_COLOR_READ_TYPE)||h===et&&(Z.get("OES_texture_float")||Z.get("WEBGL_color_buffer_float"))||h===tt&&Z.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");P.checkFramebufferStatus(P.FRAMEBUFFER)===P.FRAMEBUFFER_COMPLETE?0<=t&&t<=e.width-r&&0<=i&&i<=e.height-n&&P.readPixels(t,i,r,n,Ne(l),Ne(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&P.bindFramebuffer(P.FRAMEBUFFER,v)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function ta(e,t){this.name="",this.color=new zt(e),this.density=void 0!==t?t:25e-5}function ia(e,t,i){this.name="",this.color=new zt(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function ra(){mr.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function na(e,t,i,r,n){mr.call(this),this.lensFlares=[],this.positionScreen=new lt,(this.customUpdateCallback=void 0)!==e&&this.add(e,t,i,r,n)}function aa(e){Li.call(this),this.type="SpriteMaterial",this.color=new zt(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function oa(e){mr.call(this),this.type="Sprite",this.material=void 0!==e?e:new aa}function sa(){mr.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ca(e,t,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new ht,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=A.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new kt(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,nt,et)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,a=this.bones.length;n<a;n++)this.boneInverses.push(new ht)}}function la(){mr.call(this),this.type="Bone"}function ha(e,t,i){dn.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ht,this.bindMatrixInverse=new ht;var r=[];if(this.geometry&&void 0!==this.geometry.bones){for(var n,a,o=0,s=this.geometry.bones.length;o<s;++o)a=this.geometry.bones[o],n=new la,r.push(n),n.name=a.name,n.position.fromArray(a.pos),n.quaternion.fromArray(a.rotq),void 0!==a.scl&&n.scale.fromArray(a.scl);for(o=0,s=this.geometry.bones.length;o<s;++o)-1!==(a=this.geometry.bones[o]).parent&&null!==a.parent&&void 0!==r[a.parent]?r[a.parent].add(r[o]):this.add(r[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new ca(r,void 0,i),this.matrixWorld)}function ua(e){Li.call(this),this.type="LineBasicMaterial",this.color=new zt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function pa(e,t,i){if(1===i)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new da(e,t);mr.call(this),this.type="Line",this.geometry=void 0!==e?e:new pn,this.material=void 0!==t?t:new ua({color:16777215*Math.random()})}function da(e,t){pa.call(this,e,t),this.type="LineSegments"}function fa(e){Li.call(this),this.type="PointsMaterial",this.color=new zt(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(e)}function ma(e,t){mr.call(this),this.type="Points",this.geometry=void 0!==e?e:new pn,this.material=void 0!==t?t:new fa({color:16777215*Math.random()})}function ga(){mr.call(this),this.type="Group"}function va(t,e,i,r,n,a,o,s,c){be.call(this,t,e,i,r,n,a,o,s,c),this.generateMipmaps=!1;var l=this;!function e(){requestAnimationFrame(e),t.readyState>=t.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}()}function ya(e,t,i,r,n,a,o,s,c,l,h,u){be.call(this,null,a,o,s,c,l,r,n,h,u),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function xa(e,t,i,r,n,a,o,s,c){be.call(this,e,t,i,r,n,a,o,s,c),this.needsUpdate=!0}function ba(e,t,i,r,n,a,o,s,c,l){if((l=void 0!==l?l:at)!==at&&l!==ot)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&l===at&&(i=Qe),void 0===i&&l===ot&&(i=it),be.call(this,null,r,n,a,o,s,l,i,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:Xe,this.minFilter=void 0!==s?s:Xe,this.flipY=!1,this.generateMipmaps=!1}function wa(e){pn.call(this);var t=[0,0],i={};function r(e,t){return e-t}var n=["a","b","c"];if(e&&e.isGeometry){for(var a=e.vertices,o=e.faces,s=0,c=new Uint32Array(6*o.length),l=0,h=o.length;l<h;l++)for(var u=o[l],p=0;p<3;p++){t[0]=u[n[p]],t[1]=u[n[(p+1)%3]],t.sort(r),void 0===i[_=t.toString()]&&(c[2*s]=t[0],c[2*s+1]=t[1],i[_]=!0,s++)}var d=new Float32Array(2*s*3);for(l=0,h=s;l<h;l++)for(p=0;p<2;p++){var f=a[c[2*l+p]];d[(M=6*l+3*p)+0]=f.x,d[M+1]=f.y,d[M+2]=f.z}this.addAttribute("position",new br(d,3))}else if(e&&e.isBufferGeometry)if(null!==e.index){var m=e.index.array,g=(a=e.attributes.position,e.groups);s=0;0===g.length&&e.addGroup(0,m.length);c=new Uint32Array(2*m.length);for(var v=0,y=g.length;v<y;++v)for(var x=g[v],b=x.start,w=(l=b,b+x.count);l<w;l+=3)for(p=0;p<3;p++){var _;t[0]=m[l+p],t[1]=m[l+(p+1)%3],t.sort(r),void 0===i[_=t.toString()]&&(c[2*s]=t[0],c[2*s+1]=t[1],i[_]=!0,s++)}for(d=new Float32Array(2*s*3),l=0,h=s;l<h;l++)for(p=0;p<2;p++){var M=6*l+3*p,E=c[2*l+p];d[M+0]=a.getX(E),d[M+1]=a.getY(E),d[M+2]=a.getZ(E)}this.addAttribute("position",new br(d,3))}else{var T=(s=(a=e.attributes.position.array).length/3)/3;for(d=new Float32Array(2*s*3),l=0,h=T;l<h;l++)for(p=0;p<3;p++){var S=9*l+3*p;d[(M=18*l+6*p)+0]=a[S],d[M+1]=a[1+S],d[M+2]=a[2+S];E=9*l+(p+1)%3*3;d[M+3]=a[E],d[M+4]=a[E+1],d[M+5]=a[E+2]}this.addAttribute("position",new br(d,3))}}function _a(e,t,i){pn.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:i};var r,n,a,o,s,c=[],l=[],h=t+1;for(r=0;r<=i;r++)for(s=r/i,n=0;n<=t;n++)a=e(o=n/t,s),c.push(a.x,a.y,a.z),l.push(o,s);var u,p,d,f,m=[];for(r=0;r<i;r++)for(n=0;n<t;n++)p=(u=r*h+n)+1,d=(r+1)*h+n+1,f=(r+1)*h+n,m.push(u,p,f),m.push(p,d,f);this.setIndex(new(65535<m.length?Lr:Tr)(m,1)),this.addAttribute("position",new Ar(c,3)),this.addAttribute("uv",new Ar(l,2)),this.computeVertexNormals()}function Ma(e,t,i){un.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:i},this.fromBufferGeometry(new _a(e,t,i)),this.mergeVertices()}function Ea(r,a,e,t){pn.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:r,indices:a,radius:e,detail:t},e=e||1;var h=[],u=[];function o(e,t,i,r){var n,a,o=Math.pow(2,r),s=[];for(n=0;n<=o;n++){s[n]=[];var c=e.clone().lerp(i,n/o),l=t.clone().lerp(i,n/o),h=o-n;for(a=0;a<=h;a++)s[n][a]=0===a&&n===o?c:c.clone().lerp(l,a/h)}for(n=0;n<o;n++)for(a=0;a<2*(o-n)-1;a++){var u=Math.floor(a/2);a%2==0?(p(s[n][u+1]),p(s[n+1][u]),p(s[n][u])):(p(s[n][u+1]),p(s[n+1][u+1]),p(s[n+1][u]))}}function p(e){h.push(e.x,e.y,e.z)}function s(e,t){var i=3*e;t.x=r[0+i],t.y=r[1+i],t.z=r[2+i]}function d(e,t,i,r){r<0&&1===e.x&&(u[t]=e.x-1),0===i.x&&0===i.z&&(u[t]=r/2/Math.PI+.5)}function f(e){return Math.atan2(e.z,-e.x)}!function(e){for(var t=new lt,i=new lt,r=new lt,n=0;n<a.length;n+=3)s(a[n+0],t),s(a[n+1],i),s(a[n+2],r),o(t,i,r,e)}(t=t||0),function(e){for(var t=new lt,i=0;i<h.length;i+=3)t.x=h[i+0],t.y=h[i+1],t.z=h[i+2],t.normalize().multiplyScalar(e),h[i+0]=t.x,h[i+1]=t.y,h[i+2]=t.z}(e),function(){for(var e=new lt,t=0;t<h.length;t+=3){e.x=h[t+0],e.y=h[t+1],e.z=h[t+2];var i=f(e)/2/Math.PI+.5,r=(n=e,Math.atan2(-n.y,Math.sqrt(n.x*n.x+n.z*n.z))/Math.PI+.5);u.push(i,1-r)}var n;(function(){for(var e=new lt,t=new lt,i=new lt,r=new lt,n=new fe,a=new fe,o=new fe,s=0,c=0;s<h.length;s+=9,c+=6){e.set(h[s+0],h[s+1],h[s+2]),t.set(h[s+3],h[s+4],h[s+5]),i.set(h[s+6],h[s+7],h[s+8]),n.set(u[c+0],u[c+1]),a.set(u[c+2],u[c+3]),o.set(u[c+4],u[c+5]),r.copy(e).add(t).add(i).divideScalar(3);var l=f(r);d(n,c+0,e,l),d(a,c+2,t,l),d(o,c+4,i,l)}})(),function(){for(var e=0;e<u.length;e+=6){var t=u[e+0],i=u[e+2],r=u[e+4],n=Math.max(t,i,r),a=Math.min(t,i,r);.9<n&&a<.1&&(t<.2&&(u[e+0]+=1),i<.2&&(u[e+2]+=1),r<.2&&(u[e+4]+=1))}}()}(),this.addAttribute("position",new Ar(h,3)),this.addAttribute("normal",new Ar(h.slice(),3)),this.addAttribute("uv",new Ar(u,2)),this.normalizeNormals(),this.boundingSphere=new Ci(new lt,e)}function Ta(e,t){Ea.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Sa(e,t){un.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ta(e,t)),this.mergeVertices()}function La(e,t){Ea.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Aa(e,t){un.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new La(e,t)),this.mergeVertices()}function Ra(e,t){var i=(1+Math.sqrt(5))/2;Ea.call(this,[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Pa(e,t){un.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ra(e,t)),this.mergeVertices()}function Ca(e,t){var i=(1+Math.sqrt(5))/2,r=1/i;Ea.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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ia(e,t){un.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ca(e,t)),this.mergeVertices()}function Oa(e,t,i,r){un.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r},this.fromBufferGeometry(new Ea(e,t,i,r)),this.mergeVertices()}function Da(s,c,l,h,e){pn.call(this),this.type="TubeBufferGeometry",this.parameters={path:s,tubularSegments:c,radius:l,radialSegments:h,closed:e},c=c||64,l=l||1,h=h||8,e=e||!1;var u=s.computeFrenetFrames(c,e);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var n,p,d=new lt,f=new lt,t=new fe,m=[],g=[],i=[],a=[];function r(e){var t=s.getPointAt(e/c),i=u.normals[e],r=u.binormals[e];for(p=0;p<=h;p++){var n=p/h*Math.PI*2,a=Math.sin(n),o=-Math.cos(n);f.x=o*i.x+a*r.x,f.y=o*i.y+a*r.y,f.z=o*i.z+a*r.z,f.normalize(),g.push(f.x,f.y,f.z),d.x=t.x+l*f.x,d.y=t.y+l*f.y,d.z=t.z+l*f.z,m.push(d.x,d.y,d.z)}}!function(){for(n=0;n<c;n++)r(n);r(!1===e?c:0),function(){for(n=0;n<=c;n++)for(p=0;p<=h;p++)t.x=n/c,t.y=p/h,i.push(t.x,t.y)}(),function(){for(p=1;p<=c;p++)for(n=1;n<=h;n++){var e=(h+1)*(p-1)+(n-1),t=(h+1)*p+(n-1),i=(h+1)*p+n,r=(h+1)*(p-1)+n;a.push(e,t,r),a.push(t,i,r)}}()}(),this.setIndex(new(65535<a.length?Lr:Tr)(a,1)),this.addAttribute("position",new Ar(m,3)),this.addAttribute("normal",new Ar(g,3)),this.addAttribute("uv",new Ar(i,2))}function Na(e,t,i,r,n,a){un.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:n},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Da(e,t,i,r,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Ua(e,t,i,r,n,a){pn.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:n,q:a},e=e||100,t=t||40,i=Math.floor(i)||64,n=n||2,a=a||3;var o,s,c=((r=Math.floor(r)||8)+1)*(i+1),l=r*i*2*3,h=new br(new(65535<l?Uint32Array:Uint16Array)(l),1),u=new br(new Float32Array(3*c),3),p=new br(new Float32Array(3*c),3),d=new br(new Float32Array(2*c),2),f=0,m=0,g=new lt,v=new lt,y=new fe,x=new lt,b=new lt,w=new lt,_=new lt,M=new lt;for(o=0;o<=i;++o){var E=o/i*n*Math.PI*2;for(I(E,n,a,e,x),I(.01+E,n,a,e,b),_.subVectors(b,x),M.addVectors(b,x),w.crossVectors(_,M),M.crossVectors(w,_),w.normalize(),M.normalize(),s=0;s<=r;++s){var T=s/r*Math.PI*2,S=-t*Math.cos(T),L=t*Math.sin(T);g.x=x.x+(S*M.x+L*w.x),g.y=x.y+(S*M.y+L*w.y),g.z=x.z+(S*M.z+L*w.z),u.setXYZ(f,g.x,g.y,g.z),v.subVectors(g,x).normalize(),p.setXYZ(f,v.x,v.y,v.z),y.x=o/i,y.y=s/r,d.setXY(f,y.x,y.y),f++}}for(s=1;s<=i;s++)for(o=1;o<=r;o++){var A=(r+1)*(s-1)+(o-1),R=(r+1)*s+(o-1),P=(r+1)*s+o,C=(r+1)*(s-1)+o;h.setX(m,A),m++,h.setX(m,R),m++,h.setX(m,C),m++,h.setX(m,R),m++,h.setX(m,P),m++,h.setX(m,C),m++}function I(e,t,i,r,n){var a=Math.cos(e),o=Math.sin(e),s=i/t*e,c=Math.cos(s);n.x=r*(2+c)*.5*a,n.y=r*(2+c)*o*.5,n.z=r*Math.sin(s)*.5}this.setIndex(h),this.addAttribute("position",u),this.addAttribute("normal",p),this.addAttribute("uv",d)}function Fa(e,t,i,r,n,a,o){un.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:n,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ua(e,t,i,r,n,a)),this.mergeVertices()}function Ba(e,t,i,r,n){pn.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:n},e=e||100,t=t||40,i=Math.floor(i)||8,r=Math.floor(r)||6,n=n||2*Math.PI;var a,o,s=(i+1)*(r+1),c=i*r*2*3,l=new(65535<c?Uint32Array:Uint16Array)(c),h=new Float32Array(3*s),u=new Float32Array(3*s),p=new Float32Array(2*s),d=0,f=0,m=0,g=new lt,v=new lt,y=new lt;for(a=0;a<=i;a++)for(o=0;o<=r;o++){var x=o/r*n,b=a/i*Math.PI*2;v.x=(e+t*Math.cos(b))*Math.cos(x),v.y=(e+t*Math.cos(b))*Math.sin(x),v.z=t*Math.sin(b),h[d]=v.x,h[d+1]=v.y,h[d+2]=v.z,g.x=e*Math.cos(x),g.y=e*Math.sin(x),y.subVectors(v,g).normalize(),u[d]=y.x,u[d+1]=y.y,u[d+2]=y.z,p[f]=o/r,p[f+1]=a/i,d+=3,f+=2}for(a=1;a<=i;a++)for(o=1;o<=r;o++){var w=(r+1)*a+o-1,_=(r+1)*(a-1)+o-1,M=(r+1)*(a-1)+o,E=(r+1)*a+o;l[m]=w,l[m+1]=_,l[m+2]=E,l[m+3]=_,l[m+4]=M,l[m+5]=E,m+=6}this.setIndex(new br(l,1)),this.addAttribute("position",new br(h,3)),this.addAttribute("normal",new br(u,3)),this.addAttribute("uv",new br(p,2))}function za(e,t,i,r,n){un.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:n},this.fromBufferGeometry(new Ba(e,t,i,r,n))}ta.prototype.isFogExp2=!0,ta.prototype.clone=function(){return new ta(this.color.getHex(),this.density)},ta.prototype.toJSON=function(e){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},ia.prototype.isFog=!0,ia.prototype.clone=function(){return new ia(this.color.getHex(),this.near,this.far)},ia.prototype.toJSON=function(e){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},((ra.prototype=Object.create(mr.prototype)).constructor=ra).prototype.copy=function(e,t){return mr.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},ra.prototype.toJSON=function(e){var t=mr.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},na.prototype=Object.assign(Object.create(mr.prototype),{constructor:na,isLensFlare:!0,copy:function(e){mr.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,i=e.lensFlares.length;t<i;t++)this.lensFlares.push(e.lensFlares[t]);return this},add:function(e,t,i,r,n,a){void 0===t&&(t=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===n&&(n=new zt(16777215)),void 0===r&&(r=W),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:e,size:t,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:n,blending:r})},updateLensFlares:function(){var e,t,i=this.lensFlares.length,r=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;e<i;e++)(t=this.lensFlares[e]).x=this.positionScreen.x+r*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)}}),((aa.prototype=Object.create(Li.prototype)).constructor=aa).prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this},oa.prototype=Object.assign(Object.create(mr.prototype),{constructor:oa,isSprite:!0,raycast:(Sn=new lt,function(e,t){Sn.setFromMatrixPosition(this.matrixWorld);var i=e.ray.distanceSqToPoint(Sn);this.scale.x*this.scale.y/4<i||t.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}),clone:function(){return new this.constructor(this.material).copy(this)}}),sa.prototype=Object.assign(Object.create(mr.prototype),{constructor:sa,copy:function(e){mr.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,r=t.length;i<r;i++){var n=t[i];this.addLevel(n.object.clone(),n.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=this.levels,r=0;r<i.length&&!(t<i[r].distance);r++);i.splice(r,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,i=1,r=t.length;i<r&&!(e<t[i].distance);i++);return t[i-1].object},raycast:(Rn=new lt,function(e,t){Rn.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(Rn);this.getObjectForDistance(i).raycast(e,t)}),update:(Ln=new lt,An=new lt,function(e){var t=this.levels;if(1<t.length){Ln.setFromMatrixPosition(e.matrixWorld),An.setFromMatrixPosition(this.matrixWorld);var i=Ln.distanceTo(An);t[0].object.visible=!0;for(var r=1,n=t.length;r<n&&i>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(;r<n;r++)t[r].object.visible=!1}}),toJSON:function(e){var t=mr.prototype.toJSON.call(this,e);t.object.levels=[];for(var i=this.levels,r=0,n=i.length;r<n;r++){var a=i[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Object.assign(ca.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var i=new ht;this.bones[e]&&i.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(i)}},pose:function(){for(var e,t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:(Pn=new ht,function(){for(var e=0,t=this.bones.length;e<t;e++){var i=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;Pn.multiplyMatrices(i,this.boneInverses[e]),Pn.toArray(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}),clone:function(){return new ca(this.bones,this.boneInverses,this.useVertexTexture)}}),la.prototype=Object.assign(Object.create(mr.prototype),{constructor:la,isBone:!0}),ha.prototype=Object.assign(Object.create(dn.prototype),{constructor:ha,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e];(n=1/t.lengthManhattan())!==1/0?t.multiplyScalar(n):t.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var i=new ct,r=this.geometry.attributes.skinWeight;for(e=0;e<r.count;e++){var n;i.x=r.getX(e),i.y=r.getY(e),i.z=r.getZ(e),i.w=r.getW(e),(n=1/i.lengthManhattan())!==1/0?i.multiplyScalar(n):i.set(1,0,0,0),r.setXYZW(e,i.x,i.y,i.z,i.w)}}},updateMatrixWorld:function(){dn.prototype.updateMatrixWorld.call(this,!0),"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,this.skeleton.useVertexTexture).copy(this)}}),((ua.prototype=Object.create(Li.prototype)).constructor=ua).prototype.isLineBasicMaterial=!0,ua.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},pa.prototype=Object.assign(Object.create(mr.prototype),{constructor:pa,isLine:!0,raycast:(Cn=new ht,In=new Ui,On=new Ci,function(e,t){var i=e.linePrecision,r=i*i,n=this.geometry,a=this.matrixWorld;if(null===n.boundingSphere&&n.computeBoundingSphere(),On.copy(n.boundingSphere),On.applyMatrix4(a),!1!==e.ray.intersectsSphere(On)){Cn.getInverse(a),In.copy(e.ray).applyMatrix4(Cn);var o=new lt,s=new lt,c=new lt,l=new lt,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var u=n.index,p=n.attributes.position.array;if(null!==u)for(var d=u.array,f=0,m=d.length-1;f<m;f+=h){var g=d[f],v=d[f+1];o.fromArray(p,3*g),s.fromArray(p,3*v),r<In.distanceSqToSegment(o,s,l,c)||(l.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(l))<e.near||b>e.far||t.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+=h)o.fromArray(p,3*f),s.fromArray(p,3*f+3),r<In.distanceSqToSegment(o,s,l,c)||(l.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(l))<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else if(n.isGeometry){var y=n.vertices,x=y.length;for(f=0;f<x-1;f+=h){var b;r<In.distanceSqToSegment(y[f],y[f+1],l,c)||(l.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(l))<e.near||b>e.far||t.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)}}),da.prototype=Object.assign(Object.create(pa.prototype),{constructor:da,isLineSegments:!0}),((fa.prototype=Object.create(Li.prototype)).constructor=fa).prototype.isPointsMaterial=!0,fa.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},ma.prototype=Object.assign(Object.create(mr.prototype),{constructor:ma,isPoints:!0,raycast:(Dn=new ht,Nn=new Ui,Un=new Ci,function(a,o){var s=this,e=this.geometry,c=this.matrixWorld,t=a.params.Points.threshold;if(null===e.boundingSphere&&e.computeBoundingSphere(),Un.copy(e.boundingSphere),Un.applyMatrix4(c),!1!==a.ray.intersectsSphere(Un)){Dn.getInverse(c),Nn.copy(a.ray).applyMatrix4(Dn);var i=t/((this.scale.x+this.scale.y+this.scale.z)/3),l=i*i,r=new lt;if(e.isBufferGeometry){var n=e.index,h=e.attributes.position.array;if(null!==n)for(var u=n.array,p=0,d=u.length;p<d;p++){var f=u[p];r.fromArray(h,3*f),v(r,f)}else{p=0;for(var m=h.length/3;p<m;p++)r.fromArray(h,3*p),v(r,p)}}else{var g=e.vertices;for(p=0,m=g.length;p<m;p++)v(g[p],p)}}function v(e,t){var i=Nn.distanceSqToPoint(e);if(i<l){var r=Nn.closestPointToPoint(e);r.applyMatrix4(c);var n=a.ray.origin.distanceTo(r);if(n<a.near||n>a.far)return;o.push({distance:n,distanceToRay:Math.sqrt(i),point:r.clone(),index:t,face:null,object:s})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ga.prototype=Object.assign(Object.create(mr.prototype),{constructor:ga}),(va.prototype=Object.create(be.prototype)).constructor=va,((ya.prototype=Object.create(be.prototype)).constructor=ya).prototype.isCompressedTexture=!0,(xa.prototype=Object.create(be.prototype)).constructor=xa,((ba.prototype=Object.create(be.prototype)).constructor=ba).prototype.isDepthTexture=!0,(wa.prototype=Object.create(pn.prototype)).constructor=wa,(_a.prototype=Object.create(pn.prototype)).constructor=_a,(Ma.prototype=Object.create(un.prototype)).constructor=Ma,(Ea.prototype=Object.create(pn.prototype)).constructor=Ea,(Ta.prototype=Object.create(Ea.prototype)).constructor=Ta,(Sa.prototype=Object.create(un.prototype)).constructor=Sa,(La.prototype=Object.create(Ea.prototype)).constructor=La,(Aa.prototype=Object.create(un.prototype)).constructor=Aa,(Ra.prototype=Object.create(Ea.prototype)).constructor=Ra,(Pa.prototype=Object.create(un.prototype)).constructor=Pa,(Ca.prototype=Object.create(Ea.prototype)).constructor=Ca,(Ia.prototype=Object.create(un.prototype)).constructor=Ia,(Oa.prototype=Object.create(un.prototype)).constructor=Oa,(Da.prototype=Object.create(pn.prototype)).constructor=Da,(Na.prototype=Object.create(un.prototype)).constructor=Na,(Ua.prototype=Object.create(pn.prototype)).constructor=Ua,(Fa.prototype=Object.create(un.prototype)).constructor=Fa,(Ba.prototype=Object.create(pn.prototype)).constructor=Ba,(za.prototype=Object.create(un.prototype)).constructor=za;var Ga={area:function(e){for(var t=e.length,i=0,r=t-1,n=0;n<t;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return.5*i},triangulate:function(e,t){var i=e.length;if(i<3)return null;var r,n,a,o=[],s=[],c=[];if(0<Ga.area(e))for(n=0;n<i;n++)s[n]=n;else for(n=0;n<i;n++)s[n]=i-1-n;var l=i,h=2*l;for(n=l-1;2<l;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),t?c:o;if(l<=(r=n)&&(r=0),l<=(n=r+1)&&(n=0),l<=(a=n+1)&&(a=0),Ha(e,r,n,a,l,s)){var u,p,d,f,m;for(u=s[r],p=s[n],d=s[a],o.push([e[u],e[p],e[d]]),c.push([s[r],s[n],s[a]]),m=(f=n)+1;m<l;f++,m++)s[f]=s[m];h=2*--l}}return t?c:o},triangulateShape:function(e,t){function i(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function T(e,t,i){return e.x!==t.x?e.x<t.x?e.x<=i.x&&i.x<=t.x:t.x<=i.x&&i.x<=e.x:e.y<t.y?e.y<=i.y&&i.y<=t.y:t.y<=i.y&&i.y<=e.y}function E(e,t,i,r,n){var a=t.x-e.x,o=t.y-e.y,s=r.x-i.x,c=r.y-i.y,l=e.x-i.x,h=e.y-i.y,u=o*s-a*c,p=o*l-a*h;if(Math.abs(u)>Number.EPSILON){var d;if(0<u){if(p<0||u<p)return[];if((d=c*l-s*h)<0||u<d)return[]}else{if(0<p||p<u)return[];if(0<(d=c*l-s*h)||d<u)return[]}if(0===d)return!n||0!=p&&p!=u?[e]:[];if(d===u)return!n||0!=p&&p!=u?[t]:[];if(0==p)return[i];if(p==u)return[r];var f=d/u;return[{x:e.x+f*a,y:e.y+f*o}]}if(0!=p||c*l!=s*h)return[];var m,g,v,y,x,b,w,_,M=0==a&&0==o,E=0==s&&0==c;return M&&E?e.x!==i.x||e.y!==i.y?[]:[e]:M?T(i,r,e)?[e]:[]:E?T(e,t,i)?[i]:[]:(_=0!=a?(y=e.x<t.x?(v=(m=e).x,(g=t).x):(v=(m=t).x,(g=e).x),i.x<r.x?(w=(x=i).x,(b=r).x):(w=(x=r).x,(b=i).x)):(y=e.y<t.y?(v=(m=e).y,(g=t).y):(v=(m=t).y,(g=e).y),i.y<r.y?(w=(x=i).y,(b=r).y):(w=(x=r).y,(b=i).y)),v<=w?y<w?[]:y===w?n?[]:[x]:y<=_?[x,g]:[x,b]:_<v?[]:v===_?n?[]:[m]:y<=_?[m,g]:[m,b])}function S(e,t,i,r){var n=t.x-e.x,a=t.y-e.y,o=i.x-e.x,s=i.y-e.y,c=r.x-e.x,l=r.y-e.y,h=n*s-a*o,u=n*l-a*c;if(Math.abs(h)>Number.EPSILON){var p=c*s-l*o;return 0<h?0<=u&&0<=p:0<=u||0<=p}return 0<u}i(e),t.forEach(i);for(var r,n,a,o,s,c,l={},h=e.concat(),u=0,p=t.length;u<p;u++)Array.prototype.push.apply(h,t[u]);for(r=0,n=h.length;r<n;r++)void 0!==l[s=h[r].x+":"+h[r].y]&&console.warn("THREE.ShapeUtils: Duplicate point",s,r),l[s]=r;var d=function(e,o){var l,h=e.concat();function t(e,t){var i=h.length-1,r=e-1;r<0&&(r=i);var n=e+1;i<n&&(n=0);var a=S(h[e],h[r],h[n],l[t]);if(!a)return!1;var o=l.length-1,s=t-1;s<0&&(s=o);var c=t+1;return o<c&&(c=0),!!(a=S(l[t],l[s],l[c],h[e]))}function i(e,t){var i,r;for(i=0;i<h.length;i++)if(r=i+1,r%=h.length,0<E(e,t,h[i],h[r],!0).length)return!0;return!1}var s=[];function r(e,t){var i,r,n,a;for(i=0;i<s.length;i++)for(r=o[s[i]],n=0;n<r.length;n++)if(a=n+1,a%=r.length,0<E(e,t,r[n],r[a],!0).length)return!0;return!1}for(var n,a,c,u,p,d,f,m,g,v,y=[],x=0,b=o.length;x<b;x++)s.push(x);for(var w=0,_=2*s.length;0<s.length;){if(--_<0){console.log("Infinite Loop! Holes left:"+s.length+", Probably Hole outside Shape!");break}for(a=w;a<h.length;a++){c=h[a],n=-1;for(x=0;x<s.length;x++)if(p=s[x],void 0===y[d=c.x+":"+c.y+":"+p]){l=o[p];for(var M=0;M<l.length;M++)if(u=l[M],t(a,M)&&!i(c,u)&&!r(c,u)){n=M,s.splice(x,1),f=h.slice(0,a+1),m=h.slice(a),g=l.slice(n),v=l.slice(0,n+1),h=f.concat(g).concat(v).concat(m),w=a;break}if(0<=n)break;y[d]=!0}if(0<=n)break}}return h}(e,t),f=Ga.triangulate(d,!1);for(r=0,n=f.length;r<n;r++)for(o=f[r],a=0;a<3;a++)void 0!==(c=l[s=o[a].x+":"+o[a].y])&&(o[a]=c);return f.concat()},isClockWise:function(e){return Ga.area(e)<0},b2:function(e,t,i,r){return(o=1-e)*o*t+2*(1-(a=e))*a*i+(n=e)*n*r;var n,a,o},b3:function(e,t,i,r,n){return(l=1-e)*l*l*t+3*(c=1-(s=e))*c*s*i+3*(1-(o=e))*o*o*r+(a=e)*a*a*n;var a,o,s,c,l}};function Ha(e,t,i,r,n,a){var o,s,c,l,h,u,p,d,f,m,g,v,y,x,b,w,_;if(s=e[a[t]].x,c=e[a[t]].y,l=e[a[i]].x,h=e[a[i]].y,u=e[a[r]].x,(l-s)*((p=e[a[r]].y)-c)-(h-c)*(u-s)<=0)return!1;for(m=u-l,g=p-h,v=s-u,y=c-p,x=l-s,b=h-c,o=0;o<n;o++)if(d=e[a[o]].x,f=e[a[o]].y,!(d===s&&f===c||d===l&&f===h||d===u&&f===p)&&(w=x*(f-c)-b*(d-s),_=v*(f-p)-y*(d-u),m*(f-h)-g*(d-l)>=-Number.EPSILON&&_>=-Number.EPSILON&&w>=-Number.EPSILON))return!1;return!0}function ka(e,t){void 0!==e?(un.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),this.computeFaceNormals()):e=[]}function Va(e,t){var i=(t=t||{}).font;if(!1===(i&&i.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new un;var r=i.generateShapes(e,t.size,t.curveSegments);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),ka.call(this,r,t),this.type="TextGeometry"}function ja(e,t,i,r,n,a,o){pn.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:a,thetaLength:o},e=e||50,t=Math.max(3,Math.floor(t)||8),i=Math.max(2,Math.floor(i)||6),r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;for(var s=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),c=(t+1)*(i+1),l=new br(new Float32Array(3*c),3),h=new br(new Float32Array(3*c),3),u=new br(new Float32Array(2*c),2),p=0,d=[],f=new lt,m=0;m<=i;m++){for(var g=[],v=m/i,y=0;y<=t;y++){var x=y/t,b=-e*Math.cos(r+x*n)*Math.sin(a+v*o),w=e*Math.cos(a+v*o),_=e*Math.sin(r+x*n)*Math.sin(a+v*o);f.set(b,w,_).normalize(),l.setXYZ(p,b,w,_),h.setXYZ(p,f.x,f.y,f.z),u.setXY(p,x,1-v),g.push(p),p++}d.push(g)}var M=[];for(m=0;m<i;m++)for(y=0;y<t;y++){var E=d[m][y+1],T=d[m][y],S=d[m+1][y],L=d[m+1][y+1];(0!==m||0<a)&&M.push(E,T,L),(m!==i-1||s<Math.PI)&&M.push(T,S,L)}this.setIndex(new(65535<l.count?Lr:Tr)(M,1)),this.addAttribute("position",l),this.addAttribute("normal",h),this.addAttribute("uv",u),this.boundingSphere=new Ci(new lt,e)}function Wa(e,t,i,r,n,a,o){un.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new ja(e,t,i,r,n,a,o))}function Xa(e,t,i,r,n,a){pn.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:n,thetaLength:a},e=e||20,t=t||50,n=void 0!==n?n:0,a=void 0!==a?a:2*Math.PI;var o,s,c,l=((i=void 0!==i?Math.max(3,i):8)+1)*((r=void 0!==r?Math.max(1,r):1)+1),h=i*r*2*3,u=new br(new(65535<h?Uint32Array:Uint16Array)(h),1),p=new br(new Float32Array(3*l),3),d=new br(new Float32Array(3*l),3),f=new br(new Float32Array(2*l),2),m=0,g=0,v=e,y=(t-e)/r,x=new lt,b=new fe;for(s=0;s<=r;s++){for(c=0;c<=i;c++)o=n+c/i*a,x.x=v*Math.cos(o),x.y=v*Math.sin(o),p.setXYZ(m,x.x,x.y,x.z),d.setXYZ(m,0,0,1),b.x=(x.x/t+1)/2,b.y=(x.y/t+1)/2,f.setXY(m,b.x,b.y),m++;v+=y}for(s=0;s<r;s++){var w=s*(i+1);for(c=0;c<i;c++){var _=o=c+w,M=o+i+1,E=o+i+2,T=o+1;u.setX(g,_),g++,u.setX(g,M),g++,u.setX(g,E),g++,u.setX(g,_),g++,u.setX(g,E),g++,u.setX(g,T),g++}}this.setIndex(u),this.addAttribute("position",p),this.addAttribute("normal",d),this.addAttribute("uv",f)}function qa(e,t,i,r,n,a){un.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:n,thetaLength:a},this.fromBufferGeometry(new Xa(e,t,i,r,n,a))}function Ya(e,t,i,r){un.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r},this.fromBufferGeometry(new yn(e,t,i,r))}function Za(e,t,i,r){pn.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t)||12,i=i||0,r=r||2*Math.PI,r=A.clamp(r,0,2*Math.PI);var n,a,o,s=(t+1)*e.length,c=t*e.length*2*3,l=new br(new(65535<c?Uint32Array:Uint16Array)(c),1),h=new br(new Float32Array(3*s),3),u=new br(new Float32Array(2*s),2),p=0,d=0,f=1/t,m=new lt,g=new fe;for(a=0;a<=t;a++){var v=i+a*f*r,y=Math.sin(v),x=Math.cos(v);for(o=0;o<=e.length-1;o++)m.x=e[o].x*y,m.y=e[o].y,m.z=e[o].x*x,h.setXYZ(p,m.x,m.y,m.z),g.x=a/t,g.y=o/(e.length-1),u.setXY(p,g.x,g.y),p++}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var b=n=o+a*e.length,w=n+e.length,_=n+e.length+1,M=n+1;l.setX(d,b),d++,l.setX(d,w),d++,l.setX(d,M),d++,l.setX(d,w),d++,l.setX(d,_),d++,l.setX(d,M),d++}if(this.setIndex(l),this.addAttribute("position",h),this.addAttribute("uv",u),this.computeVertexNormals(),r===2*Math.PI){var E=this.attributes.normal.array,T=new lt,S=new lt,L=new lt;for(n=t*e.length*3,o=a=0;a<e.length;a++,o+=3)T.x=E[o+0],T.y=E[o+1],T.z=E[o+2],S.x=E[n+o+0],S.y=E[n+o+1],S.z=E[n+o+2],L.addVectors(T,S).normalize(),E[o+0]=E[n+o+0]=L.x,E[o+1]=E[n+o+1]=L.y,E[o+2]=E[n+o+2]=L.z}}function Ja(e,t,i,r){un.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},this.fromBufferGeometry(new Za(e,t,i,r)),this.mergeVertices()}function Ka(e,f){pn.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:f},f=f||12;var m=[],g=[],v=[],y=[],t=0,x=0;if(!1===Array.isArray(e))r(e);else for(var i=0;i<e.length;i++)r(e[i]),this.addGroup(t,x,i),t+=x,x=0;function r(e){var t,i,r,n=m.length/3,a=e.extractPoints(f),o=a.shape,s=a.holes;if(!1===Ga.isClockWise(o))for(o=o.reverse(),t=0,i=s.length;t<i;t++)r=s[t],!0===Ga.isClockWise(r)&&(s[t]=r.reverse());var c=Ga.triangulateShape(o,s);for(t=0,i=s.length;t<i;t++)r=s[t],o=o.concat(r);for(t=0,i=o.length;t<i;t++){var l=o[t];m.push(l.x,l.y,0),g.push(0,0,1),v.push(l.x,l.y)}for(t=0,i=c.length;t<i;t++){var h=c[t],u=h[0]+n,p=h[1]+n,d=h[2]+n;y.push(u,p,d),x+=3}}this.setIndex(new(65535<y.length?Lr:Tr)(y,1)),this.addAttribute("position",new Ar(m,3)),this.addAttribute("normal",new Ar(g,3)),this.addAttribute("uv",new Ar(v,2))}function Qa(e,t){un.call(this),this.type="ShapeGeometry","object"===(void 0===t?"undefined":_typeof(t))&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Ka(e,t)),this.mergeVertices()}function $a(e,t){pn.call(this),t=void 0!==t?t:1;var i=Math.cos(A.DEG2RAD*t),r=[0,0],n={};function a(e,t){return e-t}var o,s=["a","b","c"];e.isBufferGeometry?(o=new un).fromBufferGeometry(e):o=e.clone(),o.mergeVertices(),o.computeFaceNormals();for(var c=o.vertices,l=o.faces,h=0,u=l.length;h<u;h++)for(var p=l[h],d=0;d<3;d++){r[0]=p[s[d]],r[1]=p[s[(d+1)%3]],r.sort(a),void 0===n[m=r.toString()]?n[m]={vert1:r[0],vert2:r[1],face1:h,face2:void 0}:n[m].face2=h}var f=[];for(var m in n){var g=n[m];if(void 0===g.face2||l[g.face1].normal.dot(l[g.face2].normal)<=i){var v=c[g.vert1];f.push(v.x),f.push(v.y),f.push(v.z),v=c[g.vert2],f.push(v.x),f.push(v.y),f.push(v.z)}}this.addAttribute("position",new Ar(f,3))}function eo(v,y,x,b,w,t,_,M){pn.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:20,y=void 0!==y?y:20,x=void 0!==x?x:100,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 i=0;!1===t&&(0<v&&i++,0<y&&i++);var e=function(){var e=(b+1)*(w+1);!1===t&&(e+=(b+1)*i+b*i);return e}(),r=function(){var e=b*w*2*3;!1===t&&(e+=b*i*3);return e}(),T=new br(new(65535<r?Uint32Array:Uint16Array)(r),1),S=new br(new Float32Array(3*e),3),L=new br(new Float32Array(3*e),3),A=new br(new Float32Array(2*e),2),R=0,P=0,C=[],I=x/2,O=0;function n(e){var t,i,r,n=new fe,a=new lt,o=0,s=!0===e?v:y,c=!0===e?1:-1;for(i=R,t=1;t<=b;t++)S.setXYZ(R,0,I*c,0),L.setXYZ(R,0,c,0),n.x=.5,n.y=.5,A.setXY(R,n.x,n.y),R++;for(r=R,t=0;t<=b;t++){var l=t/b*M+_,h=Math.cos(l),u=Math.sin(l);a.x=s*u,a.y=I*c,a.z=s*h,S.setXYZ(R,a.x,a.y,a.z),L.setXYZ(R,0,c,0),n.x=.5*h+.5,n.y=.5*u*c+.5,A.setXY(R,n.x,n.y),R++}for(t=0;t<b;t++){var p=i+t,d=r+t;!0===e?(T.setX(P,d),P++,T.setX(P,d+1)):(T.setX(P,d+1),P++,T.setX(P,d)),P++,T.setX(P,p),P++,o+=3}E.addGroup(O,o,!0===e?1:2),O+=o}!function(){var e,t,i=new lt,r=new lt,n=0,a=(y-v)/x;for(t=0;t<=w;t++){var o=[],s=t/w,c=s*(y-v)+v;for(e=0;e<=b;e++){var l=e/b,h=l*M+_,u=Math.sin(h),p=Math.cos(h);r.x=c*u,r.y=-s*x+I,r.z=c*p,S.setXYZ(R,r.x,r.y,r.z),i.set(u,a,p).normalize(),L.setXYZ(R,i.x,i.y,i.z),A.setXY(R,l,1-s),o.push(R),R++}C.push(o)}for(e=0;e<b;e++)for(t=0;t<w;t++){var d=C[t][e],f=C[t+1][e],m=C[t+1][e+1],g=C[t][e+1];T.setX(P,d),P++,T.setX(P,f),P++,T.setX(P,g),P++,T.setX(P,f),P++,T.setX(P,m),P++,T.setX(P,g),P++,n+=6}E.addGroup(O,n,0),O+=n}(),!1===t&&(0<v&&n(!0),0<y&&n(!1)),this.setIndex(T),this.addAttribute("position",S),this.addAttribute("normal",L),this.addAttribute("uv",A)}function to(e,t,i,r,n,a,o,s){un.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:n,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new eo(e,t,i,r,n,a,o,s)),this.mergeVertices()}function io(e,t,i,r,n,a,o){to.call(this,0,e,t,i,r,n,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o}}function ro(e,t,i,r,n,a,o){eo.call(this,0,e,t,i,r,n,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o}}function no(e,t,i,r){pn.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},e=e||50,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var n=t+2,a=new Float32Array(3*n),o=new Float32Array(3*n),s=new Float32Array(2*n);o[2]=1,s[0]=.5,s[1]=.5;for(var c=0,l=3,h=2;c<=t;c++,l+=3,h+=2){var u=i+c/t*r;a[l]=e*Math.cos(u),a[l+1]=e*Math.sin(u),o[l+2]=1,s[h]=(a[l]/e+1)/2,s[h+1]=(a[l+1]/e+1)/2}var p=[];for(l=1;l<=t;l++)p.push(l,l+1,0);this.setIndex(new br(new Uint16Array(p),1)),this.addAttribute("position",new br(a,3)),this.addAttribute("normal",new br(o,3)),this.addAttribute("uv",new br(s,2)),this.boundingSphere=new Ci(new lt,e)}function ao(e,t,i,r){un.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},this.fromBufferGeometry(new no(e,t,i,r))}function oo(e,t,i,r,n,a){un.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a},this.fromBufferGeometry(new vn(e,t,i,r,n,a)),this.mergeVertices()}((ka.prototype=Object.create(un.prototype)).constructor=ka).prototype.addShapeList=function(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];this.addShape(n,t)}},ka.prototype.addShape=function(e,t){var i,r,n,a,o,s,c,l,h=void 0!==t.amount?t.amount:100,u=void 0!==t.bevelThickness?t.bevelThickness:6,p=void 0!==t.bevelSize?t.bevelSize:u-2,d=void 0!==t.bevelSegments?t.bevelSegments:3,f=void 0===t.bevelEnabled||t.bevelEnabled,m=void 0!==t.curveSegments?t.curveSegments:12,g=void 0!==t.steps?t.steps:1,v=t.extrudePath,y=!1,x=void 0!==t.UVGenerator?t.UVGenerator:ka.WorldUVGenerator;v&&(i=v.getSpacedPoints(g),f=!(y=!0),r=void 0!==t.frames?t.frames:v.computeFrenetFrames(g,!1),n=new lt,a=new lt,o=new lt),f||(p=u=d=0);var b=this,w=this.vertices.length,_=e.extractPoints(m),M=_.shape,E=_.holes,T=!Ga.isClockWise(M);if(T){for(M=M.reverse(),c=0,l=E.length;c<l;c++)s=E[c],Ga.isClockWise(s)&&(E[c]=s.reverse());T=!1}var S=Ga.triangulateShape(M,E),L=M;for(c=0,l=E.length;c<l;c++)s=E[c],M=M.concat(s);function A(e,t,i){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(i).add(e)}var R,P,C,I,O,D,N=M.length,U=S.length;function F(e,t,i){var r,n,a=1,o=e.x-t.x,s=e.y-t.y,c=i.x-e.x,l=i.y-e.y,h=o*o+s*s,u=o*l-s*c;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(c*c+l*l),f=t.x-s/p,m=t.y+o/p,g=((i.x-l/d-f)*l-(i.y+c/d-m)*c)/(o*l-s*c),v=(r=f+o*g-e.x)*r+(n=m+s*g-e.y)*n;if(v<=2)return new fe(r,n);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(l)&&(y=!0),a=y?(r=-s,n=o,Math.sqrt(h)):(r=o,n=s,Math.sqrt(h/2))}return new fe(r/a,n/a)}for(var B=[],z=0,G=L.length,H=G-1,k=z+1;z<G;z++,H++,k++)H===G&&(H=0),k===G&&(k=0),B[z]=F(L[z],L[H],L[k]);var V,j,W=[],X=B.concat();for(c=0,l=E.length;c<l;c++){for(s=E[c],V=[],z=0,H=(G=s.length)-1,k=z+1;z<G;z++,H++,k++)H===G&&(H=0),k===G&&(k=0),V[z]=F(s[z],s[H],s[k]);W.push(V),X=X.concat(V)}for(R=0;R<d;R++){for(C=R/d,I=u*Math.cos(C*Math.PI/2),P=p*Math.sin(C*Math.PI/2),z=0,G=L.length;z<G;z++)Y((O=A(L[z],B[z],P)).x,O.y,-I);for(c=0,l=E.length;c<l;c++)for(s=E[c],V=W[c],z=0,G=s.length;z<G;z++)Y((O=A(s[z],V[z],P)).x,O.y,-I)}for(P=p,z=0;z<N;z++)O=f?A(M[z],X[z],P):M[z],y?(a.copy(r.normals[0]).multiplyScalar(O.x),n.copy(r.binormals[0]).multiplyScalar(O.y),o.copy(i[0]).add(a).add(n),Y(o.x,o.y,o.z)):Y(O.x,O.y,0);for(j=1;j<=g;j++)for(z=0;z<N;z++)O=f?A(M[z],X[z],P):M[z],y?(a.copy(r.normals[j]).multiplyScalar(O.x),n.copy(r.binormals[j]).multiplyScalar(O.y),o.copy(i[j]).add(a).add(n),Y(o.x,o.y,o.z)):Y(O.x,O.y,h/g*j);for(R=d-1;0<=R;R--){for(C=R/d,I=u*Math.cos(C*Math.PI/2),P=p*Math.sin(C*Math.PI/2),z=0,G=L.length;z<G;z++)Y((O=A(L[z],B[z],P)).x,O.y,h+I);for(c=0,l=E.length;c<l;c++)for(s=E[c],V=W[c],z=0,G=s.length;z<G;z++)O=A(s[z],V[z],P),y?Y(O.x,O.y+i[g-1].y,i[g-1].x+I):Y(O.x,O.y,h+I)}function q(e,t){var i,r;for(z=e.length;0<=--z;){(r=(i=z)-1)<0&&(r=e.length-1);var n=0,a=g+2*d;for(n=0;n<a;n++){var o=N*n,s=N*(n+1);J(t+i+o,t+r+o,t+r+s,t+i+s,e,n,a,i,r)}}}function Y(e,t,i){b.vertices.push(new lt(e,t,i))}function Z(e,t,i){e+=w,t+=w,i+=w,b.faces.push(new yr(e,t,i,null,null,0));var r=x.generateTopUV(b,e,t,i);b.faceVertexUvs[0].push(r)}function J(e,t,i,r){e+=w,t+=w,i+=w,r+=w,b.faces.push(new yr(e,t,r,null,null,1)),b.faces.push(new yr(t,i,r,null,null,1));var n=x.generateSideWallUV(b,e,t,i,r);b.faceVertexUvs[0].push([n[0],n[1],n[3]]),b.faceVertexUvs[0].push([n[1],n[2],n[3]])}!function(){if(f){var e=0,t=N*e;for(z=0;z<U;z++)Z((D=S[z])[2]+t,D[1]+t,D[0]+t);for(t=N*(e=g+2*d),z=0;z<U;z++)Z((D=S[z])[0]+t,D[1]+t,D[2]+t)}else{for(z=0;z<U;z++)Z((D=S[z])[2],D[1],D[0]);for(z=0;z<U;z++)Z((D=S[z])[0]+N*g,D[1]+N*g,D[2]+N*g)}}(),function(){var e=0;for(q(L,e),e+=L.length,c=0,l=E.length;c<l;c++)q(s=E[c],e),e+=s.length}()},ka.WorldUVGenerator={generateTopUV:function(e,t,i,r){var n=e.vertices,a=n[t],o=n[i],s=n[r];return[new fe(a.x,a.y),new fe(o.x,o.y),new fe(s.x,s.y)]},generateSideWallUV:function(e,t,i,r,n){var a=e.vertices,o=a[t],s=a[i],c=a[r],l=a[n];return Math.abs(o.y-s.y)<.01?[new fe(o.x,1-o.z),new fe(s.x,1-s.z),new fe(c.x,1-c.z),new fe(l.x,1-l.z)]:[new fe(o.y,1-o.z),new fe(s.y,1-s.z),new fe(c.y,1-c.z),new fe(l.y,1-l.z)]}},(Va.prototype=Object.create(ka.prototype)).constructor=Va,(ja.prototype=Object.create(pn.prototype)).constructor=ja,(Wa.prototype=Object.create(un.prototype)).constructor=Wa,(Xa.prototype=Object.create(pn.prototype)).constructor=Xa,(qa.prototype=Object.create(un.prototype)).constructor=qa,(Ya.prototype=Object.create(un.prototype)).constructor=Ya,(Za.prototype=Object.create(pn.prototype)).constructor=Za,(Ja.prototype=Object.create(un.prototype)).constructor=Ja,(Ka.prototype=Object.create(pn.prototype)).constructor=Ka,(Qa.prototype=Object.create(un.prototype)).constructor=Qa,($a.prototype=Object.create(pn.prototype)).constructor=$a,(eo.prototype=Object.create(pn.prototype)).constructor=eo,(to.prototype=Object.create(un.prototype)).constructor=to,(io.prototype=Object.create(to.prototype)).constructor=io,(ro.prototype=Object.create(eo.prototype)).constructor=ro,(no.prototype=Object.create(pn.prototype)).constructor=no,(ao.prototype=Object.create(un.prototype)).constructor=ao,(oo.prototype=Object.create(un.prototype)).constructor=oo;var so=Object.freeze({WireframeGeometry:wa,ParametricGeometry:Ma,ParametricBufferGeometry:_a,TetrahedronGeometry:Sa,TetrahedronBufferGeometry:Ta,OctahedronGeometry:Aa,OctahedronBufferGeometry:La,IcosahedronGeometry:Pa,IcosahedronBufferGeometry:Ra,DodecahedronGeometry:Ia,DodecahedronBufferGeometry:Ca,PolyhedronGeometry:Oa,PolyhedronBufferGeometry:Ea,TubeGeometry:Na,TubeBufferGeometry:Da,TorusKnotGeometry:Fa,TorusKnotBufferGeometry:Ua,TorusGeometry:za,TorusBufferGeometry:Ba,TextGeometry:Va,SphereBufferGeometry:ja,SphereGeometry:Wa,RingGeometry:qa,RingBufferGeometry:Xa,PlaneBufferGeometry:yn,PlaneGeometry:Ya,LatheGeometry:Ja,LatheBufferGeometry:Za,ShapeGeometry:Qa,ShapeBufferGeometry:Ka,ExtrudeGeometry:ka,EdgesGeometry:$a,ConeGeometry:io,ConeBufferGeometry:ro,CylinderGeometry:to,CylinderBufferGeometry:eo,CircleBufferGeometry:no,CircleGeometry:ao,BoxBufferGeometry:vn,BoxGeometry:oo});function co(){Ai.call(this,{uniforms:Ft.merge([Wt.lights,{opacity:{value:1}}]),vertexShader:Bt.shadow_vert,fragmentShader:Bt.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}}})}function lo(e){Ai.call(this,e),this.type="RawShaderMaterial"}function ho(e){this.uuid=A.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(e)?e:[],this.visible=!0}function uo(e){Li.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new zt(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 zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new fe(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(e)}function po(e){uo.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function fo(e){Li.call(this),this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=F,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(e)}function mo(e){fo.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function go(e){Li.call(this,e),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new fe(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(e)}function vo(e){Li.call(this),this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=F,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(e)}function yo(e){Li.call(this),this.type="LineDashedMaterial",this.color=new zt(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(e)}((co.prototype=Object.create(Ai.prototype)).constructor=co).prototype.isShadowMaterial=!0,lo.prototype=Object.create(Ai.prototype),ho.prototype={constructor:ho,isMultiMaterial:(lo.prototype.constructor=lo).prototype.isRawShaderMaterial=!0,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},i=this.materials,r=0,n=i.length;r<n;r++){var a=i[r].toJSON(e);delete a.metadata,t.materials.push(a)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},((uo.prototype=Object.create(Li.prototype)).constructor=uo).prototype.isMeshStandardMaterial=!0,uo.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((po.prototype=Object.create(uo.prototype)).constructor=po).prototype.isMeshPhysicalMaterial=!0,po.prototype.copy=function(e){return uo.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},((fo.prototype=Object.create(Li.prototype)).constructor=fo).prototype.isMeshPhongMaterial=!0,fo.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((mo.prototype=Object.create(fo.prototype)).constructor=mo).prototype.isMeshToonMaterial=!0,mo.prototype.copy=function(e){return fo.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},((go.prototype=Object.create(Li.prototype)).constructor=go).prototype.isMeshNormalMaterial=!0,go.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((vo.prototype=Object.create(Li.prototype)).constructor=vo).prototype.isMeshLambertMaterial=!0,vo.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((yo.prototype=Object.create(Li.prototype)).constructor=yo).prototype.isLineDashedMaterial=!0,yo.prototype.copy=function(e){return Li.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var xo=Object.freeze({ShadowMaterial:co,SpriteMaterial:aa,RawShaderMaterial:lo,ShaderMaterial:Ai,PointsMaterial:fa,MultiMaterial:ho,MeshPhysicalMaterial:po,MeshStandardMaterial:uo,MeshPhongMaterial:fo,MeshToonMaterial:mo,MeshNormalMaterial:go,MeshLambertMaterial:vo,MeshDepthMaterial:Ri,MeshBasicMaterial:xr,LineDashedMaterial:yo,LineBasicMaterial:ua,Material:Li}),bo={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function wo(e,t,i){var r=this,n=!1,a=0,o=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++,!1===n&&void 0!==r.onStart&&r.onStart(e,a,o),n=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(n=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)}}var _o=new wo;function Mo(e){this.manager=void 0!==e?e:_o}function Eo(e){this.manager=void 0!==e?e:_o,this._parser=null}Object.assign(Mo.prototype,{load:function(i,r,t,n){void 0===i&&(i=""),void 0!==this.path&&(i=this.path+i);var a=this,e=bo.get(i);if(void 0!==e)return a.manager.itemStart(i),setTimeout(function(){r&&r(e),a.manager.itemEnd(i)},0),e;var o=i.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=window.decodeURIComponent(l),c&&(l=window.atob(l));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":h=new ArrayBuffer(l.length);for(var p=new Uint8Array(h),d=0;d<l.length;d++)p[d]=l.charCodeAt(d);"blob"===u&&(h=new Blob([h],{type:s}));break;case"document":var f=new DOMParser;h=f.parseFromString(l,s);break;case"json":h=JSON.parse(l);break;default:h=l}window.setTimeout(function(){r&&r(h),a.manager.itemEnd(i)},0)}catch(e){window.setTimeout(function(){n&&n(e),a.manager.itemError(i)},0)}}else{var m=new XMLHttpRequest;m.open("GET",i,!0),m.addEventListener("load",function(e){var t=e.target.response;bo.add(i,t),200===this.status?(r&&r(t),a.manager.itemEnd(i)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),r&&r(t),a.manager.itemEnd(i)):(n&&n(e),a.manager.itemError(i))},!1),void 0!==t&&m.addEventListener("progress",function(e){t(e)},!1),m.addEventListener("error",function(e){n&&n(e),a.manager.itemError(i)},!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"),m.send(null)}return a.manager.itemStart(i),m},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),Object.assign(Eo.prototype,{load:function(e,a,t,r){var o=this,s=[],c=new ya;c.image=s;var n=new Mo(this.manager);function i(i){n.load(e[i],function(e){var t=o._parser(e,!0);s[i]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(l+=1)&&(1===t.mipmapCount&&(c.minFilter=Ze),c.format=t.format,c.needsUpdate=!0,a&&a(c))},t,r)}if(n.setPath(this.path),n.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,h=0,u=e.length;h<u;++h)i(h);else n.load(e,function(e){var t=o._parser(e,!0);if(t.isCubemap)for(var i=t.mipmaps.length/t.mipmapCount,r=0;r<i;r++){s[r]={mipmaps:[]};for(var n=0;n<t.mipmapCount;n++)s[r].mipmaps.push(t.mipmaps[r*t.mipmapCount+n]),s[r].format=t.format,s[r].width=t.width,s[r].height=t.height}else c.image.width=t.width,c.image.height=t.height,c.mipmaps=t.mipmaps;1===t.mipmapCount&&(c.minFilter=Ze),c.format=t.format,c.needsUpdate=!0,a&&a(c)},t,r);return c},setPath:function(e){return this.path=e,this}});var To=So;function So(e){this.manager=void 0!==e?e:_o,this._parser=null}function Lo(e){this.manager=void 0!==e?e:_o}function Ao(e){this.manager=void 0!==e?e:_o}function Ro(e){this.manager=void 0!==e?e:_o}function Po(e,t){mr.call(this),this.type="Light",this.color=new zt(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Co(e,t,i){Po.call(this,e,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(mr.DefaultUp),this.updateMatrix(),this.groundColor=new zt(t)}function Io(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new fe(512,512),this.map=null,this.matrix=new ht}function Oo(){Io.call(this,new bn(50,1,.5,500))}function Do(e,t,i,r,n,a){Po.call(this,e,t),this.type="SpotLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.target=new mr,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==n?n:0,this.decay=void 0!==a?a:1,this.shadow=new Oo}function No(e,t,i,r){Po.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==r?r:1,this.shadow=new Io(new bn(90,1,.5,500))}function Uo(e){Io.call(this,new wn(-5,5,5,-5,.5,500))}function Fo(e,t){Po.call(this,e,t),this.type="DirectionalLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.target=new mr,this.shadow=new Uo}function Bo(e,t){Po.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}Object.assign(So.prototype,{load:function(e,i,t,r){var n=this,a=new kt,o=new Mo(this.manager);return o.setResponseType("arraybuffer"),o.load(e,function(e){var t=n._parser(e);t&&(void 0!==t.image?a.image=t.image:void 0!==t.data&&(a.image.width=t.width,a.image.height=t.height,a.image.data=t.data),a.wrapS=void 0!==t.wrapS?t.wrapS:We,a.wrapT=void 0!==t.wrapT?t.wrapT:We,a.magFilter=void 0!==t.magFilter?t.magFilter:Ze,a.minFilter=void 0!==t.minFilter?t.minFilter:Je,a.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(a.format=t.format),void 0!==t.type&&(a.type=t.type),void 0!==t.mipmaps&&(a.mipmaps=t.mipmaps),1===t.mipmapCount&&(a.minFilter=Ze),a.needsUpdate=!0,i&&i(a,t))},t,r),a}}),Object.assign(Lo.prototype,{load:function(e,t,i,r){var n=this,a=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(a.onload=function(){a.onload=null,URL.revokeObjectURL(a.src),t&&t(a),n.manager.itemEnd(e)},a.onerror=r,0===e.indexOf("data:"))a.src=e;else if(void 0!==this.crossOrigin)a.crossOrigin=this.crossOrigin,a.src=e;else{var o=new Mo;o.setPath(this.path),o.setResponseType("blob"),o.setWithCredentials(this.withCredentials),/\.svg$/.test(e)&&o.setMimeType("image/svg+xml"),o.load(e,function(e){a.src=URL.createObjectURL(e)},i,r)}return n.manager.itemStart(e),a},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Ao.prototype,{load:function(e,i,t,r){var n=new Ee,a=new Lo(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(t){a.load(e[t],function(e){n.images[t]=e,6===++o&&(n.needsUpdate=!0,i&&i(n))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Ro.prototype,{load:function(i,r,e,t){var n=new be,a=new Lo(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setWithCredentials(this.withCredentials),a.setPath(this.path),a.load(i,function(e){var t=0<i.search(/\.(jpg|jpeg)$/)||0===i.search(/^data\:image\/jpeg/);n.format=t?rt:nt,n.image=e,n.needsUpdate=!0,void 0!==r&&r(n)},e,t),n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this}}),Po.prototype=Object.assign(Object.create(mr.prototype),{constructor:Po,isLight:!0,copy:function(e){return mr.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=mr.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Co.prototype=Object.assign(Object.create(Po.prototype),{constructor:Co,isHemisphereLight:!0,copy:function(e){return Po.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Io.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Oo.prototype=Object.assign(Object.create(Io.prototype),{constructor:Oo,isSpotLightShadow:!0,update:function(e){var t=2*A.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||500,n=this.camera;t===n.fov&&i===n.aspect&&r===n.far||(n.fov=t,n.aspect=i,n.far=r,n.updateProjectionMatrix())}}),Do.prototype=Object.assign(Object.create(Po.prototype),{constructor:Do,isSpotLight:!0,copy:function(e){return Po.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),No.prototype=Object.assign(Object.create(Po.prototype),{constructor:No,isPointLight:!0,copy:function(e){return Po.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Uo.prototype=Object.assign(Object.create(Io.prototype),{constructor:Uo}),Fo.prototype=Object.assign(Object.create(Po.prototype),{constructor:Fo,isDirectionalLight:!0,copy:function(e){return Po.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Bo.prototype=Object.assign(Object.create(Po.prototype),{constructor:Bo,isAmbientLight:!0});var zo,Go,Ho,ko,Vo,jo,Wo={arraySlice:function(e,t,i){return Wo.isTypedArray(e)?new e.constructor(e.subarray(t,i)):e.slice(t,i)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(i){for(var e=i.length,t=new Array(e),r=0;r!==e;++r)t[r]=r;return t.sort(function(e,t){return i[e]-i[t]}),t},sortedArray:function(e,t,i){for(var r=e.length,n=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=i[a]*t,c=0;c!==t;++c)n[o++]=e[s+c];return n},flattenJSON:function(e,t,i,r){for(var n=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[n++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[r])&&(t.push(a.time),i.push.apply(i,o)),void 0!==(a=e[n++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[r])&&(t.push(a.time),o.toArray(i,i.length)),void 0!==(a=e[n++]););else for(;void 0!==(o=a[r])&&(t.push(a.time),i.push(o)),void 0!==(a=e[n++]););}}};function Xo(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i}function qo(e,t,i,r){Xo.call(this,e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Yo(e,t,i,r){Xo.call(this,e,t,i,r)}function Zo(e,t,i,r){Xo.call(this,e,t,i,r)}function Jo(e,t,i,r){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=Wo.convertArray(t,this.TimeBufferType),this.values=Wo.convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Ko(e,t,i,r){Jo.call(this,e,t,i,r)}function Qo(e,t,i,r){Xo.call(this,e,t,i,r)}function $o(e,t,i,r){Jo.call(this,e,t,i,r)}function es(e,t,i,r){Jo.call(this,e,t,i,r)}function ts(e,t,i,r){Jo.call(this,e,t,i,r)}function is(e,t,i){Jo.call(this,e,t,i)}function rs(e,t,i,r){Jo.call(this,e,t,i,r)}function ns(e,t,i,r){Jo.apply(this,arguments)}function as(e,t,i){this.name=e,this.tracks=i,this.duration=void 0!==t?t:-1,this.uuid=A.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function os(e){this.manager=void 0!==e?e:_o,this.textures={}}function ss(e){this.manager=void 0!==e?e:_o}function cs(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function ls(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:_o,this.withCredentials=!1}function hs(e){this.manager=void 0!==e?e:_o,this.texturePath=""}function us(){}function ps(e,t){this.v1=e,this.v2=t}function ds(){this.curves=[],this.autoClose=!1}function fs(e,t,i,r,n,a,o,s){this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}Xo.prototype={constructor:Xo,evaluate:function(e){var t=this.parameterPositions,i=this._cachedIndex,r=t[i],n=t[i-1];e:{t:{var a;i:{r:if(!(e<r)){for(var o=i+2;;){if(void 0===r){if(e<n)break r;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,n)}if(i===o)break;if(n=r,e<(r=t[++i]))break t}a=t.length;break i}if(n<=e)break e;var s=t[1];e<s&&(i=2,n=s);for(o=i-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(i===o)break;if(r=n,(n=t[--i-1])<=e)break t}a=i,i=0}for(;i<a;){var c=i+a>>>1;e<t[c]?a=c:i=1+c}if(r=t[i],void 0===(n=t[i-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,n,e)}this._cachedIndex=i,this.intervalChanged_(i,n,r)}return this.interpolate_(i,n,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r,a=0;a!==r;++a)t[a]=i[n+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}},Object.assign(Xo.prototype,{beforeStart_:Xo.prototype.copySampleValue_,afterEnd_:Xo.prototype.copySampleValue_}),qo.prototype=Object.assign(Object.create(Xo.prototype),{constructor:qo,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,i){var r=this.parameterPositions,n=e-2,a=e+1,o=r[n],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:n=e,o=2*t-i;break;case 2402:o=t+r[n=r.length-2]-r[n+1];break;default:n=e,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*i-t;break;case 2402:s=i+r[a=1]-r[0];break;default:a=e-1,s=t}var c=.5*(i-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-i),this._offsetPrev=n*l,this._offsetNext=a*l},interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-t)/(r-t),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)n[b]=g*a[l+b]+v*a[c+b]+y*a[s+b]+x*a[h+b];return n}}),Yo.prototype=Object.assign(Object.create(Xo.prototype),{constructor:Yo,interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(i-t)/(r-t),h=1-l,u=0;u!==o;++u)n[u]=a[c+u]*h+a[s+u]*l;return n}}),Zo.prototype=Object.assign(Object.create(Xo.prototype),{constructor:Zo,interpolate_:function(e){return this.copySampleValue_(e-1)}}),zo={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new Zo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Yo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new qo(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)this.createInterpolant=t;else{var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}console.warn(i)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]*=e;return this},trim:function(e,t){for(var i=this.times,r=i.length,n=0,a=r-1;n!==r&&i[n]<e;)++n;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==n||a!==r){a<=n&&(n=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Wo.arraySlice(i,n,a),this.values=Wo.arraySlice(this.values,n*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("invalid value size in track",this),e=!1);var i=this.times,r=this.values,n=i.length;0===n&&(console.error("track is empty",this),e=!1);for(var a=null,o=0;o!==n;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,o,s),e=!1;break}if(null!==a&&s<a){console.error("out of order keys",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&Wo.isTypedArray(r)){o=0;for(var c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("value is not a valid number",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),r=2302===this.getInterpolation(),n=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(r)s=!0;else for(var l=o*i,h=l-i,u=l+i,p=0;p!==i;++p){var d=t[l+p];if(d!==t[h+p]||d!==t[u+p]){s=!0;break}}if(s){if(o!==n){e[n]=e[o];var f=o*i,m=n*i;for(p=0;p!==i;++p)t[m+p]=t[f+p]}++n}}if(0<a){e[n]=e[a];for(f=a*i,m=n*i,p=0;p!==i;++p)t[m+p]=t[f+p];++n}return n!==e.length&&(this.times=Wo.arraySlice(e,0,n),this.values=Wo.arraySlice(t,0,n*i)),this}},Ko.prototype=Object.assign(Object.create(zo),{constructor:Ko,ValueTypeName:"vector"}),Qo.prototype=Object.assign(Object.create(Xo.prototype),{constructor:Qo,interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(i-t)/(r-t),l=s+o;s!==l;s+=4)Me.slerpFlat(n,0,a,s-o,a,s,c);return n}}),$o.prototype=Object.assign(Object.create(zo),{constructor:$o,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Qo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),es.prototype=Object.assign(Object.create(zo),{constructor:es,ValueTypeName:"number"}),ts.prototype=Object.assign(Object.create(zo),{constructor:ts,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),is.prototype=Object.assign(Object.create(zo),{constructor:is,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),rs.prototype=Object.assign(Object.create(zo),{constructor:rs,ValueTypeName:"color"}),(ns.prototype=zo).constructor=ns,Object.assign(ns,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=ns._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var i=[],r=[];Wo.flattenJSON(e.keys,i,r,"value"),e.times=i,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,i=e.constructor;if(void 0!==i.toJSON)t=i.toJSON(e);else{t={name:e.name,times:Wo.convertArray(e.times,Array),values:Wo.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return es;case"vector":case"vector2":case"vector3":case"vector4":return Ko;case"color":return rs;case"quaternion":return $o;case"bool":case"boolean":return is;case"string":return ts}throw new Error("Unsupported typeName: "+e)}}),as.prototype={constructor:as,resetDuration:function(){for(var e=0,t=0,i=this.tracks.length;t!==i;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(as,{parse:function(e){for(var t=[],i=e.tracks,r=1/(e.fps||1),n=0,a=i.length;n!==a;++n)t.push(ns.parse(i[n]).scale(r));return new as(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t},n=0,a=i.length;n!==a;++n)t.push(ns.toJSON(i[n]));return r},CreateFromMorphTargetSequence:function(e,t,i,r){for(var n=t.length,a=[],o=0;o<n;o++){var s=[],c=[];s.push((o+n-1)%n,o,(o+1)%n),c.push(0,1,0);var l=Wo.getKeyframeOrder(s);s=Wo.sortedArray(s,1,l),c=Wo.sortedArray(c,1,l),r||0!==s[0]||(s.push(n),c.push(c[0])),a.push(new es(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/i))}return new as(e,-1,a)},findByName:function(e,t){var i=e;if(!Array.isArray(e)){i=e.geometry&&e.geometry.animations||e.animations}for(var r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,i){for(var r={},n=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(n);if(c&&1<c.length){var l=r[u=c[1]];l||(r[u]=l=[]),l.push(s)}}var h=[];for(var u in r)h.push(as.CreateFromMorphTargetSequence(u,r[u],t,i));return h},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var i=function(e,t,i,r,n){if(0!==i.length){var a=[],o=[];Wo.flattenJSON(i,a,o,r),0!==a.length&&n.push(new e(t,a,o))}},r=[],n=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var h={},u=0;u<l.length;u++)if(l[u].morphTargets)for(var p=0;p<l[u].morphTargets.length;p++)h[l[u].morphTargets[p]]=-1;for(var d in h){var f=[],m=[];for(p=0;p!==l[u].morphTargets.length;++p){var g=l[u];f.push(g.time),m.push(g.morphTarget===d?1:0)}r.push(new es(".morphTargetInfluence["+d+"]",f,m))}a=h.length*(o||1)}else{var v=".bones["+t[c].name+"]";i(Ko,v+".position",l,"pos",r),i($o,v+".quaternion",l,"rot",r),i(Ko,v+".scale",l,"scl",r)}}return 0===r.length?null:new as(n,a,r)}}),Object.assign(os.prototype,{load:function(e,t,i,r){var n=this;new Mo(n.manager).load(e,function(e){t(n.parse(JSON.parse(e)))},i,r)},setTextures:function(e){this.textures=e},parse:function(e){var t=this.textures;function i(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var r=new xo[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearCoat&&(r.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(r.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.uniforms&&(r.uniforms=e.uniforms),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(r.vertexColors=e.vertexColors),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.shading&&(r.shading=e.shading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=i(e.map)),void 0!==e.alphaMap&&(r.alphaMap=i(e.alphaMap),r.transparent=!0),void 0!==e.bumpMap&&(r.bumpMap=i(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=i(e.normalMap)),void 0!==e.normalScale){var n=e.normalScale;!1===Array.isArray(n)&&(n=[n,n]),r.normalScale=(new fe).fromArray(n)}if(void 0!==e.displacementMap&&(r.displacementMap=i(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=i(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=i(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=i(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=i(e.specularMap)),void 0!==e.envMap&&(r.envMap=i(e.envMap)),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.lightMap&&(r.lightMap=i(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=i(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=i(e.gradientMap)),void 0!==e.materials)for(var a=0,o=e.materials.length;a<o;a++)r.materials.push(this.parse(e.materials[a]));return r}}),Object.assign(ss.prototype,{load:function(e,t,i,r){var n=this;new Mo(n.manager).load(e,function(e){t(n.parse(JSON.parse(e)))},i,r)},parse:function(e){var t=new pn,i=e.data.index,r={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==i){var n=new r[i.type](i.array);t.setIndex(new br(n,1))}var a=e.data.attributes;for(var o in a){var s=a[o];n=new r[s.type](s.array);t.addAttribute(o,new br(n,s.itemSize,s.normalized))}var c=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==c)for(var l=0,h=c.length;l!==h;++l){var u=c[l];t.addGroup(u.start,u.count,u.materialIndex)}var p=e.data.boundingSphere;if(void 0!==p){var d=new lt;void 0!==p.center&&d.fromArray(p.center),t.boundingSphere=new Ci(d,p.radius)}return t}}),cs.prototype={constructor:cs,crossOrigin:void 0,extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,i){for(var r=[],n=0;n<e.length;++n)r[n]=this.createMaterial(e[n],t,i);return r},createMaterial:(Vo={NoBlending:Ge,NormalBlending:W,AdditiveBlending:X,SubtractiveBlending:q,MultiplyBlending:Z,CustomBlending:J},function(e,l,h){void 0===Go&&(Go=new zt),void 0===Ho&&(Ho=new Ro),void 0===ko&&(ko=new os);var u={};function t(e,t,i,r,n){var a,o=l+e,s=cs.Handlers.get(o);a=null!==s?s.load(o):(Ho.setCrossOrigin(h),Ho.load(o)),void 0!==t&&(a.repeat.fromArray(t),1!==t[0]&&(a.wrapS=1e3),1!==t[1]&&(a.wrapT=1e3)),void 0!==i&&a.offset.fromArray(i),void 0!==r&&("repeat"===r[0]&&(a.wrapS=1e3),"mirror"===r[0]&&(a.wrapS=1002),"repeat"===r[1]&&(a.wrapT=1e3),"mirror"===r[1]&&(a.wrapT=1002)),void 0!==n&&(a.anisotropy=n);var c=A.generateUUID();return u[c]=a,c}var i={uuid:A.generateUUID(),type:"MeshLambertMaterial"};for(var r in e){var n=e[r];switch(r){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":i.name=n;break;case"blending":i.blending=Vo[n];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",r,"is no longer supported.");break;case"colorDiffuse":i.color=Go.fromArray(n).getHex();break;case"colorSpecular":i.specular=Go.fromArray(n).getHex();break;case"colorEmissive":i.emissive=Go.fromArray(n).getHex();break;case"specularCoef":i.shininess=n;break;case"shading":"basic"===n.toLowerCase()&&(i.type="MeshBasicMaterial"),"phong"===n.toLowerCase()&&(i.type="MeshPhongMaterial"),"standard"===n.toLowerCase()&&(i.type="MeshStandardMaterial");break;case"mapDiffuse":i.map=t(n,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":i.emissiveMap=t(n,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":i.lightMap=t(n,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":i.aoMap=t(n,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":i.bumpMap=t(n,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":i.bumpScale=n;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":i.normalMap=t(n,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":i.normalScale=[n,n];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":i.specularMap=t(n,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":i.metalnessMap=t(n,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":i.roughnessMap=t(n,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":i.alphaMap=t(n,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":i.side=Ue;break;case"doubleSided":i.side=Fe;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),i.opacity=n;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":i[r]=n;break;case"vertexColors":!0===n&&(i.vertexColors=2),"face"===n&&(i.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",r,n)}}return"MeshBasicMaterial"===i.type&&delete i.emissive,"MeshPhongMaterial"!==i.type&&delete i.specular,i.opacity<1&&(i.transparent=!0),ko.setTextures(u),ko.parse(i)})},cs.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,i=0,r=t.length;i<r;i+=2){var n=t[i],a=t[i+1];if(n.test(e))return a}return null}},Object.assign(ls.prototype,{load:function(a,o,e,t){var s=this,c=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:cs.prototype.extractUrlBase(a),i=new Mo(this.manager);i.setWithCredentials(this.withCredentials),i.load(a,function(e){var t=JSON.parse(e),i=t.metadata;if(void 0!==i){var r=i.type;if(void 0!==r){if("object"===r.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");if("scene"===r.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.")}}var n=s.parse(t,c);o(n.geometry,n.materials)},e,t)},setTexturePath:function(e){this.texturePath=e},parse:function(D,e){var N=new un,t=void 0!==D.scale?1/D.scale:1;if(!function(e){function t(e,t){return e&1<<t}var i,r,n,a,o,s,c,l,h,u,p,d,f,m,g,v,y,x,b,w,_,M,E,T,S,L,A,R=D.faces,P=D.vertices,C=D.normals,I=D.colors,O=0;if(void 0!==D.uvs){for(i=0;i<D.uvs.length;i++)D.uvs[i].length&&O++;for(i=0;i<O;i++)N.faceVertexUvs[i]=[]}a=0,o=P.length;for(;a<o;)(x=new lt).x=P[a++]*e,x.y=P[a++]*e,x.z=P[a++]*e,N.vertices.push(x);a=0,o=R.length;for(;a<o;)if(u=R[a++],p=t(u,0),d=t(u,1),f=t(u,3),m=t(u,4),g=t(u,5),v=t(u,6),y=t(u,7),p){if((w=new yr).a=R[a],w.b=R[a+1],w.c=R[a+3],(_=new yr).a=R[a+1],_.b=R[a+2],_.c=R[a+3],a+=4,d&&(h=R[a++],w.materialIndex=h,_.materialIndex=h),n=N.faces.length,f)for(i=0;i<O;i++)for(T=D.uvs[i],N.faceVertexUvs[i][n]=[],N.faceVertexUvs[i][n+1]=[],r=0;r<4;r++)l=R[a++],L=T[2*l],A=T[2*l+1],S=new fe(L,A),2!==r&&N.faceVertexUvs[i][n].push(S),0!==r&&N.faceVertexUvs[i][n+1].push(S);if(m&&(c=3*R[a++],w.normal.set(C[c++],C[c++],C[c]),_.normal.copy(w.normal)),g)for(i=0;i<4;i++)c=3*R[a++],E=new lt(C[c++],C[c++],C[c]),2!==i&&w.vertexNormals.push(E),0!==i&&_.vertexNormals.push(E);if(v&&(s=R[a++],M=I[s],w.color.setHex(M),_.color.setHex(M)),y)for(i=0;i<4;i++)s=R[a++],M=I[s],2!==i&&w.vertexColors.push(new zt(M)),0!==i&&_.vertexColors.push(new zt(M));N.faces.push(w),N.faces.push(_)}else{if((b=new yr).a=R[a++],b.b=R[a++],b.c=R[a++],d&&(h=R[a++],b.materialIndex=h),n=N.faces.length,f)for(i=0;i<O;i++)for(T=D.uvs[i],N.faceVertexUvs[i][n]=[],r=0;r<3;r++)l=R[a++],L=T[2*l],A=T[2*l+1],S=new fe(L,A),N.faceVertexUvs[i][n].push(S);if(m&&(c=3*R[a++],b.normal.set(C[c++],C[c++],C[c])),g)for(i=0;i<3;i++)c=3*R[a++],E=new lt(C[c++],C[c++],C[c]),b.vertexNormals.push(E);if(v&&(s=R[a++],b.color.setHex(I[s])),y)for(i=0;i<3;i++)s=R[a++],b.vertexColors.push(new zt(I[s]));N.faces.push(b)}}(t),function(){var e=void 0!==D.influencesPerVertex?D.influencesPerVertex:2;if(D.skinWeights)for(var t=0,i=D.skinWeights.length;t<i;t+=e){var r=D.skinWeights[t],n=1<e?D.skinWeights[t+1]:0,a=2<e?D.skinWeights[t+2]:0,o=3<e?D.skinWeights[t+3]:0;N.skinWeights.push(new ct(r,n,a,o))}if(D.skinIndices)for(t=0,i=D.skinIndices.length;t<i;t+=e){var s=D.skinIndices[t],c=1<e?D.skinIndices[t+1]:0,l=2<e?D.skinIndices[t+2]:0,h=3<e?D.skinIndices[t+3]:0;N.skinIndices.push(new ct(s,c,l,h))}N.bones=D.bones,N.bones&&0<N.bones.length&&(N.skinWeights.length!==N.skinIndices.length||N.skinIndices.length!==N.vertices.length)&&console.warn("When skinning, number of vertices ("+N.vertices.length+"), skinIndices ("+N.skinIndices.length+"), and skinWeights ("+N.skinWeights.length+") should match.")}(),function(e){if(void 0!==D.morphTargets)for(var t=0,i=D.morphTargets.length;t<i;t++){N.morphTargets[t]={},N.morphTargets[t].name=D.morphTargets[t].name,N.morphTargets[t].vertices=[];for(var r=N.morphTargets[t].vertices,n=D.morphTargets[t].vertices,a=0,o=n.length;a<o;a+=3){var s=new lt;s.x=n[a]*e,s.y=n[a+1]*e,s.z=n[a+2]*e,r.push(s)}}if(void 0!==D.morphColors&&0<D.morphColors.length){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var c=N.faces,l=D.morphColors[0].colors;for(t=0,i=c.length;t<i;t++)c[t].color.fromArray(l,3*t)}}(t),function(){var e=[],t=[];void 0!==D.animation&&t.push(D.animation);void 0!==D.animations&&(D.animations.length?t=t.concat(D.animations):t.push(D.animations));for(var i=0;i<t.length;i++){var r=as.parseAnimation(t[i],N.bones);r&&e.push(r)}if(N.morphTargets){var n=as.CreateClipsFromMorphTargetSequences(N.morphTargets,10);e=e.concat(n)}0<e.length&&(N.animations=e)}(),N.computeFaceNormals(),N.computeBoundingSphere(),void 0===D.materials||0===D.materials.length)return{geometry:N};var i=cs.prototype.initMaterials(D.materials,e,this.crossOrigin);return{geometry:N,materials:i}}}),Object.assign(hs.prototype,{load:function(r,n,e,t){""===this.texturePath&&(this.texturePath=r.substring(0,r.lastIndexOf("/")+1));var a=this;new Mo(a.manager).load(r,function(e){var t=null;try{t=JSON.parse(e)}catch(e){return void console.error("THREE:ObjectLoader: Can't parse "+r+".",e.message)}var i=t.metadata;void 0!==i&&void 0!==i.type&&"geometry"!==i.type.toLowerCase()?a.parse(t,n):console.error("THREE.ObjectLoader: Can't load "+r+". Use THREE.JSONLoader instead.")},e,t)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseGeometries(e.geometries),r=this.parseImages(e.images,function(){void 0!==t&&t(o)}),n=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,n),o=this.parseObject(e.object,i,a);return e.animations&&(o.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(o),o},parseGeometries:function(e){var t={};if(void 0!==e)for(var i=new ls,r=new ss,n=0,a=e.length;n<a;n++){var o,s=e[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new so[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new so[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new so[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new so[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new so[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new so[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new so[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new so[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new so[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new so[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new so[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=r.parse(s);break;case"Geometry":o=i.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),t[s.uuid]=o}return t},parseMaterials:function(e,t){var i={};if(void 0!==e){var r=new os;r.setTextures(t);for(var n=0,a=e.length;n<a;n++){var o=r.parse(e[n]);i[o.uuid]=o}}return i},parseAnimations:function(e){for(var t=[],i=0;i<e.length;i++){var r=as.parse(e[i]);t.push(r)}return t},parseImages:function(e,t){var i=this,r={};function n(e){return i.manager.itemStart(e),a.load(e,function(){i.manager.itemEnd(e)},void 0,function(){i.manager.itemError(e)})}if(void 0!==e&&0<e.length){var a=new Lo(new wo(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.texturePath+c.url;r[c.uuid]=n(l)}}return r},parseTextures:function(e,t){var i={UVMapping:300,CubeReflectionMapping:se,CubeRefractionMapping:ce,EquirectangularReflectionMapping:le,EquirectangularRefractionMapping:he,SphericalReflectionMapping:ue,CubeUVReflectionMapping:pe,CubeUVRefractionMapping:de},r={RepeatWrapping:1e3,ClampToEdgeWrapping:We,MirroredRepeatWrapping:1002},n={NearestFilter:Xe,NearestMipMapNearestFilter:qe,NearestMipMapLinearFilter:Ye,LinearFilter:Ze,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:Je};function a(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var o={};if(void 0!==e)for(var s=0,c=e.length;s<c;s++){var l=e[s];void 0===l.image&&console.warn('THREE.ObjectLoader: No "image" specified for',l.uuid),void 0===t[l.image]&&console.warn("THREE.ObjectLoader: Undefined image",l.image);var h=new be(t[l.image]);h.needsUpdate=!0,h.uuid=l.uuid,void 0!==l.name&&(h.name=l.name),void 0!==l.mapping&&(h.mapping=a(l.mapping,i)),void 0!==l.offset&&h.offset.fromArray(l.offset),void 0!==l.repeat&&h.repeat.fromArray(l.repeat),void 0!==l.wrap&&(h.wrapS=a(l.wrap[0],r),h.wrapT=a(l.wrap[1],r)),void 0!==l.minFilter&&(h.minFilter=a(l.minFilter,n)),void 0!==l.magFilter&&(h.magFilter=a(l.magFilter,n)),void 0!==l.anisotropy&&(h.anisotropy=l.anisotropy),void 0!==l.flipY&&(h.flipY=l.flipY),o[l.uuid]=h}return o},parseObject:(jo=new ht,function(e,t,i){var r;function n(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function a(e){if(void 0!==e)return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e]}switch(e.type){case"Scene":r=new ra,void 0!==e.background&&Number.isInteger(e.background)&&(r.background=new zt(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?r.fog=new ia(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(r.fog=new ta(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new bn(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(r.focus=e.focus),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.filmGauge&&(r.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(r.filmOffset=e.filmOffset),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new wn(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":r=new Bo(e.color,e.intensity);break;case"DirectionalLight":r=new Fo(e.color,e.intensity);break;case"PointLight":r=new No(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":r=new Do(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new Co(e.color,e.groundColor,e.intensity);break;case"Mesh":var o=n(e.geometry),s=a(e.material);r=o.bones&&0<o.bones.length?new ha(o,s):new dn(o,s);break;case"LOD":r=new sa;break;case"Line":r=new pa(n(e.geometry),a(e.material),e.mode);break;case"LineSegments":r=new da(n(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new ma(n(e.geometry),a(e.material));break;case"Sprite":r=new oa(a(e.material));break;case"Group":r=new ga;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:r=new mr}if(r.uuid=e.uuid,void 0!==e.name&&(r.name=e.name),void 0!==e.matrix?(jo.fromArray(e.matrix),jo.decompose(r.position,r.quaternion,r.scale)):(void 0!==e.position&&r.position.fromArray(e.position),void 0!==e.rotation&&r.rotation.fromArray(e.rotation),void 0!==e.quaternion&&r.quaternion.fromArray(e.quaternion),void 0!==e.scale&&r.scale.fromArray(e.scale)),void 0!==e.castShadow&&(r.castShadow=e.castShadow),void 0!==e.receiveShadow&&(r.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(r.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(r.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&r.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(r.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.children)for(var c in e.children)r.add(this.parseObject(e.children[c],t,i));if("LOD"===e.type)for(var l=e.levels,h=0;h<l.length;h++){var u=l[h];void 0!==(c=r.getObjectByProperty("uuid",u.object))&&r.addLevel(c,u.distance)}return r})}),us.prototype={constructor:us,getPoint:function(){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},getPoints:function(e){e=e||5;for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return t},getSpacedPoints:function(e){e=e||5;for(var t=[],i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e=e||(this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,r=[],n=this.getPoint(0),a=0;for(r.push(0),i=1;i<=e;i++)a+=(t=this.getPoint(i/e)).distanceTo(n),r.push(a),n=t;return this.cacheArcLengths=r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,r=this.getLengths(),n=0,a=r.length;i=t||e*r[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=r[n=Math.floor(s+(c-s)/2)]-i)<0)s=n+1;else{if(!(0<o)){c=n;break}c=n-1}if(r[n=c]===i)return n/(a-1);var l=r[n];return(n+(i-l)/(r[n+1]-l))/(a-1)},getTangent:function(e){var t=e-1e-4,i=e+1e-4;t<0&&(t=0),1<i&&(i=1);var r=this.getPoint(t);return this.getPoint(i).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var i,r,n,a=new lt,o=[],s=[],c=[],l=new lt,h=new ht;for(i=0;i<=e;i++)r=i/e,o[i]=this.getTangentAt(r),o[i].normalize();s[0]=new lt,c[0]=new lt;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),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),i=1;i<=e;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),l.crossVectors(o[i-1],o[i]),l.length()>Number.EPSILON&&(l.normalize(),n=Math.acos(A.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(h.makeRotationAxis(l,n))),c[i].crossVectors(o[i],s[i]);if(!0===t)for(n=Math.acos(A.clamp(s[0].dot(s[e]),-1,1)),n/=e,0<o[0].dot(l.crossVectors(s[0],s[e]))&&(n=-n),i=1;i<=e;i++)s[i].applyMatrix4(h.makeRotationAxis(o[i],n*i)),c[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:c}}},us.create=function(e,t){return e.prototype=Object.create(us.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},((ps.prototype=Object.create(us.prototype)).constructor=ps).prototype.isLineCurve=!0,ps.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},ps.prototype.getPointAt=function(e){return this.getPoint(e)},ps.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},ds.prototype=Object.assign(Object.create(us.prototype),{constructor:ds,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ps(t,e))},getPoint:function(e){for(var t=e*this.getLength(),i=this.getCurveLengths(),r=0;r<i.length;){if(i[r]>=t){var n=i[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-n/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){e=e||40;for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,i=[],r=0,n=this.curves;r<n.length;r++)for(var a=n[r],o=a&&a.isEllipseCurve?2*e:a&&a.isLineCurve?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(i.push(l),t=l)}return this.autoClose&&1<i.length&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new un,i=0,r=e.length;i<r;i++){var n=e[i];t.vertices.push(new lt(n.x,n.y,n.z||0))}return t}}),((fs.prototype=Object.create(us.prototype)).constructor=fs).prototype.isEllipseCurve=!0,fs.prototype.getPoint=function(e){for(var t=2*Math.PI,i=this.aEndAngle-this.aStartAngle,r=Math.abs(i)<Number.EPSILON;i<0;)i+=t;for(;t<i;)i-=t;i<Number.EPSILON&&(i=r?0:t),!0!==this.aClockwise||r||(i===t?i=-t:i-=t);var n=this.aStartAngle+e*i,a=this.aX+this.xRadius*Math.cos(n),o=this.aY+this.yRadius*Math.sin(n);if(0!==this.aRotation){var s=Math.cos(this.aRotation),c=Math.sin(this.aRotation),l=a-this.aX,h=o-this.aY;a=l*s-h*c+this.aX,o=l*c+h*s+this.aY}return new fe(a,o)};var ms={tangentQuadraticBezier:function(e,t,i,r){return 2*(1-e)*(i-t)+2*e*(r-i)},tangentCubicBezier:function(e,t,i,r,n){return-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*r*(1-e)-3*e*e*r+3*e*e*n},tangentSpline:function(e){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},interpolate:function(e,t,i,r,n){var a=.5*(i-e),o=.5*(r-t),s=n*n;return(2*t-2*i+a+o)*(n*s)+(-3*t+3*i-2*a-o)*s+a*n+t}};function gs(e){this.points=void 0===e?[]:e}function vs(e,t,i,r){this.v0=e,this.v1=t,this.v2=i,this.v3=r}function ys(e,t,i){this.v0=e,this.v1=t,this.v2=i}((gs.prototype=Object.create(us.prototype)).constructor=gs).prototype.isSplineCurve=!0,gs.prototype.getPoint=function(e){var t=this.points,i=(t.length-1)*e,r=Math.floor(i),n=i-r,a=t[0===r?r:r-1],o=t[r],s=t[r>t.length-2?t.length-1:r+1],c=t[r>t.length-3?t.length-1:r+2],l=ms.interpolate;return new fe(l(a.x,o.x,s.x,c.x,n),l(a.y,o.y,s.y,c.y,n))},((vs.prototype=Object.create(us.prototype)).constructor=vs).prototype.getPoint=function(e){var t=Ga.b3;return new fe(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},vs.prototype.getTangent=function(e){var t=ms.tangentCubicBezier;return new fe(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},((ys.prototype=Object.create(us.prototype)).constructor=ys).prototype.getPoint=function(e){var t=Ga.b2;return new fe(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},ys.prototype.getTangent=function(e){var t=ms.tangentQuadraticBezier;return new fe(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()};var xs,bs=Object.assign(Object.create(ds.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var i=new ps(this.currentPoint.clone(),new fe(e,t));this.curves.push(i),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,i,r){var n=new ys(this.currentPoint.clone(),new fe(e,t),new fe(i,r));this.curves.push(n),this.currentPoint.set(i,r)},bezierCurveTo:function(e,t,i,r,n,a){var o=new vs(this.currentPoint.clone(),new fe(e,t),new fe(i,r),new fe(n,a));this.curves.push(o),this.currentPoint.set(n,a)},splineThru:function(e){var t=new gs([this.currentPoint.clone()].concat(e));this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,i,r,n,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,i,r,n,a)},absarc:function(e,t,i,r,n,a){this.absellipse(e,t,i,i,r,n,a)},ellipse:function(e,t,i,r,n,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(e+c,t+l,i,r,n,a,o,s)},absellipse:function(e,t,i,r,n,a,o,s){var c=new fs(e,t,i,r,n,a,o,s);if(0<this.curves.length){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});function ws(){_s.apply(this,arguments),this.holes=[]}function _s(e){ds.call(this),this.currentPoint=new fe,e&&this.fromPoints(e)}function Ms(){this.subPaths=[],this.currentPath=null}function Es(e){this.data=e}function Ts(e){this.manager=void 0!==e?e:_o}ws.prototype=Object.assign(Object.create(bs),{constructor:ws,getPointsHoles:function(e){for(var t=[],i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t},extractAllPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},extractPoints:function(e){return this.extractAllPoints(e)}}),(_s.prototype=bs).constructor=_s,Ms.prototype={moveTo:function(e,t){this.currentPath=new _s,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,i,r){this.currentPath.quadraticCurveTo(e,t,i,r)},bezierCurveTo:function(e,t,i,r,n,a){this.currentPath.bezierCurveTo(e,t,i,r,n,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function i(e){for(var t=[],i=0,r=e.length;i<r;i++){var n=e[i],a=new ws;a.curves=n.curves,t.push(a)}return t}function r(e,t){for(var i=t.length,r=!1,n=i-1,a=0;a<i;n=a++){var o=t[n],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[n],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=l*(e.x-o.x)-c*(e.y-o.y);if(0==h)return!0;if(h<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var n=Ga.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return i(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new ws).curves=s.curves,l.push(c),l;var h=!n(a[0].getPoints());h=e?!h:h;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=n(u=(s=a[v]).getPoints()),(o=e?!o:o)?(!h&&f[g]&&g++,f[g]={s:new ws,p:u},f[g].s.curves=s.curves,h&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return i(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,L=0;L<f.length;L++)r(T.p,f[L].p)&&(w!==L&&b.push({froms:w,tos:L,hole:E}),S?(S=!1,d[L].push(T)):x=!0);S&&d[w].push(T)}0<b.length&&(x||(m=d))}v=0;for(var A=f.length;v<A;v++){c=f[v].s,l.push(c);for(var R=0,P=(p=m[v]).length;R<P;R++)c.holes.push(p[R].h)}return l}},Object.assign(Es.prototype,{isFont:!0,generateShapes:function(e,s,E){function c(e,t,i){var r=T.glyphs[e]||T.glyphs["?"];if(r){var n,a,o,s,c,l,h,u,p,d,f,m=new Ms,g=[],v=Ga.b2,y=Ga.b3;if(r.o)for(var x=r._cachedOutline||(r._cachedOutline=r.o.split(" ")),b=0,w=x.length;b<w;){switch(x[b++]){case"m":n=x[b++]*t+i,a=x[b++]*t,m.moveTo(n,a);break;case"l":n=x[b++]*t+i,a=x[b++]*t,m.lineTo(n,a);break;case"q":if(o=x[b++]*t+i,s=x[b++]*t,h=x[b++]*t+i,u=x[b++]*t,m.quadraticCurveTo(h,u,o,s),f=g[g.length-1]){c=f.x,l=f.y;for(var _=1;_<=E;_++){v(M=_/E,c,h,o),v(M,l,u,s)}}break;case"b":if(o=x[b++]*t+i,s=x[b++]*t,h=x[b++]*t+i,u=x[b++]*t,p=x[b++]*t+i,d=x[b++]*t,m.bezierCurveTo(h,u,p,d,o,s),f=g[g.length-1]){c=f.x,l=f.y;for(_=1;_<=E;_++){var M;y(M=_/E,c,h,p,o),y(M,l,u,d,s)}}}}return{offset:r.ha*t,path:m}}}void 0===s&&(s=100),void 0===E&&(E=4);for(var T=this.data,t=function(e){for(var t=String(e).split(""),i=s/T.resolution,r=0,n=[],a=0;a<t.length;a++){var o=c(t[a],i,r);r+=o.offset,n.push(o.path)}return n}(e),i=[],r=0,n=t.length;r<n;r++)Array.prototype.push.apply(i,t[r].toShapes());return i}}),Object.assign(Ts.prototype,{load:function(e,r,t,i){var n=this;new Mo(this.manager).load(e,function(t){var i;try{i=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(t.substring(65,t.length-2))}var e=n.parse(i);r&&r(e)},t,i)},parse:function(e){return new Es(e)}});var Ss,Ls,As,Rs,Ps,Cs,Is,Os,Ds,Ns,Us,Fs,Bs,zs,Gs,Hs,ks,Vs,js,Ws,Xs,qs,Ys,Zs,Js,Ks,Qs,$s,ec,tc,ic,rc,nc,ac,oc,sc,cc,lc,hc={getContext:function(){return void 0===xs&&(xs=new(window.AudioContext||window.webkitAudioContext)),xs},setContext:function(e){xs=e}};function uc(e){this.manager=void 0!==e?e:_o}function pc(e,t,i,r){Po.call(this,e,t),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==i?i:10,this.height=void 0!==r?r:10}function dc(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new bn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new bn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function fc(e,t,i){mr.call(this),this.type="CubeCamera";var n=new bn(90,1,e,t);n.up.set(0,-1,0),n.lookAt(new lt(1,0,0)),this.add(n);var a=new bn(90,1,e,t);a.up.set(0,-1,0),a.lookAt(new lt(-1,0,0)),this.add(a);var o=new bn(90,1,e,t);o.up.set(0,0,1),o.lookAt(new lt(0,1,0)),this.add(o);var s=new bn(90,1,e,t);s.up.set(0,0,-1),s.lookAt(new lt(0,-1,0)),this.add(s);var c=new bn(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new lt(0,0,1)),this.add(c);var l=new bn(90,1,e,t);l.up.set(0,-1,0),l.lookAt(new lt(0,0,-1)),this.add(l);var r={format:rt,magFilter:Ze,minFilter:Ze};this.renderTarget=new _e(i,i,r),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,r=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,e.render(t,n,i),i.activeCubeFace=1,e.render(t,a,i),i.activeCubeFace=2,e.render(t,o,i),i.activeCubeFace=3,e.render(t,s,i),i.activeCubeFace=4,e.render(t,c,i),i.texture.generateMipmaps=r,i.activeCubeFace=5,e.render(t,l,i),e.setRenderTarget(null)}}function mc(){mr.call(this),this.type="AudioListener",this.context=hc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function gc(e){mr.call(this),this.type="Audio",this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function vc(e){gc.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function yc(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function xc(e,t,i){this.binding=e,this.valueSize=i;var r,n=Float64Array;switch(t){case"quaternion":r=this._slerp;break;case"string":case"bool":n=Array,r=this._select;break;default:r=this._lerp}this.buffer=new n(4*i),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function bc(e,t,i){this.path=t,this.parsedPath=i||bc.parseTrackName(t),this.node=bc.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function wc(e){this.uuid=A.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var i=0,r=arguments.length;i!==r;++i)t[arguments[i].uuid]=i;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 _c(e,t,i){this._mixer=e,this._clip=t,this._localRoot=i||null;for(var r=t.tracks,n=r.length,a=new Array(n),o={endingStart:2400,endingEnd:2400},s=0;s!==n;++s){var c=r[s].createInterpolant(null);(a[s]=c).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(n),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 Mc(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Ec(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Tc(){pn.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Sc(e,t,i,r){this.uuid=A.generateUUID(),this.data=e,this.itemSize=t,this.offset=i,this.normalized=!0===r}function Lc(e,t){this.uuid=A.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Ac(e,t,i){Lc.call(this,e,t),this.meshPerAttribute=i||1}function Rc(e,t,i){br.call(this,e,t),this.meshPerAttribute=i||1}function Pc(e,t,i,r){this.ray=new Ui(e,t),this.near=i||0,this.far=r||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 Cc(e,t){return e.distance-t.distance}function Ic(e,t,i,r){if(!1!==e.visible&&(e.raycast(t,i),!0===r))for(var n=e.children,a=0,o=n.length;a<o;a++)Ic(n[a],t,i,!0)}function Oc(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Dc(e,t,i){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==i?i:0,this}function Nc(e,t,i){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==i?i:0,this}function Uc(e,t){dn.call(this,e,t),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,r=i-1,n=i/1;this.createAnimation("__default",0,r,n),this.setAnimationWeight("__default",1)}function Fc(e){mr.call(this),this.material=e,this.render=function(e){}}function Bc(e,t,i,r){this.object=e,this.size=void 0!==t?t:1;var n=void 0!==i?i:16711680,a=void 0!==r?r: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 pn,l=new Ar(2*o*3,3);c.addAttribute("position",l),da.call(this,c,new ua({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function zc(e){mr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;for(var t=new pn,i=[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],r=0,n=1;r<32;r++,n++){var a=r/32*Math.PI*2,o=n/32*Math.PI*2;i.push(Math.cos(a),Math.sin(a),1,Math.cos(o),Math.sin(o),1)}t.addAttribute("position",new Ar(i,3));var s=new ua({fog:!1});this.cone=new da(t,s),this.add(this.cone),this.update()}function Gc(e){this.bones=this.getBoneList(e);for(var t=new pn,i=[],r=[],n=new zt(0,0,1),a=new zt(0,1,0),o=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(n.r,n.g,n.b),r.push(a.r,a.g,a.b))}t.addAttribute("position",new Ar(i,3)),t.addAttribute("color",new Ar(r,3));var c=new ua({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});da.call(this,t,c),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Hc(e,t){this.light=e,this.light.updateMatrixWorld();var i=new ja(t,4,2),r=new xr({wireframe:!0,fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),dn.call(this,i,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function kc(e){mr.call(this),this.light=e,this.light.updateMatrixWorld();var t=new xr({color:e.color,fog:!1}),i=new xr({color:e.color,fog:!1,wireframe:!0}),r=new pn;r.addAttribute("position",new br(new Float32Array(18),3)),this.add(new dn(r,t)),this.add(new dn(r,i)),this.update()}function Vc(e,t){mr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;var i=new La(t);i.rotateY(.5*Math.PI);var r=new xr({vertexColors:2,wireframe:!0}),n=i.getAttribute("position"),a=new Float32Array(3*n.count);i.addAttribute("color",new br(a,3)),this.add(new dn(i,r)),this.update()}function jc(e,t,i,r){e=e||10,t=t||10,i=new zt(void 0!==i?i:4473924),r=new zt(void 0!==r?r:8947848);for(var n=t/2,a=2*e/t,o=[],s=[],c=0,l=0,h=-e;c<=t;c++,h+=a){o.push(-e,0,h,e,0,h),o.push(h,0,-e,h,0,e);var u=c===n?i:r;u.toArray(s,l),l+=3,u.toArray(s,l),l+=3,u.toArray(s,l),l+=3,u.toArray(s,l),l+=3}var p=new pn;p.addAttribute("position",new Ar(o,3)),p.addAttribute("color",new Ar(s,3));var d=new ua({vertexColors:2});da.call(this,p,d)}function Wc(e,t,i,r,n,a){e=e||10,t=t||16,i=i||8,r=r||64,n=new zt(void 0!==n?n:4473924),a=new zt(void 0!==a?a:8947848);var o,s,c,l,h,u,p,d=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,d.push(0,0,0),d.push(o,0,s),p=1&l?n:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(l=0;l<=i;l++)for(p=1&l?n:a,u=e-e/i*l,h=0;h<r;h++)c=h/r*(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=(h+1)/r*(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 pn;m.addAttribute("position",new Ar(d,3)),m.addAttribute("color",new Ar(f,3));var g=new ua({vertexColors:2});da.call(this,m,g)}function Xc(e,t,i,r){this.object=e,this.size=void 0!==t?t:1;var n=void 0!==i?i:16776960,a=void 0!==r?r: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 pn,l=new Ar(2*o*3,3);c.addAttribute("position",l),da.call(this,c,new ua({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function qc(e,t){mr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,void 0===t&&(t=1);var i=new pn;i.addAttribute("position",new Ar([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new ua({fog:!1});this.add(new pa(i,r)),(i=new pn).addAttribute("position",new Ar([0,0,0,0,0,1],3)),this.add(new pa(i,r)),this.update()}function Yc(e){var t=new pn,i=new ua({color:16777215,vertexColors:1}),r=[],n=[],a={},o=new zt(16755200),s=new zt(16711680),c=new zt(43775),l=new zt(16777215),h=new zt(3355443);function u(e,t,i){p(e,i),p(t,i)}function p(e,t){r.push(0,0,0),n.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.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",l),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.addAttribute("position",new Ar(r,3)),t.addAttribute("color",new Ar(n,3)),da.call(this,t,i),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Zc(e,t,i,r){sc.set(t,i,r).unproject(cc);var n=oc[e];if(void 0!==n)for(var a=ac.getAttribute("position"),o=0,s=n.length;o<s;o++)a.setXYZ(n[o],sc.x,sc.y,sc.z)}function Jc(e,t){void 0===t&&(t=16776960);var i=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]),r=new Float32Array(24),n=new pn;n.setIndex(new br(i,1)),n.addAttribute("position",new br(r,3)),da.call(this,n,new ua({color:t})),void 0!==e&&this.update(e)}Object.assign(uc.prototype,{load:function(e,t,i,r){var n=new Mo(this.manager);n.setResponseType("arraybuffer"),n.load(e,function(e){hc.getContext().decodeAudioData(e,function(e){t(e)})},i,r)}}),pc.prototype=Object.assign(Object.create(Po.prototype),{constructor:pc,isRectAreaLight:!0,copy:function(e){return Po.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this}}),Object.assign(dc.prototype,{update:(Os=new ht,Ds=new ht,function(e){if(Ss!==this||Ls!==e.focus||As!==e.fov||Rs!==e.aspect*this.aspect||Ps!==e.near||Cs!==e.far||Is!==e.zoom){Ss=this,Ls=e.focus,As=e.fov,Rs=e.aspect*this.aspect,Ps=e.near,Cs=e.far,Is=e.zoom;var t,i,r=e.projectionMatrix.clone(),n=this.eyeSep/2,a=n*Ps/Ls,o=Ps*Math.tan(A.DEG2RAD*As*.5)/Is;Ds.elements[12]=-n,Os.elements[12]=n,t=-o*Rs+a,i=o*Rs+a,r.elements[0]=2*Ps/(i-t),r.elements[8]=(i+t)/(i-t),this.cameraL.projectionMatrix.copy(r),t=-o*Rs-a,i=o*Rs-a,r.elements[0]=2*Ps/(i-t),r.elements[8]=(i+t)/(i-t),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Ds),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Os)})}),(fc.prototype=Object.create(mr.prototype)).constructor=fc,mc.prototype=Object.assign(Object.create(mr.prototype),{constructor:mc,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){this.gain.gain.value=e},updateMatrixWorld:(Ns=new lt,Us=new Me,Fs=new lt,Bs=new lt,function(e){mr.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,i=this.up;this.matrixWorld.decompose(Ns,Us,Fs),Bs.set(0,0,-1).applyQuaternion(Us),t.positionX?(t.positionX.setValueAtTime(Ns.x,this.context.currentTime),t.positionY.setValueAtTime(Ns.y,this.context.currentTime),t.positionZ.setValueAtTime(Ns.z,this.context.currentTime),t.forwardX.setValueAtTime(Bs.x,this.context.currentTime),t.forwardY.setValueAtTime(Bs.y,this.context.currentTime),t.forwardZ.setValueAtTime(Bs.z,this.context.currentTime),t.upX.setValueAtTime(i.x,this.context.currentTime),t.upY.setValueAtTime(i.y,this.context.currentTime),t.upZ.setValueAtTime(i.z,this.context.currentTime)):(t.setPosition(Ns.x,Ns.y,Ns.z),t.setOrientation(Bs.x,Bs.y,Bs.z,i.x,i.y,i.z))})}),gc.prototype=Object.assign(Object.create(mr.prototype),{constructor:gc,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),e.playbackRate.setValueAtTime(this.playbackRate,this.startTime),e.start(0,this.startTime),this.isPlaying=!0,this.source=e,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 this.source.stop(),this.startTime=this.context.currentTime,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.startTime=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 e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);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 e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e=e||[],!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!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(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!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(e){return this.gain.gain.value=e,this}}),vc.prototype=Object.assign(Object.create(gc.prototype),{constructor:vc,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){this.panner.refDistance=e},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){this.panner.rolloffFactor=e},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){this.panner.distanceModel=e},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){this.panner.maxDistance=e},updateMatrixWorld:(zs=new lt,function(e){mr.prototype.updateMatrixWorld.call(this,e),zs.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(zs.x,zs.y,zs.z)})}),Object.assign(yc.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),i=0;i<t.length;i++)e+=t[i];return e/t.length}}),xc.prototype={constructor:xc,accumulate:function(e,t){var i=this.buffer,r=this.valueSize,n=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)i[n+o]=i[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(i,n,0,s,r)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,i=this.buffer,r=e*t+t,n=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,n<1){var o=3*t;this._mixBufferRegion(i,r,o,1-n,t)}for(var s=t,c=t+t;s!==c;++s)if(i[s]!==i[s+t]){a.setValue(i,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,i=this.valueSize,r=3*i;e.getValue(t,r);for(var n=i,a=r;n!==a;++n)t[n]=t[r+n%i];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,i,r,n){if(.5<=r)for(var a=0;a!==n;++a)e[t+a]=e[i+a]},_slerp:function(e,t,i,r){Me.slerpFlat(e,t,e,t,e,i,r)},_lerp:function(e,t,i,r,n){for(var a=1-r,o=0;o!==n;++o){var s=t+o;e[s]=e[s]*a+e[i+o]*r}}},bc.prototype={constructor:bc,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,n=t.propertyIndex;if(e||(e=bc.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(i){var a=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[i])return void console.error(" can not bind to objectName of node, undefined",this);e=e[i]}if(void 0!==a){if(void 0===e[a])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[a]}}var s=e[r];if(void 0!==s){var c=this.Versioning.None;void 0!==e.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var l=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===n){n=o;break}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=n}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):void 0!==s.length?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var h=t.nodeName;console.error(" trying to update property for track: "+h+"."+r+" but it wasn't found.",e)}}else console.error(" 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(bc.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:bc.prototype.getValue,_setValue_unbound:bc.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)e[t++]=i[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++]},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),(bc.Composite=function(e,t,i){var r=i||bc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}).prototype={constructor:bc.Composite,getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},bc.create=function(e,t,i){return e&&e.isAnimationObjectGroup?new bc.Composite(e,t,i):new bc(e,t,i)},bc.parseTrackName=function(e){var t=/^((?:[\w-]+[\/:])*)([\w-]+)?(?:\.([\w-]+)(?:\[(.+)\])?)?\.([\w-]+)(?:\[(.+)\])?$/.exec(e);if(!t)throw new Error("cannot parse trackName at all: "+e);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]};if(null===i.propertyName||0===i.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return i},bc.findNode=function(e,a){if(!a||""===a||"root"===a||"."===a||-1===a||a===e.name||a===e.uuid)return e;if(e.skeleton){var t=function(e){for(var t=0;t<e.bones.length;t++){var i=e.bones[t];if(i.name===a)return i}return null}(e.skeleton);if(t)return t}if(e.children){var i=function e(t){for(var i=0;i<t.length;i++){var r=t[i];if(r.name===a||r.uuid===a)return r;var n=e(r.children);if(n)return n}return null}(e.children);if(i)return i}return null},wc.prototype={constructor:wc,isAnimationObjectGroup:!0,add:function(e){for(var t=this._objects,i=t.length,r=this.nCachedObjects_,n=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,c=s.length,l=0,h=arguments.length;l!==h;++l){var u=arguments[l],p=u.uuid,d=n[p],f=void 0;if(void 0===d){d=i++,n[p]=d,t.push(u);for(var m=0,g=c;m!==g;++m)s[m].push(new bc(u,a[m],o[m]))}else if(d<r){f=t[d];var v=--r,y=t[v];t[n[y.uuid]=d]=y,t[n[p]=v]=u;for(m=0,g=c;m!==g;++m){var x=s[m],b=x[v],w=x[d];x[d]=b,void 0===w&&(w=new bc(u,a[m],o[m])),x[v]=w}}else t[d]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=r},remove:function(e){for(var t=this._objects,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,a=n.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,h=r[l];if(void 0!==h&&i<=h){var u=i++,p=t[u];t[r[p.uuid]=h]=p,t[r[l]=u]=c;for(var d=0,f=a;d!==f;++d){var m=n[d],g=m[u],v=m[h];m[h]=g,m[u]=v}}}this.nCachedObjects_=i},uncache:function(e){for(var t=this._objects,i=t.length,r=this.nCachedObjects_,n=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var l=arguments[s].uuid,h=n[l];if(void 0!==h)if(delete n[l],h<r){var u=--r,p=t[u],d=t[y=--i];t[n[p.uuid]=h]=p,t[n[d.uuid]=u]=d,t.pop();for(var f=0,m=o;f!==m;++f){var g=(x=a[f])[u],v=x[y];x[h]=g,x[u]=v,x.pop()}}else{var y;t[n[(d=t[y=--i]).uuid]=h]=d,t.pop();for(f=0,m=o;f!==m;++f){var x;(x=a[f])[h]=x[y],x.pop()}}}this.nCachedObjects_=r},subscribe_:function(e,t){var i=this._bindingsIndicesByPath,r=i[e],n=this._bindings;if(void 0!==r)return n[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c);r=n.length,i[e]=r,a.push(e),o.push(t),n.push(h);for(var u=l,p=s.length;u!==p;++u){var d=s[u];h[u]=new bc(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,i=t[e];if(void 0!==i){var r=this._paths,n=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];a[t[e[o]]=i]=s,a.pop(),n[i]=n[o],n.pop(),r[i]=r[o],r.pop()}}},_c.prototype={constructor:_c,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(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){var r=this._clip.duration,n=e._clip.duration,a=n/r,o=r/n;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,i){return e.crossFadeFrom(this,t,i)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,i){var r=this._mixer,n=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=n,s[1]=n+i,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,i,r){var n=this._startTime;if(null!==n){var a=(e-n)*i;if(a<0||0===i)return;this._startTime=null,t=i*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(0<s)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(r,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i<=t)t=i;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var a=2202===r;if(-1===n&&(0<=e?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i<=t||t<0){var o=Math.floor(t/i);t-=i*o,n+=Math.abs(o);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=0<e?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1});else{if(0==s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&n))return i-(this.time=t)}return this.time=t},_setEndings:function(e,t,i){var r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,i){var r=this._mixer,n=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=n,s[0]=t,o[1]=n+e,s[1]=i,this}},Mc.prototype={constructor:Mc,clipAction:function(e,t){var i=t||this._root,r=i.uuid,n="string"==typeof e?as.findByName(i,e):e,a=null!==n?n.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[r];if(void 0!==c)return c;s=o.knownActions[0],null===n&&(n=s._clip)}if(null===n)return null;var l=new _c(this,n,t);return this._bindAction(l,s),this._addInactiveAction(l,a,r),l},existingAction:function(e,t){var i=t||this._root,r=i.uuid,n="string"==typeof e?as.findByName(i,e):e,a=n?n.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,i=this._bindings,r=this._nActiveBindings;this._nActiveActions=0;for(var n=this._nActiveBindings=0;n!==t;++n)e[n].reset();for(n=0;n!==r;++n)i[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,i=this._nActiveActions,r=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1,o=0;o!==i;++o){var s=t[o];s.enabled&&s._update(r,e,n,a)}var c=this._bindings,l=this._nActiveBindings;for(o=0;o!==l;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,i=e.uuid,r=this._actionsByClip,n=r[i];if(void 0!==n){for(var a=n.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,t[h._cacheIndex=l]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}},uncacheRoot:function(e){var t=e.uuid,i=this._actionsByClip;for(var r in i){var n=i[r].actionByRoot[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}},Object.assign(Mc.prototype,{_bindAction:function(e,t){var i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,a=e._propertyBindings,o=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==n;++h){var u=r[h],p=u.name,d=l[p];if(void 0!==d)a[h]=d;else{if(void 0!==(d=a[h])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(d=new xc(bc.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[h]=d}o[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,a=0,o=n.length;a!==o;++a){var s=n[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,i){var r=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e},_removeInactiveAction:function(e){var t=this._actions,i=t[t.length-1],r=e._cacheIndex;t[i._cacheIndex=r]=i,t.pop(),e._cacheIndex=null;var n=e._clip.uuid,a=this._actionsByClip,o=a[n],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;s[c._byClipCacheIndex=l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[n],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){var t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_takeBackAction:function(e){var t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_addInactiveBinding:function(e,t,i){var r=this._bindingsByRootAndName,n=r[t],a=this._bindings;void 0===n&&(n={},r[t]=n),(n[i]=e)._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,i=e.binding,r=i.rootNode.uuid,n=i.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;t[s._cacheIndex=c]=s,t.pop(),delete o[n];e:{for(var l in o)break e;delete a[r]}},_lendBinding:function(e){var t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_takeBackBinding:function(e){var t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,n=t[r];t[e._cacheIndex=r]=e,t[n._cacheIndex=i]=n},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&(e[(i=new Yo(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=i),i},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,n=t[r];t[e.__cacheIndex=r]=e,t[n.__cacheIndex=i]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),Object.assign(Mc.prototype,t.prototype),Ec.prototype.clone=function(){return new Ec(void 0===this.value.clone?this.value:this.value.clone())},((Tc.prototype=Object.create(pn.prototype)).constructor=Tc).prototype.isInstancedBufferGeometry=!0,Tc.prototype.addGroup=function(e,t,i){this.groups.push({start:e,count:t,materialIndex:i})},Tc.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var r in i){var n=i[r];this.addAttribute(r,n.clone())}for(var a=e.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this},Sc.prototype={constructor:Sc,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this},setXYZ:function(e,t,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this},setXYZW:function(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}},Lc.prototype={constructor:Lc,isInterleavedBuffer:!0,set needsUpdate(e){!0===e&&this.version++},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.stride:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.stride,i*=t.stride;for(var r=0,n=this.stride;r<n;r++)this.array[e+r]=t.array[i+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}},((Ac.prototype=Object.create(Lc.prototype)).constructor=Ac).prototype.isInstancedInterleavedBuffer=!0,Ac.prototype.copy=function(e){return Lc.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},((Rc.prototype=Object.create(br.prototype)).constructor=Rc).prototype.isInstancedBufferAttribute=!0,Rc.prototype.copy=function(e){return br.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},Pc.prototype={constructor:Pc,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t){var i=[];return Ic(e,this,i,t),i.sort(Cc),i},intersectObjects:function(e,t){var i=[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,n=e.length;r<n;r++)Ic(e[r],this,i,t);return i.sort(Cc),i}},Oc.prototype={constructor:Oc,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=(performance||Date).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},Dc.prototype={constructor:Dc,set:function(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(A.clamp(e.y/this.radius,-1,1))),this}},Nc.prototype={constructor:Nc,set:function(e,t,i){return this.radius=e,this.theta=t,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.radius=Math.sqrt(e.x*e.x+e.z*e.z),this.theta=Math.atan2(e.x,e.z),this.y=e.y,this}},((Uc.prototype=Object.create(dn.prototype)).constructor=Uc).prototype.createAnimation=function(e,t,i,r){var n={start:t,end:i,length:i-t+1,fps:r,duration:(i-t)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=n,this.animationsList.push(n)},Uc.prototype.autoCreateAnimations=function(e){for(var t,i=/([a-z]+)_?(\d+)/i,r={},n=this.geometry,a=0,o=n.morphTargets.length;a<o;a++){var s=n.morphTargets[a].name.match(i);if(s&&1<s.length)r[c=s[1]]||(r[c]={start:1/0,end:-1/0}),a<(l=r[c]).start&&(l.start=a),a>l.end&&(l.end=a),t=t||c}for(var c in r){var l=r[c];this.createAnimation(c,l.start,l.end,e)}this.firstAnimation=t},Uc.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},Uc.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},Uc.prototype.setAnimationFPS=function(e,t){var i=this.animationsMap[e];i&&(i.fps=t,i.duration=(i.end-i.start)/i.fps)},Uc.prototype.setAnimationDuration=function(e,t){var i=this.animationsMap[e];i&&(i.duration=t,i.fps=(i.end-i.start)/i.duration)},Uc.prototype.setAnimationWeight=function(e,t){var i=this.animationsMap[e];i&&(i.weight=t)},Uc.prototype.setAnimationTime=function(e,t){var i=this.animationsMap[e];i&&(i.time=t)},Uc.prototype.getAnimationTime=function(e){var t=0,i=this.animationsMap[e];return i&&(t=i.time),t},Uc.prototype.getAnimationDuration=function(e){var t=-1,i=this.animationsMap[e];return i&&(t=i.duration),t},Uc.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},Uc.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},Uc.prototype.update=function(e){for(var t=0,i=this.animationsList.length;t<i;t++){var r=this.animationsList[t];if(r.active){var n=r.duration/r.length;r.time+=r.direction*e,r.mirroredLoop?(r.time>r.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var a=r.start+A.clamp(Math.floor(r.time/n),0,r.length-1),o=r.weight;a!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*o,this.morphTargetInfluences[a]=0,r.lastFrame=r.currentFrame,r.currentFrame=a);var s=r.time%n/n;r.directionBackwards&&(s=1-s),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=s*o,this.morphTargetInfluences[r.lastFrame]=(1-s)*o):this.morphTargetInfluences[r.currentFrame]=o}}},((Fc.prototype=Object.create(mr.prototype)).constructor=Fc).prototype.isImmediateRenderObject=!0,((Bc.prototype=Object.create(da.prototype)).constructor=Bc).prototype.update=(Gs=new lt,Hs=new lt,ks=new Ii,function(){var e=["a","b","c"];this.object.updateMatrixWorld(!0),ks.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,i=this.geometry.attributes.position,r=this.object.geometry;if(r&&r.isGeometry)for(var n=r.vertices,a=r.faces,o=0,s=0,c=a.length;s<c;s++)for(var l=a[s],h=0,u=l.vertexNormals.length;h<u;h++){var p=n[l[e[h]]],d=l.vertexNormals[h];Gs.copy(p).applyMatrix4(t),Hs.copy(d).applyMatrix3(ks).normalize().multiplyScalar(this.size).add(Gs),i.setXYZ(o,Gs.x,Gs.y,Gs.z),o+=1,i.setXYZ(o,Hs.x,Hs.y,Hs.z),o+=1}else if(r&&r.isBufferGeometry){var f=r.attributes.position,m=r.attributes.normal;for(h=o=0,u=f.count;h<u;h++)Gs.set(f.getX(h),f.getY(h),f.getZ(h)).applyMatrix4(t),Hs.set(m.getX(h),m.getY(h),m.getZ(h)),Hs.applyMatrix3(ks).normalize().multiplyScalar(this.size).add(Gs),i.setXYZ(o,Gs.x,Gs.y,Gs.z),o+=1,i.setXYZ(o,Hs.x,Hs.y,Hs.z),o+=1}return i.needsUpdate=!0,this}),((zc.prototype=Object.create(mr.prototype)).constructor=zc).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},zc.prototype.update=(Vs=new lt,js=new lt,function(){var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Vs.setFromMatrixPosition(this.light.matrixWorld),js.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(js.sub(Vs)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}),((Gc.prototype=Object.create(da.prototype)).constructor=Gc).prototype.getBoneList=function(e){var t=[];e&&e.isBone&&t.push(e);for(var i=0;i<e.children.length;i++)t.push.apply(t,this.getBoneList(e.children[i]));return t},Gc.prototype.update=(Ws=new lt,Xs=new ht,qs=new ht,function(){var e=this.geometry,t=e.getAttribute("position");qs.getInverse(this.root.matrixWorld);for(var i=0,r=0;i<this.bones.length;i++){var n=this.bones[i];n.parent&&n.parent.isBone&&(Xs.multiplyMatrices(qs,n.matrixWorld),Ws.setFromMatrixPosition(Xs),t.setXYZ(r,Ws.x,Ws.y,Ws.z),Xs.multiplyMatrices(qs,n.parent.matrixWorld),Ws.setFromMatrixPosition(Xs),t.setXYZ(r+1,Ws.x,Ws.y,Ws.z),r+=2)}e.getAttribute("position").needsUpdate=!0}),((Hc.prototype=Object.create(dn.prototype)).constructor=Hc).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Hc.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},((kc.prototype=Object.create(mr.prototype)).constructor=kc).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose(),this.children[1].geometry.dispose(),this.children[1].material.dispose()},kc.prototype.update=(Ys=new lt,Zs=new lt,function(){var e=this.children[0],t=this.children[1];if(this.light.target){Ys.setFromMatrixPosition(this.light.matrixWorld),Zs.setFromMatrixPosition(this.light.target.matrixWorld);var i=Zs.clone().sub(Ys);e.lookAt(i),t.lookAt(i)}e.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),t.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var r=.5*this.light.width,n=.5*this.light.height,a=e.geometry.getAttribute("position"),o=a.array;o[0]=r,o[1]=-n,o[2]=0,o[3]=r,o[4]=n,o[5]=0,o[6]=-r,o[7]=n,o[8]=0,o[9]=-r,o[10]=n,o[11]=0,o[12]=-r,o[13]=-n,o[14]=0,o[15]=r,o[16]=-n,o[17]=0,a.needsUpdate=!0}),((Vc.prototype=Object.create(mr.prototype)).constructor=Vc).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Vc.prototype.update=(Js=new lt,Ks=new zt,Qs=new zt,function(){var e=this.children[0],t=e.geometry.getAttribute("color");Ks.copy(this.light.color).multiplyScalar(this.light.intensity),Qs.copy(this.light.groundColor).multiplyScalar(this.light.intensity);for(var i=0,r=t.count;i<r;i++){var n=i<r/2?Ks:Qs;t.setXYZ(i,n.r,n.g,n.b)}e.lookAt(Js.setFromMatrixPosition(this.light.matrixWorld).negate()),t.needsUpdate=!0}),(jc.prototype=Object.create(da.prototype)).constructor=jc,(Wc.prototype=Object.create(da.prototype)).constructor=Wc,((Xc.prototype=Object.create(da.prototype)).constructor=Xc).prototype.update=($s=new lt,ec=new lt,tc=new Ii,function(){this.object.updateMatrixWorld(!0),tc.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,t=this.geometry.attributes.position,i=this.object.geometry,r=i.vertices,n=i.faces,a=0,o=0,s=n.length;o<s;o++){var c=n[o],l=c.normal;$s.copy(r[c.a]).add(r[c.b]).add(r[c.c]).divideScalar(3).applyMatrix4(e),ec.copy(l).applyMatrix3(tc).normalize().multiplyScalar(this.size).add($s),t.setXYZ(a,$s.x,$s.y,$s.z),a+=1,t.setXYZ(a,ec.x,ec.y,ec.z),a+=1}return t.needsUpdate=!0,this}),((qc.prototype=Object.create(mr.prototype)).constructor=qc).prototype.dispose=function(){var e=this.children[0],t=this.children[1];e.geometry.dispose(),e.material.dispose(),t.geometry.dispose(),t.material.dispose()},qc.prototype.update=(ic=new lt,rc=new lt,nc=new lt,function(){ic.setFromMatrixPosition(this.light.matrixWorld),rc.setFromMatrixPosition(this.light.target.matrixWorld),nc.subVectors(rc,ic);var e=this.children[0],t=this.children[1];e.lookAt(nc),e.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),t.lookAt(nc),t.scale.z=nc.length()}),((Yc.prototype=Object.create(da.prototype)).constructor=Yc).prototype.update=(sc=new lt,cc=new xn,function(){ac=this.geometry,oc=this.pointMap,cc.projectionMatrix.copy(this.camera.projectionMatrix),Zc("c",0,0,-1),Zc("t",0,0,1),Zc("n1",-1,-1,-1),Zc("n2",1,-1,-1),Zc("n3",-1,1,-1),Zc("n4",1,1,-1),Zc("f1",-1,-1,1),Zc("f2",1,-1,1),Zc("f3",-1,1,1),Zc("f4",1,1,1),Zc("u1",.7,1.1,-1),Zc("u2",-.7,1.1,-1),Zc("u3",0,2,-1),Zc("cf1",-1,0,1),Zc("cf2",1,0,1),Zc("cf3",0,-1,1),Zc("cf4",0,1,1),Zc("cn1",-1,0,-1),Zc("cn2",1,0,-1),Zc("cn3",0,-1,-1),Zc("cn4",0,1,-1),ac.getAttribute("position").needsUpdate=!0}),((Jc.prototype=Object.create(da.prototype)).constructor=Jc).prototype.update=(lc=new Pi,function(e){if(e&&e.isBox3?lc.copy(e):lc.setFromObject(e),!lc.isEmpty()){var t=lc.min,i=lc.max,r=this.geometry.attributes.position,n=r.array;n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=t.x,n[4]=i.y,n[5]=i.z,n[6]=t.x,n[7]=t.y,n[8]=i.z,n[9]=i.x,n[10]=t.y,n[11]=i.z,n[12]=i.x,n[13]=i.y,n[14]=t.z,n[15]=t.x,n[16]=i.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=i.x,n[22]=t.y,n[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}});var Kc=new pn;Kc.addAttribute("position",new Ar([0,0,0,0,1,0],3));var Qc,$c,el=new eo(0,.5,1,5,1);function tl(e,t,i,r,n,a){mr.call(this),void 0===r&&(r=16776960),void 0===i&&(i=1),void 0===n&&(n=.2*i),void 0===a&&(a=.2*n),this.position.copy(t),this.line=new pa(Kc,new ua({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new dn(el,new xr({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,n,a)}function il(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=new pn;i.addAttribute("position",new Ar(t,3)),i.addAttribute("color",new Ar([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new ua({vertexColors:2});da.call(this,i,r)}el.translate(0,-.5,0),((tl.prototype=Object.create(mr.prototype)).constructor=tl).prototype.setDirection=($c=new lt,function(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):($c.set(e.z,0,-e.x).normalize(),Qc=Math.acos(e.y),this.quaternion.setFromAxisAngle($c,Qc))}),tl.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},tl.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},(il.prototype=Object.create(da.prototype)).constructor=il;var rl,nl,al,ol,sl=(rl=new lt,nl=new cl,al=new cl,ol=new cl,cl.prototype.init=function(e,t,i,r){this.c0=e,this.c1=i,this.c2=-3*e+3*t-2*i-r,this.c3=2*e-2*t+i+r},cl.prototype.initNonuniformCatmullRom=function(e,t,i,r,n,a,o){var s=(t-e)/n-(i-e)/(n+a)+(i-t)/a,c=(i-t)/a-(r-t)/(a+o)+(r-i)/o;s*=a,c*=a,this.init(t,i,s,c)},cl.prototype.initCatmullRom=function(e,t,i,r,n){this.init(t,i,n*(i-e),n*(r-t))},cl.prototype.calc=function(e){var t=e*e,i=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*i},us.create(function(e){this.points=e||[],this.closed=!1},function(e){var t,i,r,n,a,o,s,c,l=this.points;if((n=l.length)<2&&console.log("duh, you need at least 2 points"),r=(t=(n-(this.closed?0:1))*e)-(i=Math.floor(t)),this.closed?i+=0<i?0:(Math.floor(Math.abs(i)/l.length)+1)*l.length:0===r&&i===n-1&&(i=n-2,r=1),a=this.closed||0<i?l[(i-1)%n]:(rl.subVectors(l[0],l[1]).add(l[0]),rl),o=l[i%n],s=l[(i+1)%n],c=this.closed||i+2<n?l[(i+2)%n]:(rl.subVectors(l[n-1],l[n-2]).add(l[n-1]),rl),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var h="chordal"===this.type?.5:.25,u=Math.pow(a.distanceToSquared(o),h),p=Math.pow(o.distanceToSquared(s),h),d=Math.pow(s.distanceToSquared(c),h);p<1e-4&&(p=1),u<1e-4&&(u=p),d<1e-4&&(d=p),nl.initNonuniformCatmullRom(a.x,o.x,s.x,c.x,u,p,d),al.initNonuniformCatmullRom(a.y,o.y,s.y,c.y,u,p,d),ol.initNonuniformCatmullRom(a.z,o.z,s.z,c.z,u,p,d)}else if("catmullrom"===this.type){var f=void 0!==this.tension?this.tension:.5;nl.initCatmullRom(a.x,o.x,s.x,c.x,f),al.initCatmullRom(a.y,o.y,s.y,c.y,f),ol.initCatmullRom(a.z,o.z,s.z,c.z,f)}return new lt(nl.calc(r),al.calc(r),ol.calc(r))}));function cl(){}var ll=us.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0===e?[]:e},function(e){var t=this.points,i=(t.length-1)*e,r=Math.floor(i),n=i-r,a=t[0==r?r:r-1],o=t[r],s=t[r>t.length-2?t.length-1:r+1],c=t[r>t.length-3?t.length-1:r+2],l=ms.interpolate;return new lt(l(a.x,o.x,s.x,c.x,n),l(a.y,o.y,s.y,c.y,n),l(a.z,o.z,s.z,c.z,n))}),hl=us.create(function(e,t,i,r){this.v0=e,this.v1=t,this.v2=i,this.v3=r},function(e){var t=Ga.b3;return new lt(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),ul=us.create(function(e,t,i){this.v0=e,this.v1=t,this.v2=i},function(e){var t=Ga.b2;return new lt(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),pl=us.create(function(e,t){this.v1=e,this.v2=t},function(e){if(1===e)return this.v2.clone();var t=new lt;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t});function dl(e,t,i,r,n,a){fs.call(this,e,t,i,i,r,n,a)}(dl.prototype=Object.create(fs.prototype)).constructor=dl;var fl={createMultiMaterialObject:function(e,t){for(var i=new ga,r=0,n=t.length;r<n;r++)i.add(new dn(e,t[r]));return i},detach:function(e,t,i){e.applyMatrix(t.matrixWorld),t.remove(e),i.add(e)},attach:function(e,t,i){var r=new ht;r.getInverse(i.matrixWorld),e.applyMatrix(r),t.remove(e),i.add(e)}};var ml;function gl(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),sl.call(this,e),this.type="catmullrom",this.closed=!0}gl.prototype=Object.create(sl.prototype),jc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Object.assign(qt.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Pi.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),gr.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},A.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(Ii.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(ht.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return void 0===ml&&(ml=new lt),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),ml.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.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(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,i,r,n,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,i,n,a)}}),Oi.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Me.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Ui.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(ws.prototype,{extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ka(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Qa(this,e)}}),Object.assign(lt.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(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)}}),un.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(mr.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}}),Object.defineProperties(mr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},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(sa.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),bn.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Po.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(br.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(pn.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},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(pn.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.defineProperties(Ec.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(Li.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new zt}}}),Object.defineProperties(fo.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(Ai.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(ea.prototype,{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(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(ea.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(Ni.prototype,{cullFace:{get:function(){return this.renderReverseSided?j:V},set:function(e){var t=e!==V;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(we.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),gc.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new uc).load(e,function(e){t.setBuffer(e)}),this},yc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var vl={merge:function(e,t,i){var r;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,i)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},yl={crossOrigin:void 0,loadTexture:function(e,t,i,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new Ro;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,i,void 0,r);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,i,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new Ao;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,i,void 0,r);return t&&(a.mapping=t),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}};e.WebGLRenderTargetCube=_e,e.WebGLRenderTarget=we,e.WebGLRenderer=ea,e.ShaderLib=Xt,e.UniformsLib=Wt,e.UniformsUtils=Ft,e.ShaderChunk=Bt,e.FogExp2=ta,e.Fog=ia,e.Scene=ra,e.LensFlare=na,e.Sprite=oa,e.LOD=sa,e.SkinnedMesh=ha,e.Skeleton=ca,e.Bone=la,e.Mesh=dn,e.LineSegments=da,e.Line=pa,e.Points=ma,e.Group=ga,e.VideoTexture=va,e.DataTexture=kt,e.CompressedTexture=ya,e.CubeTexture=Ee,e.CanvasTexture=xa,e.DepthTexture=ba,e.Texture=be,e.CompressedTextureLoader=Eo,e.BinaryTextureLoader=So,e.DataTextureLoader=To,e.CubeTextureLoader=Ao,e.TextureLoader=Ro,e.ObjectLoader=hs,e.MaterialLoader=os,e.BufferGeometryLoader=ss,e.DefaultLoadingManager=_o,e.LoadingManager=wo,e.JSONLoader=ls,e.ImageLoader=Lo,e.FontLoader=Ts,e.FileLoader=Mo,e.Loader=cs,e.Cache=bo,e.AudioLoader=uc,e.SpotLightShadow=Oo,e.SpotLight=Do,e.PointLight=No,e.RectAreaLight=pc,e.HemisphereLight=Co,e.DirectionalLightShadow=Uo,e.DirectionalLight=Fo,e.AmbientLight=Bo,e.LightShadow=Io,e.Light=Po,e.StereoCamera=dc,e.PerspectiveCamera=bn,e.OrthographicCamera=wn,e.CubeCamera=fc,e.Camera=xn,e.AudioListener=mc,e.PositionalAudio=vc,e.AudioContext=hc,e.AudioAnalyser=yc,e.Audio=gc,e.VectorKeyframeTrack=Ko,e.StringKeyframeTrack=ts,e.QuaternionKeyframeTrack=$o,e.NumberKeyframeTrack=es,e.ColorKeyframeTrack=rs,e.BooleanKeyframeTrack=is,e.PropertyMixer=xc,e.PropertyBinding=bc,e.KeyframeTrack=ns,e.AnimationUtils=Wo,e.AnimationObjectGroup=wc,e.AnimationMixer=Mc,e.AnimationClip=as,e.Uniform=Ec,e.InstancedBufferGeometry=Tc,e.BufferGeometry=pn,e.GeometryIdCount=hn,e.Geometry=un,e.InterleavedBufferAttribute=Sc,e.InstancedInterleavedBuffer=Ac,e.InterleavedBuffer=Lc,e.InstancedBufferAttribute=Rc,e.Face3=yr,e.Object3D=mr,e.Raycaster=Pc,e.Layers=Bi,e.EventDispatcher=t,e.Clock=Oc,e.QuaternionLinearInterpolant=Qo,e.LinearInterpolant=Yo,e.DiscreteInterpolant=Zo,e.CubicInterpolant=qo,e.Interpolant=Xo,e.Triangle=vr,e.Spline=function(e){this.points=e;var t,i,r,n,a,o,s,c,l,h=[],u={x:0,y:0,z:0};function p(e,t,i,r,n,a,o){var s=.5*(i-e),c=.5*(r-t);return(2*(t-i)+s+c)*o+(-3*(t-i)-2*s-c)*a+s*n+t}this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return t=(this.points.length-1)*e,i=Math.floor(t),r=t-i,h[0]=0===i?i:i-1,h[1]=i,h[2]=i>this.points.length-2?this.points.length-1:i+1,h[3]=i>this.points.length-3?this.points.length-1:i+2,o=this.points[h[0]],s=this.points[h[1]],c=this.points[h[2]],l=this.points[h[3]],a=r*(n=r*r),u.x=p(o.x,s.x,c.x,l.x,r,n,a),u.y=p(o.y,s.y,c.y,l.y,r,n,a),u.z=p(o.z,s.z,c.z,l.z,r,n,a),u},this.getControlPointsArray=function(){var e,t,i=this.points.length,r=[];for(e=0;e<i;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(e){var t,i,r,n,a=0,o=0,s=0,c=new lt,l=new lt,h=[],u=0;for(h[0]=0,e=e||100,r=this.points.length*e,c.copy(this.points[0]),t=1;t<r;t++)i=t/r,n=this.getPoint(i),l.copy(n),u+=l.distanceTo(c),c.copy(n),a=(this.points.length-1)*i,(o=Math.floor(a))!==s&&(h[o]=u,s=o);return h[h.length]=u,{chunks:h,total:u}},this.reparametrizeByArcLength=function(e){var t,i,r,n,a,o,s,c,l=[],h=new lt,u=this.getLength();for(l.push(h.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(o=u.chunks[t]-u.chunks[t-1],s=Math.ceil(e*o/u.total),n=(t-1)/(this.points.length-1),a=t/(this.points.length-1),i=1;i<s-1;i++)r=n+i*(1/s)*(a-n),c=this.getPoint(r),l.push(h.copy(c).clone());l.push(h.copy(this.points[t]).clone())}this.points=l}},e.Math=A,e.Spherical=Dc,e.Cylindrical=Nc,e.Plane=Oi,e.Frustum=Di,e.Sphere=Ci,e.Ray=Ui,e.Matrix4=ht,e.Matrix3=Ii,e.Box3=Pi,e.Box2=qt,e.Line3=gr,e.Euler=Fi,e.Vector4=ct,e.Vector3=lt,e.Vector2=fe,e.Quaternion=Me,e.Color=zt,e.MorphBlendMesh=Uc,e.ImmediateRenderObject=Fc,e.VertexNormalsHelper=Bc,e.SpotLightHelper=zc,e.SkeletonHelper=Gc,e.PointLightHelper=Hc,e.RectAreaLightHelper=kc,e.HemisphereLightHelper=Vc,e.GridHelper=jc,e.PolarGridHelper=Wc,e.FaceNormalsHelper=Xc,e.DirectionalLightHelper=qc,e.CameraHelper=Yc,e.BoxHelper=Jc,e.ArrowHelper=tl,e.AxisHelper=il,e.CatmullRomCurve3=sl,e.SplineCurve3=ll,e.CubicBezierCurve3=hl,e.QuadraticBezierCurve3=ul,e.LineCurve3=pl,e.ArcCurve=dl,e.EllipseCurve=fs,e.SplineCurve=gs,e.CubicBezierCurve=vs,e.QuadraticBezierCurve=ys,e.LineCurve=ps,e.Shape=ws,e.ShapePath=Ms,e.Path=_s,e.Font=Es,e.CurvePath=ds,e.Curve=us,e.ShapeUtils=Ga,e.SceneUtils=fl,e.CurveUtils=ms,e.WireframeGeometry=wa,e.ParametricGeometry=Ma,e.ParametricBufferGeometry=_a,e.TetrahedronGeometry=Sa,e.TetrahedronBufferGeometry=Ta,e.OctahedronGeometry=Aa,e.OctahedronBufferGeometry=La,e.IcosahedronGeometry=Pa,e.IcosahedronBufferGeometry=Ra,e.DodecahedronGeometry=Ia,e.DodecahedronBufferGeometry=Ca,e.PolyhedronGeometry=Oa,e.PolyhedronBufferGeometry=Ea,e.TubeGeometry=Na,e.TubeBufferGeometry=Da,e.TorusKnotGeometry=Fa,e.TorusKnotBufferGeometry=Ua,e.TorusGeometry=za,e.TorusBufferGeometry=Ba,e.TextGeometry=Va,e.SphereBufferGeometry=ja,e.SphereGeometry=Wa,e.RingGeometry=qa,e.RingBufferGeometry=Xa,e.PlaneBufferGeometry=yn,e.PlaneGeometry=Ya,e.LatheGeometry=Ja,e.LatheBufferGeometry=Za,e.ShapeGeometry=Qa,e.ShapeBufferGeometry=Ka,e.ExtrudeGeometry=ka,e.EdgesGeometry=$a,e.ConeGeometry=io,e.ConeBufferGeometry=ro,e.CylinderGeometry=to,e.CylinderBufferGeometry=eo,e.CircleBufferGeometry=no,e.CircleGeometry=ao,e.BoxBufferGeometry=vn,e.BoxGeometry=oo,e.ShadowMaterial=co,e.SpriteMaterial=aa,e.RawShaderMaterial=lo,e.ShaderMaterial=Ai,e.PointsMaterial=fa,e.MultiMaterial=ho,e.MeshPhysicalMaterial=po,e.MeshStandardMaterial=uo,e.MeshPhongMaterial=fo,e.MeshToonMaterial=mo,e.MeshNormalMaterial=go,e.MeshLambertMaterial=vo,e.MeshDepthMaterial=Ri,e.MeshBasicMaterial=xr,e.LineDashedMaterial=yo,e.LineBasicMaterial=ua,e.Material=Li,e.Float64BufferAttribute=Rr,e.Float32BufferAttribute=Ar,e.Uint32BufferAttribute=Lr,e.Int32BufferAttribute=Sr,e.Uint16BufferAttribute=Tr,e.Int16BufferAttribute=Er,e.Uint8ClampedBufferAttribute=Mr,e.Uint8BufferAttribute=_r,e.Int8BufferAttribute=wr,e.BufferAttribute=br,e.REVISION="84dev",e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=k,e.CullFaceBack=V,e.CullFaceFront=j,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=Y,e.PCFSoftShadowMap=U,e.FrontSide=w,e.BackSide=Ue,e.DoubleSide=Fe,e.FlatShading=Be,e.SmoothShading=c,e.NoColors=ze,e.FaceColors=1,e.VertexColors=2,e.NoBlending=Ge,e.NormalBlending=W,e.AdditiveBlending=X,e.SubtractiveBlending=q,e.MultiplyBlending=Z,e.CustomBlending=J,e.AddEquation=He,e.SubtractEquation=101,e.ReverseSubtractEquation=102,e.MinEquation=103,e.MaxEquation=104,e.ZeroFactor=200,e.OneFactor=201,e.SrcColorFactor=202,e.OneMinusSrcColorFactor=203,e.SrcAlphaFactor=ke,e.OneMinusSrcAlphaFactor=Ve,e.DstAlphaFactor=206,e.OneMinusDstAlphaFactor=207,e.DstColorFactor=208,e.OneMinusDstColorFactor=209,e.SrcAlphaSaturateFactor=210,e.NeverDepth=K,e.AlwaysDepth=Q,e.LessDepth=$,e.LessEqualDepth=ee,e.EqualDepth=te,e.GreaterEqualDepth=ie,e.GreaterDepth=re,e.NotEqualDepth=ne,e.MultiplyOperation=F,e.MixOperation=B,e.AddOperation=z,e.NoToneMapping=G,e.LinearToneMapping=je,e.ReinhardToneMapping=H,e.Uncharted2ToneMapping=ae,e.CineonToneMapping=oe,e.UVMapping=300,e.CubeReflectionMapping=se,e.CubeRefractionMapping=ce,e.EquirectangularReflectionMapping=le,e.EquirectangularRefractionMapping=he,e.SphericalReflectionMapping=ue,e.CubeUVReflectionMapping=pe,e.CubeUVRefractionMapping=de,e.RepeatWrapping=1e3,e.ClampToEdgeWrapping=We,e.MirroredRepeatWrapping=1002,e.NearestFilter=Xe,e.NearestMipMapNearestFilter=qe,e.NearestMipMapLinearFilter=Ye,e.LinearFilter=Ze,e.LinearMipMapNearestFilter=1007,e.LinearMipMapLinearFilter=Je,e.UnsignedByteType=Ke,e.ByteType=1010,e.ShortType=1011,e.UnsignedShortType=Qe,e.IntType=1013,e.UnsignedIntType=$e,e.FloatType=et,e.HalfFloatType=tt,e.UnsignedShort4444Type=1017,e.UnsignedShort5551Type=1018,e.UnsignedShort565Type=1019,e.UnsignedInt248Type=it,e.AlphaFormat=1021,e.RGBFormat=rt,e.RGBAFormat=nt,e.LuminanceFormat=1024,e.LuminanceAlphaFormat=1025,e.RGBEFormat=l,e.DepthFormat=at,e.DepthStencilFormat=ot,e.RGB_S3TC_DXT1_Format=2001,e.RGBA_S3TC_DXT1_Format=2002,e.RGBA_S3TC_DXT3_Format=2003,e.RGBA_S3TC_DXT5_Format=2004,e.RGB_PVRTC_4BPPV1_Format=2100,e.RGB_PVRTC_2BPPV1_Format=2101,e.RGBA_PVRTC_4BPPV1_Format=2102,e.RGBA_PVRTC_2BPPV1_Format=2103,e.RGB_ETC1_Format=2151,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=2300,e.InterpolateLinear=2301,e.InterpolateSmooth=2302,e.ZeroCurvatureEnding=2400,e.ZeroSlopeEnding=2401,e.WrapAroundEnding=2402,e.TrianglesDrawMode=st,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=f,e.sRGBEncoding=h,e.GammaEncoding=m,e.RGBEEncoding=u,e.LogLuvEncoding=3003,e.RGBM7Encoding=p,e.RGBM16Encoding=d,e.RGBDEncoding=g,e.BasicDepthPacking=v,e.RGBADepthPacking=_,e.CubeGeometry=oo,e.Face4=function(e,t,i,r,n,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new yr(e,t,i,n,a,o)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial."),new ho(e)},e.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ma(e,t)},e.Particle=function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new oa(e)},e.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ma(e,t)},e.PointCloudMaterial=function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new fa(e)},e.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new fa(e)},e.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new fa(e)},e.Vertex=function(e,t,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new lt(e,t,i)},e.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new br(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wr(e,t)},e.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new _r(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Mr(e,t)},e.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Er(e,t)},e.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Tr(e,t)},e.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Sr(e,t)},e.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Lr(e,t)},e.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ar(e,t)},e.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Rr(e,t)},e.ClosedSplineCurve3=gl,e.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Jc(e,t)},e.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new da(new $a(e.geometry),new ua({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new da(new wa(e.geometry),new ua({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Mo(e)},e.GeometryUtils=vl,e.ImageUtils=yl,e.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},e.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(){}},Object.defineProperty(e,"__esModule",{value:!0})},"object"===(void 0===i?"undefined":_typeof(i))&&void 0!==t?n(i):"function"==typeof define&&define.amd?define(["exports"],n):n(r.THREE=r.THREE||{})},{}]},{},[1]);
|