text: !function(){"use strict";function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}),Object.assign(t.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var i=this._listeners[t];if(void 0!==i){var n=i.indexOf(e);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var i=e.slice(0),n=0,r=i.length;n<r;n++)i[n].call(this,t)}}}});for(var e=0,i=1,n=2,r=1,a=2,o=3,s=0,c=1,h=2,l=0,u=1,p=2,d=0,f=1,m=2,v=3,g=4,y=5,x=100,b=101,w=102,_=103,M=104,S=200,T=201,E=202,A=203,L=204,P=205,R=206,C=207,O=208,N=209,D=210,I=0,z=1,B=2,U=3,G=4,F=5,H=6,V=7,j=0,k=1,W=2,q=0,X=1,Y=2,J=3,Z=4,Q=5,K=301,$=302,tt=303,et=304,it=305,nt=306,rt=307,at=1e3,ot=1001,st=1002,ct=1003,ht=1004,lt=1005,ut=1006,pt=1007,dt=1008,ft=1009,mt=1010,vt=1011,gt=1012,yt=1013,xt=1014,bt=1015,wt=1016,_t=1017,Mt=1018,St=1019,Tt=1020,Et=1021,At=1022,Lt=1023,Pt=1024,Rt=1025,Ct=1026,Ot=1027,Nt=1028,Dt=33776,It=33777,zt=33778,Bt=33779,Ut=35840,Gt=35841,Ft=35842,Ht=35843,Vt=36196,jt=37808,kt=37809,Wt=37810,qt=37811,Xt=37812,Yt=37813,Jt=37814,Zt=37815,Qt=37816,Kt=37817,$t=37818,te=37819,ee=37820,ie=37821,ne=2201,re=2400,ae=0,oe=1,se=2,ce=3e3,he=3001,le=3007,ue=3002,pe=3003,de=3004,fe=3005,me=3006,ve=3200,ge=3201,ye=0,xe=1,be=7680,we=519,_e=[],Me=0;Me<256;Me++)_e[Me]=(Me<16?"0":"")+Me.toString(16);var Se={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(_e[255&t]+_e[t>>8&255]+_e[t>>16&255]+_e[t>>24&255]+"-"+_e[255&e]+_e[e>>8&255]+"-"+_e[e>>16&15|64]+_e[e>>24&255]+"-"+_e[63&i|128]+_e[i>>8&255]+"-"+_e[i>>16&255]+_e[i>>24&255]+_e[255&n]+_e[n>>8&255]+_e[n>>16&255]+_e[n>>24&255]).toUpperCase()},clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Se.DEG2RAD},radToDeg:function(t){return t*Se.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function Te(t,e){this.x=t||0,this.y=e||0}function Ee(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}Object.defineProperties(Te.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(Te.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}}),Object.assign(Ee,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,a,o){var s=i[n+0],c=i[n+1],h=i[n+2],l=i[n+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,v=s*u+c*p+h*d+l*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*g;if(s=s*m+u*w,c=c*m+p*w,h=h*m+d*w,l=l*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=_,c*=_,h*=_,l*=_}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),Object.defineProperties(Ee.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(Ee.prototype,{isQuaternion:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(i/2),h=o(n/2),l=o(r/2),u=s(i/2),p=s(n/2),d=s(r/2);return"XYZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"YXZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"ZXY"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"ZYX"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"YZX"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l-u*p*d):"XZY"===a&&(this._x=u*h*l-c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l+u*p*d),!1!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],p=n+s+u;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-h)*e,this._z=(o-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(l-c)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+h)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(a-h)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-r)/e,this._x=(a+h)/e,this._y=(c+l)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(Se.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var n=Math.min(1,e/i);return this.slerp(t,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+n*c-r*s,this._y=n*h+a*s+r*o-i*c,this._z=r*h+a*c+i*s-n*o,this._w=a*h-i*o-n*s-r*c,this._onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-e;return this._w=c*a+e*this._w,this._x=c*i+e*this._x,this._y=c*n+e*this._y,this._z=c*r+e*this._z,this.normalize(),this._onChangeCallback(),this}var h=Math.sqrt(s),l=Math.atan2(h,o),u=Math.sin((1-e)*l)/h,p=Math.sin(e*l)/h;return this._w=a*u+this._w*p,this._x=i*u+this._x*p,this._y=n*u+this._y*p,this._z=r*u+this._z*p,this._onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});var Ae=new Pe,Le=new Ee;function Pe(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}Object.assign(Pe.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Le.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(Le.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*i,h=s*i+o*e-r*n,l=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=c*s+u*-r+h*-o-l*-a,this.y=h*s+u*-a+l*-r-c*-o,this.z=l*s+u*-o+c*-a-h*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(t){return Ae.copy(this).projectOnVector(t),this.sub(Ae)},reflect:function(t){return this.sub(Ae.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Se.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,i){var n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}});var Re,Ce=new Pe;function Oe(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.assign(Oe.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=o,h[3]=e,h[4]=r,h[5]=s,h[6]=i,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(t){for(var e=0,i=t.count;e<i;e++)Ce.x=t.getX(e),Ce.y=t.getY(e),Ce.z=t.getZ(e),Ce.applyMatrix3(this),t.setXYZ(e,Ce.x,Ce.y,Ce.z);return t},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],c=i[1],h=i[4],l=i[7],u=i[2],p=i[5],d=i[8],f=n[0],m=n[3],v=n[6],g=n[1],y=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return r[0]=a*f+o*g+s*b,r[3]=a*m+o*y+s*w,r[6]=a*v+o*x+s*_,r[1]=c*f+h*g+l*b,r[4]=c*m+h*y+l*w,r[7]=c*v+h*x+l*_,r[2]=u*f+p*g+d*b,r[5]=u*m+p*y+d*w,r[8]=u*v+p*x+d*_,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-i*r*h+i*o*s+n*r*c-n*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var i=t.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=p*c-h*u,f=h*l-p*s,m=u*s-c*l,v=r*d+a*f+o*m;if(0===v){var g="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return n[0]=d*y,n[1]=(o*u-p*a)*y,n[2]=(h*a-o*c)*y,n[3]=f*y,n[4]=(p*r-o*l)*y,n[5]=(o*s-h*r)*y,n[6]=m*y,n[7]=(a*l-u*r)*y,n[8]=(c*r-a*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,i,n,r,a,o){var s=Math.cos(r),c=Math.sin(r);this.set(i*s,i*c,-i*(s*a+c*o)+a+t,-n*c,n*s,-n*(-c*a+s*o)+o+e,0,0,1)},scale:function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],a=n[3],o=n[6],s=n[1],c=n[4],h=n[7];return n[0]=e*r+i*s,n[3]=e*a+i*c,n[6]=e*o+i*h,n[1]=-i*r+e*s,n[4]=-i*a+e*c,n[7]=-i*o+e*h,this},translate:function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}});var Ne={getDataURL:function(t){var e;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Re&&(Re=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Re.width=t.width,Re.height=t.height;var i=Re.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=Re}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},De=0;function Ie(t,e,i,n,r,a,o,s,c,h){Object.defineProperty(this,"id",{value:De++}),this.uuid=Se.generateUUID(),this.name="",this.image=void 0!==t?t:Ie.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Ie.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:ot,this.wrapT=void 0!==n?n:ot,this.magFilter=void 0!==r?r:ut,this.minFilter=void 0!==a?a:dt,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Lt,this.type=void 0!==s?s:ft,this.offset=new Te(0,0),this.repeat=new Te(1,1),this.center=new Te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Oe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:ce,this.version=0,this.onUpdate=null}function ze(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function Be(t,e,i){this.width=t,this.height=e,this.scissor=new ze(0,0,t,e),this.scissorTest=!1,this.viewport=new ze(0,0,t,e),i=i||{},this.texture=new Ie(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:ut,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 Ue(t,e,i){Be.call(this,t,e,i),this.samples=4}Ie.DEFAULT_IMAGE=void 0,Ie.DEFAULT_MAPPING=300,Ie.prototype=Object.assign(Object.create(t.prototype),{constructor:Ie,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var 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 n=this.image;if(void 0===n.uuid&&(n.uuid=Se.generateUUID()),!e&&void 0===t.images[n.uuid]){var r;if(Array.isArray(n)){r=[];for(var a=0,o=n.length;a<o;a++)r.push(Ne.getDataURL(n[a]))}else r=Ne.getDataURL(n);t.images[n.uuid]={uuid:n.uuid,url:r}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case at:t.x=t.x-Math.floor(t.x);break;case ot:t.x=t.x<0?0:1;break;case st:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case at:t.y=t.y-Math.floor(t.y);break;case ot:t.y=t.y<0?0:1;break;case st:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(Ie.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.defineProperties(ze.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(ze.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,a=t.elements,o=a[0],s=a[4],c=a[8],h=a[1],l=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-h)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+l+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,v=(l+1)/2,g=(f+1)/2,y=(s+h)/4,x=(c+p)/4,b=(u+d)/4;return m>v&&m>g?m<.01?(i=0,n=.707106781,r=.707106781):(n=y/(i=Math.sqrt(m)),r=x/i):v>g?v<.01?(i=.707106781,n=0,r=.707106781):(i=y/(n=Math.sqrt(v)),r=b/n):g<.01?(i=.707106781,n=.707106781,r=0):(i=x/(r=Math.sqrt(g)),n=b/r),this.set(i,n,r,e),this}var w=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(h-s)*(h-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(c-p)/w,this.z=(h-s)/w,this.w=Math.acos((o+l+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Be.prototype=Object.assign(Object.create(t.prototype),{constructor:Be,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ue.prototype=Object.assign(Object.create(Be.prototype),{constructor:Ue,isWebGLMultisampleRenderTarget:!0,copy:function(t){return Be.prototype.copy.call(this,t),this.samples=t.samples,this}});var Ge=new Pe,Fe=new qe,He=new Pe(0,0,0),Ve=new Pe(1,1,1),je=new Pe,ke=new Pe,We=new Pe;function qe(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(qe.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,c,h,l,u,p,d,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=n,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[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 qe).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(t){var e=this.elements,i=t.elements,n=1/Ge.setFromMatrixColumn(t,0).length(),r=1/Ge.setFromMatrixColumn(t,1).length(),a=1/Ge.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),c=Math.sin(n),h=Math.cos(r),l=Math.sin(r);if("XYZ"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=u-f*c,e[9]=-o*s,e[2]=f-u*c,e[6]=d+p*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m-y*o,e[4]=-a*l,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=d*c-p,e[8]=u*c+f,e[1]=s*l,e[5]=f*c+u,e[9]=p*c-d,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,b=a*c,w=o*s,_=o*c;e[0]=s*h,e[4]=_-x*l,e[8]=w*l+b,e[1]=l,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=b*l+w,e[10]=x-_*l}else if("XZY"===t.order){x=a*s,b=a*c,w=o*s,_=o*c;e[0]=s*h,e[4]=-l,e[8]=c*h,e[1]=x*l+_,e[5]=a*h,e[9]=b*l-w,e[2]=w*l-b,e[6]=o*h,e[10]=_*l+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(He,t,Ve)},lookAt:function(t,e,i){var n=this.elements;return We.subVectors(t,e),0===We.lengthSq()&&(We.z=1),We.normalize(),je.crossVectors(i,We),0===je.lengthSq()&&(1===Math.abs(i.z)?We.x+=1e-4:We.z+=1e-4,We.normalize(),je.crossVectors(i,We)),je.normalize(),ke.crossVectors(We,je),n[0]=je.x,n[4]=ke.x,n[8]=We.x,n[1]=je.y,n[5]=ke.y,n[9]=We.y,n[2]=je.z,n[6]=ke.z,n[10]=We.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],b=i[15],w=n[0],_=n[4],M=n[8],S=n[12],T=n[1],E=n[5],A=n[9],L=n[13],P=n[2],R=n[6],C=n[10],O=n[14],N=n[3],D=n[7],I=n[11],z=n[15];return r[0]=a*w+o*T+s*P+c*N,r[4]=a*_+o*E+s*R+c*D,r[8]=a*M+o*A+s*C+c*I,r[12]=a*S+o*L+s*O+c*z,r[1]=h*w+l*T+u*P+p*N,r[5]=h*_+l*E+u*R+p*D,r[9]=h*M+l*A+u*C+p*I,r[13]=h*S+l*L+u*O+p*z,r[2]=d*w+f*T+m*P+v*N,r[6]=d*_+f*E+m*R+v*D,r[10]=d*M+f*A+m*C+v*I,r[14]=d*S+f*L+m*O+v*z,r[3]=g*w+y*T+x*P+b*N,r[7]=g*_+y*E+x*R+b*D,r[11]=g*M+y*A+x*C+b*I,r[15]=g*S+y*L+x*O+b*z,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(t){for(var e=0,i=t.count;e<i;e++)Ge.x=t.getX(e),Ge.y=t.getY(e),Ge.z=t.getZ(e),Ge.applyMatrix4(this),t.setXYZ(e,Ge.x,Ge.y,Ge.z);return t},determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+r*s*l-n*c*l-r*o*u+i*c*u+n*o*p-i*s*p)+t[7]*(+e*s*p-e*c*u+r*a*u-n*a*p+n*c*h-r*s*h)+t[11]*(+e*c*l-e*o*p-r*a*l+i*a*p+r*o*h-i*c*h)+t[15]*(-n*o*h-e*s*l+e*o*u+n*a*l-i*a*u+i*s*h)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t,e,i){var n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15],b=d*y*u-g*f*u+g*l*m-h*y*m-d*l*x+h*f*x,w=v*f*u-p*y*u-v*l*m+c*y*m+p*l*x-c*f*x,_=p*g*u-v*d*u+v*h*m-c*g*m-p*h*x+c*d*x,M=v*d*l-p*g*l-v*h*f+c*g*f+p*h*y-c*d*y,S=r*b+a*w+o*_+s*M;if(0===S){var T="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var E=1/S;return i[0]=b*E,i[1]=(g*f*s-d*y*s-g*o*m+a*y*m+d*o*x-a*f*x)*E,i[2]=(h*y*s-g*l*s+g*o*u-a*y*u-h*o*x+a*l*x)*E,i[3]=(d*l*s-h*f*s-d*o*u+a*f*u+h*o*m-a*l*m)*E,i[4]=w*E,i[5]=(p*y*s-v*f*s+v*o*m-r*y*m-p*o*x+r*f*x)*E,i[6]=(v*l*s-c*y*s-v*o*u+r*y*u+c*o*x-r*l*x)*E,i[7]=(c*f*s-p*l*s+p*o*u-r*f*u-c*o*m+r*l*m)*E,i[8]=_*E,i[9]=(v*d*s-p*g*s-v*a*m+r*g*m+p*a*x-r*d*x)*E,i[10]=(c*g*s-v*h*s+v*a*u-r*g*u-c*a*x+r*h*x)*E,i[11]=(p*h*s-c*d*s-p*a*u+r*d*u+c*a*m-r*h*m)*E,i[12]=M*E,i[13]=(p*g*o-v*d*o+v*a*f-r*g*f-p*a*y+r*d*y)*E,i[14]=(v*h*o-c*g*o-v*a*l+r*g*l+c*a*y-r*h*y)*E,i[15]=(c*d*o-p*h*o+p*a*l-r*d*l-c*a*f+r*h*f)*E,this},scale:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,c=r*a,h=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+i,h*s-n*a,0,c*s-n*o,h*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){var n=this.elements,r=e._x,a=e._y,o=e._z,s=e._w,c=r+r,h=a+a,l=o+o,u=r*c,p=r*h,d=r*l,f=a*h,m=a*l,v=o*l,g=s*c,y=s*h,x=s*l,b=i.x,w=i.y,_=i.z;return n[0]=(1-(f+v))*b,n[1]=(p+x)*b,n[2]=(d-y)*b,n[3]=0,n[4]=(p-x)*w,n[5]=(1-(u+v))*w,n[6]=(m+g)*w,n[7]=0,n[8]=(d+y)*_,n[9]=(m-g)*_,n[10]=(1-(u+f))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},decompose:function(t,e,i){var n=this.elements,r=Ge.set(n[0],n[1],n[2]).length(),a=Ge.set(n[4],n[5],n[6]).length(),o=Ge.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],Fe.copy(this);var s=1/r,c=1/a,h=1/o;return Fe.elements[0]*=s,Fe.elements[1]*=s,Fe.elements[2]*=s,Fe.elements[4]*=c,Fe.elements[5]*=c,Fe.elements[6]*=c,Fe.elements[8]*=h,Fe.elements[9]*=h,Fe.elements[10]*=h,e.setFromRotationMatrix(Fe),i.x=r,i.y=a,i.z=o,this},makePerspective:function(t,e,i,n,r,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*r/(e-t),c=2*r/(i-n),h=(e+t)/(e-t),l=(i+n)/(i-n),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,i,n,r,a){var o=this.elements,s=1/(e-t),c=1/(i-n),h=1/(a-r),l=(e+t)*s,u=(i+n)*c,p=(a+r)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}});var Xe=new qe,Ye=new Ee;function Je(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||Je.DefaultOrder}function Ze(){this.mask=1}Je.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Je.DefaultOrder="XYZ",Object.defineProperties(Je.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}}),Object.assign(Je.prototype,{isEuler:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=Se.clamp,r=t.elements,a=r[0],o=r[4],s=r[8],c=r[1],h=r[5],l=r[9],u=r[2],p=r[6],d=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this._onChangeCallback(),this},setFromQuaternion:function(t,e,i){return Xe.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Xe,e,i)},setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(t){return Ye.setFromEuler(this),this.setFromQuaternion(Ye,t)},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new Pe(this._x,this._y,this._z)},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),Object.assign(Ze.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},enableAll:function(){this.mask=-1},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},disableAll:function(){this.mask=0},test:function(t){return 0!=(this.mask&t.mask)}});var Qe=0,Ke=new Pe,$e=new Ee,ti=new qe,ei=new Pe,ii=new Pe,ni=new Pe,ri=new Ee,ai=new Pe(1,0,0),oi=new Pe(0,1,0),si=new Pe(0,0,1),ci={type:"added"},hi={type:"removed"};function li(){Object.defineProperty(this,"id",{value:Qe++}),this.uuid=Se.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=li.DefaultUp.clone();var t=new Pe,e=new Je,i=new Ee,n=new Pe(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new qe},normalMatrix:{value:new Oe}}),this.matrix=new qe,this.matrixWorld=new qe,this.matrixAutoUpdate=li.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Ze,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function ui(){li.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}li.DefaultUp=new Pe(0,1,0),li.DefaultMatrixAutoUpdate=!0,li.prototype=Object.assign(Object.create(t.prototype),{constructor:li,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return $e.setFromAxisAngle(t,e),this.quaternion.multiply($e),this},rotateOnWorldAxis:function(t,e){return $e.setFromAxisAngle(t,e),this.quaternion.premultiply($e),this},rotateX:function(t){return this.rotateOnAxis(ai,t)},rotateY:function(t){return this.rotateOnAxis(oi,t)},rotateZ:function(t){return this.rotateOnAxis(si,t)},translateOnAxis:function(t,e){return Ke.copy(t).applyQuaternion(this.quaternion),this.position.add(Ke.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(ai,t)},translateY:function(t){return this.translateOnAxis(oi,t)},translateZ:function(t){return this.translateOnAxis(si,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(ti.getInverse(this.matrixWorld))},lookAt:function(t,e,i){t.isVector3?ei.copy(t):ei.set(t,e,i);var n=this.parent;this.updateWorldMatrix(!0,!1),ii.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ti.lookAt(ii,ei,this.up):ti.lookAt(ei,ii,this.up),this.quaternion.setFromRotationMatrix(ti),n&&(ti.extractRotation(n.matrixWorld),$e.setFromRotationMatrix(ti),this.quaternion.premultiply($e.inverse()))},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(ci)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var i=this.children.indexOf(t);return-1!==i&&(t.parent=null,this.children.splice(i,1),t.dispatchEvent(hi)),this},attach:function(t){return this.updateWorldMatrix(!0,!1),ti.getInverse(this.matrixWorld),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),ti.multiply(t.parent.matrixWorld)),t.applyMatrix(ti),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Pe),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new Ee),this.updateMatrixWorld(!0),this.matrixWorld.decompose(ii,t,ni),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Pe),this.updateMatrixWorld(!0),this.matrixWorld.decompose(ii,ri,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Pe),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){var i=this.parent;if(!0===t&&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===e)for(var n=this.children,r=0,a=n.length;r<a;r++)n[r].updateWorldMatrix(!1,!0)},toJSON:function(t){var e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isMesh&&this.drawMode!==ae&&(n.drawMode=this.drawMode),this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var h=o[s];r(t.shapes,h)}else r(t.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var l=[];for(s=0,c=this.material.length;s<c;s++)l.push(r(t.materials,this.material[s]));n.material=l}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(t).object)}if(e){var u=m(t.geometries),p=m(t.materials),d=m(t.textures),f=m(t.images);o=m(t.shapes);u.length>0&&(i.geometries=u),p.length>0&&(i.materials=p),d.length>0&&(i.textures=d),f.length>0&&(i.images=f),o.length>0&&(i.shapes=o)}return i.object=n,i;function m(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}}),ui.prototype=Object.assign(Object.create(li.prototype),{constructor:ui,isScene:!0,copy:function(t,e){return li.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=li.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},dispose:function(){this.dispatchEvent({type:"dispose"})}});var pi=[new Pe,new Pe,new Pe,new Pe,new Pe,new Pe,new Pe,new Pe],di=new Pe,fi=new Pe,mi=new Pe,vi=new Pe,gi=new Pe,yi=new Pe,xi=new Pe,bi=new Pe,wi=new Pe,_i=new Pe,Mi=new Pe;function Si(t,e){this.min=void 0!==t?t:new Pe(1/0,1/0,1/0),this.max=void 0!==e?e:new Pe(-1/0,-1/0,-1/0)}function Ti(t,e,i,n,r){var a,o;for(a=0,o=t.length-3;a<=o;a+=3){Mi.fromArray(t,a);var s=r.x*Math.abs(Mi.x)+r.y*Math.abs(Mi.y)+r.z*Math.abs(Mi.z),c=e.dot(Mi),h=i.dot(Mi),l=n.dot(Mi);if(Math.max(-Math.max(c,h,l),Math.min(c,h,l))>s)return!1}return!0}Object.assign(Si.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var h=t.getX(s),l=t.getY(s),u=t.getZ(s);h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var i=di.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Pe),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Pe),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(t){var e,i;t.updateWorldMatrix(!1,!1);var n=t.geometry;if(void 0!==n)if(n.isGeometry){var r=n.vertices;for(e=0,i=r.length;e<i;e++)di.copy(r[e]),di.applyMatrix4(t.matrixWorld),this.expandByPoint(di)}else if(n.isBufferGeometry){var a=n.attributes.position;if(void 0!==a)for(e=0,i=a.count;e<i;e++)di.fromBufferAttribute(a,e).applyMatrix4(t.matrixWorld),this.expandByPoint(di)}var o=t.children;for(e=0,i=o.length;e<i;e++)this.expandByObject(o[e]);return this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Pe),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(t){return this.clampPoint(t.center,di),di.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return!1;this.getCenter(bi),wi.subVectors(this.max,bi),fi.subVectors(t.a,bi),mi.subVectors(t.b,bi),vi.subVectors(t.c,bi),gi.subVectors(mi,fi),yi.subVectors(vi,mi),xi.subVectors(fi,vi);var e=[0,-gi.z,gi.y,0,-yi.z,yi.y,0,-xi.z,xi.y,gi.z,0,-gi.x,yi.z,0,-yi.x,xi.z,0,-xi.x,-gi.y,gi.x,0,-yi.y,yi.x,0,-xi.y,xi.x,0];return!!Ti(e,fi,mi,vi,wi)&&(!!Ti(e=[1,0,0,0,1,0,0,0,1],fi,mi,vi,wi)&&(_i.crossVectors(gi,yi),Ti(e=[_i.x,_i.y,_i.z],fi,mi,vi,wi)))},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Pe),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return di.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(di).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()?this:(pi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),pi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),pi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),pi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),pi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),pi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),pi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),pi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(pi),this)},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Ei=new Si;function Ai(t,e){this.center=void 0!==t?t:new Pe,this.radius=void 0!==e?e:0}Object.assign(Ai.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(t,e){var i=this.center;void 0!==e?i.copy(e):Ei.setFromPoints(t).getCenter(i);for(var n=0,r=0,a=t.length;r<a;r++)n=Math.max(n,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Pe),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Si),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}});var Li=new Pe,Pi=new Pe,Ri=new Pe,Ci=new Pe,Oi=new Pe,Ni=new Pe,Di=new Pe;function Ii(t,e){this.origin=void 0!==t?t:new Pe,this.direction=void 0!==e?e:new Pe}Object.assign(Ii.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Pe),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,Li)),this},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Pe),e.subVectors(t,this.origin);var i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var e=Li.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Li.copy(this.direction).multiplyScalar(e).add(this.origin),Li.distanceToSquared(t))},distanceSqToSegment:function(t,e,i,n){Pi.copy(t).add(e).multiplyScalar(.5),Ri.copy(e).sub(t).normalize(),Ci.copy(this.origin).sub(Pi);var r,a,o,s,c=.5*t.distanceTo(e),h=-this.direction.dot(Ri),l=Ci.dot(this.direction),u=-Ci.dot(Ri),p=Ci.lengthSq(),d=Math.abs(1-h*h);if(d>0)if(a=h*l-u,s=c*d,(r=h*u-l)>=0)if(a>=-s)if(a<=s){var f=1/d;o=(r*=f)*(r+h*(a*=f)+2*l)+a*(h*r+a+2*u)+p}else a=c,o=-(r=Math.max(0,-(h*a+l)))*r+a*(a+2*u)+p;else a=-c,o=-(r=Math.max(0,-(h*a+l)))*r+a*(a+2*u)+p;else a<=-s?o=-(r=Math.max(0,-(-h*c+l)))*r+(a=r>0?-c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p:a<=s?(r=0,o=(a=Math.min(Math.max(-c,-u),c))*(a+2*u)+p):o=-(r=Math.max(0,-(h*c+l)))*r+(a=r>0?c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p;else a=h>0?-c:c,o=-(r=Math.max(0,-(h*a+l)))*r+a*(a+2*u)+p;return i&&i.copy(this.direction).multiplyScalar(r).add(this.origin),n&&n.copy(Ri).multiplyScalar(a).add(Pi),o},intersectSphere:function(t,e){Li.subVectors(t.center,this.origin);var i=Li.dot(this.direction),n=Li.dot(Li)-i*i,r=t.radius*t.radius;if(n>r)return null;var a=Math.sqrt(r-n),o=i-a,s=i+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,n,r,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(t.min.x-u.x)*c,n=(t.max.x-u.x)*c):(i=(t.max.x-u.x)*c,n=(t.min.x-u.x)*c),h>=0?(r=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),i>a||r>n?null:((r>i||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),l>=0?(o=(t.min.z-u.z)*l,s=(t.max.z-u.z)*l):(o=(t.max.z-u.z)*l,s=(t.min.z-u.z)*l),i>s||o>n?null:((o>i||i!=i)&&(i=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))},intersectsBox:function(t){return null!==this.intersectBox(t,Li)},intersectTriangle:function(t,e,i,n,r){Oi.subVectors(e,t),Ni.subVectors(i,t),Di.crossVectors(Oi,Ni);var a,o=this.direction.dot(Di);if(o>0){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Ci.subVectors(this.origin,t);var s=a*this.direction.dot(Ni.crossVectors(Ci,Ni));if(s<0)return null;var c=a*this.direction.dot(Oi.cross(Ci));if(c<0)return null;if(s+c>o)return null;var h=-a*Ci.dot(Di);return h<0?null:this.at(h/o,r)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}});var zi=new Pe,Bi=new Pe,Ui=new Pe,Gi=new Pe,Fi=new Pe,Hi=new Pe,Vi=new Pe,ji=new Pe,ki=new Pe,Wi=new Pe;function qi(t,e,i){this.a=void 0!==t?t:new Pe,this.b=void 0!==e?e:new Pe,this.c=void 0!==i?i:new Pe}Object.assign(qi,{getNormal:function(t,e,i,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new Pe),n.subVectors(i,e),zi.subVectors(t,e),n.cross(zi);var r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)},getBarycoord:function(t,e,i,n,r){zi.subVectors(n,e),Bi.subVectors(i,e),Ui.subVectors(t,e);var a=zi.dot(zi),o=zi.dot(Bi),s=zi.dot(Ui),c=Bi.dot(Bi),h=Bi.dot(Ui),l=a*c-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new Pe),0===l)return r.set(-2,-1,-1);var u=1/l,p=(c*s-o*h)*u,d=(a*h-o*s)*u;return r.set(1-p-d,d,p)},containsPoint:function(t,e,i,n){return qi.getBarycoord(t,e,i,n,Gi),Gi.x>=0&&Gi.y>=0&&Gi.x+Gi.y<=1},getUV:function(t,e,i,n,r,a,o,s){return this.getBarycoord(t,e,i,n,Gi),s.set(0,0),s.addScaledVector(r,Gi.x),s.addScaledVector(a,Gi.y),s.addScaledVector(o,Gi.z),s},isFrontFacing:function(t,e,i,n){return zi.subVectors(i,e),Bi.subVectors(t,e),zi.cross(Bi).dot(n)<0}}),Object.assign(qi.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){return zi.subVectors(this.c,this.b),Bi.subVectors(this.a,this.b),.5*zi.cross(Bi).length()},getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Pe),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return qi.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Pe),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return qi.getBarycoord(t,this.a,this.b,this.c,e)},getUV:function(t,e,i,n,r){return qi.getUV(t,this.a,this.b,this.c,e,i,n,r)},containsPoint:function(t){return qi.containsPoint(t,this.a,this.b,this.c)},isFrontFacing:function(t){return qi.isFrontFacing(this.a,this.b,this.c,t)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Pe);var i,n,r=this.a,a=this.b,o=this.c;Fi.subVectors(a,r),Hi.subVectors(o,r),ji.subVectors(t,r);var s=Fi.dot(ji),c=Hi.dot(ji);if(s<=0&&c<=0)return e.copy(r);ki.subVectors(t,a);var h=Fi.dot(ki),l=Hi.dot(ki);if(h>=0&&l<=h)return e.copy(a);var u=s*l-h*c;if(u<=0&&s>=0&&h<=0)return i=s/(s-h),e.copy(r).addScaledVector(Fi,i);Wi.subVectors(t,o);var p=Fi.dot(Wi),d=Hi.dot(Wi);if(d>=0&&p<=d)return e.copy(o);var f=p*c-s*d;if(f<=0&&c>=0&&d<=0)return n=c/(c-d),e.copy(r).addScaledVector(Hi,n);var m=h*d-p*l;if(m<=0&&l-h>=0&&p-d>=0)return Vi.subVectors(o,a),n=(l-h)/(l-h+(p-d)),e.copy(a).addScaledVector(Vi,n);var v=1/(m+f+u);return i=f*v,n=u*v,e.copy(r).addScaledVector(Fi,i).addScaledVector(Hi,n)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}});var Xi={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},Yi={h:0,s:0,l:0},Ji={h:0,s:0,l:0};function Zi(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function Qi(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Ki(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $i(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function tn(t,e,i,n,r,a){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new Pe,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new Zi,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Object.assign(Zi.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(t,e,i){if(t=Se.euclideanModulo(t,1),e=Se.clamp(e,0,1),i=Se.clamp(i,0,1),0===e)this.r=this.g=this.b=i;else{var n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Qi(r,n,t+1/3),this.g=Qi(r,n,t),this.b=Qi(r,n,t-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 n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h,l=(h=i[1]).length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}t&&t.length>0&&(void 0!==(h=Xi[t])?this.setHex(h):console.warn("THREE.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=Ki(t.r),this.g=Ki(t.g),this.b=Ki(t.b),this},copyLinearToSRGB:function(t){return this.r=$i(t.r),this.g=$i(t.g),this.b=$i(t.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,i,n=this.r,r=this.g,a=this.b,o=Math.max(n,r,a),s=Math.min(n,r,a),c=(s+o)/2;if(s===o)e=0,i=0;else{var h=o-s;switch(i=c<=.5?h/(o+s):h/(2-o-s),o){case n:e=(r-a)/h+(r<a?6:0);break;case r:e=(a-n)/h+2;break;case a:e=(n-r)/h+4}e/=6}return t.h=e,t.s=i,t.l=c,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,i){return this.getHSL(Yi),Yi.h+=t,Yi.s+=e,Yi.l+=i,this.setHSL(Yi.h,Yi.s,Yi.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},lerpHSL:function(t,e){this.getHSL(Yi),t.getHSL(Ji);var i=Se.lerp(Yi.h,Ji.h,e),n=Se.lerp(Yi.s,Ji.s,e),r=Se.lerp(Yi.l,Ji.l,e);return this.setHSL(i,n,r),this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}}),Object.assign(tn.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var en=0;function nn(){Object.defineProperty(this,"id",{value:en++}),this.uuid=Se.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=f,this.side=s,this.flatShading=!1,this.vertexTangents=!1,this.vertexColors=l,this.opacity=1,this.transparent=!1,this.blendSrc=L,this.blendDst=P,this.blendEquation=x,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilFunc=we,this.stencilRef=0,this.stencilMask=255,this.stencilFail=be,this.stencilZFail=be,this.stencilZPass=be,this.stencilWrite=!1,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.toneMapped=!0,this.userData={},this.needsUpdate=!0}function rn(t){nn.call(this),this.type="MeshBasicMaterial",this.color=new Zi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function an(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function on(t,e,i){an.call(this,new Int8Array(t),e,i)}function sn(t,e,i){an.call(this,new Uint8Array(t),e,i)}function cn(t,e,i){an.call(this,new Uint8ClampedArray(t),e,i)}function hn(t,e,i){an.call(this,new Int16Array(t),e,i)}function ln(t,e,i){an.call(this,new Uint16Array(t),e,i)}function un(t,e,i){an.call(this,new Int32Array(t),e,i)}function pn(t,e,i){an.call(this,new Uint32Array(t),e,i)}function dn(t,e,i){an.call(this,new Float32Array(t),e,i)}function fn(t,e,i){an.call(this,new Float64Array(t),e,i)}function mn(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function vn(t){if(0===t.length)return-1/0;for(var e=t[0],i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}nn.prototype=Object.assign(Object.create(t.prototype),{constructor:nn,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i)if("shading"!==e){var n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}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.emissiveIntensity&&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.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity,i.refractionRatio=this.refractionRatio,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(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==f&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),this.side!==s&&(i.side=this.side),this.vertexColors!==l&&(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,i.stencilWrite=this.stencilWrite,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilMask=this.stencilMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&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),this.linewidth&&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),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(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.morphNormals&&(i.morphNormals=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){var r=n(t.textures),a=n(t.images);r.length>0&&(i.textures=r),a.length>0&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWrite=t.stencilWrite,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilMask=t.stencilMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),rn.prototype=Object.create(nn.prototype),rn.prototype.constructor=rn,rn.prototype.isMeshBasicMaterial=!0,rn.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.defineProperty(an.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(an.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.itemSize:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new Zi),e[i++]=a.r,e[i++]=a.g,e[i++]=a.b}return this},copyVector2sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new Te),e[i++]=a.x,e[i++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new Pe),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new ze),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z,e[i++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),on.prototype=Object.create(an.prototype),on.prototype.constructor=on,sn.prototype=Object.create(an.prototype),sn.prototype.constructor=sn,cn.prototype=Object.create(an.prototype),cn.prototype.constructor=cn,hn.prototype=Object.create(an.prototype),hn.prototype.constructor=hn,ln.prototype=Object.create(an.prototype),ln.prototype.constructor=ln,un.prototype=Object.create(an.prototype),un.prototype.constructor=un,pn.prototype=Object.create(an.prototype),pn.prototype.constructor=pn,dn.prototype=Object.create(an.prototype),dn.prototype.constructor=dn,fn.prototype=Object.create(an.prototype),fn.prototype.constructor=fn,Object.assign(mn.prototype,{computeGroups:function(t){for(var e,i=[],n=void 0,r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,i.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,i=t.faces,n=t.vertices,r=t.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var h=0;h<c;h++)e[h]={name:s[h].name,data:[]};this.morphTargets.position=e}var l,u=t.morphNormals,p=u.length;if(p>0){l=[];for(h=0;h<p;h++)l[h]={name:u[h].name,data:[]};this.morphTargets.normal=l}var d=t.skinIndices,f=t.skinWeights,m=d.length===n.length,v=f.length===n.length;n.length>0&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(h=0;h<i.length;h++){var g=i[h];this.vertices.push(n[g.a],n[g.b],n[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var b,w=g.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=g.color;this.colors.push(_,_,_)}if(!0===a)void 0!==(b=r[0][h])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new Te,new Te,new Te));if(!0===o)void 0!==(b=r[1][h])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new Te,new Te,new Te));for(var M=0;M<c;M++){var S=s[M].vertices;e[M].data.push(S[g.a],S[g.b],S[g.c])}for(M=0;M<p;M++){var T=u[M].vertexNormals[h];l[M].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}});var gn=1,yn=new qe,xn=new li,bn=new Pe,wn=new Si,_n=new Si,Mn=new Pe;function Sn(){Object.defineProperty(this,"id",{value:gn+=2}),this.uuid=Se.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={}}Sn.prototype=Object.assign(Object.create(t.prototype),{constructor:Sn,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(vn(t)>65535?pn:ln)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new an(arguments[1],arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new Oe).getNormalMatrix(t).applyToBufferAttribute(i),i.needsUpdate=!0);var n=this.attributes.tangent;void 0!==n&&((new Oe).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return yn.makeRotationX(t),this.applyMatrix(yn),this},rotateY:function(t){return yn.makeRotationY(t),this.applyMatrix(yn),this},rotateZ:function(t){return yn.makeRotationZ(t),this.applyMatrix(yn),this},translate:function(t,e,i){return yn.makeTranslation(t,e,i),this.applyMatrix(yn),this},scale:function(t,e,i){return yn.makeScale(t,e,i),this.applyMatrix(yn),this},lookAt:function(t){return xn.lookAt(t),xn.updateMatrix(),this.applyMatrix(xn.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(bn).negate(),this.translate(bn.x,bn.y,bn.z),this},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new dn(3*e.vertices.length,3),n=new dn(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new dn(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];e.push(r.x,r.y,r.z||0)}return this.addAttribute("position",new dn(e,3)),this},updateFromObject:function(t){var e,i=t.geometry;if(t.isMesh){var n=i.__directGeometry;if(!0===i.elementsNeedUpdate&&(n=void 0,i.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(i);n.verticesNeedUpdate=i.verticesNeedUpdate,n.normalsNeedUpdate=i.normalsNeedUpdate,n.colorsNeedUpdate=i.colorsNeedUpdate,n.uvsNeedUpdate=i.uvsNeedUpdate,n.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=!1,i.normalsNeedUpdate=!1,i.colorsNeedUpdate=!1,i.uvsNeedUpdate=!1,i.groupsNeedUpdate=!1,i=n}return!0===i.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(i.vertices),e.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(i.normals),e.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(i.colors),e.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(i.uvs),e.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(i.lineDistances),e.needsUpdate=!0),i.lineDistancesNeedUpdate=!1),i.groupsNeedUpdate&&(i.computeGroups(t.geometry),this.groups=i.groups,i.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new mn).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new an(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new an(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new an(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new an(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new an(a,2).copyVector2sArray(t.uvs2))}for(var o in this.groups=t.groups,t.morphTargets){for(var s=[],c=t.morphTargets[o],h=0,l=c.length;h<l;h++){var u=c[h],p=new dn(3*u.data.length,3);p.name=u.name,s.push(p.copyVector3sArray(u.data))}this.morphAttributes[o]=s}if(t.skinIndices.length>0){var d=new dn(4*t.skinIndices.length,4);this.addAttribute("skinIndex",d.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var f=new dn(4*t.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Si);var t=this.attributes.position,e=this.morphAttributes.position;if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var i=0,n=e.length;i<n;i++){var r=e[i];wn.setFromBufferAttribute(r),this.boundingBox.expandByPoint(wn.min),this.boundingBox.expandByPoint(wn.max)}}else 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:function(){null===this.boundingSphere&&(this.boundingSphere=new Ai);var t=this.attributes.position,e=this.morphAttributes.position;if(t){var i=this.boundingSphere.center;if(wn.setFromBufferAttribute(t),e)for(var n=0,r=e.length;n<r;n++){var a=e[n];_n.setFromBufferAttribute(a),wn.expandByPoint(_n.min),wn.expandByPoint(_n.max)}wn.getCenter(i);var o=0;for(n=0,r=t.count;n<r;n++)Mn.fromBufferAttribute(t,n),o=Math.max(o,i.distanceToSquared(Mn));if(e)for(n=0,r=e.length;n<r;n++)for(var s=0,c=(a=e[n]).count;s<c;s++)Mn.fromBufferAttribute(a,s),o=Math.max(o,i.distanceToSquared(Mn));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new an(new Float32Array(i.length),3));else for(var n=e.normal.array,r=0,a=n.length;r<a;r++)n[r]=0;var o,s,c,h=e.normal.array,l=new Pe,u=new Pe,p=new Pe,d=new Pe,f=new Pe;if(t){var m=t.array;for(r=0,a=t.count;r<a;r+=3)o=3*m[r+0],s=3*m[r+1],c=3*m[r+2],l.fromArray(i,o),u.fromArray(i,s),p.fromArray(i,c),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),h[o]+=d.x,h[o+1]+=d.y,h[o+2]+=d.z,h[s]+=d.x,h[s+1]+=d.y,h[s+2]+=d.z,h[c]+=d.x,h[c+1]+=d.y,h[c+2]+=d.z}else for(r=0,a=i.length;r<a;r+=9)l.fromArray(i,r),u.fromArray(i,r+3),p.fromArray(i,r+6),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),h[r]=d.x,h[r+1]=d.y,h[r+2]=d.z,h[r+3]=d.x,h[r+4]=d.y,h[r+5]=d.z,h[r+6]=d.x,h[r+7]=d.y,h[r+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var i=this.attributes;for(var n in i)if(void 0!==t.attributes[n])for(var r=i[n].array,a=t.attributes[n],o=a.array,s=a.itemSize*e,c=Math.min(o.length,r.length-s),h=0,l=s;h<c;h++,l++)r[l]=o[h];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t=this.attributes.normal,e=0,i=t.count;e<i;e++)Mn.x=t.getX(e),Mn.y=t.getY(e),Mn.z=t.getZ(e),Mn.normalize(),t.setXYZ(e,Mn.x,Mn.y,Mn.z)},toNonIndexed:function(){function t(t,e){for(var i=t.array,n=t.itemSize,r=new i.constructor(e.length*n),a=0,o=0,s=0,c=e.length;s<c;s++){a=e[s]*n;for(var h=0;h<n;h++)r[o++]=i[a++]}return new an(r,n)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new Sn,i=this.index.array,n=this.attributes;for(var r in n){var a=t(n[r],i);e.addAttribute(r,a)}var o=this.morphAttributes;for(r in o){for(var s=[],c=o[r],h=0,l=c.length;h<l;h++){a=t(c[h],i);s.push(a)}e.morphAttributes[r]=s}for(var u=this.groups,p=(h=0,u.length);h<p;h++){var d=u[h];e.addGroup(d.start,d.count,d.materialIndex)}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;null!==n&&(t.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});var r=this.attributes;for(var i in r){var a=(p=r[i]).toJSON();""!==p.name&&(a.name=p.name),t.data.attributes[i]=a}var o={},s=!1;for(var i in this.morphAttributes){for(var c=this.morphAttributes[i],h=[],l=0,u=c.length;l<u;l++){var p;a=(p=c[l]).toJSON();""!==p.name&&(a.name=p.name),h.push(a)}h.length>0&&(o[i]=h,s=!0)}s&&(t.data.morphAttributes=o);var d=this.groups;d.length>0&&(t.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t},clone:function(){return(new Sn).copy(this)},copy:function(t){var e,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var c=[],h=s[e];for(i=0,n=h.length;i<n;i++)c.push(h[i].clone());this.morphAttributes[e]=c}var l=t.groups;for(i=0,n=l.length;i<n;i++){var u=l[i];this.addGroup(u.start,u.count,u.materialIndex)}var p=t.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=t.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Tn=new qe,En=new Ii,An=new Ai,Ln=new Pe,Pn=new Pe,Rn=new Pe,Cn=new Pe,On=new Pe,Nn=new Pe,Dn=new Pe,In=new Pe,zn=new Pe,Bn=new Te,Un=new Te,Gn=new Te,Fn=new Pe,Hn=new Pe;function Vn(t,e){li.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Sn,this.material=void 0!==e?e:new rn({color:16777215*Math.random()}),this.drawMode=ae,this.updateMorphTargets()}function jn(t,e,i,n,r,a,o,s){if(null===(e.side===c?n.intersectTriangle(o,a,r,!0,s):n.intersectTriangle(r,a,o,e.side!==h,s)))return null;Hn.copy(s),Hn.applyMatrix4(t.matrixWorld);var l=i.ray.origin.distanceTo(Hn);return l<i.near||l>i.far?null:{distance:l,point:Hn.clone(),object:t}}function kn(t,e,i,n,r,a,o,s,c,h,l){Ln.fromBufferAttribute(r,c),Pn.fromBufferAttribute(r,h),Rn.fromBufferAttribute(r,l);var u=t.morphTargetInfluences;if(e.morphTargets&&a&&u){Dn.set(0,0,0),In.set(0,0,0),zn.set(0,0,0);for(var p=0,d=a.length;p<d;p++){var f=u[p],m=a[p];0!==f&&(Cn.fromBufferAttribute(m,c),On.fromBufferAttribute(m,h),Nn.fromBufferAttribute(m,l),Dn.addScaledVector(Cn.sub(Ln),f),In.addScaledVector(On.sub(Pn),f),zn.addScaledVector(Nn.sub(Rn),f))}Ln.add(Dn),Pn.add(In),Rn.add(zn)}var v=jn(t,e,i,n,Ln,Pn,Rn,Fn);if(v){o&&(Bn.fromBufferAttribute(o,c),Un.fromBufferAttribute(o,h),Gn.fromBufferAttribute(o,l),v.uv=qi.getUV(Fn,Ln,Pn,Rn,Bn,Un,Gn,new Te)),s&&(Bn.fromBufferAttribute(s,c),Un.fromBufferAttribute(s,h),Gn.fromBufferAttribute(s,l),v.uv2=qi.getUV(Fn,Ln,Pn,Rn,Bn,Un,Gn,new Te));var g=new tn(c,h,l);qi.getNormal(Ln,Pn,Rn,g.normal),v.face=g}return v}Vn.prototype=Object.assign(Object.create(li.prototype),{constructor:Vn,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return li.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,e,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)i=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){var i,n=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),An.copy(n.boundingSphere),An.applyMatrix4(a),!1!==t.ray.intersectsSphere(An)&&(Tn.getInverse(a),En.copy(t.ray).applyMatrix4(Tn),null===n.boundingBox||!1!==En.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var o,s,c,h,l,u,p,d,f,m=n.index,v=n.attributes.position,g=n.morphAttributes.position,y=n.attributes.uv,x=n.attributes.uv2,b=n.groups,w=n.drawRange;if(null!==m)if(Array.isArray(r))for(h=0,u=b.length;h<u;h++)for(f=r[(d=b[h]).materialIndex],l=Math.max(d.start,w.start),p=Math.min(d.start+d.count,w.start+w.count);l<p;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(i=kn(this,f,t,En,v,g,y,x,o,s,c))&&(i.faceIndex=Math.floor(l/3),i.face.materialIndex=d.materialIndex,e.push(i));else for(h=Math.max(0,w.start),u=Math.min(m.count,w.start+w.count);h<u;h+=3)o=m.getX(h),s=m.getX(h+1),c=m.getX(h+2),(i=kn(this,r,t,En,v,g,y,x,o,s,c))&&(i.faceIndex=Math.floor(h/3),e.push(i));else if(void 0!==v)if(Array.isArray(r))for(h=0,u=b.length;h<u;h++)for(f=r[(d=b[h]).materialIndex],l=Math.max(d.start,w.start),p=Math.min(d.start+d.count,w.start+w.count);l<p;l+=3)(i=kn(this,f,t,En,v,g,y,x,o=l,s=l+1,c=l+2))&&(i.faceIndex=Math.floor(l/3),i.face.materialIndex=d.materialIndex,e.push(i));else for(h=Math.max(0,w.start),u=Math.min(v.count,w.start+w.count);h<u;h+=3)(i=kn(this,r,t,En,v,g,y,x,o=h,s=h+1,c=h+2))&&(i.faceIndex=Math.floor(h/3),e.push(i))}else if(n.isGeometry){var _,M,S,T,E=Array.isArray(r),A=n.vertices,L=n.faces,P=n.faceVertexUvs[0];P.length>0&&(T=P);for(var R=0,C=L.length;R<C;R++){var O=L[R],N=E?r[O.materialIndex]:r;if(void 0!==N&&(_=A[O.a],M=A[O.b],S=A[O.c],i=jn(this,N,t,En,_,M,S,Fn))){if(T&&T[R]){var D=T[R];Bn.copy(D[0]),Un.copy(D[1]),Gn.copy(D[2]),i.uv=qi.getUV(Fn,_,M,S,Bn,Un,Gn,new Te)}i.face=O,i.faceIndex=R,e.push(i)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Wn=0,qn=new qe,Xn=new li,Yn=new Pe;function Jn(){Object.defineProperty(this,"id",{value:Wn+=2}),this.uuid=Se.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 Zn(t,e,i,n,r,a){Jn.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Qn(t,e,i,n,r,a)),this.mergeVertices()}function Qn(t,e,i,n,r,a){Sn.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var o=this;t=t||1,e=e||1,i=i||1,n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var s=[],c=[],h=[],l=[],u=0,p=0;function d(t,e,i,n,r,a,d,f,m,v,g){var y,x,b=a/m,w=d/v,_=a/2,M=d/2,S=f/2,T=m+1,E=v+1,A=0,L=0,P=new Pe;for(x=0;x<E;x++){var R=x*w-M;for(y=0;y<T;y++){var C=y*b-_;P[t]=C*n,P[e]=R*r,P[i]=S,c.push(P.x,P.y,P.z),P[t]=0,P[e]=0,P[i]=f>0?1:-1,h.push(P.x,P.y,P.z),l.push(y/m),l.push(1-x/v),A+=1}}for(x=0;x<v;x++)for(y=0;y<m;y++){var O=u+y+T*x,N=u+y+T*(x+1),D=u+(y+1)+T*(x+1),I=u+(y+1)+T*x;s.push(O,N,I),s.push(N,D,I),L+=6}o.addGroup(p,L,g),p+=L,u+=A}d("z","y","x",-1,-1,i,e,t,a,r,0),d("z","y","x",1,-1,i,e,-t,a,r,1),d("x","z","y",1,1,t,i,e,n,a,2),d("x","z","y",1,-1,t,i,-e,n,a,3),d("x","y","z",1,-1,t,e,i,n,r,4),d("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(s),this.addAttribute("position",new dn(c,3)),this.addAttribute("normal",new dn(h,3)),this.addAttribute("uv",new dn(l,2))}function Kn(t){var e={};for(var i in t)for(var n in e[i]={},t[i]){var r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}return e}function $n(t){for(var e={},i=0;i<t.length;i++){var n=Kn(t[i]);for(var r in n)e[r]=n[r]}return e}Jn.prototype=Object.assign(Object.create(t.prototype),{constructor:Jn,isGeometry:!0,applyMatrix:function(t){for(var e=(new Oe).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++){this.vertices[i].applyMatrix4(t)}for(i=0,n=this.faces.length;i<n;i++){var r=this.faces[i];r.normal.applyMatrix3(e).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(t){return qn.makeRotationX(t),this.applyMatrix(qn),this},rotateY:function(t){return qn.makeRotationY(t),this.applyMatrix(qn),this},rotateZ:function(t){return qn.makeRotationZ(t),this.applyMatrix(qn),this},translate:function(t,e,i){return qn.makeTranslation(t,e,i),this.applyMatrix(qn),this},scale:function(t,e,i){return qn.makeScale(t,e,i),this.applyMatrix(qn),this},lookAt:function(t){return Xn.lookAt(t),Xn.updateMatrix(),this.applyMatrix(Xn.matrix),this},fromBufferGeometry:function(t){var e=this,i=null!==t.index?t.index.array:void 0,n=t.attributes,r=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,o=void 0!==n.color?n.color.array:void 0,s=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var h=0;h<r.length;h+=3)e.vertices.push((new Pe).fromArray(r,h)),void 0!==o&&e.colors.push((new Zi).fromArray(o,h));function l(t,i,n,r){var h=void 0===o?[]:[e.colors[t].clone(),e.colors[i].clone(),e.colors[n].clone()],l=new tn(t,i,n,void 0===a?[]:[(new Pe).fromArray(a,3*t),(new Pe).fromArray(a,3*i),(new Pe).fromArray(a,3*n)],h,r);e.faces.push(l),void 0!==s&&e.faceVertexUvs[0].push([(new Te).fromArray(s,2*t),(new Te).fromArray(s,2*i),(new Te).fromArray(s,2*n)]),void 0!==c&&e.faceVertexUvs[1].push([(new Te).fromArray(c,2*t),(new Te).fromArray(c,2*i),(new Te).fromArray(c,2*n)])}var u=t.groups;if(u.length>0)for(h=0;h<u.length;h++)for(var p=u[h],d=p.start,f=d,m=d+p.count;f<m;f+=3)void 0!==i?l(i[f],i[f+1],i[f+2],p.materialIndex):l(f,f+1,f+2,p.materialIndex);else if(void 0!==i)for(h=0;h<i.length;h+=3)l(i[h],i[h+1],i[h+2]);else for(h=0;h<r.length/3;h+=3)l(h,h+1,h+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Yn).negate(),this.translate(Yn.x,Yn.y,Yn.z),this},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new qe;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new Pe,e=new Pe,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var e,i,n,r,a,o;for(void 0===t&&(t=!0),o=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)o[e]=new Pe;if(t){var s,c,h,l=new Pe,u=new Pe;for(n=0,r=this.faces.length;n<r;n++)a=this.faces[n],s=this.vertices[a.a],c=this.vertices[a.b],h=this.vertices[a.c],l.subVectors(h,c),u.subVectors(s,c),l.cross(u),o[a.a].add(l),o[a.b].add(l),o[a.c].add(l)}else for(this.computeFaceNormals(),n=0,r=this.faces.length;n<r;n++)o[(a=this.faces[n]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,i=this.vertices.length;e<i;e++)o[e].normalize();for(n=0,r=this.faces.length;n<r;n++){var p=(a=this.faces[n]).vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(i=this.faces[t]).vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for((r=this.faces[i]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var a=new Jn;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)c=new Pe,h={a:new Pe,b:new Pe,c:new Pe},o.push(c),s.push(h)}var c,h,l=this.morphNormals[t];for(a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),i=0,n=this.faces.length;i<n;i++)r=this.faces[i],c=l.faceNormals[i],h=l.vertexNormals[i],c.copy(r.normal),h.a.copy(r.vertexNormals[0]),h.b.copy(r.vertexNormals[1]),h.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)(r=this.faces[i]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Si),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ai),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if(t&&t.isGeometry){var n,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,h=this.colors,l=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new Oe).getNormalMatrix(e));for(var u=0,p=o.length;u<p;u++){var d=o[u].clone();void 0!==e&&d.applyMatrix4(e),a.push(d)}for(u=0,p=l.length;u<p;u++)h.push(l[u].clone());for(u=0,p=c.length;u<p;u++){var f,m,v,g=c[u],y=g.vertexNormals,x=g.vertexColors;(f=new tn(g.a+r,g.b+r,g.c+r)).normal.copy(g.normal),void 0!==n&&f.normal.applyMatrix3(n).normalize();for(var b=0,w=y.length;b<w;b++)m=y[b].clone(),void 0!==n&&m.applyMatrix3(n).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(b=0,w=x.length;b<w;b++)v=x[b],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+i,s.push(f)}for(u=0,p=t.faceVertexUvs.length;u<p;u++){var _=t.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(b=0,w=_.length;b<w;b++){for(var M=_[b],S=[],T=0,E=M.length;T<E;T++)S.push(M[T].clone());this.faceVertexUvs[u].push(S)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,i,n,r,a,o,s,c={},h=[],l=[],u=Math.pow(10,4);for(i=0,n=this.vertices.length;i<n;i++)t=this.vertices[i],void 0===c[e=Math.round(t.x*u)+"_"+Math.round(t.y*u)+"_"+Math.round(t.z*u)]?(c[e]=i,h.push(this.vertices[i]),l[i]=h.length-1):l[i]=l[c[e]];var p=[];for(i=0,n=this.faces.length;i<n;i++){(r=this.faces[i]).a=l[r.a],r.b=l[r.b],r.c=l[r.c],a=[r.a,r.b,r.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(i);break}}for(i=p.length-1;i>=0;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-h.length;return this.vertices=h,m},setFromPoints:function(t){this.vertices=[];for(var e=0,i=t.length;e<i;e++){var n=t[e];this.vertices.push(new Pe(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,i=0;i<e;i++)t[i]._id=i;t.sort((function(t,e){return t.materialIndex-e.materialIndex}));var n,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===e&&(n=[]),o&&o.length===e&&(r=[]);for(i=0;i<e;i++){var s=t[i]._id;n&&n.push(a[s]),r&&r.push(o[s])}n&&(this.faceVertexUvs[0]=n),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}for(var n=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];n.push(a.x,a.y,a.z)}var o=[],s=[],c={},h=[],l={},u=[],p={};for(r=0;r<this.faces.length;r++){var d=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=d.normal.length()>0,v=d.vertexNormals.length>0,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,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,v),x=M(x,6,g),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][r];o.push(E(b[0]),E(b[1]),E(b[2]))}if(m&&o.push(S(d.normal)),v){var w=d.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(g&&o.push(T(d.color)),y){var _=d.vertexColors;o.push(T(_[0]),T(_[1]),T(_[2]))}}function M(t,e,i){return i?t|1<<e:t&~(1<<e)}function S(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]?c[e]:(c[e]=s.length/3,s.push(t.x,t.y,t.z),c[e])}function T(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==l[e]?l[e]:(l[e]=h.length,h.push(t.getHex()),l[e])}function E(t){var e=t.x.toString()+t.y.toString();return void 0!==p[e]?p[e]:(p[e]=u.length/2,u.push(t.x,t.y),p[e])}return t.data={},t.data.vertices=n,t.data.normals=s,h.length>0&&(t.data.colors=h),u.length>0&&(t.data.uvs=[u]),t.data.faces=o,t},clone:function(){return(new Jn).copy(this)},copy:function(t){var e,i,n,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,i=s.length;e<i;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,i=c.length;e<i;e++)this.colors.push(c[e].clone());var h=t.faces;for(e=0,i=h.length;e<i;e++)this.faces.push(h[e].clone());for(e=0,i=t.faceVertexUvs.length;e<i;e++){var l=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),n=0,r=l.length;n<r;n++){var u=l[n],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[e].push(p)}}var f=t.morphTargets;for(e=0,i=f.length;e<i;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],n=0,r=f[e].vertices.length;n<r;n++)m.vertices.push(f[e].vertices[n].clone());if(void 0!==f[e].normals)for(m.normals=[],n=0,r=f[e].normals.length;n<r;n++)m.normals.push(f[e].normals[n].clone());this.morphTargets.push(m)}var v=t.morphNormals;for(e=0,i=v.length;e<i;e++){var g={};if(void 0!==v[e].vertexNormals)for(g.vertexNormals=[],n=0,r=v[e].vertexNormals.length;n<r;n++){var y=v[e].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[e].faceNormals)for(g.faceNormals=[],n=0,r=v[e].faceNormals.length;n<r;n++)g.faceNormals.push(v[e].faceNormals[n].clone());this.morphNormals.push(g)}var b=t.skinWeights;for(e=0,i=b.length;e<i;e++)this.skinWeights.push(b[e].clone());var w=t.skinIndices;for(e=0,i=w.length;e<i;e++)this.skinIndices.push(w[e].clone());var _=t.lineDistances;for(e=0,i=_.length;e<i;e++)this.lineDistances.push(_[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=t.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Zn.prototype=Object.create(Jn.prototype),Zn.prototype.constructor=Zn,Qn.prototype=Object.create(Sn.prototype),Qn.prototype.constructor=Qn;var tr="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",er="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function ir(t){nn.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=tr,this.fragmentShader=er,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function nr(){li.call(this),this.type="Camera",this.matrixWorldInverse=new qe,this.projectionMatrix=new qe,this.projectionMatrixInverse=new qe}function rr(t,e,i,n){nr.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}ir.prototype=Object.create(nn.prototype),ir.prototype.constructor=ir,ir.prototype.isShaderMaterial=!0,ir.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Kn(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},ir.prototype.toJSON=function(t){var e=nn.prototype.toJSON.call(this,t);for(var i in e.uniforms={},this.uniforms){var n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(e.extensions=r),e},nr.prototype=Object.assign(Object.create(li.prototype),{constructor:nr,isCamera:!0,copy:function(t,e){return li.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Pe),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){li.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),rr.prototype=Object.assign(Object.create(nr.prototype),{constructor:rr,isPerspectiveCamera:!0,copy:function(t,e){return nr.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Se.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Se.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Se.RAD2DEG*Math.atan(Math.tan(.5*Se.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Se.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/o,e-=a.offsetY*i/s,n*=a.width/o,i*=a.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=li.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});var ar=90,or=1;function sr(t,e,i,n){li.call(this),this.type="CubeCamera";var r=new rr(ar,or,t,e);r.up.set(0,-1,0),r.lookAt(new Pe(1,0,0)),this.add(r);var a=new rr(ar,or,t,e);a.up.set(0,-1,0),a.lookAt(new Pe(-1,0,0)),this.add(a);var o=new rr(ar,or,t,e);o.up.set(0,0,1),o.lookAt(new Pe(0,1,0)),this.add(o);var s=new rr(ar,or,t,e);s.up.set(0,0,-1),s.lookAt(new Pe(0,-1,0)),this.add(s);var c=new rr(ar,or,t,e);c.up.set(0,-1,0),c.lookAt(new Pe(0,0,1)),this.add(c);var h=new rr(ar,or,t,e);h.up.set(0,-1,0),h.lookAt(new Pe(0,0,-1)),this.add(h),n=n||{format:At,magFilter:ut,minFilter:ut},this.renderTarget=new cr(i,i,n),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=t.getRenderTarget(),n=this.renderTarget,l=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,a),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,c),n.texture.generateMipmaps=l,t.setRenderTarget(n,5),t.render(e,h),t.setRenderTarget(i)},this.clear=function(t,e,i,n){for(var r=t.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)t.setRenderTarget(a,o),t.clear(e,i,n);t.setRenderTarget(r)}}function cr(t,e,i){Be.call(this,t,e,i)}function hr(t,e,i,n,r,a,o,s,c,h,l,u){Ie.call(this,null,a,o,s,c,h,n,r,l,u),this.image={data:t,width:e,height:i},this.magFilter=void 0!==c?c:ct,this.minFilter=void 0!==h?h:ct,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}sr.prototype=Object.create(li.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(Be.prototype),cr.prototype.constructor=cr,cr.prototype.isWebGLRenderTargetCube=!0,cr.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=e.format,this.texture.encoding=e.encoding;var i=new ui,n={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new ir({type:"CubemapFromEquirect",uniforms:Kn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:c,blending:d});r.uniforms.tEquirect.value=e;var a=new Vn(new Qn(5,5,5),r);i.add(a);var o=new sr(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(t,i),a.geometry.dispose(),a.material.dispose(),this},hr.prototype=Object.create(Ie.prototype),hr.prototype.constructor=hr,hr.prototype.isDataTexture=!0;var lr=new Pe,ur=new Pe,pr=new Oe;function dr(t,e){this.normal=void 0!==t?t:new Pe(1,0,0),this.constant=void 0!==e?e:0}Object.assign(dr.prototype,{isPlane:!0,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(t,e,i){var n=lr.subVectors(i,e).cross(ur.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Pe),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Pe);var i=t.delta(lr),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;var r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?void 0:e.copy(i).multiplyScalar(r).add(t.start)},intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Pe),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(t,e){var i=e||pr.getNormalMatrix(t),n=this.coplanarPoint(lr).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this},translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}});var fr=new Ai,mr=new Pe;function vr(t,e,i,n,r,a){this.planes=[void 0!==t?t:new dr,void 0!==e?e:new dr,void 0!==i?i:new dr,void 0!==n?n:new dr,void 0!==r?r:new dr,void 0!==a?a:new dr]}Object.assign(vr.prototype,{set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return e[0].setComponents(o-n,l-s,f-u,y-m).normalize(),e[1].setComponents(o+n,l+s,f+u,y+m).normalize(),e[2].setComponents(o+r,l+c,f+p,y+v).normalize(),e[3].setComponents(o-r,l-c,f-p,y-v).normalize(),e[4].setComponents(o-a,l-h,f-d,y-g).normalize(),e[5].setComponents(o+a,l+h,f+d,y+g).normalize(),this},intersectsObject:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),fr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(fr)},intersectsSprite:function(t){return fr.center.set(0,0,0),fr.radius=.7071067811865476,fr.applyMatrix4(t.matrixWorld),this.intersectsSphere(fr)},intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(i)<n)return!1}return!0},intersectsBox:function(t){for(var e=this.planes,i=0;i<6;i++){var n=e[i];if(mr.x=n.normal.x>0?t.max.x:t.min.x,mr.y=n.normal.y>0?t.max.y:t.min.y,mr.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(mr)<0)return!1}return!0},containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}});var gr={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( STANDARD )\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}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( 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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, 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_RoughnessDependent( specularColor, dotNV, roughness );\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}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha  = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",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( STANDARD ) && ! 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( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! 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 whiteComplement(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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\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#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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#ifdef ENV_WORLDPOS\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_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\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\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\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 )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t  vec3 reflectVec = reflect( -viewDir, normal );\n\t\t  reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, 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, roughness );\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#ifdef ENV_WORLDPOS\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 = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\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;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\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 REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#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#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\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 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\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\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 );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\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#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\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#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\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#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\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 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\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( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, 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, iblIrradiance, 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\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, normalScale, normalMap );\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#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 normalScale, in sampler2D normalMap ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy *= normalScale;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvec3 NfromST = cross( S, T );\n\t\t\tif( dot( NfromST, N ) > 0.0 ) {\n\t\t\t\tS *= -1.0;\n\t\t\t\tT *= -1.0;\n\t\t\t}\n\t\t#else\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, clearcoatNormal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = clearcoatNormalScale * mapN.xy;\n\t\tclearcoatNormal = normalize( vTBN * mapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\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}\nvec4 encodeHalfRGBA ( vec2 v ) {\n\tvec4 encoded = vec4( 0.0 );\n\tconst vec2 offset = vec2( 1.0 / 255.0, 0.0 );\n\tencoded.xy = vec2( v.x, fract( v.x * 255.0 ) );\n\tencoded.xy = encoded.xy - ( encoded.yy * offset );\n\tencoded.zw = vec2( v.y, fract( v.y * 255.0 ) );\n\tencoded.zw = encoded.zw - ( encoded.ww * offset );\n\treturn encoded;\n}\nvec2 decodeHalfRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\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:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef 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_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn decodeHalfRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\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 ) + 0.5 ) * texelSize;\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\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( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.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#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\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 ) || defined( SHADOWMAP_TYPE_VSM )\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_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; 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_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; 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_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; 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_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; 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 highp 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:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\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_common_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_common_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_common_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 STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\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_common_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 <clearcoat_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 <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_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\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\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 STANDARD\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( TANGENTSPACE_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>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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( TANGENTSPACE_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>\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#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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_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}"},yr={common:{diffuse:{value:new Zi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Oe},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 Te(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 Zi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{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 Zi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new Oe}},sprite:{diffuse:{value:new Zi(15658734)},opacity:{value:1},center:{value:new Te(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new Oe}}},xr={basic:{uniforms:$n([yr.common,yr.specularmap,yr.envmap,yr.aomap,yr.lightmap,yr.fog]),vertexShader:gr.meshbasic_vert,fragmentShader:gr.meshbasic_frag},lambert:{uniforms:$n([yr.common,yr.specularmap,yr.envmap,yr.aomap,yr.lightmap,yr.emissivemap,yr.fog,yr.lights,{emissive:{value:new Zi(0)}}]),vertexShader:gr.meshlambert_vert,fragmentShader:gr.meshlambert_frag},phong:{uniforms:$n([yr.common,yr.specularmap,yr.envmap,yr.aomap,yr.lightmap,yr.emissivemap,yr.bumpmap,yr.normalmap,yr.displacementmap,yr.gradientmap,yr.fog,yr.lights,{emissive:{value:new Zi(0)},specular:{value:new Zi(1118481)},shininess:{value:30}}]),vertexShader:gr.meshphong_vert,fragmentShader:gr.meshphong_frag},standard:{uniforms:$n([yr.common,yr.envmap,yr.aomap,yr.lightmap,yr.emissivemap,yr.bumpmap,yr.normalmap,yr.displacementmap,yr.roughnessmap,yr.metalnessmap,yr.fog,yr.lights,{emissive:{value:new Zi(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:gr.meshphysical_vert,fragmentShader:gr.meshphysical_frag},matcap:{uniforms:$n([yr.common,yr.bumpmap,yr.normalmap,yr.displacementmap,yr.fog,{matcap:{value:null}}]),vertexShader:gr.meshmatcap_vert,fragmentShader:gr.meshmatcap_frag},points:{uniforms:$n([yr.points,yr.fog]),vertexShader:gr.points_vert,fragmentShader:gr.points_frag},dashed:{uniforms:$n([yr.common,yr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gr.linedashed_vert,fragmentShader:gr.linedashed_frag},depth:{uniforms:$n([yr.common,yr.displacementmap]),vertexShader:gr.depth_vert,fragmentShader:gr.depth_frag},normal:{uniforms:$n([yr.common,yr.bumpmap,yr.normalmap,yr.displacementmap,{opacity:{value:1}}]),vertexShader:gr.normal_vert,fragmentShader:gr.normal_frag},sprite:{uniforms:$n([yr.sprite,yr.fog]),vertexShader:gr.sprite_vert,fragmentShader:gr.sprite_frag},background:{uniforms:{uvTransform:{value:new Oe},t2D:{value:null}},vertexShader:gr.background_vert,fragmentShader:gr.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:gr.cube_vert,fragmentShader:gr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gr.equirect_vert,fragmentShader:gr.equirect_frag},distanceRGBA:{uniforms:$n([yr.common,yr.displacementmap,{referencePosition:{value:new Pe},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gr.distanceRGBA_vert,fragmentShader:gr.distanceRGBA_frag},shadow:{uniforms:$n([yr.lights,yr.fog,{color:{value:new Zi(0)},opacity:{value:1}}]),vertexShader:gr.shadow_vert,fragmentShader:gr.shadow_frag}};function br(){var t=null,e=!1,i=null;function n(r,a){!1!==e&&(i(r,a),t.requestAnimationFrame(n))}return{start:function(){!0!==e&&null!==i&&(t.requestAnimationFrame(n),e=!0)},stop:function(){e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function wr(t){var e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);var n=e.get(i);n&&(t.deleteBuffer(n.buffer),e.delete(i))},update:function(i,n){i.isInterleavedBufferAttribute&&(i=i.data);var r=e.get(i);void 0===r?e.set(i,function(e,i){var n=e.array,r=e.dynamic?35048:35044,a=t.createBuffer();t.bindBuffer(i,a),t.bufferData(i,n,r),e.onUploadCallback();var o=5126;return n instanceof Float32Array?o=5126:n instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?o=5123:n instanceof Int16Array?o=5122:n instanceof Uint32Array?o=5125:n instanceof Int32Array?o=5124:n instanceof Int8Array?o=5120:n instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}(i,n)):r.version<i.version&&(!function(e,i,n){var r=i.array,a=i.updateRange;t.bindBuffer(n,e),!1===i.dynamic?t.bufferData(n,r,35044):-1===a.count?t.bufferSubData(n,0,r):0===a.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."):(t.bufferSubData(n,a.offset*r.BYTES_PER_ELEMENT,r.subarray(a.offset,a.offset+a.count)),a.count=-1)}(r.buffer,i,n),r.version=i.version)}}}function _r(t,e,i,n){Jn.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new Mr(t,e,i,n)),this.mergeVertices()}function Mr(t,e,i,n){Sn.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};var r,a,o=(t=t||1)/2,s=(e=e||1)/2,c=Math.floor(i)||1,h=Math.floor(n)||1,l=c+1,u=h+1,p=t/c,d=e/h,f=[],m=[],v=[],g=[];for(a=0;a<u;a++){var y=a*d-s;for(r=0;r<l;r++){var x=r*p-o;m.push(x,-y,0),v.push(0,0,1),g.push(r/c),g.push(1-a/h)}}for(a=0;a<h;a++)for(r=0;r<c;r++){var b=r+l*a,w=r+l*(a+1),_=r+1+l*(a+1),M=r+1+l*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.addAttribute("position",new dn(m,3)),this.addAttribute("normal",new dn(v,3)),this.addAttribute("uv",new dn(g,2))}function Sr(t,e,i,n){var r,a,o=new Zi(0),h=0,l=null,u=0;function p(t,i){e.buffers.color.setClear(t.r,t.g,t.b,i,n)}return{getClearColor:function(){return o},setClearColor:function(t,e){o.set(t),p(o,h=void 0!==e?e:1)},getClearAlpha:function(){return h},setClearAlpha:function(t){p(o,h=t)},render:function(e,n,d,f){var m=n.background,v=t.vr,g=v.getSession&&v.getSession();if(g&&"additive"===g.environmentBlendMode&&(m=null),null===m?(p(o,h),l=null,u=0):m&&m.isColor&&(p(m,1),f=!0,l=null,u=0),(t.autoClear||f)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLRenderTargetCube)){void 0===a&&((a=new Vn(new Qn(1,1,1),new ir({type:"BackgroundCubeMaterial",uniforms:Kn(xr.cube.uniforms),vertexShader:xr.cube.vertexShader,fragmentShader:xr.cube.fragmentShader,side:c,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),a.geometry.removeAttribute("uv"),a.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.tCube.value}}),i.update(a));var y=m.isWebGLRenderTargetCube?m.texture:m;a.material.uniforms.tCube.value=y,a.material.uniforms.tFlip.value=m.isWebGLRenderTargetCube?1:-1,l===m&&u===y.version||(a.material.needsUpdate=!0,l=m,u=y.version),e.unshift(a,a.geometry,a.material,0,0,null)}else m&&m.isTexture&&(void 0===r&&((r=new Vn(new Mr(2,2),new ir({type:"BackgroundMaterial",uniforms:Kn(xr.background.uniforms),vertexShader:xr.background.vertexShader,fragmentShader:xr.background.fragmentShader,side:s,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(r)),r.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),r.material.uniforms.uvTransform.value.copy(m.matrix),l===m&&u===m.version||(r.material.needsUpdate=!0,l=m,u=m.version),e.unshift(r,r.geometry,r.material,0,0,null))}}}function Tr(t,e,i,n){var r;this.setMode=function(t){r=t},this.render=function(e,n){t.drawArrays(r,e,n),i.update(n,r)},this.renderInstances=function(a,o,s){var c,h;if(n.isWebGL2)c=t,h="drawArraysInstanced";else if(h="drawArraysInstancedANGLE",null===(c=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](r,o,s,a.maxInstancedCount),i.update(s,r,a.maxInstancedCount)}}function Er(t,e,i){var n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===i.logarithmicDepthBuffer,h=t.getParameter(34930),l=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),v=t.getParameter(36349),g=l>0,y=a||!!e.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==n)return n;var i=e.get("EXT_texture_filter_anisotropic");return n=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?t.getParameter(36183):0}}function Ar(){var t=this,e=null,i=0,n=!1,r=!1,a=new dr,o=new Oe,s={value:null,needsUpdate:!1};function c(){s.value!==e&&(s.value=e,s.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function h(e,i,n,r){var c=null!==e?e.length:0,h=null;if(0!==c){if(h=s.value,!0!==r||null===h){var l=n+4*c,u=i.matrixWorldInverse;o.getNormalMatrix(u),(null===h||h.length<l)&&(h=new Float32Array(l));for(var p=0,d=n;p!==c;++p,d+=4)a.copy(e[p]).applyMatrix4(u,o),a.normal.toArray(h,d),h[d+3]=a.constant}s.value=h,s.needsUpdate=!0}return t.numPlanes=c,h}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(t,r,a){var o=0!==t.length||r||0!==i||n;return n=r,e=h(t,a,0),i=t.length,o},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1,c()},this.setState=function(t,a,o,l,u,p){if(!n||null===t||0===t.length||r&&!o)r?h(null):c();else{var d=r?0:i,f=4*d,m=u.clippingState||null;s.value=m,m=h(t,l,f,p);for(var v=0;v!==f;++v)m[v]=e[v];u.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=d}}}function Lr(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function Pr(t,e,i){var n=new WeakMap,r=new WeakMap;function a(t){var o=t.target,s=n.get(o);for(var c in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[c]);o.removeEventListener("dispose",a),n.delete(o);var h=r.get(s);h&&(e.remove(h),r.delete(s)),i.memory.geometries--}function o(t){var i=[],n=t.index,a=t.attributes.position,o=0;if(null!==n){var s=n.array;o=n.version;for(var c=0,h=s.length;c<h;c+=3){var l=s[c+0],u=s[c+1],p=s[c+2];i.push(l,u,u,p,p,l)}}else{s=a.array;o=a.version;for(c=0,h=s.length/3-1;c<h;c+=3){l=c+0,u=c+1,p=c+2;i.push(l,u,u,p,p,l)}}var d=new(vn(i)>65535?pn:ln)(i,1);d.version=o,e.update(d,34963);var f=r.get(t);f&&e.remove(f),r.set(t,d)}return{get:function(t,e){var r=n.get(e);return r||(e.addEventListener("dispose",a),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Sn).setFromObject(t)),r=e._bufferGeometry),n.set(e,r),i.memory.geometries++,r)},update:function(t){var i=t.index,n=t.attributes;for(var r in null!==i&&e.update(i,34963),n)e.update(n[r],34962);var a=t.morphAttributes;for(var r in a)for(var o=a[r],s=0,c=o.length;s<c;s++)e.update(o[s],34962)},getWireframeAttribute:function(t){var e=r.get(t);if(e){var i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return r.get(t)}}}function Rr(t,e,i,n){var r,a,o;this.setMode=function(t){r=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,n){t.drawElements(r,n,a,e*o),i.update(n,r)},this.renderInstances=function(s,c,h){var l,u;if(n.isWebGL2)l=t,u="drawElementsInstanced";else if(u="drawElementsInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](r,h,a,c*o,s.maxInstancedCount),i.update(h,r,s.maxInstancedCount)}}function Cr(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(n=n||1,e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 5:case 6:e.triangles+=n*(t-2);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Or(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Nr(t){var e={},i=new Float32Array(8);return{update:function(n,r,a,o){var s=n.morphTargetInfluences,c=s.length,h=e[r.id];if(void 0===h){h=[];for(var l=0;l<c;l++)h[l]=[l,0];e[r.id]=h}var u=a.morphTargets&&r.morphAttributes.position,p=a.morphNormals&&r.morphAttributes.normal;for(l=0;l<c;l++){0!==(d=h[l])[1]&&(u&&r.removeAttribute("morphTarget"+l),p&&r.removeAttribute("morphNormal"+l))}for(l=0;l<c;l++){(d=h[l])[0]=l,d[1]=s[l]}for(h.sort(Or),l=0;l<8;l++){var d;if(d=h[l]){var f=d[0],m=d[1];if(m){u&&r.addAttribute("morphTarget"+l,u[f]),p&&r.addAttribute("morphNormal"+l,p[f]),i[l]=m;continue}}i[l]=0}o.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function Dr(t,e){var i={};return{update:function(n){var r=e.render.frame,a=n.geometry,o=t.get(n,a);return i[o.id]!==r&&(a.isGeometry&&o.updateFromObject(n),t.update(o),i[o.id]=r),o},dispose:function(){i={}}}}function Ir(t,e,i,n,r,a,o,s,c,h){t=void 0!==t?t:[],e=void 0!==e?e:K,o=void 0!==o?o:At,Ie.call(this,t,e,i,n,r,a,o,s,c,h),this.flipY=!1}function zr(t,e,i,n){Ie.call(this,null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=ct,this.minFilter=ct,this.wrapR=ot,this.generateMipmaps=!1,this.flipY=!1}function Br(t,e,i,n){Ie.call(this,null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=ct,this.minFilter=ct,this.wrapR=ot,this.generateMipmaps=!1,this.flipY=!1}xr.physical={uniforms:$n([xr.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new Zi(0)},clearcoatNormalScale:{value:new Te(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:gr.meshphysical_vert,fragmentShader:gr.meshphysical_frag},_r.prototype=Object.create(Jn.prototype),_r.prototype.constructor=_r,Mr.prototype=Object.create(Sn.prototype),Mr.prototype.constructor=Mr,Ir.prototype=Object.create(Ie.prototype),Ir.prototype.constructor=Ir,Ir.prototype.isCubeTexture=!0,Object.defineProperty(Ir.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),zr.prototype=Object.create(Ie.prototype),zr.prototype.constructor=zr,zr.prototype.isDataTexture2DArray=!0,Br.prototype=Object.create(Ie.prototype),Br.prototype.constructor=Br,Br.prototype.isDataTexture3D=!0;var Ur=new Ie,Gr=new zr,Fr=new Br,Hr=new Ir,Vr=[],jr=[],kr=new Float32Array(16),Wr=new Float32Array(9),qr=new Float32Array(4);function Xr(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,a=Vr[r];if(void 0===a&&(a=new Float32Array(r),Vr[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function Yr(t,e){if(t.length!==e.length)return!1;for(var i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Jr(t,e){for(var i=0,n=e.length;i<n;i++)t[i]=e[i]}function Zr(t,e){var i=jr[e];void 0===i&&(i=new Int32Array(e),jr[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Qr(t,e){var i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Kr(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Yr(i,e))return;t.uniform2fv(this.addr,e),Jr(i,e)}}function $r(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Yr(i,e))return;t.uniform3fv(this.addr,e),Jr(i,e)}}function ta(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Yr(i,e))return;t.uniform4fv(this.addr,e),Jr(i,e)}}function ea(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(Yr(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Jr(i,e)}else{if(Yr(i,n))return;qr.set(n),t.uniformMatrix2fv(this.addr,!1,qr),Jr(i,n)}}function ia(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(Yr(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Jr(i,e)}else{if(Yr(i,n))return;Wr.set(n),t.uniformMatrix3fv(this.addr,!1,Wr),Jr(i,n)}}function na(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(Yr(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Jr(i,e)}else{if(Yr(i,n))return;kr.set(n),t.uniformMatrix4fv(this.addr,!1,kr),Jr(i,n)}}function ra(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||Ur,r)}function aa(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||Gr,r)}function oa(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||Fr,r)}function sa(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||Hr,r)}function ca(t,e){var i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function ha(t,e){var i=this.cache;Yr(i,e)||(t.uniform2iv(this.addr,e),Jr(i,e))}function la(t,e){var i=this.cache;Yr(i,e)||(t.uniform3iv(this.addr,e),Jr(i,e))}function ua(t,e){var i=this.cache;Yr(i,e)||(t.uniform4iv(this.addr,e),Jr(i,e))}function pa(t,e){t.uniform1fv(this.addr,e)}function da(t,e){t.uniform1iv(this.addr,e)}function fa(t,e){t.uniform2iv(this.addr,e)}function ma(t,e){t.uniform3iv(this.addr,e)}function va(t,e){t.uniform4iv(this.addr,e)}function ga(t,e){var i=Xr(e,this.size,2);t.uniform2fv(this.addr,i)}function ya(t,e){var i=Xr(e,this.size,3);t.uniform3fv(this.addr,i)}function xa(t,e){var i=Xr(e,this.size,4);t.uniform4fv(this.addr,i)}function ba(t,e){var i=Xr(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function wa(t,e){var i=Xr(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function _a(t,e){var i=Xr(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function Ma(t,e,i){var n=e.length,r=Zr(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.safeSetTexture2D(e[a]||Ur,r[a])}function Sa(t,e,i){var n=e.length,r=Zr(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.safeSetTextureCube(e[a]||Hr,r[a])}function Ta(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Qr;case 35664:return Kr;case 35665:return $r;case 35666:return ta;case 35674:return ea;case 35675:return ia;case 35676:return na;case 35678:case 36198:return ra;case 35679:return oa;case 35680:return sa;case 36289:return aa;case 5124:case 35670:return ca;case 35667:case 35671:return ha;case 35668:case 35672:return la;case 35669:case 35673:return ua}}(e.type)}function Ea(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return pa;case 35664:return ga;case 35665:return ya;case 35666:return xa;case 35674:return ba;case 35675:return wa;case 35676:return _a;case 35678:return Ma;case 35680:return Sa;case 5124:case 35670:return da;case 35667:case 35671:return fa;case 35668:case 35672:return ma;case 35669:case 35673:return va}}(e.type)}function Aa(t){this.id=t,this.seq=[],this.map={}}Ea.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Jr(e,t)},Aa.prototype.setValue=function(t,e,i){for(var n=this.seq,r=0,a=n.length;r!==a;++r){var o=n[r];o.setValue(t,e[o.id],i)}};var La=/([\w\d_]+)(\])?(\[|\.)?/g;function Pa(t,e){t.seq.push(e),t.map[e.id]=e}function Ra(t,e,i){var n=t.name,r=n.length;for(La.lastIndex=0;;){var a=La.exec(n),o=La.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s|=0),void 0===h||"["===h&&o+2===r){Pa(i,void 0===h?new Ta(s,t,e):new Ea(s,t,e));break}var l=i.map[s];void 0===l&&Pa(i,l=new Aa(s)),i=l}}function Ca(t,e){this.seq=[],this.map={};for(var i=t.getProgramParameter(e,35718),n=0;n<i;++n){var r=t.getActiveUniform(e,n);Ra(r,t.getUniformLocation(e,r.name),this)}}function Oa(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}Ca.prototype.setValue=function(t,e,i,n){var r=this.map[e];void 0!==r&&r.setValue(t,i,n)},Ca.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},Ca.upload=function(t,e,i,n){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},Ca.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var a=t[n];a.id in e&&i.push(a)}return i};var Na=0;function Da(t){switch(t){case ce:return["Linear","( value )"];case he:return["sRGB","( value )"];case ue:return["RGBE","( value )"];case de:return["RGBM","( value, 7.0 )"];case fe:return["RGBM","( value, 16.0 )"];case me:return["RGBD","( value, 256.0 )"];case le:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case pe:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+t)}}function Ia(t,e,i){var n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return n&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(t){for(var e=t.split("\n"),i=0;i<e.length;i++)e[i]=i+1+": "+e[i];return e.join("\n")}(t.getShaderSource(e))}function za(t,e){var i=Da(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Ba(t,e){var i;switch(e){case X:i="Linear";break;case Y:i="Reinhard";break;case J:i="Uncharted2";break;case Z:i="OptimizedCineon";break;case Q:i="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Ua(t){return""!==t}function Ga(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Fa(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function Ha(t){return t.replace(/^[ \t]*#include +<([\w\d.\/]+)>/gm,(function(t,e){var i=gr[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Ha(i)}))}function Va(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,(function(t,e,i,n){for(var r="",a=parseInt(e);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}))}function ja(t,e,i,n,s,c,h){var l=t.getContext(),u=n.defines,p=s.vertexShader,d=s.fragmentShader,f="SHADOWMAP_TYPE_BASIC";c.shadowMapType===r?f="SHADOWMAP_TYPE_PCF":c.shadowMapType===a?f="SHADOWMAP_TYPE_PCF_SOFT":c.shadowMapType===o&&(f="SHADOWMAP_TYPE_VSM");var m="ENVMAP_TYPE_CUBE",v="ENVMAP_MODE_REFLECTION",g="ENVMAP_BLENDING_MULTIPLY";if(c.envMap){switch(n.envMap.mapping){case K:case $:m="ENVMAP_TYPE_CUBE";break;case nt:case rt:m="ENVMAP_TYPE_CUBE_UV";break;case tt:case et:m="ENVMAP_TYPE_EQUIREC";break;case it:m="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case $:case et:v="ENVMAP_MODE_REFRACTION"}switch(n.combine){case j:g="ENVMAP_BLENDING_MULTIPLY";break;case k:g="ENVMAP_BLENDING_MIX";break;case W:g="ENVMAP_BLENDING_ADD"}}var y,x,b,w,_,M=t.gammaFactor>0?t.gammaFactor:1,S=h.isWebGL2?"":function(t,e,i){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ua).join("\n")}(n.extensions,c,e),T=function(t){var e=[];for(var i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(u),E=l.createProgram();if(n.isRawShaderMaterial?((y=[T].filter(Ua).join("\n")).length>0&&(y+="\n"),(x=[S,T].filter(Ua).join("\n")).length>0&&(x+="\n")):(y=["precision "+c.precision+" float;","precision "+c.precision+" int;","highp"===c.precision?"#define HIGH_PRECISION":"","#define SHADER_NAME "+s.name,T,c.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+M,"#define MAX_BONES "+c.maxBones,c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+v:"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.normalMap&&c.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",c.normalMap&&c.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",c.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",c.displacementMap&&c.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.roughnessMap?"#define USE_ROUGHNESSMAP":"",c.metalnessMap?"#define USE_METALNESSMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.vertexTangents?"#define USE_TANGENT":"",c.vertexColors?"#define USE_COLOR":"",c.vertexUvs?"#define USE_UV":"",c.flatShading?"#define FLAT_SHADED":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals&&!1===c.flatShading?"#define USE_MORPHNORMALS":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+f:"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"",c.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",c.logarithmicDepthBuffer&&(h.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_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(Ua).join("\n"),x=[S,"precision "+c.precision+" float;","precision "+c.precision+" int;","highp"===c.precision?"#define HIGH_PRECISION":"","#define SHADER_NAME "+s.name,T,c.alphaTest?"#define ALPHATEST "+c.alphaTest+(c.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+M,c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.matcap?"#define USE_MATCAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+m:"",c.envMap?"#define "+v:"",c.envMap?"#define "+g:"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.normalMap&&c.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",c.normalMap&&c.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",c.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.roughnessMap?"#define USE_ROUGHNESSMAP":"",c.metalnessMap?"#define USE_METALNESSMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.sheen?"#define USE_SHEEN":"",c.vertexTangents?"#define USE_TANGENT":"",c.vertexColors?"#define USE_COLOR":"",c.vertexUvs?"#define USE_UV":"",c.gradientMap?"#define USE_GRADIENTMAP":"",c.flatShading?"#define FLAT_SHADED":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+f:"",c.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",c.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",c.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",c.logarithmicDepthBuffer&&(h.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensions&&n.extensions.shaderTextureLOD||c.envMap)&&(h.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",c.toneMapping!==q?"#define TONE_MAPPING":"",c.toneMapping!==q?gr.tonemapping_pars_fragment:"",c.toneMapping!==q?Ba("toneMapping",c.toneMapping):"",c.dithering?"#define DITHERING":"",c.outputEncoding||c.mapEncoding||c.matcapEncoding||c.envMapEncoding||c.emissiveMapEncoding?gr.encodings_pars_fragment:"",c.mapEncoding?za("mapTexelToLinear",c.mapEncoding):"",c.matcapEncoding?za("matcapTexelToLinear",c.matcapEncoding):"",c.envMapEncoding?za("envMapTexelToLinear",c.envMapEncoding):"",c.emissiveMapEncoding?za("emissiveMapTexelToLinear",c.emissiveMapEncoding):"",c.outputEncoding?(b="linearToOutputTexel",w=c.outputEncoding,_=Da(w),"vec4 "+b+"( vec4 value ) { return LinearTo"+_[0]+_[1]+"; }"):"",c.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ua).join("\n")),p=Fa(p=Ga(p=Ha(p),c),c),d=Fa(d=Ga(d=Ha(d),c),c),p=Va(p),d=Va(d),h.isWebGL2&&!n.isRawShaderMaterial){var A=!1,L=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==p.match(L)&&null!==d.match(L)&&(A=!0,p=p.replace(L,""),d=d.replace(L,"")),y=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,x=["#version 300 es\n","#define varying in",A?"":"out highp vec4 pc_fragColor;",A?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x}var P,R,C=x+d,O=Oa(l,35633,y+p),N=Oa(l,35632,C);if(l.attachShader(E,O),l.attachShader(E,N),void 0!==n.index0AttributeName?l.bindAttribLocation(E,0,n.index0AttributeName):!0===c.morphTargets&&l.bindAttribLocation(E,0,"position"),l.linkProgram(E),t.debug.checkShaderErrors){var D=l.getProgramInfoLog(E).trim(),I=l.getShaderInfoLog(O).trim(),z=l.getShaderInfoLog(N).trim(),B=!0,U=!0;if(!1===l.getProgramParameter(E,35714)){B=!1;var G=Ia(l,O,"vertex"),F=Ia(l,N,"fragment");console.error("THREE.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(E,35715),"gl.getProgramInfoLog",D,G,F)}else""!==D?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",D):""!==I&&""!==z||(U=!1);U&&(this.diagnostics={runnable:B,material:n,programLog:D,vertexShader:{log:I,prefix:y},fragmentShader:{log:z,prefix:x}})}return l.deleteShader(O),l.deleteShader(N),this.getUniforms=function(){return void 0===P&&(P=new Ca(l,E)),P},this.getAttributes=function(){return void 0===R&&(R=function(t,e){for(var i={},n=t.getProgramParameter(e,35721),r=0;r<n;r++){var a=t.getActiveAttrib(e,r).name;i[a]=t.getAttribLocation(e,a)}return i}(l,E)),R},this.destroy=function(){l.deleteProgram(E),this.program=void 0},this.name=s.name,this.id=Na++,this.code=i,this.usedTimes=1,this.program=E,this.vertexShader=O,this.fragmentShader=N,this}function ka(t,e,i){var n=[],r={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","tangentSpaceNormalMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","fog","useFog","fogExp2","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","sheen"];function o(t,e){var i;return t?t.isTexture?i=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=t.texture.encoding):i=ce,i===ce&&e&&(i=le),i}this.getParameters=function(e,n,a,s,l,u,p){var d=r[e.type],f=p.isSkinnedMesh?function(t){var e=t.skeleton.bones;if(i.floatVertexTextures)return 1024;var n=i.maxVertexUniforms,r=Math.floor((n-20)/4),a=Math.min(r,e.length);return a<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+a+"."),0):a}(p):0,m=i.precision;null!==e.precision&&(m=i.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",m,"instead.");var v=t.getRenderTarget();return{shaderID:d,precision:m,supportsVertexTextures:i.vertexTextures,outputEncoding:o(v?v.texture:null,t.gammaOutput),map:!!e.map,mapEncoding:o(e.map,t.gammaInput),matcap:!!e.matcap,matcapEncoding:o(e.matcap,t.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:o(e.envMap,t.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===nt||e.envMap.mapping===rt),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:o(e.emissiveMap,t.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===xe,tangentSpaceNormalMap:e.normalMapType===ye,clearcoatNormalMap:!!e.clearcoatNormalMap,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,sheen:!!e.sheen,combine:e.combine,vertexTangents:e.normalMap&&e.vertexTangents,vertexColors:e.vertexColors,vertexUvs:!!(e.map||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e.emissiveMap||e.roughnessMap||e.metalnessMap||e.clearcoatNormalMap),fog:!!s,useFog:e.fog,fogExp2:s&&s.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:i.logarithmicDepthBuffer,skinning:e.skinning&&f>0,maxBones:f,useVertexTexture:i.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numRectAreaLights:n.rectArea.length,numHemiLights:n.hemi.length,numDirLightShadows:n.directionalShadowMap.length,numPointLightShadows:n.pointShadowMap.length,numSpotLightShadows:n.spotShadowMap.length,numClippingPlanes:l,numClipIntersection:u,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&p.receiveShadow&&a.length>0,shadowMapType:t.shadowMap.type,toneMapping:e.toneMapped?t.toneMapping:q,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===h,flipSided:e.side===c,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,i){var n=[];if(i.shaderID?n.push(i.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(var o=0;o<a.length;o++)n.push(i[a[o]]);return n.push(e.onBeforeCompile.toString()),n.push(t.gammaOutput),n.push(t.gammaFactor),n.join()},this.acquireProgram=function(r,a,o,s){for(var c,h=0,l=n.length;h<l;h++){var u=n[h];if(u.code===s){++(c=u).usedTimes;break}}return void 0===c&&(c=new ja(t,e,s,r,a,o,i),n.push(c)),c},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=n.indexOf(t);n[e]=n[n.length-1],n.pop(),t.destroy()}},this.programs=n}function Wa(){var t=new WeakMap;return{get:function(e){var i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function qa(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Xa(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Ya(){var t=[],e=0,i=[],n=[],r={id:-1};function a(i,n,a,o,s,c){var h=t[e];return void 0===h?(h={id:i.id,object:i,geometry:n,material:a,program:a.program||r,groupOrder:o,renderOrder:i.renderOrder,z:s,group:c},t[e]=h):(h.id=i.id,h.object=i,h.geometry=n,h.material=a,h.program=a.program||r,h.groupOrder=o,h.renderOrder=i.renderOrder,h.z=s,h.group=c),e++,h}return{opaque:i,transparent:n,init:function(){e=0,i.length=0,n.length=0},push:function(t,e,r,o,s,c){var h=a(t,e,r,o,s,c);(!0===r.transparent?n:i).push(h)},unshift:function(t,e,r,o,s,c){var h=a(t,e,r,o,s,c);(!0===r.transparent?n:i).unshift(h)},sort:function(){i.length>1&&i.sort(qa),n.length>1&&n.sort(Xa)}}}function Ja(){var t=new WeakMap;function e(i){var n=i.target;n.removeEventListener("dispose",e),t.delete(n)}return{get:function(i,n){var r,a=t.get(i);return void 0===a?(r=new Ya,t.set(i,new WeakMap),t.get(i).set(n,r),i.addEventListener("dispose",e)):void 0===(r=a.get(n))&&(r=new Ya,a.set(n,r)),r},dispose:function(){t=new WeakMap}}}function Za(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new Pe,color:new Zi,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"SpotLight":i={position:new Pe,direction:new Pe,color:new Zi,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"PointLight":i={position:new Pe,color:new Zi,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Te,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":i={direction:new Pe,skyColor:new Zi,groundColor:new Zi};break;case"RectAreaLight":i={color:new Zi,position:new Pe,halfWidth:new Pe,halfHeight:new Pe}}return t[e.id]=i,i}}}var Qa=0;function Ka(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function $a(){for(var t=new Za,e={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},i=0;i<9;i++)e.probe.push(new Pe);var n=new Pe,r=new qe,a=new qe;return{setup:function(i,o,s){for(var c=0,h=0,l=0,u=0;u<9;u++)e.probe[u].set(0,0,0);var p=0,d=0,f=0,m=0,v=0,g=0,y=0,x=0,b=s.matrixWorldInverse;i.sort(Ka),u=0;for(var w=i.length;u<w;u++){var _=i[u],M=_.color,S=_.intensity,T=_.distance,E=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)c+=M.r*S,h+=M.g*S,l+=M.b*S;else if(_.isLightProbe)for(var A=0;A<9;A++)e.probe[A].addScaledVector(_.sh.coefficients[A],S);else if(_.isDirectionalLight){if((P=t.get(_)).color.copy(_.color).multiplyScalar(_.intensity),P.direction.setFromMatrixPosition(_.matrixWorld),n.setFromMatrixPosition(_.target.matrixWorld),P.direction.sub(n),P.direction.transformDirection(b),P.shadow=_.castShadow,_.castShadow){var L=_.shadow;P.shadowBias=L.bias,P.shadowRadius=L.radius,P.shadowMapSize=L.mapSize,e.directionalShadowMap[p]=E,e.directionalShadowMatrix[p]=_.shadow.matrix,g++}e.directional[p]=P,p++}else if(_.isSpotLight){if((P=t.get(_)).position.setFromMatrixPosition(_.matrixWorld),P.position.applyMatrix4(b),P.color.copy(M).multiplyScalar(S),P.distance=T,P.direction.setFromMatrixPosition(_.matrixWorld),n.setFromMatrixPosition(_.target.matrixWorld),P.direction.sub(n),P.direction.transformDirection(b),P.coneCos=Math.cos(_.angle),P.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),P.decay=_.decay,P.shadow=_.castShadow,_.castShadow){L=_.shadow;P.shadowBias=L.bias,P.shadowRadius=L.radius,P.shadowMapSize=L.mapSize,e.spotShadowMap[f]=E,e.spotShadowMatrix[f]=_.shadow.matrix,x++}e.spot[f]=P,f++}else if(_.isRectAreaLight){(P=t.get(_)).color.copy(M).multiplyScalar(S),P.position.setFromMatrixPosition(_.matrixWorld),P.position.applyMatrix4(b),a.identity(),r.copy(_.matrixWorld),r.premultiply(b),a.extractRotation(r),P.halfWidth.set(.5*_.width,0,0),P.halfHeight.set(0,.5*_.height,0),P.halfWidth.applyMatrix4(a),P.halfHeight.applyMatrix4(a),e.rectArea[m]=P,m++}else if(_.isPointLight){if((P=t.get(_)).position.setFromMatrixPosition(_.matrixWorld),P.position.applyMatrix4(b),P.color.copy(_.color).multiplyScalar(_.intensity),P.distance=_.distance,P.decay=_.decay,P.shadow=_.castShadow,_.castShadow){L=_.shadow;P.shadowBias=L.bias,P.shadowRadius=L.radius,P.shadowMapSize=L.mapSize,P.shadowCameraNear=L.camera.near,P.shadowCameraFar=L.camera.far,e.pointShadowMap[d]=E,e.pointShadowMatrix[d]=_.shadow.matrix,y++}e.point[d]=P,d++}else if(_.isHemisphereLight){var P;(P=t.get(_)).direction.setFromMatrixPosition(_.matrixWorld),P.direction.transformDirection(b),P.direction.normalize(),P.skyColor.copy(_.color).multiplyScalar(S),P.groundColor.copy(_.groundColor).multiplyScalar(S),e.hemi[v]=P,v++}}e.ambient[0]=c,e.ambient[1]=h,e.ambient[2]=l;var R=e.hash;R.directionalLength===p&&R.pointLength===d&&R.spotLength===f&&R.rectAreaLength===m&&R.hemiLength===v&&R.numDirectionalShadows===g&&R.numPointShadows===y&&R.numSpotShadows===x||(e.directional.length=p,e.spot.length=f,e.rectArea.length=m,e.point.length=d,e.hemi.length=v,e.directionalShadowMap.length=g,e.pointShadowMap.length=y,e.spotShadowMap.length=x,e.directionalShadowMatrix.length=g,e.pointShadowMatrix.length=y,e.spotShadowMatrix.length=x,R.directionalLength=p,R.pointLength=d,R.spotLength=f,R.rectAreaLength=m,R.hemiLength=v,R.numDirectionalShadows=g,R.numPointShadows=y,R.numSpotShadows=x,e.version=Qa++)},state:e}}function to(){var t=new $a,e=[],i=[];return{init:function(){e.length=0,i.length=0},state:{lightsArray:e,shadowsArray:i,lights:t},setupLights:function(n){t.setup(e,i,n)},pushLight:function(t){e.push(t)},pushShadow:function(t){i.push(t)}}}function eo(){var t=new WeakMap;function e(i){var n=i.target;n.removeEventListener("dispose",e),t.delete(n)}return{get:function(i,n){var r;return!1===t.has(i)?(r=new to,t.set(i,new WeakMap),t.get(i).set(n,r),i.addEventListener("dispose",e)):!1===t.get(i).has(n)?(r=new to,t.get(i).set(n,r)):r=t.get(i).get(n),r},dispose:function(){t=new WeakMap}}}function io(t){nn.call(this),this.type="MeshDepthMaterial",this.depthPacking=ve,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function no(t){nn.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Pe,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(t)}io.prototype=Object.create(nn.prototype),io.prototype.constructor=io,io.prototype.isMeshDepthMaterial=!0,io.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},no.prototype=Object.create(nn.prototype),no.prototype.constructor=no,no.prototype.isMeshDistanceMaterial=!0,no.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var ro="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n  float mean = 0.0;\n  float squared_mean = 0.0;\n  \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy  ) / resolution ) );\n  for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n    #ifdef HORIZONAL_PASS\n      vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n      mean += distribution.x;\n      squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n    #else\n      float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0,  i )  * radius ) / resolution ) );\n      mean += depth;\n      squared_mean += depth * depth;\n    #endif\n  }\n  mean = mean * HALF_SAMPLE_RATE;\n  squared_mean = squared_mean * HALF_SAMPLE_RATE;\n  float std_dev = pow( squared_mean - mean * mean, 0.5 );\n  gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}",ao="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function oo(t,e,i){var n=new vr,a=new Te,l=new Te,u=new ze,p=1,f=2,m=1+(p|f),v=new Array(m),g=new Array(m),y={},x={0:c,1:s,2:h},b=new ir({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Te},radius:{value:4}},vertexShader:ao,fragmentShader:ro}),w=b.clone();w.defines.HORIZONAL_PASS=1;var _=new Sn;_.addAttribute("position",new an(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));for(var M=new Vn(_,b),S=0;S!==m;++S){var T=0!=(S&p),E=0!=(S&f),A=new io({depthPacking:ge,morphTargets:T,skinning:E});v[S]=A;var L=new no({morphTargets:T,skinning:E});g[S]=L}var P=this;function R(i,n){var r=e.update(M);b.uniforms.shadow_pass.value=i.map.texture,b.uniforms.resolution.value=i.mapSize,b.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,b,M,null),w.uniforms.shadow_pass.value=i.mapPass.texture,w.uniforms.resolution.value=i.mapSize,w.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,w,M,null)}function C(e,i,n,r,a,s){var c=e.geometry,h=null,l=v,u=e.customDepthMaterial;if(n.isPointLight&&(l=g,u=e.customDistanceMaterial),u)h=u;else{var d=!1;i.morphTargets&&(c&&c.isBufferGeometry?d=c.morphAttributes&&c.morphAttributes.position&&c.morphAttributes.position.length>0:c&&c.isGeometry&&(d=c.morphTargets&&c.morphTargets.length>0)),e.isSkinnedMesh&&!1===i.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var m=e.isSkinnedMesh&&i.skinning,b=0;d&&(b|=p),m&&(b|=f),h=l[b]}if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var w=h.uuid,_=i.uuid,M=y[w];void 0===M&&(M={},y[w]=M);var S=M[_];void 0===S&&(S=h.clone(),M[_]=S),h=S}return h.visible=i.visible,h.wireframe=i.wireframe,h.side=s===o?null!=i.shadowSide?i.shadowSide:i.side:null!=i.shadowSide?i.shadowSide:x[i.side],h.clipShadows=i.clipShadows,h.clippingPlanes=i.clippingPlanes,h.clipIntersection=i.clipIntersection,h.wireframeLinewidth=i.wireframeLinewidth,h.linewidth=i.linewidth,n.isPointLight&&h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(n.matrixWorld),h.nearDistance=r,h.farDistance=a),h}function O(i,r,a,s,c){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&c===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);var h=e.update(i),l=i.material;if(Array.isArray(l))for(var u=h.groups,p=0,d=u.length;p<d;p++){var f=u[p],m=l[f.materialIndex];if(m&&m.visible){var v=C(i,m,s,a.near,a.far,c);t.renderBufferDirect(a,null,h,v,i,f)}}else if(l.visible){v=C(i,l,s,a.near,a.far,c);t.renderBufferDirect(a,null,h,v,i,null)}}for(var g=i.children,y=0,x=g.length;y<x;y++)O(g[y],r,a,s,c)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=r,this.render=function(e,r,s){if(!1!==P.enabled&&(!1!==P.autoUpdate||!1!==P.needsUpdate)&&0!==e.length){var c=t.getRenderTarget(),h=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),f=t.state;f.setBlending(d),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var m=0,v=e.length;m<v;m++){var g=e[m],y=g.shadow;if(void 0!==y){a.copy(y.mapSize);var x=y.getFrameExtents();if(a.multiply(x),l.copy(y.mapSize),(a.x>i||a.y>i)&&(console.warn("THREE.WebGLShadowMap:",g,"has shadow exceeding max texture size, reducing"),a.x>i&&(l.x=Math.floor(i/x.x),a.x=l.x*x.x,y.mapSize.x=l.x),a.y>i&&(l.y=Math.floor(i/x.y),a.y=l.y*x.y,y.mapSize.y=l.y)),null===y.map&&!y.isPointLightShadow&&this.type===o){var b={minFilter:ut,magFilter:ut,format:Lt};y.map=new Be(a.x,a.y,b),y.map.texture.name=g.name+".shadowMap",y.mapPass=new Be(a.x,a.y,b),y.camera.updateProjectionMatrix()}if(null===y.map){b={minFilter:ct,magFilter:ct,format:Lt};y.map=new Be(a.x,a.y,b),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}t.setRenderTarget(y.map),t.clear();for(var w=y.getViewportCount(),_=0;_<w;_++){var M=y.getViewport(_);u.set(l.x*M.x,l.y*M.y,l.x*M.z,l.y*M.w),f.viewport(u),y.updateMatrices(g,s,_),n=y.getFrustum(),O(r,s,y.camera,g,this.type)}y.isPointLightShadow||this.type!==o||R(y,s)}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}P.needsUpdate=!1,t.setRenderTarget(c,h,p)}}}function so(t,r,a,o){var s=new function(){var e=!1,i=new ze,n=null,r=new ze(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,o,s){!0===s&&(e*=o,n*=o,a*=o),i.set(e,n,a,o),!1===r.equals(i)&&(t.clearColor(e,n,a,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},l=new function(){var e=!1,i=null,n=null,r=null;return{setTest:function(t){t?at(2929):ot(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case I:t.depthFunc(512);break;case z:t.depthFunc(519);break;case B:t.depthFunc(513);break;case U:t.depthFunc(515);break;case G:t.depthFunc(514);break;case F:t.depthFunc(518);break;case H:t.depthFunc(516);break;case V:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},u=new function(){var e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null;return{setTest:function(t){e||(t?at(2960):ot(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&a===o||(t.stencilFunc(e,i,o),n=e,r=i,a=o)},setOp:function(e,i,n){o===e&&s===i&&c===n||(t.stencilOp(e,i,n),o=e,s=i,c=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null}}},p=t.getParameter(34921),b=new Uint8Array(p),w=new Uint8Array(p),_=new Uint8Array(p),M={},S=null,T=null,E=null,A=null,L=null,P=null,R=null,C=null,O=null,N=null,D=!1,j=null,k=null,W=null,q=null,X=null,Y=t.getParameter(35661),J=!1,Z=0,Q=t.getParameter(7938);-1!==Q.indexOf("WebGL")?(Z=parseFloat(/^WebGL\ ([0-9])/.exec(Q)[1]),J=Z>=1):-1!==Q.indexOf("OpenGL ES")&&(Z=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(Q)[1]),J=Z>=2);var K=null,$={},tt=new ze,et=new ze;function it(e,i,n){var r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;o<n;o++)t.texImage2D(i+o,0,6408,1,1,0,6408,5121,r);return a}var nt={};function rt(e,i){(b[e]=1,0===w[e]&&(t.enableVertexAttribArray(e),w[e]=1),_[e]!==i)&&((o.isWebGL2?t:r.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](e,i),_[e]=i)}function at(e){!0!==M[e]&&(t.enable(e),M[e]=!0)}function ot(e){!1!==M[e]&&(t.disable(e),M[e]=!1)}function st(e,i,n,r,o,s,c,h){if(e!==d){if(E||(at(3042),E=!0),e===y)o=o||i,s=s||n,c=c||r,i===L&&o===C||(t.blendEquationSeparate(a.convert(i),a.convert(o)),L=i,C=o),n===P&&r===R&&s===O&&c===N||(t.blendFuncSeparate(a.convert(n),a.convert(r),a.convert(s),a.convert(c)),P=n,R=r,O=s,N=c),A=e,D=null;else if(e!==A||h!==D){if(L===x&&C===x||(t.blendEquation(32774),L=x,C=x),h)switch(e){case f:t.blendFuncSeparate(1,771,1,771);break;case m:t.blendFunc(1,1);break;case v:t.blendFuncSeparate(0,0,769,771);break;case g:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case f:t.blendFuncSeparate(770,771,1,771);break;case m:t.blendFunc(770,1);break;case v:t.blendFunc(0,769);break;case g:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}P=null,R=null,O=null,N=null,A=e,D=h}}else E&&(ot(3042),E=!1)}function ct(e){j!==e&&(e?t.frontFace(2304):t.frontFace(2305),j=e)}function ht(r){r!==e?(at(2884),r!==k&&(r===i?t.cullFace(1029):r===n?t.cullFace(1028):t.cullFace(1032))):ot(2884),k=r}function lt(e,i,n){e?(at(32823),q===i&&X===n||(t.polygonOffset(i,n),q=i,X=n)):ot(32823)}function ut(e){void 0===e&&(e=33984+Y-1),K!==e&&(t.activeTexture(e),K=e)}return nt[3553]=it(3553,3553,1),nt[34067]=it(34067,34069,6),s.setClear(0,0,0,1),l.setClear(1),u.setClear(0),at(2929),l.setFunc(U),ct(!1),ht(i),at(2884),st(d),{buffers:{color:s,depth:l,stencil:u},initAttributes:function(){for(var t=0,e=b.length;t<e;t++)b[t]=0},enableAttribute:function(t){rt(t,0)},enableAttributeAndDivisor:rt,disableUnusedAttributes:function(){for(var e=0,i=w.length;e!==i;++e)w[e]!==b[e]&&(t.disableVertexAttribArray(e),w[e]=0)},enable:at,disable:ot,getCompressedTextureFormats:function(){if(null===S&&(S=[],r.get("WEBGL_compressed_texture_pvrtc")||r.get("WEBGL_compressed_texture_s3tc")||r.get("WEBGL_compressed_texture_etc1")||r.get("WEBGL_compressed_texture_astc")))for(var e=t.getParameter(34467),i=0;i<e.length;i++)S.push(e[i]);return S},useProgram:function(e){return T!==e&&(t.useProgram(e),T=e,!0)},setBlending:st,setMaterial:function(t,e){t.side===h?ot(2884):at(2884);var i=t.side===c;e&&(i=!i),ct(i),t.blending===f&&!1===t.transparent?st(d):st(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),l.setFunc(t.depthFunc),l.setTest(t.depthTest),l.setMask(t.depthWrite),s.setMask(t.colorWrite);var n=t.stencilWrite;u.setTest(n),n&&(u.setFunc(t.stencilFunc,t.stencilRef,t.stencilMask),u.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),lt(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:ct,setCullFace:ht,setLineWidth:function(e){e!==W&&(J&&t.lineWidth(e),W=e)},setPolygonOffset:lt,setScissorTest:function(t){t?at(3089):ot(3089)},activeTexture:ut,bindTexture:function(e,i){null===K&&ut();var n=$[K];void 0===n&&(n={type:void 0,texture:void 0},$[K]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||nt[e]),n.type=e,n.texture=i)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===tt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),tt.copy(e))},viewport:function(e){!1===et.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),et.copy(e))},reset:function(){for(var e=0;e<w.length;e++)1===w[e]&&(t.disableVertexAttribArray(e),w[e]=0);M={},S=null,K=null,$={},T=null,A=null,j=null,k=null,s.reset(),l.reset(),u.reset()}}}function co(t,e,i,n,r,a,o){var s,c=new WeakMap,h="undefined"!=typeof OffscreenCanvas;function l(t,e){return h?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function u(t,e,i,n){var r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var a=e?Se.floorPowerOfTwo:Math.floor,o=a(r*t.width),c=a(r*t.height);void 0===s&&(s=l(o,c));var h=i?l(o,c):s;return h.width=o,h.height=c,h.getContext("2d").drawImage(t,0,0,o,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+c+")."),h}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function p(t){return Se.isPowerOfTwo(t.width)&&Se.isPowerOfTwo(t.height)}function d(t,e){return t.generateMipmaps&&e&&t.minFilter!==ct&&t.minFilter!==ut}function f(e,i,r,a){t.generateMipmap(e),n.get(i).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function m(t,i){if(!r.isWebGL2)return t;var n=t;return 6403===t&&(5126===i&&(n=33326),5131===i&&(n=33325),5121===i&&(n=33321)),6407===t&&(5126===i&&(n=34837),5131===i&&(n=34843),5121===i&&(n=32849)),6408===t&&(5126===i&&(n=34836),5131===i&&(n=34842),5121===i&&(n=32856)),33325===n||33326===n||34842===n||34836===n?e.get("EXT_color_buffer_float"):34843!==n&&34837!==n||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),n}function v(t){return t===ct||t===ht||t===lt?9728:9729}function g(e){var i=e.target;i.removeEventListener("dispose",g),function(e){var i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&c.delete(i),o.memory.textures--}function y(e){var i=e.target;i.removeEventListener("dispose",y),function(e){var i=n.get(e),r=n.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[a]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}(i),o.memory.textures--}var x=0;function b(t,e){var r=n.get(t);if(t.isVideoTexture&&function(t){var e=o.render.frame;c.get(t)!==e&&(c.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){var a=t.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void T(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function w(e,o){if(6===e.image.length){var s=n.get(e);if(e.version>0&&s.__version!==e.version){S(s,e),i.activeTexture(33984+o),i.bindTexture(34067,s.__webglTexture),t.pixelStorei(37440,e.flipY);for(var c=e&&e.isCompressedTexture,h=e.image[0]&&e.image[0].isDataTexture,l=[],v=0;v<6;v++)l[v]=c||h?h?e.image[v].image:e.image[v]:u(e.image[v],!1,!0,r.maxCubemapSize);var g,y=l[0],x=p(y)||r.isWebGL2,b=a.convert(e.format),w=a.convert(e.type),_=m(b,w);if(M(34067,e,x),c){for(v=0;v<6;v++){g=l[v].mipmaps;for(var T=0;T<g.length;T++){var E=g[T];e.format!==Lt&&e.format!==At?i.getCompressedTextureFormats().indexOf(b)>-1?i.compressedTexImage2D(34069+v,T,_,E.width,E.height,0,E.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+v,T,_,E.width,E.height,0,b,w,E.data)}}s.__maxMipLevel=g.length-1}else{g=e.mipmaps;for(v=0;v<6;v++)if(h){i.texImage2D(34069+v,0,_,l[v].width,l[v].height,0,b,w,l[v].data);for(T=0;T<g.length;T++){var A=(E=g[T]).image[v].image;i.texImage2D(34069+v,T+1,_,A.width,A.height,0,b,w,A.data)}}else{i.texImage2D(34069+v,0,_,b,w,l[v]);for(T=0;T<g.length;T++){E=g[T];i.texImage2D(34069+v,T+1,_,b,w,E.image[v])}}s.__maxMipLevel=g.length}d(e,x)&&f(34067,e,y.width,y.height),s.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(33984+o),i.bindTexture(34067,s.__webglTexture)}}function _(t,e){i.activeTexture(33984+e),i.bindTexture(34067,n.get(t).__webglTexture)}function M(i,o,s){var c;if(s?(t.texParameteri(i,10242,a.convert(o.wrapS)),t.texParameteri(i,10243,a.convert(o.wrapT)),32879!==i&&35866!==i||t.texParameteri(i,32882,a.convert(o.wrapR)),t.texParameteri(i,10240,a.convert(o.magFilter)),t.texParameteri(i,10241,a.convert(o.minFilter))):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),o.wrapS===ot&&o.wrapT===ot||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,v(o.magFilter)),t.texParameteri(i,10241,v(o.minFilter)),o.minFilter!==ct&&o.minFilter!==ut&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),c=e.get("EXT_texture_filter_anisotropic")){if(o.type===bt&&null===e.get("OES_texture_float_linear"))return;if(o.type===wt&&null===(r.isWebGL2||e.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function S(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",g),e.__webglTexture=t.createTexture(),o.memory.textures++)}function T(e,n,o){var s=3553;n.isDataTexture2DArray&&(s=35866),n.isDataTexture3D&&(s=32879),S(e,n),i.activeTexture(33984+o),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment);var c=function(t){return!r.isWebGL2&&(t.wrapS!==ot||t.wrapT!==ot||t.minFilter!==ct&&t.minFilter!==ut)}(n)&&!1===p(n.image),h=u(n.image,c,!1,r.maxTextureSize),l=p(h)||r.isWebGL2,v=a.convert(n.format),g=a.convert(n.type),y=m(v,g);M(s,n,l);var x,b=n.mipmaps;if(n.isDepthTexture){if(y=6402,n.type===bt){if(!r.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");y=36012}else r.isWebGL2&&(y=33189);n.format===Ct&&6402===y&&n.type!==gt&&n.type!==xt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=gt,g=a.convert(n.type)),n.format===Ot&&(y=34041,n.type!==Tt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=Tt,g=a.convert(n.type))),i.texImage2D(3553,0,y,h.width,h.height,0,v,g,null)}else if(n.isDataTexture)if(b.length>0&&l){for(var w=0,_=b.length;w<_;w++)x=b[w],i.texImage2D(3553,w,y,x.width,x.height,0,v,g,x.data);n.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else i.texImage2D(3553,0,y,h.width,h.height,0,v,g,h.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(w=0,_=b.length;w<_;w++)x=b[w],n.format!==Lt&&n.format!==At?i.getCompressedTextureFormats().indexOf(v)>-1?i.compressedTexImage2D(3553,w,y,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,w,y,x.width,x.height,0,v,g,x.data);e.__maxMipLevel=b.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,y,h.width,h.height,h.depth,0,v,g,h.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,y,h.width,h.height,h.depth,0,v,g,h.data),e.__maxMipLevel=0;else if(b.length>0&&l){for(w=0,_=b.length;w<_;w++)x=b[w],i.texImage2D(3553,w,y,v,g,x);n.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else i.texImage2D(3553,0,y,v,g,h),e.__maxMipLevel=0;d(n,l)&&f(3553,n,h.width,h.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function E(e,r,o,s){var c=a.convert(r.texture.format),h=a.convert(r.texture.type),l=m(c,h);i.texImage2D(s,0,l,r.width,r.height,0,c,h,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function A(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){if(n){var r=P(i);t.renderbufferStorageMultisample(36161,r,33189,i.width,i.height)}else t.renderbufferStorage(36161,33189,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){r=P(i);t.renderbufferStorageMultisample(36161,r,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{var o=m(a.convert(i.texture.format),a.convert(i.texture.type));if(n){r=P(i);t.renderbufferStorageMultisample(36161,r,o,i.width,i.height)}else t.renderbufferStorage(36161,o,i.width,i.height)}t.bindRenderbuffer(36161,null)}function L(e){var i=n.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),b(i.depthTexture,0);var r=n.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===Ct)t.framebufferTexture2D(36160,36096,3553,r,0);else{if(i.depthTexture.format!==Ot)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,r,0)}}(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(36160,i.__webglFramebuffer[a]),i.__webglDepthbuffer[a]=t.createRenderbuffer(),A(i.__webglDepthbuffer[a],e)}else t.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),A(i.__webglDepthbuffer,e);t.bindFramebuffer(36160,null)}function P(t){return r.isWebGL2&&t.isWebGLMultisampleRenderTarget?Math.min(r.maxSamples,t.samples):0}var R=!1,C=!1;this.allocateTextureUnit=function(){var t=x;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),x+=1,t},this.resetTextureUnits=function(){x=0},this.setTexture2D=b,this.setTexture2DArray=function(t,e){var r=n.get(t);t.version>0&&r.__version!==t.version?T(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){var r=n.get(t);t.version>0&&r.__version!==t.version?T(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=w,this.setTextureCubeDynamic=_,this.setupRenderTarget=function(e){var s=n.get(e),c=n.get(e.texture);e.addEventListener("dispose",y),c.__webglTexture=t.createTexture(),o.memory.textures++;var h=!0===e.isWebGLRenderTargetCube,l=!0===e.isWebGLMultisampleRenderTarget,u=p(e)||r.isWebGL2;if(h){s.__webglFramebuffer=[];for(var v=0;v<6;v++)s.__webglFramebuffer[v]=t.createFramebuffer()}else if(s.__webglFramebuffer=t.createFramebuffer(),l)if(r.isWebGL2){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var g=m(a.convert(e.texture.format),a.convert(e.texture.type)),x=P(e);t.renderbufferStorageMultisample(36161,x,g,e.width,e.height),t.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),A(s.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){i.bindTexture(34067,c.__webglTexture),M(34067,e.texture,u);for(v=0;v<6;v++)E(s.__webglFramebuffer[v],e,36064,34069+v);d(e.texture,u)&&f(34067,e.texture,e.width,e.height),i.bindTexture(34067,null)}else i.bindTexture(3553,c.__webglTexture),M(3553,e.texture,u),E(s.__webglFramebuffer,e,36064,3553),d(e.texture,u)&&f(3553,e.texture,e.width,e.height),i.bindTexture(3553,null);e.depthBuffer&&L(e)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(d(e,p(t)||r.isWebGL2)){var a=t.isWebGLRenderTargetCube?34067:3553,o=n.get(e).__webglTexture;i.bindTexture(a,o),f(a,e,t.width,t.height),i.bindTexture(a,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(r.isWebGL2){var i=n.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);var a=e.width,o=e.height,s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===R&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),R=!0),t=t.texture),b(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLRenderTargetCube&&(!1===C&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),C=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?w(t,e):_(t,e)}}function ho(t,e,i){return{convert:function(t){var n;if(t===at)return 10497;if(t===ot)return 33071;if(t===st)return 33648;if(t===ct)return 9728;if(t===ht)return 9984;if(t===lt)return 9986;if(t===ut)return 9729;if(t===pt)return 9985;if(t===dt)return 9987;if(t===ft)return 5121;if(t===_t)return 32819;if(t===Mt)return 32820;if(t===St)return 33635;if(t===mt)return 5120;if(t===vt)return 5122;if(t===gt)return 5123;if(t===yt)return 5124;if(t===xt)return 5125;if(t===bt)return 5126;if(t===wt){if(i.isWebGL2)return 5131;if(null!==(n=e.get("OES_texture_half_float")))return n.HALF_FLOAT_OES}if(t===Et)return 6406;if(t===At)return 6407;if(t===Lt)return 6408;if(t===Pt)return 6409;if(t===Rt)return 6410;if(t===Ct)return 6402;if(t===Ot)return 34041;if(t===Nt)return 6403;if(t===x)return 32774;if(t===b)return 32778;if(t===w)return 32779;if(t===S)return 0;if(t===T)return 1;if(t===E)return 768;if(t===A)return 769;if(t===L)return 770;if(t===P)return 771;if(t===R)return 772;if(t===C)return 773;if(t===O)return 774;if(t===N)return 775;if(t===D)return 776;if((t===Dt||t===It||t===zt||t===Bt)&&null!==(n=e.get("WEBGL_compressed_texture_s3tc"))){if(t===Dt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===It)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Bt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===Ut||t===Gt||t===Ft||t===Ht)&&null!==(n=e.get("WEBGL_compressed_texture_pvrtc"))){if(t===Ut)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Gt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Ft)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Ht)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===Vt&&null!==(n=e.get("WEBGL_compressed_texture_etc1")))return n.COMPRESSED_RGB_ETC1_WEBGL;if((t===jt||t===kt||t===Wt||t===qt||t===Xt||t===Yt||t===Jt||t===Zt||t===Qt||t===Kt||t===$t||t===te||t===ee||t===ie)&&null!==(n=e.get("WEBGL_compressed_texture_astc")))return t;if(t===_||t===M){if(i.isWebGL2){if(t===_)return 32775;if(t===M)return 32776}if(null!==(n=e.get("EXT_blend_minmax"))){if(t===_)return n.MIN_EXT;if(t===M)return n.MAX_EXT}}if(t===Tt){if(i.isWebGL2)return 34042;if(null!==(n=e.get("WEBGL_depth_texture")))return n.UNSIGNED_INT_24_8_WEBGL}return 0}}}function lo(){li.call(this),this.type="Group"}function uo(t){rr.call(this),this.cameras=t||[]}lo.prototype=Object.assign(Object.create(li.prototype),{constructor:lo,isGroup:!0}),uo.prototype=Object.assign(Object.create(rr.prototype),{constructor:uo,isArrayCamera:!0});var po,fo=new Pe,mo=new Pe;function vo(t,e,i){fo.setFromMatrixPosition(e.matrixWorld),mo.setFromMatrixPosition(i.matrixWorld);var n=fo.distanceTo(mo),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),c=(r[9]+1)/r[5],h=(r[9]-1)/r[5],l=(r[8]-1)/r[0],u=(a[8]+1)/a[0],p=o*l,d=o*u,f=n/(-l+u),m=f*-l;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=o+f,g=s+f,y=p-m,x=d+(n-m),b=c*s/g*v,w=h*s/g*v;t.projectionMatrix.makePerspective(y,x,b,w,v,g)}function go(t){var e,i,n=this,r=null,a=null,o=null,s=[],c=new qe,h=new qe,l=1,u="local-floor";"undefined"!=typeof window&&"VRFrameData"in window&&(a=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",w,!1));var p=new qe,d=new Ee,f=new Pe,m=new rr;m.viewport=new ze,m.layers.enable(1);var v=new rr;v.viewport=new ze,v.layers.enable(2);var g=new uo([m,v]);function y(){return null!==r&&!0===r.isPresenting}g.layers.enable(1),g.layers.enable(2);var x,b=new Te;function w(){if(y()){var a=r.getEyeParameters("left");e=2*a.renderWidth*l,i=a.renderHeight*l,x=t.getPixelRatio(),t.getSize(b),t.setDrawingBufferSize(e,i,1),m.viewport.set(0,0,e/2,i),v.viewport.set(e/2,0,e/2,i),T.start(),n.dispatchEvent({type:"sessionstart"})}else n.enabled&&t.setDrawingBufferSize(b.width,b.height,x),T.stop(),n.dispatchEvent({type:"sessionend"})}var _=[];function M(t){for(var e=navigator.getGamepads&&navigator.getGamepads(),i=0,n=0,r=e.length;i<r;i++){var a=e[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("HTC Vive Focus")||a.id.startsWith("Spatial Controller"))){if(n===t)return a;n++}}}function S(t,n){null!==n&&4===n.length&&t.set(n[0]*e,n[1]*i,n[2]*e,n[3]*i)}this.enabled=!1,this.getController=function(t){var e=s[t];return void 0===e&&((e=new lo).matrixAutoUpdate=!1,e.visible=!1,s[t]=e),e},this.getDevice=function(){return r},this.setDevice=function(t){void 0!==t&&(r=t),T.setContext(t)},this.setFramebufferScaleFactor=function(t){l=t},this.setReferenceSpaceType=function(t){u=t},this.setPoseTarget=function(t){void 0!==t&&(o=t)},this.getCamera=function(t){var e="local-floor"===u?1.6:0;if(!1===y())return t.position.set(0,e,0),t.rotation.set(0,0,0),t;if(r.depthNear=t.near,r.depthFar=t.far,r.getFrameData(a),"local-floor"===u){var i=r.stageParameters;i?c.fromArray(i.sittingToStandingTransform):c.makeTranslation(0,e,0)}var n=a.pose,l=null!==o?o:t;l.matrix.copy(c),l.matrix.decompose(l.position,l.quaternion,l.scale),null!==n.orientation&&(d.fromArray(n.orientation),l.quaternion.multiply(d)),null!==n.position&&(d.setFromRotationMatrix(c),f.fromArray(n.position),f.applyQuaternion(d),l.position.add(f)),l.updateMatrixWorld(),m.near=t.near,v.near=t.near,m.far=t.far,v.far=t.far,m.matrixWorldInverse.fromArray(a.leftViewMatrix),v.matrixWorldInverse.fromArray(a.rightViewMatrix),h.getInverse(c),"local-floor"===u&&(m.matrixWorldInverse.multiply(h),v.matrixWorldInverse.multiply(h));var x=l.parent;null!==x&&(p.getInverse(x.matrixWorld),m.matrixWorldInverse.multiply(p),v.matrixWorldInverse.multiply(p)),m.matrixWorld.getInverse(m.matrixWorldInverse),v.matrixWorld.getInverse(v.matrixWorldInverse),m.projectionMatrix.fromArray(a.leftProjectionMatrix),v.projectionMatrix.fromArray(a.rightProjectionMatrix),vo(g,m,v);var b=r.getLayers();if(b.length){var w=b[0];S(m.viewport,w.leftBounds),S(v.viewport,w.rightBounds)}return function(){for(var t=0;t<s.length;t++){var e=s[t],i=M(t);if(void 0!==i&&void 0!==i.pose){if(null===i.pose)return;var n=i.pose;!1===n.hasPosition&&e.position.set(.2,-.6,-.05),null!==n.position&&e.position.fromArray(n.position),null!==n.orientation&&e.quaternion.fromArray(n.orientation),e.matrix.compose(e.position,e.quaternion,e.scale),e.matrix.premultiply(c),e.matrix.decompose(e.position,e.quaternion,e.scale),e.matrixWorldNeedsUpdate=!0,e.visible=!0;var r="Daydream Controller"===i.id?0:1;void 0===_[t]&&(_[t]=!1),_[t]!==i.buttons[r].pressed&&(_[t]=i.buttons[r].pressed,!0===_[t]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"})))}else e.visible=!1}}(),g},this.getStandingMatrix=function(){return c},this.isPresenting=y;var T=new br;this.setAnimationLoop=function(t){T.setAnimationLoop(t),y()&&T.start()},this.submitFrame=function(){y()&&r.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",w)},this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}function yo(t,e){var i=this,n=null,r=null,a="local-floor",o=null,s=[],c=[];function h(){return null!==n&&null!==r}var l=new rr;l.layers.enable(1),l.viewport=new ze;var u=new rr;u.layers.enable(2),u.viewport=new ze;var p=new uo([l,u]);function d(t){for(var e=0;e<s.length;e++)c[e]===t.inputSource&&s[e].dispatchEvent({type:t.type})}function f(){t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),y.stop(),i.dispatchEvent({type:"sessionend"})}function m(t){r=t,y.setContext(n),y.start(),i.dispatchEvent({type:"sessionstart"})}function v(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)}p.layers.enable(1),p.layers.enable(2),this.enabled=!1,this.getController=function(t){var e=s[t];return void 0===e&&((e=new lo).matrixAutoUpdate=!1,e.visible=!1,s[t]=e),e},this.setFramebufferScaleFactor=function(t){},this.setReferenceSpaceType=function(t){a=t},this.getSession=function(){return n},this.setSession=function(t){null!==(n=t)&&(n.addEventListener("select",d),n.addEventListener("selectstart",d),n.addEventListener("selectend",d),n.addEventListener("end",f),n.updateRenderState({baseLayer:new XRWebGLLayer(n,e)}),n.requestReferenceSpace(a).then(m),c=n.inputSources,n.addEventListener("inputsourceschange",(function(){c=n.inputSources,console.log(c);for(var t=0;t<s.length;t++){s[t].userData.inputSource=c[t]}})))},this.getCamera=function(t){if(h()){var e=t.parent,i=p.cameras;v(p,e);for(var n=0;n<i.length;n++)v(i[n],e);t.matrixWorld.copy(p.matrixWorld);for(var r=t.children,a=(n=0,r.length);n<a;n++)r[n].updateMatrixWorld(!0);return vo(p,l,u),p}return t},this.isPresenting=h;var g=null;var y=new br;y.setAnimationLoop((function(e,i){if(null!==(o=i.getViewerPose(r))){var a=o.views,h=n.renderState.baseLayer;t.setFramebuffer(h.framebuffer);for(var l=0;l<a.length;l++){var u=a[l],d=h.getViewport(u),f=u.transform.inverse.matrix,m=p.cameras[l];m.matrix.fromArray(f).getInverse(m.matrix),m.projectionMatrix.fromArray(u.projectionMatrix),m.viewport.set(d.x,d.y,d.width,d.height),0===l&&p.matrix.copy(m.matrix)}}for(l=0;l<s.length;l++){var v=s[l],y=c[l];if(y){var x=i.getPose(y.targetRaySpace,r);if(null!==x){v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.visible=!0;continue}}v.visible=!1}g&&g(e)})),this.setAnimationLoop=function(t){g=t},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new qe},this.getDevice=function(){console.warn("THREE.WebXRManager: getDevice() has been deprecated.")},this.setDevice=function(){console.warn("THREE.WebXRManager: setDevice() has been deprecated.")},this.setFrameOfReferenceType=function(){console.warn("THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.")},this.submitFrame=function(){}}function xo(t){var e=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,h=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat,p=null,d=null;this.domElement=e,this.debug={checkShaderErrors:!0},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=X,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var f,m,v,g,y,x,b,w,_,M,S,T,E,A,L,P,R,C,O=this,N=!1,D=null,I=0,z=0,B=null,U=null,G=-1,F={geometry:null,program:null,wireframe:!1},H=null,V=null,j=new ze,k=new ze,W=null,q=e.width,Y=e.height,J=1,Z=new ze(0,0,q,Y),Q=new ze(0,0,q,Y),K=!1,$=new vr,tt=new Ar,et=!1,it=!1,nt=new qe,rt=new Pe;function at(){return null===B?J:1}try{var ot={alpha:n,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:h,powerPreference:l,failIfMajorPerformanceCaveat:u,xrCompatible:!0};if(e.addEventListener("webglcontextlost",lt,!1),e.addEventListener("webglcontextrestored",ut,!1),null===(f=i||e.getContext("webgl",ot)||e.getContext("experimental-webgl",ot)))throw null!==e.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===f.getShaderPrecisionFormat&&(f.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function st(){m=new Lr(f),(v=new Er(f,m,t)).isWebGL2||(m.get("WEBGL_depth_texture"),m.get("OES_texture_float"),m.get("OES_texture_half_float"),m.get("OES_texture_half_float_linear"),m.get("OES_standard_derivatives"),m.get("OES_element_index_uint"),m.get("ANGLE_instanced_arrays")),m.get("OES_texture_float_linear"),C=new ho(f,m,v),(g=new so(f,m,C,v)).scissor(k.copy(Q).multiplyScalar(J).floor()),g.viewport(j.copy(Z).multiplyScalar(J).floor()),y=new Cr(f),x=new Wa,b=new co(f,m,g,x,v,C,y),w=new wr(f),_=new Pr(f,w,y),M=new Dr(_,y),L=new Nr(f),S=new ka(O,m,v),T=new Ja,E=new eo,A=new Sr(O,g,M,s),P=new Tr(f,m,y,v),R=new Rr(f,m,y,v),y.programs=S.programs,O.capabilities=v,O.extensions=m,O.properties=x,O.renderLists=T,O.state=g,O.info=y}st();var ct="undefined"!=typeof navigator&&"xr"in navigator&&"supportsSession"in navigator.xr?new yo(O,f):new go(O);this.vr=ct;var ht=new oo(O,M,v.maxTextureSize);function lt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),N=!0}function ut(){console.log("THREE.WebGLRenderer: Context Restored."),N=!1,st()}function pt(t){var e=t.target;e.removeEventListener("dispose",pt),function(t){dt(t),x.remove(t)}(e)}function dt(t){var e=x.get(t).program;t.program=void 0,void 0!==e&&S.releaseProgram(e)}this.shadowMap=ht,this.getContext=function(){return f},this.getContextAttributes=function(){return f.getContextAttributes()},this.forceContextLoss=function(){var t=m.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=m.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(t){void 0!==t&&(J=t,this.setSize(q,Y,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new Te),t.set(q,Y)},this.setSize=function(t,i,n){ct.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(q=t,Y=i,e.width=Math.floor(t*J),e.height=Math.floor(i*J),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new Te),t.set(q*J,Y*J).floor()},this.setDrawingBufferSize=function(t,i,n){q=t,Y=i,J=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new ze),t.copy(j)},this.getViewport=function(t){return t.copy(Z)},this.setViewport=function(t,e,i,n){t.isVector4?Z.set(t.x,t.y,t.z,t.w):Z.set(t,e,i,n),g.viewport(j.copy(Z).multiplyScalar(J).floor())},this.getScissor=function(t){return t.copy(Q)},this.setScissor=function(t,e,i,n){t.isVector4?Q.set(t.x,t.y,t.z,t.w):Q.set(t,e,i,n),g.scissor(k.copy(Q).multiplyScalar(J).floor())},this.getScissorTest=function(){return K},this.setScissorTest=function(t){g.setScissorTest(K=t)},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),f.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",lt,!1),e.removeEventListener("webglcontextrestored",ut,!1),T.dispose(),E.dispose(),x.dispose(),M.dispose(),ct.dispose(),vt.stop()},this.renderBufferImmediate=function(t,e){g.initAttributes();var i=x.get(t);t.hasPositions&&!i.position&&(i.position=f.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=f.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=f.createBuffer()),t.hasColors&&!i.color&&(i.color=f.createBuffer());var n=e.getAttributes();t.hasPositions&&(f.bindBuffer(34962,i.position),f.bufferData(34962,t.positionArray,35048),g.enableAttribute(n.position),f.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(f.bindBuffer(34962,i.normal),f.bufferData(34962,t.normalArray,35048),g.enableAttribute(n.normal),f.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(f.bindBuffer(34962,i.uv),f.bufferData(34962,t.uvArray,35048),g.enableAttribute(n.uv),f.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(f.bindBuffer(34962,i.color),f.bufferData(34962,t.colorArray,35048),g.enableAttribute(n.color),f.vertexAttribPointer(n.color,3,5126,!1,0,0)),g.disableUnusedAttributes(),f.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,a){var o=r.isMesh&&r.matrixWorld.determinant()<0;g.setMaterial(n,o);var s=Mt(t,e,n,r),c=!1;F.geometry===i.id&&F.program===s.id&&F.wireframe===(!0===n.wireframe)||(F.geometry=i.id,F.program=s.id,F.wireframe=!0===n.wireframe,c=!0),r.morphTargetInfluences&&(L.update(r,i,n,s),c=!0);var h,l=i.index,u=i.attributes.position,p=1;!0===n.wireframe&&(l=_.getWireframeAttribute(i),p=2);var d=P;null!==l&&(h=w.get(l),(d=R).setIndex(h)),c&&(!function(t,e,i){if(i&&i.isInstancedBufferGeometry&&!v.isWebGL2&&null===m.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");g.initAttributes();var n=i.attributes,r=e.getAttributes(),a=t.defaultAttributeValues;for(var o in r){var s=r[o];if(s>=0){var c=n[o];if(void 0!==c){var h=c.normalized,l=c.itemSize,u=w.get(c);if(void 0===u)continue;var p=u.buffer,d=u.type,y=u.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,b=x.stride,_=c.offset;x&&x.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(s,x.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=x.meshPerAttribute*x.count)):g.enableAttribute(s),f.bindBuffer(34962,p),f.vertexAttribPointer(s,l,d,h,b*y,_*y)}else c.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=c.meshPerAttribute*c.count)):g.enableAttribute(s),f.bindBuffer(34962,p),f.vertexAttribPointer(s,l,d,h,0,0)}else if(void 0!==a){var M=a[o];if(void 0!==M)switch(M.length){case 2:f.vertexAttrib2fv(s,M);break;case 3:f.vertexAttrib3fv(s,M);break;case 4:f.vertexAttrib4fv(s,M);break;default:f.vertexAttrib1fv(s,M)}}}}g.disableUnusedAttributes()}(n,s,i),null!==l&&f.bindBuffer(34963,h.buffer));var y=1/0;null!==l?y=l.count:void 0!==u&&(y=u.count);var x=i.drawRange.start*p,b=i.drawRange.count*p,M=null!==a?a.start*p:0,S=null!==a?a.count*p:1/0,T=Math.max(x,M),E=Math.min(y,x+b,M+S)-1,A=Math.max(0,E-T+1);if(0!==A){if(r.isMesh)if(!0===n.wireframe)g.setLineWidth(n.wireframeLinewidth*at()),d.setMode(1);else switch(r.drawMode){case ae:d.setMode(4);break;case oe:d.setMode(5);break;case se:d.setMode(6)}else if(r.isLine){var C=n.linewidth;void 0===C&&(C=1),g.setLineWidth(C*at()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&d.renderInstances(i,T,A):d.render(T,A)}},this.compile=function(t,e){(d=E.get(t,e)).init(),t.traverse((function(t){t.isLight&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(e),t.traverse((function(e){if(e.material)if(Array.isArray(e.material))for(var i=0;i<e.material.length;i++)_t(e.material[i],t.fog,e);else _t(e.material,t.fog,e)}))};var mt=null;var vt=new br;function gt(t,e,i,n){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||$.intersectsSprite(t)){n&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt);var r=M.update(t);(a=t.material).visible&&p.push(t,r,a,i,rt.z,null)}}else if(t.isImmediateRenderObject)n&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt),p.push(t,null,t.material,i,rt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||$.intersectsObject(t))){n&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt);r=M.update(t);var a=t.material;if(Array.isArray(a))for(var o=r.groups,s=0,c=o.length;s<c;s++){var h=o[s],l=a[h.materialIndex];l&&l.visible&&p.push(t,r,l,i,rt.z,h)}else a.visible&&p.push(t,r,a,i,rt.z,null)}var u=t.children;for(s=0,c=u.length;s<c;s++)gt(u[s],e,i,n)}}function yt(t,e,i,n){for(var r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,c=o.geometry,h=void 0===n?o.material:n,l=o.group;if(i.isArrayCamera){V=i;for(var u=i.cameras,p=0,f=u.length;p<f;p++){var m=u[p];s.layers.test(m.layers)&&(g.viewport(j.copy(m.viewport)),d.setupLights(m),xt(s,e,m,c,h,l))}}else V=null,xt(s,e,i,c,h,l)}}function xt(t,e,i,n,r,a){if(t.onBeforeRender(O,e,i,n,r,a),d=E.get(e,V||i),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){g.setMaterial(r);var o=Mt(i,e.fog,r,t);F.geometry=null,F.program=null,F.wireframe=!1,function(t,e){t.render((function(t){O.renderBufferImmediate(t,e)}))}(t,o)}else O.renderBufferDirect(i,e.fog,n,r,t,a);t.onAfterRender(O,e,i,n,r,a),d=E.get(e,V||i)}function _t(t,e,i){var n=x.get(t),r=d.state.lights,a=d.state.shadowsArray,o=r.state.version,s=S.getParameters(t,r.state,a,e,tt.numPlanes,tt.numIntersection,i),c=S.getProgramCode(t,s),h=n.program,l=!0;if(void 0===h)t.addEventListener("dispose",pt);else if(h.code!==c)dt(t);else if(n.lightsStateVersion!==o)n.lightsStateVersion=o,l=!1;else{if(void 0!==s.shaderID)return;l=!1}if(l){if(s.shaderID){var u=xr[s.shaderID];n.shader={name:t.type,uniforms:Kn(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}}else n.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.onBeforeCompile(n.shader,O),c=S.getProgramCode(t,s),h=S.acquireProgram(t,n.shader,s,c),n.program=h,t.program=h}var p=h.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var f=0;f<O.maxMorphTargets;f++)p["morphTarget"+f]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(f=0;f<O.maxMorphNormals;f++)p["morphNormal"+f]>=0&&t.numSupportedMorphNormals++}var m=n.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=tt.numPlanes,n.numIntersection=tt.numIntersection,m.clippingPlanes=tt.uniform),n.fog=e,n.lightsStateVersion=o,t.lights&&(m.ambientLightColor.value=r.state.ambient,m.lightProbe.value=r.state.probe,m.directionalLights.value=r.state.directional,m.spotLights.value=r.state.spot,m.rectAreaLights.value=r.state.rectArea,m.pointLights.value=r.state.point,m.hemisphereLights.value=r.state.hemi,m.directionalShadowMap.value=r.state.directionalShadowMap,m.directionalShadowMatrix.value=r.state.directionalShadowMatrix,m.spotShadowMap.value=r.state.spotShadowMap,m.spotShadowMatrix.value=r.state.spotShadowMatrix,m.pointShadowMap.value=r.state.pointShadowMap,m.pointShadowMatrix.value=r.state.pointShadowMatrix);var v=n.program.getUniforms(),g=Ca.seqWithValue(v.seq,m);n.uniformsList=g}function Mt(t,e,i,n){b.resetTextureUnits();var r=x.get(i),a=d.state.lights;if(et&&(it||t!==H)){var o=t===H&&i.id===G;tt.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,r,o)}!1===i.needsUpdate&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsStateVersion!==a.state.version?i.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===tt.numPlanes&&r.numIntersection===tt.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(_t(i,e,n),i.needsUpdate=!1);var s=!1,h=!1,l=!1,u=r.program,p=u.getUniforms(),m=r.shader.uniforms;if(g.useProgram(u.program)&&(s=!0,h=!0,l=!0),i.id!==G&&(G=i.id,h=!0),s||H!==t){if(p.setValue(f,"projectionMatrix",t.projectionMatrix),v.logarithmicDepthBuffer&&p.setValue(f,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),H!==t&&(H=t,h=!0,l=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var y=p.map.cameraPosition;void 0!==y&&y.setValue(f,rt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&p.setValue(f,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){p.setOptional(f,n,"bindMatrix"),p.setOptional(f,n,"bindMatrixInverse");var w=n.skeleton;if(w){var _=w.bones;if(v.floatVertexTextures){if(void 0===w.boneTexture){var M=Math.sqrt(4*_.length);M=Se.ceilPowerOfTwo(M),M=Math.max(M,4);var S=new Float32Array(M*M*4);S.set(w.boneMatrices);var T=new hr(S,M,M,Lt,bt);T.needsUpdate=!0,w.boneMatrices=S,w.boneTexture=T,w.boneTextureSize=M}p.setValue(f,"boneTexture",w.boneTexture,b),p.setValue(f,"boneTextureSize",w.boneTextureSize)}else p.setOptional(f,w,"boneMatrices")}}return h&&(p.setValue(f,"toneMappingExposure",O.toneMappingExposure),p.setValue(f,"toneMappingWhitePoint",O.toneMappingWhitePoint),i.lights&&function(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}(m,l),e&&i.fog&&function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(m,e),i.isMeshBasicMaterial?St(m,i):i.isMeshLambertMaterial?(St(m,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(m,i)):i.isMeshPhongMaterial?(St(m,i),i.isMeshToonMaterial?function(t,e){Tt(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(m,i):Tt(m,i)):i.isMeshStandardMaterial?(St(m,i),i.isMeshPhysicalMaterial?function(t,e){Et(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===c&&t.clearcoatNormalScale.value.negate());t.transparency.value=e.transparency}(m,i):Et(m,i)):i.isMeshMatcapMaterial?(St(m,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===c&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===c&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(m,i)):i.isMeshDepthMaterial?(St(m,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(m,i)):i.isMeshDistanceMaterial?(St(m,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(m,i)):i.isMeshNormalMaterial?(St(m,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===c&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===c&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(m,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(m,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(m,i)):i.isPointsMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*J,t.scale.value=.5*Y,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(m,i):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(m,i):i.isShadowMaterial&&(m.color.value.copy(i.color),m.opacity.value=i.opacity),void 0!==m.ltc_1&&(m.ltc_1.value=yr.LTC_1),void 0!==m.ltc_2&&(m.ltc_2.value=yr.LTC_2),Ca.upload(f,r.uniformsList,m,b)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Ca.upload(f,r.uniformsList,m,b),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&p.setValue(f,"center",n.center),p.setValue(f,"modelViewMatrix",n.modelViewMatrix),p.setValue(f,"normalMatrix",n.normalMatrix),p.setValue(f,"modelMatrix",n.matrixWorld),u}function St(t,e){var i;t.opacity.value=e.opacity,e.color&&t.diffuse.value.copy(e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=x.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}function Tt(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===c&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===c&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Et(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===c&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===c&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}vt.setAnimationLoop((function(t){ct.isPresenting()||mt&&mt(t)})),"undefined"!=typeof window&&vt.setContext(window),this.setAnimationLoop=function(t){mt=t,ct.setAnimationLoop(t),vt.start()},this.render=function(t,e){var i,n;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."),n=arguments[3]),e&&e.isCamera){if(!N){F.geometry=null,F.program=null,F.wireframe=!1,G=-1,H=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),ct.enabled&&(e=ct.getCamera(e)),(d=E.get(t,e)).init(),t.onBeforeRender(O,t,e,i||B),nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),$.setFromMatrix(nt),it=this.localClippingEnabled,et=tt.init(this.clippingPlanes,it,e),(p=T.get(t,e)).init(),gt(t,e,0,O.sortObjects),!0===O.sortObjects&&p.sort(),et&&tt.beginShadows();var r=d.state.shadowsArray;ht.render(r,t,e),d.setupLights(e),et&&tt.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),A.render(p,t,e,n);var a=p.opaque,o=p.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&yt(a,t,e,s),o.length&&yt(o,t,e,s)}else a.length&&yt(a,t,e),o.length&&yt(o,t,e);t.onAfterRender(O,t,e),null!==B&&(b.updateRenderTargetMipmap(B),b.updateMultisampleRenderTarget(B)),g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),g.setPolygonOffset(!1),ct.enabled&&ct.submitFrame(),p=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(t){D!==t&&f.bindFramebuffer(36160,t),D=t},this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return B},this.setRenderTarget=function(t,e,i){B=t,I=e,z=i,t&&void 0===x.get(t).__webglFramebuffer&&b.setupRenderTarget(t);var n=D,r=!1;if(t){var a=x.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(n=a[e||0],r=!0):n=t.isWebGLMultisampleRenderTarget?x.get(t).__webglMultisampledFramebuffer:a,j.copy(t.viewport),k.copy(t.scissor),W=t.scissorTest}else j.copy(Z).multiplyScalar(J).floor(),k.copy(Q).multiplyScalar(J).floor(),W=K;if(U!==n&&(f.bindFramebuffer(36160,n),U=n),g.viewport(j),g.scissor(k),g.setScissorTest(W),r){var o=x.get(t.texture);f.framebufferTexture2D(36160,36064,34069+(e||0),o.__webglTexture,i||0)}},this.readRenderTargetPixels=function(t,e,i,n,r,a,o){if(t&&t.isWebGLRenderTarget){var s=x.get(t).__webglFramebuffer;if(t.isWebGLRenderTargetCube&&void 0!==o&&(s=s[o]),s){var c=!1;s!==U&&(f.bindFramebuffer(36160,s),c=!0);try{var h=t.texture,l=h.format,u=h.type;if(l!==Lt&&C.convert(l)!==f.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===ft||C.convert(u)===f.getParameter(35738)||u===bt&&(v.isWebGL2||m.get("OES_texture_float")||m.get("WEBGL_color_buffer_float"))||u===wt&&(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===f.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&f.readPixels(e,i,n,r,C.convert(l),C.convert(u),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&f.bindFramebuffer(36160,U)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,i){var n=e.image.width,r=e.image.height,a=C.convert(e.format);b.setTexture2D(e,0),f.copyTexImage2D(3553,i||0,a,t.x,t.y,n,r,0)},this.copyTextureToTexture=function(t,e,i,n){var r=e.image.width,a=e.image.height,o=C.convert(i.format),s=C.convert(i.type);b.setTexture2D(i,0),e.isDataTexture?f.texSubImage2D(3553,n||0,t.x,t.y,r,a,o,s,e.image.data):f.texSubImage2D(3553,n||0,t.x,t.y,o,s,e.image)},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function bo(t,e){this.name="",this.color=new Zi(t),this.density=void 0!==e?e:25e-5}function wo(t,e,i){this.name="",this.color=new Zi(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function _o(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Mo(t,e,i,n){this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function So(t){nn.call(this),this.type="SpriteMaterial",this.color=new Zi(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(t)}Object.assign(go.prototype,t.prototype),Object.assign(yo.prototype,t.prototype),Object.assign(bo.prototype,{isFogExp2:!0,clone:function(){return new bo(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(wo.prototype,{isFog:!0,clone:function(){return new wo(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(_o.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_o.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.stride:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Object.defineProperties(Mo.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Mo.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}}),So.prototype=Object.create(nn.prototype),So.prototype.constructor=So,So.prototype.isSpriteMaterial=!0,So.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this};var To=new Pe,Eo=new Pe,Ao=new Pe,Lo=new Te,Po=new Te,Ro=new qe,Co=new Pe,Oo=new Pe,No=new Pe,Do=new Te,Io=new Te,zo=new Te;function Bo(t){if(li.call(this),this.type="Sprite",void 0===po){po=new Sn;var e=new _o(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);po.setIndex([0,1,2,0,2,3]),po.addAttribute("position",new Mo(e,3,0,!1)),po.addAttribute("uv",new Mo(e,2,3,!1))}this.geometry=po,this.material=void 0!==t?t:new So,this.center=new Te(.5,.5)}function Uo(t,e,i,n,r,a){Lo.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(Po.x=a*Lo.x-r*Lo.y,Po.y=r*Lo.x+a*Lo.y):Po.copy(Lo),t.copy(e),t.x+=Po.x,t.y+=Po.y,t.applyMatrix4(Ro)}Bo.prototype=Object.assign(Object.create(li.prototype),{constructor:Bo,isSprite:!0,raycast:function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Eo.setFromMatrixScale(this.matrixWorld),Ro.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ao.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Eo.multiplyScalar(-Ao.z);var i,n,r=this.material.rotation;0!==r&&(n=Math.cos(r),i=Math.sin(r));var a=this.center;Uo(Co.set(-.5,-.5,0),Ao,a,Eo,i,n),Uo(Oo.set(.5,-.5,0),Ao,a,Eo,i,n),Uo(No.set(.5,.5,0),Ao,a,Eo,i,n),Do.set(0,0),Io.set(1,0),zo.set(1,1);var o=t.ray.intersectTriangle(Co,Oo,No,!1,To);if(null!==o||(Uo(Oo.set(-.5,.5,0),Ao,a,Eo,i,n),Io.set(0,1),null!==(o=t.ray.intersectTriangle(Co,No,Oo,!1,To)))){var s=t.ray.origin.distanceTo(To);s<t.near||s>t.far||e.push({distance:s,point:To.clone(),uv:qi.getUV(To,Co,Oo,No,Do,Io,zo,new Te),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return li.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}});var Go=new Pe,Fo=new Pe;function Ho(){li.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Vo(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Vn.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new qe,this.bindMatrixInverse=new qe}Ho.prototype=Object.assign(Object.create(li.prototype),{constructor:Ho,isLOD:!0,copy:function(t){li.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);return i.splice(n,0,{distance:e,object:t}),this.add(t),this},getObjectForDistance:function(t){for(var e=this.levels,i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object},raycast:function(t,e){Go.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(Go);this.getObjectForDistance(i).raycast(t,e)},update:function(t){var e=this.levels;if(e.length>1){Go.setFromMatrixPosition(t.matrixWorld),Fo.setFromMatrixPosition(this.matrixWorld);var i=Go.distanceTo(Fo);e[0].object.visible=!0;for(var n=1,r=e.length;n<r&&i>=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(;n<r;n++)e[n].object.visible=!1}},toJSON:function(t){var e=li.prototype.toJSON.call(this,t);e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var a=i[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),Vo.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Vo,isSkinnedMesh:!0,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var t=new ze,e=this.geometry.attributes.skinWeight,i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);var r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){Vn.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var jo=new qe,ko=new qe;function Wo(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new qe)}}function qo(){li.call(this),this.type="Bone"}function Xo(t){nn.call(this),this.type="LineBasicMaterial",this.color=new Zi(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}Object.assign(Wo.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new qe;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){var t,e,i;for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){for(var t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture,r=0,a=t.length;r<a;r++){var o=t[r]?t[r].matrixWorld:ko;jo.multiplyMatrices(o,e[r]),jo.toArray(i,16*r)}void 0!==n&&(n.needsUpdate=!0)},clone:function(){return new Wo(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,i=this.bones.length;e<i;e++){var n=this.bones[e];if(n.name===t)return n}}}),qo.prototype=Object.assign(Object.create(li.prototype),{constructor:qo,isBone:!0}),Xo.prototype=Object.create(nn.prototype),Xo.prototype.constructor=Xo,Xo.prototype.isLineBasicMaterial=!0,Xo.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this};var Yo=new Pe,Jo=new Pe,Zo=new qe,Qo=new Ii,Ko=new Ai;function $o(t,e,i){1===i&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),li.call(this),this.type="Line",this.geometry=void 0!==t?t:new Sn,this.material=void 0!==e?e:new Xo({color:16777215*Math.random()})}$o.prototype=Object.assign(Object.create(li.prototype),{constructor:$o,isLine:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,i=[0],n=1,r=e.count;n<r;n++)Yo.fromBufferAttribute(e,n-1),Jo.fromBufferAttribute(e,n),i[n]=i[n-1],i[n]+=Yo.distanceTo(Jo);t.addAttribute("lineDistance",new dn(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var a=t.vertices;(i=t.lineDistances)[0]=0;for(n=1,r=a.length;n<r;n++)i[n]=i[n-1],i[n]+=a[n-1].distanceTo(a[n])}return this},raycast:function(t,e){var i=t.linePrecision,n=this.geometry,r=this.matrixWorld;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ko.copy(n.boundingSphere),Ko.applyMatrix4(r),Ko.radius+=i,!1!==t.ray.intersectsSphere(Ko)){Zo.getInverse(r),Qo.copy(t.ray).applyMatrix4(Zo);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Pe,c=new Pe,h=new Pe,l=new Pe,u=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,d=n.attributes.position.array;if(null!==p)for(var f=p.array,m=0,v=f.length-1;m<v;m+=u){var g=f[m],y=f[m+1];if(s.fromArray(d,3*g),c.fromArray(d,3*y),!(Qo.distanceSqToSegment(s,c,l,h)>o))l.applyMatrix4(this.matrixWorld),(w=t.ray.origin.distanceTo(l))<t.near||w>t.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=d.length/3-1;m<v;m+=u){if(s.fromArray(d,3*m),c.fromArray(d,3*m+3),!(Qo.distanceSqToSegment(s,c,l,h)>o))l.applyMatrix4(this.matrixWorld),(w=t.ray.origin.distanceTo(l))<t.near||w>t.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var x=n.vertices,b=x.length;for(m=0;m<b-1;m+=u){var w;if(!(Qo.distanceSqToSegment(x[m],x[m+1],l,h)>o))l.applyMatrix4(this.matrixWorld),(w=t.ray.origin.distanceTo(l))<t.near||w>t.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var ts=new Pe,es=new Pe;function is(t,e){$o.call(this,t,e),this.type="LineSegments"}function ns(t,e){$o.call(this,t,e),this.type="LineLoop"}function rs(t){nn.call(this),this.type="PointsMaterial",this.color=new Zi(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(t)}is.prototype=Object.assign(Object.create($o.prototype),{constructor:is,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,i=[],n=0,r=e.count;n<r;n+=2)ts.fromBufferAttribute(e,n),es.fromBufferAttribute(e,n+1),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+ts.distanceTo(es);t.addAttribute("lineDistance",new dn(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var a=t.vertices;for(i=t.lineDistances,n=0,r=a.length;n<r;n+=2)ts.copy(a[n]),es.copy(a[n+1]),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+ts.distanceTo(es)}return this}}),ns.prototype=Object.assign(Object.create($o.prototype),{constructor:ns,isLineLoop:!0}),rs.prototype=Object.create(nn.prototype),rs.prototype.constructor=rs,rs.prototype.isPointsMaterial=!0,rs.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this};var as=new qe,os=new Ii,ss=new Ai,cs=new Pe;function hs(t,e){li.call(this),this.type="Points",this.geometry=void 0!==t?t:new Sn,this.material=void 0!==e?e:new rs({color:16777215*Math.random()}),this.updateMorphTargets()}function ls(t,e,i,n,r,a,o){var s=os.distanceSqToPoint(t);if(s<i){var c=new Pe;os.closestPointToPoint(t,c),c.applyMatrix4(n);var h=r.ray.origin.distanceTo(c);if(h<r.near||h>r.far)return;a.push({distance:h,distanceToRay:Math.sqrt(s),point:c,index:e,face:null,object:o})}}function us(t,e,i,n,r,a,o,s,c){Ie.call(this,t,e,i,n,r,a,o,s,c),this.format=void 0!==o?o:At,this.minFilter=void 0!==a?a:ut,this.magFilter=void 0!==r?r:ut,this.generateMipmaps=!1}function ps(t,e,i,n,r,a,o,s,c,h,l,u){Ie.call(this,null,a,o,s,c,h,n,r,l,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function ds(t,e,i,n,r,a,o,s,c){Ie.call(this,t,e,i,n,r,a,o,s,c),this.needsUpdate=!0}function fs(t,e,i,n,r,a,o,s,c,h){if((h=void 0!==h?h:Ct)!==Ct&&h!==Ot)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===Ct&&(i=gt),void 0===i&&h===Ot&&(i=Tt),Ie.call(this,null,n,r,a,o,s,h,i,c),this.image={width:t,height:e},this.magFilter=void 0!==o?o:ct,this.minFilter=void 0!==s?s:ct,this.flipY=!1,this.generateMipmaps=!1}function ms(t){Sn.call(this),this.type="WireframeGeometry";var e,i,n,r,a,o,s,c,h,l,u=[],p=[0,0],d={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,n=m.length;e<n;e++){var v=m[e];for(i=0;i<3;i++)s=v[f[i]],c=v[f[(i+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[h=p[0]+","+p[1]]&&(d[h]={index1:p[0],index2:p[1]})}for(h in d)o=d[h],l=t.vertices[o.index1],u.push(l.x,l.y,l.z),l=t.vertices[o.index2],u.push(l.x,l.y,l.z)}else if(t&&t.isBufferGeometry){var g,y,x,b,w,_,M;if(l=new Pe,null!==t.index){for(g=t.attributes.position,y=t.index,0===(x=t.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,a=x.length;r<a;++r)for(e=w=(b=x[r]).start,n=w+b.count;e<n;e+=3)for(i=0;i<3;i++)s=y.getX(e+i),c=y.getX(e+(i+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[h=p[0]+","+p[1]]&&(d[h]={index1:p[0],index2:p[1]});for(h in d)o=d[h],l.fromBufferAttribute(g,o.index1),u.push(l.x,l.y,l.z),l.fromBufferAttribute(g,o.index2),u.push(l.x,l.y,l.z)}else for(e=0,n=(g=t.attributes.position).count/3;e<n;e++)for(i=0;i<3;i++)_=3*e+i,l.fromBufferAttribute(g,_),u.push(l.x,l.y,l.z),M=3*e+(i+1)%3,l.fromBufferAttribute(g,M),u.push(l.x,l.y,l.z)}this.addAttribute("position",new dn(u,3))}function vs(t,e,i){Jn.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new gs(t,e,i)),this.mergeVertices()}function gs(t,e,i){Sn.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};var n,r,a=[],o=[],s=[],c=[],h=new Pe,l=new Pe,u=new Pe,p=new Pe,d=new Pe;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=e+1;for(n=0;n<=i;n++){var m=n/i;for(r=0;r<=e;r++){var v=r/e;t(v,m,l),o.push(l.x,l.y,l.z),v-1e-5>=0?(t(v-1e-5,m,u),p.subVectors(l,u)):(t(v+1e-5,m,u),p.subVectors(u,l)),m-1e-5>=0?(t(v,m-1e-5,u),d.subVectors(l,u)):(t(v,m+1e-5,u),d.subVectors(u,l)),h.crossVectors(p,d).normalize(),s.push(h.x,h.y,h.z),c.push(v,m)}}for(n=0;n<i;n++)for(r=0;r<e;r++){var g=n*f+r,y=n*f+r+1,x=(n+1)*f+r+1,b=(n+1)*f+r;a.push(g,y,b),a.push(y,x,b)}this.setIndex(a),this.addAttribute("position",new dn(o,3)),this.addAttribute("normal",new dn(s,3)),this.addAttribute("uv",new dn(c,2))}function ys(t,e,i,n){Jn.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},this.fromBufferGeometry(new xs(t,e,i,n)),this.mergeVertices()}function xs(t,e,i,n){Sn.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},i=i||1;var r=[],a=[];function o(t,e,i,n){var r,a,o=Math.pow(2,n),c=[];for(r=0;r<=o;r++){c[r]=[];var h=t.clone().lerp(i,r/o),l=e.clone().lerp(i,r/o),u=o-r;for(a=0;a<=u;a++)c[r][a]=0===a&&r===o?h:h.clone().lerp(l,a/u)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var p=Math.floor(a/2);a%2==0?(s(c[r][p+1]),s(c[r+1][p]),s(c[r][p])):(s(c[r][p+1]),s(c[r+1][p+1]),s(c[r+1][p]))}}function s(t){r.push(t.x,t.y,t.z)}function c(e,i){var n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function h(t,e,i,n){n<0&&1===t.x&&(a[e]=t.x-1),0===i.x&&0===i.z&&(a[e]=n/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}!function(t){for(var i=new Pe,n=new Pe,r=new Pe,a=0;a<e.length;a+=3)c(e[a+0],i),c(e[a+1],n),c(e[a+2],r),o(i,n,r,t)}(n=n||0),function(t){for(var e=new Pe,i=0;i<r.length;i+=3)e.x=r[i+0],e.y=r[i+1],e.z=r[i+2],e.normalize().multiplyScalar(t),r[i+0]=e.x,r[i+1]=e.y,r[i+2]=e.z}(i),function(){for(var t=new Pe,e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];var i=l(t)/2/Math.PI+.5,n=(o=t,Math.atan2(-o.y,Math.sqrt(o.x*o.x+o.z*o.z))/Math.PI+.5);a.push(i,1-n)}var o;(function(){for(var t=new Pe,e=new Pe,i=new Pe,n=new Pe,o=new Te,s=new Te,c=new Te,u=0,p=0;u<r.length;u+=9,p+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),i.set(r[u+6],r[u+7],r[u+8]),o.set(a[p+0],a[p+1]),s.set(a[p+2],a[p+3]),c.set(a[p+4],a[p+5]),n.copy(t).add(e).add(i).divideScalar(3);var d=l(n);h(o,p+0,t,d),h(s,p+2,e,d),h(c,p+4,i,d)}})(),function(){for(var t=0;t<a.length;t+=6){var e=a[t+0],i=a[t+2],n=a[t+4],r=Math.max(e,i,n),o=Math.min(e,i,n);r>.9&&o<.1&&(e<.2&&(a[t+0]+=1),i<.2&&(a[t+2]+=1),n<.2&&(a[t+4]+=1))}}()}(),this.addAttribute("position",new dn(r,3)),this.addAttribute("normal",new dn(r.slice(),3)),this.addAttribute("uv",new dn(a,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function bs(t,e){Jn.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ws(t,e)),this.mergeVertices()}function ws(t,e){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],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function _s(t,e){Jn.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ms(t,e)),this.mergeVertices()}function Ms(t,e){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],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ss(t,e){Jn.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ts(t,e)),this.mergeVertices()}function Ts(t,e){var i=(1+Math.sqrt(5))/2,n=[-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];xs.call(this,n,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Es(t,e){Jn.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new As(t,e)),this.mergeVertices()}function As(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n];xs.call(this,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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ls(t,e,i,n,r,a){Jn.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Ps(t,e,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Ps(t,e,i,n,r){Sn.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},e=e||64,i=i||1,n=n||8,r=r||!1;var a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,c=new Pe,h=new Pe,l=new Te,u=new Pe,p=[],d=[],f=[],m=[];function v(r){u=t.getPointAt(r/e,u);var o=a.normals[r],l=a.binormals[r];for(s=0;s<=n;s++){var f=s/n*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);h.x=v*o.x+m*l.x,h.y=v*o.y+m*l.y,h.z=v*o.z+m*l.z,h.normalize(),d.push(h.x,h.y,h.z),c.x=u.x+i*h.x,c.y=u.y+i*h.y,c.z=u.z+i*h.z,p.push(c.x,c.y,c.z)}}!function(){for(o=0;o<e;o++)v(o);v(!1===r?e:0),function(){for(o=0;o<=e;o++)for(s=0;s<=n;s++)l.x=o/e,l.y=s/n,f.push(l.x,l.y)}(),function(){for(s=1;s<=e;s++)for(o=1;o<=n;o++){var t=(n+1)*(s-1)+(o-1),i=(n+1)*s+(o-1),r=(n+1)*s+o,a=(n+1)*(s-1)+o;m.push(t,i,a),m.push(i,r,a)}}()}(),this.setIndex(m),this.addAttribute("position",new dn(p,3)),this.addAttribute("normal",new dn(d,3)),this.addAttribute("uv",new dn(f,2))}function Rs(t,e,i,n,r,a,o){Jn.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Cs(t,e,i,n,r,a)),this.mergeVertices()}function Cs(t,e,i,n,r,a){Sn.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},t=t||1,e=e||.4,i=Math.floor(i)||64,n=Math.floor(n)||8,r=r||2,a=a||3;var o,s,c=[],h=[],l=[],u=[],p=new Pe,d=new Pe,f=new Pe,m=new Pe,v=new Pe,g=new Pe,y=new Pe;for(o=0;o<=i;++o){var x=o/i*r*Math.PI*2;for(A(x,r,a,t,f),A(x+.01,r,a,t,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=n;++s){var b=s/n*Math.PI*2,w=-e*Math.cos(b),_=e*Math.sin(b);p.x=f.x+(w*y.x+_*v.x),p.y=f.y+(w*y.y+_*v.y),p.z=f.z+(w*y.z+_*v.z),h.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),l.push(d.x,d.y,d.z),u.push(o/i),u.push(s/n)}}for(s=1;s<=i;s++)for(o=1;o<=n;o++){var M=(n+1)*(s-1)+(o-1),S=(n+1)*s+(o-1),T=(n+1)*s+o,E=(n+1)*(s-1)+o;c.push(M,S,E),c.push(S,T,E)}function A(t,e,i,n,r){var a=Math.cos(t),o=Math.sin(t),s=i/e*t,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}this.setIndex(c),this.addAttribute("position",new dn(h,3)),this.addAttribute("normal",new dn(l,3)),this.addAttribute("uv",new dn(u,2))}function Os(t,e,i,n,r){Jn.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new Ns(t,e,i,n,r)),this.mergeVertices()}function Ns(t,e,i,n,r){Sn.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||1,e=e||.4,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var a,o,s=[],c=[],h=[],l=[],u=new Pe,p=new Pe,d=new Pe;for(a=0;a<=i;a++)for(o=0;o<=n;o++){var f=o/n*r,m=a/i*Math.PI*2;p.x=(t+e*Math.cos(m))*Math.cos(f),p.y=(t+e*Math.cos(m))*Math.sin(f),p.z=e*Math.sin(m),c.push(p.x,p.y,p.z),u.x=t*Math.cos(f),u.y=t*Math.sin(f),d.subVectors(p,u).normalize(),h.push(d.x,d.y,d.z),l.push(o/n),l.push(a/i)}for(a=1;a<=i;a++)for(o=1;o<=n;o++){var v=(n+1)*a+o-1,g=(n+1)*(a-1)+o-1,y=(n+1)*(a-1)+o,x=(n+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.addAttribute("position",new dn(c,3)),this.addAttribute("normal",new dn(h,3)),this.addAttribute("uv",new dn(l,2))}hs.prototype=Object.assign(Object.create(li.prototype),{constructor:hs,isPoints:!0,raycast:function(t,e){var i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),ss.copy(i.boundingSphere),ss.applyMatrix4(n),ss.radius+=r,!1!==t.ray.intersectsSphere(ss)){as.getInverse(n),os.copy(t.ray).applyMatrix4(as);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(i.isBufferGeometry){var s=i.index,c=i.attributes.position.array;if(null!==s)for(var h=s.array,l=0,u=h.length;l<u;l++){var p=h[l];cs.fromArray(c,3*p),ls(cs,p,o,n,t,e,this)}else{l=0;for(var d=c.length/3;l<d;l++)cs.fromArray(c,3*l),ls(cs,l,o,n,t,e,this)}}else{var f=i.vertices;for(l=0,d=f.length;l<d;l++)ls(f[l],l,o,n,t,e,this)}}},updateMorphTargets:function(){var t,e,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)i=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),us.prototype=Object.assign(Object.create(Ie.prototype),{constructor:us,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),ps.prototype=Object.create(Ie.prototype),ps.prototype.constructor=ps,ps.prototype.isCompressedTexture=!0,ds.prototype=Object.create(Ie.prototype),ds.prototype.constructor=ds,ds.prototype.isCanvasTexture=!0,fs.prototype=Object.create(Ie.prototype),fs.prototype.constructor=fs,fs.prototype.isDepthTexture=!0,ms.prototype=Object.create(Sn.prototype),ms.prototype.constructor=ms,vs.prototype=Object.create(Jn.prototype),vs.prototype.constructor=vs,gs.prototype=Object.create(Sn.prototype),gs.prototype.constructor=gs,ys.prototype=Object.create(Jn.prototype),ys.prototype.constructor=ys,xs.prototype=Object.create(Sn.prototype),xs.prototype.constructor=xs,bs.prototype=Object.create(Jn.prototype),bs.prototype.constructor=bs,ws.prototype=Object.create(xs.prototype),ws.prototype.constructor=ws,_s.prototype=Object.create(Jn.prototype),_s.prototype.constructor=_s,Ms.prototype=Object.create(xs.prototype),Ms.prototype.constructor=Ms,Ss.prototype=Object.create(Jn.prototype),Ss.prototype.constructor=Ss,Ts.prototype=Object.create(xs.prototype),Ts.prototype.constructor=Ts,Es.prototype=Object.create(Jn.prototype),Es.prototype.constructor=Es,As.prototype=Object.create(xs.prototype),As.prototype.constructor=As,Ls.prototype=Object.create(Jn.prototype),Ls.prototype.constructor=Ls,Ps.prototype=Object.create(Sn.prototype),Ps.prototype.constructor=Ps,Ps.prototype.toJSON=function(){var t=Sn.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},Rs.prototype=Object.create(Jn.prototype),Rs.prototype.constructor=Rs,Cs.prototype=Object.create(Sn.prototype),Cs.prototype.constructor=Cs,Os.prototype=Object.create(Jn.prototype),Os.prototype.constructor=Os,Ns.prototype=Object.create(Sn.prototype),Ns.prototype.constructor=Ns;var Ds=function(t,e,i){i=i||2;var n,r,a,o,s,c,h,l=e&&e.length,u=l?e[0]*i:t.length,p=Is(t,0,u,i,!0),d=[];if(!p||p.next===p.prev)return d;if(l&&(p=function(t,e,i,n){var r,a,o,s,c,h=[];for(r=0,a=e.length;r<a;r++)o=e[r]*n,s=r<a-1?e[r+1]*n:t.length,(c=Is(t,o,s,n,!1))===c.next&&(c.steiner=!0),h.push(Ws(c));for(h.sort(Vs),r=0;r<h.length;r++)js(h[r],i),i=zs(i,i.next);return i}(t,e,p,i)),t.length>80*i){n=a=t[0],r=o=t[1];for(var f=i;f<u;f+=i)(s=t[f])<n&&(n=s),(c=t[f+1])<r&&(r=c),s>a&&(a=s),c>o&&(o=c);h=0!==(h=Math.max(a-n,o-r))?1/h:0}return Bs(p,d,i,n,r,h),d};function Is(t,e,i,n,r){var a,o;if(r===function(t,e,i,n){for(var r=0,a=e,o=i-n;a<i;a+=n)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}(t,e,i,n)>0)for(a=e;a<i;a+=n)o=$s(a,t[a],t[a+1],o);else for(a=i-n;a>=e;a-=n)o=$s(a,t[a],t[a+1],o);return o&&Js(o,o.next)&&(tc(o),o=o.next),o}function zs(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Js(n,n.next)&&0!==Ys(n.prev,n,n.next))n=n.next;else{if(tc(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function Bs(t,e,i,n,r,a,o){if(t){!o&&a&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=ks(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,a,o,s,c,h=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,n=i,s=0,e=0;e<h&&(s++,n=n.nextZ);e++);for(c=h;s>0||c>0&&n;)0!==s&&(0===c||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,c--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,h*=2}while(o>1)}(r)}(t,n,r,a);for(var s,c,h=t;t.prev!==t.next;)if(s=t.prev,c=t.next,a?Gs(t,n,r,a):Us(t))e.push(s.i/i),e.push(t.i/i),e.push(c.i/i),tc(t),t=c.next,h=c.next;else if((t=c)===h){o?1===o?Bs(t=Fs(t,e,i),e,i,n,r,a,2):2===o&&Hs(t,e,i,n,r,a):Bs(zs(t),e,i,n,r,a,1);break}}}function Us(t){var e=t.prev,i=t,n=t.next;if(Ys(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(qs(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Ys(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Gs(t,e,i,n){var r=t.prev,a=t,o=t.next;if(Ys(r,a,o)>=0)return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,c=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,h=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,l=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=ks(s,c,e,i,n),p=ks(h,l,e,i,n),d=t.prevZ,f=t.nextZ;d&&d.z>=u&&f&&f.z<=p;){if(d!==t.prev&&d!==t.next&&qs(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ys(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==t.prev&&f!==t.next&&qs(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ys(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&qs(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ys(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&qs(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ys(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Fs(t,e,i){var n=t;do{var r=n.prev,a=n.next.next;!Js(r,a)&&Zs(r,n,n.next,a)&&Qs(r,a)&&Qs(a,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(a.i/i),tc(n),tc(n.next),n=t=a),n=n.next}while(n!==t);return n}function Hs(t,e,i,n,r,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Xs(o,s)){var c=Ks(o,s);return o=zs(o,o.next),c=zs(c,c.next),Bs(o,e,i,n,r,a),void Bs(c,e,i,n,r,a)}s=s.next}o=o.next}while(o!==t)}function Vs(t,e){return t.x-e.x}function js(t,e){if(e=function(t,e){var i,n=e,r=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>o){if(o=s,s===r){if(a===n.y)return n;if(a===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(r===o)return i.prev;var c,h=i,l=i.x,u=i.y,p=1/0;n=i.next;for(;n!==h;)r>=n.x&&n.x>=l&&r!==n.x&&qs(a<u?r:o,a,l,u,a<u?o:r,a,n.x,n.y)&&((c=Math.abs(a-n.y)/(r-n.x))<p||c===p&&n.x>i.x)&&Qs(n,t)&&(i=n,p=c),n=n.next;return i}(t,e)){var i=Ks(e,t);zs(i,i.next)}}function ks(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ws(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function qs(t,e,i,n,r,a,o,s){return(r-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(n-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(r-o)*(n-s)>=0}function Xs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Zs(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&Qs(t,e)&&Qs(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function Ys(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Js(t,e){return t.x===e.x&&t.y===e.y}function Zs(t,e,i,n){return!!(Js(t,i)&&Js(e,n)||Js(t,n)&&Js(i,e))||Ys(t,e,i)>0!=Ys(t,e,n)>0&&Ys(i,n,t)>0!=Ys(i,n,e)>0}function Qs(t,e){return Ys(t.prev,t,t.next)<0?Ys(t,e,t.next)>=0&&Ys(t,t.prev,e)>=0:Ys(t,e,t.prev)<0||Ys(t,t.next,e)<0}function Ks(t,e){var i=new ec(t.i,t.x,t.y),n=new ec(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function $s(t,e,i,n){var r=new ec(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function tc(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ec(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ic={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},isClockWise:function(t){return ic.area(t)<0},triangulateShape:function(t,e){var i=[],n=[],r=[];nc(t),rc(i,t);var a=t.length;e.forEach(nc);for(var o=0;o<e.length;o++)n.push(a),a+=e[o].length,rc(i,e[o]);var s=Ds(i,n);for(o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function nc(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function rc(t,e){for(var i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function ac(t,e){Jn.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new oc(t,e)),this.mergeVertices()}function oc(t,e){Sn.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];for(var i=this,n=[],r=[],a=0,o=t.length;a<o;a++){s(t[a])}function s(t){var a=[],o=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,c=void 0!==e.depth?e.depth:100,h=void 0===e.bevelEnabled||e.bevelEnabled,l=void 0!==e.bevelThickness?e.bevelThickness:6,u=void 0!==e.bevelSize?e.bevelSize:l-2,p=void 0!==e.bevelOffset?e.bevelOffset:0,d=void 0!==e.bevelSegments?e.bevelSegments:3,f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:sc;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=e.amount);var v,g,y,x,b,w,_,M,S=!1;f&&(v=f.getSpacedPoints(s),S=!0,h=!1,g=f.computeFrenetFrames(s,!1),y=new Pe,x=new Pe,b=new Pe),h||(d=0,l=0,u=0,p=0);var T=t.extractPoints(o),E=T.shape,A=T.holes;if(!ic.isClockWise(E))for(E=E.reverse(),_=0,M=A.length;_<M;_++)w=A[_],ic.isClockWise(w)&&(A[_]=w.reverse());var L=ic.triangulateShape(E,A),P=E;for(_=0,M=A.length;_<M;_++)w=A[_],E=E.concat(w);function R(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}var C,O,N,D,I,z,B=E.length,U=L.length;function G(t,e,i){var n,r,a,o=t.x-e.x,s=t.y-e.y,c=i.x-t.x,h=i.y-t.y,l=o*o+s*s,u=o*h-s*c;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(l),d=Math.sqrt(c*c+h*h),f=e.x-s/p,m=e.y+o/p,v=((i.x-h/d-f)*h-(i.y+c/d-m)*c)/(o*h-s*c),g=(n=f+o*v-t.x)*n+(r=m+s*v-t.y)*r;if(g<=2)return new Te(n,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(h)&&(y=!0),y?(n=-s,r=o,a=Math.sqrt(l)):(n=o,r=s,a=Math.sqrt(l/2))}return new Te(n/a,r/a)}for(var F=[],H=0,V=P.length,j=V-1,k=H+1;H<V;H++,j++,k++)j===V&&(j=0),k===V&&(k=0),F[H]=G(P[H],P[j],P[k]);var W,q,X=[],Y=F.concat();for(_=0,M=A.length;_<M;_++){for(w=A[_],W=[],H=0,j=(V=w.length)-1,k=H+1;H<V;H++,j++,k++)j===V&&(j=0),k===V&&(k=0),W[H]=G(w[H],w[j],w[k]);X.push(W),Y=Y.concat(W)}for(C=0;C<d;C++){for(N=C/d,D=l*Math.cos(N*Math.PI/2),O=u*Math.sin(N*Math.PI/2)+p,H=0,V=P.length;H<V;H++)Z((I=R(P[H],F[H],O)).x,I.y,-D);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],H=0,V=w.length;H<V;H++)Z((I=R(w[H],W[H],O)).x,I.y,-D)}for(O=u+p,H=0;H<B;H++)I=h?R(E[H],Y[H],O):E[H],S?(x.copy(g.normals[0]).multiplyScalar(I.x),y.copy(g.binormals[0]).multiplyScalar(I.y),b.copy(v[0]).add(x).add(y),Z(b.x,b.y,b.z)):Z(I.x,I.y,0);for(q=1;q<=s;q++)for(H=0;H<B;H++)I=h?R(E[H],Y[H],O):E[H],S?(x.copy(g.normals[q]).multiplyScalar(I.x),y.copy(g.binormals[q]).multiplyScalar(I.y),b.copy(v[q]).add(x).add(y),Z(b.x,b.y,b.z)):Z(I.x,I.y,c/s*q);for(C=d-1;C>=0;C--){for(N=C/d,D=l*Math.cos(N*Math.PI/2),O=u*Math.sin(N*Math.PI/2)+p,H=0,V=P.length;H<V;H++)Z((I=R(P[H],F[H],O)).x,I.y,c+D);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],H=0,V=w.length;H<V;H++)I=R(w[H],W[H],O),S?Z(I.x,I.y+v[s-1].y,v[s-1].x+D):Z(I.x,I.y,c+D)}function J(t,e){var i,n;for(H=t.length;--H>=0;){i=H,(n=H-1)<0&&(n=t.length-1);var r=0,a=s+2*d;for(r=0;r<a;r++){var o=B*r,c=B*(r+1);K(e+i+o,e+n+o,e+n+c,e+i+c)}}}function Z(t,e,i){a.push(t),a.push(e),a.push(i)}function Q(t,e,r){$(t),$(e),$(r);var a=n.length/3,o=m.generateTopUV(i,n,a-3,a-2,a-1);tt(o[0]),tt(o[1]),tt(o[2])}function K(t,e,r,a){$(t),$(e),$(a),$(e),$(r),$(a);var o=n.length/3,s=m.generateSideWallUV(i,n,o-6,o-3,o-2,o-1);tt(s[0]),tt(s[1]),tt(s[3]),tt(s[1]),tt(s[2]),tt(s[3])}function $(t){n.push(a[3*t+0]),n.push(a[3*t+1]),n.push(a[3*t+2])}function tt(t){r.push(t.x),r.push(t.y)}!function(){var t=n.length/3;if(h){var e=0,r=B*e;for(H=0;H<U;H++)Q((z=L[H])[2]+r,z[1]+r,z[0]+r);for(r=B*(e=s+2*d),H=0;H<U;H++)Q((z=L[H])[0]+r,z[1]+r,z[2]+r)}else{for(H=0;H<U;H++)Q((z=L[H])[2],z[1],z[0]);for(H=0;H<U;H++)Q((z=L[H])[0]+B*s,z[1]+B*s,z[2]+B*s)}i.addGroup(t,n.length/3-t,0)}(),function(){var t=n.length/3,e=0;for(J(P,e),e+=P.length,_=0,M=A.length;_<M;_++)J(w=A[_],e),e+=w.length;i.addGroup(t,n.length/3-t,1)}()}this.addAttribute("position",new dn(n,3)),this.addAttribute("uv",new dn(r,2)),this.computeVertexNormals()}ac.prototype=Object.create(Jn.prototype),ac.prototype.constructor=ac,ac.prototype.toJSON=function(){var t=Jn.prototype.toJSON.call(this);return cc(this.parameters.shapes,this.parameters.options,t)},oc.prototype=Object.create(Sn.prototype),oc.prototype.constructor=oc,oc.prototype.toJSON=function(){var t=Sn.prototype.toJSON.call(this);return cc(this.parameters.shapes,this.parameters.options,t)};var sc={generateTopUV:function(t,e,i,n,r){var a=e[3*i],o=e[3*i+1],s=e[3*n],c=e[3*n+1],h=e[3*r],l=e[3*r+1];return[new Te(a,o),new Te(s,c),new Te(h,l)]},generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1],c=e[3*i+2],h=e[3*n],l=e[3*n+1],u=e[3*n+2],p=e[3*r],d=e[3*r+1],f=e[3*r+2],m=e[3*a],v=e[3*a+1],g=e[3*a+2];return Math.abs(s-l)<.01?[new Te(o,1-c),new Te(h,1-u),new Te(p,1-f),new Te(m,1-g)]:[new Te(s,1-c),new Te(l,1-u),new Te(d,1-f),new Te(v,1-g)]}};function cc(t,e,i){if(i.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var a=t[n];i.shapes.push(a.uuid)}else i.shapes.push(t.uuid);return void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}function hc(t,e){Jn.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new lc(t,e)),this.mergeVertices()}function lc(t,e){var i=(e=e||{}).font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Jn;var n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),oc.call(this,n,e),this.type="TextBufferGeometry"}function uc(t,e,i,n,r,a,o){Jn.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new pc(t,e,i,n,r,a,o)),this.mergeVertices()}function pc(t,e,i,n,r,a,o){Sn.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},t=t||1,e=Math.max(3,Math.floor(e)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,c,h=Math.min(a+o,Math.PI),l=0,u=[],p=new Pe,d=new Pe,f=[],m=[],v=[],g=[];for(c=0;c<=i;c++){var y=[],x=c/i,b=0;for(0==c&&0==a?b=.5/e:c==i&&h==Math.PI&&(b=-.5/e),s=0;s<=e;s++){var w=s/e;p.x=-t*Math.cos(n+w*r)*Math.sin(a+x*o),p.y=t*Math.cos(a+x*o),p.z=t*Math.sin(n+w*r)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.copy(p).normalize(),v.push(d.x,d.y,d.z),g.push(w+b,1-x),y.push(l++)}u.push(y)}for(c=0;c<i;c++)for(s=0;s<e;s++){var _=u[c][s+1],M=u[c][s],S=u[c+1][s],T=u[c+1][s+1];(0!==c||a>0)&&f.push(_,M,T),(c!==i-1||h<Math.PI)&&f.push(M,S,T)}this.setIndex(f),this.addAttribute("position",new dn(m,3)),this.addAttribute("normal",new dn(v,3)),this.addAttribute("uv",new dn(g,2))}function dc(t,e,i,n,r,a){Jn.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new fc(t,e,i,n,r,a)),this.mergeVertices()}function fc(t,e,i,n,r,a){Sn.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},t=t||.5,e=e||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var o,s,c,h=[],l=[],u=[],p=[],d=t,f=(e-t)/(n=void 0!==n?Math.max(1,n):1),m=new Pe,v=new Te;for(s=0;s<=n;s++){for(c=0;c<=i;c++)o=r+c/i*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),l.push(m.x,m.y,m.z),u.push(0,0,1),v.x=(m.x/e+1)/2,v.y=(m.y/e+1)/2,p.push(v.x,v.y);d+=f}for(s=0;s<n;s++){var g=s*(i+1);for(c=0;c<i;c++){var y=o=c+g,x=o+i+1,b=o+i+2,w=o+1;h.push(y,x,w),h.push(x,b,w)}}this.setIndex(h),this.addAttribute("position",new dn(l,3)),this.addAttribute("normal",new dn(u,3)),this.addAttribute("uv",new dn(p,2))}function mc(t,e,i,n){Jn.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new vc(t,e,i,n)),this.mergeVertices()}function vc(t,e,i,n){Sn.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e)||12,i=i||0,n=n||2*Math.PI,n=Se.clamp(n,0,2*Math.PI);var r,a,o,s=[],c=[],h=[],l=1/e,u=new Pe,p=new Te;for(a=0;a<=e;a++){var d=i+a*l*n,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=t.length-1;o++)u.x=t[o].x*f,u.y=t[o].y,u.z=t[o].x*m,c.push(u.x,u.y,u.z),p.x=a/e,p.y=o/(t.length-1),h.push(p.x,p.y)}for(a=0;a<e;a++)for(o=0;o<t.length-1;o++){var v=r=o+a*t.length,g=r+t.length,y=r+t.length+1,x=r+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.addAttribute("position",new dn(c,3)),this.addAttribute("uv",new dn(h,2)),this.computeVertexNormals(),n===2*Math.PI){var b=this.attributes.normal.array,w=new Pe,_=new Pe,M=new Pe;for(r=e*t.length*3,a=0,o=0;a<t.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[r+o+0],_.y=b[r+o+1],_.z=b[r+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[r+o+0]=M.x,b[o+1]=b[r+o+1]=M.y,b[o+2]=b[r+o+2]=M.z}}function gc(t,e){Jn.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new yc(t,e)),this.mergeVertices()}function yc(t,e){Sn.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var i=[],n=[],r=[],a=[],o=0,s=0;if(!1===Array.isArray(t))h(t);else for(var c=0;c<t.length;c++)h(t[c]),this.addGroup(o,s,c),o+=s,s=0;function h(t){var o,c,h,l=n.length/3,u=t.extractPoints(e),p=u.shape,d=u.holes;for(!1===ic.isClockWise(p)&&(p=p.reverse()),o=0,c=d.length;o<c;o++)h=d[o],!0===ic.isClockWise(h)&&(d[o]=h.reverse());var f=ic.triangulateShape(p,d);for(o=0,c=d.length;o<c;o++)h=d[o],p=p.concat(h);for(o=0,c=p.length;o<c;o++){var m=p[o];n.push(m.x,m.y,0),r.push(0,0,1),a.push(m.x,m.y)}for(o=0,c=f.length;o<c;o++){var v=f[o],g=v[0]+l,y=v[1]+l,x=v[2]+l;i.push(g,y,x),s+=3}}this.setIndex(i),this.addAttribute("position",new dn(n,3)),this.addAttribute("normal",new dn(r,3)),this.addAttribute("uv",new dn(a,2))}function xc(t,e){if(e.shapes=[],Array.isArray(t))for(var i=0,n=t.length;i<n;i++){var r=t[i];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}function bc(t,e){Sn.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var i,n,r,a,o=[],s=Math.cos(Se.DEG2RAD*e),c=[0,0],h={},l=["a","b","c"];t.isBufferGeometry?(a=new Jn).fromBufferGeometry(t):a=t.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],v=0;v<3;v++)i=m[l[v]],n=m[l[(v+1)%3]],c[0]=Math.min(i,n),c[1]=Math.max(i,n),void 0===h[r=c[0]+","+c[1]]?h[r]={index1:c[0],index2:c[1],face1:d,face2:void 0}:h[r].face2=d;for(r in h){var g=h[r];if(void 0===g.face2||p[g.face1].normal.dot(p[g.face2].normal)<=s){var y=u[g.index1];o.push(y.x,y.y,y.z),y=u[g.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new dn(o,3))}function wc(t,e,i,n,r,a,o,s){Jn.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new _c(t,e,i,n,r,a,o,s)),this.mergeVertices()}function _c(t,e,i,n,r,a,o,s){Sn.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};var c=this;t=void 0!==t?t:1,e=void 0!==e?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var h=[],l=[],u=[],p=[],d=0,f=[],m=i/2,v=0;function g(i){var r,a,f,g=new Te,y=new Pe,x=0,b=!0===i?t:e,w=!0===i?1:-1;for(a=d,r=1;r<=n;r++)l.push(0,m*w,0),u.push(0,w,0),p.push(.5,.5),d++;for(f=d,r=0;r<=n;r++){var _=r/n*s+o,M=Math.cos(_),S=Math.sin(_);y.x=b*S,y.y=m*w,y.z=b*M,l.push(y.x,y.y,y.z),u.push(0,w,0),g.x=.5*M+.5,g.y=.5*S*w+.5,p.push(g.x,g.y),d++}for(r=0;r<n;r++){var T=a+r,E=f+r;!0===i?h.push(E,E+1,T):h.push(E+1,E,T),x+=3}c.addGroup(v,x,!0===i?1:2),v+=x}!function(){var a,g,y=new Pe,x=new Pe,b=0,w=(e-t)/i;for(g=0;g<=r;g++){var _=[],M=g/r,S=M*(e-t)+t;for(a=0;a<=n;a++){var T=a/n,E=T*s+o,A=Math.sin(E),L=Math.cos(E);x.x=S*A,x.y=-M*i+m,x.z=S*L,l.push(x.x,x.y,x.z),y.set(A,w,L).normalize(),u.push(y.x,y.y,y.z),p.push(T,1-M),_.push(d++)}f.push(_)}for(a=0;a<n;a++)for(g=0;g<r;g++){var P=f[g][a],R=f[g+1][a],C=f[g+1][a+1],O=f[g][a+1];h.push(P,R,O),h.push(R,C,O),b+=6}c.addGroup(v,b,0),v+=b}(),!1===a&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(h),this.addAttribute("position",new dn(l,3)),this.addAttribute("normal",new dn(u,3)),this.addAttribute("uv",new dn(p,2))}function Mc(t,e,i,n,r,a,o){wc.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Sc(t,e,i,n,r,a,o){_c.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Tc(t,e,i,n){Jn.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new Ec(t,e,i,n)),this.mergeVertices()}function Ec(t,e,i,n){Sn.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,a,o=[],s=[],c=[],h=[],l=new Pe,u=new Te;for(s.push(0,0,0),c.push(0,0,1),h.push(.5,.5),a=0,r=3;a<=e;a++,r+=3){var p=i+a/e*n;l.x=t*Math.cos(p),l.y=t*Math.sin(p),s.push(l.x,l.y,l.z),c.push(0,0,1),u.x=(s[r]/t+1)/2,u.y=(s[r+1]/t+1)/2,h.push(u.x,u.y)}for(r=1;r<=e;r++)o.push(r,r+1,0);this.setIndex(o),this.addAttribute("position",new dn(s,3)),this.addAttribute("normal",new dn(c,3)),this.addAttribute("uv",new dn(h,2))}hc.prototype=Object.create(Jn.prototype),hc.prototype.constructor=hc,lc.prototype=Object.create(oc.prototype),lc.prototype.constructor=lc,uc.prototype=Object.create(Jn.prototype),uc.prototype.constructor=uc,pc.prototype=Object.create(Sn.prototype),pc.prototype.constructor=pc,dc.prototype=Object.create(Jn.prototype),dc.prototype.constructor=dc,fc.prototype=Object.create(Sn.prototype),fc.prototype.constructor=fc,mc.prototype=Object.create(Jn.prototype),mc.prototype.constructor=mc,vc.prototype=Object.create(Sn.prototype),vc.prototype.constructor=vc,gc.prototype=Object.create(Jn.prototype),gc.prototype.constructor=gc,gc.prototype.toJSON=function(){var t=Jn.prototype.toJSON.call(this);return xc(this.parameters.shapes,t)},yc.prototype=Object.create(Sn.prototype),yc.prototype.constructor=yc,yc.prototype.toJSON=function(){var t=Sn.prototype.toJSON.call(this);return xc(this.parameters.shapes,t)},bc.prototype=Object.create(Sn.prototype),bc.prototype.constructor=bc,wc.prototype=Object.create(Jn.prototype),wc.prototype.constructor=wc,_c.prototype=Object.create(Sn.prototype),_c.prototype.constructor=_c,Mc.prototype=Object.create(wc.prototype),Mc.prototype.constructor=Mc,Sc.prototype=Object.create(_c.prototype),Sc.prototype.constructor=Sc,Tc.prototype=Object.create(Jn.prototype),Tc.prototype.constructor=Tc,Ec.prototype=Object.create(Sn.prototype),Ec.prototype.constructor=Ec;var Ac=Object.freeze({WireframeGeometry:ms,ParametricGeometry:vs,ParametricBufferGeometry:gs,TetrahedronGeometry:bs,TetrahedronBufferGeometry:ws,OctahedronGeometry:_s,OctahedronBufferGeometry:Ms,IcosahedronGeometry:Ss,IcosahedronBufferGeometry:Ts,DodecahedronGeometry:Es,DodecahedronBufferGeometry:As,PolyhedronGeometry:ys,PolyhedronBufferGeometry:xs,TubeGeometry:Ls,TubeBufferGeometry:Ps,TorusKnotGeometry:Rs,TorusKnotBufferGeometry:Cs,TorusGeometry:Os,TorusBufferGeometry:Ns,TextGeometry:hc,TextBufferGeometry:lc,SphereGeometry:uc,SphereBufferGeometry:pc,RingGeometry:dc,RingBufferGeometry:fc,PlaneGeometry:_r,PlaneBufferGeometry:Mr,LatheGeometry:mc,LatheBufferGeometry:vc,ShapeGeometry:gc,ShapeBufferGeometry:yc,ExtrudeGeometry:ac,ExtrudeBufferGeometry:oc,EdgesGeometry:bc,ConeGeometry:Mc,ConeBufferGeometry:Sc,CylinderGeometry:wc,CylinderBufferGeometry:_c,CircleGeometry:Tc,CircleBufferGeometry:Ec,BoxGeometry:Zn,BoxBufferGeometry:Qn});function Lc(t){nn.call(this),this.type="ShadowMaterial",this.color=new Zi(0),this.transparent=!0,this.setValues(t)}function Pc(t){ir.call(this,t),this.type="RawShaderMaterial"}function Rc(t){nn.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Zi(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 Zi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ye,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Cc(t){Rc.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new Te(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(t)}function Oc(t){nn.call(this),this.type="MeshPhongMaterial",this.color=new Zi(16777215),this.specular=new Zi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ye,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Nc(t){Oc.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Dc(t){nn.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ye,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ic(t){nn.call(this),this.type="MeshLambertMaterial",this.color=new Zi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function zc(t){nn.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Zi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ye,this.normalScale=new Te(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(t)}function Bc(t){Xo.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}Lc.prototype=Object.create(nn.prototype),Lc.prototype.constructor=Lc,Lc.prototype.isShadowMaterial=!0,Lc.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.color.copy(t.color),this},Pc.prototype=Object.create(ir.prototype),Pc.prototype.constructor=Pc,Pc.prototype.isRawShaderMaterial=!0,Rc.prototype=Object.create(nn.prototype),Rc.prototype.constructor=Rc,Rc.prototype.isMeshStandardMaterial=!0,Rc.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Cc.prototype=Object.create(Rc.prototype),Cc.prototype.constructor=Cc,Cc.prototype.isMeshPhysicalMaterial=!0,Cc.prototype.copy=function(t){return Rc.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearcoat=t.clearcoat,this.clearcoatRoughness=t.clearcoatRoughness,t.sheen?this.sheen=(this.sheen||new Zi).copy(t.sheen):this.sheen=null,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.transparency=t.transparency,this},Oc.prototype=Object.create(nn.prototype),Oc.prototype.constructor=Oc,Oc.prototype.isMeshPhongMaterial=!0,Oc.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Nc.prototype=Object.create(Oc.prototype),Nc.prototype.constructor=Nc,Nc.prototype.isMeshToonMaterial=!0,Nc.prototype.copy=function(t){return Oc.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Dc.prototype=Object.create(nn.prototype),Dc.prototype.constructor=Dc,Dc.prototype.isMeshNormalMaterial=!0,Dc.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ic.prototype=Object.create(nn.prototype),Ic.prototype.constructor=Ic,Ic.prototype.isMeshLambertMaterial=!0,Ic.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},zc.prototype=Object.create(nn.prototype),zc.prototype.constructor=zc,zc.prototype.isMeshMatcapMaterial=!0,zc.prototype.copy=function(t){return nn.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Bc.prototype=Object.create(Xo.prototype),Bc.prototype.constructor=Bc,Bc.prototype.isLineDashedMaterial=!0,Bc.prototype.copy=function(t){return Xo.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Uc=Object.freeze({ShadowMaterial:Lc,SpriteMaterial:So,RawShaderMaterial:Pc,ShaderMaterial:ir,PointsMaterial:rs,MeshPhysicalMaterial:Cc,MeshStandardMaterial:Rc,MeshPhongMaterial:Oc,MeshToonMaterial:Nc,MeshNormalMaterial:Dc,MeshLambertMaterial:Ic,MeshDepthMaterial:io,MeshDistanceMaterial:no,MeshBasicMaterial:rn,MeshMatcapMaterial:zc,LineDashedMaterial:Bc,LineBasicMaterial:Xo,Material:nn}),Gc={arraySlice:function(t,e,i){return Gc.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,i=new Array(e),n=0;n!==e;++n)i[n]=n;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,c=0;c!==e;++c)r[o++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[n])&&(e.push(a.time),i.push.apply(i,o)),a=t[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[n])&&(e.push(a.time),o.toArray(i,i.length)),a=t[r++]}while(void 0!==a);else do{void 0!==(o=a[n])&&(e.push(a.time),i.push(o)),a=t[r++]}while(void 0!==a)}}};function Fc(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function Hc(t,e,i,n){Fc.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Vc(t,e,i,n){Fc.call(this,t,e,i,n)}function jc(t,e,i,n){Fc.call(this,t,e,i,n)}function kc(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Gc.convertArray(e,this.TimeBufferType),this.values=Gc.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function Wc(t,e,i){kc.call(this,t,e,i)}function qc(t,e,i,n){kc.call(this,t,e,i,n)}function Xc(t,e,i,n){kc.call(this,t,e,i,n)}function Yc(t,e,i,n){Fc.call(this,t,e,i,n)}function Jc(t,e,i,n){kc.call(this,t,e,i,n)}function Zc(t,e,i,n){kc.call(this,t,e,i,n)}function Qc(t,e,i,n){kc.call(this,t,e,i,n)}function Kc(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=Se.generateUUID(),this.duration<0&&this.resetDuration()}function $c(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xc;case"vector":case"vector2":case"vector3":case"vector4":return Qc;case"color":return qc;case"quaternion":return Jc;case"bool":case"boolean":return Wc;case"string":return Zc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var i=[],n=[];Gc.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(Fc.prototype,{evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var a;i:{n:if(!(t<n)){for(var o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,t<(n=e[++i]))break e}a=e.length;break i}if(t>=r)break t;var s=e[1];t<s&&(i=2,r=s);for(o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,t>=(r=e[--i-1]))break e}a=i,i=0}for(;i<a;){var c=i+a>>>1;t<e[c]?a=c:i=c+1}if(n=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,a=0;a!==n;++a)e[a]=i[r+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Fc.prototype,{beforeStart_:Fc.prototype.copySampleValue_,afterEnd_:Fc.prototype.copySampleValue_}),Hc.prototype=Object.assign(Object.create(Fc.prototype),{constructor:Hc,DefaultSettings_:{endingStart:re,endingEnd:re},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-i;break;case 2402:o=e+n[r=n.length-2]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=t,s=2*i-e;break;case 2402:a=1,s=i+n[1]-n[0];break;default:a=t-1,s=e}var c=.5*(i-e),h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-i),this._offsetPrev=r*h,this._offsetNext=a*h},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-e)/(n-e),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(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)r[b]=v*a[h+b]+g*a[c+b]+y*a[s+b]+x*a[l+b];return r}}),Vc.prototype=Object.assign(Object.create(Fc.prototype),{constructor:Vc,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=(i-e)/(n-e),l=1-h,u=0;u!==o;++u)r[u]=a[c+u]*l+a[s+u]*h;return r}}),jc.prototype=Object.assign(Object.create(Fc.prototype),{constructor:jc,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(kc,{toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:Gc.convertArray(t.times,Array),values:Gc.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e}}),Object.assign(kc.prototype,{constructor:kc,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new jc(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Vc(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Hc(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=e,this},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(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,a=n-1;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Gc.arraySlice(i,r,a),this.values=Gc.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==n&&Gc.isTypedArray(n)){o=0;for(var c=n.length;o!==c;++o){var h=n[o];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,h),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=2302===this.getInterpolation(),r=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o];if(c!==t[o+1]&&(1!==o||c!==c[0]))if(n)s=!0;else for(var h=o*i,l=h-i,u=h+i,p=0;p!==i;++p){var d=e[h+p];if(d!==e[l+p]||d!==e[u+p]){s=!0;break}}if(s){if(o!==r){t[r]=t[o];var f=o*i,m=r*i;for(p=0;p!==i;++p)e[m+p]=e[f+p]}++r}}if(a>0){t[r]=t[a];for(f=a*i,m=r*i,p=0;p!==i;++p)e[m+p]=e[f+p];++r}return r!==t.length&&(this.times=Gc.arraySlice(t,0,r),this.values=Gc.arraySlice(e,0,r*i)),this},clone:function(){var t=Gc.arraySlice(this.times,0),e=Gc.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}),Wc.prototype=Object.assign(Object.create(kc.prototype),{constructor:Wc,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),qc.prototype=Object.assign(Object.create(kc.prototype),{constructor:qc,ValueTypeName:"color"}),Xc.prototype=Object.assign(Object.create(kc.prototype),{constructor:Xc,ValueTypeName:"number"}),Yc.prototype=Object.assign(Object.create(Fc.prototype),{constructor:Yc,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=(i-e)/(n-e),h=s+o;s!==h;s+=4)Ee.slerpFlat(r,0,a,s-o,a,s,c);return r}}),Jc.prototype=Object.assign(Object.create(kc.prototype),{constructor:Jc,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Yc(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Zc.prototype=Object.assign(Object.create(kc.prototype),{constructor:Zc,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Qc.prototype=Object.assign(Object.create(kc.prototype),{constructor:Qc,ValueTypeName:"vector"}),Object.assign(Kc,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,a=i.length;r!==a;++r)e.push($c(i[r]).scale(n));return new Kc(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},r=0,a=i.length;r!==a;++r)e.push(kc.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,a=[],o=0;o<r;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var h=Gc.getKeyframeOrder(s);s=Gc.sortedArray(s,1,h),c=Gc.sortedArray(c,1,h),n||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new Xc(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/i))}return new Kc(t,-1,a)},findByName:function(t,e){var i=t;if(!Array.isArray(t)){var n=t;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===e)return i[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(r);if(c&&c.length>1){var h=n[u=c[1]];h||(n[u]=h=[]),h.push(s)}}var l=[];for(var u in n)l.push(Kc.CreateFromMorphTargetSequence(u,n[u],e,i));return l},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(t,e,i,n,r){if(0!==i.length){var a=[],o=[];Gc.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o))}},n=[],r=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var l={},u=0;u<h.length;u++)if(h[u].morphTargets)for(var p=0;p<h[u].morphTargets.length;p++)l[h[u].morphTargets[p]]=-1;for(var d in l){var f=[],m=[];for(p=0;p!==h[u].morphTargets.length;++p){var v=h[u];f.push(v.time),m.push(v.morphTarget===d?1:0)}n.push(new Xc(".morphTargetInfluence["+d+"]",f,m))}a=l.length*(o||1)}else{var g=".bones["+e[c].name+"]";i(Qc,g+".position",h,"pos",n),i(Jc,g+".quaternion",h,"rot",n),i(Qc,g+".scale",h,"scl",n)}}return 0===n.length?null:new Kc(r,a,n)}}),Object.assign(Kc.prototype,{resetDuration:function(){for(var t=0,e=0,i=this.tracks.length;e!==i;++e){var n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new Kc(this.name,this.duration,t)}});var th={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function eh(t,e,i){var n=this,r=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this}}var ih=new eh;function nh(t){this.manager=void 0!==t?t:ih,this.crossOrigin="anonymous",this.path="",this.resourcePath=""}Object.assign(nh.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this}}),nh.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,i=0,n=e.length;i<n;i+=2){var r=e[i],a=e[i+1];if(r.test(t))return a}return null}};var rh={};function ah(t){nh.call(this,t)}function oh(t){nh.call(this,t)}function sh(t){nh.call(this,t),this._parser=null}function ch(t){nh.call(this,t),this._parser=null}function hh(t){nh.call(this,t)}function lh(t){nh.call(this,t)}function uh(t){nh.call(this,t)}function ph(){this.type="Curve",this.arcLengthDivisions=200}function dh(t,e,i,n,r,a,o,s){ph.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=i||1,this.yRadius=n||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function fh(t,e,i,n,r,a){dh.call(this,t,e,i,i,n,r,a),this.type="ArcCurve"}function mh(){var t=0,e=0,i=0,n=0;function r(r,a,o,s){t=r,e=o,i=-3*r+3*a-2*o-s,n=2*r-2*a+o+s}return{initCatmullRom:function(t,e,i,n,a){r(e,i,a*(i-t),a*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,a,o,s){var c=(e-t)/a-(i-t)/(a+o)+(i-e)/o,h=(i-e)/o-(n-e)/(o+s)+(n-i)/s;r(e,i,c*=o,h*=o)},calc:function(r){var a=r*r;return t+e*r+i*a+n*(a*r)}}}ah.prototype=Object.assign(Object.create(nh.prototype),{constructor:ah,load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=th.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;if(void 0===rh[t]){var o=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],h=o[3];h=decodeURIComponent(h),c&&(h=atob(h));try{var l,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var p=new Uint8Array(h.length),d=0;d<h.length;d++)p[d]=h.charCodeAt(d);l="blob"===u?new Blob([p.buffer],{type:s}):p.buffer;break;case"document":var f=new DOMParser;l=f.parseFromString(h,s);break;case"json":l=JSON.parse(h);break;default:l=h}setTimeout((function(){e&&e(l),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{rh[t]=[],rh[t].push({onLoad:e,onProgress:i,onError:n});var m=new XMLHttpRequest;for(var v in m.open("GET",t,!0),m.addEventListener("load",(function(e){var i=this.response;th.add(t,i);var n=rh[t];if(delete rh[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var a=0,o=n.length;a<o;a++){(s=n[a]).onLoad&&s.onLoad(i)}r.manager.itemEnd(t)}else{for(a=0,o=n.length;a<o;a++){var s;(s=n[a]).onError&&s.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),m.addEventListener("progress",(function(e){for(var i=rh[t],n=0,r=i.length;n<r;n++){var a=i[n];a.onProgress&&a.onProgress(e)}}),!1),m.addEventListener("error",(function(e){var i=rh[t];delete rh[t];for(var n=0,a=i.length;n<a;n++){var o=i[n];o.onError&&o.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),m.addEventListener("abort",(function(e){var i=rh[t];delete rh[t];for(var n=0,a=i.length;n<a;n++){var o=i[n];o.onError&&o.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!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(v,this.requestHeader[v]);m.send(null)}return r.manager.itemStart(t),m}rh[t].push({onLoad:e,onProgress:i,onError:n})},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),oh.prototype=Object.assign(Object.create(nh.prototype),{constructor:oh,load:function(t,e,i,n){var r=this,a=new ah(r.manager);a.setPath(r.path),a.load(t,(function(t){e(r.parse(JSON.parse(t)))}),i,n)},parse:function(t){for(var e=[],i=0;i<t.length;i++){var n=Kc.parse(t[i]);e.push(n)}return e}}),sh.prototype=Object.assign(Object.create(nh.prototype),{constructor:sh,load:function(t,e,i,n){var r=this,a=[],o=new ps;o.image=a;var s=new ah(this.manager);function c(c){s.load(t[c],(function(t){var i=r._parser(t,!0);a[c]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},6===(h+=1)&&(1===i.mipmapCount&&(o.minFilter=ut),o.format=i.format,o.needsUpdate=!0,e&&e(o))}),i,n)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,l=0,u=t.length;l<u;++l)c(l);else s.load(t,(function(t){var i=r._parser(t,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,s=0;s<n;s++){a[s]={mipmaps:[]};for(var c=0;c<i.mipmapCount;c++)a[s].mipmaps.push(i.mipmaps[s*i.mipmapCount+c]),a[s].format=i.format,a[s].width=i.width,a[s].height=i.height}else o.image.width=i.width,o.image.height=i.height,o.mipmaps=i.mipmaps;1===i.mipmapCount&&(o.minFilter=ut),o.format=i.format,o.needsUpdate=!0,e&&e(o)}),i,n);return o}}),ch.prototype=Object.assign(Object.create(nh.prototype),{constructor:ch,load:function(t,e,i,n){var r=this,a=new hr,o=new ah(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(t,(function(t){var i=r._parser(t);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:ot,a.wrapT=void 0!==i.wrapT?i.wrapT:ot,a.magFilter=void 0!==i.magFilter?i.magFilter:ut,a.minFilter=void 0!==i.minFilter?i.minFilter:dt,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps),1===i.mipmapCount&&(a.minFilter=ut),a.needsUpdate=!0,e&&e(a,i))}),i,n),a}}),hh.prototype=Object.assign(Object.create(nh.prototype),{constructor:hh,load:function(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=th.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.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),th.add(t,this),e&&e(this),r.manager.itemEnd(t)}function c(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),n&&n(e),r.manager.itemError(t),r.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),r.manager.itemStart(t),o.src=t,o}}),lh.prototype=Object.assign(Object.create(nh.prototype),{constructor:lh,load:function(t,e,i,n){var r=new Ir,a=new hh(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(i){a.load(t[i],(function(t){r.images[i]=t,6===++o&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(var c=0;c<t.length;++c)s(c);return r}}),uh.prototype=Object.assign(Object.create(nh.prototype),{constructor:uh,load:function(t,e,i,n){var r=new Ie,a=new hh(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(i){r.image=i;var n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?At:Lt,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}),Object.assign(ph.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)a+=(e=this.getPoint(i/t)).distanceTo(r),n.push(a),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,a=n.length;i=e||t*n[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=n[r=Math.floor(s+(c-s)/2)]-i)<0)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(n[r=c]===i)return r/(a-1);var h=n[r];return(r+(i-h)/(n[r+1]-h))/(a-1)},getTangent:function(t){var e=t-1e-4,i=t+1e-4;e<0&&(e=0),i>1&&(i=1);var n=this.getPoint(e);return this.getPoint(i).clone().sub(n).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i,n,r,a=new Pe,o=[],s=[],c=[],h=new Pe,l=new qe;for(i=0;i<=t;i++)n=i/t,o[i]=this.getTangentAt(n),o[i].normalize();s[0]=new Pe,c[0]=new Pe;var u=Number.MAX_VALUE,p=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(p<=u&&(u=p,a.set(1,0,0)),d<=u&&(u=d,a.set(0,1,0)),f<=u&&a.set(0,0,1),h.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],h),c[0].crossVectors(o[0],s[0]),i=1;i<=t;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),h.crossVectors(o[i-1],o[i]),h.length()>Number.EPSILON&&(h.normalize(),r=Math.acos(Se.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(l.makeRotationAxis(h,r))),c[i].crossVectors(o[i],s[i]);if(!0===e)for(r=Math.acos(Se.clamp(s[0].dot(s[t]),-1,1)),r/=t,o[0].dot(h.crossVectors(s[0],s[t]))>0&&(r=-r),i=1;i<=t;i++)s[i].applyMatrix4(l.makeRotationAxis(o[i],r*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(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),dh.prototype=Object.create(ph.prototype),dh.prototype.constructor=dh,dh.prototype.isEllipseCurve=!0,dh.prototype.getPoint=function(t,e){for(var i=e||new Te,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);var o=this.aStartAngle+t*r,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var h=Math.cos(this.aRotation),l=Math.sin(this.aRotation),u=s-this.aX,p=c-this.aY;s=u*h-p*l+this.aX,c=u*l+p*h+this.aY}return i.set(s,c)},dh.prototype.copy=function(t){return ph.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},dh.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},dh.prototype.fromJSON=function(t){return ph.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},fh.prototype=Object.create(dh.prototype),fh.prototype.constructor=fh,fh.prototype.isArcCurve=!0;var vh=new Pe,gh=new mh,yh=new mh,xh=new mh;function bh(t,e,i,n){ph.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=i||"centripetal",this.tension=n||.5}function wh(t,e,i,n,r){var a=.5*(n-e),o=.5*(r-i),s=t*t;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function _h(t,e,i,n){return function(t,e){var i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Mh(t,e,i,n,r){return function(t,e){var i=1-t;return i*i*i*e}(t,e)+function(t,e){var i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}function Sh(t,e,i,n){ph.call(this),this.type="CubicBezierCurve",this.v0=t||new Te,this.v1=e||new Te,this.v2=i||new Te,this.v3=n||new Te}function Th(t,e,i,n){ph.call(this),this.type="CubicBezierCurve3",this.v0=t||new Pe,this.v1=e||new Pe,this.v2=i||new Pe,this.v3=n||new Pe}function Eh(t,e){ph.call(this),this.type="LineCurve",this.v1=t||new Te,this.v2=e||new Te}function Ah(t,e){ph.call(this),this.type="LineCurve3",this.v1=t||new Pe,this.v2=e||new Pe}function Lh(t,e,i){ph.call(this),this.type="QuadraticBezierCurve",this.v0=t||new Te,this.v1=e||new Te,this.v2=i||new Te}function Ph(t,e,i){ph.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new Pe,this.v1=e||new Pe,this.v2=i||new Pe}function Rh(t){ph.call(this),this.type="SplineCurve",this.points=t||[]}bh.prototype=Object.create(ph.prototype),bh.prototype.constructor=bh,bh.prototype.isCatmullRomCurve3=!0,bh.prototype.getPoint=function(t,e){var i,n,r,a,o=e||new Pe,s=this.points,c=s.length,h=(c-(this.closed?0:1))*t,l=Math.floor(h),u=h-l;if(this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/c)+1)*c:0===u&&l===c-1&&(l=c-2,u=1),this.closed||l>0?i=s[(l-1)%c]:(vh.subVectors(s[0],s[1]).add(s[0]),i=vh),n=s[l%c],r=s[(l+1)%c],this.closed||l+2<c?a=s[(l+2)%c]:(vh.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=vh),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(i.distanceToSquared(n),p),f=Math.pow(n.distanceToSquared(r),p),m=Math.pow(r.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),gh.initNonuniformCatmullRom(i.x,n.x,r.x,a.x,d,f,m),yh.initNonuniformCatmullRom(i.y,n.y,r.y,a.y,d,f,m),xh.initNonuniformCatmullRom(i.z,n.z,r.z,a.z,d,f,m)}else"catmullrom"===this.curveType&&(gh.initCatmullRom(i.x,n.x,r.x,a.x,this.tension),yh.initCatmullRom(i.y,n.y,r.y,a.y,this.tension),xh.initCatmullRom(i.z,n.z,r.z,a.z,this.tension));return o.set(gh.calc(u),yh.calc(u),xh.calc(u)),o},bh.prototype.copy=function(t){ph.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},bh.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},bh.prototype.fromJSON=function(t){ph.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new Pe).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Sh.prototype=Object.create(ph.prototype),Sh.prototype.constructor=Sh,Sh.prototype.isCubicBezierCurve=!0,Sh.prototype.getPoint=function(t,e){var i=e||new Te,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Mh(t,n.x,r.x,a.x,o.x),Mh(t,n.y,r.y,a.y,o.y)),i},Sh.prototype.copy=function(t){return ph.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Sh.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Sh.prototype.fromJSON=function(t){return ph.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Th.prototype=Object.create(ph.prototype),Th.prototype.constructor=Th,Th.prototype.isCubicBezierCurve3=!0,Th.prototype.getPoint=function(t,e){var i=e||new Pe,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Mh(t,n.x,r.x,a.x,o.x),Mh(t,n.y,r.y,a.y,o.y),Mh(t,n.z,r.z,a.z,o.z)),i},Th.prototype.copy=function(t){return ph.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Th.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Th.prototype.fromJSON=function(t){return ph.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Eh.prototype=Object.create(ph.prototype),Eh.prototype.constructor=Eh,Eh.prototype.isLineCurve=!0,Eh.prototype.getPoint=function(t,e){var i=e||new Te;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},Eh.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Eh.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Eh.prototype.copy=function(t){return ph.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Eh.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Eh.prototype.fromJSON=function(t){return ph.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Ah.prototype=Object.create(ph.prototype),Ah.prototype.constructor=Ah,Ah.prototype.isLineCurve3=!0,Ah.prototype.getPoint=function(t,e){var i=e||new Pe;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},Ah.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Ah.prototype.copy=function(t){return ph.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ah.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ah.prototype.fromJSON=function(t){return ph.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Lh.prototype=Object.create(ph.prototype),Lh.prototype.constructor=Lh,Lh.prototype.isQuadraticBezierCurve=!0,Lh.prototype.getPoint=function(t,e){var i=e||new Te,n=this.v0,r=this.v1,a=this.v2;return i.set(_h(t,n.x,r.x,a.x),_h(t,n.y,r.y,a.y)),i},Lh.prototype.copy=function(t){return ph.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Lh.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Lh.prototype.fromJSON=function(t){return ph.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Ph.prototype=Object.create(ph.prototype),Ph.prototype.constructor=Ph,Ph.prototype.isQuadraticBezierCurve3=!0,Ph.prototype.getPoint=function(t,e){var i=e||new Pe,n=this.v0,r=this.v1,a=this.v2;return i.set(_h(t,n.x,r.x,a.x),_h(t,n.y,r.y,a.y),_h(t,n.z,r.z,a.z)),i},Ph.prototype.copy=function(t){return ph.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ph.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ph.prototype.fromJSON=function(t){return ph.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Rh.prototype=Object.create(ph.prototype),Rh.prototype.constructor=Rh,Rh.prototype.isSplineCurve=!0,Rh.prototype.getPoint=function(t,e){var i=e||new Te,n=this.points,r=(n.length-1)*t,a=Math.floor(r),o=r-a,s=n[0===a?a:a-1],c=n[a],h=n[a>n.length-2?n.length-1:a+1],l=n[a>n.length-3?n.length-1:a+2];return i.set(wh(o,s.x,c.x,h.x,l.x),wh(o,s.y,c.y,h.y,l.y)),i},Rh.prototype.copy=function(t){ph.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this},Rh.prototype.toJSON=function(){var t=ph.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t},Rh.prototype.fromJSON=function(t){ph.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new Te).fromArray(n))}return this};var Ch=Object.freeze({ArcCurve:fh,CatmullRomCurve3:bh,CubicBezierCurve:Sh,CubicBezierCurve3:Th,EllipseCurve:dh,LineCurve:Eh,LineCurve3:Ah,QuadraticBezierCurve:Lh,QuadraticBezierCurve3:Ph,SplineCurve:Rh});function Oh(){ph.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Nh(t){Oh.call(this),this.type="Path",this.currentPoint=new Te,t&&this.setFromPoints(t)}function Dh(t){Nh.call(this,t),this.uuid=Se.generateUUID(),this.type="Shape",this.holes=[]}function Ih(t,e){li.call(this),this.type="Light",this.color=new Zi(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function zh(t,e,i){Ih.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(li.DefaultUp),this.updateMatrix(),this.groundColor=new Zi(e)}function Bh(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new Te(512,512),this.map=null,this.mapPass=null,this.matrix=new qe,this._frustum=new vr,this._frameExtents=new Te(1,1),this._viewportCount=1,this._viewports=[new ze(0,0,1,1)]}function Uh(){Bh.call(this,new rr(50,1,.5,500))}function Gh(t,e,i,n,r,a){Ih.call(this,t,e),this.type="SpotLight",this.position.copy(li.DefaultUp),this.updateMatrix(),this.target=new li,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Uh}function Fh(){Bh.call(this,new rr(90,1,.5,500)),this._frameExtents=new Te(4,2),this._viewportCount=6,this._viewports=[new ze(2,1,1,1),new ze(0,1,1,1),new ze(3,1,1,1),new ze(1,1,1,1),new ze(3,0,1,1),new ze(1,0,1,1)],this._cubeDirections=[new Pe(1,0,0),new Pe(-1,0,0),new Pe(0,0,1),new Pe(0,0,-1),new Pe(0,1,0),new Pe(0,-1,0)],this._cubeUps=[new Pe(0,1,0),new Pe(0,1,0),new Pe(0,1,0),new Pe(0,1,0),new Pe(0,0,1),new Pe(0,0,-1)]}function Hh(t,e,i,n){Ih.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new Fh}function Vh(t,e,i,n,r,a){nr.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==t?t:-1,this.right=void 0!==e?e:1,this.top=void 0!==i?i:1,this.bottom=void 0!==n?n:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function jh(){Bh.call(this,new Vh(-5,5,5,-5,.5,500))}function kh(t,e){Ih.call(this,t,e),this.type="DirectionalLight",this.position.copy(li.DefaultUp),this.updateMatrix(),this.target=new li,this.shadow=new jh}function Wh(t,e){Ih.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function qh(t,e,i,n){Ih.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}function Xh(t){nh.call(this,t),this.textures={}}Oh.prototype=Object.assign(Object.create(ph.prototype),{constructor:Oh,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Eh(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,i=[],n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var h=s[c];e&&e.equals(h)||(i.push(h),e=h)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(t){ph.prototype.copy.call(this,t),this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){var t=ph.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,i=this.curves.length;e<i;e++){var n=this.curves[e];t.curves.push(n.toJSON())}return t},fromJSON:function(t){ph.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push((new Ch[n.type]).fromJSON(n))}return this}}),Nh.prototype=Object.assign(Object.create(Oh.prototype),{constructor:Nh,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var i=new Eh(this.currentPoint.clone(),new Te(t,e));this.curves.push(i),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,i,n){var r=new Lh(this.currentPoint.clone(),new Te(t,e),new Te(i,n));this.curves.push(r),this.currentPoint.set(i,n)},bezierCurveTo:function(t,e,i,n,r,a){var o=new Sh(this.currentPoint.clone(),new Te(t,e),new Te(i,n),new Te(r,a));this.curves.push(o),this.currentPoint.set(r,a)},splineThru:function(t){var e=new Rh([this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,i,n,r,a)},absarc:function(t,e,i,n,r,a){this.absellipse(t,e,i,i,n,r,a)},ellipse:function(t,e,i,n,r,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,i,n,r,a,o,s)},absellipse:function(t,e,i,n,r,a,o,s){var c=new dh(t,e,i,n,r,a,o,s);if(this.curves.length>0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)},copy:function(t){return Oh.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Oh.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Oh.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Dh.prototype=Object.assign(Object.create(Nh.prototype),{constructor:Dh,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){Nh.prototype.copy.call(this,t),this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push(n.clone())}return this},toJSON:function(){var t=Nh.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,i=this.holes.length;e<i;e++){var n=this.holes[e];t.holes.push(n.toJSON())}return t},fromJSON:function(t){Nh.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push((new Nh).fromJSON(n))}return this}}),Ih.prototype=Object.assign(Object.create(li.prototype),{constructor:Ih,isLight:!0,copy:function(t){return li.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=li.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),zh.prototype=Object.assign(Object.create(Ih.prototype),{constructor:zh,isHemisphereLight:!0,copy:function(t){return Ih.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Bh.prototype,{_projScreenMatrix:new qe,_lightPositionWorld:new Pe,_lookTarget:new Pe,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){var e=this.camera,i=this.matrix,n=this._projScreenMatrix,r=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(t.matrixWorld),e.position.copy(a),r.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(r),e.updateMatrixWorld(),n.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromMatrix(n),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Uh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:Uh,isSpotLightShadow:!0,updateMatrices:function(t,e,i){var n=this.camera,r=2*Se.RAD2DEG*t.angle,a=this.mapSize.width/this.mapSize.height,o=t.distance||n.far;r===n.fov&&a===n.aspect&&o===n.far||(n.fov=r,n.aspect=a,n.far=o,n.updateProjectionMatrix()),Bh.prototype.updateMatrices.call(this,t,e,i)}}),Gh.prototype=Object.assign(Object.create(Ih.prototype),{constructor:Gh,isSpotLight:!0,copy:function(t){return Ih.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Fh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:Fh,isPointLightShadow:!0,updateMatrices:function(t,e,i){var n=this.camera,r=this.matrix,a=this._lightPositionWorld,o=this._lookTarget,s=this._projScreenMatrix;a.setFromMatrixPosition(t.matrixWorld),n.position.copy(a),o.copy(n.position),o.add(this._cubeDirections[i]),n.up.copy(this._cubeUps[i]),n.lookAt(o),n.updateMatrixWorld(),r.makeTranslation(-a.x,-a.y,-a.z),s.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromMatrix(s)}}),Hh.prototype=Object.assign(Object.create(Ih.prototype),{constructor:Hh,isPointLight:!0,copy:function(t){return Ih.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Vh.prototype=Object.assign(Object.create(nr.prototype),{constructor:Vh,isOrthographicCamera:!0,copy:function(t,e){return nr.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view&&this.view.enabled){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;a=(r+=l*(this.view.offsetX/c))+l*(this.view.width/c),s=(o-=u*(this.view.offsetY/h))-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=li.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),jh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:jh,isDirectionalLightShadow:!0,updateMatrices:function(t,e,i){Bh.prototype.updateMatrices.call(this,t,e,i)}}),kh.prototype=Object.assign(Object.create(Ih.prototype),{constructor:kh,isDirectionalLight:!0,copy:function(t){return Ih.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Wh.prototype=Object.assign(Object.create(Ih.prototype),{constructor:Wh,isAmbientLight:!0}),qh.prototype=Object.assign(Object.create(Ih.prototype),{constructor:qh,isRectAreaLight:!0,copy:function(t){return Ih.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Ih.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}}),Xh.prototype=Object.assign(Object.create(nh.prototype),{constructor:Xh,load:function(t,e,i,n){var r=this,a=new ah(r.manager);a.setPath(r.path),a.load(t,(function(t){e(r.parse(JSON.parse(t)))}),i,n)},parse:function(t){var e=this.textures;function i(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var n=new Uc[t.type];if(void 0!==t.uuid&&(n.uuid=t.uuid),void 0!==t.name&&(n.name=t.name),void 0!==t.color&&n.color.setHex(t.color),void 0!==t.roughness&&(n.roughness=t.roughness),void 0!==t.metalness&&(n.metalness=t.metalness),void 0!==t.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&n.specular.setHex(t.specular),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.clearcoat&&(n.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(n.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.vertexColors&&(n.vertexColors=t.vertexColors),void 0!==t.fog&&(n.fog=t.fog),void 0!==t.flatShading&&(n.flatShading=t.flatShading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.combine&&(n.combine=t.combine),void 0!==t.side&&(n.side=t.side),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.alphaTest&&(n.alphaTest=t.alphaTest),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(n.colorWrite=t.colorWrite),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(n.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(n.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(n.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(n.rotation=t.rotation),1!==t.linewidth&&(n.linewidth=t.linewidth),void 0!==t.dashSize&&(n.dashSize=t.dashSize),void 0!==t.gapSize&&(n.gapSize=t.gapSize),void 0!==t.scale&&(n.scale=t.scale),void 0!==t.polygonOffset&&(n.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(n.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(n.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(n.skinning=t.skinning),void 0!==t.morphTargets&&(n.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(n.morphNormals=t.morphNormals),void 0!==t.dithering&&(n.dithering=t.dithering),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.toneMapped&&(n.toneMapped=t.toneMapped),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.uniforms)for(var r in t.uniforms){var a=t.uniforms[r];switch(n.uniforms[r]={},a.type){case"t":n.uniforms[r].value=i(a.value);break;case"c":n.uniforms[r].value=(new Zi).setHex(a.value);break;case"v2":n.uniforms[r].value=(new Te).fromArray(a.value);break;case"v3":n.uniforms[r].value=(new Pe).fromArray(a.value);break;case"v4":n.uniforms[r].value=(new ze).fromArray(a.value);break;case"m3":n.uniforms[r].value=(new Oe).fromArray(a.value);case"m4":n.uniforms[r].value=(new qe).fromArray(a.value);break;default:n.uniforms[r].value=a.value}}if(void 0!==t.defines&&(n.defines=t.defines),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var o in t.extensions)n.extensions[o]=t.extensions[o];if(void 0!==t.shading&&(n.flatShading=1===t.shading),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=i(t.map)),void 0!==t.matcap&&(n.matcap=i(t.matcap)),void 0!==t.alphaMap&&(n.alphaMap=i(t.alphaMap),n.transparent=!0),void 0!==t.bumpMap&&(n.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),n.normalScale=(new Te).fromArray(s)}return void 0!==t.displacementMap&&(n.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=i(t.specularMap)),void 0!==t.envMap&&(n.envMap=i(t.envMap)),void 0!==t.envMapIntensity&&(n.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(n.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(n.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatNormalMap&&(n.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(n.clearcoatNormalScale=(new Te).fromArray(t.clearcoatNormalScale)),n},setTextures:function(t){return this.textures=t,this}});var Yh=function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)};function Jh(){Sn.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Zh(t,e,i,n){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),an.call(this,t,e,i),this.meshPerAttribute=n||1}function Qh(t){nh.call(this,t)}Jh.prototype=Object.assign(Object.create(Sn.prototype),{constructor:Jh,isInstancedBufferGeometry:!0,copy:function(t){return Sn.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t=Sn.prototype.toJSON.call(this);return t.maxInstancedCount=this.maxInstancedCount,t.isInstancedBufferGeometry=!0,t}}),Zh.prototype=Object.assign(Object.create(an.prototype),{constructor:Zh,isInstancedBufferAttribute:!0,copy:function(t){return an.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){var t=an.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}),Qh.prototype=Object.assign(Object.create(nh.prototype),{constructor:Qh,load:function(t,e,i,n){var r=this,a=new ah(r.manager);a.setPath(r.path),a.load(t,(function(t){e(r.parse(JSON.parse(t)))}),i,n)},parse:function(t){var e=t.isInstancedBufferGeometry?new Jh:new Sn,i=t.data.index;if(void 0!==i){var n=new Kh[i.type](i.array);e.setIndex(new an(n,1))}var r=t.data.attributes;for(var a in r){var o=r[a],s=(n=new Kh[o.type](o.array),new(o.isInstancedBufferAttribute?Zh:an)(n,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),e.addAttribute(a,s)}var c=t.data.morphAttributes;if(c)for(var a in c){for(var h=c[a],l=[],u=0,p=h.length;u<p;u++){o=h[u],s=new an(n=new Kh[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),l.push(s)}e.morphAttributes[a]=l}var d=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==d){u=0;for(var f=d.length;u!==f;++u){var m=d[u];e.addGroup(m.start,m.count,m.materialIndex)}}var v=t.data.boundingSphere;if(void 0!==v){var g=new Pe;void 0!==v.center&&g.fromArray(v.center),e.boundingSphere=new Ai(g,v.radius)}return t.name&&(e.name=t.name),t.userData&&(e.userData=t.userData),e}});var Kh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function $h(t){nh.call(this,t)}$h.prototype=Object.assign(Object.create(nh.prototype),{constructor:$h,load:function(t,e,i,n){var r=this,a=""===this.path?Yh(t):this.path;this.resourcePath=this.resourcePath||a;var o=new ah(r.manager);o.setPath(this.path),o.load(t,(function(i){var a=null;try{a=JSON.parse(i)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(a,e):console.error("THREE.ObjectLoader: Can't load "+t)}),i,n)},parse:function(t,e){var i=this.parseShape(t.shapes),n=this.parseGeometries(t.geometries,i),r=this.parseImages(t.images,(function(){void 0!==e&&e(s)})),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),s=this.parseObject(t.object,n,o);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var i=0,n=t.length;i<n;i++){var r=(new Dh).fromJSON(t[i]);e[r.uuid]=r}return e},parseGeometries:function(t,e){var i={};if(void 0!==t)for(var n=new Qh,r=0,a=t.length;r<a;r++){var o,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Ac[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Ac[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Ac[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Ac[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 Ac[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Ac[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 Ac[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Ac[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Ac[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Ac[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Ac[s.type]((new Ch[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Ac[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Ac[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],h=0,l=s.shapes.length;h<l;h++){var u=e[s.shapes[h]];c.push(u)}o=new Ac[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],h=0,l=s.shapes.length;h<l;h++){u=e[s.shapes[h]];c.push(u)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new Ch[p.type]).fromJSON(p)),o=new Ac[s.type](c,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=n.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(t,e){var i={},n={};if(void 0!==t){var r=new Xh;r.setTextures(e);for(var a=0,o=t.length;a<o;a++){var s=t[a];if("MultiMaterial"===s.type){for(var c=[],h=0;h<s.materials.length;h++){var l=s.materials[h];void 0===i[l.uuid]&&(i[l.uuid]=r.parse(l)),c.push(i[l.uuid])}n[s.uuid]=c}else void 0===i[s.uuid]&&(i[s.uuid]=r.parse(s)),n[s.uuid]=i[s.uuid]}}return n},parseAnimations:function(t){for(var e=[],i=0;i<t.length;i++){var n=t[i],r=Kc.parse(n);void 0!==n.uuid&&(r.uuid=n.uuid),e.push(r)}return e},parseImages:function(t,e){var i=this,n={};function r(t){return i.manager.itemStart(t),a.load(t,(function(){i.manager.itemEnd(t)}),void 0,(function(){i.manager.itemError(t),i.manager.itemEnd(t)}))}if(void 0!==t&&t.length>0){var a=new hh(new eh(e));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var c=t[o],h=c.url;if(Array.isArray(h)){n[c.uuid]=[];for(var l=0,u=h.length;l<u;l++){var p=h[l],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:i.resourcePath+p;n[c.uuid].push(r(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.resourcePath+c.url;n[c.uuid]=r(d)}}}return n},parseTextures:function(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var n={};if(void 0!==t)for(var r=0,a=t.length;r<a;r++){var o,s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(e[s.image])?new Ir(e[s.image]):new Ie(e[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,el)),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],il),o.wrapT=i(s.wrap[1],il)),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,nl)),void 0!==s.magFilter&&(o.magFilter=i(s.magFilter,nl)),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),n[s.uuid]=o}return n},parseObject:function(t,e,i){var n;function r(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],n=0,r=t.length;n<r;n++){var a=t[n];void 0===i[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),e.push(i[a])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}switch(t.type){case"Scene":n=new ui,void 0!==t.background&&Number.isInteger(t.background)&&(n.background=new Zi(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?n.fog=new wo(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(n.fog=new bo(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":n=new rr(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(n.focus=t.focus),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.filmGauge&&(n.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(n.filmOffset=t.filmOffset),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"OrthographicCamera":n=new Vh(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"AmbientLight":n=new Wh(t.color,t.intensity);break;case"DirectionalLight":n=new kh(t.color,t.intensity);break;case"PointLight":n=new Hh(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":n=new qh(t.color,t.intensity,t.width,t.height);break;case"SpotLight":n=new Gh(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":n=new zh(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=r(t.geometry),s=a(t.material);n=o.bones&&o.bones.length>0?new Vo(o,s):new Vn(o,s),void 0!==t.drawMode&&n.setDrawMode(t.drawMode);break;case"LOD":n=new Ho;break;case"Line":n=new $o(r(t.geometry),a(t.material),t.mode);break;case"LineLoop":n=new ns(r(t.geometry),a(t.material));break;case"LineSegments":n=new is(r(t.geometry),a(t.material));break;case"PointCloud":case"Points":n=new hs(r(t.geometry),a(t.material));break;case"Sprite":n=new Bo(a(t.material));break;case"Group":n=new lo;break;default:n=new li}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children)for(var c=t.children,h=0;h<c.length;h++)n.add(this.parseObject(c[h],e,i));if("LOD"===t.type)for(var l=t.levels,u=0;u<l.length;u++){var p=l[u],d=n.getObjectByProperty("uuid",p.object);void 0!==d&&n.addLevel(d,p.distance)}return n}});var tl,el={UVMapping:300,CubeReflectionMapping:K,CubeRefractionMapping:$,EquirectangularReflectionMapping:tt,EquirectangularRefractionMapping:et,SphericalReflectionMapping:it,CubeUVReflectionMapping:nt,CubeUVRefractionMapping:rt},il={RepeatWrapping:at,ClampToEdgeWrapping:ot,MirroredRepeatWrapping:st},nl={NearestFilter:ct,NearestMipmapNearestFilter:ht,NearestMipmapLinearFilter:lt,LinearFilter:ut,LinearMipmapNearestFilter:pt,LinearMipmapLinearFilter:dt};function rl(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),nh.call(this,t),this.options=void 0}function al(){this.type="ShapePath",this.color=new Zi,this.subPaths=[],this.currentPath=null}function ol(t){this.type="Font",this.data=t}function sl(t,e,i,n,r){var a=r.glyphs[t]||r.glyphs["?"];if(a){var o,s,c,h,l,u,p,d,f=new al;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*e+i,s=m[v++]*e+n,f.moveTo(o,s);break;case"l":o=m[v++]*e+i,s=m[v++]*e+n,f.lineTo(o,s);break;case"q":c=m[v++]*e+i,h=m[v++]*e+n,l=m[v++]*e+i,u=m[v++]*e+n,f.quadraticCurveTo(l,u,c,h);break;case"b":c=m[v++]*e+i,h=m[v++]*e+n,l=m[v++]*e+i,u=m[v++]*e+n,p=m[v++]*e+i,d=m[v++]*e+n,f.bezierCurveTo(l,u,p,d,c,h)}}return{offsetX:a.ha*e,path:f}}console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".")}function cl(t){nh.call(this,t)}rl.prototype=Object.assign(Object.create(nh.prototype),{constructor:rl,setOptions:function(t){return this.options=t,this},load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=th.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;fetch(t).then((function(t){return t.blob()})).then((function(t){return void 0===r.options?createImageBitmap(t):createImageBitmap(t,r.options)})).then((function(i){th.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}),Object.assign(al.prototype,{moveTo:function(t,e){this.currentPath=new Nh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,i,n){this.currentPath.quadraticCurveTo(t,e,i,n)},bezierCurveTo:function(t,e,i,n,r,a){this.currentPath.bezierCurveTo(t,e,i,n,r,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],a=new Dh;a.curves=r.curves,e.push(a)}return e}function n(t,e){for(var i=e.length,n=!1,r=i-1,a=0;a<i;r=a++){var o=e[r],s=e[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n}var r=ic.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return i(a);var o,s,c,h=[];if(1===a.length)return s=a[0],(c=new Dh).curves=s.curves,h.push(c),h;var l=!r(a[0].getPoints());l=t?!l:l;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=r(u=(s=a[g]).getPoints()),(o=t?!o:o)?(!l&&f[v]&&v++,f[v]={s:new Dh,p:u},f[v].s.curves=s.curves,l&&v++,m[v]=[]):m[v].push({h:s,p:u[0]});if(!f[0])return i(a);if(f.length>1){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],S=0;S<M.length;S++){for(var T=M[S],E=!0,A=0;A<f.length;A++)n(T.p,f[A].p)&&(w!==A&&b.push({froms:w,tos:A,hole:S}),E?(E=!1,d[A].push(T)):x=!0);E&&d[w].push(T)}b.length>0&&(x||(m=d))}g=0;for(var L=f.length;g<L;g++){c=f[g].s,h.push(c);for(var P=0,R=(p=m[g]).length;P<R;P++)c.holes.push(p[P].h)}return h}}),Object.assign(ol.prototype,{isFont:!0,generateShapes:function(t,e){void 0===e&&(e=100);for(var i=[],n=function(t,e,i){for(var n=Array.from?Array.from(t):String(t).split(""),r=e/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,o=[],s=0,c=0,h=0;h<n.length;h++){var l=n[h];if("\n"===l)s=0,c-=a;else{var u=sl(l,r,s,c,i);s+=u.offsetX,o.push(u.path)}}return o}(t,e,this.data),r=0,a=n.length;r<a;r++)Array.prototype.push.apply(i,n[r].toShapes());return i}}),cl.prototype=Object.assign(Object.create(nh.prototype),{constructor:cl,load:function(t,e,i,n){var r=this,a=new ah(this.manager);a.setPath(this.path),a.load(t,(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 n=r.parse(i);e&&e(n)}),i,n)},parse:function(t){return new ol(t)}});var hl={getContext:function(){return void 0===tl&&(tl=new(window.AudioContext||window.webkitAudioContext)),tl},setContext:function(t){tl=t}};function ll(t){nh.call(this,t)}function ul(){this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Pe)}function pl(t,e){Ih.call(this,void 0,e),this.sh=void 0!==t?t:new ul}function dl(t,e,i){pl.call(this,void 0,i);var n=(new Zi).set(t),r=(new Zi).set(e),a=new Pe(n.r,n.g,n.b),o=new Pe(r.r,r.g,r.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function fl(t,e){pl.call(this,void 0,e);var i=(new Zi).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}ll.prototype=Object.assign(Object.create(nh.prototype),{constructor:ll,load:function(t,e,i,n){var r=new ah(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.load(t,(function(t){var i=t.slice(0);hl.getContext().decodeAudioData(i,(function(t){e(t)}))}),i,n)}}),Object.assign(ul.prototype,{isSphericalHarmonics3:!0,set:function(t){for(var e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this},zero:function(){for(var t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this},getAt:function(t,e){var i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScale(a[1],.488603*n),e.addScale(a[2],.488603*r),e.addScale(a[3],.488603*i),e.addScale(a[4],i*n*1.092548),e.addScale(a[5],n*r*1.092548),e.addScale(a[6],.315392*(3*r*r-1)),e.addScale(a[7],i*r*1.092548),e.addScale(a[8],.546274*(i*i-n*n)),e},getIrradianceAt:function(t,e){var i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScale(a[1],1.023328*n),e.addScale(a[2],1.023328*r),e.addScale(a[3],1.023328*i),e.addScale(a[4],.858086*i*n),e.addScale(a[5],.858086*n*r),e.addScale(a[6],.743125*r*r-.247708),e.addScale(a[7],.858086*i*r),e.addScale(a[8],.429043*(i*i-n*n)),e},add:function(t){for(var e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this},scale:function(t){for(var e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this},lerp:function(t,e){for(var i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this},equals:function(t){for(var e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0},copy:function(t){return this.set(t.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(t,e){void 0===e&&(e=0);for(var i=this.coefficients,n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);for(var i=this.coefficients,n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}}),Object.assign(ul,{getBasisAt:function(t,e){var i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}),pl.prototype=Object.assign(Object.create(Ih.prototype),{constructor:pl,isLightProbe:!0,copy:function(t){return Ih.prototype.copy.call(this,t),this.sh.copy(t.sh),this.intensity=t.intensity,this},toJSON:function(t){return Ih.prototype.toJSON.call(this,t)}}),dl.prototype=Object.assign(Object.create(pl.prototype),{constructor:dl,isHemisphereLightProbe:!0,copy:function(t){return pl.prototype.copy.call(this,t),this},toJSON:function(t){return pl.prototype.toJSON.call(this,t)}}),fl.prototype=Object.assign(Object.create(pl.prototype),{constructor:fl,isAmbientLightProbe:!0,copy:function(t){return pl.prototype.copy.call(this,t),this},toJSON:function(t){return pl.prototype.toJSON.call(this,t)}});var ml=new qe,vl=new qe;function gl(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new rr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new rr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(t){var e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;var i,n,r=t.projectionMatrix.clone(),a=e.eyeSep/2,o=a*e.near/e.focus,s=e.near*Math.tan(Se.DEG2RAD*e.fov*.5)/e.zoom;vl.elements[12]=-a,ml.elements[12]=a,i=-s*e.aspect+o,n=s*e.aspect+o,r.elements[0]=2*e.near/(n-i),r.elements[8]=(n+i)/(n-i),this.cameraL.projectionMatrix.copy(r),i=-s*e.aspect-o,n=s*e.aspect-o,r.elements[0]=2*e.near/(n-i),r.elements[8]=(n+i)/(n-i),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(vl),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(ml)}}),Object.assign(gl.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}});var yl=new Pe,xl=new Ee,bl=new Pe,wl=new Pe;function _l(){li.call(this),this.type="AudioListener",this.context=hl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new gl}function Ml(t){li.call(this),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.startTime=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}_l.prototype=Object.assign(Object.create(li.prototype),{constructor:_l,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},updateMatrixWorld:function(t){li.prototype.updateMatrixWorld.call(this,t);var e=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(yl,xl,bl),wl.set(0,0,-1).applyQuaternion(xl),e.positionX){var n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(yl.x,n),e.positionY.linearRampToValueAtTime(yl.y,n),e.positionZ.linearRampToValueAtTime(yl.z,n),e.forwardX.linearRampToValueAtTime(wl.x,n),e.forwardY.linearRampToValueAtTime(wl.y,n),e.forwardZ.linearRampToValueAtTime(wl.z,n),e.upX.linearRampToValueAtTime(i.x,n),e.upY.linearRampToValueAtTime(i.y,n),e.upZ.linearRampToValueAtTime(i.z,n)}else e.setPosition(yl.x,yl.y,yl.z),e.setOrientation(wl.x,wl.y,wl.z,i.x,i.y,i.z)}}),Ml.prototype=Object.assign(Object.create(li.prototype),{constructor:Ml,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setMediaElementSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),this.startTime=this.context.currentTime,t.start(this.startTime,this.offset,this.duration),this.isPlaying=!0,this.source=t,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(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},setDetune:function(t){if(this.detune=t,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(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!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(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}});var Sl=new Pe,Tl=new Ee,El=new Pe,Al=new Pe;function Ll(t){Ml.call(this,t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function Pl(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Rl(t,e,i){this.binding=t,this.valueSize=i;var n,r=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Ll.prototype=Object.assign(Object.create(Ml.prototype),{constructor:Ll,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){return this.panner.refDistance=t,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){return this.panner.rolloffFactor=t,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){return this.panner.distanceModel=t,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){return this.panner.maxDistance=t,this},setDirectionalCone:function(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this},updateMatrixWorld:function(t){if(li.prototype.updateMatrixWorld.call(this,t),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Sl,Tl,El),Al.set(0,0,1).applyQuaternion(Tl);var e=this.panner;if(e.positionX){var i=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Sl.x,i),e.positionY.linearRampToValueAtTime(Sl.y,i),e.positionZ.linearRampToValueAtTime(Sl.z,i),e.orientationX.linearRampToValueAtTime(Al.x,i),e.orientationY.linearRampToValueAtTime(Al.y,i),e.orientationZ.linearRampToValueAtTime(Al.z,i)}else e.setPosition(Sl.x,Sl.y,Sl.z),e.setOrientation(Al.x,Al.y,Al.z)}}}),Object.assign(Pl.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),Object.assign(Rl.prototype,{accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=3*e;this._mixBufferRegion(i,n,o,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(i[s]!==i[s+e]){a.setValue(i,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=3*i;t.getValue(e,n);for(var r=i,a=n;r!==a;++r)e[r]=e[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,i,n,r){if(n>=.5)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n){Ee.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}});var Cl=new RegExp("[\\[\\]\\.:\\/]","g"),Ol="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Nl=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Dl=/(WCOD+)?/.source.replace("WCOD",Ol),Il=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),zl=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Bl=new RegExp("^"+Nl+Dl+Il+zl+"$"),Ul=["material","materials","bones"];function Gl(t,e,i){var n=i||Fl.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function Fl(t,e,i){this.path=e,this.parsedPath=i||Fl.parseTrackName(e),this.node=Fl.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Hl(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:re,endingEnd:re},s=0;s!==r;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ne,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 Vl(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function jl(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function kl(t,e,i){_o.call(this,t,e),this.meshPerAttribute=i||1}function Wl(t,e){return t.distance-e.distance}function ql(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n))for(var r=t.children,a=0,o=r.length;a<o;a++)ql(r[a],e,i,!0)}Object.assign(Gl.prototype,{getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(Fl,{Composite:Gl,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new Fl.Composite(t,e,i):new Fl(t,e,i)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Cl,"")},parseTrackName:function(t){var e=Bl.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var r=i.nodeName.substring(n+1);-1!==Ul.indexOf(r)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=r)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i},findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){var n=function(t){for(var i=0;i<t.length;i++){var r=t[i];if(r.name===e||r.uuid===e)return r;var a=n(r.children);if(a)return a}return null},r=n(t.children);if(r)return r}return null}}),Object.assign(Fl.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=Fl.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var a=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==a){if(void 0===t[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[a]}}var s=t[n];if(void 0!==s){var c=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var h=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(t.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===r){r=o;break}}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}else{var l=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+n+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Fl.prototype,{_getValue_unbound:Fl.prototype.getValue,_setValue_unbound:Fl.prototype.setValue}),Object.assign(function(){this.uuid=Se.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=n[p];if(void 0===d){d=e++,n[p]=d,t.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new Fl(u,r[f],a[f]))}else if(d<i){c=t[d];var v=--i,g=t[v];n[g.uuid]=d,t[d]=g,n[p]=v,t[v]=u;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],b=y[d];y[d]=x,void 0===b&&(b=new Fl(u,r[f],a[f])),y[v]=b}}else t[d]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=i},remove:function(){for(var t=this._objects,e=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,r=n.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,h=i[c];if(void 0!==h&&h>=e){var l=e++,u=t[l];i[u.uuid]=h,t[h]=u,i[c]=l,t[l]=s;for(var p=0,d=r;p!==d;++p){var f=n[p],m=f[l],v=f[h];f[h]=m,f[l]=v}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=n[h];if(void 0!==l)if(delete n[h],l<i){var u=--i,p=t[u],d=t[y=--e];n[p.uuid]=l,t[l]=p,n[d.uuid]=u,t[u]=d,t.pop();for(var f=0,m=a;f!==m;++f){var v=(x=r[f])[u],g=x[y];x[l]=v,x[u]=g,x.pop()}}else{var y;n[(d=t[y=--e]).uuid]=l,t[l]=d,t.pop();for(f=0,m=a;f!==m;++f){var x;(x=r[f])[l]=x[y],x.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,l=new Array(c);n=r.length,i[t]=n,a.push(t),o.push(e),r.push(l);for(var u=h,p=s.length;u!==p;++u){var d=s[u];l[u]=new Fl(d,t,e)}return l},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}}),Object.assign(Hl.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){var n=this._clip.duration,r=t._clip.duration,a=r/n,o=n/r;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+i,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){if(this.enabled){var r=this._startTime;if(null!==r){var a=(t-r)*i;if(a<0||0===i)return;this._startTime=null,e=i*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,i=this._clip.duration,n=this.loop,r=this._loopCount,a=2202===n;if(0===t)return-1===r?e:a&&1==(1&r)?i-e:e;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0)){this.time=e;break t}e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=i||e<0){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=e;if(a&&1==(1&r))return i-e}return e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:re:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:re:2402)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}}),Vl.prototype=Object.assign(Object.create(t.prototype),{constructor:Vl,_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==r;++l){var u=n[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(void 0!==(d=a[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;++(d=new Rl(Fl.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n=this._actions,r=this._actionsByClip,a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],a=this._bindings;void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[r],0===Object.keys(o).length&&delete a[n]},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&((i=new Vc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Kc.findByName(i,t):t,a=null!==r?r.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new Hl(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Kc.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==i;++o){e[o]._update(n,t,r,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,e[h]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[e];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),jl.prototype.clone=function(){return new jl(void 0===this.value.clone?this.value:this.value.clone())},kl.prototype=Object.assign(Object.create(_o.prototype),{constructor:kl,isInstancedInterleavedBuffer:!0,copy:function(t){return _o.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(function(t,e,i,n){this.ray=new Ii(t,e),this.near=i||0,this.far=n||1/0,this.camera=null,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}}})}.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e,i){var n=i||[];return ql(t,this,n,e),n.sort(Wl),n},intersectObjects:function(t,e,i){var n=i||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var r=0,a=t.length;r<a;r++)ql(t[r],this,n,e);return n.sort(Wl),n}}),Object.assign(function(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this}.prototype,{set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(Se.clamp(e/this.radius,-1,1))),this}}),Object.assign(function(t,e,i){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==i?i:0,this}.prototype,{set:function(t,e,i){return this.radius=t,this.theta=e,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}});var Xl=new Te;function Yl(t,e){this.min=void 0!==t?t:new Te(1/0,1/0),this.max=void 0!==e?e:new Te(-1/0,-1/0)}Object.assign(Yl.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var i=Xl.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new Te),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new Te),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new Te),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new Te),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return Xl.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Jl=new Pe,Zl=new Pe;function Ql(t,e){this.start=void 0!==t?t:new Pe,this.end=void 0!==e?e:new Pe}function Kl(t){li.call(this),this.material=t,this.render=function(){}}Object.assign(Ql.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Pe),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Pe),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Pe),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){Jl.subVectors(t,this.start),Zl.subVectors(this.end,this.start);var i=Zl.dot(Zl),n=Zl.dot(Jl)/i;return e&&(n=Se.clamp(n,0,1)),n},closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new Pe),this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Kl.prototype=Object.create(li.prototype),Kl.prototype.constructor=Kl,Kl.prototype.isImmediateRenderObject=!0;var $l=new Pe,tu=new Pe,eu=new Oe,iu=["a","b","c"];function nu(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new Sn,h=new dn(2*o*3,3);c.addAttribute("position",h),is.call(this,c,new Xo({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}nu.prototype=Object.create(is.prototype),nu.prototype.constructor=nu,nu.prototype.update=function(){this.object.updateMatrixWorld(!0),eu.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,e=this.geometry.attributes.position,i=this.object.geometry;if(i&&i.isGeometry)for(var n=i.vertices,r=i.faces,a=0,o=0,s=r.length;o<s;o++)for(var c=r[o],h=0,l=c.vertexNormals.length;h<l;h++){var u=n[c[iu[h]]],p=c.vertexNormals[h];$l.copy(u).applyMatrix4(t),tu.copy(p).applyMatrix3(eu).normalize().multiplyScalar(this.size).add($l),e.setXYZ(a,$l.x,$l.y,$l.z),a+=1,e.setXYZ(a,tu.x,tu.y,tu.z),a+=1}else if(i&&i.isBufferGeometry){var d=i.attributes.position,f=i.attributes.normal;for(a=0,h=0,l=d.count;h<l;h++)$l.set(d.getX(h),d.getY(h),d.getZ(h)).applyMatrix4(t),tu.set(f.getX(h),f.getY(h),f.getZ(h)),tu.applyMatrix3(eu).normalize().multiplyScalar(this.size).add($l),e.setXYZ(a,$l.x,$l.y,$l.z),a+=1,e.setXYZ(a,tu.x,tu.y,tu.z),a+=1}e.needsUpdate=!0};var ru=new Pe;function au(t,e){li.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var i=new Sn,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}i.addAttribute("position",new dn(n,3));var c=new Xo({fog:!1});this.cone=new is(i,c),this.add(this.cone),this.update()}au.prototype=Object.create(li.prototype),au.prototype.constructor=au,au.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},au.prototype.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),ru.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ru),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var ou=new Pe,su=new qe,cu=new qe;function hu(t){for(var e=function t(e){var i=[];e&&e.isBone&&i.push(e);for(var n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),i=new Sn,n=[],r=[],a=new Zi(0,0,1),o=new Zi(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}i.addAttribute("position",new dn(n,3)),i.addAttribute("color",new dn(r,3));var h=new Xo({vertexColors:p,depthTest:!1,depthWrite:!1,transparent:!0});is.call(this,i,h),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}function lu(t,e,i){this.light=t,this.light.updateMatrixWorld(),this.color=i;var n=new pc(e,4,2),r=new rn({wireframe:!0,fog:!1});Vn.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function uu(t,e){this.type="RectAreaLightHelper",this.light=t,this.color=e;var i=new Sn;i.addAttribute("position",new dn([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere();var n=new Xo({fog:!1});$o.call(this,i,n);var r=new Sn;r.addAttribute("position",new dn([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new Vn(r,new rn({side:c,fog:!1}))),this.update()}hu.prototype=Object.create(is.prototype),hu.prototype.constructor=hu,hu.prototype.updateMatrixWorld=function(t){var e=this.bones,i=this.geometry,n=i.getAttribute("position");cu.getInverse(this.root.matrixWorld);for(var r=0,a=0;r<e.length;r++){var o=e[r];o.parent&&o.parent.isBone&&(su.multiplyMatrices(cu,o.matrixWorld),ou.setFromMatrixPosition(su),n.setXYZ(a,ou.x,ou.y,ou.z),su.multiplyMatrices(cu,o.parent.matrixWorld),ou.setFromMatrixPosition(su),n.setXYZ(a+1,ou.x,ou.y,ou.z),a+=2)}i.getAttribute("position").needsUpdate=!0,li.prototype.updateMatrixWorld.call(this,t)},lu.prototype=Object.create(Vn.prototype),lu.prototype.constructor=lu,lu.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},lu.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},uu.prototype=Object.create($o.prototype),uu.prototype.constructor=uu,uu.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 t=this.material.color,e=Math.max(t.r,t.g,t.b);e>1&&t.multiplyScalar(1/e),this.children[0].material.color.copy(this.material.color)}},uu.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()};var pu=new Pe,du=new Zi,fu=new Zi;function mu(t,e,i){li.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;var n=new Ms(e);n.rotateY(.5*Math.PI),this.material=new rn({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=p);var r=n.getAttribute("position"),a=new Float32Array(3*r.count);n.addAttribute("color",new an(a,3)),this.add(new Vn(n,this.material)),this.update()}function vu(t,e){this.lightProbe=t,this.size=e;var i={GAMMA_OUTPUT:""},n=new ir({defines:i,uniforms:{sh:{value:this.lightProbe.sh.coefficients},intensity:{value:this.lightProbe.intensity}},vertexShader:["varying vec3 vNormal;","void main() {","\tvNormal = normalize( normalMatrix * normal );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI 0.318309886","vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {","\t// matrix is assumed to be orthogonal","\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );","}","vec3 linearToOutput( in vec3 a ) {","\t#ifdef GAMMA_OUTPUT","\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );","\t#else","\t\treturn a;","\t#endif","}","// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf","vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {","\t// normal is assumed to have unit length","\tfloat x = normal.x, y = normal.y, z = normal.z;","\t// band 0","\tvec3 result = shCoefficients[ 0 ] * 0.886227;","\t// band 1","\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;","\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;","\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;","\t// band 2","\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;","\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;","\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );","\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;","\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );","\treturn result;","}","uniform vec3 sh[ 9 ]; // sh coefficients","uniform float intensity; // light probe intensity","varying vec3 vNormal;","void main() {","\tvec3 normal = normalize( vNormal );","\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );","\tvec3 irradiance = shGetIrradianceAt( worldNormal, sh );","\tvec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;","\toutgoingLight = linearToOutput( outgoingLight );","\tgl_FragColor = vec4( outgoingLight, 1.0 );","}"].join("\n")}),r=new pc(1,32,16);Vn.call(this,r,n),this.onBeforeRender()}function gu(t,e,i,n){t=t||10,e=e||10,i=new Zi(void 0!==i?i:4473924),n=new Zi(void 0!==n?n:8947848);for(var r=e/2,a=t/e,o=t/2,s=[],c=[],h=0,l=0,u=-o;h<=e;h++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var d=h===r?i:n;d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3}var f=new Sn;f.addAttribute("position",new dn(s,3)),f.addAttribute("color",new dn(c,3));var m=new Xo({vertexColors:p});is.call(this,f,m)}function yu(t,e,i,n,r,a){t=t||10,e=e||16,i=i||8,n=n||64,r=new Zi(void 0!==r?r:4473924),a=new Zi(void 0!==a?a:8947848);var o,s,c,h,l,u,d,f=[],m=[];for(h=0;h<=e;h++)c=h/e*(2*Math.PI),o=Math.sin(c)*t,s=Math.cos(c)*t,f.push(0,0,0),f.push(o,0,s),d=1&h?r:a,m.push(d.r,d.g,d.b),m.push(d.r,d.g,d.b);for(h=0;h<=i;h++)for(d=1&h?r:a,u=t-t/i*h,l=0;l<n;l++)c=l/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,f.push(o,0,s),m.push(d.r,d.g,d.b),c=(l+1)/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,f.push(o,0,s),m.push(d.r,d.g,d.b);var v=new Sn;v.addAttribute("position",new dn(f,3)),v.addAttribute("color",new dn(m,3));var g=new Xo({vertexColors:p});is.call(this,v,g)}function xu(t,e,i,n){this.audio=t,this.range=e||1,this.divisionsInnerAngle=i||16,this.divisionsOuterAngle=n||2;var r=new Sn,a=this.divisionsInnerAngle+2*this.divisionsOuterAngle,o=new Float32Array(3*(3*a+3));r.addAttribute("position",new an(o,3));var s=new Xo({color:65280}),c=new Xo({color:16776960});$o.call(this,r,[c,s]),this.update()}mu.prototype=Object.create(li.prototype),mu.prototype.constructor=mu,mu.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},mu.prototype.update=function(){var t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var e=t.geometry.getAttribute("color");du.copy(this.light.color),fu.copy(this.light.groundColor);for(var i=0,n=e.count;i<n;i++){var r=i<n/2?du:fu;e.setXYZ(i,r.r,r.g,r.b)}e.needsUpdate=!0}t.lookAt(pu.setFromMatrixPosition(this.light.matrixWorld).negate())},vu.prototype=Object.create(Vn.prototype),vu.prototype.constructor=vu,vu.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},vu.prototype.onBeforeRender=function(){this.position.copy(this.lightProbe.position),this.scale.set(1,1,1).multiplyScalar(this.size),this.material.uniforms.intensity.value=this.lightProbe.intensity},gu.prototype=Object.assign(Object.create(is.prototype),{constructor:gu,copy:function(t){return is.prototype.copy.call(this,t),this.geometry.copy(t.geometry),this.material.copy(t.material),this},clone:function(){return(new this.constructor).copy(this)}}),yu.prototype=Object.create(is.prototype),yu.prototype.constructor=yu,xu.prototype=Object.create($o.prototype),xu.prototype.constructor=xu,xu.prototype.update=function(){var t,e,i=this.audio,n=this.range,r=this.divisionsInnerAngle,a=this.divisionsOuterAngle,o=Se.degToRad(i.panner.coneInnerAngle),s=Se.degToRad(i.panner.coneOuterAngle),c=o/2,h=s/2,l=0,u=0,p=this.geometry,d=p.attributes.position;function f(i,r,a,o){var s=(r-i)/a;for(d.setXYZ(l,0,0,0),u++,t=i;t<r;t+=s)e=l+u,d.setXYZ(e,Math.sin(t)*n,0,Math.cos(t)*n),d.setXYZ(e+1,Math.sin(Math.min(t+s,r))*n,0,Math.cos(Math.min(t+s,r))*n),d.setXYZ(e+2,0,0,0),u+=3;p.addGroup(l,u,o),l+=u,u=0}p.clearGroups(),f(-h,-c,a,0),f(-c,c,r,1),f(c,h,a,0),d.needsUpdate=!0,o===s&&(this.material[0].visible=!1)},xu.prototype.dispose=function(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()};var bu=new Pe,wu=new Pe,_u=new Oe;function Mu(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Sn,h=new dn(2*o*3,3);c.addAttribute("position",h),is.call(this,c,new Xo({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}Mu.prototype=Object.create(is.prototype),Mu.prototype.constructor=Mu,Mu.prototype.update=function(){this.object.updateMatrixWorld(!0),_u.getNormalMatrix(this.object.matrixWorld);for(var t=this.object.matrixWorld,e=this.geometry.attributes.position,i=this.object.geometry,n=i.vertices,r=i.faces,a=0,o=0,s=r.length;o<s;o++){var c=r[o],h=c.normal;bu.copy(n[c.a]).add(n[c.b]).add(n[c.c]).divideScalar(3).applyMatrix4(t),wu.copy(h).applyMatrix3(_u).normalize().multiplyScalar(this.size).add(bu),e.setXYZ(a,bu.x,bu.y,bu.z),a+=1,e.setXYZ(a,wu.x,wu.y,wu.z),a+=1}e.needsUpdate=!0};var Su=new Pe,Tu=new Pe,Eu=new Pe;function Au(t,e,i){li.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,void 0===e&&(e=1);var n=new Sn;n.addAttribute("position",new dn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var r=new Xo({fog:!1});this.lightPlane=new $o(n,r),this.add(this.lightPlane),(n=new Sn).addAttribute("position",new dn([0,0,0,0,0,1],3)),this.targetLine=new $o(n,r),this.add(this.targetLine),this.update()}Au.prototype=Object.create(li.prototype),Au.prototype.constructor=Au,Au.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Au.prototype.update=function(){Su.setFromMatrixPosition(this.light.matrixWorld),Tu.setFromMatrixPosition(this.light.target.matrixWorld),Eu.subVectors(Tu,Su),this.lightPlane.lookAt(Tu),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(Tu),this.targetLine.scale.z=Eu.length()};var Lu=new Pe,Pu=new nr;function Ru(t){var e=new Sn,i=new Xo({color:16777215,vertexColors:u}),n=[],r=[],a={},o=new Zi(16755200),s=new Zi(16711680),c=new Zi(43775),h=new Zi(16777215),l=new Zi(3355443);function p(t,e,i){d(t,i),d(e,i)}function d(t,e){n.push(0,0,0),r.push(e.r,e.g,e.b),void 0===a[t]&&(a[t]=[]),a[t].push(n.length/3-1)}p("n1","n2",o),p("n2","n4",o),p("n4","n3",o),p("n3","n1",o),p("f1","f2",o),p("f2","f4",o),p("f4","f3",o),p("f3","f1",o),p("n1","f1",o),p("n2","f2",o),p("n3","f3",o),p("n4","f4",o),p("p","n1",s),p("p","n2",s),p("p","n3",s),p("p","n4",s),p("u1","u2",c),p("u2","u3",c),p("u3","u1",c),p("c","t",h),p("p","c",l),p("cn1","cn2",l),p("cn3","cn4",l),p("cf1","cf2",l),p("cf3","cf4",l),e.addAttribute("position",new dn(n,3)),e.addAttribute("color",new dn(r,3)),is.call(this,e,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Cu(t,e,i,n,r,a,o){Lu.set(r,a,o).unproject(n);var s=e[t];if(void 0!==s)for(var c=i.getAttribute("position"),h=0,l=s.length;h<l;h++)c.setXYZ(s[h],Lu.x,Lu.y,Lu.z)}Ru.prototype=Object.create(is.prototype),Ru.prototype.constructor=Ru,Ru.prototype.update=function(){var t=this.geometry,e=this.pointMap;Pu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Cu("c",e,t,Pu,0,0,-1),Cu("t",e,t,Pu,0,0,1),Cu("n1",e,t,Pu,-1,-1,-1),Cu("n2",e,t,Pu,1,-1,-1),Cu("n3",e,t,Pu,-1,1,-1),Cu("n4",e,t,Pu,1,1,-1),Cu("f1",e,t,Pu,-1,-1,1),Cu("f2",e,t,Pu,1,-1,1),Cu("f3",e,t,Pu,-1,1,1),Cu("f4",e,t,Pu,1,1,1),Cu("u1",e,t,Pu,.7,1.1,-1),Cu("u2",e,t,Pu,-.7,1.1,-1),Cu("u3",e,t,Pu,0,2,-1),Cu("cf1",e,t,Pu,-1,0,1),Cu("cf2",e,t,Pu,1,0,1),Cu("cf3",e,t,Pu,0,-1,1),Cu("cf4",e,t,Pu,0,1,1),Cu("cn1",e,t,Pu,-1,0,-1),Cu("cn2",e,t,Pu,1,0,-1),Cu("cn3",e,t,Pu,0,-1,-1),Cu("cn4",e,t,Pu,0,1,-1),t.getAttribute("position").needsUpdate=!0};var Ou=new Si;function Nu(t,e){this.object=t,void 0===e&&(e=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]),n=new Float32Array(24),r=new Sn;r.setIndex(new an(i,1)),r.addAttribute("position",new an(n,3)),is.call(this,r,new Xo({color:e})),this.matrixAutoUpdate=!1,this.update()}function Du(t,e){this.type="Box3Helper",this.box=t,e=e||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]),n=new Sn;n.setIndex(new an(i,1)),n.addAttribute("position",new dn([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)),is.call(this,n,new Xo({color:e})),this.geometry.computeBoundingSphere()}function Iu(t,e,i){this.type="PlaneHelper",this.plane=t,this.size=void 0===e?1:e;var n=void 0!==i?i:16776960,r=new Sn;r.addAttribute("position",new dn([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)),r.computeBoundingSphere(),$o.call(this,r,new Xo({color:n}));var a=new Sn;a.addAttribute("position",new dn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Vn(a,new rn({color:n,opacity:.2,transparent:!0,depthWrite:!1})))}Nu.prototype=Object.create(is.prototype),Nu.prototype.constructor=Nu,Nu.prototype.update=function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Ou.setFromObject(this.object),!Ou.isEmpty()){var e=Ou.min,i=Ou.max,n=this.geometry.attributes.position,r=n.array;r[0]=i.x,r[1]=i.y,r[2]=i.z,r[3]=e.x,r[4]=i.y,r[5]=i.z,r[6]=e.x,r[7]=e.y,r[8]=i.z,r[9]=i.x,r[10]=e.y,r[11]=i.z,r[12]=i.x,r[13]=i.y,r[14]=e.z,r[15]=e.x,r[16]=i.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=i.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}},Nu.prototype.setFromObject=function(t){return this.object=t,this.update(),this},Nu.prototype.copy=function(t){return is.prototype.copy.call(this,t),this.object=t.object,this},Nu.prototype.clone=function(){return(new this.constructor).copy(this)},Du.prototype=Object.create(is.prototype),Du.prototype.constructor=Du,Du.prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),li.prototype.updateMatrixWorld.call(this,t))},Iu.prototype=Object.create($o.prototype),Iu.prototype.constructor=Iu,Iu.prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?c:s,this.lookAt(this.plane.normal),li.prototype.updateMatrixWorld.call(this,t)};var zu,Bu,Uu,Gu,Fu,Hu,Vu,ju,ku,Wu,qu,Xu,Yu,Ju=new Pe;function Zu(t,e,i,n,r,a){li.call(this),void 0===t&&(t=new Pe(0,0,1)),void 0===e&&(e=new Pe(0,0,0)),void 0===i&&(i=1),void 0===n&&(n=16776960),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),void 0===zu&&((zu=new Sn).addAttribute("position",new dn([0,0,0,0,1,0],3)),(Bu=new _c(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new $o(zu,new Xo({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Vn(Bu,new rn({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,a)}function Qu(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new Sn;i.addAttribute("position",new dn(e,3)),i.addAttribute("color",new dn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new Xo({vertexColors:p});is.call(this,i,n)}function Ku(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),bh.call(this,t),this.type="catmullrom"}function $u(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new ah(t)}function tp(){Hu.setSize(window.innerWidth,window.innerHeight)}function ep(t){requestAnimationFrame(ep),Vu.time.value=t/1e3,Hu.render(Fu,Gu)}Zu.prototype=Object.create(li.prototype),Zu.prototype.constructor=Zu,Zu.prototype.setDirection=function(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Ju.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Ju,e)}},Zu.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},Zu.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},Zu.prototype.copy=function(t){return li.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},Zu.prototype.clone=function(){return(new this.constructor).copy(this)},Qu.prototype=Object.create(is.prototype),Qu.prototype.constructor=Qu,ph.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(ph.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(Oh.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new Jn,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new Pe(r.x,r.y,r.z||0))}return e}}),Object.assign(Nh.prototype,{fromPoints:function(t){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),Ku.prototype=Object.create(bh.prototype),Object.assign(Ku.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.")}}),gu.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},hu.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(nh.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Yh(t)}}),Object.assign($h.prototype,{setTexturePath:function(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}),Object.assign(Yl.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Si.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Ql.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(Se,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Se.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Se.ceilPowerOfTwo(t)}}),Object.assign(Oe.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(qe.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Pe).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,a)}}),dr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Ee.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Ii.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(qi.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(qi,{barycoordFromPoint:function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),qi.getBarycoord(t,e,i,n,r)},normal:function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),qi.getNormal(t,e,i,n)}}),Object.assign(Dh.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ac(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new gc(this,t)}}),Object.assign(Te.prototype,{fromAttribute:function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Pe.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(ze.prototype,{fromAttribute:function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Jn.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(li.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties(li.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Ho.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Wo.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Vo.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(ph.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),rr.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Ih.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(an.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(Sn.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Sn.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(oc.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(jl.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(nn.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 Zi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}}}),Object.defineProperties(Oc.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(ir.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(xo.prototype,{clearTarget:function(t,e,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,i,n)},animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(xo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}}}),Object.defineProperties(oo.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(cr.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(Be.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(go.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}}),Ml.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new ll).load(t,(function(t){e.setBuffer(t)})),this},Pl.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},sr.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Ne.crossOrigin=void 0,Ne.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new uh;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},Ne.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new lh;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},Ne.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Ne.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},ju="shaders/demo.vert",ku="shaders/demo.frag",Wu=(t,e)=>{!function(t,e){Uu=document.getElementById("container"),Gu=new Vh(-1,1,1,-1,0,1),Fu=new ui;var i=new Mr(2,2),n=new ir({uniforms:Vu={time:{value:1}},vertexShader:t,fragmentShader:e}),r=new Vn(i,n);Fu.add(r),(Hu=new xo).setPixelRatio(window.devicePixelRatio),Uu.appendChild(Hu.domElement),tp(),window.addEventListener("resize",tp,!1)}(t,e),ep()},(Yu=new $u(ih)).setResponseType("text"),Yu.load(ju,(function(t){var e=new $u(ih);e.setResponseType("text"),e.load(ku,(function(e){Wu(t,e)}))}),qu,Xu)}();
  