stereoframe-runtime 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- var LY="184";var DY=0,T$=1,kY=2;var n6=1,MY=2,G6=3,A9=0,yJ=1,sJ=2,H9=0,w8=1,P8=2,A$=3,S$=4,VY=5;var E6=100,BY=101,CY=102,IY=103,zY=104,_Y=200,wY=201,PY=202,TY=203,AY=204,SY=205,jY=206,vY=207,yY=208,xY=209,bY=210,hY=211,fY=212,gY=213,pY=214,uY=0,dY=1,mY=2,j$=3,lY=4,cY=5,nY=6,sY=7,iY=0,oY=1,aY=2,Q9=0,s6=1,i6=2,o6=3,T8=4,a6=5,r6=6,t6=7;var F6=301,A8=302,ZQ=303,WQ=304,e6=306,U8=1000,N6=1001,YQ=1002,V9=1003,XQ=1004;var S8=1005;var CJ=1006,O6=1007;var S9=1008;var B9=1009,rY=1010,tY=1011,J7=1012,v$=1013,G8=1014,$9=1015,kJ=1016,y$=1017,x$=1018,q6=1020,eY=35902,JX=35899,QX=1021,$X=1022,j9=1023,j8=1026,v8=1027,ZX=1028,b$=1029,y8=1030,h$=1031;var f$=1033,KQ=33776,HQ=33777,UQ=33778,GQ=33779,g$=35840,p$=35841,u$=35842,d$=35843,m$=36196,l$=37492,c$=37496,n$=37488,s$=37489,EQ=37490,i$=37491,o$=37808,a$=37809,r$=37810,t$=37811,e$=37812,JZ=37813,QZ=37814,$Z=37815,ZZ=37816,WZ=37817,YZ=37818,XZ=37819,KZ=37820,HZ=37821,UZ=36492,GZ=36494,EZ=36495,FZ=36283,NZ=36284,FQ=36285,OZ=36286;var qZ=2300,NQ=2301;var RZ=0,Q7=1,R6=2;var LZ=0,WX=1,x8="",E8="srgb",mJ="srgb-linear",DZ="linear",YJ="srgb";var YX=512,XX=513,KX=514,OQ=515,HX=516,UX=517,qQ=518,GX=519;var L6=35048;var kZ="300 es",MZ=2000;function PH(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function TH(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function K6(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function EX(){let J=K6("canvas");return J.style.display="block",J}var vW={},H6=null;function c6(...J){let Q="THREE."+J.shift();if(H6)H6("log",Q,...J);else console.log(Q,...J)}function FX(J){let Q=J[0];if(typeof Q==="string"&&Q.startsWith("TSL:")){let $=J[1];if($&&$.isStackTrace)J[0]+=" "+$.getLocation();else J[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return J}function C0(...J){J=FX(J);let Q="THREE."+J.shift();if(H6)H6("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function S0(...J){J=FX(J);let Q="THREE."+J.shift();if(H6)H6("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function JQ(...J){let Q=J.join(" ");if(Q in vW)return;vW[Q]=!0,C0(...J)}function NX(J,Q,$){return new Promise(function(Z,W){function Y(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:W();break;case J.TIMEOUT_EXPIRED:setTimeout(Y,$);break;default:Z()}}setTimeout(Y,$)})}var OX={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class v9{addEventListener(J,Q){if(this._listeners===void 0)this._listeners={};let $=this._listeners;if($[J]===void 0)$[J]=[];if($[J].indexOf(Q)===-1)$[J].push(Q)}hasEventListener(J,Q){let $=this._listeners;if($===void 0)return!1;return $[J]!==void 0&&$[J].indexOf(Q)!==-1}removeEventListener(J,Q){let $=this._listeners;if($===void 0)return;let Z=$[J];if(Z!==void 0){let W=Z.indexOf(Q);if(W!==-1)Z.splice(W,1)}}dispatchEvent(J){let Q=this._listeners;if(Q===void 0)return;let $=Q[J.type];if($!==void 0){J.target=this;let Z=$.slice(0);for(let W=0,Y=Z.length;W<Y;W++)Z[W].call(this,J);J.target=null}}}var fJ=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],yW=1234567,m6=Math.PI/180,z8=180/Math.PI;function M9(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,Z=Math.random()*4294967295|0;return(fJ[J&255]+fJ[J>>8&255]+fJ[J>>16&255]+fJ[J>>24&255]+"-"+fJ[Q&255]+fJ[Q>>8&255]+"-"+fJ[Q>>16&15|64]+fJ[Q>>24&255]+"-"+fJ[$&63|128]+fJ[$>>8&255]+"-"+fJ[$>>16&255]+fJ[$>>24&255]+fJ[Z&255]+fJ[Z>>8&255]+fJ[Z>>16&255]+fJ[Z>>24&255]).toLowerCase()}function l0(J,Q,$){return Math.max(Q,Math.min($,J))}function VZ(J,Q){return(J%Q+Q)%Q}function AH(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function SH(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function l6(J,Q,$){return(1-$)*J+$*Q}function jH(J,Q,$,Z){return l6(J,Q,1-Math.exp(-$*Z))}function vH(J,Q=1){return Q-Math.abs(VZ(J,Q*2)-Q)}function yH(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function xH(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*J*(J*(J*6-15)+10)}function bH(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function hH(J,Q){return J+Math.random()*(Q-J)}function fH(J){return J*(0.5-Math.random())}function gH(J){if(J!==void 0)yW=J;let Q=yW+=1831565813;return Q=Math.imul(Q^Q>>>15,Q|1),Q^=Q+Math.imul(Q^Q>>>7,Q|61),((Q^Q>>>14)>>>0)/4294967296}function pH(J){return J*m6}function uH(J){return J*z8}function dH(J){return(J&J-1)===0&&J!==0}function mH(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function lH(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function cH(J,Q,$,Z,W){let{cos:Y,sin:X}=Math,K=Y($/2),H=X($/2),U=Y((Q+Z)/2),G=X((Q+Z)/2),F=Y((Q-Z)/2),E=X((Q-Z)/2),O=Y((Z-Q)/2),R=X((Z-Q)/2);switch(W){case"XYX":J.set(K*G,H*F,H*E,K*U);break;case"YZY":J.set(H*E,K*G,H*F,K*U);break;case"ZXZ":J.set(H*F,H*E,K*G,K*U);break;case"XZX":J.set(K*G,H*R,H*O,K*U);break;case"YXY":J.set(H*O,K*G,H*R,K*U);break;case"ZYZ":J.set(H*R,H*O,K*G,K*U);break;default:C0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function k9(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return J/4294967295;case Uint16Array:return J/65535;case Uint8Array:return J/255;case Int32Array:return Math.max(J/2147483647,-1);case Int16Array:return Math.max(J/32767,-1);case Int8Array:return Math.max(J/127,-1);default:throw Error("Invalid component type.")}}function ZJ(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return Math.round(J*4294967295);case Uint16Array:return Math.round(J*65535);case Uint8Array:return Math.round(J*255);case Int32Array:return Math.round(J*2147483647);case Int16Array:return Math.round(J*32767);case Int8Array:return Math.round(J*127);default:throw Error("Invalid component type.")}}var D6={DEG2RAD:m6,RAD2DEG:z8,generateUUID:M9,clamp:l0,euclideanModulo:VZ,mapLinear:AH,inverseLerp:SH,lerp:l6,damp:jH,pingpong:vH,smoothstep:yH,smootherstep:xH,randInt:bH,randFloat:hH,randFloatSpread:fH,seededRandom:gH,degToRad:pH,radToDeg:uH,isPowerOfTwo:dH,ceilPowerOfTwo:mH,floorPowerOfTwo:lH,setQuaternionFromProperEuler:cH,normalize:ZJ,denormalize:k9};class T0{static{T0.prototype.isVector2=!0}constructor(J=0,Q=0){this.x=J,this.y=Q}get width(){return this.x}set width(J){this.x=J}get height(){return this.y}set height(J){this.y=J}set(J,Q){return this.x=J,this.y=Q,this}setScalar(J){return this.x=J,this.y=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y)}copy(J){return this.x=J.x,this.y=J.y,this}add(J){return this.x+=J.x,this.y+=J.y,this}addScalar(J){return this.x+=J,this.y+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this}subScalar(J){return this.x-=J,this.y-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this}multiply(J){return this.x*=J.x,this.y*=J.y,this}multiplyScalar(J){return this.x*=J,this.y*=J,this}divide(J){return this.x/=J.x,this.y/=J.y,this}divideScalar(J){return this.multiplyScalar(1/J)}applyMatrix3(J){let Q=this.x,$=this.y,Z=J.elements;return this.x=Z[0]*Q+Z[3]*$+Z[6],this.y=Z[1]*Q+Z[4]*$+Z[7],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this}clamp(J,Q){return this.x=l0(this.x,J.x,Q.x),this.y=l0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=l0(this.x,J,Q),this.y=l0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(l0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(J){return this.x*J.x+this.y*J.y}cross(J){return this.x*J.y-this.y*J.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(l0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y;return Q*Q+$*$}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this}equals(J){return J.x===this.x&&J.y===this.y}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this}rotateAround(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=this.x-J.x,Y=this.y-J.y;return this.x=W*$-Y*Z+J.x,this.y=W*Z+Y*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class AJ{constructor(J=0,Q=0,$=0,Z=1){this.isQuaternion=!0,this._x=J,this._y=Q,this._z=$,this._w=Z}static slerpFlat(J,Q,$,Z,W,Y,X){let K=$[Z+0],H=$[Z+1],U=$[Z+2],G=$[Z+3],F=W[Y+0],E=W[Y+1],O=W[Y+2],R=W[Y+3];if(G!==R||K!==F||H!==E||U!==O){let C=K*F+H*E+U*O+G*R;if(C<0)F=-F,E=-E,O=-O,R=-R,C=-C;let q=1-X;if(C<0.9995){let N=Math.acos(C),L=Math.sin(N);q=Math.sin(q*N)/L,X=Math.sin(X*N)/L,K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X}else{K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X;let N=1/Math.sqrt(K*K+H*H+U*U+G*G);K*=N,H*=N,U*=N,G*=N}}J[Q]=K,J[Q+1]=H,J[Q+2]=U,J[Q+3]=G}static multiplyQuaternionsFlat(J,Q,$,Z,W,Y){let X=$[Z],K=$[Z+1],H=$[Z+2],U=$[Z+3],G=W[Y],F=W[Y+1],E=W[Y+2],O=W[Y+3];return J[Q]=X*O+U*G+K*E-H*F,J[Q+1]=K*O+U*F+H*G-X*E,J[Q+2]=H*O+U*E+X*F-K*G,J[Q+3]=U*O-X*G-K*F-H*E,J}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get w(){return this._w}set w(J){this._w=J,this._onChangeCallback()}set(J,Q,$,Z){return this._x=J,this._y=Q,this._z=$,this._w=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(J){return this._x=J.x,this._y=J.y,this._z=J.z,this._w=J.w,this._onChangeCallback(),this}setFromEuler(J,Q=!0){let{_x:$,_y:Z,_z:W,_order:Y}=J,X=Math.cos,K=Math.sin,H=X($/2),U=X(Z/2),G=X(W/2),F=K($/2),E=K(Z/2),O=K(W/2);switch(Y){case"XYZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"YXZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"ZXY":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"ZYX":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"YZX":this._x=F*U*G+H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G-F*E*O;break;case"XZY":this._x=F*U*G-H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G+F*E*O;break;default:C0("Quaternion: .setFromEuler() encountered an unknown order: "+Y)}if(Q===!0)this._onChangeCallback();return this}setFromAxisAngle(J,Q){let $=Q/2,Z=Math.sin($);return this._x=J.x*Z,this._y=J.y*Z,this._z=J.z*Z,this._w=Math.cos($),this._onChangeCallback(),this}setFromRotationMatrix(J){let Q=J.elements,$=Q[0],Z=Q[4],W=Q[8],Y=Q[1],X=Q[5],K=Q[9],H=Q[2],U=Q[6],G=Q[10],F=$+X+G;if(F>0){let E=0.5/Math.sqrt(F+1);this._w=0.25/E,this._x=(U-K)*E,this._y=(W-H)*E,this._z=(Y-Z)*E}else if($>X&&$>G){let E=2*Math.sqrt(1+$-X-G);this._w=(U-K)/E,this._x=0.25*E,this._y=(Z+Y)/E,this._z=(W+H)/E}else if(X>G){let E=2*Math.sqrt(1+X-$-G);this._w=(W-H)/E,this._x=(Z+Y)/E,this._y=0.25*E,this._z=(K+U)/E}else{let E=2*Math.sqrt(1+G-$-X);this._w=(Y-Z)/E,this._x=(W+H)/E,this._y=(K+U)/E,this._z=0.25*E}return this._onChangeCallback(),this}setFromUnitVectors(J,Q){let $=J.dot(Q)+1;if($<0.00000001)if($=0,Math.abs(J.x)>Math.abs(J.z))this._x=-J.y,this._y=J.x,this._z=0,this._w=$;else this._x=0,this._y=-J.z,this._z=J.y,this._w=$;else this._x=J.y*Q.z-J.z*Q.y,this._y=J.z*Q.x-J.x*Q.z,this._z=J.x*Q.y-J.y*Q.x,this._w=$;return this.normalize()}angleTo(J){return 2*Math.acos(Math.abs(l0(this.dot(J),-1,1)))}rotateTowards(J,Q){let $=this.angleTo(J);if($===0)return this;let Z=Math.min(1,Q/$);return this.slerp(J,Z),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(J){return this._x*J._x+this._y*J._y+this._z*J._z+this._w*J._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let J=this.length();if(J===0)this._x=0,this._y=0,this._z=0,this._w=1;else J=1/J,this._x=this._x*J,this._y=this._y*J,this._z=this._z*J,this._w=this._w*J;return this._onChangeCallback(),this}multiply(J){return this.multiplyQuaternions(this,J)}premultiply(J){return this.multiplyQuaternions(J,this)}multiplyQuaternions(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=Q._x,K=Q._y,H=Q._z,U=Q._w;return this._x=$*U+Y*X+Z*H-W*K,this._y=Z*U+Y*K+W*X-$*H,this._z=W*U+Y*H+$*K-Z*X,this._w=Y*U-$*X-Z*K-W*H,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=this.dot(J);if(X<0)$=-$,Z=-Z,W=-W,Y=-Y,X=-X;let K=1-Q;if(X<0.9995){let H=Math.acos(X),U=Math.sin(H);K=Math.sin(K*H)/U,Q=Math.sin(Q*H)/U,this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this._onChangeCallback()}else this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this.normalize();return this}slerpQuaternions(J,Q,$){return this.copy(J).slerp(Q,$)}random(){let J=2*Math.PI*Math.random(),Q=2*Math.PI*Math.random(),$=Math.random(),Z=Math.sqrt(1-$),W=Math.sqrt($);return this.set(Z*Math.sin(J),Z*Math.cos(J),W*Math.sin(Q),W*Math.cos(Q))}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._w===this._w}fromArray(J,Q=0){return this._x=J[Q],this._y=J[Q+1],this._z=J[Q+2],this._w=J[Q+3],this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._w,J}fromBufferAttribute(J,Q){return this._x=J.getX(Q),this._y=J.getY(Q),this._z=J.getZ(Q),this._w=J.getW(Q),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class S{static{S.prototype.isVector3=!0}constructor(J=0,Q=0,$=0){this.x=J,this.y=Q,this.z=$}set(J,Q,$){if($===void 0)$=this.z;return this.x=J,this.y=Q,this.z=$,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this}multiplyVectors(J,Q){return this.x=J.x*Q.x,this.y=J.y*Q.y,this.z=J.z*Q.z,this}applyEuler(J){return this.applyQuaternion(xW.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(xW.setFromAxisAngle(J,Q))}applyMatrix3(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[3]*$+W[6]*Z,this.y=W[1]*Q+W[4]*$+W[7]*Z,this.z=W[2]*Q+W[5]*$+W[8]*Z,this}applyNormalMatrix(J){return this.applyMatrix3(J).normalize()}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements,Y=1/(W[3]*Q+W[7]*$+W[11]*Z+W[15]);return this.x=(W[0]*Q+W[4]*$+W[8]*Z+W[12])*Y,this.y=(W[1]*Q+W[5]*$+W[9]*Z+W[13])*Y,this.z=(W[2]*Q+W[6]*$+W[10]*Z+W[14])*Y,this}applyQuaternion(J){let Q=this.x,$=this.y,Z=this.z,W=J.x,Y=J.y,X=J.z,K=J.w,H=2*(Y*Z-X*$),U=2*(X*Q-W*Z),G=2*(W*$-Y*Q);return this.x=Q+K*H+Y*G-X*U,this.y=$+K*U+X*H-W*G,this.z=Z+K*G+W*U-Y*H,this}project(J){return this.applyMatrix4(J.matrixWorldInverse).applyMatrix4(J.projectionMatrix)}unproject(J){return this.applyMatrix4(J.projectionMatrixInverse).applyMatrix4(J.matrixWorld)}transformDirection(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[4]*$+W[8]*Z,this.y=W[1]*Q+W[5]*$+W[9]*Z,this.z=W[2]*Q+W[6]*$+W[10]*Z,this.normalize()}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this}divideScalar(J){return this.multiplyScalar(1/J)}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this}clamp(J,Q){return this.x=l0(this.x,J.x,Q.x),this.y=l0(this.y,J.y,Q.y),this.z=l0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=l0(this.x,J,Q),this.y=l0(this.y,J,Q),this.z=l0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(l0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this}cross(J){return this.crossVectors(this,J)}crossVectors(J,Q){let{x:$,y:Z,z:W}=J,Y=Q.x,X=Q.y,K=Q.z;return this.x=Z*K-W*X,this.y=W*Y-$*K,this.z=$*X-Z*Y,this}projectOnVector(J){let Q=J.lengthSq();if(Q===0)return this.set(0,0,0);let $=J.dot(this)/Q;return this.copy(J).multiplyScalar($)}projectOnPlane(J){return eQ.copy(this).projectOnVector(J),this.sub(eQ)}reflect(J){return this.sub(eQ.copy(J).multiplyScalar(2*this.dot(J)))}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(l0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y,Z=this.z-J.z;return Q*Q+$*$+Z*Z}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)+Math.abs(this.z-J.z)}setFromSpherical(J){return this.setFromSphericalCoords(J.radius,J.phi,J.theta)}setFromSphericalCoords(J,Q,$){let Z=Math.sin(Q)*J;return this.x=Z*Math.sin($),this.y=Math.cos(Q)*J,this.z=Z*Math.cos($),this}setFromCylindrical(J){return this.setFromCylindricalCoords(J.radius,J.theta,J.y)}setFromCylindricalCoords(J,Q,$){return this.x=J*Math.sin(Q),this.y=$,this.z=J*Math.cos(Q),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this}setFromMatrixScale(J){let Q=this.setFromMatrixColumn(J,0).length(),$=this.setFromMatrixColumn(J,1).length(),Z=this.setFromMatrixColumn(J,2).length();return this.x=Q,this.y=$,this.z=Z,this}setFromMatrixColumn(J,Q){return this.fromArray(J.elements,Q*4)}setFromMatrix3Column(J,Q){return this.fromArray(J.elements,Q*3)}setFromEuler(J){return this.x=J._x,this.y=J._y,this.z=J._z,this}setFromColor(J){return this.x=J.r,this.y=J.g,this.z=J.b,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let J=Math.random()*Math.PI*2,Q=Math.random()*2-1,$=Math.sqrt(1-Q*Q);return this.x=$*Math.cos(J),this.y=Q,this.z=$*Math.sin(J),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var eQ=new S,xW=new AJ;class h0{static{h0.prototype.isMatrix3=!0}constructor(J,Q,$,Z,W,Y,X,K,H){if(this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H)}set(J,Q,$,Z,W,Y,X,K,H){let U=this.elements;return U[0]=J,U[1]=Z,U[2]=X,U[3]=Q,U[4]=W,U[5]=K,U[6]=$,U[7]=Y,U[8]=H,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],this}extractBasis(J,Q,$){return J.setFromMatrix3Column(this,0),Q.setFromMatrix3Column(this,1),$.setFromMatrix3Column(this,2),this}setFromMatrix4(J){let Q=J.elements;return this.set(Q[0],Q[4],Q[8],Q[1],Q[5],Q[9],Q[2],Q[6],Q[10]),this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[3],K=$[6],H=$[1],U=$[4],G=$[7],F=$[2],E=$[5],O=$[8],R=Z[0],C=Z[3],q=Z[6],N=Z[1],L=Z[4],k=Z[7],M=Z[2],P=Z[5],w=Z[8];return W[0]=Y*R+X*N+K*M,W[3]=Y*C+X*L+K*P,W[6]=Y*q+X*k+K*w,W[1]=H*R+U*N+G*M,W[4]=H*C+U*L+G*P,W[7]=H*q+U*k+G*w,W[2]=F*R+E*N+O*M,W[5]=F*C+E*L+O*P,W[8]=F*q+E*k+O*w,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[3]*=J,Q[6]*=J,Q[1]*=J,Q[4]*=J,Q[7]*=J,Q[2]*=J,Q[5]*=J,Q[8]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8];return Q*Y*U-Q*X*H-$*W*U+$*X*K+Z*W*H-Z*Y*K}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=U*Y-X*H,F=X*K-U*W,E=H*W-Y*K,O=Q*G+$*F+Z*E;if(O===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/O;return J[0]=G*R,J[1]=(Z*H-U*$)*R,J[2]=(X*$-Z*Y)*R,J[3]=F*R,J[4]=(U*Q-Z*K)*R,J[5]=(Z*W-X*Q)*R,J[6]=E*R,J[7]=($*K-H*Q)*R,J[8]=(Y*Q-$*W)*R,this}transpose(){let J,Q=this.elements;return J=Q[1],Q[1]=Q[3],Q[3]=J,J=Q[2],Q[2]=Q[6],Q[6]=J,J=Q[5],Q[5]=Q[7],Q[7]=J,this}getNormalMatrix(J){return this.setFromMatrix4(J).invert().transpose()}transposeIntoArray(J){let Q=this.elements;return J[0]=Q[0],J[1]=Q[3],J[2]=Q[6],J[3]=Q[1],J[4]=Q[4],J[5]=Q[7],J[6]=Q[2],J[7]=Q[5],J[8]=Q[8],this}setUvTransform(J,Q,$,Z,W,Y,X){let K=Math.cos(W),H=Math.sin(W);return this.set($*K,$*H,-$*(K*Y+H*X)+Y+J,-Z*H,Z*K,-Z*(-H*Y+K*X)+X+Q,0,0,1),this}scale(J,Q){return this.premultiply(J$.makeScale(J,Q)),this}rotate(J){return this.premultiply(J$.makeRotation(-J)),this}translate(J,Q){return this.premultiply(J$.makeTranslation(J,Q)),this}makeTranslation(J,Q){if(J.isVector2)this.set(1,0,J.x,0,1,J.y,0,0,1);else this.set(1,0,J,0,1,Q,0,0,1);return this}makeRotation(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,$,Q,0,0,0,1),this}makeScale(J,Q){return this.set(J,0,0,0,Q,0,0,0,1),this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<9;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<9;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J}clone(){return new this.constructor().fromArray(this.elements)}}var J$=new h0,bW=new h0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),hW=new h0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function nH(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(W,Y,X){if(this.enabled===!1||Y===X||!Y||!X)return W;if(this.spaces[Y].transfer==="srgb")W.r=n9(W.r),W.g=n9(W.g),W.b=n9(W.b);if(this.spaces[Y].primaries!==this.spaces[X].primaries)W.applyMatrix3(this.spaces[Y].toXYZ),W.applyMatrix3(this.spaces[X].fromXYZ);if(this.spaces[X].transfer==="srgb")W.r=X6(W.r),W.g=X6(W.g),W.b=X6(W.b);return W},workingToColorSpace:function(W,Y){return this.convert(W,this.workingColorSpace,Y)},colorSpaceToWorking:function(W,Y){return this.convert(W,Y,this.workingColorSpace)},getPrimaries:function(W){return this.spaces[W].primaries},getTransfer:function(W){if(W==="")return"linear";return this.spaces[W].transfer},getToneMappingMode:function(W){return this.spaces[W].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(W,Y=this.workingColorSpace){return W.fromArray(this.spaces[Y].luminanceCoefficients)},define:function(W){Object.assign(this.spaces,W)},_getMatrix:function(W,Y,X){return W.copy(this.spaces[Y].toXYZ).multiply(this.spaces[X].fromXYZ)},_getDrawingBufferColorSpace:function(W){return this.spaces[W].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(W=this.workingColorSpace){return this.spaces[W].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(W,Y){return JQ("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,Y)},toWorkingColorSpace:function(W,Y){return JQ("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(W,Y)}},Q=[0.64,0.33,0.3,0.6,0.15,0.06],$=[0.2126,0.7152,0.0722],Z=[0.3127,0.329];return J.define({["srgb-linear"]:{primaries:Q,whitePoint:Z,transfer:"linear",toXYZ:bW,fromXYZ:hW,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:bW,fromXYZ:hW,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var u0=nH();function n9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function X6(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var n8;class BZ{static getDataURL(J,Q="image/png"){if(/^data:/i.test(J.src))return J.src;if(typeof HTMLCanvasElement>"u")return J.src;let $;if(J instanceof HTMLCanvasElement)$=J;else{if(n8===void 0)n8=K6("canvas");n8.width=J.width,n8.height=J.height;let Z=n8.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=n8}return $.toDataURL(Q)}static sRGBToLinear(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap){let Q=K6("canvas");Q.width=J.width,Q.height=J.height;let $=Q.getContext("2d");$.drawImage(J,0,0,J.width,J.height);let Z=$.getImageData(0,0,J.width,J.height),W=Z.data;for(let Y=0;Y<W.length;Y++)W[Y]=n9(W[Y]/255)*255;return $.putImageData(Z,0,0),Q}else if(J.data){let Q=J.data.slice(0);for(let $=0;$<Q.length;$++)if(Q instanceof Uint8Array||Q instanceof Uint8ClampedArray)Q[$]=Math.floor(n9(Q[$]/255)*255);else Q[$]=n9(Q[$]);return{data:Q,width:J.width,height:J.height}}else return C0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}var sH=0;class $7{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:sH++}),this.uuid=M9(),this.data=J,this.dataReady=!0,this.version=0}getSize(J){let Q=this.data;if(typeof HTMLVideoElement<"u"&&Q instanceof HTMLVideoElement)J.set(Q.videoWidth,Q.videoHeight,0);else if(typeof VideoFrame<"u"&&Q instanceof VideoFrame)J.set(Q.displayWidth,Q.displayHeight,0);else if(Q!==null)J.set(Q.width,Q.height,Q.depth||0);else J.set(0,0,0);return J}set needsUpdate(J){if(J===!0)this.version++}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.images[this.uuid]!==void 0)return J.images[this.uuid];let $={uuid:this.uuid,url:""},Z=this.data;if(Z!==null){let W;if(Array.isArray(Z)){W=[];for(let Y=0,X=Z.length;Y<X;Y++)if(Z[Y].isDataTexture)W.push(Q$(Z[Y].image));else W.push(Q$(Z[Y]))}else W=Q$(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function Q$(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return BZ.getDataURL(J);else if(J.data)return{data:Array.from(J.data),width:J.width,height:J.height,type:J.data.constructor.name};else return C0("Texture: Unable to serialize Texture."),{}}var iH=0,$$=new S;class PJ extends v9{constructor(J=PJ.DEFAULT_IMAGE,Q=PJ.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,Y=1008,X=1023,K=1009,H=PJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:iH++}),this.uuid=M9(),this.name="",this.source=new $7(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=Z,this.magFilter=W,this.minFilter=Y,this.anisotropy=H,this.format=X,this.internalFormat=null,this.type=K,this.offset=new T0(0,0),this.repeat=new T0(1,1),this.center=new T0(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new h0,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=U,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=J&&J.depth&&J.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize($$).x}get height(){return this.source.getSize($$).y}get depth(){return this.source.getSize($$).z}get image(){return this.source.data}set image(J){this.source.data=J}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(J){return this.name=J.name,this.source=J.source,this.mipmaps=J.mipmaps.slice(0),this.mapping=J.mapping,this.channel=J.channel,this.wrapS=J.wrapS,this.wrapT=J.wrapT,this.magFilter=J.magFilter,this.minFilter=J.minFilter,this.anisotropy=J.anisotropy,this.format=J.format,this.internalFormat=J.internalFormat,this.type=J.type,this.normalized=J.normalized,this.offset.copy(J.offset),this.repeat.copy(J.repeat),this.center.copy(J.center),this.rotation=J.rotation,this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrix.copy(J.matrix),this.generateMipmaps=J.generateMipmaps,this.premultiplyAlpha=J.premultiplyAlpha,this.flipY=J.flipY,this.unpackAlignment=J.unpackAlignment,this.colorSpace=J.colorSpace,this.renderTarget=J.renderTarget,this.isRenderTargetTexture=J.isRenderTargetTexture,this.isArrayTexture=J.isArrayTexture,this.userData=JSON.parse(JSON.stringify(J.userData)),this.needsUpdate=!0,this}setValues(J){for(let Q in J){let $=J[Q];if($===void 0){C0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){C0(`Texture.setValues(): property '${Q}' does not exist.`);continue}if(Z&&$&&(Z.isVector2&&$.isVector2))Z.copy($);else if(Z&&$&&(Z.isVector3&&$.isVector3))Z.copy($);else if(Z&&$&&(Z.isMatrix3&&$.isMatrix3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.textures[this.uuid]!==void 0)return J.textures[this.uuid];let $={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(J).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)$.userData=this.userData;if(!Q)J.textures[this.uuid]=$;return $}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(J){if(this.mapping!==300)return J;if(J.applyMatrix3(this.matrix),J.x<0||J.x>1)switch(this.wrapS){case 1000:J.x=J.x-Math.floor(J.x);break;case 1001:J.x=J.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.x)%2)===1)J.x=Math.ceil(J.x)-J.x;else J.x=J.x-Math.floor(J.x);break}if(J.y<0||J.y>1)switch(this.wrapT){case 1000:J.y=J.y-Math.floor(J.y);break;case 1001:J.y=J.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.y)%2)===1)J.y=Math.ceil(J.y)-J.y;else J.y=J.y-Math.floor(J.y);break}if(this.flipY)J.y=1-J.y;return J}set needsUpdate(J){if(J===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(J){if(J===!0)this.pmremVersion++}}PJ.DEFAULT_IMAGE=null;PJ.DEFAULT_MAPPING=300;PJ.DEFAULT_ANISOTROPY=1;class $J{static{$J.prototype.isVector4=!0}constructor(J=0,Q=0,$=0,Z=1){this.x=J,this.y=Q,this.z=$,this.w=Z}get width(){return this.z}set width(J){this.z=J}get height(){return this.w}set height(J){this.w=J}set(J,Q,$,Z){return this.x=J,this.y=Q,this.z=$,this.w=Z,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this.w=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setW(J){return this.w=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;case 3:this.w=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this.w=J.w!==void 0?J.w:1,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this.w+=J.w,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this.w+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this.w=J.w+Q.w,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this.w+=J.w*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this.w-=J.w,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this.w-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this.w=J.w-Q.w,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this.w*=J.w,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this.w*=J,this}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=this.w,Y=J.elements;return this.x=Y[0]*Q+Y[4]*$+Y[8]*Z+Y[12]*W,this.y=Y[1]*Q+Y[5]*$+Y[9]*Z+Y[13]*W,this.z=Y[2]*Q+Y[6]*$+Y[10]*Z+Y[14]*W,this.w=Y[3]*Q+Y[7]*$+Y[11]*Z+Y[15]*W,this}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this.w/=J.w,this}divideScalar(J){return this.multiplyScalar(1/J)}setAxisAngleFromQuaternion(J){this.w=2*Math.acos(J.w);let Q=Math.sqrt(1-J.w*J.w);if(Q<0.0001)this.x=1,this.y=0,this.z=0;else this.x=J.x/Q,this.y=J.y/Q,this.z=J.z/Q;return this}setAxisAngleFromRotationMatrix(J){let Q,$,Z,W,Y=0.01,X=0.1,K=J.elements,H=K[0],U=K[4],G=K[8],F=K[1],E=K[5],O=K[9],R=K[2],C=K[6],q=K[10];if(Math.abs(U-F)<0.01&&Math.abs(G-R)<0.01&&Math.abs(O-C)<0.01){if(Math.abs(U+F)<0.1&&Math.abs(G+R)<0.1&&Math.abs(O+C)<0.1&&Math.abs(H+E+q-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let L=(H+1)/2,k=(E+1)/2,M=(q+1)/2,P=(U+F)/4,w=(G+R)/4,B=(O+C)/4;if(L>k&&L>M)if(L<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(L),Z=P/$,W=w/$;else if(k>M)if(k<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(k),$=P/Z,W=B/Z;else if(M<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(M),$=w/W,Z=B/W;return this.set($,Z,W,Q),this}let N=Math.sqrt((C-O)*(C-O)+(G-R)*(G-R)+(F-U)*(F-U));if(Math.abs(N)<0.001)N=1;return this.x=(C-O)/N,this.y=(G-R)/N,this.z=(F-U)/N,this.w=Math.acos((H+E+q-1)/2),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this.w=Q[15],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this.w=Math.min(this.w,J.w),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this.w=Math.max(this.w,J.w),this}clamp(J,Q){return this.x=l0(this.x,J.x,Q.x),this.y=l0(this.y,J.y,Q.y),this.z=l0(this.z,J.z,Q.z),this.w=l0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=l0(this.x,J,Q),this.y=l0(this.y,J,Q),this.z=l0(this.z,J,Q),this.w=l0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(l0($,J,Q))}floor(){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(){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(){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(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z+this.w*J.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this.w+=(J.w-this.w)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this.w=J.w+(Q.w-J.w)*$,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z&&J.w===this.w}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this.w=J[Q+3],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J[Q+3]=this.w,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this.w=J.getW(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class CZ extends v9{constructor(J=1,Q=1,$={}){super();$=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},$),this.isRenderTarget=!0,this.width=J,this.height=Q,this.depth=$.depth,this.scissor=new $J(0,0,J,Q),this.scissorTest=!1,this.viewport=new $J(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new PJ(Z),Y=$.count;for(let X=0;X<Y;X++)this.textures[X]=W.clone(),this.textures[X].isRenderTargetTexture=!0,this.textures[X].renderTarget=this;this._setTextureOptions($),this.depthBuffer=$.depthBuffer,this.stencilBuffer=$.stencilBuffer,this.resolveDepthBuffer=$.resolveDepthBuffer,this.resolveStencilBuffer=$.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=$.depthTexture,this.samples=$.samples,this.multiview=$.multiview}_setTextureOptions(J={}){let Q={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(J.mapping!==void 0)Q.mapping=J.mapping;if(J.wrapS!==void 0)Q.wrapS=J.wrapS;if(J.wrapT!==void 0)Q.wrapT=J.wrapT;if(J.wrapR!==void 0)Q.wrapR=J.wrapR;if(J.magFilter!==void 0)Q.magFilter=J.magFilter;if(J.minFilter!==void 0)Q.minFilter=J.minFilter;if(J.format!==void 0)Q.format=J.format;if(J.type!==void 0)Q.type=J.type;if(J.anisotropy!==void 0)Q.anisotropy=J.anisotropy;if(J.colorSpace!==void 0)Q.colorSpace=J.colorSpace;if(J.flipY!==void 0)Q.flipY=J.flipY;if(J.generateMipmaps!==void 0)Q.generateMipmaps=J.generateMipmaps;if(J.internalFormat!==void 0)Q.internalFormat=J.internalFormat;for(let $=0;$<this.textures.length;$++)this.textures[$].setValues(Q)}get texture(){return this.textures[0]}set texture(J){this.textures[0]=J}set depthTexture(J){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(J!==null)J.renderTarget=this;this._depthTexture=J}get depthTexture(){return this._depthTexture}setSize(J,Q,$=1){if(this.width!==J||this.height!==Q||this.depth!==$){this.width=J,this.height=Q,this.depth=$;for(let Z=0,W=this.textures.length;Z<W;Z++)if(this.textures[Z].image.width=J,this.textures[Z].image.height=Q,this.textures[Z].image.depth=$,this.textures[Z].isData3DTexture!==!0)this.textures[Z].isArrayTexture=this.textures[Z].image.depth>1;this.dispose()}this.viewport.set(0,0,J,Q),this.scissor.set(0,0,J,Q)}clone(){return new this.constructor().copy(this)}copy(J){this.width=J.width,this.height=J.height,this.depth=J.depth,this.scissor.copy(J.scissor),this.scissorTest=J.scissorTest,this.viewport.copy(J.viewport),this.textures.length=0;for(let Q=0,$=J.textures.length;Q<$;Q++){this.textures[Q]=J.textures[Q].clone(),this.textures[Q].isRenderTargetTexture=!0,this.textures[Q].renderTarget=this;let Z=Object.assign({},J.textures[Q].image);this.textures[Q].source=new $7(Z)}if(this.depthBuffer=J.depthBuffer,this.stencilBuffer=J.stencilBuffer,this.resolveDepthBuffer=J.resolveDepthBuffer,this.resolveStencilBuffer=J.resolveStencilBuffer,J.depthTexture!==null)this.depthTexture=J.depthTexture.clone();return this.samples=J.samples,this.multiview=J.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class TJ extends CZ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class RQ extends PJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isDataArrayTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class IZ extends PJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isData3DTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class j0{static{j0.prototype.isMatrix4=!0}constructor(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,C){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,C)}set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,C){let q=this.elements;return q[0]=J,q[4]=Q,q[8]=$,q[12]=Z,q[1]=W,q[5]=Y,q[9]=X,q[13]=K,q[2]=H,q[6]=U,q[10]=G,q[14]=F,q[3]=E,q[7]=O,q[11]=R,q[15]=C,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new j0().fromArray(this.elements)}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],Q[9]=$[9],Q[10]=$[10],Q[11]=$[11],Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],Q[15]=$[15],this}copyPosition(J){let Q=this.elements,$=J.elements;return Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],this}setFromMatrix3(J){let Q=J.elements;return this.set(Q[0],Q[3],Q[6],0,Q[1],Q[4],Q[7],0,Q[2],Q[5],Q[8],0,0,0,0,1),this}extractBasis(J,Q,$){if(this.determinant()===0)return J.set(1,0,0),Q.set(0,1,0),$.set(0,0,1),this;return J.setFromMatrixColumn(this,0),Q.setFromMatrixColumn(this,1),$.setFromMatrixColumn(this,2),this}makeBasis(J,Q,$){return this.set(J.x,Q.x,$.x,0,J.y,Q.y,$.y,0,J.z,Q.z,$.z,0,0,0,0,1),this}extractRotation(J){if(J.determinant()===0)return this.identity();let Q=this.elements,$=J.elements,Z=1/s8.setFromMatrixColumn(J,0).length(),W=1/s8.setFromMatrixColumn(J,1).length(),Y=1/s8.setFromMatrixColumn(J,2).length();return Q[0]=$[0]*Z,Q[1]=$[1]*Z,Q[2]=$[2]*Z,Q[3]=0,Q[4]=$[4]*W,Q[5]=$[5]*W,Q[6]=$[6]*W,Q[7]=0,Q[8]=$[8]*Y,Q[9]=$[9]*Y,Q[10]=$[10]*Y,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromEuler(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z,Y=Math.cos($),X=Math.sin($),K=Math.cos(Z),H=Math.sin(Z),U=Math.cos(W),G=Math.sin(W);if(J.order==="XYZ"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=-K*G,Q[8]=H,Q[1]=E+O*H,Q[5]=F-R*H,Q[9]=-X*K,Q[2]=R-F*H,Q[6]=O+E*H,Q[10]=Y*K}else if(J.order==="YXZ"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F+R*X,Q[4]=O*X-E,Q[8]=Y*H,Q[1]=Y*G,Q[5]=Y*U,Q[9]=-X,Q[2]=E*X-O,Q[6]=R+F*X,Q[10]=Y*K}else if(J.order==="ZXY"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F-R*X,Q[4]=-Y*G,Q[8]=O+E*X,Q[1]=E+O*X,Q[5]=Y*U,Q[9]=R-F*X,Q[2]=-Y*H,Q[6]=X,Q[10]=Y*K}else if(J.order==="ZYX"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=O*H-E,Q[8]=F*H+R,Q[1]=K*G,Q[5]=R*H+F,Q[9]=E*H-O,Q[2]=-H,Q[6]=X*K,Q[10]=Y*K}else if(J.order==="YZX"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=R-F*G,Q[8]=O*G+E,Q[1]=G,Q[5]=Y*U,Q[9]=-X*U,Q[2]=-H*U,Q[6]=E*G+O,Q[10]=F-R*G}else if(J.order==="XZY"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=-G,Q[8]=H*U,Q[1]=F*G+R,Q[5]=Y*U,Q[9]=E*G-O,Q[2]=O*G-E,Q[6]=X*U,Q[10]=R*G+F}return Q[3]=0,Q[7]=0,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromQuaternion(J){return this.compose(oH,J,aH)}lookAt(J,Q,$){let Z=this.elements;if(eJ.subVectors(J,Q),eJ.lengthSq()===0)eJ.z=1;if(eJ.normalize(),Z8.crossVectors($,eJ),Z8.lengthSq()===0){if(Math.abs($.z)===1)eJ.x+=0.0001;else eJ.z+=0.0001;eJ.normalize(),Z8.crossVectors($,eJ)}return Z8.normalize(),P7.crossVectors(eJ,Z8),Z[0]=Z8.x,Z[4]=P7.x,Z[8]=eJ.x,Z[1]=Z8.y,Z[5]=P7.y,Z[9]=eJ.y,Z[2]=Z8.z,Z[6]=P7.z,Z[10]=eJ.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[4],K=$[8],H=$[12],U=$[1],G=$[5],F=$[9],E=$[13],O=$[2],R=$[6],C=$[10],q=$[14],N=$[3],L=$[7],k=$[11],M=$[15],P=Z[0],w=Z[4],B=Z[8],D=Z[12],V=Z[1],j=Z[5],z=Z[9],v=Z[13],y=Z[2],A=Z[6],x=Z[10],b=Z[14],p=Z[3],c=Z[7],o=Z[11],Q0=Z[15];return W[0]=Y*P+X*V+K*y+H*p,W[4]=Y*w+X*j+K*A+H*c,W[8]=Y*B+X*z+K*x+H*o,W[12]=Y*D+X*v+K*b+H*Q0,W[1]=U*P+G*V+F*y+E*p,W[5]=U*w+G*j+F*A+E*c,W[9]=U*B+G*z+F*x+E*o,W[13]=U*D+G*v+F*b+E*Q0,W[2]=O*P+R*V+C*y+q*p,W[6]=O*w+R*j+C*A+q*c,W[10]=O*B+R*z+C*x+q*o,W[14]=O*D+R*v+C*b+q*Q0,W[3]=N*P+L*V+k*y+M*p,W[7]=N*w+L*j+k*A+M*c,W[11]=N*B+L*z+k*x+M*o,W[15]=N*D+L*v+k*b+M*Q0,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[4]*=J,Q[8]*=J,Q[12]*=J,Q[1]*=J,Q[5]*=J,Q[9]*=J,Q[13]*=J,Q[2]*=J,Q[6]*=J,Q[10]*=J,Q[14]*=J,Q[3]*=J,Q[7]*=J,Q[11]*=J,Q[15]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[4],Z=J[8],W=J[12],Y=J[1],X=J[5],K=J[9],H=J[13],U=J[2],G=J[6],F=J[10],E=J[14],O=J[3],R=J[7],C=J[11],q=J[15],N=K*E-H*F,L=X*E-H*G,k=X*F-K*G,M=Y*E-H*U,P=Y*F-K*U,w=Y*G-X*U;return Q*(R*N-C*L+q*k)-$*(O*N-C*M+q*P)+Z*(O*L-R*M+q*w)-W*(O*k-R*P+C*w)}transpose(){let J=this.elements,Q;return Q=J[1],J[1]=J[4],J[4]=Q,Q=J[2],J[2]=J[8],J[8]=Q,Q=J[6],J[6]=J[9],J[9]=Q,Q=J[3],J[3]=J[12],J[12]=Q,Q=J[7],J[7]=J[13],J[13]=Q,Q=J[11],J[11]=J[14],J[14]=Q,this}setPosition(J,Q,$){let Z=this.elements;if(J.isVector3)Z[12]=J.x,Z[13]=J.y,Z[14]=J.z;else Z[12]=J,Z[13]=Q,Z[14]=$;return this}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=J[9],F=J[10],E=J[11],O=J[12],R=J[13],C=J[14],q=J[15],N=Q*X-$*Y,L=Q*K-Z*Y,k=Q*H-W*Y,M=$*K-Z*X,P=$*H-W*X,w=Z*H-W*K,B=U*R-G*O,D=U*C-F*O,V=U*q-E*O,j=G*C-F*R,z=G*q-E*R,v=F*q-E*C,y=N*v-L*z+k*j+M*V-P*D+w*B;if(y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/y;return J[0]=(X*v-K*z+H*j)*A,J[1]=(Z*z-$*v-W*j)*A,J[2]=(R*w-C*P+q*M)*A,J[3]=(F*P-G*w-E*M)*A,J[4]=(K*V-Y*v-H*D)*A,J[5]=(Q*v-Z*V+W*D)*A,J[6]=(C*k-O*w-q*L)*A,J[7]=(U*w-F*k+E*L)*A,J[8]=(Y*z-X*V+H*B)*A,J[9]=($*V-Q*z-W*B)*A,J[10]=(O*P-R*k+q*N)*A,J[11]=(G*k-U*P-E*N)*A,J[12]=(X*D-Y*j-K*B)*A,J[13]=(Q*j-$*D+Z*B)*A,J[14]=(R*L-O*M-C*N)*A,J[15]=(U*M-G*L+F*N)*A,this}scale(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z;return Q[0]*=$,Q[4]*=Z,Q[8]*=W,Q[1]*=$,Q[5]*=Z,Q[9]*=W,Q[2]*=$,Q[6]*=Z,Q[10]*=W,Q[3]*=$,Q[7]*=Z,Q[11]*=W,this}getMaxScaleOnAxis(){let J=this.elements,Q=J[0]*J[0]+J[1]*J[1]+J[2]*J[2],$=J[4]*J[4]+J[5]*J[5]+J[6]*J[6],Z=J[8]*J[8]+J[9]*J[9]+J[10]*J[10];return Math.sqrt(Math.max(Q,$,Z))}makeTranslation(J,Q,$){if(J.isVector3)this.set(1,0,0,J.x,0,1,0,J.y,0,0,1,J.z,0,0,0,1);else this.set(1,0,0,J,0,1,0,Q,0,0,1,$,0,0,0,1);return this}makeRotationX(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(1,0,0,0,0,Q,-$,0,0,$,Q,0,0,0,0,1),this}makeRotationY(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,0,$,0,0,1,0,0,-$,0,Q,0,0,0,0,1),this}makeRotationZ(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,0,$,Q,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=1-$,Y=J.x,X=J.y,K=J.z,H=W*Y,U=W*X;return this.set(H*Y+$,H*X-Z*K,H*K+Z*X,0,H*X+Z*K,U*X+$,U*K-Z*Y,0,H*K-Z*X,U*K+Z*Y,W*K*K+$,0,0,0,0,1),this}makeScale(J,Q,$){return this.set(J,0,0,0,0,Q,0,0,0,0,$,0,0,0,0,1),this}makeShear(J,Q,$,Z,W,Y){return this.set(1,$,W,0,J,1,Y,0,Q,Z,1,0,0,0,0,1),this}compose(J,Q,$){let Z=this.elements,W=Q._x,Y=Q._y,X=Q._z,K=Q._w,H=W+W,U=Y+Y,G=X+X,F=W*H,E=W*U,O=W*G,R=Y*U,C=Y*G,q=X*G,N=K*H,L=K*U,k=K*G,M=$.x,P=$.y,w=$.z;return Z[0]=(1-(R+q))*M,Z[1]=(E+k)*M,Z[2]=(O-L)*M,Z[3]=0,Z[4]=(E-k)*P,Z[5]=(1-(F+q))*P,Z[6]=(C+N)*P,Z[7]=0,Z[8]=(O+L)*w,Z[9]=(C-N)*w,Z[10]=(1-(F+R))*w,Z[11]=0,Z[12]=J.x,Z[13]=J.y,Z[14]=J.z,Z[15]=1,this}decompose(J,Q,$){let Z=this.elements;J.x=Z[12],J.y=Z[13],J.z=Z[14];let W=this.determinant();if(W===0)return $.set(1,1,1),Q.identity(),this;let Y=s8.set(Z[0],Z[1],Z[2]).length(),X=s8.set(Z[4],Z[5],Z[6]).length(),K=s8.set(Z[8],Z[9],Z[10]).length();if(W<0)Y=-Y;q9.copy(this);let H=1/Y,U=1/X,G=1/K;return q9.elements[0]*=H,q9.elements[1]*=H,q9.elements[2]*=H,q9.elements[4]*=U,q9.elements[5]*=U,q9.elements[6]*=U,q9.elements[8]*=G,q9.elements[9]*=G,q9.elements[10]*=G,Q.setFromRotationMatrix(q9),$.x=Y,$.y=X,$.z=K,this}makePerspective(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2*W/(Q-J),G=2*W/($-Z),F=(Q+J)/(Q-J),E=($+Z)/($-Z),O,R;if(K)O=W/(Y-W),R=Y*W/(Y-W);else if(X===2000)O=-(Y+W)/(Y-W),R=-2*Y*W/(Y-W);else if(X===2001)O=-Y/(Y-W),R=-Y*W/(Y-W);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=F,H[12]=0,H[1]=0,H[5]=G,H[9]=E,H[13]=0,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=-1,H[15]=0,this}makeOrthographic(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2/(Q-J),G=2/($-Z),F=-(Q+J)/(Q-J),E=-($+Z)/($-Z),O,R;if(K)O=1/(Y-W),R=Y/(Y-W);else if(X===2000)O=-2/(Y-W),R=-(Y+W)/(Y-W);else if(X===2001)O=-1/(Y-W),R=-W/(Y-W);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=0,H[12]=F,H[1]=0,H[5]=G,H[9]=0,H[13]=E,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=0,H[15]=1,this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<16;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<16;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J[Q+9]=$[9],J[Q+10]=$[10],J[Q+11]=$[11],J[Q+12]=$[12],J[Q+13]=$[13],J[Q+14]=$[14],J[Q+15]=$[15],J}}var s8=new S,q9=new j0,oH=new S(0,0,0),aH=new S(1,1,1),Z8=new S,P7=new S,eJ=new S,fW=new j0,gW=new AJ;class T9{constructor(J=0,Q=0,$=0,Z=T9.DEFAULT_ORDER){this.isEuler=!0,this._x=J,this._y=Q,this._z=$,this._order=Z}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get order(){return this._order}set order(J){this._order=J,this._onChangeCallback()}set(J,Q,$,Z=this._order){return this._x=J,this._y=Q,this._z=$,this._order=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(J){return this._x=J._x,this._y=J._y,this._z=J._z,this._order=J._order,this._onChangeCallback(),this}setFromRotationMatrix(J,Q=this._order,$=!0){let Z=J.elements,W=Z[0],Y=Z[4],X=Z[8],K=Z[1],H=Z[5],U=Z[9],G=Z[2],F=Z[6],E=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(l0(X,-1,1)),Math.abs(X)<0.9999999)this._x=Math.atan2(-U,E),this._z=Math.atan2(-Y,W);else this._x=Math.atan2(F,H),this._z=0;break;case"YXZ":if(this._x=Math.asin(-l0(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(X,E),this._z=Math.atan2(K,H);else this._y=Math.atan2(-G,W),this._z=0;break;case"ZXY":if(this._x=Math.asin(l0(F,-1,1)),Math.abs(F)<0.9999999)this._y=Math.atan2(-G,E),this._z=Math.atan2(-Y,H);else this._y=0,this._z=Math.atan2(K,W);break;case"ZYX":if(this._y=Math.asin(-l0(G,-1,1)),Math.abs(G)<0.9999999)this._x=Math.atan2(F,E),this._z=Math.atan2(K,W);else this._x=0,this._z=Math.atan2(-Y,H);break;case"YZX":if(this._z=Math.asin(l0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(-U,H),this._y=Math.atan2(-G,W);else this._x=0,this._y=Math.atan2(X,E);break;case"XZY":if(this._z=Math.asin(-l0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(F,H),this._y=Math.atan2(X,W);else this._x=Math.atan2(-U,E),this._y=0;break;default:C0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return fW.makeRotationFromQuaternion(J),this.setFromRotationMatrix(fW,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return gW.setFromEuler(this),this.setFromQuaternion(gW,J)}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._order===this._order}fromArray(J){if(this._x=J[0],this._y=J[1],this._z=J[2],J[3]!==void 0)this._order=J[3];return this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._order,J}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}T9.DEFAULT_ORDER="XYZ";class LQ{constructor(){this.mask=1}set(J){this.mask=(1<<J|0)>>>0}enable(J){this.mask|=1<<J|0}enableAll(){this.mask=-1}toggle(J){this.mask^=1<<J|0}disable(J){this.mask&=~(1<<J|0)}disableAll(){this.mask=0}test(J){return(this.mask&J.mask)!==0}isEnabled(J){return(this.mask&(1<<J|0))!==0}}var rH=0,pW=new S,i8=new AJ,g9=new j0,T7=new S,x6=new S,tH=new S,eH=new AJ,uW=new S(1,0,0),dW=new S(0,1,0),mW=new S(0,0,1),lW={type:"added"},JU={type:"removed"},o8={type:"childadded",child:null},Z$={type:"childremoved",child:null};class HJ extends v9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:rH++}),this.uuid=M9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=HJ.DEFAULT_UP.clone();let J=new S,Q=new T9,$=new AJ,Z=new S(1,1,1);function W(){$.setFromEuler(Q,!1)}function Y(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(W),$._onChange(Y),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:J},rotation:{configurable:!0,enumerable:!0,value:Q},quaternion:{configurable:!0,enumerable:!0,value:$},scale:{configurable:!0,enumerable:!0,value:Z},modelViewMatrix:{value:new j0},normalMatrix:{value:new h0}}),this.matrix=new j0,this.matrixWorld=new j0,this.matrixAutoUpdate=HJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=HJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new LQ,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(J){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(J),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(J){return this.quaternion.premultiply(J),this}setRotationFromAxisAngle(J,Q){this.quaternion.setFromAxisAngle(J,Q)}setRotationFromEuler(J){this.quaternion.setFromEuler(J,!0)}setRotationFromMatrix(J){this.quaternion.setFromRotationMatrix(J)}setRotationFromQuaternion(J){this.quaternion.copy(J)}rotateOnAxis(J,Q){return i8.setFromAxisAngle(J,Q),this.quaternion.multiply(i8),this}rotateOnWorldAxis(J,Q){return i8.setFromAxisAngle(J,Q),this.quaternion.premultiply(i8),this}rotateX(J){return this.rotateOnAxis(uW,J)}rotateY(J){return this.rotateOnAxis(dW,J)}rotateZ(J){return this.rotateOnAxis(mW,J)}translateOnAxis(J,Q){return pW.copy(J).applyQuaternion(this.quaternion),this.position.add(pW.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(uW,J)}translateY(J){return this.translateOnAxis(dW,J)}translateZ(J){return this.translateOnAxis(mW,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(g9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)T7.copy(J);else T7.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),x6.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)g9.lookAt(x6,T7,this.up);else g9.lookAt(T7,x6,this.up);if(this.quaternion.setFromRotationMatrix(g9),Z)g9.extractRotation(Z.matrixWorld),i8.setFromRotationMatrix(g9),this.quaternion.premultiply(i8.invert())}add(J){if(arguments.length>1){for(let Q=0;Q<arguments.length;Q++)this.add(arguments[Q]);return this}if(J===this)return S0("Object3D.add: object can't be added as a child of itself.",J),this;if(J&&J.isObject3D)J.removeFromParent(),J.parent=this,this.children.push(J),J.dispatchEvent(lW),o8.child=J,this.dispatchEvent(o8),o8.child=null;else S0("Object3D.add: object not an instance of THREE.Object3D.",J);return this}remove(J){if(arguments.length>1){for(let $=0;$<arguments.length;$++)this.remove(arguments[$]);return this}let Q=this.children.indexOf(J);if(Q!==-1)J.parent=null,this.children.splice(Q,1),J.dispatchEvent(JU),Z$.child=J,this.dispatchEvent(Z$),Z$.child=null;return this}removeFromParent(){let J=this.parent;if(J!==null)J.remove(this);return this}clear(){return this.remove(...this.children)}attach(J){if(this.updateWorldMatrix(!0,!1),g9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),g9.multiply(J.parent.matrixWorld);return J.applyMatrix4(g9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(lW),o8.child=J,this.dispatchEvent(o8),o8.child=null,this}getObjectById(J){return this.getObjectByProperty("id",J)}getObjectByName(J){return this.getObjectByProperty("name",J)}getObjectByProperty(J,Q){if(this[J]===Q)return this;for(let $=0,Z=this.children.length;$<Z;$++){let Y=this.children[$].getObjectByProperty(J,Q);if(Y!==void 0)return Y}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].getObjectsByProperty(J,Q,$);return $}getWorldPosition(J){return this.updateWorldMatrix(!0,!1),J.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(x6,J,tH),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(x6,eH,J),J}getWorldDirection(J){this.updateWorldMatrix(!0,!1);let Q=this.matrixWorld.elements;return J.set(Q[8],Q[9],Q[10]).normalize()}raycast(){}traverse(J){J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverse(J)}traverseVisible(J){if(this.visible===!1)return;J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverseVisible(J)}traverseAncestors(J){let Q=this.parent;if(Q!==null)J(Q),Q.traverseAncestors(J)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let J=this.pivot;if(J!==null){let{x:Q,y:$,z:Z}=J,W=this.matrix.elements;W[12]+=Q-W[0]*Q-W[4]*$-W[8]*Z,W[13]+=$-W[1]*Q-W[5]*$-W[9]*Z,W[14]+=Z-W[2]*Q-W[6]*$-W[10]*Z}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(J){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||J){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,J=!0}let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].updateMatrixWorld(J)}updateWorldMatrix(J,Q){let $=this.parent;if(J===!0&&$!==null)$.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);if(Q===!0){let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].updateWorldMatrix(!1,!0)}}toJSON(J){let Q=J===void 0||typeof J==="string",$={};if(Q)J={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},$.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let Z={};if(Z.uuid=this.uuid,Z.type=this.type,this.name!=="")Z.name=this.name;if(this.castShadow===!0)Z.castShadow=!0;if(this.receiveShadow===!0)Z.receiveShadow=!0;if(this.visible===!1)Z.visible=!1;if(this.frustumCulled===!1)Z.frustumCulled=!1;if(this.renderOrder!==0)Z.renderOrder=this.renderOrder;if(this.static!==!1)Z.static=this.static;if(Object.keys(this.userData).length>0)Z.userData=this.userData;if(Z.layers=this.layers.mask,Z.matrix=this.matrix.toArray(),Z.up=this.up.toArray(),this.pivot!==null)Z.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)Z.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)Z.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)Z.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(Z.type="InstancedMesh",Z.count=this.count,Z.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)Z.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(Z.type="BatchedMesh",Z.perObjectFrustumCulled=this.perObjectFrustumCulled,Z.sortObjects=this.sortObjects,Z.drawRanges=this._drawRanges,Z.reservedRanges=this._reservedRanges,Z.geometryInfo=this._geometryInfo.map((X)=>({...X,boundingBox:X.boundingBox?X.boundingBox.toJSON():void 0,boundingSphere:X.boundingSphere?X.boundingSphere.toJSON():void 0})),Z.instanceInfo=this._instanceInfo.map((X)=>({...X})),Z.availableInstanceIds=this._availableInstanceIds.slice(),Z.availableGeometryIds=this._availableGeometryIds.slice(),Z.nextIndexStart=this._nextIndexStart,Z.nextVertexStart=this._nextVertexStart,Z.geometryCount=this._geometryCount,Z.maxInstanceCount=this._maxInstanceCount,Z.maxVertexCount=this._maxVertexCount,Z.maxIndexCount=this._maxIndexCount,Z.geometryInitialized=this._geometryInitialized,Z.matricesTexture=this._matricesTexture.toJSON(J),Z.indirectTexture=this._indirectTexture.toJSON(J),this._colorsTexture!==null)Z.colorsTexture=this._colorsTexture.toJSON(J);if(this.boundingSphere!==null)Z.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)Z.boundingBox=this.boundingBox.toJSON()}function W(X,K){if(X[K.uuid]===void 0)X[K.uuid]=K.toJSON(J);return K.uuid}if(this.isScene){if(this.background){if(this.background.isColor)Z.background=this.background.toJSON();else if(this.background.isTexture)Z.background=this.background.toJSON(J).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)Z.environment=this.environment.toJSON(J).uuid}else if(this.isMesh||this.isLine||this.isPoints){Z.geometry=W(J.geometries,this.geometry);let X=this.geometry.parameters;if(X!==void 0&&X.shapes!==void 0){let K=X.shapes;if(Array.isArray(K))for(let H=0,U=K.length;H<U;H++){let G=K[H];W(J.shapes,G)}else W(J.shapes,K)}}if(this.isSkinnedMesh){if(Z.bindMode=this.bindMode,Z.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)W(J.skeletons,this.skeleton),Z.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let X=[];for(let K=0,H=this.material.length;K<H;K++)X.push(W(J.materials,this.material[K]));Z.material=X}else Z.material=W(J.materials,this.material);if(this.children.length>0){Z.children=[];for(let X=0;X<this.children.length;X++)Z.children.push(this.children[X].toJSON(J).object)}if(this.animations.length>0){Z.animations=[];for(let X=0;X<this.animations.length;X++){let K=this.animations[X];Z.animations.push(W(J.animations,K))}}if(Q){let X=Y(J.geometries),K=Y(J.materials),H=Y(J.textures),U=Y(J.images),G=Y(J.shapes),F=Y(J.skeletons),E=Y(J.animations),O=Y(J.nodes);if(X.length>0)$.geometries=X;if(K.length>0)$.materials=K;if(H.length>0)$.textures=H;if(U.length>0)$.images=U;if(G.length>0)$.shapes=G;if(F.length>0)$.skeletons=F;if(E.length>0)$.animations=E;if(O.length>0)$.nodes=O}return $.object=Z,$;function Y(X){let K=[];for(let H in X){let U=X[H];delete U.metadata,K.push(U)}return K}}clone(J){return new this.constructor().copy(this,J)}copy(J,Q=!0){if(this.name=J.name,this.up.copy(J.up),this.position.copy(J.position),this.rotation.order=J.rotation.order,this.quaternion.copy(J.quaternion),this.scale.copy(J.scale),this.pivot=J.pivot!==null?J.pivot.clone():null,this.matrix.copy(J.matrix),this.matrixWorld.copy(J.matrixWorld),this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrixWorldAutoUpdate=J.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=J.matrixWorldNeedsUpdate,this.layers.mask=J.layers.mask,this.visible=J.visible,this.castShadow=J.castShadow,this.receiveShadow=J.receiveShadow,this.frustumCulled=J.frustumCulled,this.renderOrder=J.renderOrder,this.static=J.static,this.animations=J.animations.slice(),this.userData=JSON.parse(JSON.stringify(J.userData)),Q===!0)for(let $=0;$<J.children.length;$++){let Z=J.children[$];this.add(Z.clone())}return this}}HJ.DEFAULT_UP=new S(0,1,0);HJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;HJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class K9 extends HJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var QU={type:"move"};class Z7{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new K9,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new K9,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new S,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new S;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new K9,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new S,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new S,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(J){if(this._targetRay!==null)this._targetRay.dispatchEvent(J);if(this._grip!==null)this._grip.dispatchEvent(J);if(this._hand!==null)this._hand.dispatchEvent(J);return this}connect(J){if(J&&J.hand){let Q=this._hand;if(Q)for(let $ of J.hand.values())this._getHandJoint(Q,$)}return this.dispatchEvent({type:"connected",data:J}),this}disconnect(J){if(this.dispatchEvent({type:"disconnected",data:J}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(J,Q,$){let Z=null,W=null,Y=null,X=this._targetRay,K=this._grip,H=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(H&&J.hand){Y=!0;for(let R of J.hand.values()){let C=Q.getJointPose(R,$),q=this._getHandJoint(H,R);if(C!==null)q.matrix.fromArray(C.transform.matrix),q.matrix.decompose(q.position,q.rotation,q.scale),q.matrixWorldNeedsUpdate=!0,q.jointRadius=C.radius;q.visible=C!==null}let U=H.joints["index-finger-tip"],G=H.joints["thumb-tip"],F=U.position.distanceTo(G.position),E=0.02,O=0.005;if(H.inputState.pinching&&F>E+O)H.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!H.inputState.pinching&&F<=E-O)H.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(K!==null&&J.gripSpace){if(W=Q.getPose(J.gripSpace,$),W!==null){if(K.matrix.fromArray(W.transform.matrix),K.matrix.decompose(K.position,K.rotation,K.scale),K.matrixWorldNeedsUpdate=!0,W.linearVelocity)K.hasLinearVelocity=!0,K.linearVelocity.copy(W.linearVelocity);else K.hasLinearVelocity=!1;if(W.angularVelocity)K.hasAngularVelocity=!0,K.angularVelocity.copy(W.angularVelocity);else K.hasAngularVelocity=!1;if(K.eventsEnabled)K.dispatchEvent({type:"gripUpdated",data:J,target:this})}}if(X!==null){if(Z=Q.getPose(J.targetRaySpace,$),Z===null&&W!==null)Z=W;if(Z!==null){if(X.matrix.fromArray(Z.transform.matrix),X.matrix.decompose(X.position,X.rotation,X.scale),X.matrixWorldNeedsUpdate=!0,Z.linearVelocity)X.hasLinearVelocity=!0,X.linearVelocity.copy(Z.linearVelocity);else X.hasLinearVelocity=!1;if(Z.angularVelocity)X.hasAngularVelocity=!0,X.angularVelocity.copy(Z.angularVelocity);else X.hasAngularVelocity=!1;this.dispatchEvent(QU)}}}if(X!==null)X.visible=Z!==null;if(K!==null)K.visible=W!==null;if(H!==null)H.visible=Y!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new K9;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var qX={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},W8={h:0,s:0,l:0},A7={h:0,s:0,l:0};function W$(J,Q,$){if($<0)$+=1;if($>1)$-=1;if($<0.16666666666666666)return J+(Q-J)*6*$;if($<0.5)return Q;if($<0.6666666666666666)return J+(Q-J)*6*(0.6666666666666666-$);return J}class X0{constructor(J,Q,$){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(J,Q,$)}set(J,Q,$){if(Q===void 0&&$===void 0){let Z=J;if(Z&&Z.isColor)this.copy(Z);else if(typeof Z==="number")this.setHex(Z);else if(typeof Z==="string")this.setStyle(Z)}else this.setRGB(J,Q,$);return this}setScalar(J){return this.r=J,this.g=J,this.b=J,this}setHex(J,Q="srgb"){return J=Math.floor(J),this.r=(J>>16&255)/255,this.g=(J>>8&255)/255,this.b=(J&255)/255,u0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=u0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,u0.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=u0.workingColorSpace){if(J=VZ(J,1),Q=l0(Q,0,1),$=l0($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,Y=2*$-W;this.r=W$(Y,W,J+0.3333333333333333),this.g=W$(Y,W,J),this.b=W$(Y,W,J-0.3333333333333333)}return u0.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)C0("Color: Alpha component of "+J+" will be ignored.")}let Z;if(Z=/^(\w+)\(([^\)]*)\)/.exec(J)){let W,Y=Z[1],X=Z[2];switch(Y){case"rgb":case"rgba":if(W=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(255,parseInt(W[1],10))/255,Math.min(255,parseInt(W[2],10))/255,Math.min(255,parseInt(W[3],10))/255,Q);if(W=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(100,parseInt(W[1],10))/100,Math.min(100,parseInt(W[2],10))/100,Math.min(100,parseInt(W[3],10))/100,Q);break;case"hsl":case"hsla":if(W=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setHSL(parseFloat(W[1])/360,parseFloat(W[2])/100,parseFloat(W[3])/100,Q);break;default:C0("Color: Unknown color model "+J)}}else if(Z=/^\#([A-Fa-f\d]+)$/.exec(J)){let W=Z[1],Y=W.length;if(Y===3)return this.setRGB(parseInt(W.charAt(0),16)/15,parseInt(W.charAt(1),16)/15,parseInt(W.charAt(2),16)/15,Q);else if(Y===6)return this.setHex(parseInt(W,16),Q);else C0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=qX[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else C0("Color: Unknown color "+J);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(J){return this.r=J.r,this.g=J.g,this.b=J.b,this}copySRGBToLinear(J){return this.r=n9(J.r),this.g=n9(J.g),this.b=n9(J.b),this}copyLinearToSRGB(J){return this.r=X6(J.r),this.g=X6(J.g),this.b=X6(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return u0.workingToColorSpace(gJ.copy(this),J),Math.round(l0(gJ.r*255,0,255))*65536+Math.round(l0(gJ.g*255,0,255))*256+Math.round(l0(gJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=u0.workingColorSpace){u0.workingToColorSpace(gJ.copy(this),Q);let{r:$,g:Z,b:W}=gJ,Y=Math.max($,Z,W),X=Math.min($,Z,W),K,H,U=(X+Y)/2;if(X===Y)K=0,H=0;else{let G=Y-X;switch(H=U<=0.5?G/(Y+X):G/(2-Y-X),Y){case $:K=(Z-W)/G+(Z<W?6:0);break;case Z:K=(W-$)/G+2;break;case W:K=($-Z)/G+4;break}K/=6}return J.h=K,J.s=H,J.l=U,J}getRGB(J,Q=u0.workingColorSpace){return u0.workingToColorSpace(gJ.copy(this),Q),J.r=gJ.r,J.g=gJ.g,J.b=gJ.b,J}getStyle(J="srgb"){u0.workingToColorSpace(gJ.copy(this),J);let{r:Q,g:$,b:Z}=gJ;if(J!=="srgb")return`color(${J} ${Q.toFixed(3)} ${$.toFixed(3)} ${Z.toFixed(3)})`;return`rgb(${Math.round(Q*255)},${Math.round($*255)},${Math.round(Z*255)})`}offsetHSL(J,Q,$){return this.getHSL(W8),this.setHSL(W8.h+J,W8.s+Q,W8.l+$)}add(J){return this.r+=J.r,this.g+=J.g,this.b+=J.b,this}addColors(J,Q){return this.r=J.r+Q.r,this.g=J.g+Q.g,this.b=J.b+Q.b,this}addScalar(J){return this.r+=J,this.g+=J,this.b+=J,this}sub(J){return this.r=Math.max(0,this.r-J.r),this.g=Math.max(0,this.g-J.g),this.b=Math.max(0,this.b-J.b),this}multiply(J){return this.r*=J.r,this.g*=J.g,this.b*=J.b,this}multiplyScalar(J){return this.r*=J,this.g*=J,this.b*=J,this}lerp(J,Q){return this.r+=(J.r-this.r)*Q,this.g+=(J.g-this.g)*Q,this.b+=(J.b-this.b)*Q,this}lerpColors(J,Q,$){return this.r=J.r+(Q.r-J.r)*$,this.g=J.g+(Q.g-J.g)*$,this.b=J.b+(Q.b-J.b)*$,this}lerpHSL(J,Q){this.getHSL(W8),J.getHSL(A7);let $=l6(W8.h,A7.h,Q),Z=l6(W8.s,A7.s,Q),W=l6(W8.l,A7.l,Q);return this.setHSL($,Z,W),this}setFromVector3(J){return this.r=J.x,this.g=J.y,this.b=J.z,this}applyMatrix3(J){let Q=this.r,$=this.g,Z=this.b,W=J.elements;return this.r=W[0]*Q+W[3]*$+W[6]*Z,this.g=W[1]*Q+W[4]*$+W[7]*Z,this.b=W[2]*Q+W[5]*$+W[8]*Z,this}equals(J){return J.r===this.r&&J.g===this.g&&J.b===this.b}fromArray(J,Q=0){return this.r=J[Q],this.g=J[Q+1],this.b=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.r,J[Q+1]=this.g,J[Q+2]=this.b,J}fromBufferAttribute(J,Q){return this.r=J.getX(Q),this.g=J.getY(Q),this.b=J.getZ(Q),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var gJ=new X0;X0.NAMES=qX;class k6 extends HJ{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new T9,this.environmentIntensity=1,this.environmentRotation=new T9,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(J,Q){if(super.copy(J,Q),J.background!==null)this.background=J.background.clone();if(J.environment!==null)this.environment=J.environment.clone();if(J.fog!==null)this.fog=J.fog.clone();if(this.backgroundBlurriness=J.backgroundBlurriness,this.backgroundIntensity=J.backgroundIntensity,this.backgroundRotation.copy(J.backgroundRotation),this.environmentIntensity=J.environmentIntensity,this.environmentRotation.copy(J.environmentRotation),J.overrideMaterial!==null)this.overrideMaterial=J.overrideMaterial.clone();return this.matrixAutoUpdate=J.matrixAutoUpdate,this}toJSON(J){let Q=super.toJSON(J);if(this.fog!==null)Q.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)Q.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)Q.object.backgroundIntensity=this.backgroundIntensity;if(Q.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)Q.object.environmentIntensity=this.environmentIntensity;return Q.object.environmentRotation=this.environmentRotation.toArray(),Q}}var R9=new S,p9=new S,Y$=new S,u9=new S,a8=new S,r8=new S,cW=new S,X$=new S,K$=new S,H$=new S,U$=new $J,G$=new $J,E$=new $J;class X9{constructor(J=new S,Q=new S,$=new S){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,Z){Z.subVectors($,Q),R9.subVectors(J,Q),Z.cross(R9);let W=Z.lengthSq();if(W>0)return Z.multiplyScalar(1/Math.sqrt(W));return Z.set(0,0,0)}static getBarycoord(J,Q,$,Z,W){R9.subVectors(Z,Q),p9.subVectors($,Q),Y$.subVectors(J,Q);let Y=R9.dot(R9),X=R9.dot(p9),K=R9.dot(Y$),H=p9.dot(p9),U=p9.dot(Y$),G=Y*H-X*X;if(G===0)return W.set(0,0,0),null;let F=1/G,E=(H*K-X*U)*F,O=(Y*U-X*K)*F;return W.set(1-E-O,O,E)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,u9)===null)return!1;return u9.x>=0&&u9.y>=0&&u9.x+u9.y<=1}static getInterpolation(J,Q,$,Z,W,Y,X,K){if(this.getBarycoord(J,Q,$,Z,u9)===null){if(K.x=0,K.y=0,"z"in K)K.z=0;if("w"in K)K.w=0;return null}return K.setScalar(0),K.addScaledVector(W,u9.x),K.addScaledVector(Y,u9.y),K.addScaledVector(X,u9.z),K}static getInterpolatedAttribute(J,Q,$,Z,W,Y){return U$.setScalar(0),G$.setScalar(0),E$.setScalar(0),U$.fromBufferAttribute(J,Q),G$.fromBufferAttribute(J,$),E$.fromBufferAttribute(J,Z),Y.setScalar(0),Y.addScaledVector(U$,W.x),Y.addScaledVector(G$,W.y),Y.addScaledVector(E$,W.z),Y}static isFrontFacing(J,Q,$,Z){return R9.subVectors($,Q),p9.subVectors(J,Q),R9.cross(p9).dot(Z)<0}set(J,Q,$){return this.a.copy(J),this.b.copy(Q),this.c.copy($),this}setFromPointsAndIndices(J,Q,$,Z){return this.a.copy(J[Q]),this.b.copy(J[$]),this.c.copy(J[Z]),this}setFromAttributeAndIndices(J,Q,$,Z){return this.a.fromBufferAttribute(J,Q),this.b.fromBufferAttribute(J,$),this.c.fromBufferAttribute(J,Z),this}clone(){return new this.constructor().copy(this)}copy(J){return this.a.copy(J.a),this.b.copy(J.b),this.c.copy(J.c),this}getArea(){return R9.subVectors(this.c,this.b),p9.subVectors(this.a,this.b),R9.cross(p9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return X9.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return X9.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return X9.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return X9.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return X9.isFrontFacing(this.a,this.b,this.c,J)}intersectsBox(J){return J.intersectsTriangle(this)}closestPointToPoint(J,Q){let $=this.a,Z=this.b,W=this.c,Y,X;a8.subVectors(Z,$),r8.subVectors(W,$),X$.subVectors(J,$);let K=a8.dot(X$),H=r8.dot(X$);if(K<=0&&H<=0)return Q.copy($);K$.subVectors(J,Z);let U=a8.dot(K$),G=r8.dot(K$);if(U>=0&&G<=U)return Q.copy(Z);let F=K*G-U*H;if(F<=0&&K>=0&&U<=0)return Y=K/(K-U),Q.copy($).addScaledVector(a8,Y);H$.subVectors(J,W);let E=a8.dot(H$),O=r8.dot(H$);if(O>=0&&E<=O)return Q.copy(W);let R=E*H-K*O;if(R<=0&&H>=0&&O<=0)return X=H/(H-O),Q.copy($).addScaledVector(r8,X);let C=U*O-E*G;if(C<=0&&G-U>=0&&E-O>=0)return cW.subVectors(W,Z),X=(G-U)/(G-U+(E-O)),Q.copy(Z).addScaledVector(cW,X);let q=1/(C+R+F);return Y=R*q,X=F*q,Q.copy($).addScaledVector(a8,Y).addScaledVector(r8,X)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class iJ{constructor(J=new S(1/0,1/0,1/0),Q=new S(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromArray(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q+=3)this.expandByPoint(L9.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(L9.fromBufferAttribute(J,Q));return this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=L9.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}setFromObject(J,Q=!1){return this.makeEmpty(),this.expandByObject(J,Q)}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){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(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(J){return this.isEmpty()?J.set(0,0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}expandByObject(J,Q=!1){J.updateWorldMatrix(!1,!1);let $=J.geometry;if($!==void 0){let W=$.getAttribute("position");if(Q===!0&&W!==void 0&&J.isInstancedMesh!==!0)for(let Y=0,X=W.count;Y<X;Y++){if(J.isMesh===!0)J.getVertexPosition(Y,L9);else L9.fromBufferAttribute(W,Y);L9.applyMatrix4(J.matrixWorld),this.expandByPoint(L9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();S7.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();S7.copy($.boundingBox)}S7.applyMatrix4(J.matrixWorld),this.union(S7)}}let Z=J.children;for(let W=0,Y=Z.length;W<Y;W++)this.expandByObject(Z[W],Q);return this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y&&J.z>=this.min.z&&J.z<=this.max.z}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y&&this.min.z<=J.min.z&&J.max.z<=this.max.z}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y),(J.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y&&J.max.z>=this.min.z&&J.min.z<=this.max.z}intersectsSphere(J){return this.clampPoint(J.center,L9),L9.distanceToSquared(J.center)<=J.radius*J.radius}intersectsPlane(J){let Q,$;if(J.normal.x>0)Q=J.normal.x*this.min.x,$=J.normal.x*this.max.x;else Q=J.normal.x*this.max.x,$=J.normal.x*this.min.x;if(J.normal.y>0)Q+=J.normal.y*this.min.y,$+=J.normal.y*this.max.y;else Q+=J.normal.y*this.max.y,$+=J.normal.y*this.min.y;if(J.normal.z>0)Q+=J.normal.z*this.min.z,$+=J.normal.z*this.max.z;else Q+=J.normal.z*this.max.z,$+=J.normal.z*this.min.z;return Q<=-J.constant&&$>=-J.constant}intersectsTriangle(J){if(this.isEmpty())return!1;this.getCenter(b6),j7.subVectors(this.max,b6),t8.subVectors(J.a,b6),e8.subVectors(J.b,b6),J6.subVectors(J.c,b6),Y8.subVectors(e8,t8),X8.subVectors(J6,e8),V8.subVectors(t8,J6);let Q=[0,-Y8.z,Y8.y,0,-X8.z,X8.y,0,-V8.z,V8.y,Y8.z,0,-Y8.x,X8.z,0,-X8.x,V8.z,0,-V8.x,-Y8.y,Y8.x,0,-X8.y,X8.x,0,-V8.y,V8.x,0];if(!F$(Q,t8,e8,J6,j7))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!F$(Q,t8,e8,J6,j7))return!1;return v7.crossVectors(Y8,X8),Q=[v7.x,v7.y,v7.z],F$(Q,t8,e8,J6,j7)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,L9).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(L9).length()*0.5;return J}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}applyMatrix4(J){if(this.isEmpty())return this;return d9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),d9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),d9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),d9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),d9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),d9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),d9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),d9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(d9),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(J){return this.min.fromArray(J.min),this.max.fromArray(J.max),this}}var d9=[new S,new S,new S,new S,new S,new S,new S,new S],L9=new S,S7=new iJ,t8=new S,e8=new S,J6=new S,Y8=new S,X8=new S,V8=new S,b6=new S,j7=new S,v7=new S,B8=new S;function F$(J,Q,$,Z,W){for(let Y=0,X=J.length-3;Y<=X;Y+=3){B8.fromArray(J,Y);let K=W.x*Math.abs(B8.x)+W.y*Math.abs(B8.y)+W.z*Math.abs(B8.z),H=Q.dot(B8),U=$.dot(B8),G=Z.dot(B8);if(Math.max(-Math.max(H,U,G),Math.min(H,U,G))>K)return!1}return!0}var c9=$U();function $U(){let J=new ArrayBuffer(4),Q=new Float32Array(J),$=new Uint32Array(J),Z=new Uint32Array(512),W=new Uint32Array(512);for(let H=0;H<256;++H){let U=H-127;if(U<-27)Z[H]=0,Z[H|256]=32768,W[H]=24,W[H|256]=24;else if(U<-14)Z[H]=1024>>-U-14,Z[H|256]=1024>>-U-14|32768,W[H]=-U-1,W[H|256]=-U-1;else if(U<=15)Z[H]=U+15<<10,Z[H|256]=U+15<<10|32768,W[H]=13,W[H|256]=13;else if(U<128)Z[H]=31744,Z[H|256]=64512,W[H]=24,W[H|256]=24;else Z[H]=31744,Z[H|256]=64512,W[H]=13,W[H|256]=13}let Y=new Uint32Array(2048),X=new Uint32Array(64),K=new Uint32Array(64);for(let H=1;H<1024;++H){let U=H<<13,G=0;while((U&8388608)===0)U<<=1,G-=8388608;U&=-8388609,G+=947912704,Y[H]=U|G}for(let H=1024;H<2048;++H)Y[H]=939524096+(H-1024<<13);for(let H=1;H<31;++H)X[H]=H<<23;X[31]=1199570944,X[32]=2147483648;for(let H=33;H<63;++H)X[H]=2147483648+(H-32<<23);X[63]=3347054592;for(let H=1;H<64;++H)if(H!==32)K[H]=1024;return{floatView:Q,uint32View:$,baseTable:Z,shiftTable:W,mantissaTable:Y,exponentTable:X,offsetTable:K}}function ZU(J){if(Math.abs(J)>65504)C0("DataUtils.toHalfFloat(): Value out of range.");J=l0(J,-65504,65504),c9.floatView[0]=J;let Q=c9.uint32View[0],$=Q>>23&511;return c9.baseTable[$]+((Q&8388607)>>c9.shiftTable[$])}function WU(J){let Q=J>>10;return c9.uint32View[0]=c9.mantissaTable[c9.offsetTable[Q]+(J&1023)]+c9.exponentTable[Q],c9.floatView[0]}class b8{static toHalfFloat(J){return ZU(J)}static fromHalfFloat(J){return WU(J)}}var wJ=new S,y7=new T0,YU=0;class QJ extends v9{constructor(J,Q,$=!1){super();if(Array.isArray(J))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:YU++}),this.name="",this.array=J,this.itemSize=Q,this.count=J!==void 0?J.length/Q:0,this.normalized=$,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.name=J.name,this.array=new J.array.constructor(J.array),this.itemSize=J.itemSize,this.count=J.count,this.normalized=J.normalized,this.usage=J.usage,this.gpuType=J.gpuType,this}copyAt(J,Q,$){J*=this.itemSize,$*=Q.itemSize;for(let Z=0,W=this.itemSize;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}copyArray(J){return this.array.set(J),this}applyMatrix3(J){if(this.itemSize===2)for(let Q=0,$=this.count;Q<$;Q++)y7.fromBufferAttribute(this,Q),y7.applyMatrix3(J),this.setXY(Q,y7.x,y7.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)wJ.fromBufferAttribute(this,Q),wJ.applyMatrix3(J),this.setXYZ(Q,wJ.x,wJ.y,wJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)wJ.fromBufferAttribute(this,Q),wJ.applyMatrix4(J),this.setXYZ(Q,wJ.x,wJ.y,wJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)wJ.fromBufferAttribute(this,Q),wJ.applyNormalMatrix(J),this.setXYZ(Q,wJ.x,wJ.y,wJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)wJ.fromBufferAttribute(this,Q),wJ.transformDirection(J),this.setXYZ(Q,wJ.x,wJ.y,wJ.z);return this}set(J,Q=0){return this.array.set(J,Q),this}getComponent(J,Q){let $=this.array[J*this.itemSize+Q];if(this.normalized)$=k9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=ZJ($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=k9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.array[J*this.itemSize]=Q,this}getY(J){let Q=this.array[J*this.itemSize+1];if(this.normalized)Q=k9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.array[J*this.itemSize+1]=Q,this}getZ(J){let Q=this.array[J*this.itemSize+2];if(this.normalized)Q=k9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.array[J*this.itemSize+2]=Q,this}getW(J){let Q=this.array[J*this.itemSize+3];if(this.normalized)Q=k9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=ZJ(Q,this.array),$=ZJ($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=ZJ(Q,this.array),$=ZJ($,this.array),Z=ZJ(Z,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=ZJ(Q,this.array),$=ZJ($,this.array),Z=ZJ(Z,this.array),W=ZJ(W,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this.array[J+3]=W,this}onUpload(J){return this.onUploadCallback=J,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let J={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")J.name=this.name;if(this.usage!==35044)J.usage=this.usage;return J}dispose(){this.dispatchEvent({type:"dispose"})}}class DQ extends QJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class kQ extends QJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class WJ extends QJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var XU=new iJ,h6=new S,N$=new S;class lJ{constructor(J=new S,Q=-1){this.isSphere=!0,this.center=J,this.radius=Q}set(J,Q){return this.center.copy(J),this.radius=Q,this}setFromPoints(J,Q){let $=this.center;if(Q!==void 0)$.copy(Q);else XU.setFromPoints(J).getCenter($);let Z=0;for(let W=0,Y=J.length;W<Y;W++)Z=Math.max(Z,$.distanceToSquared(J[W]));return this.radius=Math.sqrt(Z),this}copy(J){return this.center.copy(J.center),this.radius=J.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(J){return J.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(J){return J.distanceTo(this.center)-this.radius}intersectsSphere(J){let Q=this.radius+J.radius;return J.center.distanceToSquared(this.center)<=Q*Q}intersectsBox(J){return J.intersectsSphere(this)}intersectsPlane(J){return Math.abs(J.distanceToPoint(this.center))<=this.radius}clampPoint(J,Q){let $=this.center.distanceToSquared(J);if(Q.copy(J),$>this.radius*this.radius)Q.sub(this.center).normalize(),Q.multiplyScalar(this.radius).add(this.center);return Q}getBoundingBox(J){if(this.isEmpty())return J.makeEmpty(),J;return J.set(this.center,this.center),J.expandByScalar(this.radius),J}applyMatrix4(J){return this.center.applyMatrix4(J),this.radius=this.radius*J.getMaxScaleOnAxis(),this}translate(J){return this.center.add(J),this}expandByPoint(J){if(this.isEmpty())return this.center.copy(J),this.radius=0,this;h6.subVectors(J,this.center);let Q=h6.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(h6,Z/$),this.radius+=Z}return this}union(J){if(J.isEmpty())return this;if(this.isEmpty())return this.copy(J),this;if(this.center.equals(J.center)===!0)this.radius=Math.max(this.radius,J.radius);else N$.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(h6.copy(J.center).add(N$)),this.expandByPoint(h6.copy(J.center).sub(N$));return this}equals(J){return J.center.equals(this.center)&&J.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(J){return this.radius=J.radius,this.center.fromArray(J.center),this}}var KU=0,Y9=new j0,O$=new HJ,Q6=new S,J9=new iJ,f6=new iJ,vJ=new S;class qJ extends v9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:KU++}),this.uuid=M9(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(J){if(Array.isArray(J))this.index=new((PH(J))?kQ:DQ)(J,1);else this.index=J;return this}setIndirect(J,Q=0){return this.indirect=J,this.indirectOffset=Q,this}getIndirect(){return this.indirect}getAttribute(J){return this.attributes[J]}setAttribute(J,Q){return this.attributes[J]=Q,this}deleteAttribute(J){return delete this.attributes[J],this}hasAttribute(J){return this.attributes[J]!==void 0}addGroup(J,Q,$=0){this.groups.push({start:J,count:Q,materialIndex:$})}clearGroups(){this.groups=[]}setDrawRange(J,Q){this.drawRange.start=J,this.drawRange.count=Q}applyMatrix4(J){let Q=this.attributes.position;if(Q!==void 0)Q.applyMatrix4(J),Q.needsUpdate=!0;let $=this.attributes.normal;if($!==void 0){let W=new h0().getNormalMatrix(J);$.applyNormalMatrix(W),$.needsUpdate=!0}let Z=this.attributes.tangent;if(Z!==void 0)Z.transformDirection(J),Z.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this}applyQuaternion(J){return Y9.makeRotationFromQuaternion(J),this.applyMatrix4(Y9),this}rotateX(J){return Y9.makeRotationX(J),this.applyMatrix4(Y9),this}rotateY(J){return Y9.makeRotationY(J),this.applyMatrix4(Y9),this}rotateZ(J){return Y9.makeRotationZ(J),this.applyMatrix4(Y9),this}translate(J,Q,$){return Y9.makeTranslation(J,Q,$),this.applyMatrix4(Y9),this}scale(J,Q,$){return Y9.makeScale(J,Q,$),this.applyMatrix4(Y9),this}lookAt(J){return O$.lookAt(J),O$.updateMatrix(),this.applyMatrix4(O$.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Q6).negate(),this.translate(Q6.x,Q6.y,Q6.z),this}setFromPoints(J){let Q=this.getAttribute("position");if(Q===void 0){let $=[];for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];$.push(Y.x,Y.y,Y.z||0)}this.setAttribute("position",new WJ($,3))}else{let $=Math.min(J.length,Q.count);for(let Z=0;Z<$;Z++){let W=J[Z];Q.setXYZ(Z,W.x,W.y,W.z||0)}if(J.length>Q.count)C0("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");Q.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new iJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){S0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new S(-1/0,-1/0,-1/0),new S(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(J9.setFromBufferAttribute(W),this.morphTargetsRelative)vJ.addVectors(this.boundingBox.min,J9.min),this.boundingBox.expandByPoint(vJ),vJ.addVectors(this.boundingBox.max,J9.max),this.boundingBox.expandByPoint(vJ);else this.boundingBox.expandByPoint(J9.min),this.boundingBox.expandByPoint(J9.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))S0('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new lJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){S0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new S,1/0);return}if(J){let $=this.boundingSphere.center;if(J9.setFromBufferAttribute(J),Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W];if(f6.setFromBufferAttribute(X),this.morphTargetsRelative)vJ.addVectors(J9.min,f6.min),J9.expandByPoint(vJ),vJ.addVectors(J9.max,f6.max),J9.expandByPoint(vJ);else J9.expandByPoint(f6.min),J9.expandByPoint(f6.max)}J9.getCenter($);let Z=0;for(let W=0,Y=J.count;W<Y;W++)vJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(vJ));if(Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W],K=this.morphTargetsRelative;for(let H=0,U=X.count;H<U;H++){if(vJ.fromBufferAttribute(X,H),K)Q6.fromBufferAttribute(J,H),vJ.add(Q6);Z=Math.max(Z,$.distanceToSquared(vJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))S0('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let J=this.index,Q=this.attributes;if(J===null||Q.position===void 0||Q.normal===void 0||Q.uv===void 0){S0("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:$,normal:Z,uv:W}=Q;if(this.hasAttribute("tangent")===!1)this.setAttribute("tangent",new QJ(new Float32Array(4*$.count),4));let Y=this.getAttribute("tangent"),X=[],K=[];for(let B=0;B<$.count;B++)X[B]=new S,K[B]=new S;let H=new S,U=new S,G=new S,F=new T0,E=new T0,O=new T0,R=new S,C=new S;function q(B,D,V){H.fromBufferAttribute($,B),U.fromBufferAttribute($,D),G.fromBufferAttribute($,V),F.fromBufferAttribute(W,B),E.fromBufferAttribute(W,D),O.fromBufferAttribute(W,V),U.sub(H),G.sub(H),E.sub(F),O.sub(F);let j=1/(E.x*O.y-O.x*E.y);if(!isFinite(j))return;R.copy(U).multiplyScalar(O.y).addScaledVector(G,-E.y).multiplyScalar(j),C.copy(G).multiplyScalar(E.x).addScaledVector(U,-O.x).multiplyScalar(j),X[B].add(R),X[D].add(R),X[V].add(R),K[B].add(C),K[D].add(C),K[V].add(C)}let N=this.groups;if(N.length===0)N=[{start:0,count:J.count}];for(let B=0,D=N.length;B<D;++B){let V=N[B],j=V.start,z=V.count;for(let v=j,y=j+z;v<y;v+=3)q(J.getX(v+0),J.getX(v+1),J.getX(v+2))}let L=new S,k=new S,M=new S,P=new S;function w(B){M.fromBufferAttribute(Z,B),P.copy(M);let D=X[B];L.copy(D),L.sub(M.multiplyScalar(M.dot(D))).normalize(),k.crossVectors(P,D);let j=k.dot(K[B])<0?-1:1;Y.setXYZW(B,L.x,L.y,L.z,j)}for(let B=0,D=N.length;B<D;++B){let V=N[B],j=V.start,z=V.count;for(let v=j,y=j+z;v<y;v+=3)w(J.getX(v+0)),w(J.getX(v+1)),w(J.getX(v+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new QJ(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let F=0,E=$.count;F<E;F++)$.setXYZ(F,0,0,0);let Z=new S,W=new S,Y=new S,X=new S,K=new S,H=new S,U=new S,G=new S;if(J)for(let F=0,E=J.count;F<E;F+=3){let O=J.getX(F+0),R=J.getX(F+1),C=J.getX(F+2);Z.fromBufferAttribute(Q,O),W.fromBufferAttribute(Q,R),Y.fromBufferAttribute(Q,C),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),X.fromBufferAttribute($,O),K.fromBufferAttribute($,R),H.fromBufferAttribute($,C),X.add(U),K.add(U),H.add(U),$.setXYZ(O,X.x,X.y,X.z),$.setXYZ(R,K.x,K.y,K.z),$.setXYZ(C,H.x,H.y,H.z)}else for(let F=0,E=Q.count;F<E;F+=3)Z.fromBufferAttribute(Q,F+0),W.fromBufferAttribute(Q,F+1),Y.fromBufferAttribute(Q,F+2),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),$.setXYZ(F+0,U.x,U.y,U.z),$.setXYZ(F+1,U.x,U.y,U.z),$.setXYZ(F+2,U.x,U.y,U.z);this.normalizeNormals(),$.needsUpdate=!0}}normalizeNormals(){let J=this.attributes.normal;for(let Q=0,$=J.count;Q<$;Q++)vJ.fromBufferAttribute(J,Q),vJ.normalize(),J.setXYZ(Q,vJ.x,vJ.y,vJ.z)}toNonIndexed(){function J(X,K){let{array:H,itemSize:U,normalized:G}=X,F=new H.constructor(K.length*U),E=0,O=0;for(let R=0,C=K.length;R<C;R++){if(X.isInterleavedBufferAttribute)E=K[R]*X.data.stride+X.offset;else E=K[R]*U;for(let q=0;q<U;q++)F[O++]=H[E++]}return new QJ(F,U,G)}if(this.index===null)return C0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new qJ,$=this.index.array,Z=this.attributes;for(let X in Z){let K=Z[X],H=J(K,$);Q.setAttribute(X,H)}let W=this.morphAttributes;for(let X in W){let K=[],H=W[X];for(let U=0,G=H.length;U<G;U++){let F=H[U],E=J(F,$);K.push(E)}Q.morphAttributes[X]=K}Q.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;for(let X=0,K=Y.length;X<K;X++){let H=Y[X];Q.addGroup(H.start,H.count,H.materialIndex)}return Q}toJSON(){let J={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(J.uuid=this.uuid,J.type=this.type,this.name!=="")J.name=this.name;if(Object.keys(this.userData).length>0)J.userData=this.userData;if(this.parameters!==void 0){let K=this.parameters;for(let H in K)if(K[H]!==void 0)J[H]=K[H];return J}J.data={attributes:{}};let Q=this.index;if(Q!==null)J.data.index={type:Q.array.constructor.name,array:Array.prototype.slice.call(Q.array)};let $=this.attributes;for(let K in $){let H=$[K];J.data.attributes[K]=H.toJSON(J.data)}let Z={},W=!1;for(let K in this.morphAttributes){let H=this.morphAttributes[K],U=[];for(let G=0,F=H.length;G<F;G++){let E=H[G];U.push(E.toJSON(J.data))}if(U.length>0)Z[K]=U,W=!0}if(W)J.data.morphAttributes=Z,J.data.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;if(Y.length>0)J.data.groups=JSON.parse(JSON.stringify(Y));let X=this.boundingSphere;if(X!==null)J.data.boundingSphere=X.toJSON();return J}clone(){return new this.constructor().copy(this)}copy(J){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let Q={};this.name=J.name;let $=J.index;if($!==null)this.setIndex($.clone());let Z=J.attributes;for(let H in Z){let U=Z[H];this.setAttribute(H,U.clone(Q))}let W=J.morphAttributes;for(let H in W){let U=[],G=W[H];for(let F=0,E=G.length;F<E;F++)U.push(G[F].clone(Q));this.morphAttributes[H]=U}this.morphTargetsRelative=J.morphTargetsRelative;let Y=J.groups;for(let H=0,U=Y.length;H<U;H++){let G=Y[H];this.addGroup(G.start,G.count,G.materialIndex)}let X=J.boundingBox;if(X!==null)this.boundingBox=X.clone();let K=J.boundingSphere;if(K!==null)this.boundingSphere=K.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class W7{constructor(J,Q){this.isInterleavedBuffer=!0,this.array=J,this.stride=Q,this.count=J!==void 0?J.length/Q:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=M9()}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.array=new J.array.constructor(J.array),this.count=J.count,this.stride=J.stride,this.usage=J.usage,this}copyAt(J,Q,$){J*=this.stride,$*=Q.stride;for(let Z=0,W=this.stride;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}set(J,Q=0){return this.array.set(J,Q),this}clone(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=M9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let Q=new this.array.constructor(J.arrayBuffers[this.array.buffer._uuid]),$=new this.constructor(Q,this.stride);return $.setUsage(this.usage),$}onUpload(J){return this.onUploadCallback=J,this}toJSON(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=M9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var dJ=new S;class M6{constructor(J,Q,$,Z=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=J,this.itemSize=Q,this.offset=$,this.normalized=Z}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(J){this.data.needsUpdate=J}applyMatrix4(J){for(let Q=0,$=this.data.count;Q<$;Q++)dJ.fromBufferAttribute(this,Q),dJ.applyMatrix4(J),this.setXYZ(Q,dJ.x,dJ.y,dJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)dJ.fromBufferAttribute(this,Q),dJ.applyNormalMatrix(J),this.setXYZ(Q,dJ.x,dJ.y,dJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)dJ.fromBufferAttribute(this,Q),dJ.transformDirection(J),this.setXYZ(Q,dJ.x,dJ.y,dJ.z);return this}getComponent(J,Q){let $=this.array[J*this.data.stride+this.offset+Q];if(this.normalized)$=k9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=ZJ($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=ZJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+3]=Q,this}getX(J){let Q=this.data.array[J*this.data.stride+this.offset];if(this.normalized)Q=k9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=k9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=k9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=k9(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=ZJ(Q,this.array),$=ZJ($,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J=J*this.data.stride+this.offset,this.normalized)Q=ZJ(Q,this.array),$=ZJ($,this.array),Z=ZJ(Z,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J=J*this.data.stride+this.offset,this.normalized)Q=ZJ(Q,this.array),$=ZJ($,this.array),Z=ZJ(Z,this.array),W=ZJ(W,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this.data.array[J+3]=W,this}clone(J){if(J===void 0){c6("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return new QJ(new this.array.constructor(Q),this.itemSize,this.normalized)}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.clone(J);return new M6(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){c6("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Q,normalized:this.normalized}}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.toJSON(J);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var HU=0;class oJ extends v9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:HU++}),this.uuid=M9(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new X0(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(J){if(this._alphaTest>0!==J>0)this.version++;this._alphaTest=J}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(J){if(J===void 0)return;for(let Q in J){let $=J[Q];if($===void 0){C0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){C0(`Material: '${Q}' is not a property of THREE.${this.type}.`);continue}if(Z&&Z.isColor)Z.set($);else if(Z&&Z.isVector3&&($&&$.isVector3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(Q)J={textures:{},images:{}};let $={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if($.uuid=this.uuid,$.type=this.type,this.name!=="")$.name=this.name;if(this.color&&this.color.isColor)$.color=this.color.getHex();if(this.roughness!==void 0)$.roughness=this.roughness;if(this.metalness!==void 0)$.metalness=this.metalness;if(this.sheen!==void 0)$.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)$.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)$.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)$.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)$.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)$.specular=this.specular.getHex();if(this.specularIntensity!==void 0)$.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)$.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)$.shininess=this.shininess;if(this.clearcoat!==void 0)$.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)$.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)$.clearcoatMap=this.clearcoatMap.toJSON(J).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)$.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(J).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)$.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(J).uuid,$.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)$.sheenColorMap=this.sheenColorMap.toJSON(J).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)$.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(J).uuid;if(this.dispersion!==void 0)$.dispersion=this.dispersion;if(this.iridescence!==void 0)$.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)$.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)$.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)$.iridescenceMap=this.iridescenceMap.toJSON(J).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)$.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(J).uuid;if(this.anisotropy!==void 0)$.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)$.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)$.anisotropyMap=this.anisotropyMap.toJSON(J).uuid;if(this.map&&this.map.isTexture)$.map=this.map.toJSON(J).uuid;if(this.matcap&&this.matcap.isTexture)$.matcap=this.matcap.toJSON(J).uuid;if(this.alphaMap&&this.alphaMap.isTexture)$.alphaMap=this.alphaMap.toJSON(J).uuid;if(this.lightMap&&this.lightMap.isTexture)$.lightMap=this.lightMap.toJSON(J).uuid,$.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)$.aoMap=this.aoMap.toJSON(J).uuid,$.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)$.bumpMap=this.bumpMap.toJSON(J).uuid,$.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)$.normalMap=this.normalMap.toJSON(J).uuid,$.normalMapType=this.normalMapType,$.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)$.displacementMap=this.displacementMap.toJSON(J).uuid,$.displacementScale=this.displacementScale,$.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)$.roughnessMap=this.roughnessMap.toJSON(J).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)$.metalnessMap=this.metalnessMap.toJSON(J).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)$.emissiveMap=this.emissiveMap.toJSON(J).uuid;if(this.specularMap&&this.specularMap.isTexture)$.specularMap=this.specularMap.toJSON(J).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)$.specularIntensityMap=this.specularIntensityMap.toJSON(J).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)$.specularColorMap=this.specularColorMap.toJSON(J).uuid;if(this.envMap&&this.envMap.isTexture){if($.envMap=this.envMap.toJSON(J).uuid,this.combine!==void 0)$.combine=this.combine}if(this.envMapRotation!==void 0)$.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)$.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)$.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)$.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)$.gradientMap=this.gradientMap.toJSON(J).uuid;if(this.transmission!==void 0)$.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)$.transmissionMap=this.transmissionMap.toJSON(J).uuid;if(this.thickness!==void 0)$.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)$.thicknessMap=this.thicknessMap.toJSON(J).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)$.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)$.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)$.size=this.size;if(this.shadowSide!==null)$.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)$.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)$.blending=this.blending;if(this.side!==0)$.side=this.side;if(this.vertexColors===!0)$.vertexColors=!0;if(this.opacity<1)$.opacity=this.opacity;if(this.transparent===!0)$.transparent=!0;if(this.blendSrc!==204)$.blendSrc=this.blendSrc;if(this.blendDst!==205)$.blendDst=this.blendDst;if(this.blendEquation!==100)$.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)$.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)$.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)$.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)$.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)$.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)$.depthFunc=this.depthFunc;if(this.depthTest===!1)$.depthTest=this.depthTest;if(this.depthWrite===!1)$.depthWrite=this.depthWrite;if(this.colorWrite===!1)$.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)$.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)$.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)$.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)$.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)$.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)$.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)$.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)$.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)$.rotation=this.rotation;if(this.polygonOffset===!0)$.polygonOffset=!0;if(this.polygonOffsetFactor!==0)$.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)$.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)$.linewidth=this.linewidth;if(this.dashSize!==void 0)$.dashSize=this.dashSize;if(this.gapSize!==void 0)$.gapSize=this.gapSize;if(this.scale!==void 0)$.scale=this.scale;if(this.dithering===!0)$.dithering=!0;if(this.alphaTest>0)$.alphaTest=this.alphaTest;if(this.alphaHash===!0)$.alphaHash=!0;if(this.alphaToCoverage===!0)$.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)$.premultipliedAlpha=!0;if(this.forceSinglePass===!0)$.forceSinglePass=!0;if(this.allowOverride===!1)$.allowOverride=!1;if(this.wireframe===!0)$.wireframe=!0;if(this.wireframeLinewidth>1)$.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")$.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")$.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)$.flatShading=!0;if(this.visible===!1)$.visible=!1;if(this.toneMapped===!1)$.toneMapped=!1;if(this.fog===!1)$.fog=!1;if(Object.keys(this.userData).length>0)$.userData=this.userData;function Z(W){let Y=[];for(let X in W){let K=W[X];delete K.metadata,Y.push(K)}return Y}if(Q){let W=Z(J.textures),Y=Z(J.images);if(W.length>0)$.textures=W;if(Y.length>0)$.images=Y}return $}clone(){return new this.constructor().copy(this)}copy(J){this.name=J.name,this.blending=J.blending,this.side=J.side,this.vertexColors=J.vertexColors,this.opacity=J.opacity,this.transparent=J.transparent,this.blendSrc=J.blendSrc,this.blendDst=J.blendDst,this.blendEquation=J.blendEquation,this.blendSrcAlpha=J.blendSrcAlpha,this.blendDstAlpha=J.blendDstAlpha,this.blendEquationAlpha=J.blendEquationAlpha,this.blendColor.copy(J.blendColor),this.blendAlpha=J.blendAlpha,this.depthFunc=J.depthFunc,this.depthTest=J.depthTest,this.depthWrite=J.depthWrite,this.stencilWriteMask=J.stencilWriteMask,this.stencilFunc=J.stencilFunc,this.stencilRef=J.stencilRef,this.stencilFuncMask=J.stencilFuncMask,this.stencilFail=J.stencilFail,this.stencilZFail=J.stencilZFail,this.stencilZPass=J.stencilZPass,this.stencilWrite=J.stencilWrite;let Q=J.clippingPlanes,$=null;if(Q!==null){let Z=Q.length;$=Array(Z);for(let W=0;W!==Z;++W)$[W]=Q[W].clone()}return this.clippingPlanes=$,this.clipIntersection=J.clipIntersection,this.clipShadows=J.clipShadows,this.shadowSide=J.shadowSide,this.colorWrite=J.colorWrite,this.precision=J.precision,this.polygonOffset=J.polygonOffset,this.polygonOffsetFactor=J.polygonOffsetFactor,this.polygonOffsetUnits=J.polygonOffsetUnits,this.dithering=J.dithering,this.alphaTest=J.alphaTest,this.alphaHash=J.alphaHash,this.alphaToCoverage=J.alphaToCoverage,this.premultipliedAlpha=J.premultipliedAlpha,this.forceSinglePass=J.forceSinglePass,this.allowOverride=J.allowOverride,this.visible=J.visible,this.toneMapped=J.toneMapped,this.userData=JSON.parse(JSON.stringify(J.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(J){if(J===!0)this.version++}}var m9=new S,q$=new S,x7=new S,K8=new S,R$=new S,b7=new S,L$=new S;class V6{constructor(J=new S,Q=new S(0,0,-1)){this.origin=J,this.direction=Q}set(J,Q){return this.origin.copy(J),this.direction.copy(Q),this}copy(J){return this.origin.copy(J.origin),this.direction.copy(J.direction),this}at(J,Q){return Q.copy(this.origin).addScaledVector(this.direction,J)}lookAt(J){return this.direction.copy(J).sub(this.origin).normalize(),this}recast(J){return this.origin.copy(this.at(J,m9)),this}closestPointToPoint(J,Q){Q.subVectors(J,this.origin);let $=Q.dot(this.direction);if($<0)return Q.copy(this.origin);return Q.copy(this.origin).addScaledVector(this.direction,$)}distanceToPoint(J){return Math.sqrt(this.distanceSqToPoint(J))}distanceSqToPoint(J){let Q=m9.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return m9.copy(this.origin).addScaledVector(this.direction,Q),m9.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){q$.copy(J).add(Q).multiplyScalar(0.5),x7.copy(Q).sub(J).normalize(),K8.copy(this.origin).sub(q$);let W=J.distanceTo(Q)*0.5,Y=-this.direction.dot(x7),X=K8.dot(this.direction),K=-K8.dot(x7),H=K8.lengthSq(),U=Math.abs(1-Y*Y),G,F,E,O;if(U>0)if(G=Y*K-X,F=Y*X-K,O=W*U,G>=0)if(F>=-O)if(F<=O){let R=1/U;G*=R,F*=R,E=G*(G+Y*F+2*X)+F*(Y*G+F+2*K)+H}else F=W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else F=-W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else if(F<=-O)G=Math.max(0,-(-Y*W+X)),F=G>0?-W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else if(F<=O)G=0,F=Math.min(Math.max(-W,-K),W),E=F*(F+2*K)+H;else G=Math.max(0,-(Y*W+X)),F=G>0?W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else F=Y>0?-W:W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;if($)$.copy(this.origin).addScaledVector(this.direction,G);if(Z)Z.copy(q$).addScaledVector(x7,F);return E}intersectSphere(J,Q){m9.subVectors(J.center,this.origin);let $=m9.dot(this.direction),Z=m9.dot(m9)-$*$,W=J.radius*J.radius;if(Z>W)return null;let Y=Math.sqrt(W-Z),X=$-Y,K=$+Y;if(K<0)return null;if(X<0)return this.at(K,Q);return this.at(X,Q)}intersectsSphere(J){if(J.radius<0)return!1;return this.distanceSqToPoint(J.center)<=J.radius*J.radius}distanceToPlane(J){let Q=J.normal.dot(this.direction);if(Q===0){if(J.distanceToPoint(this.origin)===0)return 0;return null}let $=-(this.origin.dot(J.normal)+J.constant)/Q;return $>=0?$:null}intersectPlane(J,Q){let $=this.distanceToPlane(J);if($===null)return null;return this.at($,Q)}intersectsPlane(J){let Q=J.distanceToPoint(this.origin);if(Q===0)return!0;if(J.normal.dot(this.direction)*Q<0)return!0;return!1}intersectBox(J,Q){let $,Z,W,Y,X,K,H=1/this.direction.x,U=1/this.direction.y,G=1/this.direction.z,F=this.origin;if(H>=0)$=(J.min.x-F.x)*H,Z=(J.max.x-F.x)*H;else $=(J.max.x-F.x)*H,Z=(J.min.x-F.x)*H;if(U>=0)W=(J.min.y-F.y)*U,Y=(J.max.y-F.y)*U;else W=(J.max.y-F.y)*U,Y=(J.min.y-F.y)*U;if($>Y||W>Z)return null;if(W>$||isNaN($))$=W;if(Y<Z||isNaN(Z))Z=Y;if(G>=0)X=(J.min.z-F.z)*G,K=(J.max.z-F.z)*G;else X=(J.max.z-F.z)*G,K=(J.min.z-F.z)*G;if($>K||X>Z)return null;if(X>$||$!==$)$=X;if(K<Z||Z!==Z)Z=K;if(Z<0)return null;return this.at($>=0?$:Z,Q)}intersectsBox(J){return this.intersectBox(J,m9)!==null}intersectTriangle(J,Q,$,Z,W){R$.subVectors(Q,J),b7.subVectors($,J),L$.crossVectors(R$,b7);let Y=this.direction.dot(L$),X;if(Y>0){if(Z)return null;X=1}else if(Y<0)X=-1,Y=-Y;else return null;K8.subVectors(this.origin,J);let K=X*this.direction.dot(b7.crossVectors(K8,b7));if(K<0)return null;let H=X*this.direction.dot(R$.cross(K8));if(H<0)return null;if(K+H>Y)return null;let U=-X*K8.dot(L$);if(U<0)return null;return this.at(U/Y,W)}applyMatrix4(J){return this.origin.applyMatrix4(J),this.direction.transformDirection(J),this}equals(J){return J.origin.equals(this.origin)&&J.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class U9 extends oJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new X0(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.envMapRotation=new T9,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}var nW=new j0,C8=new V6,h7=new lJ,sW=new S,f7=new S,g7=new S,p7=new S,D$=new S,u7=new S,iW=new S,d7=new S;class a0 extends HJ{constructor(J=new qJ,Q=new U9){super();this.isMesh=!0,this.type="Mesh",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(J,Q){if(super.copy(J,Q),J.morphTargetInfluences!==void 0)this.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);return this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}getVertexPosition(J,Q){let $=this.geometry,Z=$.attributes.position,W=$.morphAttributes.position,Y=$.morphTargetsRelative;Q.fromBufferAttribute(Z,J);let X=this.morphTargetInfluences;if(W&&X){u7.set(0,0,0);for(let K=0,H=W.length;K<H;K++){let U=X[K],G=W[K];if(U===0)continue;if(D$.fromBufferAttribute(G,J),Y)u7.addScaledVector(D$,U);else u7.addScaledVector(D$.sub(Q),U)}Q.add(u7)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(h7.copy($.boundingSphere),h7.applyMatrix4(W),C8.copy(J.ray).recast(J.near),h7.containsPoint(C8.origin)===!1){if(C8.intersectSphere(h7,sW)===null)return;if(C8.origin.distanceToSquared(sW)>(J.far-J.near)**2)return}if(nW.copy(W).invert(),C8.copy(J.ray).applyMatrix4(nW),$.boundingBox!==null){if(C8.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,C8)}_computeIntersections(J,Q,$){let Z,W=this.geometry,Y=this.material,X=W.index,K=W.attributes.position,H=W.attributes.uv,U=W.attributes.uv1,G=W.attributes.normal,F=W.groups,E=W.drawRange;if(X!==null)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let C=F[O],q=Y[C.materialIndex],N=Math.max(C.start,E.start),L=Math.min(X.count,Math.min(C.start+C.count,E.start+E.count));for(let k=N,M=L;k<M;k+=3){let P=X.getX(k),w=X.getX(k+1),B=X.getX(k+2);if(Z=m7(this,q,J,$,H,U,G,P,w,B),Z)Z.faceIndex=Math.floor(k/3),Z.face.materialIndex=C.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(X.count,E.start+E.count);for(let C=O,q=R;C<q;C+=3){let N=X.getX(C),L=X.getX(C+1),k=X.getX(C+2);if(Z=m7(this,Y,J,$,H,U,G,N,L,k),Z)Z.faceIndex=Math.floor(C/3),Q.push(Z)}}else if(K!==void 0)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let C=F[O],q=Y[C.materialIndex],N=Math.max(C.start,E.start),L=Math.min(K.count,Math.min(C.start+C.count,E.start+E.count));for(let k=N,M=L;k<M;k+=3){let P=k,w=k+1,B=k+2;if(Z=m7(this,q,J,$,H,U,G,P,w,B),Z)Z.faceIndex=Math.floor(k/3),Z.face.materialIndex=C.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(K.count,E.start+E.count);for(let C=O,q=R;C<q;C+=3){let N=C,L=C+1,k=C+2;if(Z=m7(this,Y,J,$,H,U,G,N,L,k),Z)Z.faceIndex=Math.floor(C/3),Q.push(Z)}}}}function UU(J,Q,$,Z,W,Y,X,K){let H;if(Q.side===1)H=Z.intersectTriangle(X,Y,W,!0,K);else H=Z.intersectTriangle(W,Y,X,Q.side===0,K);if(H===null)return null;d7.copy(K),d7.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(d7);if(U<$.near||U>$.far)return null;return{distance:U,point:d7.clone(),object:J}}function m7(J,Q,$,Z,W,Y,X,K,H,U){J.getVertexPosition(K,f7),J.getVertexPosition(H,g7),J.getVertexPosition(U,p7);let G=UU(J,Q,$,Z,f7,g7,p7,iW);if(G){let F=new S;if(X9.getBarycoord(iW,f7,g7,p7,F),W)G.uv=X9.getInterpolatedAttribute(W,K,H,U,F,new T0);if(Y)G.uv1=X9.getInterpolatedAttribute(Y,K,H,U,F,new T0);if(X){if(G.normal=X9.getInterpolatedAttribute(X,K,H,U,F,new S),G.normal.dot(Z.direction)>0)G.normal.multiplyScalar(-1)}let E={a:K,b:H,c:U,normal:new S,materialIndex:0};X9.getNormal(f7,g7,p7,E.normal),G.face=E,G.barycoord=F}return G}var g6=new $J,oW=new $J,aW=new $J,GU=new $J,rW=new j0,l7=new S,k$=new lJ,tW=new j0,M$=new V6;class MQ extends a0{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new j0,this.bindMatrixInverse=new j0,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let J=this.geometry;if(this.boundingBox===null)this.boundingBox=new iJ;this.boundingBox.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,l7),this.boundingBox.expandByPoint(l7)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new lJ;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,l7),this.boundingSphere.expandByPoint(l7)}copy(J,Q){if(super.copy(J,Q),this.bindMode=J.bindMode,this.bindMatrix.copy(J.bindMatrix),this.bindMatrixInverse.copy(J.bindMatrixInverse),this.skeleton=J.skeleton,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}raycast(J,Q){let $=this.material,Z=this.matrixWorld;if($===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(k$.copy(this.boundingSphere),k$.applyMatrix4(Z),J.ray.intersectsSphere(k$)===!1)return;if(tW.copy(Z).invert(),M$.copy(J.ray).applyMatrix4(tW),this.boundingBox!==null){if(M$.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,M$)}getVertexPosition(J,Q){return super.getVertexPosition(J,Q),this.applyBoneTransform(J,Q),Q}bind(J,Q){if(this.skeleton=J,Q===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Q=this.matrixWorld;this.bindMatrix.copy(Q),this.bindMatrixInverse.copy(Q).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let J=new $J,Q=this.geometry.attributes.skinWeight;for(let $=0,Z=Q.count;$<Z;$++){J.fromBufferAttribute(Q,$);let W=1/J.manhattanLength();if(W!==1/0)J.multiplyScalar(W);else J.set(1,0,0,0);Q.setXYZW($,J.x,J.y,J.z,J.w)}}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else C0("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(J,Q){let $=this.skeleton,Z=this.geometry;if(oW.fromBufferAttribute(Z.attributes.skinIndex,J),aW.fromBufferAttribute(Z.attributes.skinWeight,J),Q.isVector4)g6.copy(Q),Q.set(0,0,0,0);else g6.set(...Q,1),Q.set(0,0,0);g6.applyMatrix4(this.bindMatrix);for(let W=0;W<4;W++){let Y=aW.getComponent(W);if(Y!==0){let X=oW.getComponent(W);rW.multiplyMatrices($.bones[X].matrixWorld,$.boneInverses[X]),Q.addScaledVector(GU.copy(g6).applyMatrix4(rW),Y)}}if(Q.isVector4)Q.w=g6.w;return Q.applyMatrix4(this.bindMatrixInverse)}}class Y7 extends HJ{constructor(){super();this.isBone=!0,this.type="Bone"}}class B6 extends PJ{constructor(J=null,Q=1,$=1,Z,W,Y,X,K,H=1003,U=1003,G,F){super(null,Y,X,K,H,U,Z,W,G,F);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var eW=new j0,EU=new j0;class X7{constructor(J=[],Q=[]){this.uuid=M9(),this.bones=J.slice(0),this.boneInverses=Q,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let J=this.bones,Q=this.boneInverses;if(this.boneMatrices=new Float32Array(J.length*16),Q.length===0)this.calculateInverses();else if(J.length!==Q.length){C0("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let $=0,Z=this.bones.length;$<Z;$++)this.boneInverses.push(new j0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new j0;if(this.bones[J])$.copy(this.bones[J].matrixWorld).invert();this.boneInverses.push($)}}pose(){for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($)$.matrixWorld.copy(this.boneInverses[J]).invert()}for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($){if($.parent&&$.parent.isBone)$.matrix.copy($.parent.matrixWorld).invert(),$.matrix.multiply($.matrixWorld);else $.matrix.copy($.matrixWorld);$.matrix.decompose($.position,$.quaternion,$.scale)}}}update(){let J=this.bones,Q=this.boneInverses,$=this.boneMatrices,Z=this.boneTexture;for(let W=0,Y=J.length;W<Y;W++){let X=J[W]?J[W].matrixWorld:EU;eW.multiplyMatrices(X,Q[W]),eW.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new X7(this.bones,this.boneInverses)}computeBoneTexture(){let J=Math.sqrt(this.bones.length*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4);Q.set(this.boneMatrices);let $=new B6(Q,J,J,1023,1015);return $.needsUpdate=!0,this.boneMatrices=Q,this.boneTexture=$,this}getBoneByName(J){for(let Q=0,$=this.bones.length;Q<$;Q++){let Z=this.bones[Q];if(Z.name===J)return Z}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(J,Q){this.uuid=J.uuid;for(let $=0,Z=J.bones.length;$<Z;$++){let W=J.bones[$],Y=Q[W];if(Y===void 0)C0("Skeleton: No bone found with UUID:",W),Y=new Y7;this.bones.push(Y),this.boneInverses.push(new j0().fromArray(J.boneInverses[$]))}return this.init(),this}toJSON(){let J={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};J.uuid=this.uuid;let Q=this.bones,$=this.boneInverses;for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z];J.bones.push(Y.uuid);let X=$[Z];J.boneInverses.push(X.toArray())}return J}}class _8 extends QJ{constructor(J,Q,$,Z=1){super(J,Q,$);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Z}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}toJSON(){let J=super.toJSON();return J.meshPerAttribute=this.meshPerAttribute,J.isInstancedBufferAttribute=!0,J}}var $6=new j0,JY=new j0,c7=[],QY=new iJ,FU=new j0,p6=new a0,u6=new lJ;class F8 extends a0{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new _8(new Float32Array($*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=$,this.boundingBox=null,this.boundingSphere=null;for(let Z=0;Z<$;Z++)this.setMatrixAt(Z,FU)}computeBoundingBox(){let J=this.geometry,Q=this.count;if(this.boundingBox===null)this.boundingBox=new iJ;if(J.boundingBox===null)J.computeBoundingBox();this.boundingBox.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,$6),QY.copy(J.boundingBox).applyMatrix4($6),this.boundingBox.union(QY)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new lJ;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,$6),u6.copy(J.boundingSphere).applyMatrix4($6),this.boundingSphere.union(u6)}copy(J,Q){if(super.copy(J,Q),this.instanceMatrix.copy(J.instanceMatrix),J.previousInstanceMatrix!==null)this.previousInstanceMatrix=J.previousInstanceMatrix.clone();if(J.morphTexture!==null)this.morphTexture=J.morphTexture.clone();if(J.instanceColor!==null)this.instanceColor=J.instanceColor.clone();if(this.count=J.count,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}getColorAt(J,Q){if(this.instanceColor===null)return Q.setRGB(1,1,1);else return Q.fromArray(this.instanceColor.array,J*3)}getMatrixAt(J,Q){return Q.fromArray(this.instanceMatrix.array,J*16)}getMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=this.morphTexture.source.data.data,W=$.length+1,Y=J*W+1;for(let X=0;X<$.length;X++)$[X]=Z[Y+X]}raycast(J,Q){let $=this.matrixWorld,Z=this.count;if(p6.geometry=this.geometry,p6.material=this.material,p6.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(u6.copy(this.boundingSphere),u6.applyMatrix4($),J.ray.intersectsSphere(u6)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,$6),JY.multiplyMatrices($,$6),p6.matrixWorld=JY,p6.raycast(J,c7);for(let Y=0,X=c7.length;Y<X;Y++){let K=c7[Y];K.instanceId=W,K.object=this,Q.push(K)}c7.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new _8(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return Q.toArray(this.instanceColor.array,J*3),this}setMatrixAt(J,Q){return Q.toArray(this.instanceMatrix.array,J*16),this}setMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=$.length+1;if(this.morphTexture===null)this.morphTexture=new B6(new Float32Array(Z*this.count),Z,this.count,1028,1015);let W=this.morphTexture.source.data.data,Y=0;for(let H=0;H<$.length;H++)Y+=$[H];let X=this.geometry.morphTargetsRelative?1:1-Y,K=Z*J;return W[K]=X,W.set($,K+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var V$=new S,NU=new S,OU=new h0;class D9{constructor(J=new S(1,0,0),Q=0){this.isPlane=!0,this.normal=J,this.constant=Q}set(J,Q){return this.normal.copy(J),this.constant=Q,this}setComponents(J,Q,$,Z){return this.normal.set(J,Q,$),this.constant=Z,this}setFromNormalAndCoplanarPoint(J,Q){return this.normal.copy(J),this.constant=-Q.dot(this.normal),this}setFromCoplanarPoints(J,Q,$){let Z=V$.subVectors($,Q).cross(NU.subVectors(J,Q)).normalize();return this.setFromNormalAndCoplanarPoint(Z,J),this}copy(J){return this.normal.copy(J.normal),this.constant=J.constant,this}normalize(){let J=1/this.normal.length();return this.normal.multiplyScalar(J),this.constant*=J,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(J){return this.normal.dot(J)+this.constant}distanceToSphere(J){return this.distanceToPoint(J.center)-J.radius}projectPoint(J,Q){return Q.copy(J).addScaledVector(this.normal,-this.distanceToPoint(J))}intersectLine(J,Q,$=!0){let Z=J.delta(V$),W=this.normal.dot(Z);if(W===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let Y=-(J.start.dot(this.normal)+this.constant)/W;if($===!0&&(Y<0||Y>1))return null;return Q.copy(J.start).addScaledVector(Z,Y)}intersectsLine(J){let Q=this.distanceToPoint(J.start),$=this.distanceToPoint(J.end);return Q<0&&$>0||$<0&&Q>0}intersectsBox(J){return J.intersectsPlane(this)}intersectsSphere(J){return J.intersectsPlane(this)}coplanarPoint(J){return J.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(J,Q){let $=Q||OU.getNormalMatrix(J),Z=this.coplanarPoint(V$).applyMatrix4(J),W=this.normal.applyMatrix3($).normalize();return this.constant=-Z.dot(W),this}translate(J){return this.constant-=J.dot(this.normal),this}equals(J){return J.normal.equals(this.normal)&&J.constant===this.constant}clone(){return new this.constructor().copy(this)}}var I8=new lJ,qU=new T0(0.5,0.5),n7=new S;class h8{constructor(J=new D9,Q=new D9,$=new D9,Z=new D9,W=new D9,Y=new D9){this.planes=[J,Q,$,Z,W,Y]}set(J,Q,$,Z,W,Y){let X=this.planes;return X[0].copy(J),X[1].copy(Q),X[2].copy($),X[3].copy(Z),X[4].copy(W),X[5].copy(Y),this}copy(J){let Q=this.planes;for(let $=0;$<6;$++)Q[$].copy(J.planes[$]);return this}setFromProjectionMatrix(J,Q=2000,$=!1){let Z=this.planes,W=J.elements,Y=W[0],X=W[1],K=W[2],H=W[3],U=W[4],G=W[5],F=W[6],E=W[7],O=W[8],R=W[9],C=W[10],q=W[11],N=W[12],L=W[13],k=W[14],M=W[15];if(Z[0].setComponents(H-Y,E-U,q-O,M-N).normalize(),Z[1].setComponents(H+Y,E+U,q+O,M+N).normalize(),Z[2].setComponents(H+X,E+G,q+R,M+L).normalize(),Z[3].setComponents(H-X,E-G,q-R,M-L).normalize(),$)Z[4].setComponents(K,F,C,k).normalize(),Z[5].setComponents(H-K,E-F,q-C,M-k).normalize();else if(Z[4].setComponents(H-K,E-F,q-C,M-k).normalize(),Q===2000)Z[5].setComponents(H+K,E+F,q+C,M+k).normalize();else if(Q===2001)Z[5].setComponents(K,F,C,k).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+Q);return this}intersectsObject(J){if(J.boundingSphere!==void 0){if(J.boundingSphere===null)J.computeBoundingSphere();I8.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();I8.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(I8)}intersectsSprite(J){I8.center.set(0,0,0);let Q=qU.distanceTo(J.center);return I8.radius=0.7071067811865476+Q,I8.applyMatrix4(J.matrixWorld),this.intersectsSphere(I8)}intersectsSphere(J){let Q=this.planes,$=J.center,Z=-J.radius;for(let W=0;W<6;W++)if(Q[W].distanceToPoint($)<Z)return!1;return!0}intersectsBox(J){let Q=this.planes;for(let $=0;$<6;$++){let Z=Q[$];if(n7.x=Z.normal.x>0?J.max.x:J.min.x,n7.y=Z.normal.y>0?J.max.y:J.min.y,n7.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(n7)<0)return!1}return!0}containsPoint(J){let Q=this.planes;for(let $=0;$<6;$++)if(Q[$].distanceToPoint(J)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class K7 extends oJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new X0(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.linewidth=J.linewidth,this.linecap=J.linecap,this.linejoin=J.linejoin,this.fog=J.fog,this}}var QQ=new S,$Q=new S,$Y=new j0,d6=new V6,s7=new lJ,B$=new S,ZY=new S;class C6 extends HJ{constructor(J=new qJ,Q=new K7){super();this.isLine=!0,this.type="Line",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[0];for(let Z=1,W=Q.count;Z<W;Z++)QQ.fromBufferAttribute(Q,Z-1),$Q.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=QQ.distanceTo($Q);J.setAttribute("lineDistance",new WJ($,1))}else C0("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Line.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(s7.copy($.boundingSphere),s7.applyMatrix4(Z),s7.radius+=W,J.ray.intersectsSphere(s7)===!1)return;$Y.copy(Z).invert(),d6.copy(J.ray).applyMatrix4($Y);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=this.isLineSegments?2:1,U=$.index,F=$.attributes.position;if(U!==null){let E=Math.max(0,Y.start),O=Math.min(U.count,Y.start+Y.count);for(let R=E,C=O-1;R<C;R+=H){let q=U.getX(R),N=U.getX(R+1),L=i7(this,J,d6,K,q,N,R);if(L)Q.push(L)}if(this.isLineLoop){let R=U.getX(O-1),C=U.getX(E),q=i7(this,J,d6,K,R,C,O-1);if(q)Q.push(q)}}else{let E=Math.max(0,Y.start),O=Math.min(F.count,Y.start+Y.count);for(let R=E,C=O-1;R<C;R+=H){let q=i7(this,J,d6,K,R,R+1,R);if(q)Q.push(q)}if(this.isLineLoop){let R=i7(this,J,d6,K,O-1,E,O-1);if(R)Q.push(R)}}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function i7(J,Q,$,Z,W,Y,X){let K=J.geometry.attributes.position;if(QQ.fromBufferAttribute(K,W),$Q.fromBufferAttribute(K,Y),$.distanceSqToSegment(QQ,$Q,B$,ZY)>Z)return;B$.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(B$);if(U<Q.near||U>Q.far)return;return{distance:U,point:ZY.clone().applyMatrix4(J.matrixWorld),index:X,face:null,faceIndex:null,barycoord:null,object:J}}var WY=new S,YY=new S;class VQ extends C6{constructor(J,Q){super(J,Q);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[];for(let Z=0,W=Q.count;Z<W;Z+=2)WY.fromBufferAttribute(Q,Z),YY.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+WY.distanceTo(YY);J.setAttribute("lineDistance",new WJ($,1))}else C0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class BQ extends C6{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}}class H7 extends oJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new X0(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.size=J.size,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var XY=new j0,P$=new V6,o7=new lJ,a7=new S;class o9 extends HJ{constructor(J=new qJ,Q=new H7){super();this.isPoints=!0,this.type="Points",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Points.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(o7.copy($.boundingSphere),o7.applyMatrix4(Z),o7.radius+=W,J.ray.intersectsSphere(o7)===!1)return;XY.copy(Z).invert(),P$.copy(J.ray).applyMatrix4(XY);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=$.index,G=$.attributes.position;if(H!==null){let F=Math.max(0,Y.start),E=Math.min(H.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++){let C=H.getX(O);a7.fromBufferAttribute(G,C),KY(a7,C,K,Z,J,Q,this)}}else{let F=Math.max(0,Y.start),E=Math.min(G.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++)a7.fromBufferAttribute(G,O),KY(a7,O,K,Z,J,Q,this)}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function KY(J,Q,$,Z,W,Y,X){let K=P$.distanceSqToPoint(J);if(K<$){let H=new S;P$.closestPointToPoint(J,H),H.applyMatrix4(Z);let U=W.ray.origin.distanceTo(H);if(U<W.near||U>W.far)return;Y.push({distance:U,distanceToRay:Math.sqrt(K),point:H,index:Q,face:null,faceIndex:null,barycoord:null,object:X})}}class CQ extends PJ{constructor(J=[],Q=301,$,Z,W,Y,X,K,H,U){super(J,Q,$,Z,W,Y,X,K,H,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}}class N8 extends PJ{constructor(J,Q,$=1014,Z,W,Y,X=1003,K=1003,H,U=1026,G=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let F={width:J,height:Q,depth:G};super(F,Z,W,Y,X,K,U,$,H);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new $7(Object.assign({},J.image)),this.compareFunction=J.compareFunction,this}toJSON(J){let Q=super.toJSON(J);if(this.compareFunction!==null)Q.compareFunction=this.compareFunction;return Q}}class zZ extends N8{constructor(J,Q=1014,$=301,Z,W,Y=1003,X=1003,K,H=1026){let U={width:J,height:J,depth:1},G=[U,U,U,U,U,U];super(J,J,Q,$,Z,W,Y,X,K,H);this.image=G,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}}class IQ extends PJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class aJ extends qJ{constructor(J=1,Q=1,$=1,Z=1,W=1,Y=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:Z,heightSegments:W,depthSegments:Y};let X=this;Z=Math.floor(Z),W=Math.floor(W),Y=Math.floor(Y);let K=[],H=[],U=[],G=[],F=0,E=0;O("z","y","x",-1,-1,$,Q,J,Y,W,0),O("z","y","x",1,-1,$,Q,-J,Y,W,1),O("x","z","y",1,1,J,$,Q,Z,Y,2),O("x","z","y",1,-1,J,$,-Q,Z,Y,3),O("x","y","z",1,-1,J,Q,$,Z,W,4),O("x","y","z",-1,-1,J,Q,-$,Z,W,5),this.setIndex(K),this.setAttribute("position",new WJ(H,3)),this.setAttribute("normal",new WJ(U,3)),this.setAttribute("uv",new WJ(G,2));function O(R,C,q,N,L,k,M,P,w,B,D){let V=k/w,j=M/B,z=k/2,v=M/2,y=P/2,A=w+1,x=B+1,b=0,p=0,c=new S;for(let o=0;o<x;o++){let Q0=o*j-v;for(let Y0=0;Y0<A;Y0++){let J0=Y0*V-z;c[R]=J0*N,c[C]=Q0*L,c[q]=y,H.push(c.x,c.y,c.z),c[R]=0,c[C]=0,c[q]=P>0?1:-1,U.push(c.x,c.y,c.z),G.push(Y0/w),G.push(1-o/B),b+=1}}for(let o=0;o<B;o++)for(let Q0=0;Q0<w;Q0++){let Y0=F+Q0+A*o,J0=F+Q0+A*(o+1),x0=F+(Q0+1)+A*(o+1),v0=F+(Q0+1)+A*o;K.push(Y0,J0,v0),K.push(J0,x0,v0),p+=6}X.addGroup(E,p,D),E+=p,F+=b}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new aJ(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class U7 extends qJ{constructor(J=1,Q=1,$=1,Z=32,W=1,Y=!1,X=0,K=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:Z,heightSegments:W,openEnded:Y,thetaStart:X,thetaLength:K};let H=this;Z=Math.floor(Z),W=Math.floor(W);let U=[],G=[],F=[],E=[],O=0,R=[],C=$/2,q=0;if(N(),Y===!1){if(J>0)L(!0);if(Q>0)L(!1)}this.setIndex(U),this.setAttribute("position",new WJ(G,3)),this.setAttribute("normal",new WJ(F,3)),this.setAttribute("uv",new WJ(E,2));function N(){let k=new S,M=new S,P=0,w=(Q-J)/$;for(let B=0;B<=W;B++){let D=[],V=B/W,j=V*(Q-J)+J;for(let z=0;z<=Z;z++){let v=z/Z,y=v*K+X,A=Math.sin(y),x=Math.cos(y);M.x=j*A,M.y=-V*$+C,M.z=j*x,G.push(M.x,M.y,M.z),k.set(A,w,x).normalize(),F.push(k.x,k.y,k.z),E.push(v,1-V),D.push(O++)}R.push(D)}for(let B=0;B<Z;B++)for(let D=0;D<W;D++){let V=R[D][B],j=R[D+1][B],z=R[D+1][B+1],v=R[D][B+1];if(J>0||D!==0)U.push(V,j,v),P+=3;if(Q>0||D!==W-1)U.push(j,z,v),P+=3}H.addGroup(q,P,0),q+=P}function L(k){let M=O,P=new T0,w=new S,B=0,D=k===!0?J:Q,V=k===!0?1:-1;for(let z=1;z<=Z;z++)G.push(0,C*V,0),F.push(0,V,0),E.push(0.5,0.5),O++;let j=O;for(let z=0;z<=Z;z++){let y=z/Z*K+X,A=Math.cos(y),x=Math.sin(y);w.x=D*x,w.y=C*V,w.z=D*A,G.push(w.x,w.y,w.z),F.push(0,V,0),P.x=A*0.5+0.5,P.y=x*0.5*V+0.5,E.push(P.x,P.y),O++}for(let z=0;z<Z;z++){let v=M+z,y=j+z;if(k===!0)U.push(y,y+1,v);else U.push(y+1,y,v);B+=3}H.addGroup(q,B,k===!0?1:2),q+=B}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new U7(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class zQ extends qJ{constructor(J=[],Q=[],$=1,Z=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:J,indices:Q,radius:$,detail:Z};let W=[],Y=[];if(X(Z),H($),U(),this.setAttribute("position",new WJ(W,3)),this.setAttribute("normal",new WJ(W.slice(),3)),this.setAttribute("uv",new WJ(Y,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function X(N){let L=new S,k=new S,M=new S;for(let P=0;P<Q.length;P+=3)E(Q[P+0],L),E(Q[P+1],k),E(Q[P+2],M),K(L,k,M,N)}function K(N,L,k,M){let P=M+1,w=[];for(let B=0;B<=P;B++){w[B]=[];let D=N.clone().lerp(k,B/P),V=L.clone().lerp(k,B/P),j=P-B;for(let z=0;z<=j;z++)if(z===0&&B===P)w[B][z]=D;else w[B][z]=D.clone().lerp(V,z/j)}for(let B=0;B<P;B++)for(let D=0;D<2*(P-B)-1;D++){let V=Math.floor(D/2);if(D%2===0)F(w[B][V+1]),F(w[B+1][V]),F(w[B][V]);else F(w[B][V+1]),F(w[B+1][V+1]),F(w[B+1][V])}}function H(N){let L=new S;for(let k=0;k<W.length;k+=3)L.x=W[k+0],L.y=W[k+1],L.z=W[k+2],L.normalize().multiplyScalar(N),W[k+0]=L.x,W[k+1]=L.y,W[k+2]=L.z}function U(){let N=new S;for(let L=0;L<W.length;L+=3){N.x=W[L+0],N.y=W[L+1],N.z=W[L+2];let k=C(N)/2/Math.PI+0.5,M=q(N)/Math.PI+0.5;Y.push(k,1-M)}O(),G()}function G(){for(let N=0;N<Y.length;N+=6){let L=Y[N+0],k=Y[N+2],M=Y[N+4],P=Math.max(L,k,M),w=Math.min(L,k,M);if(P>0.9&&w<0.1){if(L<0.2)Y[N+0]+=1;if(k<0.2)Y[N+2]+=1;if(M<0.2)Y[N+4]+=1}}}function F(N){W.push(N.x,N.y,N.z)}function E(N,L){let k=N*3;L.x=J[k+0],L.y=J[k+1],L.z=J[k+2]}function O(){let N=new S,L=new S,k=new S,M=new S,P=new T0,w=new T0,B=new T0;for(let D=0,V=0;D<W.length;D+=9,V+=6){N.set(W[D+0],W[D+1],W[D+2]),L.set(W[D+3],W[D+4],W[D+5]),k.set(W[D+6],W[D+7],W[D+8]),P.set(Y[V+0],Y[V+1]),w.set(Y[V+2],Y[V+3]),B.set(Y[V+4],Y[V+5]),M.copy(N).add(L).add(k).divideScalar(3);let j=C(M);R(P,V+0,N,j),R(w,V+2,L,j),R(B,V+4,k,j)}}function R(N,L,k,M){if(M<0&&N.x===1)Y[L]=N.x-1;if(k.x===0&&k.z===0)Y[L]=M/2/Math.PI+0.5}function C(N){return Math.atan2(N.z,-N.x)}function q(N){return Math.atan2(-N.y,Math.sqrt(N.x*N.x+N.z*N.z))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new zQ(J.vertices,J.indices,J.radius,J.detail)}}class _Z{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){C0("Curve: .getPoint() not implemented.")}getPointAt(J,Q){let $=this.getUtoTmapping(J);return this.getPoint($,Q)}getPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));return Q}getSpacedPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPointAt($/J));return Q}getLength(){let J=this.getLengths();return J[J.length-1]}getLengths(J=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===J+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let Q=[],$,Z=this.getPoint(0),W=0;Q.push(0);for(let Y=1;Y<=J;Y++)$=this.getPoint(Y/J),W+=$.distanceTo(Z),Q.push(W),Z=$;return this.cacheArcLengths=Q,Q}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(J,Q=null){let $=this.getLengths(),Z=0,W=$.length,Y;if(Q)Y=Q;else Y=J*$[W-1];let X=0,K=W-1,H;while(X<=K)if(Z=Math.floor(X+(K-X)/2),H=$[Z]-Y,H<0)X=Z+1;else if(H>0)K=Z-1;else{K=Z;break}if(Z=K,$[Z]===Y)return Z/(W-1);let U=$[Z],F=$[Z+1]-U,E=(Y-U)/F;return(Z+E)/(W-1)}getTangent(J,Q){let Z=J-0.0001,W=J+0.0001;if(Z<0)Z=0;if(W>1)W=1;let Y=this.getPoint(Z),X=this.getPoint(W),K=Q||(Y.isVector2?new T0:new S);return K.copy(X).sub(Y).normalize(),K}getTangentAt(J,Q){let $=this.getUtoTmapping(J);return this.getTangent($,Q)}computeFrenetFrames(J,Q=!1){let $=new S,Z=[],W=[],Y=[],X=new S,K=new j0;for(let E=0;E<=J;E++){let O=E/J;Z[E]=this.getTangentAt(O,new S)}W[0]=new S,Y[0]=new S;let H=Number.MAX_VALUE,U=Math.abs(Z[0].x),G=Math.abs(Z[0].y),F=Math.abs(Z[0].z);if(U<=H)H=U,$.set(1,0,0);if(G<=H)H=G,$.set(0,1,0);if(F<=H)$.set(0,0,1);X.crossVectors(Z[0],$).normalize(),W[0].crossVectors(Z[0],X),Y[0].crossVectors(Z[0],W[0]);for(let E=1;E<=J;E++){if(W[E]=W[E-1].clone(),Y[E]=Y[E-1].clone(),X.crossVectors(Z[E-1],Z[E]),X.length()>Number.EPSILON){X.normalize();let O=Math.acos(l0(Z[E-1].dot(Z[E]),-1,1));W[E].applyMatrix4(K.makeRotationAxis(X,O))}Y[E].crossVectors(Z[E],W[E])}if(Q===!0){let E=Math.acos(l0(W[0].dot(W[J]),-1,1));if(E/=J,Z[0].dot(X.crossVectors(W[0],W[J]))>0)E=-E;for(let O=1;O<=J;O++)W[O].applyMatrix4(K.makeRotationAxis(Z[O],E*O)),Y[O].crossVectors(Z[O],W[O])}return{tangents:Z,normals:W,binormals:Y}}clone(){return new this.constructor().copy(this)}copy(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}toJSON(){let J={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return J.arcLengthDivisions=this.arcLengthDivisions,J.type=this.type,J}fromJSON(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}}function wZ(){let J=0,Q=0,$=0,Z=0;function W(Y,X,K,H){J=Y,Q=K,$=-3*Y+3*X-2*K-H,Z=2*Y-2*X+K+H}return{initCatmullRom:function(Y,X,K,H,U){W(X,K,U*(K-Y),U*(H-X))},initNonuniformCatmullRom:function(Y,X,K,H,U,G,F){let E=(X-Y)/U-(K-Y)/(U+G)+(K-X)/G,O=(K-X)/G-(H-X)/(G+F)+(H-K)/F;E*=G,O*=G,W(X,K,E,O)},calc:function(Y){let X=Y*Y,K=X*Y;return J+Q*Y+$*X+Z*K}}}var HY=new S,UY=new S,C$=new wZ,I$=new wZ,z$=new wZ;class _Q extends _Z{constructor(J=[],Q=!1,$="centripetal",Z=0.5){super();this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=J,this.closed=Q,this.curveType=$,this.tension=Z}getPoint(J,Q=new S){let $=Q,Z=this.points,W=Z.length,Y=(W-(this.closed?0:1))*J,X=Math.floor(Y),K=Y-X;if(this.closed)X+=X>0?0:(Math.floor(Math.abs(X)/W)+1)*W;else if(K===0&&X===W-1)X=W-2,K=1;let H,U;if(this.closed||X>0)H=Z[(X-1)%W];else UY.subVectors(Z[0],Z[1]).add(Z[0]),H=UY;let G=Z[X%W],F=Z[(X+1)%W];if(this.closed||X+2<W)U=Z[(X+2)%W];else HY.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=HY;if(this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?0.5:0.25,O=Math.pow(H.distanceToSquared(G),E),R=Math.pow(G.distanceToSquared(F),E),C=Math.pow(F.distanceToSquared(U),E);if(R<0.0001)R=1;if(O<0.0001)O=R;if(C<0.0001)C=R;C$.initNonuniformCatmullRom(H.x,G.x,F.x,U.x,O,R,C),I$.initNonuniformCatmullRom(H.y,G.y,F.y,U.y,O,R,C),z$.initNonuniformCatmullRom(H.z,G.z,F.z,U.z,O,R,C)}else if(this.curveType==="catmullrom")C$.initCatmullRom(H.x,G.x,F.x,U.x,this.tension),I$.initCatmullRom(H.y,G.y,F.y,U.y,this.tension),z$.initCatmullRom(H.z,G.z,F.z,U.z,this.tension);return $.set(C$.calc(K),I$.calc(K),z$.calc(K)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J.closed=this.closed,J.curveType=this.curveType,J.tension=this.tension,J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new S().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}}class G7 extends zQ{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=[-1,$,0,1,$,0,-1,-$,0,1,-$,0,0,-1,$,0,1,$,0,-1,-$,0,1,-$,$,0,-1,$,0,1,-$,0,-1,-$,0,1],W=[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];super(Z,W,J,Q);this.type="IcosahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new G7(J.radius,J.detail)}}class C9 extends qJ{constructor(J=1,Q=1,$=1,Z=1){super();this.type="PlaneGeometry",this.parameters={width:J,height:Q,widthSegments:$,heightSegments:Z};let W=J/2,Y=Q/2,X=Math.floor($),K=Math.floor(Z),H=X+1,U=K+1,G=J/X,F=Q/K,E=[],O=[],R=[],C=[];for(let q=0;q<U;q++){let N=q*F-Y;for(let L=0;L<H;L++){let k=L*G-W;O.push(k,-N,0),R.push(0,0,1),C.push(L/X),C.push(1-q/K)}}for(let q=0;q<K;q++)for(let N=0;N<X;N++){let L=N+H*q,k=N+H*(q+1),M=N+1+H*(q+1),P=N+1+H*q;E.push(L,k,P),E.push(k,M,P)}this.setIndex(E),this.setAttribute("position",new WJ(O,3)),this.setAttribute("normal",new WJ(R,3)),this.setAttribute("uv",new WJ(C,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new C9(J.width,J.height,J.widthSegments,J.heightSegments)}}class E7 extends qJ{constructor(J=1,Q=32,$=16,Z=0,W=Math.PI*2,Y=0,X=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:Z,phiLength:W,thetaStart:Y,thetaLength:X},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let K=Math.min(Y+X,Math.PI),H=0,U=[],G=new S,F=new S,E=[],O=[],R=[],C=[];for(let q=0;q<=$;q++){let N=[],L=q/$,k=0;if(q===0&&Y===0)k=0.5/Q;else if(q===$&&K===Math.PI)k=-0.5/Q;for(let M=0;M<=Q;M++){let P=M/Q;G.x=-J*Math.cos(Z+P*W)*Math.sin(Y+L*X),G.y=J*Math.cos(Y+L*X),G.z=J*Math.sin(Z+P*W)*Math.sin(Y+L*X),O.push(G.x,G.y,G.z),F.copy(G).normalize(),R.push(F.x,F.y,F.z),C.push(P+k,1-L),N.push(H++)}U.push(N)}for(let q=0;q<$;q++)for(let N=0;N<Q;N++){let L=U[q][N+1],k=U[q][N],M=U[q+1][N],P=U[q+1][N+1];if(q!==0||Y>0)E.push(L,k,P);if(q!==$-1||K<Math.PI)E.push(k,M,P)}this.setIndex(E),this.setAttribute("position",new WJ(O,3)),this.setAttribute("normal",new WJ(R,3)),this.setAttribute("uv",new WJ(C,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new E7(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class F7 extends qJ{constructor(J=1,Q=0.4,$=12,Z=48,W=Math.PI*2,Y=0,X=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:Z,arc:W,thetaStart:Y,thetaLength:X},$=Math.floor($),Z=Math.floor(Z);let K=[],H=[],U=[],G=[],F=new S,E=new S,O=new S;for(let R=0;R<=$;R++){let C=Y+R/$*X;for(let q=0;q<=Z;q++){let N=q/Z*W;E.x=(J+Q*Math.cos(C))*Math.cos(N),E.y=(J+Q*Math.cos(C))*Math.sin(N),E.z=Q*Math.sin(C),H.push(E.x,E.y,E.z),F.x=J*Math.cos(N),F.y=J*Math.sin(N),O.subVectors(E,F).normalize(),U.push(O.x,O.y,O.z),G.push(q/Z),G.push(R/$)}}for(let R=1;R<=$;R++)for(let C=1;C<=Z;C++){let q=(Z+1)*R+C-1,N=(Z+1)*(R-1)+C-1,L=(Z+1)*(R-1)+C,k=(Z+1)*R+C;K.push(q,N,k),K.push(N,L,k)}this.setIndex(K),this.setAttribute("position",new WJ(H,3)),this.setAttribute("normal",new WJ(U,3)),this.setAttribute("uv",new WJ(G,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new F7(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}function f8(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(GY(W))if(W.isRenderTargetTexture)C0("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Q[$][Z]=null;else Q[$][Z]=W.clone();else if(Array.isArray(W))if(GY(W[0])){let Y=[];for(let X=0,K=W.length;X<K;X++)Y[X]=W[X].clone();Q[$][Z]=Y}else Q[$][Z]=W.slice();else Q[$][Z]=W}}return Q}function pJ(J){let Q={};for(let $=0;$<J.length;$++){let Z=f8(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function GY(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function RU(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function PZ(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return u0.workingColorSpace}var rJ={clone:f8,merge:pJ},LU=`void main() {
1
+ var y1=Object.defineProperty;var x1=(J)=>J;function b1(J,Q){this[J]=x1.bind(null,Q)}var h1=(J,Q)=>{for(var $ in Q)y1(J,$,{get:Q[$],enumerable:!0,configurable:!0,set:b1.bind(Q,$)})};var QY={};h1(QY,{warnOnce:()=>VQ,warn:()=>O0,setConsoleFunction:()=>X5,log:()=>B7,getConsoleFunction:()=>K5,error:()=>v0,createCanvasElement:()=>tX,ZeroStencilOp:()=>AG,ZeroSlopeEnding:()=>DG,ZeroFactor:()=>NX,ZeroCurvatureEnding:()=>LG,WrapAroundEnding:()=>MG,WireframeGeometry:()=>_W,WebXRController:()=>f7,WebGPUCoordinateSystem:()=>J5,WebGLUtils:()=>YE,WebGLRenderer:()=>JY,WebGLRenderTarget:()=>PJ,WebGLCubeRenderTarget:()=>tW,WebGLCoordinateSystem:()=>OW,WebGLArrayRenderTarget:()=>JK,WebGL3DRenderTarget:()=>QK,VideoTexture:()=>MW,VideoFrameTexture:()=>HK,VectorKeyframeTrack:()=>H8,Vector4:()=>FJ,Vector3:()=>A,Vector2:()=>i,VSMShadowMap:()=>I6,UnsignedShortType:()=>v7,UnsignedShort5551Type:()=>AZ,UnsignedShort4444Type:()=>PZ,UnsignedIntType:()=>w8,UnsignedInt5999Type:()=>pX,UnsignedInt248Type:()=>T6,UnsignedInt101111Type:()=>uX,UnsignedByteType:()=>j9,UniformsUtils:()=>K9,UniformsLib:()=>D0,UniformsGroup:()=>SK,Uniform:()=>nW,Uint8ClampedBufferAttribute:()=>WK,Uint8BufferAttribute:()=>ZK,Uint32BufferAttribute:()=>dQ,Uint16BufferAttribute:()=>uQ,UVMapping:()=>XG,TubeGeometry:()=>K$,TrianglesDrawMode:()=>GW,TriangleStripDrawMode:()=>y7,TriangleFanDrawMode:()=>S6,Triangle:()=>Y9,TorusKnotGeometry:()=>X$,TorusGeometry:()=>g6,TimestampQuery:()=>Q5,Timer:()=>a7,TextureUtils:()=>QH,TextureLoader:()=>d6,Texture:()=>kJ,TetrahedronGeometry:()=>Y$,TangentSpaceNormalMap:()=>EW,TOUCH:()=>JG,SubtractiveBlending:()=>zZ,SubtractEquation:()=>UX,StringKeyframeTrack:()=>j8,StreamReadUsage:()=>oG,StreamDrawUsage:()=>nG,StreamCopyUsage:()=>tG,StereoCamera:()=>CK,StaticReadUsage:()=>sG,StaticDrawUsage:()=>cG,StaticCopyUsage:()=>aG,SrcColorFactor:()=>qX,SrcAlphaSaturateFactor:()=>CX,SrcAlphaFactor:()=>LX,SpriteMaterial:()=>mQ,Sprite:()=>RW,SpotLightHelper:()=>pK,SpotLight:()=>o7,SplineCurve:()=>J$,SphericalHarmonics3:()=>O$,Spherical:()=>bK,SphereGeometry:()=>Z6,Sphere:()=>_J,Source:()=>X8,SkinnedMesh:()=>g7,SkeletonHelper:()=>uK,Skeleton:()=>x6,ShortType:()=>gX,ShapeUtils:()=>P9,ShapePath:()=>eK,ShapeGeometry:()=>W$,Shape:()=>z8,ShadowMaterial:()=>wW,ShaderMaterial:()=>LJ,ShaderLib:()=>e9,ShaderChunk:()=>ZJ,Scene:()=>e8,SRGBTransfer:()=>OJ,SRGBColorSpace:()=>a9,SIGNED_RG11_EAC_Format:()=>dZ,SIGNED_RED_RGTC1_Format:()=>KW,SIGNED_RED_GREEN_RGTC2_Format:()=>HW,SIGNED_R11_EAC_Format:()=>uZ,RingGeometry:()=>Z$,ReverseSubtractEquation:()=>GX,ReplaceStencilOp:()=>SG,RepeatWrapping:()=>_8,RenderTarget3D:()=>TK,RenderTarget:()=>fQ,ReinhardToneMapping:()=>w7,RedIntegerFormat:()=>TZ,RedFormat:()=>lX,RectAreaLight:()=>hW,Raycaster:()=>yK,Ray:()=>Q6,RawShaderMaterial:()=>u6,RGIntegerFormat:()=>SZ,RGFormat:()=>r8,RGDepthPacking:()=>IG,RGB_S3TC_DXT1_Format:()=>AQ,RGB_PVRTC_4BPPV1_Format:()=>vZ,RGB_PVRTC_2BPPV1_Format:()=>yZ,RGB_ETC2_Format:()=>fZ,RGB_ETC1_Format:()=>hZ,RGB_BPTC_UNSIGNED_Format:()=>YW,RGB_BPTC_SIGNED_Format:()=>WW,RGBIntegerFormat:()=>EG,RGBFormat:()=>mX,RGBDepthPacking:()=>zG,RGBA_S3TC_DXT5_Format:()=>jQ,RGBA_S3TC_DXT3_Format:()=>SQ,RGBA_S3TC_DXT1_Format:()=>TQ,RGBA_PVRTC_4BPPV1_Format:()=>xZ,RGBA_PVRTC_2BPPV1_Format:()=>bZ,RGBA_ETC2_EAC_Format:()=>gZ,RGBA_BPTC_Format:()=>ZW,RGBA_ASTC_8x8_Format:()=>aZ,RGBA_ASTC_8x6_Format:()=>oZ,RGBA_ASTC_8x5_Format:()=>iZ,RGBA_ASTC_6x6_Format:()=>sZ,RGBA_ASTC_6x5_Format:()=>nZ,RGBA_ASTC_5x5_Format:()=>cZ,RGBA_ASTC_5x4_Format:()=>lZ,RGBA_ASTC_4x4_Format:()=>mZ,RGBA_ASTC_12x12_Format:()=>$W,RGBA_ASTC_12x10_Format:()=>QW,RGBA_ASTC_10x8_Format:()=>eZ,RGBA_ASTC_10x6_Format:()=>tZ,RGBA_ASTC_10x5_Format:()=>rZ,RGBA_ASTC_10x10_Format:()=>JW,RGBAIntegerFormat:()=>jZ,RGBAFormat:()=>o9,RGBADepthPacking:()=>CG,RG11_EAC_Format:()=>vQ,REVISION:()=>WX,RED_RGTC1_Format:()=>XW,RED_GREEN_RGTC2_Format:()=>yQ,R11_EAC_Format:()=>pZ,QuaternionLinearInterpolant:()=>xW,QuaternionKeyframeTrack:()=>F8,Quaternion:()=>zJ,QuadraticBezierCurve3:()=>eQ,QuadraticBezierCurve:()=>tQ,PropertyMixer:()=>lW,PropertyBinding:()=>GJ,PositionalAudio:()=>IK,PolyhedronGeometry:()=>T8,PolarGridHelper:()=>cK,PointsMaterial:()=>b6,Points:()=>r9,PointLightHelper:()=>dK,PointLight:()=>N8,PlaneHelper:()=>aK,PlaneGeometry:()=>z9,Plane:()=>w9,PerspectiveCamera:()=>BJ,Path:()=>C7,PMREMGenerator:()=>c6,PCFSoftShadowMap:()=>KX,PCFShadowMap:()=>I7,OrthographicCamera:()=>t9,OneMinusSrcColorFactor:()=>RX,OneMinusSrcAlphaFactor:()=>DX,OneMinusDstColorFactor:()=>BX,OneMinusDstAlphaFactor:()=>kX,OneMinusConstantColorFactor:()=>IX,OneMinusConstantAlphaFactor:()=>wX,OneFactor:()=>OX,OctahedronGeometry:()=>c7,ObjectSpaceNormalMap:()=>cX,ObjectLoader:()=>VK,Object3D:()=>HJ,NumberKeyframeTrack:()=>K8,NotEqualStencilFunc:()=>dG,NotEqualDepth:()=>yX,NotEqualCompare:()=>aX,NormalRGPacking:()=>wG,NormalGAPacking:()=>PG,NormalBlending:()=>l8,NormalAnimationBlendMode:()=>kG,NoToneMapping:()=>F9,NoNormalPacking:()=>_G,NoColorSpace:()=>t8,NoBlending:()=>V9,NeverStencilFunc:()=>hG,NeverDepth:()=>PX,NeverCompare:()=>nX,NeutralToneMapping:()=>S7,NearestMipmapNearestFilter:()=>PQ,NearestMipmapLinearFilter:()=>i8,NearestMipMapNearestFilter:()=>KG,NearestMipMapLinearFilter:()=>HG,NearestFilter:()=>S9,MultiplyOperation:()=>xX,MultiplyBlending:()=>IZ,MixOperation:()=>bX,MirroredRepeatWrapping:()=>wQ,MinEquation:()=>EX,MeshToonMaterial:()=>AW,MeshStandardMaterial:()=>iJ,MeshPhysicalMaterial:()=>oJ,MeshPhongMaterial:()=>PW,MeshNormalMaterial:()=>TW,MeshMatcapMaterial:()=>s7,MeshLambertMaterial:()=>n7,MeshDistanceMaterial:()=>U$,MeshDepthMaterial:()=>H$,MeshBasicMaterial:()=>nJ,Mesh:()=>a0,MaxEquation:()=>FX,Matrix4:()=>y0,Matrix3:()=>o0,Matrix2:()=>sW,MathUtils:()=>v6,MaterialLoader:()=>q$,MaterialBlending:()=>ZG,Material:()=>vJ,MOUSE:()=>eU,LoopRepeat:()=>NG,LoopPingPong:()=>OG,LoopOnce:()=>FG,LoadingManager:()=>F$,LoaderUtils:()=>n9,Loader:()=>sJ,LinearTransfer:()=>FW,LinearToneMapping:()=>_7,LinearSRGBColorSpace:()=>J9,LinearMipmapNearestFilter:()=>A6,LinearMipmapLinearFilter:()=>i9,LinearMipMapNearestFilter:()=>UG,LinearMipMapLinearFilter:()=>GG,LinearInterpolant:()=>G$,LinearFilter:()=>jJ,LineSegments:()=>O9,LineLoop:()=>p7,LineDashedMaterial:()=>SW,LineCurve3:()=>zW,LineCurve:()=>rQ,LineBasicMaterial:()=>dJ,Line3:()=>gK,Line:()=>T9,LightProbe:()=>fW,Light:()=>v9,LessStencilFunc:()=>fG,LessEqualStencilFunc:()=>pG,LessEqualDepth:()=>_Z,LessEqualCompare:()=>bQ,LessDepth:()=>TX,LessCompare:()=>sX,Layers:()=>h7,LatheGeometry:()=>$$,LOD:()=>LW,KeyframeTrack:()=>q9,KeepStencilOp:()=>TG,InvertStencilOp:()=>bG,InterpolationSamplingType:()=>$5,InterpolationSamplingMode:()=>Z5,InterpolateSmooth:()=>qG,InterpolateLinear:()=>xQ,InterpolateDiscrete:()=>UW,InterpolateBezier:()=>RG,Interpolant:()=>E8,InterleavedBufferAttribute:()=>l9,InterleavedBuffer:()=>P8,IntType:()=>wZ,Int8BufferAttribute:()=>$K,Int32BufferAttribute:()=>XK,Int16BufferAttribute:()=>YK,InstancedMesh:()=>U8,InstancedInterleavedBuffer:()=>jK,InstancedBufferGeometry:()=>gW,InstancedBufferAttribute:()=>c9,IncrementWrapStencilOp:()=>yG,IncrementStencilOp:()=>jG,ImageUtils:()=>qW,ImageLoader:()=>z6,ImageBitmapLoader:()=>R$,IcosahedronGeometry:()=>f6,HemisphereLightHelper:()=>mK,HemisphereLight:()=>W6,HalfFloatType:()=>wJ,HTMLTexture:()=>FK,Group:()=>G9,GridHelper:()=>lK,GreaterStencilFunc:()=>uG,GreaterEqualStencilFunc:()=>mG,GreaterEqualDepth:()=>jX,GreaterEqualCompare:()=>hQ,GreaterDepth:()=>vX,GreaterCompare:()=>oX,GLSL3:()=>NW,GLSL1:()=>eG,GLBufferAttribute:()=>vK,FrustumArray:()=>lQ,Frustum:()=>G8,FrontSide:()=>s9,FramebufferTexture:()=>UK,FogExp2:()=>gQ,Fog:()=>pQ,FloatType:()=>N9,Float32BufferAttribute:()=>z0,Float16BufferAttribute:()=>KK,FileLoader:()=>E9,ExtrudeGeometry:()=>Q$,ExternalTexture:()=>nQ,EventDispatcher:()=>B9,Euler:()=>A9,EquirectangularRefractionMapping:()=>_Q,EquirectangularReflectionMapping:()=>IQ,EqualStencilFunc:()=>gG,EqualDepth:()=>SX,EqualCompare:()=>iX,EllipseCurve:()=>m7,EdgesGeometry:()=>VW,DynamicReadUsage:()=>iG,DynamicDrawUsage:()=>j6,DynamicCopyUsage:()=>rG,DstColorFactor:()=>VX,DstAlphaFactor:()=>MX,DoubleSide:()=>X9,DodecahedronGeometry:()=>oQ,DiscreteInterpolant:()=>vW,DirectionalLightHelper:()=>nK,DirectionalLight:()=>y9,DetachedBindMode:()=>YG,DepthTexture:()=>A8,DepthStencilFormat:()=>a8,DepthFormat:()=>o8,DefaultLoadingManager:()=>LK,DecrementWrapStencilOp:()=>xG,DecrementStencilOp:()=>vG,DataUtils:()=>J6,DataTextureLoader:()=>N$,DataTexture:()=>k9,DataArrayTexture:()=>x7,Data3DTexture:()=>b7,Cylindrical:()=>hK,CylinderGeometry:()=>$6,CustomToneMapping:()=>A7,CustomBlending:()=>HX,CurvePath:()=>IW,Curve:()=>C9,CullFaceNone:()=>YX,CullFaceFrontBack:()=>QG,CullFaceFront:()=>XX,CullFaceBack:()=>CZ,CubicInterpolant:()=>jW,CubicBezierCurve3:()=>CW,CubicBezierCurve:()=>aQ,CubeUVReflectionMapping:()=>j7,CubeTextureLoader:()=>kK,CubeTexture:()=>h6,CubeRefractionMapping:()=>s8,CubeReflectionMapping:()=>w6,CubeDepthTexture:()=>kW,CubeCamera:()=>uW,Controls:()=>JH,ConstantColorFactor:()=>zX,ConstantAlphaFactor:()=>_X,ConeGeometry:()=>d7,CompressedTextureLoader:()=>MK,CompressedTexture:()=>u7,CompressedCubeTexture:()=>EK,CompressedArrayTexture:()=>GK,Compatibility:()=>W5,ColorManagement:()=>t0,ColorKeyframeTrack:()=>E$,Color:()=>e,Clock:()=>xK,ClampToEdgeWrapping:()=>P6,CircleGeometry:()=>iQ,CineonToneMapping:()=>P7,CatmullRomCurve3:()=>l7,CapsuleGeometry:()=>sQ,CanvasTexture:()=>cQ,CameraHelper:()=>sK,Camera:()=>i7,Cache:()=>m9,ByteType:()=>fX,BufferGeometryLoader:()=>pW,BufferGeometry:()=>u0,BufferAttribute:()=>i0,BoxHelper:()=>iK,BoxGeometry:()=>Q9,Box3Helper:()=>oK,Box3:()=>SJ,Box2:()=>fK,BooleanKeyframeTrack:()=>S8,Bone:()=>y6,BezierInterpolant:()=>yW,BatchedMesh:()=>DW,BasicShadowMap:()=>$G,BasicDepthPacking:()=>BG,BackSide:()=>uJ,AxesHelper:()=>tK,AudioLoader:()=>BK,AudioListener:()=>zK,AudioContext:()=>L$,AudioAnalyser:()=>_K,Audio:()=>mW,AttachedBindMode:()=>WG,ArrowHelper:()=>rK,ArrayCamera:()=>dW,ArcCurve:()=>BW,AnimationUtils:()=>RK,AnimationObjectGroup:()=>AK,AnimationMixer:()=>D$,AnimationLoader:()=>DK,AnimationClip:()=>I8,AnimationAction:()=>cW,AmbientLight:()=>m6,AlwaysStencilFunc:()=>lG,AlwaysDepth:()=>AX,AlwaysCompare:()=>rX,AlphaFormat:()=>dX,AgXToneMapping:()=>T7,AdditiveBlending:()=>c8,AdditiveAnimationBlendMode:()=>VG,AddOperation:()=>hX,AddEquation:()=>_6,ACESFilmicToneMapping:()=>n8});var WX="184",eU={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},JG={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},YX=0,CZ=1,XX=2,QG=3,$G=0,I7=1,KX=2,I6=3,s9=0,uJ=1,X9=2,V9=0,l8=1,c8=2,zZ=3,IZ=4,HX=5,ZG=6,_6=100,UX=101,GX=102,EX=103,FX=104,NX=200,OX=201,qX=202,RX=203,LX=204,DX=205,MX=206,kX=207,VX=208,BX=209,CX=210,zX=211,IX=212,_X=213,wX=214,PX=0,AX=1,TX=2,_Z=3,SX=4,jX=5,vX=6,yX=7,xX=0,bX=1,hX=2,F9=0,_7=1,w7=2,P7=3,n8=4,A7=5,T7=6,S7=7,WG="attached",YG="detached",XG=300,w6=301,s8=302,IQ=303,_Q=304,j7=306,_8=1000,P6=1001,wQ=1002,S9=1003,PQ=1004,KG=1004,i8=1005,HG=1005,jJ=1006,A6=1007,UG=1007,i9=1008,GG=1008,j9=1009,fX=1010,gX=1011,v7=1012,wZ=1013,w8=1014,N9=1015,wJ=1016,PZ=1017,AZ=1018,T6=1020,pX=35902,uX=35899,dX=1021,mX=1022,o9=1023,o8=1026,a8=1027,lX=1028,TZ=1029,r8=1030,SZ=1031,EG=1032,jZ=1033,AQ=33776,TQ=33777,SQ=33778,jQ=33779,vZ=35840,yZ=35841,xZ=35842,bZ=35843,hZ=36196,fZ=37492,gZ=37496,pZ=37488,uZ=37489,vQ=37490,dZ=37491,mZ=37808,lZ=37809,cZ=37810,nZ=37811,sZ=37812,iZ=37813,oZ=37814,aZ=37815,rZ=37816,tZ=37817,eZ=37818,JW=37819,QW=37820,$W=37821,ZW=36492,WW=36494,YW=36495,XW=36283,KW=36284,yQ=36285,HW=36286,FG=2200,NG=2201,OG=2202,UW=2300,xQ=2301,qG=2302,RG=2303,LG=2400,DG=2401,MG=2402,kG=2500,VG=2501,GW=0,y7=1,S6=2,BG=3200,CG=3201,zG=3202,IG=3203,EW=0,cX=1,t8="",a9="srgb",J9="srgb-linear",FW="linear",OJ="srgb",_G="",wG="rg",PG="ga",AG=0,TG=7680,SG=7681,jG=7682,vG=7683,yG=34055,xG=34056,bG=5386,hG=512,fG=513,gG=514,pG=515,uG=516,dG=517,mG=518,lG=519,nX=512,sX=513,iX=514,bQ=515,oX=516,aX=517,hQ=518,rX=519,cG=35044,j6=35048,nG=35040,sG=35045,iG=35049,oG=35041,aG=35046,rG=35050,tG=35042,eG="100",NW="300 es",OW=2000,J5=2001,Q5={COMPUTE:"compute",RENDER:"render"},$5={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Z5={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},W5={TEXTURE_COMPARE:"depthTextureCompare"};function f1(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}var g1={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function M7(J,Q){return new g1[J](Q)}function Y5(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function V7(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function tX(){let J=V7("canvas");return J.style.display="block",J}var lH={},m8=null;function X5(J){m8=J}function K5(){return m8}function B7(...J){let Q="THREE."+J.shift();if(m8)m8("log",Q,...J);else console.log(Q,...J)}function H5(J){let Q=J[0];if(typeof Q==="string"&&Q.startsWith("TSL:")){let $=J[1];if($&&$.isStackTrace)J[0]+=" "+$.getLocation();else J[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return J}function O0(...J){J=H5(J);let Q="THREE."+J.shift();if(m8)m8("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function v0(...J){J=H5(J);let Q="THREE."+J.shift();if(m8)m8("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function VQ(...J){let Q=J.join(" ");if(Q in lH)return;lH[Q]=!0,O0(...J)}function U5(J,Q,$){return new Promise(function(Z,W){function Y(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:W();break;case J.TIMEOUT_EXPIRED:setTimeout(Y,$);break;default:Z()}}setTimeout(Y,$)})}var G5={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class B9{addEventListener(J,Q){if(this._listeners===void 0)this._listeners={};let $=this._listeners;if($[J]===void 0)$[J]=[];if($[J].indexOf(Q)===-1)$[J].push(Q)}hasEventListener(J,Q){let $=this._listeners;if($===void 0)return!1;return $[J]!==void 0&&$[J].indexOf(Q)!==-1}removeEventListener(J,Q){let $=this._listeners;if($===void 0)return;let Z=$[J];if(Z!==void 0){let W=Z.indexOf(Q);if(W!==-1)Z.splice(W,1)}}dispatchEvent(J){let Q=this._listeners;if(Q===void 0)return;let $=Q[J.type];if($!==void 0){J.target=this;let Z=$.slice(0);for(let W=0,Y=Z.length;W<Y;W++)Z[W].call(this,J);J.target=null}}}var rJ=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],cH=1234567,V6=Math.PI/180,B6=180/Math.PI;function M9(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,Z=Math.random()*4294967295|0;return(rJ[J&255]+rJ[J>>8&255]+rJ[J>>16&255]+rJ[J>>24&255]+"-"+rJ[Q&255]+rJ[Q>>8&255]+"-"+rJ[Q>>16&15|64]+rJ[Q>>24&255]+"-"+rJ[$&63|128]+rJ[$>>8&255]+"-"+rJ[$>>16&255]+rJ[$>>24&255]+rJ[Z&255]+rJ[Z>>8&255]+rJ[Z>>16&255]+rJ[Z>>24&255]).toLowerCase()}function s0(J,Q,$){return Math.max(Q,Math.min($,J))}function eX(J,Q){return(J%Q+Q)%Q}function p1(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function u1(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function DQ(J,Q,$){return(1-$)*J+$*Q}function d1(J,Q,$,Z){return DQ(J,Q,1-Math.exp(-$*Z))}function m1(J,Q=1){return Q-Math.abs(eX(J,Q*2)-Q)}function l1(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function c1(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*J*(J*(J*6-15)+10)}function n1(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function s1(J,Q){return J+Math.random()*(Q-J)}function i1(J){return J*(0.5-Math.random())}function o1(J){if(J!==void 0)cH=J;let Q=cH+=1831565813;return Q=Math.imul(Q^Q>>>15,Q|1),Q^=Q+Math.imul(Q^Q>>>7,Q|61),((Q^Q>>>14)>>>0)/4294967296}function a1(J){return J*V6}function r1(J){return J*B6}function t1(J){return(J&J-1)===0&&J!==0}function e1(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function JF(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function QF(J,Q,$,Z,W){let{cos:Y,sin:X}=Math,K=Y($/2),H=X($/2),U=Y((Q+Z)/2),G=X((Q+Z)/2),F=Y((Q-Z)/2),E=X((Q-Z)/2),O=Y((Z-Q)/2),R=X((Z-Q)/2);switch(W){case"XYX":J.set(K*G,H*F,H*E,K*U);break;case"YZY":J.set(H*E,K*G,H*F,K*U);break;case"ZXZ":J.set(H*F,H*E,K*G,K*U);break;case"XZX":J.set(K*G,H*R,H*O,K*U);break;case"YXY":J.set(H*O,K*G,H*R,K*U);break;case"ZYZ":J.set(H*R,H*O,K*G,K*U);break;default:O0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function W9(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return J/4294967295;case Uint16Array:return J/65535;case Uint8Array:return J/255;case Int32Array:return Math.max(J/2147483647,-1);case Int16Array:return Math.max(J/32767,-1);case Int8Array:return Math.max(J/127,-1);default:throw Error("Invalid component type.")}}function QJ(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return Math.round(J*4294967295);case Uint16Array:return Math.round(J*65535);case Uint8Array:return Math.round(J*255);case Int32Array:return Math.round(J*2147483647);case Int16Array:return Math.round(J*32767);case Int8Array:return Math.round(J*127);default:throw Error("Invalid component type.")}}var v6={DEG2RAD:V6,RAD2DEG:B6,generateUUID:M9,clamp:s0,euclideanModulo:eX,mapLinear:p1,inverseLerp:u1,lerp:DQ,damp:d1,pingpong:m1,smoothstep:l1,smootherstep:c1,randInt:n1,randFloat:s1,randFloatSpread:i1,seededRandom:o1,degToRad:a1,radToDeg:r1,isPowerOfTwo:t1,ceilPowerOfTwo:e1,floorPowerOfTwo:JF,setQuaternionFromProperEuler:QF,normalize:QJ,denormalize:W9};class i{static{i.prototype.isVector2=!0}constructor(J=0,Q=0){this.x=J,this.y=Q}get width(){return this.x}set width(J){this.x=J}get height(){return this.y}set height(J){this.y=J}set(J,Q){return this.x=J,this.y=Q,this}setScalar(J){return this.x=J,this.y=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y)}copy(J){return this.x=J.x,this.y=J.y,this}add(J){return this.x+=J.x,this.y+=J.y,this}addScalar(J){return this.x+=J,this.y+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this}subScalar(J){return this.x-=J,this.y-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this}multiply(J){return this.x*=J.x,this.y*=J.y,this}multiplyScalar(J){return this.x*=J,this.y*=J,this}divide(J){return this.x/=J.x,this.y/=J.y,this}divideScalar(J){return this.multiplyScalar(1/J)}applyMatrix3(J){let Q=this.x,$=this.y,Z=J.elements;return this.x=Z[0]*Q+Z[3]*$+Z[6],this.y=Z[1]*Q+Z[4]*$+Z[7],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this}clamp(J,Q){return this.x=s0(this.x,J.x,Q.x),this.y=s0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=s0(this.x,J,Q),this.y=s0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(s0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(J){return this.x*J.x+this.y*J.y}cross(J){return this.x*J.y-this.y*J.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(s0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y;return Q*Q+$*$}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this}equals(J){return J.x===this.x&&J.y===this.y}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this}rotateAround(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=this.x-J.x,Y=this.y-J.y;return this.x=W*$-Y*Z+J.x,this.y=W*Z+Y*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class zJ{constructor(J=0,Q=0,$=0,Z=1){this.isQuaternion=!0,this._x=J,this._y=Q,this._z=$,this._w=Z}static slerpFlat(J,Q,$,Z,W,Y,X){let K=$[Z+0],H=$[Z+1],U=$[Z+2],G=$[Z+3],F=W[Y+0],E=W[Y+1],O=W[Y+2],R=W[Y+3];if(G!==R||K!==F||H!==E||U!==O){let M=K*F+H*E+U*O+G*R;if(M<0)F=-F,E=-E,O=-O,R=-R,M=-M;let q=1-X;if(M<0.9995){let N=Math.acos(M),L=Math.sin(N);q=Math.sin(q*N)/L,X=Math.sin(X*N)/L,K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X}else{K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X;let N=1/Math.sqrt(K*K+H*H+U*U+G*G);K*=N,H*=N,U*=N,G*=N}}J[Q]=K,J[Q+1]=H,J[Q+2]=U,J[Q+3]=G}static multiplyQuaternionsFlat(J,Q,$,Z,W,Y){let X=$[Z],K=$[Z+1],H=$[Z+2],U=$[Z+3],G=W[Y],F=W[Y+1],E=W[Y+2],O=W[Y+3];return J[Q]=X*O+U*G+K*E-H*F,J[Q+1]=K*O+U*F+H*G-X*E,J[Q+2]=H*O+U*E+X*F-K*G,J[Q+3]=U*O-X*G-K*F-H*E,J}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get w(){return this._w}set w(J){this._w=J,this._onChangeCallback()}set(J,Q,$,Z){return this._x=J,this._y=Q,this._z=$,this._w=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(J){return this._x=J.x,this._y=J.y,this._z=J.z,this._w=J.w,this._onChangeCallback(),this}setFromEuler(J,Q=!0){let{_x:$,_y:Z,_z:W,_order:Y}=J,X=Math.cos,K=Math.sin,H=X($/2),U=X(Z/2),G=X(W/2),F=K($/2),E=K(Z/2),O=K(W/2);switch(Y){case"XYZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"YXZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"ZXY":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"ZYX":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"YZX":this._x=F*U*G+H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G-F*E*O;break;case"XZY":this._x=F*U*G-H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G+F*E*O;break;default:O0("Quaternion: .setFromEuler() encountered an unknown order: "+Y)}if(Q===!0)this._onChangeCallback();return this}setFromAxisAngle(J,Q){let $=Q/2,Z=Math.sin($);return this._x=J.x*Z,this._y=J.y*Z,this._z=J.z*Z,this._w=Math.cos($),this._onChangeCallback(),this}setFromRotationMatrix(J){let Q=J.elements,$=Q[0],Z=Q[4],W=Q[8],Y=Q[1],X=Q[5],K=Q[9],H=Q[2],U=Q[6],G=Q[10],F=$+X+G;if(F>0){let E=0.5/Math.sqrt(F+1);this._w=0.25/E,this._x=(U-K)*E,this._y=(W-H)*E,this._z=(Y-Z)*E}else if($>X&&$>G){let E=2*Math.sqrt(1+$-X-G);this._w=(U-K)/E,this._x=0.25*E,this._y=(Z+Y)/E,this._z=(W+H)/E}else if(X>G){let E=2*Math.sqrt(1+X-$-G);this._w=(W-H)/E,this._x=(Z+Y)/E,this._y=0.25*E,this._z=(K+U)/E}else{let E=2*Math.sqrt(1+G-$-X);this._w=(Y-Z)/E,this._x=(W+H)/E,this._y=(K+U)/E,this._z=0.25*E}return this._onChangeCallback(),this}setFromUnitVectors(J,Q){let $=J.dot(Q)+1;if($<0.00000001)if($=0,Math.abs(J.x)>Math.abs(J.z))this._x=-J.y,this._y=J.x,this._z=0,this._w=$;else this._x=0,this._y=-J.z,this._z=J.y,this._w=$;else this._x=J.y*Q.z-J.z*Q.y,this._y=J.z*Q.x-J.x*Q.z,this._z=J.x*Q.y-J.y*Q.x,this._w=$;return this.normalize()}angleTo(J){return 2*Math.acos(Math.abs(s0(this.dot(J),-1,1)))}rotateTowards(J,Q){let $=this.angleTo(J);if($===0)return this;let Z=Math.min(1,Q/$);return this.slerp(J,Z),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(J){return this._x*J._x+this._y*J._y+this._z*J._z+this._w*J._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let J=this.length();if(J===0)this._x=0,this._y=0,this._z=0,this._w=1;else J=1/J,this._x=this._x*J,this._y=this._y*J,this._z=this._z*J,this._w=this._w*J;return this._onChangeCallback(),this}multiply(J){return this.multiplyQuaternions(this,J)}premultiply(J){return this.multiplyQuaternions(J,this)}multiplyQuaternions(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=Q._x,K=Q._y,H=Q._z,U=Q._w;return this._x=$*U+Y*X+Z*H-W*K,this._y=Z*U+Y*K+W*X-$*H,this._z=W*U+Y*H+$*K-Z*X,this._w=Y*U-$*X-Z*K-W*H,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=this.dot(J);if(X<0)$=-$,Z=-Z,W=-W,Y=-Y,X=-X;let K=1-Q;if(X<0.9995){let H=Math.acos(X),U=Math.sin(H);K=Math.sin(K*H)/U,Q=Math.sin(Q*H)/U,this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this._onChangeCallback()}else this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this.normalize();return this}slerpQuaternions(J,Q,$){return this.copy(J).slerp(Q,$)}random(){let J=2*Math.PI*Math.random(),Q=2*Math.PI*Math.random(),$=Math.random(),Z=Math.sqrt(1-$),W=Math.sqrt($);return this.set(Z*Math.sin(J),Z*Math.cos(J),W*Math.sin(Q),W*Math.cos(Q))}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._w===this._w}fromArray(J,Q=0){return this._x=J[Q],this._y=J[Q+1],this._z=J[Q+2],this._w=J[Q+3],this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._w,J}fromBufferAttribute(J,Q){return this._x=J.getX(Q),this._y=J.getY(Q),this._z=J.getZ(Q),this._w=J.getW(Q),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class A{static{A.prototype.isVector3=!0}constructor(J=0,Q=0,$=0){this.x=J,this.y=Q,this.z=$}set(J,Q,$){if($===void 0)$=this.z;return this.x=J,this.y=Q,this.z=$,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this}multiplyVectors(J,Q){return this.x=J.x*Q.x,this.y=J.y*Q.y,this.z=J.z*Q.z,this}applyEuler(J){return this.applyQuaternion(nH.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(nH.setFromAxisAngle(J,Q))}applyMatrix3(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[3]*$+W[6]*Z,this.y=W[1]*Q+W[4]*$+W[7]*Z,this.z=W[2]*Q+W[5]*$+W[8]*Z,this}applyNormalMatrix(J){return this.applyMatrix3(J).normalize()}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements,Y=1/(W[3]*Q+W[7]*$+W[11]*Z+W[15]);return this.x=(W[0]*Q+W[4]*$+W[8]*Z+W[12])*Y,this.y=(W[1]*Q+W[5]*$+W[9]*Z+W[13])*Y,this.z=(W[2]*Q+W[6]*$+W[10]*Z+W[14])*Y,this}applyQuaternion(J){let Q=this.x,$=this.y,Z=this.z,W=J.x,Y=J.y,X=J.z,K=J.w,H=2*(Y*Z-X*$),U=2*(X*Q-W*Z),G=2*(W*$-Y*Q);return this.x=Q+K*H+Y*G-X*U,this.y=$+K*U+X*H-W*G,this.z=Z+K*G+W*U-Y*H,this}project(J){return this.applyMatrix4(J.matrixWorldInverse).applyMatrix4(J.projectionMatrix)}unproject(J){return this.applyMatrix4(J.projectionMatrixInverse).applyMatrix4(J.matrixWorld)}transformDirection(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[4]*$+W[8]*Z,this.y=W[1]*Q+W[5]*$+W[9]*Z,this.z=W[2]*Q+W[6]*$+W[10]*Z,this.normalize()}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this}divideScalar(J){return this.multiplyScalar(1/J)}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this}clamp(J,Q){return this.x=s0(this.x,J.x,Q.x),this.y=s0(this.y,J.y,Q.y),this.z=s0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=s0(this.x,J,Q),this.y=s0(this.y,J,Q),this.z=s0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(s0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this}cross(J){return this.crossVectors(this,J)}crossVectors(J,Q){let{x:$,y:Z,z:W}=J,Y=Q.x,X=Q.y,K=Q.z;return this.x=Z*K-W*X,this.y=W*Y-$*K,this.z=$*X-Z*Y,this}projectOnVector(J){let Q=J.lengthSq();if(Q===0)return this.set(0,0,0);let $=J.dot(this)/Q;return this.copy(J).multiplyScalar($)}projectOnPlane(J){return qY.copy(this).projectOnVector(J),this.sub(qY)}reflect(J){return this.sub(qY.copy(J).multiplyScalar(2*this.dot(J)))}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(s0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y,Z=this.z-J.z;return Q*Q+$*$+Z*Z}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)+Math.abs(this.z-J.z)}setFromSpherical(J){return this.setFromSphericalCoords(J.radius,J.phi,J.theta)}setFromSphericalCoords(J,Q,$){let Z=Math.sin(Q)*J;return this.x=Z*Math.sin($),this.y=Math.cos(Q)*J,this.z=Z*Math.cos($),this}setFromCylindrical(J){return this.setFromCylindricalCoords(J.radius,J.theta,J.y)}setFromCylindricalCoords(J,Q,$){return this.x=J*Math.sin(Q),this.y=$,this.z=J*Math.cos(Q),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this}setFromMatrixScale(J){let Q=this.setFromMatrixColumn(J,0).length(),$=this.setFromMatrixColumn(J,1).length(),Z=this.setFromMatrixColumn(J,2).length();return this.x=Q,this.y=$,this.z=Z,this}setFromMatrixColumn(J,Q){return this.fromArray(J.elements,Q*4)}setFromMatrix3Column(J,Q){return this.fromArray(J.elements,Q*3)}setFromEuler(J){return this.x=J._x,this.y=J._y,this.z=J._z,this}setFromColor(J){return this.x=J.r,this.y=J.g,this.z=J.b,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let J=Math.random()*Math.PI*2,Q=Math.random()*2-1,$=Math.sqrt(1-Q*Q);return this.x=$*Math.cos(J),this.y=Q,this.z=$*Math.sin(J),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var qY=new A,nH=new zJ;class o0{static{o0.prototype.isMatrix3=!0}constructor(J,Q,$,Z,W,Y,X,K,H){if(this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H)}set(J,Q,$,Z,W,Y,X,K,H){let U=this.elements;return U[0]=J,U[1]=Z,U[2]=X,U[3]=Q,U[4]=W,U[5]=K,U[6]=$,U[7]=Y,U[8]=H,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],this}extractBasis(J,Q,$){return J.setFromMatrix3Column(this,0),Q.setFromMatrix3Column(this,1),$.setFromMatrix3Column(this,2),this}setFromMatrix4(J){let Q=J.elements;return this.set(Q[0],Q[4],Q[8],Q[1],Q[5],Q[9],Q[2],Q[6],Q[10]),this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[3],K=$[6],H=$[1],U=$[4],G=$[7],F=$[2],E=$[5],O=$[8],R=Z[0],M=Z[3],q=Z[6],N=Z[1],L=Z[4],D=Z[7],V=Z[2],z=Z[5],I=Z[8];return W[0]=Y*R+X*N+K*V,W[3]=Y*M+X*L+K*z,W[6]=Y*q+X*D+K*I,W[1]=H*R+U*N+G*V,W[4]=H*M+U*L+G*z,W[7]=H*q+U*D+G*I,W[2]=F*R+E*N+O*V,W[5]=F*M+E*L+O*z,W[8]=F*q+E*D+O*I,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[3]*=J,Q[6]*=J,Q[1]*=J,Q[4]*=J,Q[7]*=J,Q[2]*=J,Q[5]*=J,Q[8]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8];return Q*Y*U-Q*X*H-$*W*U+$*X*K+Z*W*H-Z*Y*K}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=U*Y-X*H,F=X*K-U*W,E=H*W-Y*K,O=Q*G+$*F+Z*E;if(O===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/O;return J[0]=G*R,J[1]=(Z*H-U*$)*R,J[2]=(X*$-Z*Y)*R,J[3]=F*R,J[4]=(U*Q-Z*K)*R,J[5]=(Z*W-X*Q)*R,J[6]=E*R,J[7]=($*K-H*Q)*R,J[8]=(Y*Q-$*W)*R,this}transpose(){let J,Q=this.elements;return J=Q[1],Q[1]=Q[3],Q[3]=J,J=Q[2],Q[2]=Q[6],Q[6]=J,J=Q[5],Q[5]=Q[7],Q[7]=J,this}getNormalMatrix(J){return this.setFromMatrix4(J).invert().transpose()}transposeIntoArray(J){let Q=this.elements;return J[0]=Q[0],J[1]=Q[3],J[2]=Q[6],J[3]=Q[1],J[4]=Q[4],J[5]=Q[7],J[6]=Q[2],J[7]=Q[5],J[8]=Q[8],this}setUvTransform(J,Q,$,Z,W,Y,X){let K=Math.cos(W),H=Math.sin(W);return this.set($*K,$*H,-$*(K*Y+H*X)+Y+J,-Z*H,Z*K,-Z*(-H*Y+K*X)+X+Q,0,0,1),this}scale(J,Q){return this.premultiply(RY.makeScale(J,Q)),this}rotate(J){return this.premultiply(RY.makeRotation(-J)),this}translate(J,Q){return this.premultiply(RY.makeTranslation(J,Q)),this}makeTranslation(J,Q){if(J.isVector2)this.set(1,0,J.x,0,1,J.y,0,0,1);else this.set(1,0,J,0,1,Q,0,0,1);return this}makeRotation(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,$,Q,0,0,0,1),this}makeScale(J,Q){return this.set(J,0,0,0,Q,0,0,0,1),this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<9;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<9;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J}clone(){return new this.constructor().fromArray(this.elements)}}var RY=new o0,sH=new o0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),iH=new o0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function $F(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(W,Y,X){if(this.enabled===!1||Y===X||!Y||!X)return W;if(this.spaces[Y].transfer==="srgb")W.r=C8(W.r),W.g=C8(W.g),W.b=C8(W.b);if(this.spaces[Y].primaries!==this.spaces[X].primaries)W.applyMatrix3(this.spaces[Y].toXYZ),W.applyMatrix3(this.spaces[X].fromXYZ);if(this.spaces[X].transfer==="srgb")W.r=k7(W.r),W.g=k7(W.g),W.b=k7(W.b);return W},workingToColorSpace:function(W,Y){return this.convert(W,this.workingColorSpace,Y)},colorSpaceToWorking:function(W,Y){return this.convert(W,Y,this.workingColorSpace)},getPrimaries:function(W){return this.spaces[W].primaries},getTransfer:function(W){if(W==="")return"linear";return this.spaces[W].transfer},getToneMappingMode:function(W){return this.spaces[W].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(W,Y=this.workingColorSpace){return W.fromArray(this.spaces[Y].luminanceCoefficients)},define:function(W){Object.assign(this.spaces,W)},_getMatrix:function(W,Y,X){return W.copy(this.spaces[Y].toXYZ).multiply(this.spaces[X].fromXYZ)},_getDrawingBufferColorSpace:function(W){return this.spaces[W].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(W=this.workingColorSpace){return this.spaces[W].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(W,Y){return VQ("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,Y)},toWorkingColorSpace:function(W,Y){return VQ("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(W,Y)}},Q=[0.64,0.33,0.3,0.6,0.15,0.06],$=[0.2126,0.7152,0.0722],Z=[0.3127,0.329];return J.define({["srgb-linear"]:{primaries:Q,whitePoint:Z,transfer:"linear",toXYZ:sH,fromXYZ:iH,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:sH,fromXYZ:iH,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var t0=$F();function C8(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function k7(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var e6;class qW{static getDataURL(J,Q="image/png"){if(/^data:/i.test(J.src))return J.src;if(typeof HTMLCanvasElement>"u")return J.src;let $;if(J instanceof HTMLCanvasElement)$=J;else{if(e6===void 0)e6=V7("canvas");e6.width=J.width,e6.height=J.height;let Z=e6.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=e6}return $.toDataURL(Q)}static sRGBToLinear(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap){let Q=V7("canvas");Q.width=J.width,Q.height=J.height;let $=Q.getContext("2d");$.drawImage(J,0,0,J.width,J.height);let Z=$.getImageData(0,0,J.width,J.height),W=Z.data;for(let Y=0;Y<W.length;Y++)W[Y]=C8(W[Y]/255)*255;return $.putImageData(Z,0,0),Q}else if(J.data){let Q=J.data.slice(0);for(let $=0;$<Q.length;$++)if(Q instanceof Uint8Array||Q instanceof Uint8ClampedArray)Q[$]=Math.floor(C8(Q[$]/255)*255);else Q[$]=C8(Q[$]);return{data:Q,width:J.width,height:J.height}}else return O0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}var ZF=0;class X8{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ZF++}),this.uuid=M9(),this.data=J,this.dataReady=!0,this.version=0}getSize(J){let Q=this.data;if(typeof HTMLVideoElement<"u"&&Q instanceof HTMLVideoElement)J.set(Q.videoWidth,Q.videoHeight,0);else if(typeof VideoFrame<"u"&&Q instanceof VideoFrame)J.set(Q.displayWidth,Q.displayHeight,0);else if(Q!==null)J.set(Q.width,Q.height,Q.depth||0);else J.set(0,0,0);return J}set needsUpdate(J){if(J===!0)this.version++}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.images[this.uuid]!==void 0)return J.images[this.uuid];let $={uuid:this.uuid,url:""},Z=this.data;if(Z!==null){let W;if(Array.isArray(Z)){W=[];for(let Y=0,X=Z.length;Y<X;Y++)if(Z[Y].isDataTexture)W.push(LY(Z[Y].image));else W.push(LY(Z[Y]))}else W=LY(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function LY(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return qW.getDataURL(J);else if(J.data)return{data:Array.from(J.data),width:J.width,height:J.height,type:J.data.constructor.name};else return O0("Texture: Unable to serialize Texture."),{}}var WF=0,DY=new A;class kJ extends B9{constructor(J=kJ.DEFAULT_IMAGE,Q=kJ.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,Y=1008,X=1023,K=1009,H=kJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:WF++}),this.uuid=M9(),this.name="",this.source=new X8(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=Z,this.magFilter=W,this.minFilter=Y,this.anisotropy=H,this.format=X,this.internalFormat=null,this.type=K,this.offset=new i(0,0),this.repeat=new i(1,1),this.center=new i(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new o0,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=U,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=J&&J.depth&&J.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(DY).x}get height(){return this.source.getSize(DY).y}get depth(){return this.source.getSize(DY).z}get image(){return this.source.data}set image(J){this.source.data=J}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(J){return this.name=J.name,this.source=J.source,this.mipmaps=J.mipmaps.slice(0),this.mapping=J.mapping,this.channel=J.channel,this.wrapS=J.wrapS,this.wrapT=J.wrapT,this.magFilter=J.magFilter,this.minFilter=J.minFilter,this.anisotropy=J.anisotropy,this.format=J.format,this.internalFormat=J.internalFormat,this.type=J.type,this.normalized=J.normalized,this.offset.copy(J.offset),this.repeat.copy(J.repeat),this.center.copy(J.center),this.rotation=J.rotation,this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrix.copy(J.matrix),this.generateMipmaps=J.generateMipmaps,this.premultiplyAlpha=J.premultiplyAlpha,this.flipY=J.flipY,this.unpackAlignment=J.unpackAlignment,this.colorSpace=J.colorSpace,this.renderTarget=J.renderTarget,this.isRenderTargetTexture=J.isRenderTargetTexture,this.isArrayTexture=J.isArrayTexture,this.userData=JSON.parse(JSON.stringify(J.userData)),this.needsUpdate=!0,this}setValues(J){for(let Q in J){let $=J[Q];if($===void 0){O0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){O0(`Texture.setValues(): property '${Q}' does not exist.`);continue}if(Z&&$&&(Z.isVector2&&$.isVector2))Z.copy($);else if(Z&&$&&(Z.isVector3&&$.isVector3))Z.copy($);else if(Z&&$&&(Z.isMatrix3&&$.isMatrix3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.textures[this.uuid]!==void 0)return J.textures[this.uuid];let $={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(J).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)$.userData=this.userData;if(!Q)J.textures[this.uuid]=$;return $}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(J){if(this.mapping!==300)return J;if(J.applyMatrix3(this.matrix),J.x<0||J.x>1)switch(this.wrapS){case 1000:J.x=J.x-Math.floor(J.x);break;case 1001:J.x=J.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.x)%2)===1)J.x=Math.ceil(J.x)-J.x;else J.x=J.x-Math.floor(J.x);break}if(J.y<0||J.y>1)switch(this.wrapT){case 1000:J.y=J.y-Math.floor(J.y);break;case 1001:J.y=J.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.y)%2)===1)J.y=Math.ceil(J.y)-J.y;else J.y=J.y-Math.floor(J.y);break}if(this.flipY)J.y=1-J.y;return J}set needsUpdate(J){if(J===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(J){if(J===!0)this.pmremVersion++}}kJ.DEFAULT_IMAGE=null;kJ.DEFAULT_MAPPING=300;kJ.DEFAULT_ANISOTROPY=1;class FJ{static{FJ.prototype.isVector4=!0}constructor(J=0,Q=0,$=0,Z=1){this.x=J,this.y=Q,this.z=$,this.w=Z}get width(){return this.z}set width(J){this.z=J}get height(){return this.w}set height(J){this.w=J}set(J,Q,$,Z){return this.x=J,this.y=Q,this.z=$,this.w=Z,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this.w=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setW(J){return this.w=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;case 3:this.w=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this.w=J.w!==void 0?J.w:1,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this.w+=J.w,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this.w+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this.w=J.w+Q.w,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this.w+=J.w*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this.w-=J.w,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this.w-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this.w=J.w-Q.w,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this.w*=J.w,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this.w*=J,this}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=this.w,Y=J.elements;return this.x=Y[0]*Q+Y[4]*$+Y[8]*Z+Y[12]*W,this.y=Y[1]*Q+Y[5]*$+Y[9]*Z+Y[13]*W,this.z=Y[2]*Q+Y[6]*$+Y[10]*Z+Y[14]*W,this.w=Y[3]*Q+Y[7]*$+Y[11]*Z+Y[15]*W,this}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this.w/=J.w,this}divideScalar(J){return this.multiplyScalar(1/J)}setAxisAngleFromQuaternion(J){this.w=2*Math.acos(J.w);let Q=Math.sqrt(1-J.w*J.w);if(Q<0.0001)this.x=1,this.y=0,this.z=0;else this.x=J.x/Q,this.y=J.y/Q,this.z=J.z/Q;return this}setAxisAngleFromRotationMatrix(J){let Q,$,Z,W,Y=0.01,X=0.1,K=J.elements,H=K[0],U=K[4],G=K[8],F=K[1],E=K[5],O=K[9],R=K[2],M=K[6],q=K[10];if(Math.abs(U-F)<0.01&&Math.abs(G-R)<0.01&&Math.abs(O-M)<0.01){if(Math.abs(U+F)<0.1&&Math.abs(G+R)<0.1&&Math.abs(O+M)<0.1&&Math.abs(H+E+q-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let L=(H+1)/2,D=(E+1)/2,V=(q+1)/2,z=(U+F)/4,I=(G+R)/4,B=(O+M)/4;if(L>D&&L>V)if(L<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(L),Z=z/$,W=I/$;else if(D>V)if(D<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(D),$=z/Z,W=B/Z;else if(V<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(V),$=I/W,Z=B/W;return this.set($,Z,W,Q),this}let N=Math.sqrt((M-O)*(M-O)+(G-R)*(G-R)+(F-U)*(F-U));if(Math.abs(N)<0.001)N=1;return this.x=(M-O)/N,this.y=(G-R)/N,this.z=(F-U)/N,this.w=Math.acos((H+E+q-1)/2),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this.w=Q[15],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this.w=Math.min(this.w,J.w),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this.w=Math.max(this.w,J.w),this}clamp(J,Q){return this.x=s0(this.x,J.x,Q.x),this.y=s0(this.y,J.y,Q.y),this.z=s0(this.z,J.z,Q.z),this.w=s0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=s0(this.x,J,Q),this.y=s0(this.y,J,Q),this.z=s0(this.z,J,Q),this.w=s0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(s0($,J,Q))}floor(){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(){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(){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(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z+this.w*J.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this.w+=(J.w-this.w)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this.w=J.w+(Q.w-J.w)*$,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z&&J.w===this.w}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this.w=J[Q+3],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J[Q+3]=this.w,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this.w=J.getW(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class fQ extends B9{constructor(J=1,Q=1,$={}){super();$=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},$),this.isRenderTarget=!0,this.width=J,this.height=Q,this.depth=$.depth,this.scissor=new FJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new FJ(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new kJ(Z),Y=$.count;for(let X=0;X<Y;X++)this.textures[X]=W.clone(),this.textures[X].isRenderTargetTexture=!0,this.textures[X].renderTarget=this;this._setTextureOptions($),this.depthBuffer=$.depthBuffer,this.stencilBuffer=$.stencilBuffer,this.resolveDepthBuffer=$.resolveDepthBuffer,this.resolveStencilBuffer=$.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=$.depthTexture,this.samples=$.samples,this.multiview=$.multiview}_setTextureOptions(J={}){let Q={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(J.mapping!==void 0)Q.mapping=J.mapping;if(J.wrapS!==void 0)Q.wrapS=J.wrapS;if(J.wrapT!==void 0)Q.wrapT=J.wrapT;if(J.wrapR!==void 0)Q.wrapR=J.wrapR;if(J.magFilter!==void 0)Q.magFilter=J.magFilter;if(J.minFilter!==void 0)Q.minFilter=J.minFilter;if(J.format!==void 0)Q.format=J.format;if(J.type!==void 0)Q.type=J.type;if(J.anisotropy!==void 0)Q.anisotropy=J.anisotropy;if(J.colorSpace!==void 0)Q.colorSpace=J.colorSpace;if(J.flipY!==void 0)Q.flipY=J.flipY;if(J.generateMipmaps!==void 0)Q.generateMipmaps=J.generateMipmaps;if(J.internalFormat!==void 0)Q.internalFormat=J.internalFormat;for(let $=0;$<this.textures.length;$++)this.textures[$].setValues(Q)}get texture(){return this.textures[0]}set texture(J){this.textures[0]=J}set depthTexture(J){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(J!==null)J.renderTarget=this;this._depthTexture=J}get depthTexture(){return this._depthTexture}setSize(J,Q,$=1){if(this.width!==J||this.height!==Q||this.depth!==$){this.width=J,this.height=Q,this.depth=$;for(let Z=0,W=this.textures.length;Z<W;Z++)if(this.textures[Z].image.width=J,this.textures[Z].image.height=Q,this.textures[Z].image.depth=$,this.textures[Z].isData3DTexture!==!0)this.textures[Z].isArrayTexture=this.textures[Z].image.depth>1;this.dispose()}this.viewport.set(0,0,J,Q),this.scissor.set(0,0,J,Q)}clone(){return new this.constructor().copy(this)}copy(J){this.width=J.width,this.height=J.height,this.depth=J.depth,this.scissor.copy(J.scissor),this.scissorTest=J.scissorTest,this.viewport.copy(J.viewport),this.textures.length=0;for(let Q=0,$=J.textures.length;Q<$;Q++){this.textures[Q]=J.textures[Q].clone(),this.textures[Q].isRenderTargetTexture=!0,this.textures[Q].renderTarget=this;let Z=Object.assign({},J.textures[Q].image);this.textures[Q].source=new X8(Z)}if(this.depthBuffer=J.depthBuffer,this.stencilBuffer=J.stencilBuffer,this.resolveDepthBuffer=J.resolveDepthBuffer,this.resolveStencilBuffer=J.resolveStencilBuffer,J.depthTexture!==null)this.depthTexture=J.depthTexture.clone();return this.samples=J.samples,this.multiview=J.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class PJ extends fQ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class x7 extends kJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isDataArrayTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class JK extends PJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGLArrayRenderTarget=!0,this.depth=$,this.texture=new x7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}}class b7 extends kJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isData3DTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class QK extends PJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGL3DRenderTarget=!0,this.depth=$,this.texture=new b7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}}class y0{static{y0.prototype.isMatrix4=!0}constructor(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,M){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,M)}set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,M){let q=this.elements;return q[0]=J,q[4]=Q,q[8]=$,q[12]=Z,q[1]=W,q[5]=Y,q[9]=X,q[13]=K,q[2]=H,q[6]=U,q[10]=G,q[14]=F,q[3]=E,q[7]=O,q[11]=R,q[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new y0().fromArray(this.elements)}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],Q[9]=$[9],Q[10]=$[10],Q[11]=$[11],Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],Q[15]=$[15],this}copyPosition(J){let Q=this.elements,$=J.elements;return Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],this}setFromMatrix3(J){let Q=J.elements;return this.set(Q[0],Q[3],Q[6],0,Q[1],Q[4],Q[7],0,Q[2],Q[5],Q[8],0,0,0,0,1),this}extractBasis(J,Q,$){if(this.determinant()===0)return J.set(1,0,0),Q.set(0,1,0),$.set(0,0,1),this;return J.setFromMatrixColumn(this,0),Q.setFromMatrixColumn(this,1),$.setFromMatrixColumn(this,2),this}makeBasis(J,Q,$){return this.set(J.x,Q.x,$.x,0,J.y,Q.y,$.y,0,J.z,Q.z,$.z,0,0,0,0,1),this}extractRotation(J){if(J.determinant()===0)return this.identity();let Q=this.elements,$=J.elements,Z=1/J7.setFromMatrixColumn(J,0).length(),W=1/J7.setFromMatrixColumn(J,1).length(),Y=1/J7.setFromMatrixColumn(J,2).length();return Q[0]=$[0]*Z,Q[1]=$[1]*Z,Q[2]=$[2]*Z,Q[3]=0,Q[4]=$[4]*W,Q[5]=$[5]*W,Q[6]=$[6]*W,Q[7]=0,Q[8]=$[8]*Y,Q[9]=$[9]*Y,Q[10]=$[10]*Y,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromEuler(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z,Y=Math.cos($),X=Math.sin($),K=Math.cos(Z),H=Math.sin(Z),U=Math.cos(W),G=Math.sin(W);if(J.order==="XYZ"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=-K*G,Q[8]=H,Q[1]=E+O*H,Q[5]=F-R*H,Q[9]=-X*K,Q[2]=R-F*H,Q[6]=O+E*H,Q[10]=Y*K}else if(J.order==="YXZ"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F+R*X,Q[4]=O*X-E,Q[8]=Y*H,Q[1]=Y*G,Q[5]=Y*U,Q[9]=-X,Q[2]=E*X-O,Q[6]=R+F*X,Q[10]=Y*K}else if(J.order==="ZXY"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F-R*X,Q[4]=-Y*G,Q[8]=O+E*X,Q[1]=E+O*X,Q[5]=Y*U,Q[9]=R-F*X,Q[2]=-Y*H,Q[6]=X,Q[10]=Y*K}else if(J.order==="ZYX"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=O*H-E,Q[8]=F*H+R,Q[1]=K*G,Q[5]=R*H+F,Q[9]=E*H-O,Q[2]=-H,Q[6]=X*K,Q[10]=Y*K}else if(J.order==="YZX"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=R-F*G,Q[8]=O*G+E,Q[1]=G,Q[5]=Y*U,Q[9]=-X*U,Q[2]=-H*U,Q[6]=E*G+O,Q[10]=F-R*G}else if(J.order==="XZY"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=-G,Q[8]=H*U,Q[1]=F*G+R,Q[5]=Y*U,Q[9]=E*G-O,Q[2]=O*G-E,Q[6]=X*U,Q[10]=R*G+F}return Q[3]=0,Q[7]=0,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromQuaternion(J){return this.compose(YF,J,XF)}lookAt(J,Q,$){let Z=this.elements;if(L9.subVectors(J,Q),L9.lengthSq()===0)L9.z=1;if(L9.normalize(),b8.crossVectors($,L9),b8.lengthSq()===0){if(Math.abs($.z)===1)L9.x+=0.0001;else L9.z+=0.0001;L9.normalize(),b8.crossVectors($,L9)}return b8.normalize(),S$.crossVectors(L9,b8),Z[0]=b8.x,Z[4]=S$.x,Z[8]=L9.x,Z[1]=b8.y,Z[5]=S$.y,Z[9]=L9.y,Z[2]=b8.z,Z[6]=S$.z,Z[10]=L9.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[4],K=$[8],H=$[12],U=$[1],G=$[5],F=$[9],E=$[13],O=$[2],R=$[6],M=$[10],q=$[14],N=$[3],L=$[7],D=$[11],V=$[15],z=Z[0],I=Z[4],B=Z[8],k=Z[12],C=Z[1],j=Z[5],w=Z[9],v=Z[13],b=Z[2],S=Z[6],h=Z[10],x=Z[14],p=Z[3],c=Z[7],o=Z[11],W0=Z[15];return W[0]=Y*z+X*C+K*b+H*p,W[4]=Y*I+X*j+K*S+H*c,W[8]=Y*B+X*w+K*h+H*o,W[12]=Y*k+X*v+K*x+H*W0,W[1]=U*z+G*C+F*b+E*p,W[5]=U*I+G*j+F*S+E*c,W[9]=U*B+G*w+F*h+E*o,W[13]=U*k+G*v+F*x+E*W0,W[2]=O*z+R*C+M*b+q*p,W[6]=O*I+R*j+M*S+q*c,W[10]=O*B+R*w+M*h+q*o,W[14]=O*k+R*v+M*x+q*W0,W[3]=N*z+L*C+D*b+V*p,W[7]=N*I+L*j+D*S+V*c,W[11]=N*B+L*w+D*h+V*o,W[15]=N*k+L*v+D*x+V*W0,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[4]*=J,Q[8]*=J,Q[12]*=J,Q[1]*=J,Q[5]*=J,Q[9]*=J,Q[13]*=J,Q[2]*=J,Q[6]*=J,Q[10]*=J,Q[14]*=J,Q[3]*=J,Q[7]*=J,Q[11]*=J,Q[15]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[4],Z=J[8],W=J[12],Y=J[1],X=J[5],K=J[9],H=J[13],U=J[2],G=J[6],F=J[10],E=J[14],O=J[3],R=J[7],M=J[11],q=J[15],N=K*E-H*F,L=X*E-H*G,D=X*F-K*G,V=Y*E-H*U,z=Y*F-K*U,I=Y*G-X*U;return Q*(R*N-M*L+q*D)-$*(O*N-M*V+q*z)+Z*(O*L-R*V+q*I)-W*(O*D-R*z+M*I)}transpose(){let J=this.elements,Q;return Q=J[1],J[1]=J[4],J[4]=Q,Q=J[2],J[2]=J[8],J[8]=Q,Q=J[6],J[6]=J[9],J[9]=Q,Q=J[3],J[3]=J[12],J[12]=Q,Q=J[7],J[7]=J[13],J[13]=Q,Q=J[11],J[11]=J[14],J[14]=Q,this}setPosition(J,Q,$){let Z=this.elements;if(J.isVector3)Z[12]=J.x,Z[13]=J.y,Z[14]=J.z;else Z[12]=J,Z[13]=Q,Z[14]=$;return this}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=J[9],F=J[10],E=J[11],O=J[12],R=J[13],M=J[14],q=J[15],N=Q*X-$*Y,L=Q*K-Z*Y,D=Q*H-W*Y,V=$*K-Z*X,z=$*H-W*X,I=Z*H-W*K,B=U*R-G*O,k=U*M-F*O,C=U*q-E*O,j=G*M-F*R,w=G*q-E*R,v=F*q-E*M,b=N*v-L*w+D*j+V*C-z*k+I*B;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/b;return J[0]=(X*v-K*w+H*j)*S,J[1]=(Z*w-$*v-W*j)*S,J[2]=(R*I-M*z+q*V)*S,J[3]=(F*z-G*I-E*V)*S,J[4]=(K*C-Y*v-H*k)*S,J[5]=(Q*v-Z*C+W*k)*S,J[6]=(M*D-O*I-q*L)*S,J[7]=(U*I-F*D+E*L)*S,J[8]=(Y*w-X*C+H*B)*S,J[9]=($*C-Q*w-W*B)*S,J[10]=(O*z-R*D+q*N)*S,J[11]=(G*D-U*z-E*N)*S,J[12]=(X*k-Y*j-K*B)*S,J[13]=(Q*j-$*k+Z*B)*S,J[14]=(R*L-O*V-M*N)*S,J[15]=(U*V-G*L+F*N)*S,this}scale(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z;return Q[0]*=$,Q[4]*=Z,Q[8]*=W,Q[1]*=$,Q[5]*=Z,Q[9]*=W,Q[2]*=$,Q[6]*=Z,Q[10]*=W,Q[3]*=$,Q[7]*=Z,Q[11]*=W,this}getMaxScaleOnAxis(){let J=this.elements,Q=J[0]*J[0]+J[1]*J[1]+J[2]*J[2],$=J[4]*J[4]+J[5]*J[5]+J[6]*J[6],Z=J[8]*J[8]+J[9]*J[9]+J[10]*J[10];return Math.sqrt(Math.max(Q,$,Z))}makeTranslation(J,Q,$){if(J.isVector3)this.set(1,0,0,J.x,0,1,0,J.y,0,0,1,J.z,0,0,0,1);else this.set(1,0,0,J,0,1,0,Q,0,0,1,$,0,0,0,1);return this}makeRotationX(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(1,0,0,0,0,Q,-$,0,0,$,Q,0,0,0,0,1),this}makeRotationY(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,0,$,0,0,1,0,0,-$,0,Q,0,0,0,0,1),this}makeRotationZ(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,0,$,Q,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=1-$,Y=J.x,X=J.y,K=J.z,H=W*Y,U=W*X;return this.set(H*Y+$,H*X-Z*K,H*K+Z*X,0,H*X+Z*K,U*X+$,U*K-Z*Y,0,H*K-Z*X,U*K+Z*Y,W*K*K+$,0,0,0,0,1),this}makeScale(J,Q,$){return this.set(J,0,0,0,0,Q,0,0,0,0,$,0,0,0,0,1),this}makeShear(J,Q,$,Z,W,Y){return this.set(1,$,W,0,J,1,Y,0,Q,Z,1,0,0,0,0,1),this}compose(J,Q,$){let Z=this.elements,W=Q._x,Y=Q._y,X=Q._z,K=Q._w,H=W+W,U=Y+Y,G=X+X,F=W*H,E=W*U,O=W*G,R=Y*U,M=Y*G,q=X*G,N=K*H,L=K*U,D=K*G,V=$.x,z=$.y,I=$.z;return Z[0]=(1-(R+q))*V,Z[1]=(E+D)*V,Z[2]=(O-L)*V,Z[3]=0,Z[4]=(E-D)*z,Z[5]=(1-(F+q))*z,Z[6]=(M+N)*z,Z[7]=0,Z[8]=(O+L)*I,Z[9]=(M-N)*I,Z[10]=(1-(F+R))*I,Z[11]=0,Z[12]=J.x,Z[13]=J.y,Z[14]=J.z,Z[15]=1,this}decompose(J,Q,$){let Z=this.elements;J.x=Z[12],J.y=Z[13],J.z=Z[14];let W=this.determinant();if(W===0)return $.set(1,1,1),Q.identity(),this;let Y=J7.set(Z[0],Z[1],Z[2]).length(),X=J7.set(Z[4],Z[5],Z[6]).length(),K=J7.set(Z[8],Z[9],Z[10]).length();if(W<0)Y=-Y;p9.copy(this);let H=1/Y,U=1/X,G=1/K;return p9.elements[0]*=H,p9.elements[1]*=H,p9.elements[2]*=H,p9.elements[4]*=U,p9.elements[5]*=U,p9.elements[6]*=U,p9.elements[8]*=G,p9.elements[9]*=G,p9.elements[10]*=G,Q.setFromRotationMatrix(p9),$.x=Y,$.y=X,$.z=K,this}makePerspective(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2*W/(Q-J),G=2*W/($-Z),F=(Q+J)/(Q-J),E=($+Z)/($-Z),O,R;if(K)O=W/(Y-W),R=Y*W/(Y-W);else if(X===2000)O=-(Y+W)/(Y-W),R=-2*Y*W/(Y-W);else if(X===2001)O=-Y/(Y-W),R=-Y*W/(Y-W);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=F,H[12]=0,H[1]=0,H[5]=G,H[9]=E,H[13]=0,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=-1,H[15]=0,this}makeOrthographic(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2/(Q-J),G=2/($-Z),F=-(Q+J)/(Q-J),E=-($+Z)/($-Z),O,R;if(K)O=1/(Y-W),R=Y/(Y-W);else if(X===2000)O=-2/(Y-W),R=-(Y+W)/(Y-W);else if(X===2001)O=-1/(Y-W),R=-W/(Y-W);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=0,H[12]=F,H[1]=0,H[5]=G,H[9]=0,H[13]=E,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=0,H[15]=1,this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<16;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<16;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J[Q+9]=$[9],J[Q+10]=$[10],J[Q+11]=$[11],J[Q+12]=$[12],J[Q+13]=$[13],J[Q+14]=$[14],J[Q+15]=$[15],J}}var J7=new A,p9=new y0,YF=new A(0,0,0),XF=new A(1,1,1),b8=new A,S$=new A,L9=new A,oH=new y0,aH=new zJ;class A9{constructor(J=0,Q=0,$=0,Z=A9.DEFAULT_ORDER){this.isEuler=!0,this._x=J,this._y=Q,this._z=$,this._order=Z}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get order(){return this._order}set order(J){this._order=J,this._onChangeCallback()}set(J,Q,$,Z=this._order){return this._x=J,this._y=Q,this._z=$,this._order=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(J){return this._x=J._x,this._y=J._y,this._z=J._z,this._order=J._order,this._onChangeCallback(),this}setFromRotationMatrix(J,Q=this._order,$=!0){let Z=J.elements,W=Z[0],Y=Z[4],X=Z[8],K=Z[1],H=Z[5],U=Z[9],G=Z[2],F=Z[6],E=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(s0(X,-1,1)),Math.abs(X)<0.9999999)this._x=Math.atan2(-U,E),this._z=Math.atan2(-Y,W);else this._x=Math.atan2(F,H),this._z=0;break;case"YXZ":if(this._x=Math.asin(-s0(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(X,E),this._z=Math.atan2(K,H);else this._y=Math.atan2(-G,W),this._z=0;break;case"ZXY":if(this._x=Math.asin(s0(F,-1,1)),Math.abs(F)<0.9999999)this._y=Math.atan2(-G,E),this._z=Math.atan2(-Y,H);else this._y=0,this._z=Math.atan2(K,W);break;case"ZYX":if(this._y=Math.asin(-s0(G,-1,1)),Math.abs(G)<0.9999999)this._x=Math.atan2(F,E),this._z=Math.atan2(K,W);else this._x=0,this._z=Math.atan2(-Y,H);break;case"YZX":if(this._z=Math.asin(s0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(-U,H),this._y=Math.atan2(-G,W);else this._x=0,this._y=Math.atan2(X,E);break;case"XZY":if(this._z=Math.asin(-s0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(F,H),this._y=Math.atan2(X,W);else this._x=Math.atan2(-U,E),this._y=0;break;default:O0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return oH.makeRotationFromQuaternion(J),this.setFromRotationMatrix(oH,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return aH.setFromEuler(this),this.setFromQuaternion(aH,J)}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._order===this._order}fromArray(J){if(this._x=J[0],this._y=J[1],this._z=J[2],J[3]!==void 0)this._order=J[3];return this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._order,J}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}A9.DEFAULT_ORDER="XYZ";class h7{constructor(){this.mask=1}set(J){this.mask=(1<<J|0)>>>0}enable(J){this.mask|=1<<J|0}enableAll(){this.mask=-1}toggle(J){this.mask^=1<<J|0}disable(J){this.mask&=~(1<<J|0)}disableAll(){this.mask=0}test(J){return(this.mask&J.mask)!==0}isEnabled(J){return(this.mask&(1<<J|0))!==0}}var KF=0,rH=new A,Q7=new zJ,R8=new y0,j$=new A,WQ=new A,HF=new A,UF=new zJ,tH=new A(1,0,0),eH=new A(0,1,0),JU=new A(0,0,1),QU={type:"added"},GF={type:"removed"},$7={type:"childadded",child:null},MY={type:"childremoved",child:null};class HJ extends B9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:KF++}),this.uuid=M9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=HJ.DEFAULT_UP.clone();let J=new A,Q=new A9,$=new zJ,Z=new A(1,1,1);function W(){$.setFromEuler(Q,!1)}function Y(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(W),$._onChange(Y),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:J},rotation:{configurable:!0,enumerable:!0,value:Q},quaternion:{configurable:!0,enumerable:!0,value:$},scale:{configurable:!0,enumerable:!0,value:Z},modelViewMatrix:{value:new y0},normalMatrix:{value:new o0}}),this.matrix=new y0,this.matrixWorld=new y0,this.matrixAutoUpdate=HJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=HJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new h7,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(J){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(J),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(J){return this.quaternion.premultiply(J),this}setRotationFromAxisAngle(J,Q){this.quaternion.setFromAxisAngle(J,Q)}setRotationFromEuler(J){this.quaternion.setFromEuler(J,!0)}setRotationFromMatrix(J){this.quaternion.setFromRotationMatrix(J)}setRotationFromQuaternion(J){this.quaternion.copy(J)}rotateOnAxis(J,Q){return Q7.setFromAxisAngle(J,Q),this.quaternion.multiply(Q7),this}rotateOnWorldAxis(J,Q){return Q7.setFromAxisAngle(J,Q),this.quaternion.premultiply(Q7),this}rotateX(J){return this.rotateOnAxis(tH,J)}rotateY(J){return this.rotateOnAxis(eH,J)}rotateZ(J){return this.rotateOnAxis(JU,J)}translateOnAxis(J,Q){return rH.copy(J).applyQuaternion(this.quaternion),this.position.add(rH.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(tH,J)}translateY(J){return this.translateOnAxis(eH,J)}translateZ(J){return this.translateOnAxis(JU,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(R8.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)j$.copy(J);else j$.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),WQ.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)R8.lookAt(WQ,j$,this.up);else R8.lookAt(j$,WQ,this.up);if(this.quaternion.setFromRotationMatrix(R8),Z)R8.extractRotation(Z.matrixWorld),Q7.setFromRotationMatrix(R8),this.quaternion.premultiply(Q7.invert())}add(J){if(arguments.length>1){for(let Q=0;Q<arguments.length;Q++)this.add(arguments[Q]);return this}if(J===this)return v0("Object3D.add: object can't be added as a child of itself.",J),this;if(J&&J.isObject3D)J.removeFromParent(),J.parent=this,this.children.push(J),J.dispatchEvent(QU),$7.child=J,this.dispatchEvent($7),$7.child=null;else v0("Object3D.add: object not an instance of THREE.Object3D.",J);return this}remove(J){if(arguments.length>1){for(let $=0;$<arguments.length;$++)this.remove(arguments[$]);return this}let Q=this.children.indexOf(J);if(Q!==-1)J.parent=null,this.children.splice(Q,1),J.dispatchEvent(GF),MY.child=J,this.dispatchEvent(MY),MY.child=null;return this}removeFromParent(){let J=this.parent;if(J!==null)J.remove(this);return this}clear(){return this.remove(...this.children)}attach(J){if(this.updateWorldMatrix(!0,!1),R8.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),R8.multiply(J.parent.matrixWorld);return J.applyMatrix4(R8),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(QU),$7.child=J,this.dispatchEvent($7),$7.child=null,this}getObjectById(J){return this.getObjectByProperty("id",J)}getObjectByName(J){return this.getObjectByProperty("name",J)}getObjectByProperty(J,Q){if(this[J]===Q)return this;for(let $=0,Z=this.children.length;$<Z;$++){let Y=this.children[$].getObjectByProperty(J,Q);if(Y!==void 0)return Y}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].getObjectsByProperty(J,Q,$);return $}getWorldPosition(J){return this.updateWorldMatrix(!0,!1),J.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(WQ,J,HF),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(WQ,UF,J),J}getWorldDirection(J){this.updateWorldMatrix(!0,!1);let Q=this.matrixWorld.elements;return J.set(Q[8],Q[9],Q[10]).normalize()}raycast(){}traverse(J){J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverse(J)}traverseVisible(J){if(this.visible===!1)return;J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverseVisible(J)}traverseAncestors(J){let Q=this.parent;if(Q!==null)J(Q),Q.traverseAncestors(J)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let J=this.pivot;if(J!==null){let{x:Q,y:$,z:Z}=J,W=this.matrix.elements;W[12]+=Q-W[0]*Q-W[4]*$-W[8]*Z,W[13]+=$-W[1]*Q-W[5]*$-W[9]*Z,W[14]+=Z-W[2]*Q-W[6]*$-W[10]*Z}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(J){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||J){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,J=!0}let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].updateMatrixWorld(J)}updateWorldMatrix(J,Q){let $=this.parent;if(J===!0&&$!==null)$.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);if(Q===!0){let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].updateWorldMatrix(!1,!0)}}toJSON(J){let Q=J===void 0||typeof J==="string",$={};if(Q)J={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},$.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let Z={};if(Z.uuid=this.uuid,Z.type=this.type,this.name!=="")Z.name=this.name;if(this.castShadow===!0)Z.castShadow=!0;if(this.receiveShadow===!0)Z.receiveShadow=!0;if(this.visible===!1)Z.visible=!1;if(this.frustumCulled===!1)Z.frustumCulled=!1;if(this.renderOrder!==0)Z.renderOrder=this.renderOrder;if(this.static!==!1)Z.static=this.static;if(Object.keys(this.userData).length>0)Z.userData=this.userData;if(Z.layers=this.layers.mask,Z.matrix=this.matrix.toArray(),Z.up=this.up.toArray(),this.pivot!==null)Z.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)Z.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)Z.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)Z.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(Z.type="InstancedMesh",Z.count=this.count,Z.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)Z.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(Z.type="BatchedMesh",Z.perObjectFrustumCulled=this.perObjectFrustumCulled,Z.sortObjects=this.sortObjects,Z.drawRanges=this._drawRanges,Z.reservedRanges=this._reservedRanges,Z.geometryInfo=this._geometryInfo.map((X)=>({...X,boundingBox:X.boundingBox?X.boundingBox.toJSON():void 0,boundingSphere:X.boundingSphere?X.boundingSphere.toJSON():void 0})),Z.instanceInfo=this._instanceInfo.map((X)=>({...X})),Z.availableInstanceIds=this._availableInstanceIds.slice(),Z.availableGeometryIds=this._availableGeometryIds.slice(),Z.nextIndexStart=this._nextIndexStart,Z.nextVertexStart=this._nextVertexStart,Z.geometryCount=this._geometryCount,Z.maxInstanceCount=this._maxInstanceCount,Z.maxVertexCount=this._maxVertexCount,Z.maxIndexCount=this._maxIndexCount,Z.geometryInitialized=this._geometryInitialized,Z.matricesTexture=this._matricesTexture.toJSON(J),Z.indirectTexture=this._indirectTexture.toJSON(J),this._colorsTexture!==null)Z.colorsTexture=this._colorsTexture.toJSON(J);if(this.boundingSphere!==null)Z.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)Z.boundingBox=this.boundingBox.toJSON()}function W(X,K){if(X[K.uuid]===void 0)X[K.uuid]=K.toJSON(J);return K.uuid}if(this.isScene){if(this.background){if(this.background.isColor)Z.background=this.background.toJSON();else if(this.background.isTexture)Z.background=this.background.toJSON(J).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)Z.environment=this.environment.toJSON(J).uuid}else if(this.isMesh||this.isLine||this.isPoints){Z.geometry=W(J.geometries,this.geometry);let X=this.geometry.parameters;if(X!==void 0&&X.shapes!==void 0){let K=X.shapes;if(Array.isArray(K))for(let H=0,U=K.length;H<U;H++){let G=K[H];W(J.shapes,G)}else W(J.shapes,K)}}if(this.isSkinnedMesh){if(Z.bindMode=this.bindMode,Z.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)W(J.skeletons,this.skeleton),Z.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let X=[];for(let K=0,H=this.material.length;K<H;K++)X.push(W(J.materials,this.material[K]));Z.material=X}else Z.material=W(J.materials,this.material);if(this.children.length>0){Z.children=[];for(let X=0;X<this.children.length;X++)Z.children.push(this.children[X].toJSON(J).object)}if(this.animations.length>0){Z.animations=[];for(let X=0;X<this.animations.length;X++){let K=this.animations[X];Z.animations.push(W(J.animations,K))}}if(Q){let X=Y(J.geometries),K=Y(J.materials),H=Y(J.textures),U=Y(J.images),G=Y(J.shapes),F=Y(J.skeletons),E=Y(J.animations),O=Y(J.nodes);if(X.length>0)$.geometries=X;if(K.length>0)$.materials=K;if(H.length>0)$.textures=H;if(U.length>0)$.images=U;if(G.length>0)$.shapes=G;if(F.length>0)$.skeletons=F;if(E.length>0)$.animations=E;if(O.length>0)$.nodes=O}return $.object=Z,$;function Y(X){let K=[];for(let H in X){let U=X[H];delete U.metadata,K.push(U)}return K}}clone(J){return new this.constructor().copy(this,J)}copy(J,Q=!0){if(this.name=J.name,this.up.copy(J.up),this.position.copy(J.position),this.rotation.order=J.rotation.order,this.quaternion.copy(J.quaternion),this.scale.copy(J.scale),this.pivot=J.pivot!==null?J.pivot.clone():null,this.matrix.copy(J.matrix),this.matrixWorld.copy(J.matrixWorld),this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrixWorldAutoUpdate=J.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=J.matrixWorldNeedsUpdate,this.layers.mask=J.layers.mask,this.visible=J.visible,this.castShadow=J.castShadow,this.receiveShadow=J.receiveShadow,this.frustumCulled=J.frustumCulled,this.renderOrder=J.renderOrder,this.static=J.static,this.animations=J.animations.slice(),this.userData=JSON.parse(JSON.stringify(J.userData)),Q===!0)for(let $=0;$<J.children.length;$++){let Z=J.children[$];this.add(Z.clone())}return this}}HJ.DEFAULT_UP=new A(0,1,0);HJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;HJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class G9 extends HJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var EF={type:"move"};class f7{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new G9,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new G9,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new A,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new A;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new G9,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new A,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new A,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(J){if(this._targetRay!==null)this._targetRay.dispatchEvent(J);if(this._grip!==null)this._grip.dispatchEvent(J);if(this._hand!==null)this._hand.dispatchEvent(J);return this}connect(J){if(J&&J.hand){let Q=this._hand;if(Q)for(let $ of J.hand.values())this._getHandJoint(Q,$)}return this.dispatchEvent({type:"connected",data:J}),this}disconnect(J){if(this.dispatchEvent({type:"disconnected",data:J}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(J,Q,$){let Z=null,W=null,Y=null,X=this._targetRay,K=this._grip,H=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(H&&J.hand){Y=!0;for(let R of J.hand.values()){let M=Q.getJointPose(R,$),q=this._getHandJoint(H,R);if(M!==null)q.matrix.fromArray(M.transform.matrix),q.matrix.decompose(q.position,q.rotation,q.scale),q.matrixWorldNeedsUpdate=!0,q.jointRadius=M.radius;q.visible=M!==null}let U=H.joints["index-finger-tip"],G=H.joints["thumb-tip"],F=U.position.distanceTo(G.position),E=0.02,O=0.005;if(H.inputState.pinching&&F>E+O)H.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!H.inputState.pinching&&F<=E-O)H.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(K!==null&&J.gripSpace){if(W=Q.getPose(J.gripSpace,$),W!==null){if(K.matrix.fromArray(W.transform.matrix),K.matrix.decompose(K.position,K.rotation,K.scale),K.matrixWorldNeedsUpdate=!0,W.linearVelocity)K.hasLinearVelocity=!0,K.linearVelocity.copy(W.linearVelocity);else K.hasLinearVelocity=!1;if(W.angularVelocity)K.hasAngularVelocity=!0,K.angularVelocity.copy(W.angularVelocity);else K.hasAngularVelocity=!1;if(K.eventsEnabled)K.dispatchEvent({type:"gripUpdated",data:J,target:this})}}if(X!==null){if(Z=Q.getPose(J.targetRaySpace,$),Z===null&&W!==null)Z=W;if(Z!==null){if(X.matrix.fromArray(Z.transform.matrix),X.matrix.decompose(X.position,X.rotation,X.scale),X.matrixWorldNeedsUpdate=!0,Z.linearVelocity)X.hasLinearVelocity=!0,X.linearVelocity.copy(Z.linearVelocity);else X.hasLinearVelocity=!1;if(Z.angularVelocity)X.hasAngularVelocity=!0,X.angularVelocity.copy(Z.angularVelocity);else X.hasAngularVelocity=!1;this.dispatchEvent(EF)}}}if(X!==null)X.visible=Z!==null;if(K!==null)K.visible=W!==null;if(H!==null)H.visible=Y!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new G9;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var E5={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},h8={h:0,s:0,l:0},v$={h:0,s:0,l:0};function kY(J,Q,$){if($<0)$+=1;if($>1)$-=1;if($<0.16666666666666666)return J+(Q-J)*6*$;if($<0.5)return Q;if($<0.6666666666666666)return J+(Q-J)*6*(0.6666666666666666-$);return J}class e{constructor(J,Q,$){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(J,Q,$)}set(J,Q,$){if(Q===void 0&&$===void 0){let Z=J;if(Z&&Z.isColor)this.copy(Z);else if(typeof Z==="number")this.setHex(Z);else if(typeof Z==="string")this.setStyle(Z)}else this.setRGB(J,Q,$);return this}setScalar(J){return this.r=J,this.g=J,this.b=J,this}setHex(J,Q="srgb"){return J=Math.floor(J),this.r=(J>>16&255)/255,this.g=(J>>8&255)/255,this.b=(J&255)/255,t0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=t0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,t0.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=t0.workingColorSpace){if(J=eX(J,1),Q=s0(Q,0,1),$=s0($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,Y=2*$-W;this.r=kY(Y,W,J+0.3333333333333333),this.g=kY(Y,W,J),this.b=kY(Y,W,J-0.3333333333333333)}return t0.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)O0("Color: Alpha component of "+J+" will be ignored.")}let Z;if(Z=/^(\w+)\(([^\)]*)\)/.exec(J)){let W,Y=Z[1],X=Z[2];switch(Y){case"rgb":case"rgba":if(W=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(255,parseInt(W[1],10))/255,Math.min(255,parseInt(W[2],10))/255,Math.min(255,parseInt(W[3],10))/255,Q);if(W=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(100,parseInt(W[1],10))/100,Math.min(100,parseInt(W[2],10))/100,Math.min(100,parseInt(W[3],10))/100,Q);break;case"hsl":case"hsla":if(W=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setHSL(parseFloat(W[1])/360,parseFloat(W[2])/100,parseFloat(W[3])/100,Q);break;default:O0("Color: Unknown color model "+J)}}else if(Z=/^\#([A-Fa-f\d]+)$/.exec(J)){let W=Z[1],Y=W.length;if(Y===3)return this.setRGB(parseInt(W.charAt(0),16)/15,parseInt(W.charAt(1),16)/15,parseInt(W.charAt(2),16)/15,Q);else if(Y===6)return this.setHex(parseInt(W,16),Q);else O0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=E5[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else O0("Color: Unknown color "+J);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(J){return this.r=J.r,this.g=J.g,this.b=J.b,this}copySRGBToLinear(J){return this.r=C8(J.r),this.g=C8(J.g),this.b=C8(J.b),this}copyLinearToSRGB(J){return this.r=k7(J.r),this.g=k7(J.g),this.b=k7(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return t0.workingToColorSpace(tJ.copy(this),J),Math.round(s0(tJ.r*255,0,255))*65536+Math.round(s0(tJ.g*255,0,255))*256+Math.round(s0(tJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=t0.workingColorSpace){t0.workingToColorSpace(tJ.copy(this),Q);let{r:$,g:Z,b:W}=tJ,Y=Math.max($,Z,W),X=Math.min($,Z,W),K,H,U=(X+Y)/2;if(X===Y)K=0,H=0;else{let G=Y-X;switch(H=U<=0.5?G/(Y+X):G/(2-Y-X),Y){case $:K=(Z-W)/G+(Z<W?6:0);break;case Z:K=(W-$)/G+2;break;case W:K=($-Z)/G+4;break}K/=6}return J.h=K,J.s=H,J.l=U,J}getRGB(J,Q=t0.workingColorSpace){return t0.workingToColorSpace(tJ.copy(this),Q),J.r=tJ.r,J.g=tJ.g,J.b=tJ.b,J}getStyle(J="srgb"){t0.workingToColorSpace(tJ.copy(this),J);let{r:Q,g:$,b:Z}=tJ;if(J!=="srgb")return`color(${J} ${Q.toFixed(3)} ${$.toFixed(3)} ${Z.toFixed(3)})`;return`rgb(${Math.round(Q*255)},${Math.round($*255)},${Math.round(Z*255)})`}offsetHSL(J,Q,$){return this.getHSL(h8),this.setHSL(h8.h+J,h8.s+Q,h8.l+$)}add(J){return this.r+=J.r,this.g+=J.g,this.b+=J.b,this}addColors(J,Q){return this.r=J.r+Q.r,this.g=J.g+Q.g,this.b=J.b+Q.b,this}addScalar(J){return this.r+=J,this.g+=J,this.b+=J,this}sub(J){return this.r=Math.max(0,this.r-J.r),this.g=Math.max(0,this.g-J.g),this.b=Math.max(0,this.b-J.b),this}multiply(J){return this.r*=J.r,this.g*=J.g,this.b*=J.b,this}multiplyScalar(J){return this.r*=J,this.g*=J,this.b*=J,this}lerp(J,Q){return this.r+=(J.r-this.r)*Q,this.g+=(J.g-this.g)*Q,this.b+=(J.b-this.b)*Q,this}lerpColors(J,Q,$){return this.r=J.r+(Q.r-J.r)*$,this.g=J.g+(Q.g-J.g)*$,this.b=J.b+(Q.b-J.b)*$,this}lerpHSL(J,Q){this.getHSL(h8),J.getHSL(v$);let $=DQ(h8.h,v$.h,Q),Z=DQ(h8.s,v$.s,Q),W=DQ(h8.l,v$.l,Q);return this.setHSL($,Z,W),this}setFromVector3(J){return this.r=J.x,this.g=J.y,this.b=J.z,this}applyMatrix3(J){let Q=this.r,$=this.g,Z=this.b,W=J.elements;return this.r=W[0]*Q+W[3]*$+W[6]*Z,this.g=W[1]*Q+W[4]*$+W[7]*Z,this.b=W[2]*Q+W[5]*$+W[8]*Z,this}equals(J){return J.r===this.r&&J.g===this.g&&J.b===this.b}fromArray(J,Q=0){return this.r=J[Q],this.g=J[Q+1],this.b=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.r,J[Q+1]=this.g,J[Q+2]=this.b,J}fromBufferAttribute(J,Q){return this.r=J.getX(Q),this.g=J.getY(Q),this.b=J.getZ(Q),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var tJ=new e;e.NAMES=E5;class gQ{constructor(J,Q=0.00025){this.isFogExp2=!0,this.name="",this.color=new e(J),this.density=Q}clone(){return new gQ(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class pQ{constructor(J,Q=1,$=1000){this.isFog=!0,this.name="",this.color=new e(J),this.near=Q,this.far=$}clone(){return new pQ(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class e8 extends HJ{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new A9,this.environmentIntensity=1,this.environmentRotation=new A9,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(J,Q){if(super.copy(J,Q),J.background!==null)this.background=J.background.clone();if(J.environment!==null)this.environment=J.environment.clone();if(J.fog!==null)this.fog=J.fog.clone();if(this.backgroundBlurriness=J.backgroundBlurriness,this.backgroundIntensity=J.backgroundIntensity,this.backgroundRotation.copy(J.backgroundRotation),this.environmentIntensity=J.environmentIntensity,this.environmentRotation.copy(J.environmentRotation),J.overrideMaterial!==null)this.overrideMaterial=J.overrideMaterial.clone();return this.matrixAutoUpdate=J.matrixAutoUpdate,this}toJSON(J){let Q=super.toJSON(J);if(this.fog!==null)Q.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)Q.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)Q.object.backgroundIntensity=this.backgroundIntensity;if(Q.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)Q.object.environmentIntensity=this.environmentIntensity;return Q.object.environmentRotation=this.environmentRotation.toArray(),Q}}var u9=new A,L8=new A,VY=new A,D8=new A,Z7=new A,W7=new A,$U=new A,BY=new A,CY=new A,zY=new A,IY=new FJ,_Y=new FJ,wY=new FJ;class Y9{constructor(J=new A,Q=new A,$=new A){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,Z){Z.subVectors($,Q),u9.subVectors(J,Q),Z.cross(u9);let W=Z.lengthSq();if(W>0)return Z.multiplyScalar(1/Math.sqrt(W));return Z.set(0,0,0)}static getBarycoord(J,Q,$,Z,W){u9.subVectors(Z,Q),L8.subVectors($,Q),VY.subVectors(J,Q);let Y=u9.dot(u9),X=u9.dot(L8),K=u9.dot(VY),H=L8.dot(L8),U=L8.dot(VY),G=Y*H-X*X;if(G===0)return W.set(0,0,0),null;let F=1/G,E=(H*K-X*U)*F,O=(Y*U-X*K)*F;return W.set(1-E-O,O,E)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,D8)===null)return!1;return D8.x>=0&&D8.y>=0&&D8.x+D8.y<=1}static getInterpolation(J,Q,$,Z,W,Y,X,K){if(this.getBarycoord(J,Q,$,Z,D8)===null){if(K.x=0,K.y=0,"z"in K)K.z=0;if("w"in K)K.w=0;return null}return K.setScalar(0),K.addScaledVector(W,D8.x),K.addScaledVector(Y,D8.y),K.addScaledVector(X,D8.z),K}static getInterpolatedAttribute(J,Q,$,Z,W,Y){return IY.setScalar(0),_Y.setScalar(0),wY.setScalar(0),IY.fromBufferAttribute(J,Q),_Y.fromBufferAttribute(J,$),wY.fromBufferAttribute(J,Z),Y.setScalar(0),Y.addScaledVector(IY,W.x),Y.addScaledVector(_Y,W.y),Y.addScaledVector(wY,W.z),Y}static isFrontFacing(J,Q,$,Z){return u9.subVectors($,Q),L8.subVectors(J,Q),u9.cross(L8).dot(Z)<0}set(J,Q,$){return this.a.copy(J),this.b.copy(Q),this.c.copy($),this}setFromPointsAndIndices(J,Q,$,Z){return this.a.copy(J[Q]),this.b.copy(J[$]),this.c.copy(J[Z]),this}setFromAttributeAndIndices(J,Q,$,Z){return this.a.fromBufferAttribute(J,Q),this.b.fromBufferAttribute(J,$),this.c.fromBufferAttribute(J,Z),this}clone(){return new this.constructor().copy(this)}copy(J){return this.a.copy(J.a),this.b.copy(J.b),this.c.copy(J.c),this}getArea(){return u9.subVectors(this.c,this.b),L8.subVectors(this.a,this.b),u9.cross(L8).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return Y9.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return Y9.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return Y9.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return Y9.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return Y9.isFrontFacing(this.a,this.b,this.c,J)}intersectsBox(J){return J.intersectsTriangle(this)}closestPointToPoint(J,Q){let $=this.a,Z=this.b,W=this.c,Y,X;Z7.subVectors(Z,$),W7.subVectors(W,$),BY.subVectors(J,$);let K=Z7.dot(BY),H=W7.dot(BY);if(K<=0&&H<=0)return Q.copy($);CY.subVectors(J,Z);let U=Z7.dot(CY),G=W7.dot(CY);if(U>=0&&G<=U)return Q.copy(Z);let F=K*G-U*H;if(F<=0&&K>=0&&U<=0)return Y=K/(K-U),Q.copy($).addScaledVector(Z7,Y);zY.subVectors(J,W);let E=Z7.dot(zY),O=W7.dot(zY);if(O>=0&&E<=O)return Q.copy(W);let R=E*H-K*O;if(R<=0&&H>=0&&O<=0)return X=H/(H-O),Q.copy($).addScaledVector(W7,X);let M=U*O-E*G;if(M<=0&&G-U>=0&&E-O>=0)return $U.subVectors(W,Z),X=(G-U)/(G-U+(E-O)),Q.copy(Z).addScaledVector($U,X);let q=1/(M+R+F);return Y=R*q,X=F*q,Q.copy($).addScaledVector(Z7,Y).addScaledVector(W7,X)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class SJ{constructor(J=new A(1/0,1/0,1/0),Q=new A(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromArray(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q+=3)this.expandByPoint(d9.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(d9.fromBufferAttribute(J,Q));return this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=d9.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}setFromObject(J,Q=!1){return this.makeEmpty(),this.expandByObject(J,Q)}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){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(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(J){return this.isEmpty()?J.set(0,0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}expandByObject(J,Q=!1){J.updateWorldMatrix(!1,!1);let $=J.geometry;if($!==void 0){let W=$.getAttribute("position");if(Q===!0&&W!==void 0&&J.isInstancedMesh!==!0)for(let Y=0,X=W.count;Y<X;Y++){if(J.isMesh===!0)J.getVertexPosition(Y,d9);else d9.fromBufferAttribute(W,Y);d9.applyMatrix4(J.matrixWorld),this.expandByPoint(d9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();y$.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();y$.copy($.boundingBox)}y$.applyMatrix4(J.matrixWorld),this.union(y$)}}let Z=J.children;for(let W=0,Y=Z.length;W<Y;W++)this.expandByObject(Z[W],Q);return this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y&&J.z>=this.min.z&&J.z<=this.max.z}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y&&this.min.z<=J.min.z&&J.max.z<=this.max.z}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y),(J.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y&&J.max.z>=this.min.z&&J.min.z<=this.max.z}intersectsSphere(J){return this.clampPoint(J.center,d9),d9.distanceToSquared(J.center)<=J.radius*J.radius}intersectsPlane(J){let Q,$;if(J.normal.x>0)Q=J.normal.x*this.min.x,$=J.normal.x*this.max.x;else Q=J.normal.x*this.max.x,$=J.normal.x*this.min.x;if(J.normal.y>0)Q+=J.normal.y*this.min.y,$+=J.normal.y*this.max.y;else Q+=J.normal.y*this.max.y,$+=J.normal.y*this.min.y;if(J.normal.z>0)Q+=J.normal.z*this.min.z,$+=J.normal.z*this.max.z;else Q+=J.normal.z*this.max.z,$+=J.normal.z*this.min.z;return Q<=-J.constant&&$>=-J.constant}intersectsTriangle(J){if(this.isEmpty())return!1;this.getCenter(YQ),x$.subVectors(this.max,YQ),Y7.subVectors(J.a,YQ),X7.subVectors(J.b,YQ),K7.subVectors(J.c,YQ),f8.subVectors(X7,Y7),g8.subVectors(K7,X7),H6.subVectors(Y7,K7);let Q=[0,-f8.z,f8.y,0,-g8.z,g8.y,0,-H6.z,H6.y,f8.z,0,-f8.x,g8.z,0,-g8.x,H6.z,0,-H6.x,-f8.y,f8.x,0,-g8.y,g8.x,0,-H6.y,H6.x,0];if(!PY(Q,Y7,X7,K7,x$))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!PY(Q,Y7,X7,K7,x$))return!1;return b$.crossVectors(f8,g8),Q=[b$.x,b$.y,b$.z],PY(Q,Y7,X7,K7,x$)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,d9).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(d9).length()*0.5;return J}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}applyMatrix4(J){if(this.isEmpty())return this;return M8[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),M8[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),M8[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),M8[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),M8[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),M8[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),M8[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),M8[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(M8),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(J){return this.min.fromArray(J.min),this.max.fromArray(J.max),this}}var M8=[new A,new A,new A,new A,new A,new A,new A,new A],d9=new A,y$=new SJ,Y7=new A,X7=new A,K7=new A,f8=new A,g8=new A,H6=new A,YQ=new A,x$=new A,b$=new A,U6=new A;function PY(J,Q,$,Z,W){for(let Y=0,X=J.length-3;Y<=X;Y+=3){U6.fromArray(J,Y);let K=W.x*Math.abs(U6.x)+W.y*Math.abs(U6.y)+W.z*Math.abs(U6.z),H=Q.dot(U6),U=$.dot(U6),G=Z.dot(U6);if(Math.max(-Math.max(H,U,G),Math.min(H,U,G))>K)return!1}return!0}var B8=FF();function FF(){let J=new ArrayBuffer(4),Q=new Float32Array(J),$=new Uint32Array(J),Z=new Uint32Array(512),W=new Uint32Array(512);for(let H=0;H<256;++H){let U=H-127;if(U<-27)Z[H]=0,Z[H|256]=32768,W[H]=24,W[H|256]=24;else if(U<-14)Z[H]=1024>>-U-14,Z[H|256]=1024>>-U-14|32768,W[H]=-U-1,W[H|256]=-U-1;else if(U<=15)Z[H]=U+15<<10,Z[H|256]=U+15<<10|32768,W[H]=13,W[H|256]=13;else if(U<128)Z[H]=31744,Z[H|256]=64512,W[H]=24,W[H|256]=24;else Z[H]=31744,Z[H|256]=64512,W[H]=13,W[H|256]=13}let Y=new Uint32Array(2048),X=new Uint32Array(64),K=new Uint32Array(64);for(let H=1;H<1024;++H){let U=H<<13,G=0;while((U&8388608)===0)U<<=1,G-=8388608;U&=-8388609,G+=947912704,Y[H]=U|G}for(let H=1024;H<2048;++H)Y[H]=939524096+(H-1024<<13);for(let H=1;H<31;++H)X[H]=H<<23;X[31]=1199570944,X[32]=2147483648;for(let H=33;H<63;++H)X[H]=2147483648+(H-32<<23);X[63]=3347054592;for(let H=1;H<64;++H)if(H!==32)K[H]=1024;return{floatView:Q,uint32View:$,baseTable:Z,shiftTable:W,mantissaTable:Y,exponentTable:X,offsetTable:K}}function U9(J){if(Math.abs(J)>65504)O0("DataUtils.toHalfFloat(): Value out of range.");J=s0(J,-65504,65504),B8.floatView[0]=J;let Q=B8.uint32View[0],$=Q>>23&511;return B8.baseTable[$]+((Q&8388607)>>B8.shiftTable[$])}function RQ(J){let Q=J>>10;return B8.uint32View[0]=B8.mantissaTable[B8.offsetTable[Q]+(J&1023)]+B8.exponentTable[Q],B8.floatView[0]}class J6{static toHalfFloat(J){return U9(J)}static fromHalfFloat(J){return RQ(J)}}var pJ=new A,h$=new i,NF=0;class i0 extends B9{constructor(J,Q,$=!1){super();if(Array.isArray(J))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:NF++}),this.name="",this.array=J,this.itemSize=Q,this.count=J!==void 0?J.length/Q:0,this.normalized=$,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.name=J.name,this.array=new J.array.constructor(J.array),this.itemSize=J.itemSize,this.count=J.count,this.normalized=J.normalized,this.usage=J.usage,this.gpuType=J.gpuType,this}copyAt(J,Q,$){J*=this.itemSize,$*=Q.itemSize;for(let Z=0,W=this.itemSize;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}copyArray(J){return this.array.set(J),this}applyMatrix3(J){if(this.itemSize===2)for(let Q=0,$=this.count;Q<$;Q++)h$.fromBufferAttribute(this,Q),h$.applyMatrix3(J),this.setXY(Q,h$.x,h$.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)pJ.fromBufferAttribute(this,Q),pJ.applyMatrix3(J),this.setXYZ(Q,pJ.x,pJ.y,pJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)pJ.fromBufferAttribute(this,Q),pJ.applyMatrix4(J),this.setXYZ(Q,pJ.x,pJ.y,pJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)pJ.fromBufferAttribute(this,Q),pJ.applyNormalMatrix(J),this.setXYZ(Q,pJ.x,pJ.y,pJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)pJ.fromBufferAttribute(this,Q),pJ.transformDirection(J),this.setXYZ(Q,pJ.x,pJ.y,pJ.z);return this}set(J,Q=0){return this.array.set(J,Q),this}getComponent(J,Q){let $=this.array[J*this.itemSize+Q];if(this.normalized)$=W9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=W9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize]=Q,this}getY(J){let Q=this.array[J*this.itemSize+1];if(this.normalized)Q=W9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+1]=Q,this}getZ(J){let Q=this.array[J*this.itemSize+2];if(this.normalized)Q=W9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+2]=Q,this}getW(J){let Q=this.array[J*this.itemSize+3];if(this.normalized)Q=W9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array),W=QJ(W,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this.array[J+3]=W,this}onUpload(J){return this.onUploadCallback=J,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let J={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")J.name=this.name;if(this.usage!==35044)J.usage=this.usage;return J}dispose(){this.dispatchEvent({type:"dispose"})}}class $K extends i0{constructor(J,Q,$){super(new Int8Array(J),Q,$)}}class ZK extends i0{constructor(J,Q,$){super(new Uint8Array(J),Q,$)}}class WK extends i0{constructor(J,Q,$){super(new Uint8ClampedArray(J),Q,$)}}class YK extends i0{constructor(J,Q,$){super(new Int16Array(J),Q,$)}}class uQ extends i0{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class XK extends i0{constructor(J,Q,$){super(new Int32Array(J),Q,$)}}class dQ extends i0{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class KK extends i0{constructor(J,Q,$){super(new Uint16Array(J),Q,$);this.isFloat16BufferAttribute=!0}getX(J){let Q=RQ(this.array[J*this.itemSize]);if(this.normalized)Q=W9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize]=U9(Q),this}getY(J){let Q=RQ(this.array[J*this.itemSize+1]);if(this.normalized)Q=W9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+1]=U9(Q),this}getZ(J){let Q=RQ(this.array[J*this.itemSize+2]);if(this.normalized)Q=W9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+2]=U9(Q),this}getW(J){let Q=RQ(this.array[J*this.itemSize+3]);if(this.normalized)Q=W9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+3]=U9(Q),this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.array[J+0]=U9(Q),this.array[J+1]=U9($),this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array);return this.array[J+0]=U9(Q),this.array[J+1]=U9($),this.array[J+2]=U9(Z),this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array),W=QJ(W,this.array);return this.array[J+0]=U9(Q),this.array[J+1]=U9($),this.array[J+2]=U9(Z),this.array[J+3]=U9(W),this}}class z0 extends i0{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var OF=new SJ,XQ=new A,AY=new A;class _J{constructor(J=new A,Q=-1){this.isSphere=!0,this.center=J,this.radius=Q}set(J,Q){return this.center.copy(J),this.radius=Q,this}setFromPoints(J,Q){let $=this.center;if(Q!==void 0)$.copy(Q);else OF.setFromPoints(J).getCenter($);let Z=0;for(let W=0,Y=J.length;W<Y;W++)Z=Math.max(Z,$.distanceToSquared(J[W]));return this.radius=Math.sqrt(Z),this}copy(J){return this.center.copy(J.center),this.radius=J.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(J){return J.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(J){return J.distanceTo(this.center)-this.radius}intersectsSphere(J){let Q=this.radius+J.radius;return J.center.distanceToSquared(this.center)<=Q*Q}intersectsBox(J){return J.intersectsSphere(this)}intersectsPlane(J){return Math.abs(J.distanceToPoint(this.center))<=this.radius}clampPoint(J,Q){let $=this.center.distanceToSquared(J);if(Q.copy(J),$>this.radius*this.radius)Q.sub(this.center).normalize(),Q.multiplyScalar(this.radius).add(this.center);return Q}getBoundingBox(J){if(this.isEmpty())return J.makeEmpty(),J;return J.set(this.center,this.center),J.expandByScalar(this.radius),J}applyMatrix4(J){return this.center.applyMatrix4(J),this.radius=this.radius*J.getMaxScaleOnAxis(),this}translate(J){return this.center.add(J),this}expandByPoint(J){if(this.isEmpty())return this.center.copy(J),this.radius=0,this;XQ.subVectors(J,this.center);let Q=XQ.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(XQ,Z/$),this.radius+=Z}return this}union(J){if(J.isEmpty())return this;if(this.isEmpty())return this.copy(J),this;if(this.center.equals(J.center)===!0)this.radius=Math.max(this.radius,J.radius);else AY.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(XQ.copy(J.center).add(AY)),this.expandByPoint(XQ.copy(J.center).sub(AY));return this}equals(J){return J.center.equals(this.center)&&J.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(J){return this.radius=J.radius,this.center.fromArray(J.center),this}}var qF=0,_9=new y0,TY=new HJ,H7=new A,D9=new SJ,KQ=new SJ,cJ=new A;class u0 extends B9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:qF++}),this.uuid=M9(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(J){if(Array.isArray(J))this.index=new((f1(J))?dQ:uQ)(J,1);else this.index=J;return this}setIndirect(J,Q=0){return this.indirect=J,this.indirectOffset=Q,this}getIndirect(){return this.indirect}getAttribute(J){return this.attributes[J]}setAttribute(J,Q){return this.attributes[J]=Q,this}deleteAttribute(J){return delete this.attributes[J],this}hasAttribute(J){return this.attributes[J]!==void 0}addGroup(J,Q,$=0){this.groups.push({start:J,count:Q,materialIndex:$})}clearGroups(){this.groups=[]}setDrawRange(J,Q){this.drawRange.start=J,this.drawRange.count=Q}applyMatrix4(J){let Q=this.attributes.position;if(Q!==void 0)Q.applyMatrix4(J),Q.needsUpdate=!0;let $=this.attributes.normal;if($!==void 0){let W=new o0().getNormalMatrix(J);$.applyNormalMatrix(W),$.needsUpdate=!0}let Z=this.attributes.tangent;if(Z!==void 0)Z.transformDirection(J),Z.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this}applyQuaternion(J){return _9.makeRotationFromQuaternion(J),this.applyMatrix4(_9),this}rotateX(J){return _9.makeRotationX(J),this.applyMatrix4(_9),this}rotateY(J){return _9.makeRotationY(J),this.applyMatrix4(_9),this}rotateZ(J){return _9.makeRotationZ(J),this.applyMatrix4(_9),this}translate(J,Q,$){return _9.makeTranslation(J,Q,$),this.applyMatrix4(_9),this}scale(J,Q,$){return _9.makeScale(J,Q,$),this.applyMatrix4(_9),this}lookAt(J){return TY.lookAt(J),TY.updateMatrix(),this.applyMatrix4(TY.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(H7).negate(),this.translate(H7.x,H7.y,H7.z),this}setFromPoints(J){let Q=this.getAttribute("position");if(Q===void 0){let $=[];for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];$.push(Y.x,Y.y,Y.z||0)}this.setAttribute("position",new z0($,3))}else{let $=Math.min(J.length,Q.count);for(let Z=0;Z<$;Z++){let W=J[Z];Q.setXYZ(Z,W.x,W.y,W.z||0)}if(J.length>Q.count)O0("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");Q.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new SJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){v0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new A(-1/0,-1/0,-1/0),new A(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(D9.setFromBufferAttribute(W),this.morphTargetsRelative)cJ.addVectors(this.boundingBox.min,D9.min),this.boundingBox.expandByPoint(cJ),cJ.addVectors(this.boundingBox.max,D9.max),this.boundingBox.expandByPoint(cJ);else this.boundingBox.expandByPoint(D9.min),this.boundingBox.expandByPoint(D9.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))v0('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new _J;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){v0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new A,1/0);return}if(J){let $=this.boundingSphere.center;if(D9.setFromBufferAttribute(J),Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W];if(KQ.setFromBufferAttribute(X),this.morphTargetsRelative)cJ.addVectors(D9.min,KQ.min),D9.expandByPoint(cJ),cJ.addVectors(D9.max,KQ.max),D9.expandByPoint(cJ);else D9.expandByPoint(KQ.min),D9.expandByPoint(KQ.max)}D9.getCenter($);let Z=0;for(let W=0,Y=J.count;W<Y;W++)cJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(cJ));if(Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W],K=this.morphTargetsRelative;for(let H=0,U=X.count;H<U;H++){if(cJ.fromBufferAttribute(X,H),K)H7.fromBufferAttribute(J,H),cJ.add(H7);Z=Math.max(Z,$.distanceToSquared(cJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))v0('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let J=this.index,Q=this.attributes;if(J===null||Q.position===void 0||Q.normal===void 0||Q.uv===void 0){v0("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:$,normal:Z,uv:W}=Q;if(this.hasAttribute("tangent")===!1)this.setAttribute("tangent",new i0(new Float32Array(4*$.count),4));let Y=this.getAttribute("tangent"),X=[],K=[];for(let B=0;B<$.count;B++)X[B]=new A,K[B]=new A;let H=new A,U=new A,G=new A,F=new i,E=new i,O=new i,R=new A,M=new A;function q(B,k,C){H.fromBufferAttribute($,B),U.fromBufferAttribute($,k),G.fromBufferAttribute($,C),F.fromBufferAttribute(W,B),E.fromBufferAttribute(W,k),O.fromBufferAttribute(W,C),U.sub(H),G.sub(H),E.sub(F),O.sub(F);let j=1/(E.x*O.y-O.x*E.y);if(!isFinite(j))return;R.copy(U).multiplyScalar(O.y).addScaledVector(G,-E.y).multiplyScalar(j),M.copy(G).multiplyScalar(E.x).addScaledVector(U,-O.x).multiplyScalar(j),X[B].add(R),X[k].add(R),X[C].add(R),K[B].add(M),K[k].add(M),K[C].add(M)}let N=this.groups;if(N.length===0)N=[{start:0,count:J.count}];for(let B=0,k=N.length;B<k;++B){let C=N[B],j=C.start,w=C.count;for(let v=j,b=j+w;v<b;v+=3)q(J.getX(v+0),J.getX(v+1),J.getX(v+2))}let L=new A,D=new A,V=new A,z=new A;function I(B){V.fromBufferAttribute(Z,B),z.copy(V);let k=X[B];L.copy(k),L.sub(V.multiplyScalar(V.dot(k))).normalize(),D.crossVectors(z,k);let j=D.dot(K[B])<0?-1:1;Y.setXYZW(B,L.x,L.y,L.z,j)}for(let B=0,k=N.length;B<k;++B){let C=N[B],j=C.start,w=C.count;for(let v=j,b=j+w;v<b;v+=3)I(J.getX(v+0)),I(J.getX(v+1)),I(J.getX(v+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new i0(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let F=0,E=$.count;F<E;F++)$.setXYZ(F,0,0,0);let Z=new A,W=new A,Y=new A,X=new A,K=new A,H=new A,U=new A,G=new A;if(J)for(let F=0,E=J.count;F<E;F+=3){let O=J.getX(F+0),R=J.getX(F+1),M=J.getX(F+2);Z.fromBufferAttribute(Q,O),W.fromBufferAttribute(Q,R),Y.fromBufferAttribute(Q,M),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),X.fromBufferAttribute($,O),K.fromBufferAttribute($,R),H.fromBufferAttribute($,M),X.add(U),K.add(U),H.add(U),$.setXYZ(O,X.x,X.y,X.z),$.setXYZ(R,K.x,K.y,K.z),$.setXYZ(M,H.x,H.y,H.z)}else for(let F=0,E=Q.count;F<E;F+=3)Z.fromBufferAttribute(Q,F+0),W.fromBufferAttribute(Q,F+1),Y.fromBufferAttribute(Q,F+2),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),$.setXYZ(F+0,U.x,U.y,U.z),$.setXYZ(F+1,U.x,U.y,U.z),$.setXYZ(F+2,U.x,U.y,U.z);this.normalizeNormals(),$.needsUpdate=!0}}normalizeNormals(){let J=this.attributes.normal;for(let Q=0,$=J.count;Q<$;Q++)cJ.fromBufferAttribute(J,Q),cJ.normalize(),J.setXYZ(Q,cJ.x,cJ.y,cJ.z)}toNonIndexed(){function J(X,K){let{array:H,itemSize:U,normalized:G}=X,F=new H.constructor(K.length*U),E=0,O=0;for(let R=0,M=K.length;R<M;R++){if(X.isInterleavedBufferAttribute)E=K[R]*X.data.stride+X.offset;else E=K[R]*U;for(let q=0;q<U;q++)F[O++]=H[E++]}return new i0(F,U,G)}if(this.index===null)return O0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new u0,$=this.index.array,Z=this.attributes;for(let X in Z){let K=Z[X],H=J(K,$);Q.setAttribute(X,H)}let W=this.morphAttributes;for(let X in W){let K=[],H=W[X];for(let U=0,G=H.length;U<G;U++){let F=H[U],E=J(F,$);K.push(E)}Q.morphAttributes[X]=K}Q.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;for(let X=0,K=Y.length;X<K;X++){let H=Y[X];Q.addGroup(H.start,H.count,H.materialIndex)}return Q}toJSON(){let J={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(J.uuid=this.uuid,J.type=this.type,this.name!=="")J.name=this.name;if(Object.keys(this.userData).length>0)J.userData=this.userData;if(this.parameters!==void 0){let K=this.parameters;for(let H in K)if(K[H]!==void 0)J[H]=K[H];return J}J.data={attributes:{}};let Q=this.index;if(Q!==null)J.data.index={type:Q.array.constructor.name,array:Array.prototype.slice.call(Q.array)};let $=this.attributes;for(let K in $){let H=$[K];J.data.attributes[K]=H.toJSON(J.data)}let Z={},W=!1;for(let K in this.morphAttributes){let H=this.morphAttributes[K],U=[];for(let G=0,F=H.length;G<F;G++){let E=H[G];U.push(E.toJSON(J.data))}if(U.length>0)Z[K]=U,W=!0}if(W)J.data.morphAttributes=Z,J.data.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;if(Y.length>0)J.data.groups=JSON.parse(JSON.stringify(Y));let X=this.boundingSphere;if(X!==null)J.data.boundingSphere=X.toJSON();return J}clone(){return new this.constructor().copy(this)}copy(J){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let Q={};this.name=J.name;let $=J.index;if($!==null)this.setIndex($.clone());let Z=J.attributes;for(let H in Z){let U=Z[H];this.setAttribute(H,U.clone(Q))}let W=J.morphAttributes;for(let H in W){let U=[],G=W[H];for(let F=0,E=G.length;F<E;F++)U.push(G[F].clone(Q));this.morphAttributes[H]=U}this.morphTargetsRelative=J.morphTargetsRelative;let Y=J.groups;for(let H=0,U=Y.length;H<U;H++){let G=Y[H];this.addGroup(G.start,G.count,G.materialIndex)}let X=J.boundingBox;if(X!==null)this.boundingBox=X.clone();let K=J.boundingSphere;if(K!==null)this.boundingSphere=K.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class P8{constructor(J,Q){this.isInterleavedBuffer=!0,this.array=J,this.stride=Q,this.count=J!==void 0?J.length/Q:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=M9()}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.array=new J.array.constructor(J.array),this.count=J.count,this.stride=J.stride,this.usage=J.usage,this}copyAt(J,Q,$){J*=this.stride,$*=Q.stride;for(let Z=0,W=this.stride;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}set(J,Q=0){return this.array.set(J,Q),this}clone(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=M9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let Q=new this.array.constructor(J.arrayBuffers[this.array.buffer._uuid]),$=new this.constructor(Q,this.stride);return $.setUsage(this.usage),$}onUpload(J){return this.onUploadCallback=J,this}toJSON(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=M9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var Z9=new A;class l9{constructor(J,Q,$,Z=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=J,this.itemSize=Q,this.offset=$,this.normalized=Z}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(J){this.data.needsUpdate=J}applyMatrix4(J){for(let Q=0,$=this.data.count;Q<$;Q++)Z9.fromBufferAttribute(this,Q),Z9.applyMatrix4(J),this.setXYZ(Q,Z9.x,Z9.y,Z9.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)Z9.fromBufferAttribute(this,Q),Z9.applyNormalMatrix(J),this.setXYZ(Q,Z9.x,Z9.y,Z9.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)Z9.fromBufferAttribute(this,Q),Z9.transformDirection(J),this.setXYZ(Q,Z9.x,Z9.y,Z9.z);return this}getComponent(J,Q){let $=this.array[J*this.data.stride+this.offset+Q];if(this.normalized)$=W9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+3]=Q,this}getX(J){let Q=this.data.array[J*this.data.stride+this.offset];if(this.normalized)Q=W9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=W9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=W9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=W9(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array),W=QJ(W,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this.data.array[J+3]=W,this}clone(J){if(J===void 0){B7("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return new i0(new this.array.constructor(Q),this.itemSize,this.normalized)}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.clone(J);return new l9(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){B7("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Q,normalized:this.normalized}}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.toJSON(J);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var RF=0;class vJ extends B9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:RF++}),this.uuid=M9(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new e(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(J){if(this._alphaTest>0!==J>0)this.version++;this._alphaTest=J}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(J){if(J===void 0)return;for(let Q in J){let $=J[Q];if($===void 0){O0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){O0(`Material: '${Q}' is not a property of THREE.${this.type}.`);continue}if(Z&&Z.isColor)Z.set($);else if(Z&&Z.isVector3&&($&&$.isVector3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(Q)J={textures:{},images:{}};let $={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if($.uuid=this.uuid,$.type=this.type,this.name!=="")$.name=this.name;if(this.color&&this.color.isColor)$.color=this.color.getHex();if(this.roughness!==void 0)$.roughness=this.roughness;if(this.metalness!==void 0)$.metalness=this.metalness;if(this.sheen!==void 0)$.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)$.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)$.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)$.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)$.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)$.specular=this.specular.getHex();if(this.specularIntensity!==void 0)$.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)$.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)$.shininess=this.shininess;if(this.clearcoat!==void 0)$.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)$.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)$.clearcoatMap=this.clearcoatMap.toJSON(J).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)$.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(J).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)$.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(J).uuid,$.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)$.sheenColorMap=this.sheenColorMap.toJSON(J).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)$.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(J).uuid;if(this.dispersion!==void 0)$.dispersion=this.dispersion;if(this.iridescence!==void 0)$.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)$.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)$.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)$.iridescenceMap=this.iridescenceMap.toJSON(J).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)$.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(J).uuid;if(this.anisotropy!==void 0)$.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)$.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)$.anisotropyMap=this.anisotropyMap.toJSON(J).uuid;if(this.map&&this.map.isTexture)$.map=this.map.toJSON(J).uuid;if(this.matcap&&this.matcap.isTexture)$.matcap=this.matcap.toJSON(J).uuid;if(this.alphaMap&&this.alphaMap.isTexture)$.alphaMap=this.alphaMap.toJSON(J).uuid;if(this.lightMap&&this.lightMap.isTexture)$.lightMap=this.lightMap.toJSON(J).uuid,$.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)$.aoMap=this.aoMap.toJSON(J).uuid,$.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)$.bumpMap=this.bumpMap.toJSON(J).uuid,$.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)$.normalMap=this.normalMap.toJSON(J).uuid,$.normalMapType=this.normalMapType,$.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)$.displacementMap=this.displacementMap.toJSON(J).uuid,$.displacementScale=this.displacementScale,$.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)$.roughnessMap=this.roughnessMap.toJSON(J).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)$.metalnessMap=this.metalnessMap.toJSON(J).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)$.emissiveMap=this.emissiveMap.toJSON(J).uuid;if(this.specularMap&&this.specularMap.isTexture)$.specularMap=this.specularMap.toJSON(J).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)$.specularIntensityMap=this.specularIntensityMap.toJSON(J).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)$.specularColorMap=this.specularColorMap.toJSON(J).uuid;if(this.envMap&&this.envMap.isTexture){if($.envMap=this.envMap.toJSON(J).uuid,this.combine!==void 0)$.combine=this.combine}if(this.envMapRotation!==void 0)$.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)$.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)$.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)$.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)$.gradientMap=this.gradientMap.toJSON(J).uuid;if(this.transmission!==void 0)$.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)$.transmissionMap=this.transmissionMap.toJSON(J).uuid;if(this.thickness!==void 0)$.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)$.thicknessMap=this.thicknessMap.toJSON(J).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)$.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)$.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)$.size=this.size;if(this.shadowSide!==null)$.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)$.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)$.blending=this.blending;if(this.side!==0)$.side=this.side;if(this.vertexColors===!0)$.vertexColors=!0;if(this.opacity<1)$.opacity=this.opacity;if(this.transparent===!0)$.transparent=!0;if(this.blendSrc!==204)$.blendSrc=this.blendSrc;if(this.blendDst!==205)$.blendDst=this.blendDst;if(this.blendEquation!==100)$.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)$.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)$.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)$.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)$.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)$.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)$.depthFunc=this.depthFunc;if(this.depthTest===!1)$.depthTest=this.depthTest;if(this.depthWrite===!1)$.depthWrite=this.depthWrite;if(this.colorWrite===!1)$.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)$.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)$.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)$.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)$.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)$.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)$.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)$.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)$.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)$.rotation=this.rotation;if(this.polygonOffset===!0)$.polygonOffset=!0;if(this.polygonOffsetFactor!==0)$.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)$.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)$.linewidth=this.linewidth;if(this.dashSize!==void 0)$.dashSize=this.dashSize;if(this.gapSize!==void 0)$.gapSize=this.gapSize;if(this.scale!==void 0)$.scale=this.scale;if(this.dithering===!0)$.dithering=!0;if(this.alphaTest>0)$.alphaTest=this.alphaTest;if(this.alphaHash===!0)$.alphaHash=!0;if(this.alphaToCoverage===!0)$.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)$.premultipliedAlpha=!0;if(this.forceSinglePass===!0)$.forceSinglePass=!0;if(this.allowOverride===!1)$.allowOverride=!1;if(this.wireframe===!0)$.wireframe=!0;if(this.wireframeLinewidth>1)$.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")$.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")$.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)$.flatShading=!0;if(this.visible===!1)$.visible=!1;if(this.toneMapped===!1)$.toneMapped=!1;if(this.fog===!1)$.fog=!1;if(Object.keys(this.userData).length>0)$.userData=this.userData;function Z(W){let Y=[];for(let X in W){let K=W[X];delete K.metadata,Y.push(K)}return Y}if(Q){let W=Z(J.textures),Y=Z(J.images);if(W.length>0)$.textures=W;if(Y.length>0)$.images=Y}return $}clone(){return new this.constructor().copy(this)}copy(J){this.name=J.name,this.blending=J.blending,this.side=J.side,this.vertexColors=J.vertexColors,this.opacity=J.opacity,this.transparent=J.transparent,this.blendSrc=J.blendSrc,this.blendDst=J.blendDst,this.blendEquation=J.blendEquation,this.blendSrcAlpha=J.blendSrcAlpha,this.blendDstAlpha=J.blendDstAlpha,this.blendEquationAlpha=J.blendEquationAlpha,this.blendColor.copy(J.blendColor),this.blendAlpha=J.blendAlpha,this.depthFunc=J.depthFunc,this.depthTest=J.depthTest,this.depthWrite=J.depthWrite,this.stencilWriteMask=J.stencilWriteMask,this.stencilFunc=J.stencilFunc,this.stencilRef=J.stencilRef,this.stencilFuncMask=J.stencilFuncMask,this.stencilFail=J.stencilFail,this.stencilZFail=J.stencilZFail,this.stencilZPass=J.stencilZPass,this.stencilWrite=J.stencilWrite;let Q=J.clippingPlanes,$=null;if(Q!==null){let Z=Q.length;$=Array(Z);for(let W=0;W!==Z;++W)$[W]=Q[W].clone()}return this.clippingPlanes=$,this.clipIntersection=J.clipIntersection,this.clipShadows=J.clipShadows,this.shadowSide=J.shadowSide,this.colorWrite=J.colorWrite,this.precision=J.precision,this.polygonOffset=J.polygonOffset,this.polygonOffsetFactor=J.polygonOffsetFactor,this.polygonOffsetUnits=J.polygonOffsetUnits,this.dithering=J.dithering,this.alphaTest=J.alphaTest,this.alphaHash=J.alphaHash,this.alphaToCoverage=J.alphaToCoverage,this.premultipliedAlpha=J.premultipliedAlpha,this.forceSinglePass=J.forceSinglePass,this.allowOverride=J.allowOverride,this.visible=J.visible,this.toneMapped=J.toneMapped,this.userData=JSON.parse(JSON.stringify(J.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(J){if(J===!0)this.version++}}class mQ extends vJ{constructor(J){super();this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new e(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.rotation=J.rotation,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var U7,HQ=new A,G7=new A,E7=new A,F7=new i,UQ=new i,F5=new y0,f$=new A,GQ=new A,g$=new A,ZU=new i,SY=new i,WU=new i;class RW extends HJ{constructor(J=new mQ){super();if(this.isSprite=!0,this.type="Sprite",U7===void 0){U7=new u0;let Q=new Float32Array([-0.5,-0.5,0,0,0,0.5,-0.5,0,1,0,0.5,0.5,0,1,1,-0.5,0.5,0,0,1]),$=new P8(Q,5);U7.setIndex([0,1,2,0,2,3]),U7.setAttribute("position",new l9($,3,0,!1)),U7.setAttribute("uv",new l9($,2,3,!1))}this.geometry=U7,this.material=J,this.center=new i(0.5,0.5),this.count=1}raycast(J,Q){if(J.camera===null)v0('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');if(G7.setFromMatrixScale(this.matrixWorld),F5.copy(J.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(J.camera.matrixWorldInverse,this.matrixWorld),E7.setFromMatrixPosition(this.modelViewMatrix),J.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1)G7.multiplyScalar(-E7.z);let $=this.material.rotation,Z,W;if($!==0)W=Math.cos($),Z=Math.sin($);let Y=this.center;p$(f$.set(-0.5,-0.5,0),E7,Y,G7,Z,W),p$(GQ.set(0.5,-0.5,0),E7,Y,G7,Z,W),p$(g$.set(0.5,0.5,0),E7,Y,G7,Z,W),ZU.set(0,0),SY.set(1,0),WU.set(1,1);let X=J.ray.intersectTriangle(f$,GQ,g$,!1,HQ);if(X===null){if(p$(GQ.set(-0.5,0.5,0),E7,Y,G7,Z,W),SY.set(0,1),X=J.ray.intersectTriangle(f$,g$,GQ,!1,HQ),X===null)return}let K=J.ray.origin.distanceTo(HQ);if(K<J.near||K>J.far)return;Q.push({distance:K,point:HQ.clone(),uv:Y9.getInterpolation(HQ,f$,GQ,g$,ZU,SY,WU,new i),face:null,object:this})}copy(J,Q){if(super.copy(J,Q),J.center!==void 0)this.center.copy(J.center);return this.material=J.material,this}}function p$(J,Q,$,Z,W,Y){if(F7.subVectors(J,$).addScalar(0.5).multiply(Z),W!==void 0)UQ.x=Y*F7.x-W*F7.y,UQ.y=W*F7.x+Y*F7.y;else UQ.copy(F7);J.copy(Q),J.x+=UQ.x,J.y+=UQ.y,J.applyMatrix4(F5)}var u$=new A,YU=new A;class LW extends HJ{constructor(){super();this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(J){super.copy(J,!1);let Q=J.levels;for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];this.addLevel(W.object.clone(),W.distance,W.hysteresis)}return this.autoUpdate=J.autoUpdate,this}addLevel(J,Q=0,$=0){Q=Math.abs(Q);let Z=this.levels,W;for(W=0;W<Z.length;W++)if(Q<Z[W].distance)break;return Z.splice(W,0,{distance:Q,hysteresis:$,object:J}),this.add(J),this}removeLevel(J){let Q=this.levels;for(let $=0;$<Q.length;$++)if(Q[$].distance===J){let Z=Q.splice($,1);return this.remove(Z[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(J){let Q=this.levels;if(Q.length>0){let $,Z;for($=1,Z=Q.length;$<Z;$++){let W=Q[$].distance;if(Q[$].object.visible)W-=W*Q[$].hysteresis;if(J<W)break}return Q[$-1].object}return null}raycast(J,Q){if(this.levels.length>0){u$.setFromMatrixPosition(this.matrixWorld);let Z=J.ray.origin.distanceTo(u$);this.getObjectForDistance(Z).raycast(J,Q)}}update(J){let Q=this.levels;if(Q.length>1){u$.setFromMatrixPosition(J.matrixWorld),YU.setFromMatrixPosition(this.matrixWorld);let $=u$.distanceTo(YU)/J.zoom;Q[0].object.visible=!0;let Z,W;for(Z=1,W=Q.length;Z<W;Z++){let Y=Q[Z].distance;if(Q[Z].object.visible)Y-=Y*Q[Z].hysteresis;if($>=Y)Q[Z-1].object.visible=!1,Q[Z].object.visible=!0;else break}this._currentLevel=Z-1;for(;Z<W;Z++)Q[Z].object.visible=!1}}toJSON(J){let Q=super.toJSON(J);if(this.autoUpdate===!1)Q.object.autoUpdate=!1;Q.object.levels=[];let $=this.levels;for(let Z=0,W=$.length;Z<W;Z++){let Y=$[Z];Q.object.levels.push({object:Y.object.uuid,distance:Y.distance,hysteresis:Y.hysteresis})}return Q}}var k8=new A,jY=new A,d$=new A,p8=new A,vY=new A,m$=new A,yY=new A;class Q6{constructor(J=new A,Q=new A(0,0,-1)){this.origin=J,this.direction=Q}set(J,Q){return this.origin.copy(J),this.direction.copy(Q),this}copy(J){return this.origin.copy(J.origin),this.direction.copy(J.direction),this}at(J,Q){return Q.copy(this.origin).addScaledVector(this.direction,J)}lookAt(J){return this.direction.copy(J).sub(this.origin).normalize(),this}recast(J){return this.origin.copy(this.at(J,k8)),this}closestPointToPoint(J,Q){Q.subVectors(J,this.origin);let $=Q.dot(this.direction);if($<0)return Q.copy(this.origin);return Q.copy(this.origin).addScaledVector(this.direction,$)}distanceToPoint(J){return Math.sqrt(this.distanceSqToPoint(J))}distanceSqToPoint(J){let Q=k8.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return k8.copy(this.origin).addScaledVector(this.direction,Q),k8.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){jY.copy(J).add(Q).multiplyScalar(0.5),d$.copy(Q).sub(J).normalize(),p8.copy(this.origin).sub(jY);let W=J.distanceTo(Q)*0.5,Y=-this.direction.dot(d$),X=p8.dot(this.direction),K=-p8.dot(d$),H=p8.lengthSq(),U=Math.abs(1-Y*Y),G,F,E,O;if(U>0)if(G=Y*K-X,F=Y*X-K,O=W*U,G>=0)if(F>=-O)if(F<=O){let R=1/U;G*=R,F*=R,E=G*(G+Y*F+2*X)+F*(Y*G+F+2*K)+H}else F=W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else F=-W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else if(F<=-O)G=Math.max(0,-(-Y*W+X)),F=G>0?-W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else if(F<=O)G=0,F=Math.min(Math.max(-W,-K),W),E=F*(F+2*K)+H;else G=Math.max(0,-(Y*W+X)),F=G>0?W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else F=Y>0?-W:W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;if($)$.copy(this.origin).addScaledVector(this.direction,G);if(Z)Z.copy(jY).addScaledVector(d$,F);return E}intersectSphere(J,Q){k8.subVectors(J.center,this.origin);let $=k8.dot(this.direction),Z=k8.dot(k8)-$*$,W=J.radius*J.radius;if(Z>W)return null;let Y=Math.sqrt(W-Z),X=$-Y,K=$+Y;if(K<0)return null;if(X<0)return this.at(K,Q);return this.at(X,Q)}intersectsSphere(J){if(J.radius<0)return!1;return this.distanceSqToPoint(J.center)<=J.radius*J.radius}distanceToPlane(J){let Q=J.normal.dot(this.direction);if(Q===0){if(J.distanceToPoint(this.origin)===0)return 0;return null}let $=-(this.origin.dot(J.normal)+J.constant)/Q;return $>=0?$:null}intersectPlane(J,Q){let $=this.distanceToPlane(J);if($===null)return null;return this.at($,Q)}intersectsPlane(J){let Q=J.distanceToPoint(this.origin);if(Q===0)return!0;if(J.normal.dot(this.direction)*Q<0)return!0;return!1}intersectBox(J,Q){let $,Z,W,Y,X,K,H=1/this.direction.x,U=1/this.direction.y,G=1/this.direction.z,F=this.origin;if(H>=0)$=(J.min.x-F.x)*H,Z=(J.max.x-F.x)*H;else $=(J.max.x-F.x)*H,Z=(J.min.x-F.x)*H;if(U>=0)W=(J.min.y-F.y)*U,Y=(J.max.y-F.y)*U;else W=(J.max.y-F.y)*U,Y=(J.min.y-F.y)*U;if($>Y||W>Z)return null;if(W>$||isNaN($))$=W;if(Y<Z||isNaN(Z))Z=Y;if(G>=0)X=(J.min.z-F.z)*G,K=(J.max.z-F.z)*G;else X=(J.max.z-F.z)*G,K=(J.min.z-F.z)*G;if($>K||X>Z)return null;if(X>$||$!==$)$=X;if(K<Z||Z!==Z)Z=K;if(Z<0)return null;return this.at($>=0?$:Z,Q)}intersectsBox(J){return this.intersectBox(J,k8)!==null}intersectTriangle(J,Q,$,Z,W){vY.subVectors(Q,J),m$.subVectors($,J),yY.crossVectors(vY,m$);let Y=this.direction.dot(yY),X;if(Y>0){if(Z)return null;X=1}else if(Y<0)X=-1,Y=-Y;else return null;p8.subVectors(this.origin,J);let K=X*this.direction.dot(m$.crossVectors(p8,m$));if(K<0)return null;let H=X*this.direction.dot(vY.cross(p8));if(H<0)return null;if(K+H>Y)return null;let U=-X*p8.dot(yY);if(U<0)return null;return this.at(U/Y,W)}applyMatrix4(J){return this.origin.applyMatrix4(J),this.direction.transformDirection(J),this}equals(J){return J.origin.equals(this.origin)&&J.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class nJ extends vJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new e(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.envMapRotation=new A9,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}var XU=new y0,G6=new Q6,l$=new _J,KU=new A,c$=new A,n$=new A,s$=new A,xY=new A,i$=new A,HU=new A,o$=new A;class a0 extends HJ{constructor(J=new u0,Q=new nJ){super();this.isMesh=!0,this.type="Mesh",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(J,Q){if(super.copy(J,Q),J.morphTargetInfluences!==void 0)this.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);return this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}getVertexPosition(J,Q){let $=this.geometry,Z=$.attributes.position,W=$.morphAttributes.position,Y=$.morphTargetsRelative;Q.fromBufferAttribute(Z,J);let X=this.morphTargetInfluences;if(W&&X){i$.set(0,0,0);for(let K=0,H=W.length;K<H;K++){let U=X[K],G=W[K];if(U===0)continue;if(xY.fromBufferAttribute(G,J),Y)i$.addScaledVector(xY,U);else i$.addScaledVector(xY.sub(Q),U)}Q.add(i$)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(l$.copy($.boundingSphere),l$.applyMatrix4(W),G6.copy(J.ray).recast(J.near),l$.containsPoint(G6.origin)===!1){if(G6.intersectSphere(l$,KU)===null)return;if(G6.origin.distanceToSquared(KU)>(J.far-J.near)**2)return}if(XU.copy(W).invert(),G6.copy(J.ray).applyMatrix4(XU),$.boundingBox!==null){if(G6.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,G6)}_computeIntersections(J,Q,$){let Z,W=this.geometry,Y=this.material,X=W.index,K=W.attributes.position,H=W.attributes.uv,U=W.attributes.uv1,G=W.attributes.normal,F=W.groups,E=W.drawRange;if(X!==null)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let M=F[O],q=Y[M.materialIndex],N=Math.max(M.start,E.start),L=Math.min(X.count,Math.min(M.start+M.count,E.start+E.count));for(let D=N,V=L;D<V;D+=3){let z=X.getX(D),I=X.getX(D+1),B=X.getX(D+2);if(Z=a$(this,q,J,$,H,U,G,z,I,B),Z)Z.faceIndex=Math.floor(D/3),Z.face.materialIndex=M.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(X.count,E.start+E.count);for(let M=O,q=R;M<q;M+=3){let N=X.getX(M),L=X.getX(M+1),D=X.getX(M+2);if(Z=a$(this,Y,J,$,H,U,G,N,L,D),Z)Z.faceIndex=Math.floor(M/3),Q.push(Z)}}else if(K!==void 0)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let M=F[O],q=Y[M.materialIndex],N=Math.max(M.start,E.start),L=Math.min(K.count,Math.min(M.start+M.count,E.start+E.count));for(let D=N,V=L;D<V;D+=3){let z=D,I=D+1,B=D+2;if(Z=a$(this,q,J,$,H,U,G,z,I,B),Z)Z.faceIndex=Math.floor(D/3),Z.face.materialIndex=M.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(K.count,E.start+E.count);for(let M=O,q=R;M<q;M+=3){let N=M,L=M+1,D=M+2;if(Z=a$(this,Y,J,$,H,U,G,N,L,D),Z)Z.faceIndex=Math.floor(M/3),Q.push(Z)}}}}function LF(J,Q,$,Z,W,Y,X,K){let H;if(Q.side===1)H=Z.intersectTriangle(X,Y,W,!0,K);else H=Z.intersectTriangle(W,Y,X,Q.side===0,K);if(H===null)return null;o$.copy(K),o$.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(o$);if(U<$.near||U>$.far)return null;return{distance:U,point:o$.clone(),object:J}}function a$(J,Q,$,Z,W,Y,X,K,H,U){J.getVertexPosition(K,c$),J.getVertexPosition(H,n$),J.getVertexPosition(U,s$);let G=LF(J,Q,$,Z,c$,n$,s$,HU);if(G){let F=new A;if(Y9.getBarycoord(HU,c$,n$,s$,F),W)G.uv=Y9.getInterpolatedAttribute(W,K,H,U,F,new i);if(Y)G.uv1=Y9.getInterpolatedAttribute(Y,K,H,U,F,new i);if(X){if(G.normal=Y9.getInterpolatedAttribute(X,K,H,U,F,new A),G.normal.dot(Z.direction)>0)G.normal.multiplyScalar(-1)}let E={a:K,b:H,c:U,normal:new A,materialIndex:0};Y9.getNormal(c$,n$,s$,E.normal),G.face=E,G.barycoord=F}return G}var EQ=new FJ,UU=new FJ,GU=new FJ,DF=new FJ,EU=new y0,r$=new A,bY=new _J,FU=new y0,hY=new Q6;class g7 extends a0{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new y0,this.bindMatrixInverse=new y0,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let J=this.geometry;if(this.boundingBox===null)this.boundingBox=new SJ;this.boundingBox.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,r$),this.boundingBox.expandByPoint(r$)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new _J;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,r$),this.boundingSphere.expandByPoint(r$)}copy(J,Q){if(super.copy(J,Q),this.bindMode=J.bindMode,this.bindMatrix.copy(J.bindMatrix),this.bindMatrixInverse.copy(J.bindMatrixInverse),this.skeleton=J.skeleton,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}raycast(J,Q){let $=this.material,Z=this.matrixWorld;if($===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(bY.copy(this.boundingSphere),bY.applyMatrix4(Z),J.ray.intersectsSphere(bY)===!1)return;if(FU.copy(Z).invert(),hY.copy(J.ray).applyMatrix4(FU),this.boundingBox!==null){if(hY.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,hY)}getVertexPosition(J,Q){return super.getVertexPosition(J,Q),this.applyBoneTransform(J,Q),Q}bind(J,Q){if(this.skeleton=J,Q===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Q=this.matrixWorld;this.bindMatrix.copy(Q),this.bindMatrixInverse.copy(Q).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let J=new FJ,Q=this.geometry.attributes.skinWeight;for(let $=0,Z=Q.count;$<Z;$++){J.fromBufferAttribute(Q,$);let W=1/J.manhattanLength();if(W!==1/0)J.multiplyScalar(W);else J.set(1,0,0,0);Q.setXYZW($,J.x,J.y,J.z,J.w)}}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else O0("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(J,Q){let $=this.skeleton,Z=this.geometry;if(UU.fromBufferAttribute(Z.attributes.skinIndex,J),GU.fromBufferAttribute(Z.attributes.skinWeight,J),Q.isVector4)EQ.copy(Q),Q.set(0,0,0,0);else EQ.set(...Q,1),Q.set(0,0,0);EQ.applyMatrix4(this.bindMatrix);for(let W=0;W<4;W++){let Y=GU.getComponent(W);if(Y!==0){let X=UU.getComponent(W);EU.multiplyMatrices($.bones[X].matrixWorld,$.boneInverses[X]),Q.addScaledVector(DF.copy(EQ).applyMatrix4(EU),Y)}}if(Q.isVector4)Q.w=EQ.w;return Q.applyMatrix4(this.bindMatrixInverse)}}class y6 extends HJ{constructor(){super();this.isBone=!0,this.type="Bone"}}class k9 extends kJ{constructor(J=null,Q=1,$=1,Z,W,Y,X,K,H=1003,U=1003,G,F){super(null,Y,X,K,H,U,Z,W,G,F);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var NU=new y0,MF=new y0;class x6{constructor(J=[],Q=[]){this.uuid=M9(),this.bones=J.slice(0),this.boneInverses=Q,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let J=this.bones,Q=this.boneInverses;if(this.boneMatrices=new Float32Array(J.length*16),Q.length===0)this.calculateInverses();else if(J.length!==Q.length){O0("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let $=0,Z=this.bones.length;$<Z;$++)this.boneInverses.push(new y0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new y0;if(this.bones[J])$.copy(this.bones[J].matrixWorld).invert();this.boneInverses.push($)}}pose(){for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($)$.matrixWorld.copy(this.boneInverses[J]).invert()}for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($){if($.parent&&$.parent.isBone)$.matrix.copy($.parent.matrixWorld).invert(),$.matrix.multiply($.matrixWorld);else $.matrix.copy($.matrixWorld);$.matrix.decompose($.position,$.quaternion,$.scale)}}}update(){let J=this.bones,Q=this.boneInverses,$=this.boneMatrices,Z=this.boneTexture;for(let W=0,Y=J.length;W<Y;W++){let X=J[W]?J[W].matrixWorld:MF;NU.multiplyMatrices(X,Q[W]),NU.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new x6(this.bones,this.boneInverses)}computeBoneTexture(){let J=Math.sqrt(this.bones.length*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4);Q.set(this.boneMatrices);let $=new k9(Q,J,J,1023,1015);return $.needsUpdate=!0,this.boneMatrices=Q,this.boneTexture=$,this}getBoneByName(J){for(let Q=0,$=this.bones.length;Q<$;Q++){let Z=this.bones[Q];if(Z.name===J)return Z}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(J,Q){this.uuid=J.uuid;for(let $=0,Z=J.bones.length;$<Z;$++){let W=J.bones[$],Y=Q[W];if(Y===void 0)O0("Skeleton: No bone found with UUID:",W),Y=new y6;this.bones.push(Y),this.boneInverses.push(new y0().fromArray(J.boneInverses[$]))}return this.init(),this}toJSON(){let J={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};J.uuid=this.uuid;let Q=this.bones,$=this.boneInverses;for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z];J.bones.push(Y.uuid);let X=$[Z];J.boneInverses.push(X.toArray())}return J}}class c9 extends i0{constructor(J,Q,$,Z=1){super(J,Q,$);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Z}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}toJSON(){let J=super.toJSON();return J.meshPerAttribute=this.meshPerAttribute,J.isInstancedBufferAttribute=!0,J}}var N7=new y0,OU=new y0,t$=[],qU=new SJ,kF=new y0,FQ=new a0,NQ=new _J;class U8 extends a0{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new c9(new Float32Array($*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=$,this.boundingBox=null,this.boundingSphere=null;for(let Z=0;Z<$;Z++)this.setMatrixAt(Z,kF)}computeBoundingBox(){let J=this.geometry,Q=this.count;if(this.boundingBox===null)this.boundingBox=new SJ;if(J.boundingBox===null)J.computeBoundingBox();this.boundingBox.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,N7),qU.copy(J.boundingBox).applyMatrix4(N7),this.boundingBox.union(qU)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new _J;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,N7),NQ.copy(J.boundingSphere).applyMatrix4(N7),this.boundingSphere.union(NQ)}copy(J,Q){if(super.copy(J,Q),this.instanceMatrix.copy(J.instanceMatrix),J.previousInstanceMatrix!==null)this.previousInstanceMatrix=J.previousInstanceMatrix.clone();if(J.morphTexture!==null)this.morphTexture=J.morphTexture.clone();if(J.instanceColor!==null)this.instanceColor=J.instanceColor.clone();if(this.count=J.count,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}getColorAt(J,Q){if(this.instanceColor===null)return Q.setRGB(1,1,1);else return Q.fromArray(this.instanceColor.array,J*3)}getMatrixAt(J,Q){return Q.fromArray(this.instanceMatrix.array,J*16)}getMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=this.morphTexture.source.data.data,W=$.length+1,Y=J*W+1;for(let X=0;X<$.length;X++)$[X]=Z[Y+X]}raycast(J,Q){let $=this.matrixWorld,Z=this.count;if(FQ.geometry=this.geometry,FQ.material=this.material,FQ.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(NQ.copy(this.boundingSphere),NQ.applyMatrix4($),J.ray.intersectsSphere(NQ)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,N7),OU.multiplyMatrices($,N7),FQ.matrixWorld=OU,FQ.raycast(J,t$);for(let Y=0,X=t$.length;Y<X;Y++){let K=t$[Y];K.instanceId=W,K.object=this,Q.push(K)}t$.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new c9(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return Q.toArray(this.instanceColor.array,J*3),this}setMatrixAt(J,Q){return Q.toArray(this.instanceMatrix.array,J*16),this}setMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=$.length+1;if(this.morphTexture===null)this.morphTexture=new k9(new Float32Array(Z*this.count),Z,this.count,1028,1015);let W=this.morphTexture.source.data.data,Y=0;for(let H=0;H<$.length;H++)Y+=$[H];let X=this.geometry.morphTargetsRelative?1:1-Y,K=Z*J;return W[K]=X,W.set($,K+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var fY=new A,VF=new A,BF=new o0;class w9{constructor(J=new A(1,0,0),Q=0){this.isPlane=!0,this.normal=J,this.constant=Q}set(J,Q){return this.normal.copy(J),this.constant=Q,this}setComponents(J,Q,$,Z){return this.normal.set(J,Q,$),this.constant=Z,this}setFromNormalAndCoplanarPoint(J,Q){return this.normal.copy(J),this.constant=-Q.dot(this.normal),this}setFromCoplanarPoints(J,Q,$){let Z=fY.subVectors($,Q).cross(VF.subVectors(J,Q)).normalize();return this.setFromNormalAndCoplanarPoint(Z,J),this}copy(J){return this.normal.copy(J.normal),this.constant=J.constant,this}normalize(){let J=1/this.normal.length();return this.normal.multiplyScalar(J),this.constant*=J,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(J){return this.normal.dot(J)+this.constant}distanceToSphere(J){return this.distanceToPoint(J.center)-J.radius}projectPoint(J,Q){return Q.copy(J).addScaledVector(this.normal,-this.distanceToPoint(J))}intersectLine(J,Q,$=!0){let Z=J.delta(fY),W=this.normal.dot(Z);if(W===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let Y=-(J.start.dot(this.normal)+this.constant)/W;if($===!0&&(Y<0||Y>1))return null;return Q.copy(J.start).addScaledVector(Z,Y)}intersectsLine(J){let Q=this.distanceToPoint(J.start),$=this.distanceToPoint(J.end);return Q<0&&$>0||$<0&&Q>0}intersectsBox(J){return J.intersectsPlane(this)}intersectsSphere(J){return J.intersectsPlane(this)}coplanarPoint(J){return J.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(J,Q){let $=Q||BF.getNormalMatrix(J),Z=this.coplanarPoint(fY).applyMatrix4(J),W=this.normal.applyMatrix3($).normalize();return this.constant=-Z.dot(W),this}translate(J){return this.constant-=J.dot(this.normal),this}equals(J){return J.normal.equals(this.normal)&&J.constant===this.constant}clone(){return new this.constructor().copy(this)}}var E6=new _J,CF=new i(0.5,0.5),e$=new A;class G8{constructor(J=new w9,Q=new w9,$=new w9,Z=new w9,W=new w9,Y=new w9){this.planes=[J,Q,$,Z,W,Y]}set(J,Q,$,Z,W,Y){let X=this.planes;return X[0].copy(J),X[1].copy(Q),X[2].copy($),X[3].copy(Z),X[4].copy(W),X[5].copy(Y),this}copy(J){let Q=this.planes;for(let $=0;$<6;$++)Q[$].copy(J.planes[$]);return this}setFromProjectionMatrix(J,Q=2000,$=!1){let Z=this.planes,W=J.elements,Y=W[0],X=W[1],K=W[2],H=W[3],U=W[4],G=W[5],F=W[6],E=W[7],O=W[8],R=W[9],M=W[10],q=W[11],N=W[12],L=W[13],D=W[14],V=W[15];if(Z[0].setComponents(H-Y,E-U,q-O,V-N).normalize(),Z[1].setComponents(H+Y,E+U,q+O,V+N).normalize(),Z[2].setComponents(H+X,E+G,q+R,V+L).normalize(),Z[3].setComponents(H-X,E-G,q-R,V-L).normalize(),$)Z[4].setComponents(K,F,M,D).normalize(),Z[5].setComponents(H-K,E-F,q-M,V-D).normalize();else if(Z[4].setComponents(H-K,E-F,q-M,V-D).normalize(),Q===2000)Z[5].setComponents(H+K,E+F,q+M,V+D).normalize();else if(Q===2001)Z[5].setComponents(K,F,M,D).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+Q);return this}intersectsObject(J){if(J.boundingSphere!==void 0){if(J.boundingSphere===null)J.computeBoundingSphere();E6.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();E6.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(E6)}intersectsSprite(J){E6.center.set(0,0,0);let Q=CF.distanceTo(J.center);return E6.radius=0.7071067811865476+Q,E6.applyMatrix4(J.matrixWorld),this.intersectsSphere(E6)}intersectsSphere(J){let Q=this.planes,$=J.center,Z=-J.radius;for(let W=0;W<6;W++)if(Q[W].distanceToPoint($)<Z)return!1;return!0}intersectsBox(J){let Q=this.planes;for(let $=0;$<6;$++){let Z=Q[$];if(e$.x=Z.normal.x>0?J.max.x:J.min.x,e$.y=Z.normal.y>0?J.max.y:J.min.y,e$.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(e$)<0)return!1}return!0}containsPoint(J){let Q=this.planes;for(let $=0;$<6;$++)if(Q[$].distanceToPoint(J)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}var Z8=new y0,W8=new G8;class lQ{constructor(){this.coordinateSystem=2000}intersectsObject(J,Q){if(!Q.isArrayCamera||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Z8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),W8.setFromProjectionMatrix(Z8,Z.coordinateSystem,Z.reversedDepth),W8.intersectsObject(J))return!0}return!1}intersectsSprite(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Z8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),W8.setFromProjectionMatrix(Z8,Z.coordinateSystem,Z.reversedDepth),W8.intersectsSprite(J))return!0}return!1}intersectsSphere(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Z8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),W8.setFromProjectionMatrix(Z8,Z.coordinateSystem,Z.reversedDepth),W8.intersectsSphere(J))return!0}return!1}intersectsBox(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Z8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),W8.setFromProjectionMatrix(Z8,Z.coordinateSystem,Z.reversedDepth),W8.intersectsBox(J))return!0}return!1}containsPoint(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Z8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),W8.setFromProjectionMatrix(Z8,Z.coordinateSystem,Z.reversedDepth),W8.containsPoint(J))return!0}return!1}clone(){return new lQ}}function gY(J,Q){return J-Q}function zF(J,Q){return J.z-Q.z}function IF(J,Q){return Q.z-J.z}class N5{constructor(){this.index=0,this.pool=[],this.list=[]}push(J,Q,$,Z){let W=this.pool,Y=this.list;if(this.index>=W.length)W.push({start:-1,count:-1,z:-1,index:-1});let X=W[this.index];Y.push(X),this.index++,X.start=J,X.count=Q,X.z=$,X.index=Z}reset(){this.list.length=0,this.index=0}}var H9=new y0,_F=new e(1,1,1),RU=new G8,wF=new lQ,JZ=new SJ,F6=new _J,OQ=new A,LU=new A,PF=new A,pY=new N5,eJ=new a0,QZ=[];function AF(J,Q,$=0){let Z=Q.itemSize;if(J.isInterleavedBufferAttribute||J.array.constructor!==Q.array.constructor){let W=J.count;for(let Y=0;Y<W;Y++)for(let X=0;X<Z;X++)Q.setComponent(Y+$,X,J.getComponent(Y,X))}else Q.array.set(J.array,$*Z);Q.needsUpdate=!0}function N6(J,Q){if(J.constructor!==Q.constructor){let $=Math.min(J.length,Q.length);for(let Z=0;Z<$;Z++)Q[Z]=J[Z]}else{let $=Math.min(J.length,Q.length);Q.set(new J.constructor(J.buffer,0,$))}}class DW extends a0{constructor(J,Q,$=Q*2,Z){super(new u0,Z);this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=J,this._maxVertexCount=Q,this._maxIndexCount=$,this._multiDrawCounts=new Int32Array(J),this._multiDrawStarts=new Int32Array(J),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let J=Math.sqrt(this._maxInstanceCount*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4),$=new k9(Q,J,J,1023,1015);this._matricesTexture=$}_initIndirectTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Uint32Array(J*J),$=new k9(Q,J,J,1029,1014);this._indirectTexture=$}_initColorsTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Float32Array(J*J*4).fill(1),$=new k9(Q,J,J,1023,1015);$.colorSpace=t0.workingColorSpace,this._colorsTexture=$}_initializeGeometry(J){let Q=this.geometry,$=this._maxVertexCount,Z=this._maxIndexCount;if(this._geometryInitialized===!1){for(let W in J.attributes){let Y=J.getAttribute(W),{array:X,itemSize:K,normalized:H}=Y,U=new X.constructor($*K),G=new i0(U,K,H);Q.setAttribute(W,G)}if(J.getIndex()!==null){let W=$>65535?new Uint32Array(Z):new Uint16Array(Z);Q.setIndex(new i0(W,1))}this._geometryInitialized=!0}}_validateGeometry(J){let Q=this.geometry;if(Boolean(J.getIndex())!==Boolean(Q.getIndex()))throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let $ in Q.attributes){if(!J.hasAttribute($))throw Error(`THREE.BatchedMesh: Added geometry missing "${$}". All geometries must have consistent attributes.`);let Z=J.getAttribute($),W=Q.getAttribute($);if(Z.itemSize!==W.itemSize||Z.normalized!==W.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(J){let Q=this._instanceInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${J}. Instance is either out of range or has been deleted.`)}validateGeometryId(J){let Q=this._geometryInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${J}. Geometry is either out of range or has been deleted.`)}setCustomSort(J){return this.customSort=J,this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new SJ;let J=this.boundingBox,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,H9),this.getBoundingBoxAt(W,JZ).applyMatrix4(H9),J.union(JZ)}}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new _J;let J=this.boundingSphere,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,H9),this.getBoundingSphereAt(W,F6).applyMatrix4(H9),J.union(F6)}}addInstance(J){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error("THREE.BatchedMesh: Maximum item count reached.");let $={visible:!0,active:!0,geometryIndex:J},Z=null;if(this._availableInstanceIds.length>0)this._availableInstanceIds.sort(gY),Z=this._availableInstanceIds.shift(),this._instanceInfo[Z]=$;else Z=this._instanceInfo.length,this._instanceInfo.push($);let W=this._matricesTexture;H9.identity().toArray(W.image.data,Z*16),W.needsUpdate=!0;let Y=this._colorsTexture;if(Y)_F.toArray(Y.image.data,Z*4),Y.needsUpdate=!0;return this._visibilityChanged=!0,Z}addGeometry(J,Q=-1,$=-1){this._initializeGeometry(J),this._validateGeometry(J);let Z={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},W=this._geometryInfo;Z.vertexStart=this._nextVertexStart,Z.reservedVertexCount=Q===-1?J.getAttribute("position").count:Q;let Y=J.getIndex();if(Y!==null)Z.indexStart=this._nextIndexStart,Z.reservedIndexCount=$===-1?Y.count:$;if(Z.indexStart!==-1&&Z.indexStart+Z.reservedIndexCount>this._maxIndexCount||Z.vertexStart+Z.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let K;if(this._availableGeometryIds.length>0)this._availableGeometryIds.sort(gY),K=this._availableGeometryIds.shift(),W[K]=Z;else K=this._geometryCount,this._geometryCount++,W.push(Z);return this.setGeometryAt(K,J),this._nextIndexStart=Z.indexStart+Z.reservedIndexCount,this._nextVertexStart=Z.vertexStart+Z.reservedVertexCount,K}setGeometryAt(J,Q){if(J>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Q);let $=this.geometry,Z=$.getIndex()!==null,W=$.getIndex(),Y=Q.getIndex(),X=this._geometryInfo[J];if(Z&&Y.count>X.reservedIndexCount||Q.attributes.position.count>X.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let{vertexStart:K,reservedVertexCount:H}=X;X.vertexCount=Q.getAttribute("position").count;for(let U in $.attributes){let G=Q.getAttribute(U),F=$.getAttribute(U);AF(G,F,K);let E=G.itemSize;for(let O=G.count,R=H;O<R;O++){let M=K+O;for(let q=0;q<E;q++)F.setComponent(M,q,0)}F.needsUpdate=!0,F.addUpdateRange(K*E,H*E)}if(Z){let{indexStart:U,reservedIndexCount:G}=X;X.indexCount=Q.getIndex().count;for(let F=0;F<Y.count;F++)W.setX(U+F,K+Y.getX(F));for(let F=Y.count,E=G;F<E;F++)W.setX(U+F,K);W.needsUpdate=!0,W.addUpdateRange(U,X.reservedIndexCount)}if(X.start=Z?X.indexStart:X.vertexStart,X.count=Z?X.indexCount:X.vertexCount,X.boundingBox=null,Q.boundingBox!==null)X.boundingBox=Q.boundingBox.clone();if(X.boundingSphere=null,Q.boundingSphere!==null)X.boundingSphere=Q.boundingSphere.clone();return this._visibilityChanged=!0,J}deleteGeometry(J){let Q=this._geometryInfo;if(J>=Q.length||Q[J].active===!1)return this;let $=this._instanceInfo;for(let Z=0,W=$.length;Z<W;Z++)if($[Z].active&&$[Z].geometryIndex===J)this.deleteInstance(Z);return Q[J].active=!1,this._availableGeometryIds.push(J),this._visibilityChanged=!0,this}deleteInstance(J){return this.validateInstanceId(J),this._instanceInfo[J].active=!1,this._availableInstanceIds.push(J),this._visibilityChanged=!0,this}optimize(){let J=0,Q=0,$=this._geometryInfo,Z=$.map((Y,X)=>X).sort((Y,X)=>{return $[Y].vertexStart-$[X].vertexStart}),W=this.geometry;for(let Y=0,X=$.length;Y<X;Y++){let K=Z[Y],H=$[K];if(H.active===!1)continue;if(W.index!==null){if(H.indexStart!==Q){let{indexStart:U,vertexStart:G,reservedIndexCount:F}=H,E=W.index,O=E.array,R=J-G;for(let M=U;M<U+F;M++)O[M]=O[M]+R;E.array.copyWithin(Q,U,U+F),E.addUpdateRange(Q,F),E.needsUpdate=!0,H.indexStart=Q}Q+=H.reservedIndexCount}if(H.vertexStart!==J){let{vertexStart:U,reservedVertexCount:G}=H,F=W.attributes;for(let E in F){let O=F[E],{array:R,itemSize:M}=O;R.copyWithin(J*M,U*M,(U+G)*M),O.addUpdateRange(J*M,G*M),O.needsUpdate=!0}H.vertexStart=J}J+=H.reservedVertexCount,H.start=W.index?H.indexStart:H.vertexStart}return this._nextIndexStart=Q,this._nextVertexStart=J,this._visibilityChanged=!0,this}getBoundingBoxAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingBox===null){let W=new SJ,Y=$.index,X=$.attributes.position;for(let K=Z.start,H=Z.start+Z.count;K<H;K++){let U=K;if(Y)U=Y.getX(U);W.expandByPoint(OQ.fromBufferAttribute(X,U))}Z.boundingBox=W}return Q.copy(Z.boundingBox),Q}getBoundingSphereAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingSphere===null){let W=new _J;this.getBoundingBoxAt(J,JZ),JZ.getCenter(W.center);let Y=$.index,X=$.attributes.position,K=0;for(let H=Z.start,U=Z.start+Z.count;H<U;H++){let G=H;if(Y)G=Y.getX(G);OQ.fromBufferAttribute(X,G),K=Math.max(K,W.center.distanceToSquared(OQ))}W.radius=Math.sqrt(K),Z.boundingSphere=W}return Q.copy(Z.boundingSphere),Q}setMatrixAt(J,Q){this.validateInstanceId(J);let $=this._matricesTexture,Z=this._matricesTexture.image.data;return Q.toArray(Z,J*16),$.needsUpdate=!0,this}getMatrixAt(J,Q){return this.validateInstanceId(J),Q.fromArray(this._matricesTexture.image.data,J*16)}setColorAt(J,Q){if(this.validateInstanceId(J),this._colorsTexture===null)this._initColorsTexture();return Q.toArray(this._colorsTexture.image.data,J*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(J,Q){if(this.validateInstanceId(J),this._colorsTexture===null)if(Q.isVector4)return Q.set(1,1,1,1);else return Q.setRGB(1,1,1);else return Q.fromArray(this._colorsTexture.image.data,J*4)}setVisibleAt(J,Q){if(this.validateInstanceId(J),this._instanceInfo[J].visible===Q)return this;return this._instanceInfo[J].visible=Q,this._visibilityChanged=!0,this}getVisibleAt(J){return this.validateInstanceId(J),this._instanceInfo[J].visible}setGeometryIdAt(J,Q){return this.validateInstanceId(J),this.validateGeometryId(Q),this._instanceInfo[J].geometryIndex=Q,this}getGeometryIdAt(J){return this.validateInstanceId(J),this._instanceInfo[J].geometryIndex}getGeometryRangeAt(J,Q={}){this.validateGeometryId(J);let $=this._geometryInfo[J];return Q.vertexStart=$.vertexStart,Q.vertexCount=$.vertexCount,Q.reservedVertexCount=$.reservedVertexCount,Q.indexStart=$.indexStart,Q.indexCount=$.indexCount,Q.reservedIndexCount=$.reservedIndexCount,Q.start=$.start,Q.count=$.count,Q}setInstanceCount(J){let Q=this._availableInstanceIds,$=this._instanceInfo;Q.sort(gY);while(Q[Q.length-1]===$.length-1)$.pop(),Q.pop();if(J<$.length)throw Error(`BatchedMesh: Instance ids outside the range ${J} are being used. Cannot shrink instance count.`);let Z=new Int32Array(J),W=new Int32Array(J);N6(this._multiDrawCounts,Z),N6(this._multiDrawStarts,W),this._multiDrawCounts=Z,this._multiDrawStarts=W,this._maxInstanceCount=J;let Y=this._indirectTexture,X=this._matricesTexture,K=this._colorsTexture;if(Y.dispose(),this._initIndirectTexture(),N6(Y.image.data,this._indirectTexture.image.data),X.dispose(),this._initMatricesTexture(),N6(X.image.data,this._matricesTexture.image.data),K)K.dispose(),this._initColorsTexture(),N6(K.image.data,this._colorsTexture.image.data)}setGeometrySize(J,Q){let $=[...this._geometryInfo].filter((X)=>X.active);if(Math.max(...$.map((X)=>X.vertexStart+X.reservedVertexCount))>J)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${Q}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...$.map((K)=>K.indexStart+K.reservedIndexCount))>Q)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${Q}. Cannot shrink further.`)}let W=this.geometry;if(W.dispose(),this._maxVertexCount=J,this._maxIndexCount=Q,this._geometryInitialized)this._geometryInitialized=!1,this.geometry=new u0,this._initializeGeometry(W);let Y=this.geometry;if(W.index)N6(W.index.array,Y.index.array);for(let X in W.attributes)N6(W.attributes[X].array,Y.attributes[X].array)}raycast(J,Q){let $=this._instanceInfo,Z=this._geometryInfo,W=this.matrixWorld,Y=this.geometry;if(eJ.material=this.material,eJ.geometry.index=Y.index,eJ.geometry.attributes=Y.attributes,eJ.geometry.boundingBox===null)eJ.geometry.boundingBox=new SJ;if(eJ.geometry.boundingSphere===null)eJ.geometry.boundingSphere=new _J;for(let X=0,K=$.length;X<K;X++){if(!$[X].visible||!$[X].active)continue;let H=$[X].geometryIndex,U=Z[H];eJ.geometry.setDrawRange(U.start,U.count),this.getMatrixAt(X,eJ.matrixWorld).premultiply(W),this.getBoundingBoxAt(H,eJ.geometry.boundingBox),this.getBoundingSphereAt(H,eJ.geometry.boundingSphere),eJ.raycast(J,QZ);for(let G=0,F=QZ.length;G<F;G++){let E=QZ[G];E.object=this,E.batchId=X,Q.push(E)}QZ.length=0}eJ.material=null,eJ.geometry.index=null,eJ.geometry.attributes={},eJ.geometry.setDrawRange(0,1/0)}copy(J){if(super.copy(J),this.geometry=J.geometry.clone(),this.perObjectFrustumCulled=J.perObjectFrustumCulled,this.sortObjects=J.sortObjects,this.boundingBox=J.boundingBox!==null?J.boundingBox.clone():null,this.boundingSphere=J.boundingSphere!==null?J.boundingSphere.clone():null,this._geometryInfo=J._geometryInfo.map((Q)=>({...Q,boundingBox:Q.boundingBox!==null?Q.boundingBox.clone():null,boundingSphere:Q.boundingSphere!==null?Q.boundingSphere.clone():null})),this._instanceInfo=J._instanceInfo.map((Q)=>({...Q})),this._availableInstanceIds=J._availableInstanceIds.slice(),this._availableGeometryIds=J._availableGeometryIds.slice(),this._nextIndexStart=J._nextIndexStart,this._nextVertexStart=J._nextVertexStart,this._geometryCount=J._geometryCount,this._maxInstanceCount=J._maxInstanceCount,this._maxVertexCount=J._maxVertexCount,this._maxIndexCount=J._maxIndexCount,this._geometryInitialized=J._geometryInitialized,this._multiDrawCounts=J._multiDrawCounts.slice(),this._multiDrawStarts=J._multiDrawStarts.slice(),this._indirectTexture=J._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=J._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null)this._colorsTexture=J._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice();return this}dispose(){if(this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null)this._colorsTexture.dispose(),this._colorsTexture=null}onBeforeRender(J,Q,$,Z,W){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let Y=Z.getIndex(),X=Y===null?1:Y.array.BYTES_PER_ELEMENT,K=1;if(W.wireframe)K=2,X=Z.attributes.position.count>65535?4:2;let H=this._instanceInfo,U=this._multiDrawStarts,G=this._multiDrawCounts,F=this._geometryInfo,E=this.perObjectFrustumCulled,O=this._indirectTexture,R=O.image.data,M=$.isArrayCamera?wF:RU;if(E&&!$.isArrayCamera)H9.multiplyMatrices($.projectionMatrix,$.matrixWorldInverse).multiply(this.matrixWorld),RU.setFromProjectionMatrix(H9,$.coordinateSystem,$.reversedDepth);let q=0;if(this.sortObjects){H9.copy(this.matrixWorld).invert(),OQ.setFromMatrixPosition($.matrixWorld).applyMatrix4(H9),LU.set(0,0,-1).transformDirection($.matrixWorld).transformDirection(H9);for(let D=0,V=H.length;D<V;D++)if(H[D].visible&&H[D].active){let z=H[D].geometryIndex;this.getMatrixAt(D,H9),this.getBoundingSphereAt(z,F6).applyMatrix4(H9);let I=!1;if(E)I=!M.intersectsSphere(F6,$);if(!I){let B=F[z],k=PF.subVectors(F6.center,OQ).dot(LU);pY.push(B.start,B.count,k,D)}}let N=pY.list,L=this.customSort;if(L===null)N.sort(W.transparent?IF:zF);else L.call(this,N,$);for(let D=0,V=N.length;D<V;D++){let z=N[D];U[q]=z.start*X*K,G[q]=z.count*K,R[q]=z.index,q++}pY.reset()}else for(let N=0,L=H.length;N<L;N++)if(H[N].visible&&H[N].active){let D=H[N].geometryIndex,V=!1;if(E)this.getMatrixAt(N,H9),this.getBoundingSphereAt(D,F6).applyMatrix4(H9),V=!M.intersectsSphere(F6,$);if(!V){let z=F[D];U[q]=z.start*X*K,G[q]=z.count*K,R[q]=N,q++}}O.needsUpdate=!0,this._multiDrawCount=q,this._visibilityChanged=!1}onBeforeShadow(J,Q,$,Z,W,Y){this.onBeforeRender(J,null,Z,W,Y)}}class dJ extends vJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new e(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.linewidth=J.linewidth,this.linecap=J.linecap,this.linejoin=J.linejoin,this.fog=J.fog,this}}var kZ=new A,VZ=new A,DU=new y0,qQ=new Q6,$Z=new _J,uY=new A,MU=new A;class T9 extends HJ{constructor(J=new u0,Q=new dJ){super();this.isLine=!0,this.type="Line",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[0];for(let Z=1,W=Q.count;Z<W;Z++)kZ.fromBufferAttribute(Q,Z-1),VZ.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=kZ.distanceTo(VZ);J.setAttribute("lineDistance",new z0($,1))}else O0("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Line.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if($Z.copy($.boundingSphere),$Z.applyMatrix4(Z),$Z.radius+=W,J.ray.intersectsSphere($Z)===!1)return;DU.copy(Z).invert(),qQ.copy(J.ray).applyMatrix4(DU);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=this.isLineSegments?2:1,U=$.index,F=$.attributes.position;if(U!==null){let E=Math.max(0,Y.start),O=Math.min(U.count,Y.start+Y.count);for(let R=E,M=O-1;R<M;R+=H){let q=U.getX(R),N=U.getX(R+1),L=ZZ(this,J,qQ,K,q,N,R);if(L)Q.push(L)}if(this.isLineLoop){let R=U.getX(O-1),M=U.getX(E),q=ZZ(this,J,qQ,K,R,M,O-1);if(q)Q.push(q)}}else{let E=Math.max(0,Y.start),O=Math.min(F.count,Y.start+Y.count);for(let R=E,M=O-1;R<M;R+=H){let q=ZZ(this,J,qQ,K,R,R+1,R);if(q)Q.push(q)}if(this.isLineLoop){let R=ZZ(this,J,qQ,K,O-1,E,O-1);if(R)Q.push(R)}}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function ZZ(J,Q,$,Z,W,Y,X){let K=J.geometry.attributes.position;if(kZ.fromBufferAttribute(K,W),VZ.fromBufferAttribute(K,Y),$.distanceSqToSegment(kZ,VZ,uY,MU)>Z)return;uY.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(uY);if(U<Q.near||U>Q.far)return;return{distance:U,point:MU.clone().applyMatrix4(J.matrixWorld),index:X,face:null,faceIndex:null,barycoord:null,object:J}}var kU=new A,VU=new A;class O9 extends T9{constructor(J,Q){super(J,Q);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[];for(let Z=0,W=Q.count;Z<W;Z+=2)kU.fromBufferAttribute(Q,Z),VU.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+kU.distanceTo(VU);J.setAttribute("lineDistance",new z0($,1))}else O0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class p7 extends T9{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}}class b6 extends vJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new e(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.size=J.size,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var BU=new y0,eY=new Q6,WZ=new _J,YZ=new A;class r9 extends HJ{constructor(J=new u0,Q=new b6){super();this.isPoints=!0,this.type="Points",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Points.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(WZ.copy($.boundingSphere),WZ.applyMatrix4(Z),WZ.radius+=W,J.ray.intersectsSphere(WZ)===!1)return;BU.copy(Z).invert(),eY.copy(J.ray).applyMatrix4(BU);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=$.index,G=$.attributes.position;if(H!==null){let F=Math.max(0,Y.start),E=Math.min(H.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++){let M=H.getX(O);YZ.fromBufferAttribute(G,M),CU(YZ,M,K,Z,J,Q,this)}}else{let F=Math.max(0,Y.start),E=Math.min(G.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++)YZ.fromBufferAttribute(G,O),CU(YZ,O,K,Z,J,Q,this)}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function CU(J,Q,$,Z,W,Y,X){let K=eY.distanceSqToPoint(J);if(K<$){let H=new A;eY.closestPointToPoint(J,H),H.applyMatrix4(Z);let U=W.ray.origin.distanceTo(H);if(U<W.near||U>W.far)return;Y.push({distance:U,distanceToRay:Math.sqrt(K),point:H,index:Q,face:null,faceIndex:null,barycoord:null,object:X})}}class MW extends kJ{constructor(J,Q,$,Z,W=1006,Y=1006,X,K,H){super(J,Q,$,Z,W,Y,X,K,H);this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let U=this;function G(){U.needsUpdate=!0,U._requestVideoFrameCallbackId=J.requestVideoFrameCallback(G)}if("requestVideoFrameCallback"in J)this._requestVideoFrameCallbackId=J.requestVideoFrameCallback(G)}clone(){return new this.constructor(this.image).copy(this)}update(){let J=this.image;if("requestVideoFrameCallback"in J===!1&&J.readyState>=J.HAVE_CURRENT_DATA)this.needsUpdate=!0}dispose(){if(this._requestVideoFrameCallbackId!==0)this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0;super.dispose()}}class HK extends MW{constructor(J,Q,$,Z,W,Y,X,K){super({},J,Q,$,Z,W,Y,X,K);this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(J){this.image=J,this.needsUpdate=!0}}class UK extends kJ{constructor(J,Q){super({width:J,height:Q});this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class u7 extends kJ{constructor(J,Q,$,Z,W,Y,X,K,H,U,G,F){super(null,Y,X,K,H,U,Z,W,G,F);this.isCompressedTexture=!0,this.image={width:Q,height:$},this.mipmaps=J,this.flipY=!1,this.generateMipmaps=!1}}class GK extends u7{constructor(J,Q,$,Z,W,Y){super(J,Q,$,W,Y);this.isCompressedArrayTexture=!0,this.image.depth=Z,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class EK extends u7{constructor(J,Q,$){super(void 0,J[0].width,J[0].height,Q,$,301);this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=J}}class h6 extends kJ{constructor(J=[],Q=301,$,Z,W,Y,X,K,H,U){super(J,Q,$,Z,W,Y,X,K,H,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}}class cQ extends kJ{constructor(J,Q,$,Z,W,Y,X,K,H){super(J,Q,$,Z,W,Y,X,K,H);this.isCanvasTexture=!0,this.needsUpdate=!0}}class FK extends kJ{constructor(J,Q,$,Z,W,Y,X,K,H){super(J,Q,$,Z,W,Y,X,K,H);this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let U=J?J.parentNode:null;if(U!==null&&"requestPaint"in U)U.onpaint=()=>{this.needsUpdate=!0},U.requestPaint()}dispose(){let J=this.image?this.image.parentNode:null;if(J!==null&&"onpaint"in J)J.onpaint=null;super.dispose()}}class A8 extends kJ{constructor(J,Q,$=1014,Z,W,Y,X=1003,K=1003,H,U=1026,G=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let F={width:J,height:Q,depth:G};super(F,Z,W,Y,X,K,U,$,H);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new X8(Object.assign({},J.image)),this.compareFunction=J.compareFunction,this}toJSON(J){let Q=super.toJSON(J);if(this.compareFunction!==null)Q.compareFunction=this.compareFunction;return Q}}class kW extends A8{constructor(J,Q=1014,$=301,Z,W,Y=1003,X=1003,K,H=1026){let U={width:J,height:J,depth:1},G=[U,U,U,U,U,U];super(J,J,Q,$,Z,W,Y,X,K,H);this.image=G,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}}class nQ extends kJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class Q9 extends u0{constructor(J=1,Q=1,$=1,Z=1,W=1,Y=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:Z,heightSegments:W,depthSegments:Y};let X=this;Z=Math.floor(Z),W=Math.floor(W),Y=Math.floor(Y);let K=[],H=[],U=[],G=[],F=0,E=0;O("z","y","x",-1,-1,$,Q,J,Y,W,0),O("z","y","x",1,-1,$,Q,-J,Y,W,1),O("x","z","y",1,1,J,$,Q,Z,Y,2),O("x","z","y",1,-1,J,$,-Q,Z,Y,3),O("x","y","z",1,-1,J,Q,$,Z,W,4),O("x","y","z",-1,-1,J,Q,-$,Z,W,5),this.setIndex(K),this.setAttribute("position",new z0(H,3)),this.setAttribute("normal",new z0(U,3)),this.setAttribute("uv",new z0(G,2));function O(R,M,q,N,L,D,V,z,I,B,k){let C=D/I,j=V/B,w=D/2,v=V/2,b=z/2,S=I+1,h=B+1,x=0,p=0,c=new A;for(let o=0;o<h;o++){let W0=o*j-v;for(let H0=0;H0<S;H0++){let J0=H0*C-w;c[R]=J0*N,c[M]=W0*L,c[q]=b,H.push(c.x,c.y,c.z),c[R]=0,c[M]=0,c[q]=z>0?1:-1,U.push(c.x,c.y,c.z),G.push(H0/I),G.push(1-o/B),x+=1}}for(let o=0;o<B;o++)for(let W0=0;W0<I;W0++){let H0=F+W0+S*o,J0=F+W0+S*(o+1),c0=F+(W0+1)+S*(o+1),d0=F+(W0+1)+S*o;K.push(H0,J0,d0),K.push(J0,c0,d0),p+=6}X.addGroup(E,p,k),E+=p,F+=x}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new Q9(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class sQ extends u0{constructor(J=1,Q=1,$=4,Z=8,W=1){super();this.type="CapsuleGeometry",this.parameters={radius:J,height:Q,capSegments:$,radialSegments:Z,heightSegments:W},Q=Math.max(0,Q),$=Math.max(1,Math.floor($)),Z=Math.max(3,Math.floor(Z)),W=Math.max(1,Math.floor(W));let Y=[],X=[],K=[],H=[],U=Q/2,G=Math.PI/2*J,F=Q,E=2*G+F,O=$*2+W,R=Z+1,M=new A,q=new A;for(let N=0;N<=O;N++){let L=0,D=0,V=0,z=0;if(N<=$){let k=N/$,C=k*Math.PI/2;D=-U-J*Math.cos(C),V=J*Math.sin(C),z=-J*Math.cos(C),L=k*G}else if(N<=$+W){let k=(N-$)/W;D=-U+k*Q,V=J,z=0,L=G+k*F}else{let k=(N-$-W)/$,C=k*Math.PI/2;D=U+J*Math.sin(C),V=J*Math.cos(C),z=J*Math.sin(C),L=G+F+k*G}let I=Math.max(0,Math.min(1,L/E)),B=0;if(N===0)B=0.5/Z;else if(N===O)B=-0.5/Z;for(let k=0;k<=Z;k++){let C=k/Z,j=C*Math.PI*2,w=Math.sin(j),v=Math.cos(j);q.x=-V*v,q.y=D,q.z=V*w,X.push(q.x,q.y,q.z),M.set(-V*v,z,V*w),M.normalize(),K.push(M.x,M.y,M.z),H.push(C+B,I)}if(N>0){let k=(N-1)*R;for(let C=0;C<Z;C++){let j=k+C,w=k+C+1,v=N*R+C,b=N*R+C+1;Y.push(j,w,v),Y.push(w,b,v)}}}this.setIndex(Y),this.setAttribute("position",new z0(X,3)),this.setAttribute("normal",new z0(K,3)),this.setAttribute("uv",new z0(H,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new sQ(J.radius,J.height,J.capSegments,J.radialSegments,J.heightSegments)}}class iQ extends u0{constructor(J=1,Q=32,$=0,Z=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:J,segments:Q,thetaStart:$,thetaLength:Z},Q=Math.max(3,Q);let W=[],Y=[],X=[],K=[],H=new A,U=new i;Y.push(0,0,0),X.push(0,0,1),K.push(0.5,0.5);for(let G=0,F=3;G<=Q;G++,F+=3){let E=$+G/Q*Z;H.x=J*Math.cos(E),H.y=J*Math.sin(E),Y.push(H.x,H.y,H.z),X.push(0,0,1),U.x=(Y[F]/J+1)/2,U.y=(Y[F+1]/J+1)/2,K.push(U.x,U.y)}for(let G=1;G<=Q;G++)W.push(G,G+1,0);this.setIndex(W),this.setAttribute("position",new z0(Y,3)),this.setAttribute("normal",new z0(X,3)),this.setAttribute("uv",new z0(K,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new iQ(J.radius,J.segments,J.thetaStart,J.thetaLength)}}class $6 extends u0{constructor(J=1,Q=1,$=1,Z=32,W=1,Y=!1,X=0,K=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:Z,heightSegments:W,openEnded:Y,thetaStart:X,thetaLength:K};let H=this;Z=Math.floor(Z),W=Math.floor(W);let U=[],G=[],F=[],E=[],O=0,R=[],M=$/2,q=0;if(N(),Y===!1){if(J>0)L(!0);if(Q>0)L(!1)}this.setIndex(U),this.setAttribute("position",new z0(G,3)),this.setAttribute("normal",new z0(F,3)),this.setAttribute("uv",new z0(E,2));function N(){let D=new A,V=new A,z=0,I=(Q-J)/$;for(let B=0;B<=W;B++){let k=[],C=B/W,j=C*(Q-J)+J;for(let w=0;w<=Z;w++){let v=w/Z,b=v*K+X,S=Math.sin(b),h=Math.cos(b);V.x=j*S,V.y=-C*$+M,V.z=j*h,G.push(V.x,V.y,V.z),D.set(S,I,h).normalize(),F.push(D.x,D.y,D.z),E.push(v,1-C),k.push(O++)}R.push(k)}for(let B=0;B<Z;B++)for(let k=0;k<W;k++){let C=R[k][B],j=R[k+1][B],w=R[k+1][B+1],v=R[k][B+1];if(J>0||k!==0)U.push(C,j,v),z+=3;if(Q>0||k!==W-1)U.push(j,w,v),z+=3}H.addGroup(q,z,0),q+=z}function L(D){let V=O,z=new i,I=new A,B=0,k=D===!0?J:Q,C=D===!0?1:-1;for(let w=1;w<=Z;w++)G.push(0,M*C,0),F.push(0,C,0),E.push(0.5,0.5),O++;let j=O;for(let w=0;w<=Z;w++){let b=w/Z*K+X,S=Math.cos(b),h=Math.sin(b);I.x=k*h,I.y=M*C,I.z=k*S,G.push(I.x,I.y,I.z),F.push(0,C,0),z.x=S*0.5+0.5,z.y=h*0.5*C+0.5,E.push(z.x,z.y),O++}for(let w=0;w<Z;w++){let v=V+w,b=j+w;if(D===!0)U.push(b,b+1,v);else U.push(b+1,b,v);B+=3}H.addGroup(q,B,D===!0?1:2),q+=B}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new $6(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class d7 extends $6{constructor(J=1,Q=1,$=32,Z=1,W=!1,Y=0,X=Math.PI*2){super(0,J,Q,$,Z,W,Y,X);this.type="ConeGeometry",this.parameters={radius:J,height:Q,radialSegments:$,heightSegments:Z,openEnded:W,thetaStart:Y,thetaLength:X}}static fromJSON(J){return new d7(J.radius,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class T8 extends u0{constructor(J=[],Q=[],$=1,Z=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:J,indices:Q,radius:$,detail:Z};let W=[],Y=[];if(X(Z),H($),U(),this.setAttribute("position",new z0(W,3)),this.setAttribute("normal",new z0(W.slice(),3)),this.setAttribute("uv",new z0(Y,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function X(N){let L=new A,D=new A,V=new A;for(let z=0;z<Q.length;z+=3)E(Q[z+0],L),E(Q[z+1],D),E(Q[z+2],V),K(L,D,V,N)}function K(N,L,D,V){let z=V+1,I=[];for(let B=0;B<=z;B++){I[B]=[];let k=N.clone().lerp(D,B/z),C=L.clone().lerp(D,B/z),j=z-B;for(let w=0;w<=j;w++)if(w===0&&B===z)I[B][w]=k;else I[B][w]=k.clone().lerp(C,w/j)}for(let B=0;B<z;B++)for(let k=0;k<2*(z-B)-1;k++){let C=Math.floor(k/2);if(k%2===0)F(I[B][C+1]),F(I[B+1][C]),F(I[B][C]);else F(I[B][C+1]),F(I[B+1][C+1]),F(I[B+1][C])}}function H(N){let L=new A;for(let D=0;D<W.length;D+=3)L.x=W[D+0],L.y=W[D+1],L.z=W[D+2],L.normalize().multiplyScalar(N),W[D+0]=L.x,W[D+1]=L.y,W[D+2]=L.z}function U(){let N=new A;for(let L=0;L<W.length;L+=3){N.x=W[L+0],N.y=W[L+1],N.z=W[L+2];let D=M(N)/2/Math.PI+0.5,V=q(N)/Math.PI+0.5;Y.push(D,1-V)}O(),G()}function G(){for(let N=0;N<Y.length;N+=6){let L=Y[N+0],D=Y[N+2],V=Y[N+4],z=Math.max(L,D,V),I=Math.min(L,D,V);if(z>0.9&&I<0.1){if(L<0.2)Y[N+0]+=1;if(D<0.2)Y[N+2]+=1;if(V<0.2)Y[N+4]+=1}}}function F(N){W.push(N.x,N.y,N.z)}function E(N,L){let D=N*3;L.x=J[D+0],L.y=J[D+1],L.z=J[D+2]}function O(){let N=new A,L=new A,D=new A,V=new A,z=new i,I=new i,B=new i;for(let k=0,C=0;k<W.length;k+=9,C+=6){N.set(W[k+0],W[k+1],W[k+2]),L.set(W[k+3],W[k+4],W[k+5]),D.set(W[k+6],W[k+7],W[k+8]),z.set(Y[C+0],Y[C+1]),I.set(Y[C+2],Y[C+3]),B.set(Y[C+4],Y[C+5]),V.copy(N).add(L).add(D).divideScalar(3);let j=M(V);R(z,C+0,N,j),R(I,C+2,L,j),R(B,C+4,D,j)}}function R(N,L,D,V){if(V<0&&N.x===1)Y[L]=N.x-1;if(D.x===0&&D.z===0)Y[L]=V/2/Math.PI+0.5}function M(N){return Math.atan2(N.z,-N.x)}function q(N){return Math.atan2(-N.y,Math.sqrt(N.x*N.x+N.z*N.z))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new T8(J.vertices,J.indices,J.radius,J.detail)}}class oQ extends T8{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=1/$,W=[-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,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,0,-$,0,-Z,$,0,-Z,-$,0,Z,$,0,Z],Y=[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];super(W,Y,J,Q);this.type="DodecahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new oQ(J.radius,J.detail)}}var XZ=new A,KZ=new A,dY=new A,HZ=new Y9;class VW extends u0{constructor(J=null,Q=1){super();if(this.type="EdgesGeometry",this.parameters={geometry:J,thresholdAngle:Q},J!==null){let Z=Math.pow(10,4),W=Math.cos(V6*Q),Y=J.getIndex(),X=J.getAttribute("position"),K=Y?Y.count:X.count,H=[0,0,0],U=["a","b","c"],G=[,,,],F={},E=[];for(let O=0;O<K;O+=3){if(Y)H[0]=Y.getX(O),H[1]=Y.getX(O+1),H[2]=Y.getX(O+2);else H[0]=O,H[1]=O+1,H[2]=O+2;let{a:R,b:M,c:q}=HZ;if(R.fromBufferAttribute(X,H[0]),M.fromBufferAttribute(X,H[1]),q.fromBufferAttribute(X,H[2]),HZ.getNormal(dY),G[0]=`${Math.round(R.x*Z)},${Math.round(R.y*Z)},${Math.round(R.z*Z)}`,G[1]=`${Math.round(M.x*Z)},${Math.round(M.y*Z)},${Math.round(M.z*Z)}`,G[2]=`${Math.round(q.x*Z)},${Math.round(q.y*Z)},${Math.round(q.z*Z)}`,G[0]===G[1]||G[1]===G[2]||G[2]===G[0])continue;for(let N=0;N<3;N++){let L=(N+1)%3,D=G[N],V=G[L],z=HZ[U[N]],I=HZ[U[L]],B=`${D}_${V}`,k=`${V}_${D}`;if(k in F&&F[k]){if(dY.dot(F[k].normal)<=W)E.push(z.x,z.y,z.z),E.push(I.x,I.y,I.z);F[k]=null}else if(!(B in F))F[B]={index0:H[N],index1:H[L],normal:dY.clone()}}}for(let O in F)if(F[O]){let{index0:R,index1:M}=F[O];XZ.fromBufferAttribute(X,R),KZ.fromBufferAttribute(X,M),E.push(XZ.x,XZ.y,XZ.z),E.push(KZ.x,KZ.y,KZ.z)}this.setAttribute("position",new z0(E,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}}class C9{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){O0("Curve: .getPoint() not implemented.")}getPointAt(J,Q){let $=this.getUtoTmapping(J);return this.getPoint($,Q)}getPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));return Q}getSpacedPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPointAt($/J));return Q}getLength(){let J=this.getLengths();return J[J.length-1]}getLengths(J=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===J+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let Q=[],$,Z=this.getPoint(0),W=0;Q.push(0);for(let Y=1;Y<=J;Y++)$=this.getPoint(Y/J),W+=$.distanceTo(Z),Q.push(W),Z=$;return this.cacheArcLengths=Q,Q}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(J,Q=null){let $=this.getLengths(),Z=0,W=$.length,Y;if(Q)Y=Q;else Y=J*$[W-1];let X=0,K=W-1,H;while(X<=K)if(Z=Math.floor(X+(K-X)/2),H=$[Z]-Y,H<0)X=Z+1;else if(H>0)K=Z-1;else{K=Z;break}if(Z=K,$[Z]===Y)return Z/(W-1);let U=$[Z],F=$[Z+1]-U,E=(Y-U)/F;return(Z+E)/(W-1)}getTangent(J,Q){let Z=J-0.0001,W=J+0.0001;if(Z<0)Z=0;if(W>1)W=1;let Y=this.getPoint(Z),X=this.getPoint(W),K=Q||(Y.isVector2?new i:new A);return K.copy(X).sub(Y).normalize(),K}getTangentAt(J,Q){let $=this.getUtoTmapping(J);return this.getTangent($,Q)}computeFrenetFrames(J,Q=!1){let $=new A,Z=[],W=[],Y=[],X=new A,K=new y0;for(let E=0;E<=J;E++){let O=E/J;Z[E]=this.getTangentAt(O,new A)}W[0]=new A,Y[0]=new A;let H=Number.MAX_VALUE,U=Math.abs(Z[0].x),G=Math.abs(Z[0].y),F=Math.abs(Z[0].z);if(U<=H)H=U,$.set(1,0,0);if(G<=H)H=G,$.set(0,1,0);if(F<=H)$.set(0,0,1);X.crossVectors(Z[0],$).normalize(),W[0].crossVectors(Z[0],X),Y[0].crossVectors(Z[0],W[0]);for(let E=1;E<=J;E++){if(W[E]=W[E-1].clone(),Y[E]=Y[E-1].clone(),X.crossVectors(Z[E-1],Z[E]),X.length()>Number.EPSILON){X.normalize();let O=Math.acos(s0(Z[E-1].dot(Z[E]),-1,1));W[E].applyMatrix4(K.makeRotationAxis(X,O))}Y[E].crossVectors(Z[E],W[E])}if(Q===!0){let E=Math.acos(s0(W[0].dot(W[J]),-1,1));if(E/=J,Z[0].dot(X.crossVectors(W[0],W[J]))>0)E=-E;for(let O=1;O<=J;O++)W[O].applyMatrix4(K.makeRotationAxis(Z[O],E*O)),Y[O].crossVectors(Z[O],W[O])}return{tangents:Z,normals:W,binormals:Y}}clone(){return new this.constructor().copy(this)}copy(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}toJSON(){let J={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return J.arcLengthDivisions=this.arcLengthDivisions,J.type=this.type,J}fromJSON(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}}class m7 extends C9{constructor(J=0,Q=0,$=1,Z=1,W=0,Y=Math.PI*2,X=!1,K=0){super();this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=J,this.aY=Q,this.xRadius=$,this.yRadius=Z,this.aStartAngle=W,this.aEndAngle=Y,this.aClockwise=X,this.aRotation=K}getPoint(J,Q=new i){let $=Q,Z=Math.PI*2,W=this.aEndAngle-this.aStartAngle,Y=Math.abs(W)<Number.EPSILON;while(W<0)W+=Z;while(W>Z)W-=Z;if(W<Number.EPSILON)if(Y)W=0;else W=Z;if(this.aClockwise===!0&&!Y)if(W===Z)W=-Z;else W=W-Z;let X=this.aStartAngle+J*W,K=this.aX+this.xRadius*Math.cos(X),H=this.aY+this.yRadius*Math.sin(X);if(this.aRotation!==0){let U=Math.cos(this.aRotation),G=Math.sin(this.aRotation),F=K-this.aX,E=H-this.aY;K=F*U-E*G+this.aX,H=F*G+E*U+this.aY}return $.set(K,H)}copy(J){return super.copy(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}toJSON(){let J=super.toJSON();return J.aX=this.aX,J.aY=this.aY,J.xRadius=this.xRadius,J.yRadius=this.yRadius,J.aStartAngle=this.aStartAngle,J.aEndAngle=this.aEndAngle,J.aClockwise=this.aClockwise,J.aRotation=this.aRotation,J}fromJSON(J){return super.fromJSON(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}}class BW extends m7{constructor(J,Q,$,Z,W,Y){super(J,Q,$,$,Z,W,Y);this.isArcCurve=!0,this.type="ArcCurve"}}function NK(){let J=0,Q=0,$=0,Z=0;function W(Y,X,K,H){J=Y,Q=K,$=-3*Y+3*X-2*K-H,Z=2*Y-2*X+K+H}return{initCatmullRom:function(Y,X,K,H,U){W(X,K,U*(K-Y),U*(H-X))},initNonuniformCatmullRom:function(Y,X,K,H,U,G,F){let E=(X-Y)/U-(K-Y)/(U+G)+(K-X)/G,O=(K-X)/G-(H-X)/(G+F)+(H-K)/F;E*=G,O*=G,W(X,K,E,O)},calc:function(Y){let X=Y*Y,K=X*Y;return J+Q*Y+$*X+Z*K}}}var zU=new A,IU=new A,mY=new NK,lY=new NK,cY=new NK;class l7 extends C9{constructor(J=[],Q=!1,$="centripetal",Z=0.5){super();this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=J,this.closed=Q,this.curveType=$,this.tension=Z}getPoint(J,Q=new A){let $=Q,Z=this.points,W=Z.length,Y=(W-(this.closed?0:1))*J,X=Math.floor(Y),K=Y-X;if(this.closed)X+=X>0?0:(Math.floor(Math.abs(X)/W)+1)*W;else if(K===0&&X===W-1)X=W-2,K=1;let H,U;if(this.closed||X>0)H=Z[(X-1)%W];else IU.subVectors(Z[0],Z[1]).add(Z[0]),H=IU;let G=Z[X%W],F=Z[(X+1)%W];if(this.closed||X+2<W)U=Z[(X+2)%W];else zU.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=zU;if(this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?0.5:0.25,O=Math.pow(H.distanceToSquared(G),E),R=Math.pow(G.distanceToSquared(F),E),M=Math.pow(F.distanceToSquared(U),E);if(R<0.0001)R=1;if(O<0.0001)O=R;if(M<0.0001)M=R;mY.initNonuniformCatmullRom(H.x,G.x,F.x,U.x,O,R,M),lY.initNonuniformCatmullRom(H.y,G.y,F.y,U.y,O,R,M),cY.initNonuniformCatmullRom(H.z,G.z,F.z,U.z,O,R,M)}else if(this.curveType==="catmullrom")mY.initCatmullRom(H.x,G.x,F.x,U.x,this.tension),lY.initCatmullRom(H.y,G.y,F.y,U.y,this.tension),cY.initCatmullRom(H.z,G.z,F.z,U.z,this.tension);return $.set(mY.calc(K),lY.calc(K),cY.calc(K)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J.closed=this.closed,J.curveType=this.curveType,J.tension=this.tension,J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new A().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}}function _U(J,Q,$,Z,W){let Y=(Z-Q)*0.5,X=(W-$)*0.5,K=J*J,H=J*K;return(2*$-2*Z+Y+X)*H+(-3*$+3*Z-2*Y-X)*K+Y*J+$}function TF(J,Q){let $=1-J;return $*$*Q}function SF(J,Q){return 2*(1-J)*J*Q}function jF(J,Q){return J*J*Q}function MQ(J,Q,$,Z){return TF(J,Q)+SF(J,$)+jF(J,Z)}function vF(J,Q){let $=1-J;return $*$*$*Q}function yF(J,Q){let $=1-J;return 3*$*$*J*Q}function xF(J,Q){return 3*(1-J)*J*J*Q}function bF(J,Q){return J*J*J*Q}function kQ(J,Q,$,Z,W){return vF(J,Q)+yF(J,$)+xF(J,Z)+bF(J,W)}class aQ extends C9{constructor(J=new i,Q=new i,$=new i,Z=new i){super();this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new i){let $=Q,Z=this.v0,W=this.v1,Y=this.v2,X=this.v3;return $.set(kQ(J,Z.x,W.x,Y.x,X.x),kQ(J,Z.y,W.y,Y.y,X.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}}class CW extends C9{constructor(J=new A,Q=new A,$=new A,Z=new A){super();this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new A){let $=Q,Z=this.v0,W=this.v1,Y=this.v2,X=this.v3;return $.set(kQ(J,Z.x,W.x,Y.x,X.x),kQ(J,Z.y,W.y,Y.y,X.y),kQ(J,Z.z,W.z,Y.z,X.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}}class rQ extends C9{constructor(J=new i,Q=new i){super();this.isLineCurve=!0,this.type="LineCurve",this.v1=J,this.v2=Q}getPoint(J,Q=new i){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new i){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class zW extends C9{constructor(J=new A,Q=new A){super();this.isLineCurve3=!0,this.type="LineCurve3",this.v1=J,this.v2=Q}getPoint(J,Q=new A){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new A){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class tQ extends C9{constructor(J=new i,Q=new i,$=new i){super();this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new i){let $=Q,Z=this.v0,W=this.v1,Y=this.v2;return $.set(MQ(J,Z.x,W.x,Y.x),MQ(J,Z.y,W.y,Y.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class eQ extends C9{constructor(J=new A,Q=new A,$=new A){super();this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new A){let $=Q,Z=this.v0,W=this.v1,Y=this.v2;return $.set(MQ(J,Z.x,W.x,Y.x),MQ(J,Z.y,W.y,Y.y),MQ(J,Z.z,W.z,Y.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class J$ extends C9{constructor(J=[]){super();this.isSplineCurve=!0,this.type="SplineCurve",this.points=J}getPoint(J,Q=new i){let $=Q,Z=this.points,W=(Z.length-1)*J,Y=Math.floor(W),X=W-Y,K=Z[Y===0?Y:Y-1],H=Z[Y],U=Z[Y>Z.length-2?Z.length-1:Y+1],G=Z[Y>Z.length-3?Z.length-1:Y+2];return $.set(_U(X,K.x,H.x,U.x,G.x),_U(X,K.y,H.y,U.y,G.y)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new i().fromArray(Z))}return this}}var BZ=Object.freeze({__proto__:null,ArcCurve:BW,CatmullRomCurve3:l7,CubicBezierCurve:aQ,CubicBezierCurve3:CW,EllipseCurve:m7,LineCurve:rQ,LineCurve3:zW,QuadraticBezierCurve:tQ,QuadraticBezierCurve3:eQ,SplineCurve:J$});class IW extends C9{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(J){this.curves.push(J)}closePath(){let J=this.curves[0].getPoint(0),Q=this.curves[this.curves.length-1].getPoint(1);if(!J.equals(Q)){let $=J.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new BZ[$](Q,J))}return this}getPoint(J,Q){let $=J*this.getLength(),Z=this.getCurveLengths(),W=0;while(W<Z.length){if(Z[W]>=$){let Y=Z[W]-$,X=this.curves[W],K=X.getLength(),H=K===0?0:1-Y/K;return X.getPointAt(H,Q)}W++}return null}getLength(){let J=this.getCurveLengths();return J[J.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let J=[],Q=0;for(let $=0,Z=this.curves.length;$<Z;$++)Q+=this.curves[$].getLength(),J.push(Q);return this.cacheLengths=J,J}getSpacedPoints(J=40){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));if(this.autoClose)Q.push(Q[0]);return Q}getPoints(J=12){let Q=[],$;for(let Z=0,W=this.curves;Z<W.length;Z++){let Y=W[Z],X=Y.isEllipseCurve?J*2:Y.isLineCurve||Y.isLineCurve3?1:Y.isSplineCurve?J*Y.points.length:J,K=Y.getPoints(X);for(let H=0;H<K.length;H++){let U=K[H];if($&&$.equals(U))continue;Q.push(U),$=U}}if(this.autoClose&&Q.length>1&&!Q[Q.length-1].equals(Q[0]))Q.push(Q[0]);return Q}copy(J){super.copy(J),this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(Z.clone())}return this.autoClose=J.autoClose,this}toJSON(){let J=super.toJSON();J.autoClose=this.autoClose,J.curves=[];for(let Q=0,$=this.curves.length;Q<$;Q++){let Z=this.curves[Q];J.curves.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.autoClose=J.autoClose,this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(new BZ[Z.type]().fromJSON(Z))}return this}}class C7 extends IW{constructor(J){super();if(this.type="Path",this.currentPoint=new i,J)this.setFromPoints(J)}setFromPoints(J){this.moveTo(J[0].x,J[0].y);for(let Q=1,$=J.length;Q<$;Q++)this.lineTo(J[Q].x,J[Q].y);return this}moveTo(J,Q){return this.currentPoint.set(J,Q),this}lineTo(J,Q){let $=new rQ(this.currentPoint.clone(),new i(J,Q));return this.curves.push($),this.currentPoint.set(J,Q),this}quadraticCurveTo(J,Q,$,Z){let W=new tQ(this.currentPoint.clone(),new i(J,Q),new i($,Z));return this.curves.push(W),this.currentPoint.set($,Z),this}bezierCurveTo(J,Q,$,Z,W,Y){let X=new aQ(this.currentPoint.clone(),new i(J,Q),new i($,Z),new i(W,Y));return this.curves.push(X),this.currentPoint.set(W,Y),this}splineThru(J){let Q=[this.currentPoint.clone()].concat(J),$=new J$(Q);return this.curves.push($),this.currentPoint.copy(J[J.length-1]),this}arc(J,Q,$,Z,W,Y){let X=this.currentPoint.x,K=this.currentPoint.y;return this.absarc(J+X,Q+K,$,Z,W,Y),this}absarc(J,Q,$,Z,W,Y){return this.absellipse(J,Q,$,$,Z,W,Y),this}ellipse(J,Q,$,Z,W,Y,X,K){let H=this.currentPoint.x,U=this.currentPoint.y;return this.absellipse(J+H,Q+U,$,Z,W,Y,X,K),this}absellipse(J,Q,$,Z,W,Y,X,K){let H=new m7(J,Q,$,Z,W,Y,X,K);if(this.curves.length>0){let G=H.getPoint(0);if(!G.equals(this.currentPoint))this.lineTo(G.x,G.y)}this.curves.push(H);let U=H.getPoint(1);return this.currentPoint.copy(U),this}copy(J){return super.copy(J),this.currentPoint.copy(J.currentPoint),this}toJSON(){let J=super.toJSON();return J.currentPoint=this.currentPoint.toArray(),J}fromJSON(J){return super.fromJSON(J),this.currentPoint.fromArray(J.currentPoint),this}}class z8 extends C7{constructor(J){super(J);this.uuid=M9(),this.type="Shape",this.holes=[]}getPointsHoles(J){let Q=[];for(let $=0,Z=this.holes.length;$<Z;$++)Q[$]=this.holes[$].getPoints(J);return Q}extractPoints(J){return{shape:this.getPoints(J),holes:this.getPointsHoles(J)}}copy(J){super.copy(J),this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.uuid=this.uuid,J.holes=[];for(let Q=0,$=this.holes.length;Q<$;Q++){let Z=this.holes[Q];J.holes.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.uuid=J.uuid,this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(new C7().fromJSON(Z))}return this}}function hF(J,Q,$=2){let Z=Q&&Q.length,W=Z?Q[0]*$:J.length,Y=O5(J,0,W,$,!0),X=[];if(!Y||Y.next===Y.prev)return X;let K,H,U;if(Z)Y=dF(J,Q,Y,$);if(J.length>80*$){K=J[0],H=J[1];let G=K,F=H;for(let E=$;E<W;E+=$){let O=J[E],R=J[E+1];if(O<K)K=O;if(R<H)H=R;if(O>G)G=O;if(R>F)F=R}U=Math.max(G-K,F-H),U=U!==0?32767/U:0}return BQ(Y,X,$,K,H,U,0),X}function O5(J,Q,$,Z,W){let Y;if(W===eF(J,Q,$,Z)>0)for(let X=Q;X<$;X+=Z)Y=wU(X/Z|0,J[X],J[X+1],Y);else for(let X=$-Z;X>=Q;X-=Z)Y=wU(X/Z|0,J[X],J[X+1],Y);if(Y&&z7(Y,Y.next))zQ(Y),Y=Y.next;return Y}function C6(J,Q){if(!J)return J;if(!Q)Q=J;let $=J,Z;do if(Z=!1,!$.steiner&&(z7($,$.next)||IJ($.prev,$,$.next)===0)){if(zQ($),$=Q=$.prev,$===$.next)break;Z=!0}else $=$.next;while(Z||$!==Q);return Q}function BQ(J,Q,$,Z,W,Y,X){if(!J)return;if(!X&&Y)sF(J,Z,W,Y);let K=J;while(J.prev!==J.next){let{prev:H,next:U}=J;if(Y?gF(J,Z,W,Y):fF(J)){Q.push(H.i,J.i,U.i),zQ(J),J=U.next,K=U.next;continue}if(J=U,J===K){if(!X)BQ(C6(J),Q,$,Z,W,Y,1);else if(X===1)J=pF(C6(J),Q),BQ(J,Q,$,Z,W,Y,2);else if(X===2)uF(J,Q,$,Z,W,Y);break}}}function fF(J){let Q=J.prev,$=J,Z=J.next;if(IJ(Q,$,Z)>=0)return!1;let W=Q.x,Y=$.x,X=Z.x,K=Q.y,H=$.y,U=Z.y,G=Math.min(W,Y,X),F=Math.min(K,H,U),E=Math.max(W,Y,X),O=Math.max(K,H,U),R=Z.next;while(R!==Q){if(R.x>=G&&R.x<=E&&R.y>=F&&R.y<=O&&LQ(W,K,Y,H,X,U,R.x,R.y)&&IJ(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function gF(J,Q,$,Z){let W=J.prev,Y=J,X=J.next;if(IJ(W,Y,X)>=0)return!1;let K=W.x,H=Y.x,U=X.x,G=W.y,F=Y.y,E=X.y,O=Math.min(K,H,U),R=Math.min(G,F,E),M=Math.max(K,H,U),q=Math.max(G,F,E),N=JX(O,R,Q,$,Z),L=JX(M,q,Q,$,Z),D=J.prevZ,V=J.nextZ;while(D&&D.z>=N&&V&&V.z<=L){if(D.x>=O&&D.x<=M&&D.y>=R&&D.y<=q&&D!==W&&D!==X&&LQ(K,G,H,F,U,E,D.x,D.y)&&IJ(D.prev,D,D.next)>=0)return!1;if(D=D.prevZ,V.x>=O&&V.x<=M&&V.y>=R&&V.y<=q&&V!==W&&V!==X&&LQ(K,G,H,F,U,E,V.x,V.y)&&IJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}while(D&&D.z>=N){if(D.x>=O&&D.x<=M&&D.y>=R&&D.y<=q&&D!==W&&D!==X&&LQ(K,G,H,F,U,E,D.x,D.y)&&IJ(D.prev,D,D.next)>=0)return!1;D=D.prevZ}while(V&&V.z<=L){if(V.x>=O&&V.x<=M&&V.y>=R&&V.y<=q&&V!==W&&V!==X&&LQ(K,G,H,F,U,E,V.x,V.y)&&IJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function pF(J,Q){let $=J;do{let Z=$.prev,W=$.next.next;if(!z7(Z,W)&&R5(Z,$,$.next,W)&&CQ(Z,W)&&CQ(W,Z))Q.push(Z.i,$.i,W.i),zQ($),zQ($.next),$=J=W;$=$.next}while($!==J);return C6($)}function uF(J,Q,$,Z,W,Y){let X=J;do{let K=X.next.next;while(K!==X.prev){if(X.i!==K.i&&aF(X,K)){let H=L5(X,K);X=C6(X,X.next),H=C6(H,H.next),BQ(X,Q,$,Z,W,Y,0),BQ(H,Q,$,Z,W,Y,0);return}K=K.next}X=X.next}while(X!==J)}function dF(J,Q,$,Z){let W=[];for(let Y=0,X=Q.length;Y<X;Y++){let K=Q[Y]*Z,H=Y<X-1?Q[Y+1]*Z:J.length,U=O5(J,K,H,Z,!1);if(U===U.next)U.steiner=!0;W.push(oF(U))}W.sort(mF);for(let Y=0;Y<W.length;Y++)$=lF(W[Y],$);return $}function mF(J,Q){let $=J.x-Q.x;if($===0){if($=J.y-Q.y,$===0){let Z=(J.next.y-J.y)/(J.next.x-J.x),W=(Q.next.y-Q.y)/(Q.next.x-Q.x);$=Z-W}}return $}function lF(J,Q){let $=cF(J,Q);if(!$)return Q;let Z=L5($,J);return C6(Z,Z.next),C6($,$.next)}function cF(J,Q){let $=Q,Z=J.x,W=J.y,Y=-1/0,X;if(z7(J,$))return $;do{if(z7(J,$.next))return $.next;else if(W<=$.y&&W>=$.next.y&&$.next.y!==$.y){let F=$.x+(W-$.y)*($.next.x-$.x)/($.next.y-$.y);if(F<=Z&&F>Y){if(Y=F,X=$.x<$.next.x?$:$.next,F===Z)return X}}$=$.next}while($!==Q);if(!X)return null;let K=X,H=X.x,U=X.y,G=1/0;$=X;do{if(Z>=$.x&&$.x>=H&&Z!==$.x&&q5(W<U?Z:Y,W,H,U,W<U?Y:Z,W,$.x,$.y)){let F=Math.abs(W-$.y)/(Z-$.x);if(CQ($,J)&&(F<G||F===G&&($.x>X.x||$.x===X.x&&nF(X,$))))X=$,G=F}$=$.next}while($!==K);return X}function nF(J,Q){return IJ(J.prev,J,Q.prev)<0&&IJ(Q.next,J,J.next)<0}function sF(J,Q,$,Z){let W=J;do{if(W.z===0)W.z=JX(W.x,W.y,Q,$,Z);W.prevZ=W.prev,W.nextZ=W.next,W=W.next}while(W!==J);W.prevZ.nextZ=null,W.prevZ=null,iF(W)}function iF(J){let Q,$=1;do{let Z=J,W;J=null;let Y=null;Q=0;while(Z){Q++;let X=Z,K=0;for(let U=0;U<$;U++)if(K++,X=X.nextZ,!X)break;let H=$;while(K>0||H>0&&X){if(K!==0&&(H===0||!X||Z.z<=X.z))W=Z,Z=Z.nextZ,K--;else W=X,X=X.nextZ,H--;if(Y)Y.nextZ=W;else J=W;W.prevZ=Y,Y=W}Z=X}Y.nextZ=null,$*=2}while(Q>1);return J}function JX(J,Q,$,Z,W){return J=(J-$)*W|0,Q=(Q-Z)*W|0,J=(J|J<<8)&16711935,J=(J|J<<4)&252645135,J=(J|J<<2)&858993459,J=(J|J<<1)&1431655765,Q=(Q|Q<<8)&16711935,Q=(Q|Q<<4)&252645135,Q=(Q|Q<<2)&858993459,Q=(Q|Q<<1)&1431655765,J|Q<<1}function oF(J){let Q=J,$=J;do{if(Q.x<$.x||Q.x===$.x&&Q.y<$.y)$=Q;Q=Q.next}while(Q!==J);return $}function q5(J,Q,$,Z,W,Y,X,K){return(W-X)*(Q-K)>=(J-X)*(Y-K)&&(J-X)*(Z-K)>=($-X)*(Q-K)&&($-X)*(Y-K)>=(W-X)*(Z-K)}function LQ(J,Q,$,Z,W,Y,X,K){return!(J===X&&Q===K)&&q5(J,Q,$,Z,W,Y,X,K)}function aF(J,Q){return J.next.i!==Q.i&&J.prev.i!==Q.i&&!rF(J,Q)&&(CQ(J,Q)&&CQ(Q,J)&&tF(J,Q)&&(IJ(J.prev,J,Q.prev)||IJ(J,Q.prev,Q))||z7(J,Q)&&IJ(J.prev,J,J.next)>0&&IJ(Q.prev,Q,Q.next)>0)}function IJ(J,Q,$){return(Q.y-J.y)*($.x-Q.x)-(Q.x-J.x)*($.y-Q.y)}function z7(J,Q){return J.x===Q.x&&J.y===Q.y}function R5(J,Q,$,Z){let W=GZ(IJ(J,Q,$)),Y=GZ(IJ(J,Q,Z)),X=GZ(IJ($,Z,J)),K=GZ(IJ($,Z,Q));if(W!==Y&&X!==K)return!0;if(W===0&&UZ(J,$,Q))return!0;if(Y===0&&UZ(J,Z,Q))return!0;if(X===0&&UZ($,J,Z))return!0;if(K===0&&UZ($,Q,Z))return!0;return!1}function UZ(J,Q,$){return Q.x<=Math.max(J.x,$.x)&&Q.x>=Math.min(J.x,$.x)&&Q.y<=Math.max(J.y,$.y)&&Q.y>=Math.min(J.y,$.y)}function GZ(J){return J>0?1:J<0?-1:0}function rF(J,Q){let $=J;do{if($.i!==J.i&&$.next.i!==J.i&&$.i!==Q.i&&$.next.i!==Q.i&&R5($,$.next,J,Q))return!0;$=$.next}while($!==J);return!1}function CQ(J,Q){return IJ(J.prev,J,J.next)<0?IJ(J,Q,J.next)>=0&&IJ(J,J.prev,Q)>=0:IJ(J,Q,J.prev)<0||IJ(J,J.next,Q)<0}function tF(J,Q){let $=J,Z=!1,W=(J.x+Q.x)/2,Y=(J.y+Q.y)/2;do{if($.y>Y!==$.next.y>Y&&$.next.y!==$.y&&W<($.next.x-$.x)*(Y-$.y)/($.next.y-$.y)+$.x)Z=!Z;$=$.next}while($!==J);return Z}function L5(J,Q){let $=QX(J.i,J.x,J.y),Z=QX(Q.i,Q.x,Q.y),W=J.next,Y=Q.prev;return J.next=Q,Q.prev=J,$.next=W,W.prev=$,Z.next=$,$.prev=Z,Y.next=Z,Z.prev=Y,Z}function wU(J,Q,$,Z){let W=QX(J,Q,$);if(!Z)W.prev=W,W.next=W;else W.next=Z.next,W.prev=Z,Z.next.prev=W,Z.next=W;return W}function zQ(J){if(J.next.prev=J.prev,J.prev.next=J.next,J.prevZ)J.prevZ.nextZ=J.nextZ;if(J.nextZ)J.nextZ.prevZ=J.prevZ}function QX(J,Q,$){return{i:J,x:Q,y:$,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function eF(J,Q,$,Z){let W=0;for(let Y=Q,X=$-Z;Y<$;Y+=Z)W+=(J[X]-J[Y])*(J[Y+1]+J[X+1]),X=Y;return W}class D5{static triangulate(J,Q,$=2){return hF(J,Q,$)}}class P9{static area(J){let Q=J.length,$=0;for(let Z=Q-1,W=0;W<Q;Z=W++)$+=J[Z].x*J[W].y-J[W].x*J[Z].y;return $*0.5}static isClockWise(J){return P9.area(J)<0}static triangulateShape(J,Q){let $=[],Z=[],W=[];PU(J),AU($,J);let Y=J.length;Q.forEach(PU);for(let K=0;K<Q.length;K++)Z.push(Y),Y+=Q[K].length,AU($,Q[K]);let X=D5.triangulate($,Z);for(let K=0;K<X.length;K+=3)W.push(X.slice(K,K+3));return W}}function PU(J){let Q=J.length;if(Q>2&&J[Q-1].equals(J[0]))J.pop()}function AU(J,Q){for(let $=0;$<Q.length;$++)J.push(Q[$].x),J.push(Q[$].y)}class Q$ extends u0{constructor(J=new z8([new i(0.5,0.5),new i(-0.5,0.5),new i(-0.5,-0.5),new i(0.5,-0.5)]),Q={}){super();this.type="ExtrudeGeometry",this.parameters={shapes:J,options:Q},J=Array.isArray(J)?J:[J];let $=this,Z=[],W=[];for(let X=0,K=J.length;X<K;X++){let H=J[X];Y(H)}this.setAttribute("position",new z0(Z,3)),this.setAttribute("uv",new z0(W,2)),this.computeVertexNormals();function Y(X){let K=[],H=Q.curveSegments!==void 0?Q.curveSegments:12,U=Q.steps!==void 0?Q.steps:1,G=Q.depth!==void 0?Q.depth:1,F=Q.bevelEnabled!==void 0?Q.bevelEnabled:!0,E=Q.bevelThickness!==void 0?Q.bevelThickness:0.2,O=Q.bevelSize!==void 0?Q.bevelSize:E-0.1,R=Q.bevelOffset!==void 0?Q.bevelOffset:0,M=Q.bevelSegments!==void 0?Q.bevelSegments:3,q=Q.extrudePath,N=Q.UVGenerator!==void 0?Q.UVGenerator:JN,L,D=!1,V,z,I,B;if(q){L=q.getSpacedPoints(U),D=!0,F=!1;let Q0=q.isCatmullRomCurve3?q.closed:!1;V=q.computeFrenetFrames(U,Q0),z=new A,I=new A,B=new A}if(!F)M=0,E=0,O=0,R=0;let k=X.extractPoints(H),C=k.shape,j=k.holes;if(!P9.isClockWise(C)){C=C.reverse();for(let Q0=0,X0=j.length;Q0<X0;Q0++){let $0=j[Q0];if(P9.isClockWise($0))j[Q0]=$0.reverse()}}function v(Q0){let _0=Q0[0];for(let C0=1;C0<=Q0.length;C0++){let m0=C0%Q0.length,y=Q0[m0],YJ=y.x-_0.x,h0=y.y-_0.y,l0=YJ*YJ+h0*h0,U0=Math.max(Math.abs(y.x),Math.abs(y.y),Math.abs(_0.x),Math.abs(_0.y)),NJ=0.000000000000000000010000000000000001*U0*U0;if(l0<=NJ){Q0.splice(m0,1),C0--;continue}_0=y}}v(C),j.forEach(v);let b=j.length,S=C;for(let Q0=0;Q0<b;Q0++){let X0=j[Q0];C=C.concat(X0)}function h(Q0,X0,$0){if(!X0)v0("ExtrudeGeometry: vec does not exist");return Q0.clone().addScaledVector(X0,$0)}let x=C.length;function p(Q0,X0,$0){let _0,C0,m0,y=Q0.x-X0.x,YJ=Q0.y-X0.y,h0=$0.x-Q0.x,l0=$0.y-Q0.y,U0=y*y+YJ*YJ,NJ=y*l0-YJ*h0;if(Math.abs(NJ)>Number.EPSILON){let A0=Math.sqrt(U0),T=Math.sqrt(h0*h0+l0*l0),_=X0.x-YJ/A0,u=X0.y+y/A0,r=$0.x-l0/T,Z0=$0.y+h0/T,K0=((r-_)*l0-(Z0-u)*h0)/(y*l0-YJ*h0);_0=_+y*K0-Q0.x,C0=u+YJ*K0-Q0.y;let M0=_0*_0+C0*C0;if(M0<=2)return new i(_0,C0);else m0=Math.sqrt(M0/2)}else{let A0=!1;if(y>Number.EPSILON){if(h0>Number.EPSILON)A0=!0}else if(y<-Number.EPSILON){if(h0<-Number.EPSILON)A0=!0}else if(Math.sign(YJ)===Math.sign(l0))A0=!0;if(A0)_0=-YJ,C0=y,m0=Math.sqrt(U0);else _0=y,C0=YJ,m0=Math.sqrt(U0/2)}return new i(_0/m0,C0/m0)}let c=[];for(let Q0=0,X0=S.length,$0=X0-1,_0=Q0+1;Q0<X0;Q0++,$0++,_0++){if($0===X0)$0=0;if(_0===X0)_0=0;c[Q0]=p(S[Q0],S[$0],S[_0])}let o=[],W0,H0=c.concat();for(let Q0=0,X0=b;Q0<X0;Q0++){let $0=j[Q0];W0=[];for(let _0=0,C0=$0.length,m0=C0-1,y=_0+1;_0<C0;_0++,m0++,y++){if(m0===C0)m0=0;if(y===C0)y=0;W0[_0]=p($0[_0],$0[m0],$0[y])}o.push(W0),H0=H0.concat(W0)}let J0;if(M===0)J0=P9.triangulateShape(S,j);else{let Q0=[],X0=[];for(let $0=0;$0<M;$0++){let _0=$0/M,C0=E*Math.cos(_0*Math.PI/2),m0=O*Math.sin(_0*Math.PI/2)+R;for(let y=0,YJ=S.length;y<YJ;y++){let h0=h(S[y],c[y],m0);if(E0(h0.x,h0.y,-C0),_0===0)Q0.push(h0)}for(let y=0,YJ=b;y<YJ;y++){let h0=j[y];W0=o[y];let l0=[];for(let U0=0,NJ=h0.length;U0<NJ;U0++){let A0=h(h0[U0],W0[U0],m0);if(E0(A0.x,A0.y,-C0),_0===0)l0.push(A0)}if(_0===0)X0.push(l0)}}J0=P9.triangulateShape(Q0,X0)}let c0=J0.length,d0=O+R;for(let Q0=0;Q0<x;Q0++){let X0=F?h(C[Q0],H0[Q0],d0):C[Q0];if(!D)E0(X0.x,X0.y,0);else I.copy(V.normals[0]).multiplyScalar(X0.x),z.copy(V.binormals[0]).multiplyScalar(X0.y),B.copy(L[0]).add(I).add(z),E0(B.x,B.y,B.z)}for(let Q0=1;Q0<=U;Q0++)for(let X0=0;X0<x;X0++){let $0=F?h(C[X0],H0[X0],d0):C[X0];if(!D)E0($0.x,$0.y,G/U*Q0);else I.copy(V.normals[Q0]).multiplyScalar($0.x),z.copy(V.binormals[Q0]).multiplyScalar($0.y),B.copy(L[Q0]).add(I).add(z),E0(B.x,B.y,B.z)}for(let Q0=M-1;Q0>=0;Q0--){let X0=Q0/M,$0=E*Math.cos(X0*Math.PI/2),_0=O*Math.sin(X0*Math.PI/2)+R;for(let C0=0,m0=S.length;C0<m0;C0++){let y=h(S[C0],c[C0],_0);E0(y.x,y.y,G+$0)}for(let C0=0,m0=j.length;C0<m0;C0++){let y=j[C0];W0=o[C0];for(let YJ=0,h0=y.length;YJ<h0;YJ++){let l0=h(y[YJ],W0[YJ],_0);if(!D)E0(l0.x,l0.y,G+$0);else E0(l0.x,l0.y+L[U-1].y,L[U-1].x+$0)}}}s(),F0();function s(){let Q0=Z.length/3;if(F){let X0=0,$0=x*X0;for(let _0=0;_0<c0;_0++){let C0=J0[_0];j0(C0[2]+$0,C0[1]+$0,C0[0]+$0)}X0=U+M*2,$0=x*X0;for(let _0=0;_0<c0;_0++){let C0=J0[_0];j0(C0[0]+$0,C0[1]+$0,C0[2]+$0)}}else{for(let X0=0;X0<c0;X0++){let $0=J0[X0];j0($0[2],$0[1],$0[0])}for(let X0=0;X0<c0;X0++){let $0=J0[X0];j0($0[0]+x*U,$0[1]+x*U,$0[2]+x*U)}}$.addGroup(Q0,Z.length/3-Q0,0)}function F0(){let Q0=Z.length/3,X0=0;I0(S,X0),X0+=S.length;for(let $0=0,_0=j.length;$0<_0;$0++){let C0=j[$0];I0(C0,X0),X0+=C0.length}$.addGroup(Q0,Z.length/3-Q0,1)}function I0(Q0,X0){let $0=Q0.length;while(--$0>=0){let _0=$0,C0=$0-1;if(C0<0)C0=Q0.length-1;for(let m0=0,y=U+M*2;m0<y;m0++){let YJ=x*m0,h0=x*(m0+1),l0=X0+_0+YJ,U0=X0+C0+YJ,NJ=X0+C0+h0,A0=X0+_0+h0;WJ(l0,U0,NJ,A0)}}}function E0(Q0,X0,$0){K.push(Q0),K.push(X0),K.push($0)}function j0(Q0,X0,$0){x0(Q0),x0(X0),x0($0);let _0=Z.length/3,C0=N.generateTopUV($,Z,_0-3,_0-2,_0-1);n0(C0[0]),n0(C0[1]),n0(C0[2])}function WJ(Q0,X0,$0,_0){x0(Q0),x0(X0),x0(_0),x0(X0),x0($0),x0(_0);let C0=Z.length/3,m0=N.generateSideWallUV($,Z,C0-6,C0-3,C0-2,C0-1);n0(m0[0]),n0(m0[1]),n0(m0[3]),n0(m0[1]),n0(m0[2]),n0(m0[3])}function x0(Q0){Z.push(K[Q0*3+0]),Z.push(K[Q0*3+1]),Z.push(K[Q0*3+2])}function n0(Q0){W.push(Q0.x),W.push(Q0.y)}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes,$=this.parameters.options;return QN(Q,$,J)}static fromJSON(J,Q){let $=[];for(let W=0,Y=J.shapes.length;W<Y;W++){let X=Q[J.shapes[W]];$.push(X)}let Z=J.options.extrudePath;if(Z!==void 0)J.options.extrudePath=new BZ[Z.type]().fromJSON(Z);return new Q$($,J.options)}}var JN={generateTopUV:function(J,Q,$,Z,W){let Y=Q[$*3],X=Q[$*3+1],K=Q[Z*3],H=Q[Z*3+1],U=Q[W*3],G=Q[W*3+1];return[new i(Y,X),new i(K,H),new i(U,G)]},generateSideWallUV:function(J,Q,$,Z,W,Y){let X=Q[$*3],K=Q[$*3+1],H=Q[$*3+2],U=Q[Z*3],G=Q[Z*3+1],F=Q[Z*3+2],E=Q[W*3],O=Q[W*3+1],R=Q[W*3+2],M=Q[Y*3],q=Q[Y*3+1],N=Q[Y*3+2];if(Math.abs(K-G)<Math.abs(X-U))return[new i(X,1-H),new i(U,1-F),new i(E,1-R),new i(M,1-N)];else return[new i(K,1-H),new i(G,1-F),new i(O,1-R),new i(q,1-N)]}};function QN(J,Q,$){if($.shapes=[],Array.isArray(J))for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];$.shapes.push(Y.uuid)}else $.shapes.push(J.uuid);if($.options=Object.assign({},Q),Q.extrudePath!==void 0)$.options.extrudePath=Q.extrudePath.toJSON();return $}class f6 extends T8{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=[-1,$,0,1,$,0,-1,-$,0,1,-$,0,0,-1,$,0,1,$,0,-1,-$,0,1,-$,$,0,-1,$,0,1,-$,0,-1,-$,0,1],W=[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];super(Z,W,J,Q);this.type="IcosahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new f6(J.radius,J.detail)}}class $$ extends u0{constructor(J=[new i(0,-0.5),new i(0.5,0),new i(0,0.5)],Q=12,$=0,Z=Math.PI*2){super();this.type="LatheGeometry",this.parameters={points:J,segments:Q,phiStart:$,phiLength:Z},Q=Math.floor(Q),Z=s0(Z,0,Math.PI*2);let W=[],Y=[],X=[],K=[],H=[],U=1/Q,G=new A,F=new i,E=new A,O=new A,R=new A,M=0,q=0;for(let N=0;N<=J.length-1;N++)switch(N){case 0:M=J[N+1].x-J[N].x,q=J[N+1].y-J[N].y,E.x=q*1,E.y=-M,E.z=q*0,R.copy(E),E.normalize(),K.push(E.x,E.y,E.z);break;case J.length-1:K.push(R.x,R.y,R.z);break;default:M=J[N+1].x-J[N].x,q=J[N+1].y-J[N].y,E.x=q*1,E.y=-M,E.z=q*0,O.copy(E),E.x+=R.x,E.y+=R.y,E.z+=R.z,E.normalize(),K.push(E.x,E.y,E.z),R.copy(O)}for(let N=0;N<=Q;N++){let L=$+N*U*Z,D=Math.sin(L),V=Math.cos(L);for(let z=0;z<=J.length-1;z++){G.x=J[z].x*D,G.y=J[z].y,G.z=J[z].x*V,Y.push(G.x,G.y,G.z),F.x=N/Q,F.y=z/(J.length-1),X.push(F.x,F.y);let I=K[3*z+0]*D,B=K[3*z+1],k=K[3*z+0]*V;H.push(I,B,k)}}for(let N=0;N<Q;N++)for(let L=0;L<J.length-1;L++){let D=L+N*J.length,V=D,z=D+J.length,I=D+J.length+1,B=D+1;W.push(V,z,B),W.push(I,B,z)}this.setIndex(W),this.setAttribute("position",new z0(Y,3)),this.setAttribute("uv",new z0(X,2)),this.setAttribute("normal",new z0(H,3))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new $$(J.points,J.segments,J.phiStart,J.phiLength)}}class c7 extends T8{constructor(J=1,Q=0){let $=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Z=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super($,Z,J,Q);this.type="OctahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new c7(J.radius,J.detail)}}class z9 extends u0{constructor(J=1,Q=1,$=1,Z=1){super();this.type="PlaneGeometry",this.parameters={width:J,height:Q,widthSegments:$,heightSegments:Z};let W=J/2,Y=Q/2,X=Math.floor($),K=Math.floor(Z),H=X+1,U=K+1,G=J/X,F=Q/K,E=[],O=[],R=[],M=[];for(let q=0;q<U;q++){let N=q*F-Y;for(let L=0;L<H;L++){let D=L*G-W;O.push(D,-N,0),R.push(0,0,1),M.push(L/X),M.push(1-q/K)}}for(let q=0;q<K;q++)for(let N=0;N<X;N++){let L=N+H*q,D=N+H*(q+1),V=N+1+H*(q+1),z=N+1+H*q;E.push(L,D,z),E.push(D,V,z)}this.setIndex(E),this.setAttribute("position",new z0(O,3)),this.setAttribute("normal",new z0(R,3)),this.setAttribute("uv",new z0(M,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new z9(J.width,J.height,J.widthSegments,J.heightSegments)}}class Z$ extends u0{constructor(J=0.5,Q=1,$=32,Z=1,W=0,Y=Math.PI*2){super();this.type="RingGeometry",this.parameters={innerRadius:J,outerRadius:Q,thetaSegments:$,phiSegments:Z,thetaStart:W,thetaLength:Y},$=Math.max(3,$),Z=Math.max(1,Z);let X=[],K=[],H=[],U=[],G=J,F=(Q-J)/Z,E=new A,O=new i;for(let R=0;R<=Z;R++){for(let M=0;M<=$;M++){let q=W+M/$*Y;E.x=G*Math.cos(q),E.y=G*Math.sin(q),K.push(E.x,E.y,E.z),H.push(0,0,1),O.x=(E.x/Q+1)/2,O.y=(E.y/Q+1)/2,U.push(O.x,O.y)}G+=F}for(let R=0;R<Z;R++){let M=R*($+1);for(let q=0;q<$;q++){let N=q+M,L=N,D=N+$+1,V=N+$+2,z=N+1;X.push(L,D,z),X.push(D,V,z)}}this.setIndex(X),this.setAttribute("position",new z0(K,3)),this.setAttribute("normal",new z0(H,3)),this.setAttribute("uv",new z0(U,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new Z$(J.innerRadius,J.outerRadius,J.thetaSegments,J.phiSegments,J.thetaStart,J.thetaLength)}}class W$ extends u0{constructor(J=new z8([new i(0,0.5),new i(-0.5,-0.5),new i(0.5,-0.5)]),Q=12){super();this.type="ShapeGeometry",this.parameters={shapes:J,curveSegments:Q};let $=[],Z=[],W=[],Y=[],X=0,K=0;if(Array.isArray(J)===!1)H(J);else for(let U=0;U<J.length;U++)H(J[U]),this.addGroup(X,K,U),X+=K,K=0;this.setIndex($),this.setAttribute("position",new z0(Z,3)),this.setAttribute("normal",new z0(W,3)),this.setAttribute("uv",new z0(Y,2));function H(U){let G=Z.length/3,F=U.extractPoints(Q),E=F.shape,O=F.holes;if(P9.isClockWise(E)===!1)E=E.reverse();for(let M=0,q=O.length;M<q;M++){let N=O[M];if(P9.isClockWise(N)===!0)O[M]=N.reverse()}let R=P9.triangulateShape(E,O);for(let M=0,q=O.length;M<q;M++){let N=O[M];E=E.concat(N)}for(let M=0,q=E.length;M<q;M++){let N=E[M];Z.push(N.x,N.y,0),W.push(0,0,1),Y.push(N.x,N.y)}for(let M=0,q=R.length;M<q;M++){let N=R[M],L=N[0]+G,D=N[1]+G,V=N[2]+G;$.push(L,D,V),K+=3}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes;return $N(Q,J)}static fromJSON(J,Q){let $=[];for(let Z=0,W=J.shapes.length;Z<W;Z++){let Y=Q[J.shapes[Z]];$.push(Y)}return new W$($,J.curveSegments)}}function $N(J,Q){if(Q.shapes=[],Array.isArray(J))for(let $=0,Z=J.length;$<Z;$++){let W=J[$];Q.shapes.push(W.uuid)}else Q.shapes.push(J.uuid);return Q}class Z6 extends u0{constructor(J=1,Q=32,$=16,Z=0,W=Math.PI*2,Y=0,X=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:Z,phiLength:W,thetaStart:Y,thetaLength:X},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let K=Math.min(Y+X,Math.PI),H=0,U=[],G=new A,F=new A,E=[],O=[],R=[],M=[];for(let q=0;q<=$;q++){let N=[],L=q/$,D=0;if(q===0&&Y===0)D=0.5/Q;else if(q===$&&K===Math.PI)D=-0.5/Q;for(let V=0;V<=Q;V++){let z=V/Q;G.x=-J*Math.cos(Z+z*W)*Math.sin(Y+L*X),G.y=J*Math.cos(Y+L*X),G.z=J*Math.sin(Z+z*W)*Math.sin(Y+L*X),O.push(G.x,G.y,G.z),F.copy(G).normalize(),R.push(F.x,F.y,F.z),M.push(z+D,1-L),N.push(H++)}U.push(N)}for(let q=0;q<$;q++)for(let N=0;N<Q;N++){let L=U[q][N+1],D=U[q][N],V=U[q+1][N],z=U[q+1][N+1];if(q!==0||Y>0)E.push(L,D,z);if(q!==$-1||K<Math.PI)E.push(D,V,z)}this.setIndex(E),this.setAttribute("position",new z0(O,3)),this.setAttribute("normal",new z0(R,3)),this.setAttribute("uv",new z0(M,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new Z6(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class Y$ extends T8{constructor(J=1,Q=0){let $=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Z=[2,1,0,0,3,2,1,3,0,2,3,1];super($,Z,J,Q);this.type="TetrahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new Y$(J.radius,J.detail)}}class g6 extends u0{constructor(J=1,Q=0.4,$=12,Z=48,W=Math.PI*2,Y=0,X=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:Z,arc:W,thetaStart:Y,thetaLength:X},$=Math.floor($),Z=Math.floor(Z);let K=[],H=[],U=[],G=[],F=new A,E=new A,O=new A;for(let R=0;R<=$;R++){let M=Y+R/$*X;for(let q=0;q<=Z;q++){let N=q/Z*W;E.x=(J+Q*Math.cos(M))*Math.cos(N),E.y=(J+Q*Math.cos(M))*Math.sin(N),E.z=Q*Math.sin(M),H.push(E.x,E.y,E.z),F.x=J*Math.cos(N),F.y=J*Math.sin(N),O.subVectors(E,F).normalize(),U.push(O.x,O.y,O.z),G.push(q/Z),G.push(R/$)}}for(let R=1;R<=$;R++)for(let M=1;M<=Z;M++){let q=(Z+1)*R+M-1,N=(Z+1)*(R-1)+M-1,L=(Z+1)*(R-1)+M,D=(Z+1)*R+M;K.push(q,N,D),K.push(N,L,D)}this.setIndex(K),this.setAttribute("position",new z0(H,3)),this.setAttribute("normal",new z0(U,3)),this.setAttribute("uv",new z0(G,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new g6(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}class X$ extends u0{constructor(J=1,Q=0.4,$=64,Z=8,W=2,Y=3){super();this.type="TorusKnotGeometry",this.parameters={radius:J,tube:Q,tubularSegments:$,radialSegments:Z,p:W,q:Y},$=Math.floor($),Z=Math.floor(Z);let X=[],K=[],H=[],U=[],G=new A,F=new A,E=new A,O=new A,R=new A,M=new A,q=new A;for(let L=0;L<=$;++L){let D=L/$*W*Math.PI*2;N(D,W,Y,J,E),N(D+0.01,W,Y,J,O),M.subVectors(O,E),q.addVectors(O,E),R.crossVectors(M,q),q.crossVectors(R,M),R.normalize(),q.normalize();for(let V=0;V<=Z;++V){let z=V/Z*Math.PI*2,I=-Q*Math.cos(z),B=Q*Math.sin(z);G.x=E.x+(I*q.x+B*R.x),G.y=E.y+(I*q.y+B*R.y),G.z=E.z+(I*q.z+B*R.z),K.push(G.x,G.y,G.z),F.subVectors(G,E).normalize(),H.push(F.x,F.y,F.z),U.push(L/$),U.push(V/Z)}}for(let L=1;L<=$;L++)for(let D=1;D<=Z;D++){let V=(Z+1)*(L-1)+(D-1),z=(Z+1)*L+(D-1),I=(Z+1)*L+D,B=(Z+1)*(L-1)+D;X.push(V,z,B),X.push(z,I,B)}this.setIndex(X),this.setAttribute("position",new z0(K,3)),this.setAttribute("normal",new z0(H,3)),this.setAttribute("uv",new z0(U,2));function N(L,D,V,z,I){let B=Math.cos(L),k=Math.sin(L),C=V/D*L,j=Math.cos(C);I.x=z*(2+j)*0.5*B,I.y=z*(2+j)*k*0.5,I.z=z*Math.sin(C)*0.5}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new X$(J.radius,J.tube,J.tubularSegments,J.radialSegments,J.p,J.q)}}class K$ extends u0{constructor(J=new eQ(new A(-1,-1,0),new A(-1,1,0),new A(1,1,0)),Q=64,$=1,Z=8,W=!1){super();this.type="TubeGeometry",this.parameters={path:J,tubularSegments:Q,radius:$,radialSegments:Z,closed:W};let Y=J.computeFrenetFrames(Q,W);this.tangents=Y.tangents,this.normals=Y.normals,this.binormals=Y.binormals;let X=new A,K=new A,H=new i,U=new A,G=[],F=[],E=[],O=[];R(),this.setIndex(O),this.setAttribute("position",new z0(G,3)),this.setAttribute("normal",new z0(F,3)),this.setAttribute("uv",new z0(E,2));function R(){for(let L=0;L<Q;L++)M(L);M(W===!1?Q:0),N(),q()}function M(L){U=J.getPointAt(L/Q,U);let D=Y.normals[L],V=Y.binormals[L];for(let z=0;z<=Z;z++){let I=z/Z*Math.PI*2,B=Math.sin(I),k=-Math.cos(I);K.x=k*D.x+B*V.x,K.y=k*D.y+B*V.y,K.z=k*D.z+B*V.z,K.normalize(),F.push(K.x,K.y,K.z),X.x=U.x+$*K.x,X.y=U.y+$*K.y,X.z=U.z+$*K.z,G.push(X.x,X.y,X.z)}}function q(){for(let L=1;L<=Q;L++)for(let D=1;D<=Z;D++){let V=(Z+1)*(L-1)+(D-1),z=(Z+1)*L+(D-1),I=(Z+1)*L+D,B=(Z+1)*(L-1)+D;O.push(V,z,B),O.push(z,I,B)}}function N(){for(let L=0;L<=Q;L++)for(let D=0;D<=Z;D++)H.x=L/Q,H.y=D/Z,E.push(H.x,H.y)}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON();return J.path=this.parameters.path.toJSON(),J}static fromJSON(J){return new K$(new BZ[J.path.type]().fromJSON(J.path),J.tubularSegments,J.radius,J.radialSegments,J.closed)}}class _W extends u0{constructor(J=null){super();if(this.type="WireframeGeometry",this.parameters={geometry:J},J!==null){let Q=[],$=new Set,Z=new A,W=new A;if(J.index!==null){let Y=J.attributes.position,X=J.index,K=J.groups;if(K.length===0)K=[{start:0,count:X.count,materialIndex:0}];for(let H=0,U=K.length;H<U;++H){let G=K[H],F=G.start,E=G.count;for(let O=F,R=F+E;O<R;O+=3)for(let M=0;M<3;M++){let q=X.getX(O+M),N=X.getX(O+(M+1)%3);if(Z.fromBufferAttribute(Y,q),W.fromBufferAttribute(Y,N),TU(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}}else{let Y=J.attributes.position;for(let X=0,K=Y.count/3;X<K;X++)for(let H=0;H<3;H++){let U=3*X+H,G=3*X+(H+1)%3;if(Z.fromBufferAttribute(Y,U),W.fromBufferAttribute(Y,G),TU(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}this.setAttribute("position",new z0(Q,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}}function TU(J,Q,$){let Z=`${J.x},${J.y},${J.z}-${Q.x},${Q.y},${Q.z}`,W=`${Q.x},${Q.y},${Q.z}-${J.x},${J.y},${J.z}`;if($.has(Z)===!0||$.has(W)===!0)return!1;else return $.add(Z),$.add(W),!0}var SU=Object.freeze({__proto__:null,BoxGeometry:Q9,CapsuleGeometry:sQ,CircleGeometry:iQ,ConeGeometry:d7,CylinderGeometry:$6,DodecahedronGeometry:oQ,EdgesGeometry:VW,ExtrudeGeometry:Q$,IcosahedronGeometry:f6,LatheGeometry:$$,OctahedronGeometry:c7,PlaneGeometry:z9,PolyhedronGeometry:T8,RingGeometry:Z$,ShapeGeometry:W$,SphereGeometry:Z6,TetrahedronGeometry:Y$,TorusGeometry:g6,TorusKnotGeometry:X$,TubeGeometry:K$,WireframeGeometry:_W});class wW extends vJ{constructor(J){super();this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new e(0),this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.fog=J.fog,this}}function p6(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(jU(W))if(W.isRenderTargetTexture)O0("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Q[$][Z]=null;else Q[$][Z]=W.clone();else if(Array.isArray(W))if(jU(W[0])){let Y=[];for(let X=0,K=W.length;X<K;X++)Y[X]=W[X].clone();Q[$][Z]=Y}else Q[$][Z]=W.slice();else Q[$][Z]=W}}return Q}function $9(J){let Q={};for(let $=0;$<J.length;$++){let Z=p6(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function jU(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function ZN(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function OK(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return t0.workingColorSpace}var K9={clone:p6,merge:$9},WN=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
- }`,DU=`void main() {
3
+ }`,YN=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5
- }`;class OJ extends oJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=LU,this.fragmentShader=DU,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,J!==void 0)this.setValues(J)}copy(J){return super.copy(J),this.fragmentShader=J.fragmentShader,this.vertexShader=J.vertexShader,this.uniforms=f8(J.uniforms),this.uniformsGroups=RU(J.uniformsGroups),this.defines=Object.assign({},J.defines),this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.fog=J.fog,this.lights=J.lights,this.clipping=J.clipping,this.extensions=Object.assign({},J.extensions),this.glslVersion=J.glslVersion,this.defaultAttributeValues=Object.assign({},J.defaultAttributeValues),this.index0AttributeName=J.index0AttributeName,this.uniformsNeedUpdate=J.uniformsNeedUpdate,this}toJSON(J){let Q=super.toJSON(J);Q.glslVersion=this.glslVersion,Q.uniforms={};for(let Z in this.uniforms){let Y=this.uniforms[Z].value;if(Y&&Y.isTexture)Q.uniforms[Z]={type:"t",value:Y.toJSON(J).uuid};else if(Y&&Y.isColor)Q.uniforms[Z]={type:"c",value:Y.getHex()};else if(Y&&Y.isVector2)Q.uniforms[Z]={type:"v2",value:Y.toArray()};else if(Y&&Y.isVector3)Q.uniforms[Z]={type:"v3",value:Y.toArray()};else if(Y&&Y.isVector4)Q.uniforms[Z]={type:"v4",value:Y.toArray()};else if(Y&&Y.isMatrix3)Q.uniforms[Z]={type:"m3",value:Y.toArray()};else if(Y&&Y.isMatrix4)Q.uniforms[Z]={type:"m4",value:Y.toArray()};else Q.uniforms[Z]={value:Y}}if(Object.keys(this.defines).length>0)Q.defines=this.defines;Q.vertexShader=this.vertexShader,Q.fragmentShader=this.fragmentShader,Q.lights=this.lights,Q.clipping=this.clipping;let $={};for(let Z in this.extensions)if(this.extensions[Z]===!0)$[Z]=!0;if(Object.keys($).length>0)Q.extensions=$;return Q}}class N7 extends OJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class cJ extends oJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new X0(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new T0(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new T9,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={STANDARD:""},this.color.copy(J.color),this.roughness=J.roughness,this.metalness=J.metalness,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.roughnessMap=J.roughnessMap,this.metalnessMap=J.metalnessMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.envMapIntensity=J.envMapIntensity,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class nJ extends cJ{constructor(J){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new T0(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return l0(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Q){this.ior=(1+0.4*Q)/(1-0.4*Q)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new X0(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new X0(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new X0(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(J)}get anisotropy(){return this._anisotropy}set anisotropy(J){if(this._anisotropy>0!==J>0)this.version++;this._anisotropy=J}get clearcoat(){return this._clearcoat}set clearcoat(J){if(this._clearcoat>0!==J>0)this.version++;this._clearcoat=J}get iridescence(){return this._iridescence}set iridescence(J){if(this._iridescence>0!==J>0)this.version++;this._iridescence=J}get dispersion(){return this._dispersion}set dispersion(J){if(this._dispersion>0!==J>0)this.version++;this._dispersion=J}get sheen(){return this._sheen}set sheen(J){if(this._sheen>0!==J>0)this.version++;this._sheen=J}get transmission(){return this._transmission}set transmission(J){if(this._transmission>0!==J>0)this.version++;this._transmission=J}copy(J){return super.copy(J),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=J.anisotropy,this.anisotropyRotation=J.anisotropyRotation,this.anisotropyMap=J.anisotropyMap,this.clearcoat=J.clearcoat,this.clearcoatMap=J.clearcoatMap,this.clearcoatRoughness=J.clearcoatRoughness,this.clearcoatRoughnessMap=J.clearcoatRoughnessMap,this.clearcoatNormalMap=J.clearcoatNormalMap,this.clearcoatNormalScale.copy(J.clearcoatNormalScale),this.dispersion=J.dispersion,this.ior=J.ior,this.iridescence=J.iridescence,this.iridescenceMap=J.iridescenceMap,this.iridescenceIOR=J.iridescenceIOR,this.iridescenceThicknessRange=[...J.iridescenceThicknessRange],this.iridescenceThicknessMap=J.iridescenceThicknessMap,this.sheen=J.sheen,this.sheenColor.copy(J.sheenColor),this.sheenColorMap=J.sheenColorMap,this.sheenRoughness=J.sheenRoughness,this.sheenRoughnessMap=J.sheenRoughnessMap,this.transmission=J.transmission,this.transmissionMap=J.transmissionMap,this.thickness=J.thickness,this.thicknessMap=J.thicknessMap,this.attenuationDistance=J.attenuationDistance,this.attenuationColor.copy(J.attenuationColor),this.specularIntensity=J.specularIntensity,this.specularIntensityMap=J.specularIntensityMap,this.specularColor.copy(J.specularColor),this.specularColorMap=J.specularColorMap,this}}class wQ extends oJ{constructor(J){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new X0(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new T0(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new T9,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class TZ extends oJ{constructor(J){super();this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(J)}copy(J){return super.copy(J),this.depthPacking=J.depthPacking,this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this}}class AZ extends oJ{constructor(J){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(J)}copy(J){return super.copy(J),this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this}}function r7(J,Q){if(!J||J.constructor===Q)return J;if(typeof Q.BYTES_PER_ELEMENT==="number")return new Q(J);return Array.prototype.slice.call(J)}function kU(J){function Q(W,Y){return J[W]-J[Y]}let $=J.length,Z=Array($);for(let W=0;W!==$;++W)Z[W]=W;return Z.sort(Q),Z}function EY(J,Q,$){let Z=J.length,W=new J.constructor(Z);for(let Y=0,X=0;X!==Z;++Y){let K=$[Y]*Q;for(let H=0;H!==Q;++H)W[X++]=J[K+H]}return W}function RX(J,Q,$,Z){let W=1,Y=J[0];while(Y!==void 0&&Y[Z]===void 0)Y=J[W++];if(Y===void 0)return;let X=Y[Z];if(X===void 0)return;if(Array.isArray(X))do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(...X);Y=J[W++]}while(Y!==void 0);else if(X.toArray!==void 0)do{if(X=Y[Z],X!==void 0)Q.push(Y.time),X.toArray($,$.length);Y=J[W++]}while(Y!==void 0);else do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(X);Y=J[W++]}while(Y!==void 0)}class a9{constructor(J,Q,$,Z){this.parameterPositions=J,this._cachedIndex=0,this.resultBuffer=Z!==void 0?Z:new Q.constructor($),this.sampleValues=Q,this.valueSize=$,this.settings=null,this.DefaultSettings_={}}evaluate(J){let Q=this.parameterPositions,$=this._cachedIndex,Z=Q[$],W=Q[$-1];J:{Q:{let Y;$:{Z:if(!(J<Z)){for(let X=$+2;;){if(Z===void 0){if(J<W)break Z;return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}if($===X)break;if(W=Z,Z=Q[++$],J<Z)break Q}Y=Q.length;break $}if(!(J>=W)){let X=Q[1];if(J<X)$=2,W=X;for(let K=$-2;;){if(W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if($===K)break;if(Z=W,W=Q[--$-1],J>=W)break Q}Y=$,$=0;break $}break J}while($<Y){let X=$+Y>>>1;if(J<Q[X])Y=X;else $=X+1}if(Z=Q[$],W=Q[$-1],W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Z===void 0)return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}this._cachedIndex=$,this.intervalChanged_($,W,Z)}return this.interpolate_($,W,J,Z)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z;for(let Y=0;Y!==Z;++Y)Q[Y]=$[W+Y];return Q}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class SZ extends a9{constructor(J,Q,$,Z){super(J,Q,$,Z);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(J,Q,$){let Z=this.parameterPositions,W=J-2,Y=J+1,X=Z[W],K=Z[Y];if(X===void 0)switch(this.getSettings_().endingStart){case 2401:W=J,X=2*Q-$;break;case 2402:W=Z.length-2,X=Q+Z[W]-Z[W+1];break;default:W=J,X=$}if(K===void 0)switch(this.getSettings_().endingEnd){case 2401:Y=J,K=2*$-Q;break;case 2402:Y=1,K=$+Z[1]-Z[0];break;default:Y=J-1,K=Q}let H=($-Q)*0.5,U=this.valueSize;this._weightPrev=H/(Q-X),this._weightNext=H/(K-$),this._offsetPrev=W*U,this._offsetNext=Y*U}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this._offsetPrev,G=this._offsetNext,F=this._weightPrev,E=this._weightNext,O=($-Q)/(Z-Q),R=O*O,C=R*O,q=-F*C+2*F*R-F*O,N=(1+F)*C+(-1.5-2*F)*R+(-0.5+F)*O+1,L=(-1-E)*C+(1.5+E)*R+0.5*O,k=E*C-E*R;for(let M=0;M!==X;++M)W[M]=q*Y[U+M]+N*Y[H+M]+L*Y[K+M]+k*Y[G+M];return W}}class PQ extends a9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=($-Q)/(Z-Q),G=1-U;for(let F=0;F!==X;++F)W[F]=Y[H+F]*G+Y[K+F]*U;return W}}class jZ extends a9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}}class vZ extends a9{interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this.settings||this.DefaultSettings_,G=U.inTangents,F=U.outTangents;if(!G||!F){let R=($-Q)/(Z-Q),C=1-R;for(let q=0;q!==X;++q)W[q]=Y[H+q]*C+Y[K+q]*R;return W}let E=X*2,O=J-1;for(let R=0;R!==X;++R){let C=Y[H+R],q=Y[K+R],N=O*E+R*2,L=F[N],k=F[N+1],M=J*E+R*2,P=G[M],w=G[M+1],B=($-Q)/(Z-Q),D,V,j,z,v;for(let y=0;y<8;y++){D=B*B,V=D*B,j=1-B,z=j*j,v=z*j;let x=v*Q+3*z*B*L+3*j*D*P+V*Z-$;if(Math.abs(x)<0.0000000001)break;let b=3*z*(L-Q)+6*j*B*(P-L)+3*D*(Z-P);if(Math.abs(b)<0.0000000001)break;B=B-x/b,B=Math.max(0,Math.min(1,B))}W[R]=v*C+3*z*B*k+3*j*D*w+V*q}return W}}class Z9{constructor(J,Q,$,Z){if(J===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(Q===void 0||Q.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+J);this.name=J,this.times=r7(Q,this.TimeBufferType),this.values=r7($,this.ValueBufferType),this.setInterpolation(Z||this.DefaultInterpolation)}static toJSON(J){let Q=J.constructor,$;if(Q.toJSON!==this.toJSON)$=Q.toJSON(J);else{$={name:J.name,times:r7(J.times,Array),values:r7(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new jZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new PQ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new SZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new vZ(this.times,this.values,this.getValueSize(),J);if(this.settings)Q.settings=this.settings;return Q}setInterpolation(J){let Q;switch(J){case 2300:Q=this.InterpolantFactoryMethodDiscrete;break;case 2301:Q=this.InterpolantFactoryMethodLinear;break;case 2302:Q=this.InterpolantFactoryMethodSmooth;break;case 2303:Q=this.InterpolantFactoryMethodBezier;break}if(Q===void 0){let $="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(J!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error($);return C0("KeyframeTrack:",$),this}return this.createInterpolant=Q,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(J){if(J!==0){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]+=J}return this}scale(J){if(J!==1){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]*=J}return this}trim(J,Q){let $=this.times,Z=$.length,W=0,Y=Z-1;while(W!==Z&&$[W]<J)++W;while(Y!==-1&&$[Y]>Q)--Y;if(++Y,W!==0||Y!==Z){if(W>=Y)Y=Math.max(Y,1),W=Y-1;let X=this.getValueSize();this.times=$.slice(W,Y),this.values=this.values.slice(W*X,Y*X)}return this}validate(){let J=!0,Q=this.getValueSize();if(Q-Math.floor(Q)!==0)S0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)S0("KeyframeTrack: Track is empty.",this),J=!1;let Y=null;for(let X=0;X!==W;X++){let K=$[X];if(typeof K==="number"&&isNaN(K)){S0("KeyframeTrack: Time is not a valid number.",this,X,K),J=!1;break}if(Y!==null&&Y>K){S0("KeyframeTrack: Out of order keys.",this,X,K,Y),J=!1;break}Y=K}if(Z!==void 0){if(TH(Z))for(let X=0,K=Z.length;X!==K;++X){let H=Z[X];if(isNaN(H)){S0("KeyframeTrack: Value is not a valid number.",this,X,H),J=!1;break}}}return J}optimize(){let J=this.times.slice(),Q=this.values.slice(),$=this.getValueSize(),Z=this.getInterpolation()===2302,W=J.length-1,Y=1;for(let X=1;X<W;++X){let K=!1,H=J[X],U=J[X+1];if(H!==U&&(X!==1||H!==J[0]))if(!Z){let G=X*$,F=G-$,E=G+$;for(let O=0;O!==$;++O){let R=Q[G+O];if(R!==Q[F+O]||R!==Q[E+O]){K=!0;break}}}else K=!0;if(K){if(X!==Y){J[Y]=J[X];let G=X*$,F=Y*$;for(let E=0;E!==$;++E)Q[F+E]=Q[G+E]}++Y}}if(W>0){J[Y]=J[W];for(let X=W*$,K=Y*$,H=0;H!==$;++H)Q[K+H]=Q[X+H];++Y}if(Y!==J.length)this.times=J.slice(0,Y),this.values=Q.slice(0,Y*$);else this.times=J,this.values=Q;return this}clone(){let J=this.times.slice(),Q=this.values.slice(),Z=new this.constructor(this.name,J,Q);return Z.createInterpolant=this.createInterpolant,Z}}Z9.prototype.ValueTypeName="";Z9.prototype.TimeBufferType=Float32Array;Z9.prototype.ValueBufferType=Float32Array;Z9.prototype.DefaultInterpolation=2301;class O8 extends Z9{constructor(J,Q,$){super(J,Q,$)}}O8.prototype.ValueTypeName="bool";O8.prototype.ValueBufferType=Array;O8.prototype.DefaultInterpolation=2300;O8.prototype.InterpolantFactoryMethodLinear=void 0;O8.prototype.InterpolantFactoryMethodSmooth=void 0;class TQ extends Z9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}TQ.prototype.ValueTypeName="color";class s9 extends Z9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}s9.prototype.ValueTypeName="number";class yZ extends a9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=($-Q)/(Z-Q),H=J*X;for(let U=H+X;H!==U;H+=4)AJ.slerpFlat(W,0,Y,H-X,Y,H,K);return W}}class r9 extends Z9{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new yZ(this.times,this.values,this.getValueSize(),J)}}r9.prototype.ValueTypeName="quaternion";r9.prototype.InterpolantFactoryMethodSmooth=void 0;class q8 extends Z9{constructor(J,Q,$){super(J,Q,$)}}q8.prototype.ValueTypeName="string";q8.prototype.ValueBufferType=Array;q8.prototype.DefaultInterpolation=2300;q8.prototype.InterpolantFactoryMethodLinear=void 0;q8.prototype.InterpolantFactoryMethodSmooth=void 0;class i9 extends Z9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}i9.prototype.ValueTypeName="vector";class U6{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=M9(),this.userData={},this.duration<0)this.resetDuration()}static parse(J){let Q=[],$=J.tracks,Z=1/(J.fps||1);for(let Y=0,X=$.length;Y!==X;++Y)Q.push(VU($[Y]).scale(Z));let W=new this(J.name,J.duration,Q,J.blendMode);return W.uuid=J.uuid,W.userData=JSON.parse(J.userData||"{}"),W}static toJSON(J){let Q=[],$=J.tracks,Z={name:J.name,duration:J.duration,tracks:Q,uuid:J.uuid,blendMode:J.blendMode,userData:JSON.stringify(J.userData)};for(let W=0,Y=$.length;W!==Y;++W)Q.push(Z9.toJSON($[W]));return Z}static CreateFromMorphTargetSequence(J,Q,$,Z){let W=Q.length,Y=[];for(let X=0;X<W;X++){let K=[],H=[];K.push((X+W-1)%W,X,(X+1)%W),H.push(0,1,0);let U=kU(K);if(K=EY(K,1,U),H=EY(H,1,U),!Z&&K[0]===0)K.push(W),H.push(H[0]);Y.push(new s9(".morphTargetInfluences["+Q[X].name+"]",K,H).scale(1/$))}return new this(J,-1,Y)}static findByName(J,Q){let $=J;if(!Array.isArray(J)){let Z=J;$=Z.geometry&&Z.geometry.animations||Z.animations}for(let Z=0;Z<$.length;Z++)if($[Z].name===Q)return $[Z];return null}static CreateClipsFromMorphTargetSequences(J,Q,$){let Z={},W=/^([\w-]*?)([\d]+)$/;for(let X=0,K=J.length;X<K;X++){let H=J[X],U=H.name.match(W);if(U&&U.length>1){let G=U[1],F=Z[G];if(!F)Z[G]=F=[];F.push(H)}}let Y=[];for(let X in Z)Y.push(this.CreateFromMorphTargetSequence(X,Z[X],Q,$));return Y}static parseAnimation(J,Q){if(C0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return S0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,F,E,O,R){if(E.length!==0){let C=[],q=[];if(RX(E,C,q,O),C.length!==0)R.push(new G(F,C,q))}},Z=[],W=J.name||"default",Y=J.fps||30,X=J.blendMode,K=J.length||-1,H=J.hierarchy||[];for(let G=0;G<H.length;G++){let F=H[G].keys;if(!F||F.length===0)continue;if(F[0].morphTargets){let E={},O;for(O=0;O<F.length;O++)if(F[O].morphTargets)for(let R=0;R<F[O].morphTargets.length;R++)E[F[O].morphTargets[R]]=-1;for(let R in E){let C=[],q=[];for(let N=0;N!==F[O].morphTargets.length;++N){let L=F[O];C.push(L.time),q.push(L.morphTarget===R?1:0)}Z.push(new s9(".morphTargetInfluence["+R+"]",C,q))}K=E.length*Y}else{let E=".bones["+Q[G].name+"]";$(i9,E+".position",F,"pos",Z),$(r9,E+".quaternion",F,"rot",Z),$(i9,E+".scale",F,"scl",Z)}}if(Z.length===0)return null;return new this(W,K,Z,X)}resetDuration(){let J=this.tracks,Q=0;for(let $=0,Z=J.length;$!==Z;++$){let W=this.tracks[$];Q=Math.max(Q,W.times[W.times.length-1])}return this.duration=Q,this}trim(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].trim(0,this.duration);return this}validate(){let J=!0;for(let Q=0;Q<this.tracks.length;Q++)J=J&&this.tracks[Q].validate();return J}optimize(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].optimize();return this}clone(){let J=[];for(let $=0;$<this.tracks.length;$++)J.push(this.tracks[$].clone());let Q=new this.constructor(this.name,this.duration,J,this.blendMode);return Q.userData=JSON.parse(JSON.stringify(this.userData)),Q}toJSON(){return this.constructor.toJSON(this)}}function MU(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return s9;case"vector":case"vector2":case"vector3":case"vector4":return i9;case"color":return TQ;case"quaternion":return r9;case"bool":case"boolean":return O8;case"string":return q8}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function VU(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=MU(J.type);if(J.times===void 0){let $=[],Z=[];RX(J.keys,$,Z,"value"),J.times=$,J.values=Z}if(Q.parse!==void 0)return Q.parse(J);else return new Q(J.name,J.times,J.values,J.interpolation)}var P9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(FY(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(FY(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};function FY(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class xZ{constructor(J,Q,$){let Z=this,W=!1,Y=0,X=0,K=void 0,H=[];this.onStart=void 0,this.onLoad=J,this.onProgress=Q,this.onError=$,this._abortController=null,this.itemStart=function(U){if(X++,W===!1){if(Z.onStart!==void 0)Z.onStart(U,Y,X)}W=!0},this.itemEnd=function(U){if(Y++,Z.onProgress!==void 0)Z.onProgress(U,Y,X);if(Y===X){if(W=!1,Z.onLoad!==void 0)Z.onLoad()}},this.itemError=function(U){if(Z.onError!==void 0)Z.onError(U)},this.resolveURL=function(U){if(K)return K(U);return U},this.setURLModifier=function(U){return K=U,this},this.addHandler=function(U,G){return H.push(U,G),this},this.removeHandler=function(U){let G=H.indexOf(U);if(G!==-1)H.splice(G,2);return this},this.getHandler=function(U){for(let G=0,F=H.length;G<F;G+=2){let E=H[G],O=H[G+1];if(E.global)E.lastIndex=0;if(E.test(U))return O}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var LX=new xZ;class y9{constructor(J){if(this.manager=J!==void 0?J:LX,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(J,Q){let $=this;return new Promise(function(Z,W){$.load(J,Z,Q,W)})}parse(){}setCrossOrigin(J){return this.crossOrigin=J,this}setWithCredentials(J){return this.withCredentials=J,this}setPath(J){return this.path=J,this}setResourcePath(J){return this.resourcePath=J,this}setRequestHeader(J){return this.requestHeader=J,this}abort(){return this}}y9.DEFAULT_MATERIAL_NAME="__DEFAULT";var l9={};class DX extends Error{constructor(J,Q){super(J);this.response=Q}}class I6 extends y9{constructor(J){super(J);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=P9.get(`file:${J}`);if(W!==void 0){this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0);return}if(l9[J]!==void 0){l9[J].push({onLoad:Q,onProgress:$,onError:Z});return}l9[J]=[],l9[J].push({onLoad:Q,onProgress:$,onError:Z});let Y=new Request(J,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),X=this.mimeType,K=this.responseType;fetch(Y).then((H)=>{if(H.status===200||H.status===0){if(H.status===0)C0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||H.body===void 0||H.body.getReader===void 0)return H;let U=l9[J],G=H.body.getReader(),F=H.headers.get("X-File-Size")||H.headers.get("Content-Length"),E=F?parseInt(F):0,O=E!==0,R=0,C=new ReadableStream({start(q){N();function N(){G.read().then(({done:L,value:k})=>{if(L)q.close();else{R+=k.byteLength;let M=new ProgressEvent("progress",{lengthComputable:O,loaded:R,total:E});for(let P=0,w=U.length;P<w;P++){let B=U[P];if(B.onProgress)B.onProgress(M)}q.enqueue(k),N()}},(L)=>{q.error(L)})}}});return new Response(C)}else throw new DX(`fetch for "${H.url}" responded with ${H.status}: ${H.statusText}`,H)}).then((H)=>{switch(K){case"arraybuffer":return H.arrayBuffer();case"blob":return H.blob();case"document":return H.text().then((U)=>{return new DOMParser().parseFromString(U,X)});case"json":return H.json();default:if(X==="")return H.text();else{let G=/charset="?([^;"\s]*)"?/i.exec(X),F=G&&G[1]?G[1].toLowerCase():void 0,E=new TextDecoder(F);return H.arrayBuffer().then((O)=>E.decode(O))}}}).then((H)=>{P9.add(`file:${J}`,H);let U=l9[J];delete l9[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onLoad)E.onLoad(H)}}).catch((H)=>{let U=l9[J];if(U===void 0)throw this.manager.itemError(J),H;delete l9[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onError)E.onError(H)}this.manager.itemError(J)}).finally(()=>{this.manager.itemEnd(J)}),this.manager.itemStart(J)}setResponseType(J){return this.responseType=J,this}setMimeType(J){return this.mimeType=J,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var Z6=new WeakMap;class bZ extends y9{constructor(J){super(J)}load(J,Q,$,Z){if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=P9.get(`image:${J}`);if(Y!==void 0){if(Y.complete===!0)W.manager.itemStart(J),setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);else{let G=Z6.get(Y);if(G===void 0)G=[],Z6.set(Y,G);G.push({onLoad:Q,onError:Z})}return Y}let X=K6("img");function K(){if(U(),Q)Q(this);let G=Z6.get(this)||[];for(let F=0;F<G.length;F++){let E=G[F];if(E.onLoad)E.onLoad(this)}Z6.delete(this),W.manager.itemEnd(J)}function H(G){if(U(),Z)Z(G);P9.remove(`image:${J}`);let F=Z6.get(this)||[];for(let E=0;E<F.length;E++){let O=F[E];if(O.onError)O.onError(G)}Z6.delete(this),W.manager.itemError(J),W.manager.itemEnd(J)}function U(){X.removeEventListener("load",K,!1),X.removeEventListener("error",H,!1)}if(X.addEventListener("load",K,!1),X.addEventListener("error",H,!1),J.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)X.crossOrigin=this.crossOrigin}return P9.add(`image:${J}`,X),W.manager.itemStart(J),X.src=J,X}}class AQ extends y9{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new B6,X=new I6(this.manager);return X.setResponseType("arraybuffer"),X.setRequestHeader(this.requestHeader),X.setPath(this.path),X.setWithCredentials(W.withCredentials),X.load(J,function(K){let H;try{H=W.parse(K)}catch(U){if(Z!==void 0)Z(U);else S0(U);return}if(H.image!==void 0)Y.image=H.image;else if(H.data!==void 0)Y.image.width=H.width,Y.image.height=H.height,Y.image.data=H.data;if(Y.wrapS=H.wrapS!==void 0?H.wrapS:1001,Y.wrapT=H.wrapT!==void 0?H.wrapT:1001,Y.magFilter=H.magFilter!==void 0?H.magFilter:1006,Y.minFilter=H.minFilter!==void 0?H.minFilter:1006,Y.anisotropy=H.anisotropy!==void 0?H.anisotropy:1,H.colorSpace!==void 0)Y.colorSpace=H.colorSpace;if(H.flipY!==void 0)Y.flipY=H.flipY;if(H.format!==void 0)Y.format=H.format;if(H.type!==void 0)Y.type=H.type;if(H.mipmaps!==void 0)Y.mipmaps=H.mipmaps,Y.minFilter=1008;if(H.mipmapCount===1)Y.minFilter=1006;if(H.generateMipmaps!==void 0)Y.generateMipmaps=H.generateMipmaps;if(Y.needsUpdate=!0,Q)Q(Y,H)},$,Z),Y}}class z6 extends y9{constructor(J){super(J)}load(J,Q,$,Z){let W=new PJ,Y=new bZ(this.manager);return Y.setCrossOrigin(this.crossOrigin),Y.setPath(this.path),Y.load(J,function(X){if(W.image=X,W.needsUpdate=!0,Q!==void 0)Q(W)},$,Z),W}}class t9 extends HJ{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new X0(J),this.intensity=Q}dispose(){this.dispatchEvent({type:"dispose"})}copy(J,Q){return super.copy(J,Q),this.color.copy(J.color),this.intensity=J.intensity,this}toJSON(J){let Q=super.toJSON(J);return Q.object.color=this.color.getHex(),Q.object.intensity=this.intensity,Q}}class _6 extends t9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.groundColor=new X0(Q)}copy(J,Q){return super.copy(J,Q),this.groundColor.copy(J.groundColor),this}toJSON(J){let Q=super.toJSON(J);return Q.object.groundColor=this.groundColor.getHex(),Q}}var _$=new j0,NY=new S,OY=new S;class SQ{constructor(J){this.camera=J,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new T0(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new j0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new h8,this._frameExtents=new T0(1,1),this._viewportCount=1,this._viewports=[new $J(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(NY.setFromMatrixPosition(J.matrixWorld),Q.position.copy(NY),OY.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(OY),Q.updateMatrixWorld(),_$.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_$,Q.coordinateSystem,Q.reversedDepth),Q.coordinateSystem===2001||Q.reversedDepth)$.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else $.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);$.multiply(_$)}getViewport(J){return this._viewports[J]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(J){return this.camera=J.camera.clone(),this.intensity=J.intensity,this.bias=J.bias,this.radius=J.radius,this.autoUpdate=J.autoUpdate,this.needsUpdate=J.needsUpdate,this.normalBias=J.normalBias,this.blurSamples=J.blurSamples,this.mapSize.copy(J.mapSize),this.biasNode=J.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let J={};if(this.intensity!==1)J.intensity=this.intensity;if(this.bias!==0)J.bias=this.bias;if(this.normalBias!==0)J.normalBias=this.normalBias;if(this.radius!==1)J.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)J.mapSize=this.mapSize.toArray();return J.camera=this.camera.toJSON(!1).object,delete J.camera.matrix,J}}var t7=new S,e7=new AJ,w9=new S;class jQ extends HJ{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new j0,this.projectionMatrix=new j0,this.projectionMatrixInverse=new j0,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(J,Q){return super.copy(J,Q),this.matrixWorldInverse.copy(J.matrixWorldInverse),this.projectionMatrix.copy(J.projectionMatrix),this.projectionMatrixInverse.copy(J.projectionMatrixInverse),this.coordinateSystem=J.coordinateSystem,this}getWorldDirection(J){return super.getWorldDirection(J).negate()}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.matrixWorld.decompose(t7,e7,w9),w9.x===1&&w9.y===1&&w9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(t7,e7,w9.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(t7,e7,w9),w9.x===1&&w9.y===1&&w9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(t7,e7,w9.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var H8=new S,qY=new T0,RY=new T0;class BJ extends jQ{constructor(J=50,Q=1,$=0.1,Z=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=J,this.zoom=1,this.near=$,this.far=Z,this.focus=10,this.aspect=Q,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.fov=J.fov,this.zoom=J.zoom,this.near=J.near,this.far=J.far,this.focus=J.focus,this.aspect=J.aspect,this.view=J.view===null?null:Object.assign({},J.view),this.filmGauge=J.filmGauge,this.filmOffset=J.filmOffset,this}setFocalLength(J){let Q=0.5*this.getFilmHeight()/J;this.fov=z8*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(m6*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return z8*2*Math.atan(Math.tan(m6*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(J,Q,$){H8.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(H8.x,H8.y).multiplyScalar(-J/H8.z),H8.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(H8.x,H8.y).multiplyScalar(-J/H8.z)}getViewSize(J,Q){return this.getViewBounds(J,qY,RY),Q.subVectors(RY,qY)}setViewOffset(J,Q,$,Z,W,Y){if(this.aspect=J/Q,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=this.near,Q=J*Math.tan(m6*0.5*this.fov)/this.zoom,$=2*Q,Z=this.aspect*$,W=-0.5*Z,Y=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:K,fullHeight:H}=Y;W+=Y.offsetX*Z/K,Q-=Y.offsetY*$/H,Z*=Y.width/K,$*=Y.height/H}let X=this.filmOffset;if(X!==0)W+=J*X/this.getFilmWidth();this.projectionMatrix.makePerspective(W,W+Z,Q,Q-$,J,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.fov=this.fov,Q.object.zoom=this.zoom,Q.object.near=this.near,Q.object.far=this.far,Q.object.focus=this.focus,Q.object.aspect=this.aspect,this.view!==null)Q.object.view=Object.assign({},this.view);return Q.object.filmGauge=this.filmGauge,Q.object.filmOffset=this.filmOffset,Q}}class kX extends SQ{constructor(){super(new BJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=z8*2*J.angle*this.focus,Z=this.mapSize.width/this.mapSize.height*this.aspect,W=J.distance||Q.far;if($!==Q.fov||Z!==Q.aspect||W!==Q.far)Q.fov=$,Q.aspect=Z,Q.far=W,Q.updateProjectionMatrix();super.updateMatrices(J)}copy(J){return super.copy(J),this.focus=J.focus,this}}class vQ extends t9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,Y=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.target=new HJ,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=Y,this.map=null,this.shadow=new kX}get power(){return this.intensity*Math.PI}set power(J){this.intensity=J/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.angle=J.angle,this.penumbra=J.penumbra,this.decay=J.decay,this.target=J.target.clone(),this.map=J.map,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);if(Q.object.distance=this.distance,Q.object.angle=this.angle,Q.object.decay=this.decay,Q.object.penumbra=this.penumbra,Q.object.target=this.target.uuid,this.map&&this.map.isTexture)Q.object.map=this.map.toJSON(J).uuid;return Q.object.shadow=this.shadow.toJSON(),Q}}class MX extends SQ{constructor(){super(new BJ(90,1,0.5,500));this.isPointLightShadow=!0}}class R8 extends t9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new MX}get power(){return this.intensity*4*Math.PI}set power(J){this.intensity=J/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.decay=J.decay,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.distance=this.distance,Q.object.decay=this.decay,Q.object.shadow=this.shadow.toJSON(),Q}}class e9 extends jQ{constructor(J=-1,Q=1,$=1,Z=-1,W=0.1,Y=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=J,this.right=Q,this.top=$,this.bottom=Z,this.near=W,this.far=Y,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.left=J.left,this.right=J.right,this.top=J.top,this.bottom=J.bottom,this.near=J.near,this.far=J.far,this.zoom=J.zoom,this.view=J.view===null?null:Object.assign({},J.view),this}setViewOffset(J,Q,$,Z,W,Y){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=(this.right-this.left)/(2*this.zoom),Q=(this.top-this.bottom)/(2*this.zoom),$=(this.right+this.left)/2,Z=(this.top+this.bottom)/2,W=$-J,Y=$+J,X=Z+Q,K=Z-Q;if(this.view!==null&&this.view.enabled){let H=(this.right-this.left)/this.view.fullWidth/this.zoom,U=(this.top-this.bottom)/this.view.fullHeight/this.zoom;W+=H*this.view.offsetX,Y=W+H*this.view.width,X-=U*this.view.offsetY,K=X-U*this.view.height}this.projectionMatrix.makeOrthographic(W,Y,X,K,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.zoom=this.zoom,Q.object.left=this.left,Q.object.right=this.right,Q.object.top=this.top,Q.object.bottom=this.bottom,Q.object.near=this.near,Q.object.far=this.far,this.view!==null)Q.object.view=Object.assign({},this.view);return Q}}class VX extends SQ{constructor(){super(new e9(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class x9 extends t9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.target=new HJ,this.shadow=new VX}dispose(){super.dispose(),this.shadow.dispose()}copy(J){return super.copy(J),this.target=J.target.clone(),this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.shadow=this.shadow.toJSON(),Q.object.target=this.target.uuid,Q}}class O7 extends t9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}}class L8{static extractUrlBase(J){let Q=J.lastIndexOf("/");if(Q===-1)return"./";return J.slice(0,Q+1)}static resolveURL(J,Q){if(typeof J!=="string"||J==="")return"";if(/^https?:\/\//i.test(Q)&&/^\//.test(J))Q=Q.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(J))return J;if(/^data:.*,.*$/i.test(J))return J;if(/^blob:.*$/i.test(J))return J;return Q+J}}var w$=new WeakMap;class yQ extends y9{constructor(J){super(J);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")C0("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")C0("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(J){return this.options=J,this}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=P9.get(`image-bitmap:${J}`);if(Y!==void 0){if(W.manager.itemStart(J),Y.then){Y.then((H)=>{if(w$.has(Y)===!0){if(Z)Z(w$.get(Y));W.manager.itemError(J),W.manager.itemEnd(J)}else{if(Q)Q(H);W.manager.itemEnd(J)}});return}setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);return}let X={};X.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",X.headers=this.requestHeader,X.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let K=fetch(J,X).then(function(H){return H.blob()}).then(function(H){return createImageBitmap(H,Object.assign(W.options,{colorSpaceConversion:"none"}))}).then(function(H){if(P9.add(`image-bitmap:${J}`,H),Q)Q(H);W.manager.itemEnd(J)}).catch(function(H){if(Z)Z(H);w$.set(K,H),P9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});P9.add(`image-bitmap:${J}`,K),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var W6=-90,Y6=1;class hZ extends HJ{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new BJ(W6,Y6,J,Q);Z.layers=this.layers,this.add(Z);let W=new BJ(W6,Y6,J,Q);W.layers=this.layers,this.add(W);let Y=new BJ(W6,Y6,J,Q);Y.layers=this.layers,this.add(Y);let X=new BJ(W6,Y6,J,Q);X.layers=this.layers,this.add(X);let K=new BJ(W6,Y6,J,Q);K.layers=this.layers,this.add(K);let H=new BJ(W6,Y6,J,Q);H.layers=this.layers,this.add(H)}updateCoordinateSystem(){let J=this.coordinateSystem,Q=this.children.concat(),[$,Z,W,Y,X,K]=Q;for(let H of Q)this.remove(H);if(J===2000)$.up.set(0,1,0),$.lookAt(1,0,0),Z.up.set(0,1,0),Z.lookAt(-1,0,0),W.up.set(0,0,-1),W.lookAt(0,1,0),Y.up.set(0,0,1),Y.lookAt(0,-1,0),X.up.set(0,1,0),X.lookAt(0,0,1),K.up.set(0,1,0),K.lookAt(0,0,-1);else if(J===2001)$.up.set(0,-1,0),$.lookAt(-1,0,0),Z.up.set(0,-1,0),Z.lookAt(1,0,0),W.up.set(0,0,1),W.lookAt(0,1,0),Y.up.set(0,0,-1),Y.lookAt(0,-1,0),X.up.set(0,-1,0),X.lookAt(0,0,1),K.up.set(0,-1,0),K.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+J);for(let H of Q)this.add(H),H.updateMatrixWorld()}update(J,Q){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:$,activeMipmapLevel:Z}=this;if(this.coordinateSystem!==J.coordinateSystem)this.coordinateSystem=J.coordinateSystem,this.updateCoordinateSystem();let[W,Y,X,K,H,U]=this.children,G=J.getRenderTarget(),F=J.getActiveCubeFace(),E=J.getActiveMipmapLevel(),O=J.xr.enabled;J.xr.enabled=!1;let R=$.texture.generateMipmaps;$.texture.generateMipmaps=!1;let C=!1;if(J.isWebGLRenderer===!0)C=J.state.buffers.depth.getReversed();else C=J.reversedDepthBuffer;if(J.setRenderTarget($,0,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,W),J.setRenderTarget($,1,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,Y),J.setRenderTarget($,2,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,X),J.setRenderTarget($,3,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,K),J.setRenderTarget($,4,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,H),$.texture.generateMipmaps=R,J.setRenderTarget($,5,Z),C&&J.autoClear===!1)J.clearDepth();J.render(Q,U),J.setRenderTarget(G,F,E),J.xr.enabled=O,$.texture.needsPMREMUpdate=!0}}class fZ extends BJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class xQ{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(J){if(this._document=J,J.hidden!==void 0)this._pageVisibilityHandler=BU.bind(this),J.addEventListener("visibilitychange",this._pageVisibilityHandler,!1)}disconnect(){if(this._pageVisibilityHandler!==null)this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null;this._document=null}getDelta(){return this._delta/1000}getElapsed(){return this._elapsed/1000}getTimescale(){return this._timescale}setTimescale(J){return this._timescale=J,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(J){if(this._pageVisibilityHandler!==null&&this._document.hidden===!0)this._delta=0;else this._previousTime=this._currentTime,this._currentTime=(J!==void 0?J:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta;return this}}function BU(){if(this._document.hidden===!1)this.reset()}class gZ{constructor(J,Q,$){this.binding=J,this.valueSize=$;let Z,W,Y;switch(Q){case"quaternion":Z=this._slerp,W=this._slerpAdditive,Y=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array($*6),this._workIndex=5;break;case"string":case"bool":Z=this._select,W=this._select,Y=this._setAdditiveIdentityOther,this.buffer=Array($*5);break;default:Z=this._lerp,W=this._lerpAdditive,Y=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array($*5)}this._mixBufferRegion=Z,this._mixBufferRegionAdditive=W,this._setIdentity=Y,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(J,Q){let $=this.buffer,Z=this.valueSize,W=J*Z+Z,Y=this.cumulativeWeight;if(Y===0){for(let X=0;X!==Z;++X)$[W+X]=$[X];Y=Q}else{Y+=Q;let X=Q/Y;this._mixBufferRegion($,W,0,X,Z)}this.cumulativeWeight=Y}accumulateAdditive(J){let Q=this.buffer,$=this.valueSize,Z=$*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(Q,Z,0,J,$),this.cumulativeWeightAdditive+=J}apply(J){let Q=this.valueSize,$=this.buffer,Z=J*Q+Q,W=this.cumulativeWeight,Y=this.cumulativeWeightAdditive,X=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,W<1){let K=Q*this._origIndex;this._mixBufferRegion($,Z,K,1-W,Q)}if(Y>0)this._mixBufferRegionAdditive($,Z,this._addIndex*Q,1,Q);for(let K=Q,H=Q+Q;K!==H;++K)if($[K]!==$[K+Q]){X.setValue($,Z);break}}saveOriginalState(){let J=this.binding,Q=this.buffer,$=this.valueSize,Z=$*this._origIndex;J.getValue(Q,Z);for(let W=$,Y=Z;W!==Y;++W)Q[W]=Q[Z+W%$];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let J=this.valueSize*3;this.binding.setValue(this.buffer,J)}_setAdditiveIdentityNumeric(){let J=this._addIndex*this.valueSize,Q=J+this.valueSize;for(let $=J;$<Q;$++)this.buffer[$]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let J=this._origIndex*this.valueSize,Q=this._addIndex*this.valueSize;for(let $=0;$<this.valueSize;$++)this.buffer[Q+$]=this.buffer[J+$]}_select(J,Q,$,Z,W){if(Z>=0.5)for(let Y=0;Y!==W;++Y)J[Q+Y]=J[$+Y]}_slerp(J,Q,$,Z){AJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let Y=this._workIndex*W;AJ.multiplyQuaternionsFlat(J,Y,J,Q,J,$),AJ.slerpFlat(J,Q,J,Q,J,Y,Z)}_lerp(J,Q,$,Z,W){let Y=1-Z;for(let X=0;X!==W;++X){let K=Q+X;J[K]=J[K]*Y+J[$+X]*Z}}_lerpAdditive(J,Q,$,Z,W){for(let Y=0;Y!==W;++Y){let X=Q+Y;J[X]=J[X]+J[$+Y]*Z}}}var pZ="\\[\\]\\.:\\/",CU=new RegExp("["+pZ+"]","g"),uZ="[^"+pZ+"]",IU="[^"+pZ.replace("\\.","")+"]",zU=/((?:WC+[\/:])*)/.source.replace("WC",uZ),_U=/(WCOD+)?/.source.replace("WCOD",IU),wU=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uZ),PU=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uZ),TU=new RegExp("^"+zU+_U+wU+PU+"$"),AU=["material","materials","bones","map"];class BX{constructor(J,Q,$){let Z=$||JJ.parseTrackName(Q);this._targetGroup=J,this._bindings=J.subscribe_(Q,Z)}getValue(J,Q){this.bind();let $=this._targetGroup.nCachedObjects_,Z=this._bindings[$];if(Z!==void 0)Z.getValue(J,Q)}setValue(J,Q){let $=this._bindings;for(let Z=this._targetGroup.nCachedObjects_,W=$.length;Z!==W;++Z)$[Z].setValue(J,Q)}bind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].bind()}unbind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].unbind()}}class JJ{constructor(J,Q,$){this.path=Q,this.parsedPath=$||JJ.parseTrackName(Q),this.node=JJ.findNode(J,this.parsedPath.nodeName),this.rootNode=J,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(J,Q,$){if(!(J&&J.isAnimationObjectGroup))return new JJ(J,Q,$);else return new JJ.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(CU,"")}static parseTrackName(J){let Q=TU.exec(J);if(Q===null)throw Error("PropertyBinding: Cannot parse trackName: "+J);let $={nodeName:Q[2],objectName:Q[3],objectIndex:Q[4],propertyName:Q[5],propertyIndex:Q[6]},Z=$.nodeName&&$.nodeName.lastIndexOf(".");if(Z!==void 0&&Z!==-1){let W=$.nodeName.substring(Z+1);if(AU.indexOf(W)!==-1)$.nodeName=$.nodeName.substring(0,Z),$.objectName=W}if($.propertyName===null||$.propertyName.length===0)throw Error("PropertyBinding: can not parse propertyName from trackName: "+J);return $}static findNode(J,Q){if(Q===void 0||Q===""||Q==="."||Q===-1||Q===J.name||Q===J.uuid)return J;if(J.skeleton){let $=J.skeleton.getBoneByName(Q);if($!==void 0)return $}if(J.children){let $=function(W){for(let Y=0;Y<W.length;Y++){let X=W[Y];if(X.name===Q||X.uuid===Q)return X;let K=$(X.children);if(K)return K}return null},Z=$(J.children);if(Z)return Z}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(J,Q){J[Q]=this.targetObject[this.propertyName]}_getValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)J[Q++]=$[Z]}_getValue_arrayElement(J,Q){J[Q]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(J,Q){this.resolvedProperty.toArray(J,Q)}_setValue_direct(J,Q){this.targetObject[this.propertyName]=J[Q]}_setValue_direct_setNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++]}_setValue_array_setNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q]}_setValue_arrayElement_setNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(J,Q){this.resolvedProperty.fromArray(J,Q)}_setValue_fromArray_setNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(J,Q){this.bind(),this.getValue(J,Q)}_setValue_unbound(J,Q){this.bind(),this.setValue(J,Q)}bind(){let J=this.node,Q=this.parsedPath,$=Q.objectName,Z=Q.propertyName,W=Q.propertyIndex;if(!J)J=JJ.findNode(this.rootNode,Q.nodeName),this.node=J;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!J){C0("PropertyBinding: No target node found for track: "+this.path+".");return}if($){let H=Q.objectIndex;switch($){case"materials":if(!J.material){S0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){S0("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}J=J.material.materials;break;case"bones":if(!J.skeleton){S0("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}J=J.skeleton.bones;for(let U=0;U<J.length;U++)if(J[U].name===H){H=U;break}break;case"map":if("map"in J){J=J.map;break}if(!J.material){S0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){S0("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}J=J.material.map;break;default:if(J[$]===void 0){S0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(H!==void 0){if(J[H]===void 0){S0("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,J);return}J=J[H]}}let Y=J[Z];if(Y===void 0){let H=Q.nodeName;S0("PropertyBinding: Trying to update property for track: "+H+"."+Z+" but it wasn't found.",J);return}let X=this.Versioning.None;if(this.targetObject=J,J.isMaterial===!0)X=this.Versioning.NeedsUpdate;else if(J.isObject3D===!0)X=this.Versioning.MatrixWorldNeedsUpdate;let K=this.BindingType.Direct;if(W!==void 0){if(Z==="morphTargetInfluences"){if(!J.geometry){S0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){S0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(J.morphTargetDictionary[W]!==void 0)W=J.morphTargetDictionary[W]}K=this.BindingType.ArrayElement,this.resolvedProperty=Y,this.propertyIndex=W}else if(Y.fromArray!==void 0&&Y.toArray!==void 0)K=this.BindingType.HasFromToArray,this.resolvedProperty=Y;else if(Array.isArray(Y))K=this.BindingType.EntireArray,this.resolvedProperty=Y;else this.propertyName=Z;this.getValue=this.GetterByBindingType[K],this.setValue=this.SetterByBindingTypeAndVersioning[K][X]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}JJ.Composite=BX;JJ.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};JJ.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};JJ.prototype.GetterByBindingType=[JJ.prototype._getValue_direct,JJ.prototype._getValue_array,JJ.prototype._getValue_arrayElement,JJ.prototype._getValue_toArray];JJ.prototype.SetterByBindingTypeAndVersioning=[[JJ.prototype._setValue_direct,JJ.prototype._setValue_direct_setNeedsUpdate,JJ.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[JJ.prototype._setValue_array,JJ.prototype._setValue_array_setNeedsUpdate,JJ.prototype._setValue_array_setMatrixWorldNeedsUpdate],[JJ.prototype._setValue_arrayElement,JJ.prototype._setValue_arrayElement_setNeedsUpdate,JJ.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[JJ.prototype._setValue_fromArray,JJ.prototype._setValue_fromArray_setNeedsUpdate,JJ.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class dZ{constructor(J,Q,$=null,Z=Q.blendMode){this._mixer=J,this._clip=Q,this._localRoot=$,this.blendMode=Z;let W=Q.tracks,Y=W.length,X=Array(Y),K={endingStart:2400,endingEnd:2400};for(let H=0;H!==Y;++H){let U=W[H].createInterpolant(null);if(X[H]=U,U.settings)Object.assign(K,U.settings);U.settings=K}this._interpolantSettings=K,this._interpolants=X,this._propertyBindings=Array(Y),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(J){return this._startTime=J,this}setLoop(J,Q){return this.loop=J,this.repetitions=Q,this}setEffectiveWeight(J){return this.weight=J,this._effectiveWeight=this.enabled?J:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(J){return this._scheduleFading(J,0,1)}fadeOut(J){return this._scheduleFading(J,1,0)}crossFadeFrom(J,Q,$=!1){if(J.fadeOut(Q),this.fadeIn(Q),$===!0){let Z=this._clip.duration,W=J._clip.duration,Y=W/Z,X=Z/W;J.warp(1,Y,Q),this.warp(X,1,Q)}return this}crossFadeTo(J,Q,$=!1){return J.crossFadeFrom(this,Q,$)}stopFading(){let J=this._weightInterpolant;if(J!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}setEffectiveTimeScale(J){return this.timeScale=J,this._effectiveTimeScale=this.paused?0:J,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(J){return this.timeScale=this._clip.duration/J,this.stopWarping()}syncWith(J){return this.time=J.time,this.timeScale=J.timeScale,this.stopWarping()}halt(J){return this.warp(this._effectiveTimeScale,0,J)}warp(J,Q,$){let Z=this._mixer,W=Z.time,Y=this.timeScale,X=this._timeScaleInterpolant;if(X===null)X=Z._lendControlInterpolant(),this._timeScaleInterpolant=X;let{parameterPositions:K,sampleValues:H}=X;return K[0]=W,K[1]=W+$,H[0]=J/Y,H[1]=Q/Y,this}stopWarping(){let J=this._timeScaleInterpolant;if(J!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(J,Q,$,Z){if(!this.enabled){this._updateWeight(J);return}let W=this._startTime;if(W!==null){let K=(J-W)*$;if(K<0||$===0)Q=0;else this._startTime=null,Q=$*K}Q*=this._updateTimeScale(J);let Y=this._updateTime(Q),X=this._updateWeight(J);if(X>0){let K=this._interpolants,H=this._propertyBindings;switch(this.blendMode){case 2501:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulateAdditive(X);break;case 2500:default:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulate(Z,X)}}}_updateWeight(J){let Q=0;if(this.enabled){Q=this.weight;let $=this._weightInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1]){if(this.stopFading(),Z===0)this.enabled=!1}}}return this._effectiveWeight=Q,Q}_updateTimeScale(J){let Q=0;if(!this.paused){Q=this.timeScale;let $=this._timeScaleInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1])if(this.stopWarping(),Q===0)this.paused=!0;else this.timeScale=Q}}return this._effectiveTimeScale=Q,Q}_updateTime(J){let Q=this._clip.duration,$=this.loop,Z=this.time+J,W=this._loopCount,Y=$===2202;if(J===0){if(W===-1)return Z;return Y&&(W&1)===1?Q-Z:Z}if($===2200){if(W===-1)this._loopCount=0,this._setEndings(!0,!0,!1);J:{if(Z>=Q)Z=Q;else if(Z<0)Z=0;else{this.time=Z;break J}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J<0?-1:1})}}else{if(W===-1)if(J>=0)W=0,this._setEndings(!0,this.repetitions===0,Y);else this._setEndings(this.repetitions===0,!0,Y);if(Z>=Q||Z<0){let X=Math.floor(Z/Q);Z-=Q*X,W+=Math.abs(X);let K=this.repetitions-W;if(K<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;Z=J>0?Q:0,this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J>0?1:-1})}else{if(K===1){let H=J<0;this._setEndings(H,!H,Y)}else this._setEndings(!1,!1,Y);this._loopCount=W,this.time=Z,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:X})}}else this._loopCount=W,this.time=Z;if(Y&&(W&1)===1)return Q-Z}return Z}_setEndings(J,Q,$){let Z=this._interpolantSettings;if($)Z.endingStart=2401,Z.endingEnd=2401;else{if(J)Z.endingStart=this.zeroSlopeAtStart?2401:2400;else Z.endingStart=2402;if(Q)Z.endingEnd=this.zeroSlopeAtEnd?2401:2400;else Z.endingEnd=2402}}_scheduleFading(J,Q,$){let Z=this._mixer,W=Z.time,Y=this._weightInterpolant;if(Y===null)Y=Z._lendControlInterpolant(),this._weightInterpolant=Y;let{parameterPositions:X,sampleValues:K}=Y;return X[0]=W,K[0]=Q,X[1]=W+J,K[1]=$,this}}var SU=new Float32Array(1);class bQ extends v9{constructor(J){super();if(this._root=J,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(J,Q){let $=J._localRoot||this._root,Z=J._clip.tracks,W=Z.length,Y=J._propertyBindings,X=J._interpolants,K=$.uuid,H=this._bindingsByRootAndName,U=H[K];if(U===void 0)U={},H[K]=U;for(let G=0;G!==W;++G){let F=Z[G],E=F.name,O=U[E];if(O!==void 0)++O.referenceCount,Y[G]=O;else{if(O=Y[G],O!==void 0){if(O._cacheIndex===null)++O.referenceCount,this._addInactiveBinding(O,K,E);continue}let R=Q&&Q._propertyBindings[G].binding.parsedPath;O=new gZ(JJ.create($,E,R),F.ValueTypeName,F.getValueSize()),++O.referenceCount,this._addInactiveBinding(O,K,E),Y[G]=O}X[G].resultBuffer=O.buffer}}_activateAction(J){if(!this._isActiveAction(J)){if(J._cacheIndex===null){let $=(J._localRoot||this._root).uuid,Z=J._clip.uuid,W=this._actionsByClip[Z];this._bindAction(J,W&&W.knownActions[0]),this._addInactiveAction(J,Z,$)}let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(W.useCount++===0)this._lendBinding(W),W.saveOriginalState()}this._lendAction(J)}}_deactivateAction(J){if(this._isActiveAction(J)){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.useCount===0)W.restoreOriginalState(),this._takeBackBinding(W)}this._takeBackAction(J)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let J=this;this.stats={actions:{get total(){return J._actions.length},get inUse(){return J._nActiveActions}},bindings:{get total(){return J._bindings.length},get inUse(){return J._nActiveBindings}},controlInterpolants:{get total(){return J._controlInterpolants.length},get inUse(){return J._nActiveControlInterpolants}}}}_isActiveAction(J){let Q=J._cacheIndex;return Q!==null&&Q<this._nActiveActions}_addInactiveAction(J,Q,$){let Z=this._actions,W=this._actionsByClip,Y=W[Q];if(Y===void 0)Y={knownActions:[J],actionByRoot:{}},J._byClipCacheIndex=0,W[Q]=Y;else{let X=Y.knownActions;J._byClipCacheIndex=X.length,X.push(J)}J._cacheIndex=Z.length,Z.push(J),Y.actionByRoot[$]=J}_removeInactiveAction(J){let Q=this._actions,$=Q[Q.length-1],Z=J._cacheIndex;$._cacheIndex=Z,Q[Z]=$,Q.pop(),J._cacheIndex=null;let W=J._clip.uuid,Y=this._actionsByClip,X=Y[W],K=X.knownActions,H=K[K.length-1],U=J._byClipCacheIndex;H._byClipCacheIndex=U,K[U]=H,K.pop(),J._byClipCacheIndex=null;let G=X.actionByRoot,F=(J._localRoot||this._root).uuid;if(delete G[F],K.length===0)delete Y[W];this._removeInactiveBindingsForAction(J)}_removeInactiveBindingsForAction(J){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.referenceCount===0)this._removeInactiveBinding(W)}}_lendAction(J){let Q=this._actions,$=J._cacheIndex,Z=this._nActiveActions++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackAction(J){let Q=this._actions,$=J._cacheIndex,Z=--this._nActiveActions,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_addInactiveBinding(J,Q,$){let Z=this._bindingsByRootAndName,W=this._bindings,Y=Z[Q];if(Y===void 0)Y={},Z[Q]=Y;Y[$]=J,J._cacheIndex=W.length,W.push(J)}_removeInactiveBinding(J){let Q=this._bindings,$=J.binding,Z=$.rootNode.uuid,W=$.path,Y=this._bindingsByRootAndName,X=Y[Z],K=Q[Q.length-1],H=J._cacheIndex;if(K._cacheIndex=H,Q[H]=K,Q.pop(),delete X[W],Object.keys(X).length===0)delete Y[Z]}_lendBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=this._nActiveBindings++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=--this._nActiveBindings,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_lendControlInterpolant(){let J=this._controlInterpolants,Q=this._nActiveControlInterpolants++,$=J[Q];if($===void 0)$=new PQ(new Float32Array(2),new Float32Array(2),1,SU),$.__cacheIndex=Q,J[Q]=$;return $}_takeBackControlInterpolant(J){let Q=this._controlInterpolants,$=J.__cacheIndex,Z=--this._nActiveControlInterpolants,W=Q[Z];J.__cacheIndex=Z,Q[Z]=J,W.__cacheIndex=$,Q[$]=W}clipAction(J,Q,$){let Z=Q||this._root,W=Z.uuid,Y=typeof J==="string"?U6.findByName(Z,J):J,X=Y!==null?Y.uuid:J,K=this._actionsByClip[X],H=null;if($===void 0)if(Y!==null)$=Y.blendMode;else $=2500;if(K!==void 0){let G=K.actionByRoot[W];if(G!==void 0&&G.blendMode===$)return G;if(H=K.knownActions[0],Y===null)Y=H._clip}if(Y===null)return null;let U=new dZ(this,Y,Q,$);return this._bindAction(U,H),this._addInactiveAction(U,X,W),U}existingAction(J,Q){let $=Q||this._root,Z=$.uuid,W=typeof J==="string"?U6.findByName($,J):J,Y=W?W.uuid:J,X=this._actionsByClip[Y];if(X!==void 0)return X.actionByRoot[Z]||null;return null}stopAllAction(){let J=this._actions,Q=this._nActiveActions;for(let $=Q-1;$>=0;--$)J[$].stop();return this}update(J){J*=this.timeScale;let Q=this._actions,$=this._nActiveActions,Z=this.time+=J,W=Math.sign(J),Y=this._accuIndex^=1;for(let H=0;H!==$;++H)Q[H]._update(Z,J,W,Y);let X=this._bindings,K=this._nActiveBindings;for(let H=0;H!==K;++H)X[H].apply(Y);return this}setTime(J){this.time=0;for(let Q=0;Q<this._actions.length;Q++)this._actions[Q].time=0;return this.update(J)}getRoot(){return this._root}uncacheClip(J){let Q=this._actions,$=J.uuid,Z=this._actionsByClip,W=Z[$];if(W!==void 0){let Y=W.knownActions;for(let X=0,K=Y.length;X!==K;++X){let H=Y[X];this._deactivateAction(H);let U=H._cacheIndex,G=Q[Q.length-1];H._cacheIndex=null,H._byClipCacheIndex=null,G._cacheIndex=U,Q[U]=G,Q.pop(),this._removeInactiveBindingsForAction(H)}delete Z[$]}}uncacheRoot(J){let Q=J.uuid,$=this._actionsByClip;for(let Y in $){let X=$[Y].actionByRoot,K=X[Q];if(K!==void 0)this._deactivateAction(K),this._removeInactiveAction(K)}let Z=this._bindingsByRootAndName,W=Z[Q];if(W!==void 0)for(let Y in W){let X=W[Y];X.restoreOriginalState(),this._removeInactiveBinding(X)}}uncacheAction(J,Q){let $=this.existingAction(J,Q);if($!==null)this._deactivateAction($),this._removeInactiveAction($)}}class mZ{static{mZ.prototype.isMatrix2=!0}constructor(J,Q,$,Z){if(this.elements=[1,0,0,1],J!==void 0)this.set(J,Q,$,Z)}identity(){return this.set(1,0,0,1),this}fromArray(J,Q=0){for(let $=0;$<4;$++)this.elements[$]=J[$+Q];return this}set(J,Q,$,Z){let W=this.elements;return W[0]=J,W[2]=Q,W[1]=$,W[3]=Z,this}}function lZ(J,Q,$,Z){let W=jU(Z);switch($){case 1021:return J*Q;case 1028:return J*Q/W.components*W.byteLength;case 1029:return J*Q/W.components*W.byteLength;case 1030:return J*Q*2/W.components*W.byteLength;case 1031:return J*Q*2/W.components*W.byteLength;case 1022:return J*Q*3/W.components*W.byteLength;case 1023:return J*Q*4/W.components*W.byteLength;case 1033:return J*Q*4/W.components*W.byteLength;case 33776:case 33777:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 33778:case 33779:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 35841:case 35843:return Math.max(J,16)*Math.max(Q,8)/4;case 35840:case 35842:return Math.max(J,8)*Math.max(Q,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37808:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37809:return Math.floor((J+4)/5)*Math.floor((Q+3)/4)*16;case 37810:return Math.floor((J+4)/5)*Math.floor((Q+4)/5)*16;case 37811:return Math.floor((J+5)/6)*Math.floor((Q+4)/5)*16;case 37812:return Math.floor((J+5)/6)*Math.floor((Q+5)/6)*16;case 37813:return Math.floor((J+7)/8)*Math.floor((Q+4)/5)*16;case 37814:return Math.floor((J+7)/8)*Math.floor((Q+5)/6)*16;case 37815:return Math.floor((J+7)/8)*Math.floor((Q+7)/8)*16;case 37816:return Math.floor((J+9)/10)*Math.floor((Q+4)/5)*16;case 37817:return Math.floor((J+9)/10)*Math.floor((Q+5)/6)*16;case 37818:return Math.floor((J+9)/10)*Math.floor((Q+7)/8)*16;case 37819:return Math.floor((J+9)/10)*Math.floor((Q+9)/10)*16;case 37820:return Math.floor((J+11)/12)*Math.floor((Q+9)/10)*16;case 37821:return Math.floor((J+11)/12)*Math.floor((Q+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(J/4)*Math.ceil(Q/4)*16;case 36283:case 36284:return Math.ceil(J/4)*Math.ceil(Q/4)*8;case 36285:case 36286:return Math.ceil(J/4)*Math.ceil(Q/4)*16}throw Error(`Unable to determine texture byte length for ${$} format.`)}function jU(J){switch(J){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${J}.`)}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));if(typeof window<"u")if(window.__THREE__)C0("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="184";function cX(){let J=null,Q=!1,$=null,Z=null;function W(Y,X){$(Y,X),Z=J.requestAnimationFrame(W)}return{start:function(){if(Q===!0)return;if($===null)return;if(J===null)return;Z=J.requestAnimationFrame(W),Q=!0},stop:function(){if(J!==null)J.cancelAnimationFrame(Z);Q=!1},setAnimationLoop:function(Y){$=Y},setContext:function(Y){J=Y}}}function vU(J){let Q=new WeakMap;function $(K,H){let{array:U,usage:G}=K,F=U.byteLength,E=J.createBuffer();J.bindBuffer(H,E),J.bufferData(H,U,G),K.onUploadCallback();let O;if(U instanceof Float32Array)O=J.FLOAT;else if(typeof Float16Array<"u"&&U instanceof Float16Array)O=J.HALF_FLOAT;else if(U instanceof Uint16Array)if(K.isFloat16BufferAttribute)O=J.HALF_FLOAT;else O=J.UNSIGNED_SHORT;else if(U instanceof Int16Array)O=J.SHORT;else if(U instanceof Uint32Array)O=J.UNSIGNED_INT;else if(U instanceof Int32Array)O=J.INT;else if(U instanceof Int8Array)O=J.BYTE;else if(U instanceof Uint8Array)O=J.UNSIGNED_BYTE;else if(U instanceof Uint8ClampedArray)O=J.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+U);return{buffer:E,type:O,bytesPerElement:U.BYTES_PER_ELEMENT,version:K.version,size:F}}function Z(K,H,U){let{array:G,updateRanges:F}=H;if(J.bindBuffer(U,K),F.length===0)J.bufferSubData(U,0,G);else{F.sort((O,R)=>O.start-R.start);let E=0;for(let O=1;O<F.length;O++){let R=F[E],C=F[O];if(C.start<=R.start+R.count+1)R.count=Math.max(R.count,C.start+C.count-R.start);else++E,F[E]=C}F.length=E+1;for(let O=0,R=F.length;O<R;O++){let C=F[O];J.bufferSubData(U,C.start*G.BYTES_PER_ELEMENT,G,C.start,C.count)}H.clearUpdateRanges()}H.onUploadCallback()}function W(K){if(K.isInterleavedBufferAttribute)K=K.data;return Q.get(K)}function Y(K){if(K.isInterleavedBufferAttribute)K=K.data;let H=Q.get(K);if(H)J.deleteBuffer(H.buffer),Q.delete(K)}function X(K,H){if(K.isInterleavedBufferAttribute)K=K.data;if(K.isGLBufferAttribute){let G=Q.get(K);if(!G||G.version<K.version)Q.set(K,{buffer:K.buffer,type:K.type,bytesPerElement:K.elementSize,version:K.version});return}let U=Q.get(K);if(U===void 0)Q.set(K,$(K,H));else if(U.version<K.version){if(U.size!==K.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");Z(U.buffer,K,H),U.version=K.version}}return{get:W,remove:Y,update:X}}var yU=`#ifdef USE_ALPHAHASH
5
+ }`;class LJ extends vJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=WN,this.fragmentShader=YN,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,J!==void 0)this.setValues(J)}copy(J){return super.copy(J),this.fragmentShader=J.fragmentShader,this.vertexShader=J.vertexShader,this.uniforms=p6(J.uniforms),this.uniformsGroups=ZN(J.uniformsGroups),this.defines=Object.assign({},J.defines),this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.fog=J.fog,this.lights=J.lights,this.clipping=J.clipping,this.extensions=Object.assign({},J.extensions),this.glslVersion=J.glslVersion,this.defaultAttributeValues=Object.assign({},J.defaultAttributeValues),this.index0AttributeName=J.index0AttributeName,this.uniformsNeedUpdate=J.uniformsNeedUpdate,this}toJSON(J){let Q=super.toJSON(J);Q.glslVersion=this.glslVersion,Q.uniforms={};for(let Z in this.uniforms){let Y=this.uniforms[Z].value;if(Y&&Y.isTexture)Q.uniforms[Z]={type:"t",value:Y.toJSON(J).uuid};else if(Y&&Y.isColor)Q.uniforms[Z]={type:"c",value:Y.getHex()};else if(Y&&Y.isVector2)Q.uniforms[Z]={type:"v2",value:Y.toArray()};else if(Y&&Y.isVector3)Q.uniforms[Z]={type:"v3",value:Y.toArray()};else if(Y&&Y.isVector4)Q.uniforms[Z]={type:"v4",value:Y.toArray()};else if(Y&&Y.isMatrix3)Q.uniforms[Z]={type:"m3",value:Y.toArray()};else if(Y&&Y.isMatrix4)Q.uniforms[Z]={type:"m4",value:Y.toArray()};else Q.uniforms[Z]={value:Y}}if(Object.keys(this.defines).length>0)Q.defines=this.defines;Q.vertexShader=this.vertexShader,Q.fragmentShader=this.fragmentShader,Q.lights=this.lights,Q.clipping=this.clipping;let $={};for(let Z in this.extensions)if(this.extensions[Z]===!0)$[Z]=!0;if(Object.keys($).length>0)Q.extensions=$;return Q}}class u6 extends LJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class iJ extends vJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new e(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new A9,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={STANDARD:""},this.color.copy(J.color),this.roughness=J.roughness,this.metalness=J.metalness,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.roughnessMap=J.roughnessMap,this.metalnessMap=J.metalnessMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.envMapIntensity=J.envMapIntensity,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class oJ extends iJ{constructor(J){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new i(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return s0(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Q){this.ior=(1+0.4*Q)/(1-0.4*Q)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new e(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new e(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(J)}get anisotropy(){return this._anisotropy}set anisotropy(J){if(this._anisotropy>0!==J>0)this.version++;this._anisotropy=J}get clearcoat(){return this._clearcoat}set clearcoat(J){if(this._clearcoat>0!==J>0)this.version++;this._clearcoat=J}get iridescence(){return this._iridescence}set iridescence(J){if(this._iridescence>0!==J>0)this.version++;this._iridescence=J}get dispersion(){return this._dispersion}set dispersion(J){if(this._dispersion>0!==J>0)this.version++;this._dispersion=J}get sheen(){return this._sheen}set sheen(J){if(this._sheen>0!==J>0)this.version++;this._sheen=J}get transmission(){return this._transmission}set transmission(J){if(this._transmission>0!==J>0)this.version++;this._transmission=J}copy(J){return super.copy(J),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=J.anisotropy,this.anisotropyRotation=J.anisotropyRotation,this.anisotropyMap=J.anisotropyMap,this.clearcoat=J.clearcoat,this.clearcoatMap=J.clearcoatMap,this.clearcoatRoughness=J.clearcoatRoughness,this.clearcoatRoughnessMap=J.clearcoatRoughnessMap,this.clearcoatNormalMap=J.clearcoatNormalMap,this.clearcoatNormalScale.copy(J.clearcoatNormalScale),this.dispersion=J.dispersion,this.ior=J.ior,this.iridescence=J.iridescence,this.iridescenceMap=J.iridescenceMap,this.iridescenceIOR=J.iridescenceIOR,this.iridescenceThicknessRange=[...J.iridescenceThicknessRange],this.iridescenceThicknessMap=J.iridescenceThicknessMap,this.sheen=J.sheen,this.sheenColor.copy(J.sheenColor),this.sheenColorMap=J.sheenColorMap,this.sheenRoughness=J.sheenRoughness,this.sheenRoughnessMap=J.sheenRoughnessMap,this.transmission=J.transmission,this.transmissionMap=J.transmissionMap,this.thickness=J.thickness,this.thicknessMap=J.thicknessMap,this.attenuationDistance=J.attenuationDistance,this.attenuationColor.copy(J.attenuationColor),this.specularIntensity=J.specularIntensity,this.specularIntensityMap=J.specularIntensityMap,this.specularColor.copy(J.specularColor),this.specularColorMap=J.specularColorMap,this}}class PW extends vJ{constructor(J){super();this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new e(16777215),this.specular=new e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new A9,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.specular.copy(J.specular),this.shininess=J.shininess,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class AW extends vJ{constructor(J){super();this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.gradientMap=J.gradientMap,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}class TW extends vJ{constructor(J){super();this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(J)}copy(J){return super.copy(J),this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this}}class n7 extends vJ{constructor(J){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new A9,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class H$ extends vJ{constructor(J){super();this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(J)}copy(J){return super.copy(J),this.depthPacking=J.depthPacking,this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this}}class U$ extends vJ{constructor(J){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(J)}copy(J){return super.copy(J),this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this}}class s7 extends vJ{constructor(J){super();this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={MATCAP:""},this.color.copy(J.color),this.matcap=J.matcap,this.map=J.map,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this.fog=J.fog,this}}class SW extends dJ{constructor(J){super();this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(J)}copy(J){return super.copy(J),this.scale=J.scale,this.dashSize=J.dashSize,this.gapSize=J.gapSize,this}}function k6(J,Q){if(!J||J.constructor===Q)return J;if(typeof Q.BYTES_PER_ELEMENT==="number")return new Q(J);return Array.prototype.slice.call(J)}function M5(J){function Q(W,Y){return J[W]-J[Y]}let $=J.length,Z=Array($);for(let W=0;W!==$;++W)Z[W]=W;return Z.sort(Q),Z}function $X(J,Q,$){let Z=J.length,W=new J.constructor(Z);for(let Y=0,X=0;X!==Z;++Y){let K=$[Y]*Q;for(let H=0;H!==Q;++H)W[X++]=J[K+H]}return W}function qK(J,Q,$,Z){let W=1,Y=J[0];while(Y!==void 0&&Y[Z]===void 0)Y=J[W++];if(Y===void 0)return;let X=Y[Z];if(X===void 0)return;if(Array.isArray(X))do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(...X);Y=J[W++]}while(Y!==void 0);else if(X.toArray!==void 0)do{if(X=Y[Z],X!==void 0)Q.push(Y.time),X.toArray($,$.length);Y=J[W++]}while(Y!==void 0);else do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(X);Y=J[W++]}while(Y!==void 0)}function XN(J,Q,$,Z,W=30){let Y=J.clone();Y.name=Q;let X=[];for(let H=0;H<Y.tracks.length;++H){let U=Y.tracks[H],G=U.getValueSize(),F=[],E=[];for(let O=0;O<U.times.length;++O){let R=U.times[O]*W;if(R<$||R>=Z)continue;F.push(U.times[O]);for(let M=0;M<G;++M)E.push(U.values[O*G+M])}if(F.length===0)continue;U.times=k6(F,U.times.constructor),U.values=k6(E,U.values.constructor),X.push(U)}Y.tracks=X;let K=1/0;for(let H=0;H<Y.tracks.length;++H)if(K>Y.tracks[H].times[0])K=Y.tracks[H].times[0];for(let H=0;H<Y.tracks.length;++H)Y.tracks[H].shift(-1*K);return Y.resetDuration(),Y}function KN(J,Q=0,$=J,Z=30){if(Z<=0)Z=30;let W=$.tracks.length,Y=Q/Z;for(let X=0;X<W;++X){let K=$.tracks[X],H=K.ValueTypeName;if(H==="bool"||H==="string")continue;let U=J.tracks.find(function(N){return N.name===K.name&&N.ValueTypeName===H});if(U===void 0)continue;let G=0,F=K.getValueSize();if(K.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)G=F/3;let E=0,O=U.getValueSize();if(U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)E=O/3;let R=K.times.length-1,M;if(Y<=K.times[0]){let N=G,L=F-G;M=K.values.slice(N,L)}else if(Y>=K.times[R]){let N=R*F+G,L=N+F-G;M=K.values.slice(N,L)}else{let N=K.createInterpolant(),L=G,D=F-G;N.evaluate(Y),M=N.resultBuffer.slice(L,D)}if(H==="quaternion")new zJ().fromArray(M).normalize().conjugate().toArray(M);let q=U.times.length;for(let N=0;N<q;++N){let L=N*O+E;if(H==="quaternion")zJ.multiplyQuaternionsFlat(U.values,L,M,0,U.values,L);else{let D=O-E*2;for(let V=0;V<D;++V)U.values[L+V]-=M[V]}}}return J.blendMode=2501,J}class RK{static convertArray(J,Q){return k6(J,Q)}static isTypedArray(J){return Y5(J)}static getKeyframeOrder(J){return M5(J)}static sortedArray(J,Q,$){return $X(J,Q,$)}static flattenJSON(J,Q,$,Z){qK(J,Q,$,Z)}static subclip(J,Q,$,Z,W=30){return XN(J,Q,$,Z,W)}static makeClipAdditive(J,Q=0,$=J,Z=30){return KN(J,Q,$,Z)}}class E8{constructor(J,Q,$,Z){this.parameterPositions=J,this._cachedIndex=0,this.resultBuffer=Z!==void 0?Z:new Q.constructor($),this.sampleValues=Q,this.valueSize=$,this.settings=null,this.DefaultSettings_={}}evaluate(J){let Q=this.parameterPositions,$=this._cachedIndex,Z=Q[$],W=Q[$-1];J:{Q:{let Y;$:{Z:if(!(J<Z)){for(let X=$+2;;){if(Z===void 0){if(J<W)break Z;return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}if($===X)break;if(W=Z,Z=Q[++$],J<Z)break Q}Y=Q.length;break $}if(!(J>=W)){let X=Q[1];if(J<X)$=2,W=X;for(let K=$-2;;){if(W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if($===K)break;if(Z=W,W=Q[--$-1],J>=W)break Q}Y=$,$=0;break $}break J}while($<Y){let X=$+Y>>>1;if(J<Q[X])Y=X;else $=X+1}if(Z=Q[$],W=Q[$-1],W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Z===void 0)return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}this._cachedIndex=$,this.intervalChanged_($,W,Z)}return this.interpolate_($,W,J,Z)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z;for(let Y=0;Y!==Z;++Y)Q[Y]=$[W+Y];return Q}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class jW extends E8{constructor(J,Q,$,Z){super(J,Q,$,Z);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(J,Q,$){let Z=this.parameterPositions,W=J-2,Y=J+1,X=Z[W],K=Z[Y];if(X===void 0)switch(this.getSettings_().endingStart){case 2401:W=J,X=2*Q-$;break;case 2402:W=Z.length-2,X=Q+Z[W]-Z[W+1];break;default:W=J,X=$}if(K===void 0)switch(this.getSettings_().endingEnd){case 2401:Y=J,K=2*$-Q;break;case 2402:Y=1,K=$+Z[1]-Z[0];break;default:Y=J-1,K=Q}let H=($-Q)*0.5,U=this.valueSize;this._weightPrev=H/(Q-X),this._weightNext=H/(K-$),this._offsetPrev=W*U,this._offsetNext=Y*U}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this._offsetPrev,G=this._offsetNext,F=this._weightPrev,E=this._weightNext,O=($-Q)/(Z-Q),R=O*O,M=R*O,q=-F*M+2*F*R-F*O,N=(1+F)*M+(-1.5-2*F)*R+(-0.5+F)*O+1,L=(-1-E)*M+(1.5+E)*R+0.5*O,D=E*M-E*R;for(let V=0;V!==X;++V)W[V]=q*Y[U+V]+N*Y[H+V]+L*Y[K+V]+D*Y[G+V];return W}}class G$ extends E8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=($-Q)/(Z-Q),G=1-U;for(let F=0;F!==X;++F)W[F]=Y[H+F]*G+Y[K+F]*U;return W}}class vW extends E8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}}class yW extends E8{interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this.settings||this.DefaultSettings_,G=U.inTangents,F=U.outTangents;if(!G||!F){let R=($-Q)/(Z-Q),M=1-R;for(let q=0;q!==X;++q)W[q]=Y[H+q]*M+Y[K+q]*R;return W}let E=X*2,O=J-1;for(let R=0;R!==X;++R){let M=Y[H+R],q=Y[K+R],N=O*E+R*2,L=F[N],D=F[N+1],V=J*E+R*2,z=G[V],I=G[V+1],B=($-Q)/(Z-Q),k,C,j,w,v;for(let b=0;b<8;b++){k=B*B,C=k*B,j=1-B,w=j*j,v=w*j;let h=v*Q+3*w*B*L+3*j*k*z+C*Z-$;if(Math.abs(h)<0.0000000001)break;let x=3*w*(L-Q)+6*j*B*(z-L)+3*k*(Z-z);if(Math.abs(x)<0.0000000001)break;B=B-h/x,B=Math.max(0,Math.min(1,B))}W[R]=v*M+3*w*B*D+3*j*k*I+C*q}return W}}class q9{constructor(J,Q,$,Z){if(J===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(Q===void 0||Q.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+J);this.name=J,this.times=k6(Q,this.TimeBufferType),this.values=k6($,this.ValueBufferType),this.setInterpolation(Z||this.DefaultInterpolation)}static toJSON(J){let Q=J.constructor,$;if(Q.toJSON!==this.toJSON)$=Q.toJSON(J);else{$={name:J.name,times:k6(J.times,Array),values:k6(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new vW(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new G$(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new jW(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new yW(this.times,this.values,this.getValueSize(),J);if(this.settings)Q.settings=this.settings;return Q}setInterpolation(J){let Q;switch(J){case 2300:Q=this.InterpolantFactoryMethodDiscrete;break;case 2301:Q=this.InterpolantFactoryMethodLinear;break;case 2302:Q=this.InterpolantFactoryMethodSmooth;break;case 2303:Q=this.InterpolantFactoryMethodBezier;break}if(Q===void 0){let $="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(J!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error($);return O0("KeyframeTrack:",$),this}return this.createInterpolant=Q,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(J){if(J!==0){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]+=J}return this}scale(J){if(J!==1){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]*=J}return this}trim(J,Q){let $=this.times,Z=$.length,W=0,Y=Z-1;while(W!==Z&&$[W]<J)++W;while(Y!==-1&&$[Y]>Q)--Y;if(++Y,W!==0||Y!==Z){if(W>=Y)Y=Math.max(Y,1),W=Y-1;let X=this.getValueSize();this.times=$.slice(W,Y),this.values=this.values.slice(W*X,Y*X)}return this}validate(){let J=!0,Q=this.getValueSize();if(Q-Math.floor(Q)!==0)v0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)v0("KeyframeTrack: Track is empty.",this),J=!1;let Y=null;for(let X=0;X!==W;X++){let K=$[X];if(typeof K==="number"&&isNaN(K)){v0("KeyframeTrack: Time is not a valid number.",this,X,K),J=!1;break}if(Y!==null&&Y>K){v0("KeyframeTrack: Out of order keys.",this,X,K,Y),J=!1;break}Y=K}if(Z!==void 0){if(Y5(Z))for(let X=0,K=Z.length;X!==K;++X){let H=Z[X];if(isNaN(H)){v0("KeyframeTrack: Value is not a valid number.",this,X,H),J=!1;break}}}return J}optimize(){let J=this.times.slice(),Q=this.values.slice(),$=this.getValueSize(),Z=this.getInterpolation()===2302,W=J.length-1,Y=1;for(let X=1;X<W;++X){let K=!1,H=J[X],U=J[X+1];if(H!==U&&(X!==1||H!==J[0]))if(!Z){let G=X*$,F=G-$,E=G+$;for(let O=0;O!==$;++O){let R=Q[G+O];if(R!==Q[F+O]||R!==Q[E+O]){K=!0;break}}}else K=!0;if(K){if(X!==Y){J[Y]=J[X];let G=X*$,F=Y*$;for(let E=0;E!==$;++E)Q[F+E]=Q[G+E]}++Y}}if(W>0){J[Y]=J[W];for(let X=W*$,K=Y*$,H=0;H!==$;++H)Q[K+H]=Q[X+H];++Y}if(Y!==J.length)this.times=J.slice(0,Y),this.values=Q.slice(0,Y*$);else this.times=J,this.values=Q;return this}clone(){let J=this.times.slice(),Q=this.values.slice(),Z=new this.constructor(this.name,J,Q);return Z.createInterpolant=this.createInterpolant,Z}}q9.prototype.ValueTypeName="";q9.prototype.TimeBufferType=Float32Array;q9.prototype.ValueBufferType=Float32Array;q9.prototype.DefaultInterpolation=2301;class S8 extends q9{constructor(J,Q,$){super(J,Q,$)}}S8.prototype.ValueTypeName="bool";S8.prototype.ValueBufferType=Array;S8.prototype.DefaultInterpolation=2300;S8.prototype.InterpolantFactoryMethodLinear=void 0;S8.prototype.InterpolantFactoryMethodSmooth=void 0;class E$ extends q9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}E$.prototype.ValueTypeName="color";class K8 extends q9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}K8.prototype.ValueTypeName="number";class xW extends E8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=($-Q)/(Z-Q),H=J*X;for(let U=H+X;H!==U;H+=4)zJ.slerpFlat(W,0,Y,H-X,Y,H,K);return W}}class F8 extends q9{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new xW(this.times,this.values,this.getValueSize(),J)}}F8.prototype.ValueTypeName="quaternion";F8.prototype.InterpolantFactoryMethodSmooth=void 0;class j8 extends q9{constructor(J,Q,$){super(J,Q,$)}}j8.prototype.ValueTypeName="string";j8.prototype.ValueBufferType=Array;j8.prototype.DefaultInterpolation=2300;j8.prototype.InterpolantFactoryMethodLinear=void 0;j8.prototype.InterpolantFactoryMethodSmooth=void 0;class H8 extends q9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}H8.prototype.ValueTypeName="vector";class I8{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=M9(),this.userData={},this.duration<0)this.resetDuration()}static parse(J){let Q=[],$=J.tracks,Z=1/(J.fps||1);for(let Y=0,X=$.length;Y!==X;++Y)Q.push(UN($[Y]).scale(Z));let W=new this(J.name,J.duration,Q,J.blendMode);return W.uuid=J.uuid,W.userData=JSON.parse(J.userData||"{}"),W}static toJSON(J){let Q=[],$=J.tracks,Z={name:J.name,duration:J.duration,tracks:Q,uuid:J.uuid,blendMode:J.blendMode,userData:JSON.stringify(J.userData)};for(let W=0,Y=$.length;W!==Y;++W)Q.push(q9.toJSON($[W]));return Z}static CreateFromMorphTargetSequence(J,Q,$,Z){let W=Q.length,Y=[];for(let X=0;X<W;X++){let K=[],H=[];K.push((X+W-1)%W,X,(X+1)%W),H.push(0,1,0);let U=M5(K);if(K=$X(K,1,U),H=$X(H,1,U),!Z&&K[0]===0)K.push(W),H.push(H[0]);Y.push(new K8(".morphTargetInfluences["+Q[X].name+"]",K,H).scale(1/$))}return new this(J,-1,Y)}static findByName(J,Q){let $=J;if(!Array.isArray(J)){let Z=J;$=Z.geometry&&Z.geometry.animations||Z.animations}for(let Z=0;Z<$.length;Z++)if($[Z].name===Q)return $[Z];return null}static CreateClipsFromMorphTargetSequences(J,Q,$){let Z={},W=/^([\w-]*?)([\d]+)$/;for(let X=0,K=J.length;X<K;X++){let H=J[X],U=H.name.match(W);if(U&&U.length>1){let G=U[1],F=Z[G];if(!F)Z[G]=F=[];F.push(H)}}let Y=[];for(let X in Z)Y.push(this.CreateFromMorphTargetSequence(X,Z[X],Q,$));return Y}static parseAnimation(J,Q){if(O0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return v0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,F,E,O,R){if(E.length!==0){let M=[],q=[];if(qK(E,M,q,O),M.length!==0)R.push(new G(F,M,q))}},Z=[],W=J.name||"default",Y=J.fps||30,X=J.blendMode,K=J.length||-1,H=J.hierarchy||[];for(let G=0;G<H.length;G++){let F=H[G].keys;if(!F||F.length===0)continue;if(F[0].morphTargets){let E={},O;for(O=0;O<F.length;O++)if(F[O].morphTargets)for(let R=0;R<F[O].morphTargets.length;R++)E[F[O].morphTargets[R]]=-1;for(let R in E){let M=[],q=[];for(let N=0;N!==F[O].morphTargets.length;++N){let L=F[O];M.push(L.time),q.push(L.morphTarget===R?1:0)}Z.push(new K8(".morphTargetInfluence["+R+"]",M,q))}K=E.length*Y}else{let E=".bones["+Q[G].name+"]";$(H8,E+".position",F,"pos",Z),$(F8,E+".quaternion",F,"rot",Z),$(H8,E+".scale",F,"scl",Z)}}if(Z.length===0)return null;return new this(W,K,Z,X)}resetDuration(){let J=this.tracks,Q=0;for(let $=0,Z=J.length;$!==Z;++$){let W=this.tracks[$];Q=Math.max(Q,W.times[W.times.length-1])}return this.duration=Q,this}trim(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].trim(0,this.duration);return this}validate(){let J=!0;for(let Q=0;Q<this.tracks.length;Q++)J=J&&this.tracks[Q].validate();return J}optimize(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].optimize();return this}clone(){let J=[];for(let $=0;$<this.tracks.length;$++)J.push(this.tracks[$].clone());let Q=new this.constructor(this.name,this.duration,J,this.blendMode);return Q.userData=JSON.parse(JSON.stringify(this.userData)),Q}toJSON(){return this.constructor.toJSON(this)}}function HN(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return K8;case"vector":case"vector2":case"vector3":case"vector4":return H8;case"color":return E$;case"quaternion":return F8;case"bool":case"boolean":return S8;case"string":return j8}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function UN(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=HN(J.type);if(J.times===void 0){let $=[],Z=[];qK(J.keys,$,Z,"value"),J.times=$,J.values=Z}if(Q.parse!==void 0)return Q.parse(J);else return new Q(J.name,J.times,J.values,J.interpolation)}var m9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(vU(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(vU(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};function vU(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class F${constructor(J,Q,$){let Z=this,W=!1,Y=0,X=0,K=void 0,H=[];this.onStart=void 0,this.onLoad=J,this.onProgress=Q,this.onError=$,this._abortController=null,this.itemStart=function(U){if(X++,W===!1){if(Z.onStart!==void 0)Z.onStart(U,Y,X)}W=!0},this.itemEnd=function(U){if(Y++,Z.onProgress!==void 0)Z.onProgress(U,Y,X);if(Y===X){if(W=!1,Z.onLoad!==void 0)Z.onLoad()}},this.itemError=function(U){if(Z.onError!==void 0)Z.onError(U)},this.resolveURL=function(U){if(K)return K(U);return U},this.setURLModifier=function(U){return K=U,this},this.addHandler=function(U,G){return H.push(U,G),this},this.removeHandler=function(U){let G=H.indexOf(U);if(G!==-1)H.splice(G,2);return this},this.getHandler=function(U){for(let G=0,F=H.length;G<F;G+=2){let E=H[G],O=H[G+1];if(E.global)E.lastIndex=0;if(E.test(U))return O}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var LK=new F$;class sJ{constructor(J){if(this.manager=J!==void 0?J:LK,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(J,Q){let $=this;return new Promise(function(Z,W){$.load(J,Z,Q,W)})}parse(){}setCrossOrigin(J){return this.crossOrigin=J,this}setWithCredentials(J){return this.withCredentials=J,this}setPath(J){return this.path=J,this}setResourcePath(J){return this.resourcePath=J,this}setRequestHeader(J){return this.requestHeader=J,this}abort(){return this}}sJ.DEFAULT_MATERIAL_NAME="__DEFAULT";var V8={};class k5 extends Error{constructor(J,Q){super(J);this.response=Q}}class E9 extends sJ{constructor(J){super(J);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=m9.get(`file:${J}`);if(W!==void 0){this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0);return}if(V8[J]!==void 0){V8[J].push({onLoad:Q,onProgress:$,onError:Z});return}V8[J]=[],V8[J].push({onLoad:Q,onProgress:$,onError:Z});let Y=new Request(J,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),X=this.mimeType,K=this.responseType;fetch(Y).then((H)=>{if(H.status===200||H.status===0){if(H.status===0)O0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||H.body===void 0||H.body.getReader===void 0)return H;let U=V8[J],G=H.body.getReader(),F=H.headers.get("X-File-Size")||H.headers.get("Content-Length"),E=F?parseInt(F):0,O=E!==0,R=0,M=new ReadableStream({start(q){N();function N(){G.read().then(({done:L,value:D})=>{if(L)q.close();else{R+=D.byteLength;let V=new ProgressEvent("progress",{lengthComputable:O,loaded:R,total:E});for(let z=0,I=U.length;z<I;z++){let B=U[z];if(B.onProgress)B.onProgress(V)}q.enqueue(D),N()}},(L)=>{q.error(L)})}}});return new Response(M)}else throw new k5(`fetch for "${H.url}" responded with ${H.status}: ${H.statusText}`,H)}).then((H)=>{switch(K){case"arraybuffer":return H.arrayBuffer();case"blob":return H.blob();case"document":return H.text().then((U)=>{return new DOMParser().parseFromString(U,X)});case"json":return H.json();default:if(X==="")return H.text();else{let G=/charset="?([^;"\s]*)"?/i.exec(X),F=G&&G[1]?G[1].toLowerCase():void 0,E=new TextDecoder(F);return H.arrayBuffer().then((O)=>E.decode(O))}}}).then((H)=>{m9.add(`file:${J}`,H);let U=V8[J];delete V8[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onLoad)E.onLoad(H)}}).catch((H)=>{let U=V8[J];if(U===void 0)throw this.manager.itemError(J),H;delete V8[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onError)E.onError(H)}this.manager.itemError(J)}).finally(()=>{this.manager.itemEnd(J)}),this.manager.itemStart(J)}setResponseType(J){return this.responseType=J,this}setMimeType(J){return this.mimeType=J,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class DK extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new E9(this.manager);Y.setPath(this.path),Y.setRequestHeader(this.requestHeader),Y.setWithCredentials(this.withCredentials),Y.load(J,function(X){try{Q(W.parse(JSON.parse(X)))}catch(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}},$,Z)}parse(J){let Q=[];for(let $=0;$<J.length;$++){let Z=I8.parse(J[$]);Q.push(Z)}return Q}}class MK extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=[],X=new u7,K=new E9(this.manager);K.setPath(this.path),K.setResponseType("arraybuffer"),K.setRequestHeader(this.requestHeader),K.setWithCredentials(W.withCredentials);let H=0;function U(G){K.load(J[G],function(F){let E=W.parse(F,!0);if(Y[G]={width:E.width,height:E.height,format:E.format,mipmaps:E.mipmaps},H+=1,H===6){if(E.mipmapCount===1)X.minFilter=1006;if(X.image=Y,X.format=E.format,X.needsUpdate=!0,Q)Q(X)}},$,Z)}if(Array.isArray(J))for(let G=0,F=J.length;G<F;++G)U(G);else K.load(J,function(G){let F=W.parse(G,!0);if(F.isCubemap){let E=F.mipmaps.length/F.mipmapCount;for(let O=0;O<E;O++){Y[O]={mipmaps:[]};for(let R=0;R<F.mipmapCount;R++)Y[O].mipmaps.push(F.mipmaps[O*F.mipmapCount+R]),Y[O].format=F.format,Y[O].width=F.width,Y[O].height=F.height}X.image=Y}else X.image.width=F.width,X.image.height=F.height,X.mipmaps=F.mipmaps;if(F.mipmapCount===1)X.minFilter=1006;if(X.format=F.format,X.needsUpdate=!0,Q)Q(X)},$,Z);return X}}var O7=new WeakMap;class z6 extends sJ{constructor(J){super(J)}load(J,Q,$,Z){if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=m9.get(`image:${J}`);if(Y!==void 0){if(Y.complete===!0)W.manager.itemStart(J),setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);else{let G=O7.get(Y);if(G===void 0)G=[],O7.set(Y,G);G.push({onLoad:Q,onError:Z})}return Y}let X=V7("img");function K(){if(U(),Q)Q(this);let G=O7.get(this)||[];for(let F=0;F<G.length;F++){let E=G[F];if(E.onLoad)E.onLoad(this)}O7.delete(this),W.manager.itemEnd(J)}function H(G){if(U(),Z)Z(G);m9.remove(`image:${J}`);let F=O7.get(this)||[];for(let E=0;E<F.length;E++){let O=F[E];if(O.onError)O.onError(G)}O7.delete(this),W.manager.itemError(J),W.manager.itemEnd(J)}function U(){X.removeEventListener("load",K,!1),X.removeEventListener("error",H,!1)}if(X.addEventListener("load",K,!1),X.addEventListener("error",H,!1),J.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)X.crossOrigin=this.crossOrigin}return m9.add(`image:${J}`,X),W.manager.itemStart(J),X.src=J,X}}class kK extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new h6;W.colorSpace="srgb";let Y=new z6(this.manager);Y.setCrossOrigin(this.crossOrigin),Y.setPath(this.path);let X=0;function K(H){Y.load(J[H],function(U){if(W.images[H]=U,X++,X===6){if(W.needsUpdate=!0,Q)Q(W)}},void 0,Z)}for(let H=0;H<J.length;++H)K(H);return W}}class N$ extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new k9,X=new E9(this.manager);return X.setResponseType("arraybuffer"),X.setRequestHeader(this.requestHeader),X.setPath(this.path),X.setWithCredentials(W.withCredentials),X.load(J,function(K){let H;try{H=W.parse(K)}catch(U){if(Z!==void 0)Z(U);else v0(U);return}if(H.image!==void 0)Y.image=H.image;else if(H.data!==void 0)Y.image.width=H.width,Y.image.height=H.height,Y.image.data=H.data;if(Y.wrapS=H.wrapS!==void 0?H.wrapS:1001,Y.wrapT=H.wrapT!==void 0?H.wrapT:1001,Y.magFilter=H.magFilter!==void 0?H.magFilter:1006,Y.minFilter=H.minFilter!==void 0?H.minFilter:1006,Y.anisotropy=H.anisotropy!==void 0?H.anisotropy:1,H.colorSpace!==void 0)Y.colorSpace=H.colorSpace;if(H.flipY!==void 0)Y.flipY=H.flipY;if(H.format!==void 0)Y.format=H.format;if(H.type!==void 0)Y.type=H.type;if(H.mipmaps!==void 0)Y.mipmaps=H.mipmaps,Y.minFilter=1008;if(H.mipmapCount===1)Y.minFilter=1006;if(H.generateMipmaps!==void 0)Y.generateMipmaps=H.generateMipmaps;if(Y.needsUpdate=!0,Q)Q(Y,H)},$,Z),Y}}class d6 extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new kJ,Y=new z6(this.manager);return Y.setCrossOrigin(this.crossOrigin),Y.setPath(this.path),Y.load(J,function(X){if(W.image=X,W.needsUpdate=!0,Q!==void 0)Q(W)},$,Z),W}}class v9 extends HJ{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new e(J),this.intensity=Q}dispose(){this.dispatchEvent({type:"dispose"})}copy(J,Q){return super.copy(J,Q),this.color.copy(J.color),this.intensity=J.intensity,this}toJSON(J){let Q=super.toJSON(J);return Q.object.color=this.color.getHex(),Q.object.intensity=this.intensity,Q}}class W6 extends v9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.groundColor=new e(Q)}copy(J,Q){return super.copy(J,Q),this.groundColor.copy(J.groundColor),this}toJSON(J){let Q=super.toJSON(J);return Q.object.groundColor=this.groundColor.getHex(),Q}}var nY=new y0,yU=new A,xU=new A;class bW{constructor(J){this.camera=J,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new i(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new y0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new G8,this._frameExtents=new i(1,1),this._viewportCount=1,this._viewports=[new FJ(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(yU.setFromMatrixPosition(J.matrixWorld),Q.position.copy(yU),xU.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(xU),Q.updateMatrixWorld(),nY.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(nY,Q.coordinateSystem,Q.reversedDepth),Q.coordinateSystem===2001||Q.reversedDepth)$.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else $.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);$.multiply(nY)}getViewport(J){return this._viewports[J]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(J){return this.camera=J.camera.clone(),this.intensity=J.intensity,this.bias=J.bias,this.radius=J.radius,this.autoUpdate=J.autoUpdate,this.needsUpdate=J.needsUpdate,this.normalBias=J.normalBias,this.blurSamples=J.blurSamples,this.mapSize.copy(J.mapSize),this.biasNode=J.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let J={};if(this.intensity!==1)J.intensity=this.intensity;if(this.bias!==0)J.bias=this.bias;if(this.normalBias!==0)J.normalBias=this.normalBias;if(this.radius!==1)J.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)J.mapSize=this.mapSize.toArray();return J.camera=this.camera.toJSON(!1).object,delete J.camera.matrix,J}}var EZ=new A,FZ=new zJ,Y8=new A;class i7 extends HJ{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new y0,this.projectionMatrix=new y0,this.projectionMatrixInverse=new y0,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(J,Q){return super.copy(J,Q),this.matrixWorldInverse.copy(J.matrixWorldInverse),this.projectionMatrix.copy(J.projectionMatrix),this.projectionMatrixInverse.copy(J.projectionMatrixInverse),this.coordinateSystem=J.coordinateSystem,this}getWorldDirection(J){return super.getWorldDirection(J).negate()}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.matrixWorld.decompose(EZ,FZ,Y8),Y8.x===1&&Y8.y===1&&Y8.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(EZ,FZ,Y8.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(EZ,FZ,Y8),Y8.x===1&&Y8.y===1&&Y8.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(EZ,FZ,Y8.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var u8=new A,bU=new i,hU=new i;class BJ extends i7{constructor(J=50,Q=1,$=0.1,Z=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=J,this.zoom=1,this.near=$,this.far=Z,this.focus=10,this.aspect=Q,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.fov=J.fov,this.zoom=J.zoom,this.near=J.near,this.far=J.far,this.focus=J.focus,this.aspect=J.aspect,this.view=J.view===null?null:Object.assign({},J.view),this.filmGauge=J.filmGauge,this.filmOffset=J.filmOffset,this}setFocalLength(J){let Q=0.5*this.getFilmHeight()/J;this.fov=B6*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(V6*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return B6*2*Math.atan(Math.tan(V6*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(J,Q,$){u8.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(u8.x,u8.y).multiplyScalar(-J/u8.z),u8.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(u8.x,u8.y).multiplyScalar(-J/u8.z)}getViewSize(J,Q){return this.getViewBounds(J,bU,hU),Q.subVectors(hU,bU)}setViewOffset(J,Q,$,Z,W,Y){if(this.aspect=J/Q,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=this.near,Q=J*Math.tan(V6*0.5*this.fov)/this.zoom,$=2*Q,Z=this.aspect*$,W=-0.5*Z,Y=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:K,fullHeight:H}=Y;W+=Y.offsetX*Z/K,Q-=Y.offsetY*$/H,Z*=Y.width/K,$*=Y.height/H}let X=this.filmOffset;if(X!==0)W+=J*X/this.getFilmWidth();this.projectionMatrix.makePerspective(W,W+Z,Q,Q-$,J,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.fov=this.fov,Q.object.zoom=this.zoom,Q.object.near=this.near,Q.object.far=this.far,Q.object.focus=this.focus,Q.object.aspect=this.aspect,this.view!==null)Q.object.view=Object.assign({},this.view);return Q.object.filmGauge=this.filmGauge,Q.object.filmOffset=this.filmOffset,Q}}class V5 extends bW{constructor(){super(new BJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=B6*2*J.angle*this.focus,Z=this.mapSize.width/this.mapSize.height*this.aspect,W=J.distance||Q.far;if($!==Q.fov||Z!==Q.aspect||W!==Q.far)Q.fov=$,Q.aspect=Z,Q.far=W,Q.updateProjectionMatrix();super.updateMatrices(J)}copy(J){return super.copy(J),this.focus=J.focus,this}}class o7 extends v9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,Y=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.target=new HJ,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=Y,this.map=null,this.shadow=new V5}get power(){return this.intensity*Math.PI}set power(J){this.intensity=J/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.angle=J.angle,this.penumbra=J.penumbra,this.decay=J.decay,this.target=J.target.clone(),this.map=J.map,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);if(Q.object.distance=this.distance,Q.object.angle=this.angle,Q.object.decay=this.decay,Q.object.penumbra=this.penumbra,Q.object.target=this.target.uuid,this.map&&this.map.isTexture)Q.object.map=this.map.toJSON(J).uuid;return Q.object.shadow=this.shadow.toJSON(),Q}}class B5 extends bW{constructor(){super(new BJ(90,1,0.5,500));this.isPointLightShadow=!0}}class N8 extends v9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new B5}get power(){return this.intensity*4*Math.PI}set power(J){this.intensity=J/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.decay=J.decay,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.distance=this.distance,Q.object.decay=this.decay,Q.object.shadow=this.shadow.toJSON(),Q}}class t9 extends i7{constructor(J=-1,Q=1,$=1,Z=-1,W=0.1,Y=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=J,this.right=Q,this.top=$,this.bottom=Z,this.near=W,this.far=Y,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.left=J.left,this.right=J.right,this.top=J.top,this.bottom=J.bottom,this.near=J.near,this.far=J.far,this.zoom=J.zoom,this.view=J.view===null?null:Object.assign({},J.view),this}setViewOffset(J,Q,$,Z,W,Y){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=(this.right-this.left)/(2*this.zoom),Q=(this.top-this.bottom)/(2*this.zoom),$=(this.right+this.left)/2,Z=(this.top+this.bottom)/2,W=$-J,Y=$+J,X=Z+Q,K=Z-Q;if(this.view!==null&&this.view.enabled){let H=(this.right-this.left)/this.view.fullWidth/this.zoom,U=(this.top-this.bottom)/this.view.fullHeight/this.zoom;W+=H*this.view.offsetX,Y=W+H*this.view.width,X-=U*this.view.offsetY,K=X-U*this.view.height}this.projectionMatrix.makeOrthographic(W,Y,X,K,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.zoom=this.zoom,Q.object.left=this.left,Q.object.right=this.right,Q.object.top=this.top,Q.object.bottom=this.bottom,Q.object.near=this.near,Q.object.far=this.far,this.view!==null)Q.object.view=Object.assign({},this.view);return Q}}class C5 extends bW{constructor(){super(new t9(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class y9 extends v9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.target=new HJ,this.shadow=new C5}dispose(){super.dispose(),this.shadow.dispose()}copy(J){return super.copy(J),this.target=J.target.clone(),this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.shadow=this.shadow.toJSON(),Q.object.target=this.target.uuid,Q}}class m6 extends v9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}}class hW extends v9{constructor(J,Q,$=10,Z=10){super(J,Q);this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=$,this.height=Z}get power(){return this.intensity*this.width*this.height*Math.PI}set power(J){this.intensity=J/(this.width*this.height*Math.PI)}copy(J){return super.copy(J),this.width=J.width,this.height=J.height,this}toJSON(J){let Q=super.toJSON(J);return Q.object.width=this.width,Q.object.height=this.height,Q}}class O${constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let J=0;J<9;J++)this.coefficients.push(new A)}set(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].copy(J[Q]);return this}zero(){for(let J=0;J<9;J++)this.coefficients[J].set(0,0,0);return this}getAt(J,Q){let{x:$,y:Z,z:W}=J,Y=this.coefficients;return Q.copy(Y[0]).multiplyScalar(0.282095),Q.addScaledVector(Y[1],0.488603*Z),Q.addScaledVector(Y[2],0.488603*W),Q.addScaledVector(Y[3],0.488603*$),Q.addScaledVector(Y[4],1.092548*($*Z)),Q.addScaledVector(Y[5],1.092548*(Z*W)),Q.addScaledVector(Y[6],0.315392*(3*W*W-1)),Q.addScaledVector(Y[7],1.092548*($*W)),Q.addScaledVector(Y[8],0.546274*($*$-Z*Z)),Q}getIrradianceAt(J,Q){let{x:$,y:Z,z:W}=J,Y=this.coefficients;return Q.copy(Y[0]).multiplyScalar(0.886227),Q.addScaledVector(Y[1],1.023328*Z),Q.addScaledVector(Y[2],1.023328*W),Q.addScaledVector(Y[3],1.023328*$),Q.addScaledVector(Y[4],0.858086*$*Z),Q.addScaledVector(Y[5],0.858086*Z*W),Q.addScaledVector(Y[6],0.743125*W*W-0.247708),Q.addScaledVector(Y[7],0.858086*$*W),Q.addScaledVector(Y[8],0.429043*($*$-Z*Z)),Q}add(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].add(J.coefficients[Q]);return this}addScaledSH(J,Q){for(let $=0;$<9;$++)this.coefficients[$].addScaledVector(J.coefficients[$],Q);return this}scale(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].multiplyScalar(J);return this}lerp(J,Q){for(let $=0;$<9;$++)this.coefficients[$].lerp(J.coefficients[$],Q);return this}equals(J){for(let Q=0;Q<9;Q++)if(!this.coefficients[Q].equals(J.coefficients[Q]))return!1;return!0}copy(J){return this.set(J.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(J,Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].fromArray(J,Q+Z*3);return this}toArray(J=[],Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].toArray(J,Q+Z*3);return J}static getBasisAt(J,Q){let{x:$,y:Z,z:W}=J;Q[0]=0.282095,Q[1]=0.488603*Z,Q[2]=0.488603*W,Q[3]=0.488603*$,Q[4]=1.092548*$*Z,Q[5]=1.092548*Z*W,Q[6]=0.315392*(3*W*W-1),Q[7]=1.092548*$*W,Q[8]=0.546274*($*$-Z*Z)}}class fW extends v9{constructor(J=new O$,Q=1){super(void 0,Q);this.isLightProbe=!0,this.sh=J}copy(J){return super.copy(J),this.sh.copy(J.sh),this}toJSON(J){let Q=super.toJSON(J);return Q.object.sh=this.sh.toArray(),Q}}class q$ extends sJ{constructor(J){super(J);this.textures={}}load(J,Q,$,Z){let W=this,Y=new E9(W.manager);Y.setPath(W.path),Y.setRequestHeader(W.requestHeader),Y.setWithCredentials(W.withCredentials),Y.load(J,function(X){try{Q(W.parse(JSON.parse(X)))}catch(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}},$,Z)}parse(J){let Q=this.textures;function $(W){if(Q[W]===void 0)O0("MaterialLoader: Undefined texture",W);return Q[W]}let Z=this.createMaterialFromType(J.type);if(J.uuid!==void 0)Z.uuid=J.uuid;if(J.name!==void 0)Z.name=J.name;if(J.color!==void 0&&Z.color!==void 0)Z.color.setHex(J.color);if(J.roughness!==void 0)Z.roughness=J.roughness;if(J.metalness!==void 0)Z.metalness=J.metalness;if(J.sheen!==void 0)Z.sheen=J.sheen;if(J.sheenColor!==void 0)Z.sheenColor=new e().setHex(J.sheenColor);if(J.sheenRoughness!==void 0)Z.sheenRoughness=J.sheenRoughness;if(J.emissive!==void 0&&Z.emissive!==void 0)Z.emissive.setHex(J.emissive);if(J.specular!==void 0&&Z.specular!==void 0)Z.specular.setHex(J.specular);if(J.specularIntensity!==void 0)Z.specularIntensity=J.specularIntensity;if(J.specularColor!==void 0&&Z.specularColor!==void 0)Z.specularColor.setHex(J.specularColor);if(J.shininess!==void 0)Z.shininess=J.shininess;if(J.clearcoat!==void 0)Z.clearcoat=J.clearcoat;if(J.clearcoatRoughness!==void 0)Z.clearcoatRoughness=J.clearcoatRoughness;if(J.dispersion!==void 0)Z.dispersion=J.dispersion;if(J.iridescence!==void 0)Z.iridescence=J.iridescence;if(J.iridescenceIOR!==void 0)Z.iridescenceIOR=J.iridescenceIOR;if(J.iridescenceThicknessRange!==void 0)Z.iridescenceThicknessRange=J.iridescenceThicknessRange;if(J.transmission!==void 0)Z.transmission=J.transmission;if(J.thickness!==void 0)Z.thickness=J.thickness;if(J.attenuationDistance!==void 0)Z.attenuationDistance=J.attenuationDistance;if(J.attenuationColor!==void 0&&Z.attenuationColor!==void 0)Z.attenuationColor.setHex(J.attenuationColor);if(J.anisotropy!==void 0)Z.anisotropy=J.anisotropy;if(J.anisotropyRotation!==void 0)Z.anisotropyRotation=J.anisotropyRotation;if(J.fog!==void 0)Z.fog=J.fog;if(J.flatShading!==void 0)Z.flatShading=J.flatShading;if(J.blending!==void 0)Z.blending=J.blending;if(J.combine!==void 0)Z.combine=J.combine;if(J.side!==void 0)Z.side=J.side;if(J.shadowSide!==void 0)Z.shadowSide=J.shadowSide;if(J.opacity!==void 0)Z.opacity=J.opacity;if(J.transparent!==void 0)Z.transparent=J.transparent;if(J.alphaTest!==void 0)Z.alphaTest=J.alphaTest;if(J.alphaHash!==void 0)Z.alphaHash=J.alphaHash;if(J.depthFunc!==void 0)Z.depthFunc=J.depthFunc;if(J.depthTest!==void 0)Z.depthTest=J.depthTest;if(J.depthWrite!==void 0)Z.depthWrite=J.depthWrite;if(J.colorWrite!==void 0)Z.colorWrite=J.colorWrite;if(J.blendSrc!==void 0)Z.blendSrc=J.blendSrc;if(J.blendDst!==void 0)Z.blendDst=J.blendDst;if(J.blendEquation!==void 0)Z.blendEquation=J.blendEquation;if(J.blendSrcAlpha!==void 0)Z.blendSrcAlpha=J.blendSrcAlpha;if(J.blendDstAlpha!==void 0)Z.blendDstAlpha=J.blendDstAlpha;if(J.blendEquationAlpha!==void 0)Z.blendEquationAlpha=J.blendEquationAlpha;if(J.blendColor!==void 0&&Z.blendColor!==void 0)Z.blendColor.setHex(J.blendColor);if(J.blendAlpha!==void 0)Z.blendAlpha=J.blendAlpha;if(J.stencilWriteMask!==void 0)Z.stencilWriteMask=J.stencilWriteMask;if(J.stencilFunc!==void 0)Z.stencilFunc=J.stencilFunc;if(J.stencilRef!==void 0)Z.stencilRef=J.stencilRef;if(J.stencilFuncMask!==void 0)Z.stencilFuncMask=J.stencilFuncMask;if(J.stencilFail!==void 0)Z.stencilFail=J.stencilFail;if(J.stencilZFail!==void 0)Z.stencilZFail=J.stencilZFail;if(J.stencilZPass!==void 0)Z.stencilZPass=J.stencilZPass;if(J.stencilWrite!==void 0)Z.stencilWrite=J.stencilWrite;if(J.wireframe!==void 0)Z.wireframe=J.wireframe;if(J.wireframeLinewidth!==void 0)Z.wireframeLinewidth=J.wireframeLinewidth;if(J.wireframeLinecap!==void 0)Z.wireframeLinecap=J.wireframeLinecap;if(J.wireframeLinejoin!==void 0)Z.wireframeLinejoin=J.wireframeLinejoin;if(J.rotation!==void 0)Z.rotation=J.rotation;if(J.linewidth!==void 0)Z.linewidth=J.linewidth;if(J.dashSize!==void 0)Z.dashSize=J.dashSize;if(J.gapSize!==void 0)Z.gapSize=J.gapSize;if(J.scale!==void 0)Z.scale=J.scale;if(J.polygonOffset!==void 0)Z.polygonOffset=J.polygonOffset;if(J.polygonOffsetFactor!==void 0)Z.polygonOffsetFactor=J.polygonOffsetFactor;if(J.polygonOffsetUnits!==void 0)Z.polygonOffsetUnits=J.polygonOffsetUnits;if(J.dithering!==void 0)Z.dithering=J.dithering;if(J.alphaToCoverage!==void 0)Z.alphaToCoverage=J.alphaToCoverage;if(J.premultipliedAlpha!==void 0)Z.premultipliedAlpha=J.premultipliedAlpha;if(J.forceSinglePass!==void 0)Z.forceSinglePass=J.forceSinglePass;if(J.allowOverride!==void 0)Z.allowOverride=J.allowOverride;if(J.visible!==void 0)Z.visible=J.visible;if(J.toneMapped!==void 0)Z.toneMapped=J.toneMapped;if(J.userData!==void 0)Z.userData=J.userData;if(J.vertexColors!==void 0)if(typeof J.vertexColors==="number")Z.vertexColors=J.vertexColors>0;else Z.vertexColors=J.vertexColors;if(J.uniforms!==void 0)for(let W in J.uniforms){let Y=J.uniforms[W];switch(Z.uniforms[W]={},Y.type){case"t":Z.uniforms[W].value=$(Y.value);break;case"c":Z.uniforms[W].value=new e().setHex(Y.value);break;case"v2":Z.uniforms[W].value=new i().fromArray(Y.value);break;case"v3":Z.uniforms[W].value=new A().fromArray(Y.value);break;case"v4":Z.uniforms[W].value=new FJ().fromArray(Y.value);break;case"m3":Z.uniforms[W].value=new o0().fromArray(Y.value);break;case"m4":Z.uniforms[W].value=new y0().fromArray(Y.value);break;default:Z.uniforms[W].value=Y.value}}if(J.defines!==void 0)Z.defines=J.defines;if(J.vertexShader!==void 0)Z.vertexShader=J.vertexShader;if(J.fragmentShader!==void 0)Z.fragmentShader=J.fragmentShader;if(J.glslVersion!==void 0)Z.glslVersion=J.glslVersion;if(J.extensions!==void 0)for(let W in J.extensions)Z.extensions[W]=J.extensions[W];if(J.lights!==void 0)Z.lights=J.lights;if(J.clipping!==void 0)Z.clipping=J.clipping;if(J.size!==void 0)Z.size=J.size;if(J.sizeAttenuation!==void 0)Z.sizeAttenuation=J.sizeAttenuation;if(J.map!==void 0)Z.map=$(J.map);if(J.matcap!==void 0)Z.matcap=$(J.matcap);if(J.alphaMap!==void 0)Z.alphaMap=$(J.alphaMap);if(J.bumpMap!==void 0)Z.bumpMap=$(J.bumpMap);if(J.bumpScale!==void 0)Z.bumpScale=J.bumpScale;if(J.normalMap!==void 0)Z.normalMap=$(J.normalMap);if(J.normalMapType!==void 0)Z.normalMapType=J.normalMapType;if(J.normalScale!==void 0){let W=J.normalScale;if(Array.isArray(W)===!1)W=[W,W];Z.normalScale=new i().fromArray(W)}if(J.displacementMap!==void 0)Z.displacementMap=$(J.displacementMap);if(J.displacementScale!==void 0)Z.displacementScale=J.displacementScale;if(J.displacementBias!==void 0)Z.displacementBias=J.displacementBias;if(J.roughnessMap!==void 0)Z.roughnessMap=$(J.roughnessMap);if(J.metalnessMap!==void 0)Z.metalnessMap=$(J.metalnessMap);if(J.emissiveMap!==void 0)Z.emissiveMap=$(J.emissiveMap);if(J.emissiveIntensity!==void 0)Z.emissiveIntensity=J.emissiveIntensity;if(J.specularMap!==void 0)Z.specularMap=$(J.specularMap);if(J.specularIntensityMap!==void 0)Z.specularIntensityMap=$(J.specularIntensityMap);if(J.specularColorMap!==void 0)Z.specularColorMap=$(J.specularColorMap);if(J.envMap!==void 0)Z.envMap=$(J.envMap);if(J.envMapRotation!==void 0)Z.envMapRotation.fromArray(J.envMapRotation);if(J.envMapIntensity!==void 0)Z.envMapIntensity=J.envMapIntensity;if(J.reflectivity!==void 0)Z.reflectivity=J.reflectivity;if(J.refractionRatio!==void 0)Z.refractionRatio=J.refractionRatio;if(J.lightMap!==void 0)Z.lightMap=$(J.lightMap);if(J.lightMapIntensity!==void 0)Z.lightMapIntensity=J.lightMapIntensity;if(J.aoMap!==void 0)Z.aoMap=$(J.aoMap);if(J.aoMapIntensity!==void 0)Z.aoMapIntensity=J.aoMapIntensity;if(J.gradientMap!==void 0)Z.gradientMap=$(J.gradientMap);if(J.clearcoatMap!==void 0)Z.clearcoatMap=$(J.clearcoatMap);if(J.clearcoatRoughnessMap!==void 0)Z.clearcoatRoughnessMap=$(J.clearcoatRoughnessMap);if(J.clearcoatNormalMap!==void 0)Z.clearcoatNormalMap=$(J.clearcoatNormalMap);if(J.clearcoatNormalScale!==void 0)Z.clearcoatNormalScale=new i().fromArray(J.clearcoatNormalScale);if(J.iridescenceMap!==void 0)Z.iridescenceMap=$(J.iridescenceMap);if(J.iridescenceThicknessMap!==void 0)Z.iridescenceThicknessMap=$(J.iridescenceThicknessMap);if(J.transmissionMap!==void 0)Z.transmissionMap=$(J.transmissionMap);if(J.thicknessMap!==void 0)Z.thicknessMap=$(J.thicknessMap);if(J.anisotropyMap!==void 0)Z.anisotropyMap=$(J.anisotropyMap);if(J.sheenColorMap!==void 0)Z.sheenColorMap=$(J.sheenColorMap);if(J.sheenRoughnessMap!==void 0)Z.sheenRoughnessMap=$(J.sheenRoughnessMap);return Z}setTextures(J){return this.textures=J,this}createMaterialFromType(J){return q$.createMaterialFromType(J)}static createMaterialFromType(J){return new{ShadowMaterial:wW,SpriteMaterial:mQ,RawShaderMaterial:u6,ShaderMaterial:LJ,PointsMaterial:b6,MeshPhysicalMaterial:oJ,MeshStandardMaterial:iJ,MeshPhongMaterial:PW,MeshToonMaterial:AW,MeshNormalMaterial:TW,MeshLambertMaterial:n7,MeshDepthMaterial:H$,MeshDistanceMaterial:U$,MeshBasicMaterial:nJ,MeshMatcapMaterial:s7,LineDashedMaterial:SW,LineBasicMaterial:dJ,Material:vJ}[J]}}class n9{static extractUrlBase(J){let Q=J.lastIndexOf("/");if(Q===-1)return"./";return J.slice(0,Q+1)}static resolveURL(J,Q){if(typeof J!=="string"||J==="")return"";if(/^https?:\/\//i.test(Q)&&/^\//.test(J))Q=Q.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(J))return J;if(/^data:.*,.*$/i.test(J))return J;if(/^blob:.*$/i.test(J))return J;return Q+J}}class gW extends u0{constructor(){super();this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(J){return super.copy(J),this.instanceCount=J.instanceCount,this}toJSON(){let J=super.toJSON();return J.instanceCount=this.instanceCount,J.isInstancedBufferGeometry=!0,J}}class pW extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new E9(W.manager);Y.setPath(W.path),Y.setRequestHeader(W.requestHeader),Y.setWithCredentials(W.withCredentials),Y.load(J,function(X){try{Q(W.parse(JSON.parse(X)))}catch(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}},$,Z)}parse(J){let Q={},$={};function Z(E,O){if(Q[O]!==void 0)return Q[O];let M=E.interleavedBuffers[O],q=W(E,M.buffer),N=M7(M.type,q),L=new P8(N,M.stride);return L.uuid=M.uuid,Q[O]=L,L}function W(E,O){if($[O]!==void 0)return $[O];let M=E.arrayBuffers[O],q=new Uint32Array(M).buffer;return $[O]=q,q}let Y=J.isInstancedBufferGeometry?new gW:new u0,X=J.data.index;if(X!==void 0){let E=M7(X.type,X.array);Y.setIndex(new i0(E,1))}let K=J.data.attributes;for(let E in K){let O=K[E],R;if(O.isInterleavedBufferAttribute){let M=Z(J.data,O.data);R=new l9(M,O.itemSize,O.offset,O.normalized)}else{let M=M7(O.type,O.array);R=new(O.isInstancedBufferAttribute?c9:i0)(M,O.itemSize,O.normalized)}if(O.name!==void 0)R.name=O.name;if(O.usage!==void 0)R.setUsage(O.usage);Y.setAttribute(E,R)}let H=J.data.morphAttributes;if(H)for(let E in H){let O=H[E],R=[];for(let M=0,q=O.length;M<q;M++){let N=O[M],L;if(N.isInterleavedBufferAttribute){let D=Z(J.data,N.data);L=new l9(D,N.itemSize,N.offset,N.normalized)}else{let D=M7(N.type,N.array);L=new i0(D,N.itemSize,N.normalized)}if(N.name!==void 0)L.name=N.name;R.push(L)}Y.morphAttributes[E]=R}if(J.data.morphTargetsRelative)Y.morphTargetsRelative=!0;let G=J.data.groups||J.data.drawcalls||J.data.offsets;if(G!==void 0)for(let E=0,O=G.length;E!==O;++E){let R=G[E];Y.addGroup(R.start,R.count,R.materialIndex)}let F=J.data.boundingSphere;if(F!==void 0)Y.boundingSphere=new _J().fromJSON(F);if(J.name)Y.name=J.name;if(J.userData)Y.userData=J.userData;return Y}}var sY={};class VK extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=this.path===""?n9.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||Y;let X=new E9(this.manager);X.setPath(this.path),X.setRequestHeader(this.requestHeader),X.setWithCredentials(this.withCredentials),X.load(J,function(K){let H=null;try{H=JSON.parse(K)}catch(G){if(Z!==void 0)Z(G);v0("ObjectLoader: Can't parse "+J+".",G.message);return}let U=H.metadata;if(U===void 0||U.type===void 0||U.type.toLowerCase()==="geometry"){if(Z!==void 0)Z(Error("THREE.ObjectLoader: Can't load "+J));v0("ObjectLoader: Can't load "+J);return}W.parse(H,Q)},$,Z)}async loadAsync(J,Q){let $=this,Z=this.path===""?n9.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||Z;let W=new E9(this.manager);W.setPath(this.path),W.setRequestHeader(this.requestHeader),W.setWithCredentials(this.withCredentials);let Y=await W.loadAsync(J,Q),X;try{X=JSON.parse(Y)}catch(H){throw Error("ObjectLoader: Can't parse "+J+". "+H.message)}let K=X.metadata;if(K===void 0||K.type===void 0||K.type.toLowerCase()==="geometry")throw Error("THREE.ObjectLoader: Can't load "+J);return await $.parseAsync(X)}parse(J,Q){let $=this.parseAnimations(J.animations),Z=this.parseShapes(J.shapes),W=this.parseGeometries(J.geometries,Z),Y=this.parseImages(J.images,function(){if(Q!==void 0)Q(H)}),X=this.parseTextures(J.textures,Y),K=this.parseMaterials(J.materials,X),H=this.parseObject(J.object,W,K,X,$),U=this.parseSkeletons(J.skeletons,H);if(this.bindSkeletons(H,U),this.bindLightTargets(H),Q!==void 0){let G=!1;for(let F in Y)if(Y[F].data instanceof HTMLImageElement){G=!0;break}if(G===!1)Q(H)}return H}async parseAsync(J){let Q=this.parseAnimations(J.animations),$=this.parseShapes(J.shapes),Z=this.parseGeometries(J.geometries,$),W=await this.parseImagesAsync(J.images),Y=this.parseTextures(J.textures,W),X=this.parseMaterials(J.materials,Y),K=this.parseObject(J.object,Z,X,Y,Q),H=this.parseSkeletons(J.skeletons,K);return this.bindSkeletons(K,H),this.bindLightTargets(K),K}static registerGeometry(J,Q){sY[J]=Q}parseShapes(J){let Q={};if(J!==void 0)for(let $=0,Z=J.length;$<Z;$++){let W=new z8().fromJSON(J[$]);Q[W.uuid]=W}return Q}parseSkeletons(J,Q){let $={},Z={};if(Q.traverse(function(W){if(W.isBone)Z[W.uuid]=W}),J!==void 0)for(let W=0,Y=J.length;W<Y;W++){let X=new x6().fromJSON(J[W],Z);$[X.uuid]=X}return $}parseGeometries(J,Q){let $={};if(J!==void 0){let Z=new pW;for(let W=0,Y=J.length;W<Y;W++){let X,K=J[W];switch(K.type){case"BufferGeometry":case"InstancedBufferGeometry":X=Z.parse(K);break;default:if(K.type in SU)X=SU[K.type].fromJSON(K,Q);else if(K.type in sY)X=sY[K.type].fromJSON(K,Q);else O0(`ObjectLoader: Unknown geometry type "${K.type}". Use .registerGeometry() before starting the deserialization process.`)}if(X.uuid=K.uuid,K.name!==void 0)X.name=K.name;if(K.userData!==void 0)X.userData=K.userData;$[K.uuid]=X}}return $}parseMaterials(J,Q){let $={},Z={};if(J!==void 0){let W=new q$;W.setTextures(Q);for(let Y=0,X=J.length;Y<X;Y++){let K=J[Y];if($[K.uuid]===void 0)$[K.uuid]=W.parse(K);Z[K.uuid]=$[K.uuid]}}return Z}parseAnimations(J){let Q={};if(J!==void 0)for(let $=0;$<J.length;$++){let Z=J[$],W=I8.parse(Z);Q[W.uuid]=W}return Q}parseImages(J,Q){let $=this,Z={},W;function Y(K){return $.manager.itemStart(K),W.load(K,function(){$.manager.itemEnd(K)},void 0,function(){$.manager.itemError(K),$.manager.itemEnd(K)})}function X(K){if(typeof K==="string"){let H=K,U=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(H)?H:$.resourcePath+H;return Y(U)}else if(K.data)return{data:M7(K.type,K.data),width:K.width,height:K.height};else return null}if(J!==void 0&&J.length>0){let K=new F$(Q);W=new z6(K),W.setCrossOrigin(this.crossOrigin);for(let H=0,U=J.length;H<U;H++){let G=J[H],F=G.url;if(Array.isArray(F)){let E=[];for(let O=0,R=F.length;O<R;O++){let M=F[O],q=X(M);if(q!==null)if(q instanceof HTMLImageElement)E.push(q);else E.push(new k9(q.data,q.width,q.height))}Z[G.uuid]=new X8(E)}else{let E=X(G.url);Z[G.uuid]=new X8(E)}}}return Z}async parseImagesAsync(J){let Q=this,$={},Z;async function W(Y){if(typeof Y==="string"){let X=Y,K=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(X)?X:Q.resourcePath+X;return await Z.loadAsync(K)}else if(Y.data)return{data:M7(Y.type,Y.data),width:Y.width,height:Y.height};else return null}if(J!==void 0&&J.length>0){Z=new z6(this.manager),Z.setCrossOrigin(this.crossOrigin);for(let Y=0,X=J.length;Y<X;Y++){let K=J[Y],H=K.url;if(Array.isArray(H)){let U=[];for(let G=0,F=H.length;G<F;G++){let E=H[G],O=await W(E);if(O!==null)if(O instanceof HTMLImageElement)U.push(O);else U.push(new k9(O.data,O.width,O.height))}$[K.uuid]=new X8(U)}else{let U=await W(K.url);$[K.uuid]=new X8(U)}}}return $}parseTextures(J,Q){function $(W,Y){if(typeof W==="number")return W;return O0("ObjectLoader.parseTexture: Constant should be in numeric form.",W),Y[W]}let Z={};if(J!==void 0)for(let W=0,Y=J.length;W<Y;W++){let X=J[W];if(X.image===void 0)O0('ObjectLoader: No "image" specified for',X.uuid);if(Q[X.image]===void 0)O0("ObjectLoader: Undefined image",X.image);let K=Q[X.image],H=K.data,U;if(Array.isArray(H)){if(U=new h6,H.length===6)U.needsUpdate=!0}else{if(H&&H.data)U=new k9;else U=new kJ;if(H)U.needsUpdate=!0}if(U.source=K,U.uuid=X.uuid,X.name!==void 0)U.name=X.name;if(X.mapping!==void 0)U.mapping=$(X.mapping,GN);if(X.channel!==void 0)U.channel=X.channel;if(X.offset!==void 0)U.offset.fromArray(X.offset);if(X.repeat!==void 0)U.repeat.fromArray(X.repeat);if(X.center!==void 0)U.center.fromArray(X.center);if(X.rotation!==void 0)U.rotation=X.rotation;if(X.wrap!==void 0)U.wrapS=$(X.wrap[0],fU),U.wrapT=$(X.wrap[1],fU);if(X.format!==void 0)U.format=X.format;if(X.internalFormat!==void 0)U.internalFormat=X.internalFormat;if(X.type!==void 0)U.type=X.type;if(X.colorSpace!==void 0)U.colorSpace=X.colorSpace;if(X.minFilter!==void 0)U.minFilter=$(X.minFilter,gU);if(X.magFilter!==void 0)U.magFilter=$(X.magFilter,gU);if(X.anisotropy!==void 0)U.anisotropy=X.anisotropy;if(X.flipY!==void 0)U.flipY=X.flipY;if(X.generateMipmaps!==void 0)U.generateMipmaps=X.generateMipmaps;if(X.premultiplyAlpha!==void 0)U.premultiplyAlpha=X.premultiplyAlpha;if(X.unpackAlignment!==void 0)U.unpackAlignment=X.unpackAlignment;if(X.compareFunction!==void 0)U.compareFunction=X.compareFunction;if(X.normalized!==void 0)U.normalized=X.normalized;if(X.userData!==void 0)U.userData=X.userData;Z[X.uuid]=U}return Z}parseObject(J,Q,$,Z,W){let Y;function X(F){if(Q[F]===void 0)O0("ObjectLoader: Undefined geometry",F);return Q[F]}function K(F){if(F===void 0)return;if(Array.isArray(F)){let E=[];for(let O=0,R=F.length;O<R;O++){let M=F[O];if($[M]===void 0)O0("ObjectLoader: Undefined material",M);E.push($[M])}return E}if($[F]===void 0)O0("ObjectLoader: Undefined material",F);return $[F]}function H(F){if(Z[F]===void 0)O0("ObjectLoader: Undefined texture",F);return Z[F]}let U,G;switch(J.type){case"Scene":if(Y=new e8,J.background!==void 0)if(Number.isInteger(J.background))Y.background=new e(J.background);else Y.background=H(J.background);if(J.environment!==void 0)Y.environment=H(J.environment);if(J.fog!==void 0){if(J.fog.type==="Fog")Y.fog=new pQ(J.fog.color,J.fog.near,J.fog.far);else if(J.fog.type==="FogExp2")Y.fog=new gQ(J.fog.color,J.fog.density);if(J.fog.name!=="")Y.fog.name=J.fog.name}if(J.backgroundBlurriness!==void 0)Y.backgroundBlurriness=J.backgroundBlurriness;if(J.backgroundIntensity!==void 0)Y.backgroundIntensity=J.backgroundIntensity;if(J.backgroundRotation!==void 0)Y.backgroundRotation.fromArray(J.backgroundRotation);if(J.environmentIntensity!==void 0)Y.environmentIntensity=J.environmentIntensity;if(J.environmentRotation!==void 0)Y.environmentRotation.fromArray(J.environmentRotation);break;case"PerspectiveCamera":if(Y=new BJ(J.fov,J.aspect,J.near,J.far),J.focus!==void 0)Y.focus=J.focus;if(J.zoom!==void 0)Y.zoom=J.zoom;if(J.filmGauge!==void 0)Y.filmGauge=J.filmGauge;if(J.filmOffset!==void 0)Y.filmOffset=J.filmOffset;if(J.view!==void 0)Y.view=Object.assign({},J.view);break;case"OrthographicCamera":if(Y=new t9(J.left,J.right,J.top,J.bottom,J.near,J.far),J.zoom!==void 0)Y.zoom=J.zoom;if(J.view!==void 0)Y.view=Object.assign({},J.view);break;case"AmbientLight":Y=new m6(J.color,J.intensity);break;case"DirectionalLight":Y=new y9(J.color,J.intensity),Y.target=J.target||"";break;case"PointLight":Y=new N8(J.color,J.intensity,J.distance,J.decay);break;case"RectAreaLight":Y=new hW(J.color,J.intensity,J.width,J.height);break;case"SpotLight":Y=new o7(J.color,J.intensity,J.distance,J.angle,J.penumbra,J.decay),Y.target=J.target||"";break;case"HemisphereLight":Y=new W6(J.color,J.groundColor,J.intensity);break;case"LightProbe":let F=new O$().fromArray(J.sh);Y=new fW(F,J.intensity);break;case"SkinnedMesh":if(U=X(J.geometry),G=K(J.material),Y=new g7(U,G),J.bindMode!==void 0)Y.bindMode=J.bindMode;if(J.bindMatrix!==void 0)Y.bindMatrix.fromArray(J.bindMatrix);if(J.skeleton!==void 0)Y.skeleton=J.skeleton;break;case"Mesh":U=X(J.geometry),G=K(J.material),Y=new a0(U,G);break;case"InstancedMesh":U=X(J.geometry),G=K(J.material);let{count:E,instanceMatrix:O,instanceColor:R}=J;if(Y=new U8(U,G,E),Y.instanceMatrix=new c9(new Float32Array(O.array),16),R!==void 0)Y.instanceColor=new c9(new Float32Array(R.array),R.itemSize);break;case"BatchedMesh":if(U=X(J.geometry),G=K(J.material),Y=new DW(J.maxInstanceCount,J.maxVertexCount,J.maxIndexCount,G),Y.geometry=U,Y.perObjectFrustumCulled=J.perObjectFrustumCulled,Y.sortObjects=J.sortObjects,Y._drawRanges=J.drawRanges,Y._reservedRanges=J.reservedRanges,Y._geometryInfo=J.geometryInfo.map((M)=>{let q=null,N=null;if(M.boundingBox!==void 0)q=new SJ().fromJSON(M.boundingBox);if(M.boundingSphere!==void 0)N=new _J().fromJSON(M.boundingSphere);return{...M,boundingBox:q,boundingSphere:N}}),Y._instanceInfo=J.instanceInfo,Y._availableInstanceIds=J._availableInstanceIds,Y._availableGeometryIds=J._availableGeometryIds,Y._nextIndexStart=J.nextIndexStart,Y._nextVertexStart=J.nextVertexStart,Y._geometryCount=J.geometryCount,Y._maxInstanceCount=J.maxInstanceCount,Y._maxVertexCount=J.maxVertexCount,Y._maxIndexCount=J.maxIndexCount,Y._geometryInitialized=J.geometryInitialized,Y._matricesTexture=H(J.matricesTexture.uuid),Y._indirectTexture=H(J.indirectTexture.uuid),J.colorsTexture!==void 0)Y._colorsTexture=H(J.colorsTexture.uuid);if(J.boundingSphere!==void 0)Y.boundingSphere=new _J().fromJSON(J.boundingSphere);if(J.boundingBox!==void 0)Y.boundingBox=new SJ().fromJSON(J.boundingBox);break;case"LOD":Y=new LW;break;case"Line":Y=new T9(X(J.geometry),K(J.material));break;case"LineLoop":Y=new p7(X(J.geometry),K(J.material));break;case"LineSegments":Y=new O9(X(J.geometry),K(J.material));break;case"PointCloud":case"Points":Y=new r9(X(J.geometry),K(J.material));break;case"Sprite":Y=new RW(K(J.material));break;case"Group":Y=new G9;break;case"Bone":Y=new y6;break;default:Y=new HJ}if(Y.uuid=J.uuid,J.name!==void 0)Y.name=J.name;if(J.matrix!==void 0){if(Y.matrix.fromArray(J.matrix),J.matrixAutoUpdate!==void 0)Y.matrixAutoUpdate=J.matrixAutoUpdate;if(Y.matrixAutoUpdate)Y.matrix.decompose(Y.position,Y.quaternion,Y.scale)}else{if(J.position!==void 0)Y.position.fromArray(J.position);if(J.rotation!==void 0)Y.rotation.fromArray(J.rotation);if(J.quaternion!==void 0)Y.quaternion.fromArray(J.quaternion);if(J.scale!==void 0)Y.scale.fromArray(J.scale)}if(J.up!==void 0)Y.up.fromArray(J.up);if(J.pivot!==void 0)Y.pivot=new A().fromArray(J.pivot);if(J.morphTargetDictionary!==void 0)Y.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);if(J.morphTargetInfluences!==void 0)Y.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.castShadow!==void 0)Y.castShadow=J.castShadow;if(J.receiveShadow!==void 0)Y.receiveShadow=J.receiveShadow;if(J.shadow){if(J.shadow.intensity!==void 0)Y.shadow.intensity=J.shadow.intensity;if(J.shadow.bias!==void 0)Y.shadow.bias=J.shadow.bias;if(J.shadow.normalBias!==void 0)Y.shadow.normalBias=J.shadow.normalBias;if(J.shadow.radius!==void 0)Y.shadow.radius=J.shadow.radius;if(J.shadow.mapSize!==void 0)Y.shadow.mapSize.fromArray(J.shadow.mapSize);if(J.shadow.camera!==void 0)Y.shadow.camera=this.parseObject(J.shadow.camera)}if(J.visible!==void 0)Y.visible=J.visible;if(J.frustumCulled!==void 0)Y.frustumCulled=J.frustumCulled;if(J.renderOrder!==void 0)Y.renderOrder=J.renderOrder;if(J.static!==void 0)Y.static=J.static;if(J.userData!==void 0)Y.userData=J.userData;if(J.layers!==void 0)Y.layers.mask=J.layers;if(J.children!==void 0){let F=J.children;for(let E=0;E<F.length;E++)Y.add(this.parseObject(F[E],Q,$,Z,W))}if(J.animations!==void 0){let F=J.animations;for(let E=0;E<F.length;E++){let O=F[E];Y.animations.push(W[O])}}if(J.type==="LOD"){if(J.autoUpdate!==void 0)Y.autoUpdate=J.autoUpdate;let F=J.levels;for(let E=0;E<F.length;E++){let O=F[E],R=Y.getObjectByProperty("uuid",O.object);if(R!==void 0)Y.addLevel(R,O.distance,O.hysteresis)}}return Y}bindSkeletons(J,Q){if(Object.keys(Q).length===0)return;J.traverse(function($){if($.isSkinnedMesh===!0&&$.skeleton!==void 0){let Z=Q[$.skeleton];if(Z===void 0)O0("ObjectLoader: No skeleton found with UUID:",$.skeleton);else $.bind(Z,$.bindMatrix)}})}bindLightTargets(J){J.traverse(function(Q){if(Q.isDirectionalLight||Q.isSpotLight){let $=Q.target,Z=J.getObjectByProperty("uuid",$);if(Z!==void 0)Q.target=Z;else Q.target=new HJ}})}}var GN={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},fU={RepeatWrapping:1000,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},gU={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008},iY=new WeakMap;class R$ extends sJ{constructor(J){super(J);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")O0("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")O0("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(J){return this.options=J,this}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=m9.get(`image-bitmap:${J}`);if(Y!==void 0){if(W.manager.itemStart(J),Y.then){Y.then((H)=>{if(iY.has(Y)===!0){if(Z)Z(iY.get(Y));W.manager.itemError(J),W.manager.itemEnd(J)}else{if(Q)Q(H);W.manager.itemEnd(J)}});return}setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);return}let X={};X.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",X.headers=this.requestHeader,X.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let K=fetch(J,X).then(function(H){return H.blob()}).then(function(H){return createImageBitmap(H,Object.assign(W.options,{colorSpaceConversion:"none"}))}).then(function(H){if(m9.add(`image-bitmap:${J}`,H),Q)Q(H);W.manager.itemEnd(J)}).catch(function(H){if(Z)Z(H);iY.set(K,H),m9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});m9.add(`image-bitmap:${J}`,K),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var NZ;class L${static getContext(){if(NZ===void 0)NZ=new(window.AudioContext||window.webkitAudioContext);return NZ}static setContext(J){NZ=J}}class BK extends sJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new E9(this.manager);Y.setResponseType("arraybuffer"),Y.setPath(this.path),Y.setRequestHeader(this.requestHeader),Y.setWithCredentials(this.withCredentials),Y.load(J,function(K){try{let H=K.slice(0),U=L$.getContext(),G=J+"#decode";W.manager.itemStart(G),U.decodeAudioData(H,function(F){Q(F),W.manager.itemEnd(G)}).catch(function(F){X(F),W.manager.itemEnd(G)})}catch(H){X(H)}},$,Z);function X(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}}}var pU=new y0,uU=new y0,O6=new y0;class CK{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=0.064,this.cameraL=new BJ,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new BJ,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}}update(J){let Q=this._cache;if(Q.focus!==J.focus||Q.fov!==J.fov||Q.aspect!==J.aspect*this.aspect||Q.near!==J.near||Q.far!==J.far||Q.zoom!==J.zoom||Q.eyeSep!==this.eyeSep){Q.focus=J.focus,Q.fov=J.fov,Q.aspect=J.aspect*this.aspect,Q.near=J.near,Q.far=J.far,Q.zoom=J.zoom,Q.eyeSep=this.eyeSep,O6.copy(J.projectionMatrix);let Z=Q.eyeSep/2,W=Z*Q.near/Q.focus,Y=Q.near*Math.tan(V6*Q.fov*0.5)/Q.zoom,X,K;uU.elements[12]=-Z,pU.elements[12]=Z,X=-Y*Q.aspect+W,K=Y*Q.aspect+W,O6.elements[0]=2*Q.near/(K-X),O6.elements[8]=(K+X)/(K-X),this.cameraL.projectionMatrix.copy(O6),X=-Y*Q.aspect-W,K=Y*Q.aspect-W,O6.elements[0]=2*Q.near/(K-X),O6.elements[8]=(K+X)/(K-X),this.cameraR.projectionMatrix.copy(O6)}this.cameraL.matrixWorld.copy(J.matrixWorld).multiply(uU),this.cameraR.matrixWorld.copy(J.matrixWorld).multiply(pU)}}var q7=-90,R7=1;class uW extends HJ{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new BJ(q7,R7,J,Q);Z.layers=this.layers,this.add(Z);let W=new BJ(q7,R7,J,Q);W.layers=this.layers,this.add(W);let Y=new BJ(q7,R7,J,Q);Y.layers=this.layers,this.add(Y);let X=new BJ(q7,R7,J,Q);X.layers=this.layers,this.add(X);let K=new BJ(q7,R7,J,Q);K.layers=this.layers,this.add(K);let H=new BJ(q7,R7,J,Q);H.layers=this.layers,this.add(H)}updateCoordinateSystem(){let J=this.coordinateSystem,Q=this.children.concat(),[$,Z,W,Y,X,K]=Q;for(let H of Q)this.remove(H);if(J===2000)$.up.set(0,1,0),$.lookAt(1,0,0),Z.up.set(0,1,0),Z.lookAt(-1,0,0),W.up.set(0,0,-1),W.lookAt(0,1,0),Y.up.set(0,0,1),Y.lookAt(0,-1,0),X.up.set(0,1,0),X.lookAt(0,0,1),K.up.set(0,1,0),K.lookAt(0,0,-1);else if(J===2001)$.up.set(0,-1,0),$.lookAt(-1,0,0),Z.up.set(0,-1,0),Z.lookAt(1,0,0),W.up.set(0,0,1),W.lookAt(0,1,0),Y.up.set(0,0,-1),Y.lookAt(0,-1,0),X.up.set(0,-1,0),X.lookAt(0,0,1),K.up.set(0,-1,0),K.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+J);for(let H of Q)this.add(H),H.updateMatrixWorld()}update(J,Q){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:$,activeMipmapLevel:Z}=this;if(this.coordinateSystem!==J.coordinateSystem)this.coordinateSystem=J.coordinateSystem,this.updateCoordinateSystem();let[W,Y,X,K,H,U]=this.children,G=J.getRenderTarget(),F=J.getActiveCubeFace(),E=J.getActiveMipmapLevel(),O=J.xr.enabled;J.xr.enabled=!1;let R=$.texture.generateMipmaps;$.texture.generateMipmaps=!1;let M=!1;if(J.isWebGLRenderer===!0)M=J.state.buffers.depth.getReversed();else M=J.reversedDepthBuffer;if(J.setRenderTarget($,0,Z),M&&J.autoClear===!1)J.clearDepth();if(J.render(Q,W),J.setRenderTarget($,1,Z),M&&J.autoClear===!1)J.clearDepth();if(J.render(Q,Y),J.setRenderTarget($,2,Z),M&&J.autoClear===!1)J.clearDepth();if(J.render(Q,X),J.setRenderTarget($,3,Z),M&&J.autoClear===!1)J.clearDepth();if(J.render(Q,K),J.setRenderTarget($,4,Z),M&&J.autoClear===!1)J.clearDepth();if(J.render(Q,H),$.texture.generateMipmaps=R,J.setRenderTarget($,5,Z),M&&J.autoClear===!1)J.clearDepth();J.render(Q,U),J.setRenderTarget(G,F,E),J.xr.enabled=O,$.texture.needsPMREMUpdate=!0}}class dW extends BJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class a7{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(J){if(this._document=J,J.hidden!==void 0)this._pageVisibilityHandler=EN.bind(this),J.addEventListener("visibilitychange",this._pageVisibilityHandler,!1)}disconnect(){if(this._pageVisibilityHandler!==null)this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null;this._document=null}getDelta(){return this._delta/1000}getElapsed(){return this._elapsed/1000}getTimescale(){return this._timescale}setTimescale(J){return this._timescale=J,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(J){if(this._pageVisibilityHandler!==null&&this._document.hidden===!0)this._delta=0;else this._previousTime=this._currentTime,this._currentTime=(J!==void 0?J:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta;return this}}function EN(){if(this._document.hidden===!1)this.reset()}var q6=new A,oY=new zJ,FN=new A,R6=new A,L6=new A;class zK extends HJ{constructor(){super();this.type="AudioListener",this.context=L$.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new a7}getInput(){return this.gain}removeFilter(){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null;return this}getFilter(){return this.filter}setFilter(J){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination);else this.gain.disconnect(this.context.destination);return this.filter=J,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}updateMatrixWorld(J){super.updateMatrixWorld(J),this._timer.update();let Q=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(q6,oY,FN),R6.set(0,0,-1).applyQuaternion(oY),L6.set(0,1,0).applyQuaternion(oY),Q.positionX){let $=this.context.currentTime+this.timeDelta;Q.positionX.linearRampToValueAtTime(q6.x,$),Q.positionY.linearRampToValueAtTime(q6.y,$),Q.positionZ.linearRampToValueAtTime(q6.z,$),Q.forwardX.linearRampToValueAtTime(R6.x,$),Q.forwardY.linearRampToValueAtTime(R6.y,$),Q.forwardZ.linearRampToValueAtTime(R6.z,$),Q.upX.linearRampToValueAtTime(L6.x,$),Q.upY.linearRampToValueAtTime(L6.y,$),Q.upZ.linearRampToValueAtTime(L6.z,$)}else Q.setPosition(q6.x,q6.y,q6.z),Q.setOrientation(R6.x,R6.y,R6.z,L6.x,L6.y,L6.z)}}class mW extends HJ{constructor(J){super();this.type="Audio",this.listener=J,this.context=J.context,this.gain=this.context.createGain(),this.gain.connect(J.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(J){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=J,this.connect(),this}setMediaElementSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(J),this.connect(),this}setMediaStreamSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(J),this.connect(),this}setBuffer(J){if(this.buffer=J,this.sourceType="buffer",this.autoplay)this.play();return this}play(J=0){if(this.isPlaying===!0){O0("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+J;let Q=this.context.createBufferSource();return Q.buffer=this.buffer,Q.loop=this.loop,Q.loopStart=this.loopStart,Q.loopEnd=this.loopEnd,Q.onended=this.onEnded.bind(this),Q.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Q,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this.isPlaying===!0){if(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0)this._progress=this._progress%(this.duration||this.buffer.duration);this.source.stop(),this.source.onended=null,this.isPlaying=!1}return this}stop(J=0){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this._progress=0,this.source!==null)this.source.stop(this.context.currentTime+J),this.source.onended=null;return this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].connect(this.filters[J]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected===!1)return;if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].disconnect(this.filters[J]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(J){if(!J)J=[];if(this._connected===!0)this.disconnect(),this.filters=J.slice(),this.connect();else this.filters=J.slice();return this}setDetune(J){if(this.detune=J,this.isPlaying===!0&&this.source.detune!==void 0)this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,0.01);return this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(J){return this.setFilters(J?[J]:[])}setPlaybackRate(J){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this.playbackRate=J,this.isPlaying===!0)this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,0.01);return this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){if(this.hasPlaybackControl===!1)return O0("Audio: this Audio has no playback control."),!1;return this.loop}setLoop(J){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this.loop=J,this.isPlaying===!0)this.source.loop=this.loop;return this}setLoopStart(J){return this.loopStart=J,this}setLoopEnd(J){return this.loopEnd=J,this}getVolume(){return this.gain.gain.value}setVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}copy(J,Q){if(super.copy(J,Q),J.sourceType!=="buffer")return O0("Audio: Audio source type cannot be copied."),this;return this.autoplay=J.autoplay,this.buffer=J.buffer,this.detune=J.detune,this.loop=J.loop,this.loopStart=J.loopStart,this.loopEnd=J.loopEnd,this.offset=J.offset,this.duration=J.duration,this.playbackRate=J.playbackRate,this.hasPlaybackControl=J.hasPlaybackControl,this.sourceType=J.sourceType,this.filters=J.filters.slice(),this}clone(J){return new this.constructor(this.listener).copy(this,J)}}var D6=new A,dU=new zJ,NN=new A,M6=new A;class IK extends mW{constructor(J){super(J);this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(J){return this.panner.refDistance=J,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(J){return this.panner.rolloffFactor=J,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(J){return this.panner.distanceModel=J,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(J){return this.panner.maxDistance=J,this}setDirectionalCone(J,Q,$){return this.panner.coneInnerAngle=J,this.panner.coneOuterAngle=Q,this.panner.coneOuterGain=$,this}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(D6,dU,NN),M6.set(0,0,1).applyQuaternion(dU);let Q=this.panner;if(Q.positionX){let $=this.context.currentTime+this.listener.timeDelta;Q.positionX.linearRampToValueAtTime(D6.x,$),Q.positionY.linearRampToValueAtTime(D6.y,$),Q.positionZ.linearRampToValueAtTime(D6.z,$),Q.orientationX.linearRampToValueAtTime(M6.x,$),Q.orientationY.linearRampToValueAtTime(M6.y,$),Q.orientationZ.linearRampToValueAtTime(M6.z,$)}else Q.setPosition(D6.x,D6.y,D6.z),Q.setOrientation(M6.x,M6.y,M6.z)}}class _K{constructor(J,Q=2048){this.analyser=J.context.createAnalyser(),this.analyser.fftSize=Q,this.data=new Uint8Array(this.analyser.frequencyBinCount),J.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let J=0,Q=this.getFrequencyData();for(let $=0;$<Q.length;$++)J+=Q[$];return J/Q.length}}class lW{constructor(J,Q,$){this.binding=J,this.valueSize=$;let Z,W,Y;switch(Q){case"quaternion":Z=this._slerp,W=this._slerpAdditive,Y=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array($*6),this._workIndex=5;break;case"string":case"bool":Z=this._select,W=this._select,Y=this._setAdditiveIdentityOther,this.buffer=Array($*5);break;default:Z=this._lerp,W=this._lerpAdditive,Y=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array($*5)}this._mixBufferRegion=Z,this._mixBufferRegionAdditive=W,this._setIdentity=Y,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(J,Q){let $=this.buffer,Z=this.valueSize,W=J*Z+Z,Y=this.cumulativeWeight;if(Y===0){for(let X=0;X!==Z;++X)$[W+X]=$[X];Y=Q}else{Y+=Q;let X=Q/Y;this._mixBufferRegion($,W,0,X,Z)}this.cumulativeWeight=Y}accumulateAdditive(J){let Q=this.buffer,$=this.valueSize,Z=$*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(Q,Z,0,J,$),this.cumulativeWeightAdditive+=J}apply(J){let Q=this.valueSize,$=this.buffer,Z=J*Q+Q,W=this.cumulativeWeight,Y=this.cumulativeWeightAdditive,X=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,W<1){let K=Q*this._origIndex;this._mixBufferRegion($,Z,K,1-W,Q)}if(Y>0)this._mixBufferRegionAdditive($,Z,this._addIndex*Q,1,Q);for(let K=Q,H=Q+Q;K!==H;++K)if($[K]!==$[K+Q]){X.setValue($,Z);break}}saveOriginalState(){let J=this.binding,Q=this.buffer,$=this.valueSize,Z=$*this._origIndex;J.getValue(Q,Z);for(let W=$,Y=Z;W!==Y;++W)Q[W]=Q[Z+W%$];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let J=this.valueSize*3;this.binding.setValue(this.buffer,J)}_setAdditiveIdentityNumeric(){let J=this._addIndex*this.valueSize,Q=J+this.valueSize;for(let $=J;$<Q;$++)this.buffer[$]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let J=this._origIndex*this.valueSize,Q=this._addIndex*this.valueSize;for(let $=0;$<this.valueSize;$++)this.buffer[Q+$]=this.buffer[J+$]}_select(J,Q,$,Z,W){if(Z>=0.5)for(let Y=0;Y!==W;++Y)J[Q+Y]=J[$+Y]}_slerp(J,Q,$,Z){zJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let Y=this._workIndex*W;zJ.multiplyQuaternionsFlat(J,Y,J,Q,J,$),zJ.slerpFlat(J,Q,J,Q,J,Y,Z)}_lerp(J,Q,$,Z,W){let Y=1-Z;for(let X=0;X!==W;++X){let K=Q+X;J[K]=J[K]*Y+J[$+X]*Z}}_lerpAdditive(J,Q,$,Z,W){for(let Y=0;Y!==W;++Y){let X=Q+Y;J[X]=J[X]+J[$+Y]*Z}}}var wK="\\[\\]\\.:\\/",ON=new RegExp("["+wK+"]","g"),PK="[^"+wK+"]",qN="[^"+wK.replace("\\.","")+"]",RN=/((?:WC+[\/:])*)/.source.replace("WC",PK),LN=/(WCOD+)?/.source.replace("WCOD",qN),DN=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",PK),MN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",PK),kN=new RegExp("^"+RN+LN+DN+MN+"$"),VN=["material","materials","bones","map"];class z5{constructor(J,Q,$){let Z=$||GJ.parseTrackName(Q);this._targetGroup=J,this._bindings=J.subscribe_(Q,Z)}getValue(J,Q){this.bind();let $=this._targetGroup.nCachedObjects_,Z=this._bindings[$];if(Z!==void 0)Z.getValue(J,Q)}setValue(J,Q){let $=this._bindings;for(let Z=this._targetGroup.nCachedObjects_,W=$.length;Z!==W;++Z)$[Z].setValue(J,Q)}bind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].bind()}unbind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].unbind()}}class GJ{constructor(J,Q,$){this.path=Q,this.parsedPath=$||GJ.parseTrackName(Q),this.node=GJ.findNode(J,this.parsedPath.nodeName),this.rootNode=J,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(J,Q,$){if(!(J&&J.isAnimationObjectGroup))return new GJ(J,Q,$);else return new GJ.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(ON,"")}static parseTrackName(J){let Q=kN.exec(J);if(Q===null)throw Error("PropertyBinding: Cannot parse trackName: "+J);let $={nodeName:Q[2],objectName:Q[3],objectIndex:Q[4],propertyName:Q[5],propertyIndex:Q[6]},Z=$.nodeName&&$.nodeName.lastIndexOf(".");if(Z!==void 0&&Z!==-1){let W=$.nodeName.substring(Z+1);if(VN.indexOf(W)!==-1)$.nodeName=$.nodeName.substring(0,Z),$.objectName=W}if($.propertyName===null||$.propertyName.length===0)throw Error("PropertyBinding: can not parse propertyName from trackName: "+J);return $}static findNode(J,Q){if(Q===void 0||Q===""||Q==="."||Q===-1||Q===J.name||Q===J.uuid)return J;if(J.skeleton){let $=J.skeleton.getBoneByName(Q);if($!==void 0)return $}if(J.children){let $=function(W){for(let Y=0;Y<W.length;Y++){let X=W[Y];if(X.name===Q||X.uuid===Q)return X;let K=$(X.children);if(K)return K}return null},Z=$(J.children);if(Z)return Z}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(J,Q){J[Q]=this.targetObject[this.propertyName]}_getValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)J[Q++]=$[Z]}_getValue_arrayElement(J,Q){J[Q]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(J,Q){this.resolvedProperty.toArray(J,Q)}_setValue_direct(J,Q){this.targetObject[this.propertyName]=J[Q]}_setValue_direct_setNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++]}_setValue_array_setNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q]}_setValue_arrayElement_setNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(J,Q){this.resolvedProperty.fromArray(J,Q)}_setValue_fromArray_setNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(J,Q){this.bind(),this.getValue(J,Q)}_setValue_unbound(J,Q){this.bind(),this.setValue(J,Q)}bind(){let J=this.node,Q=this.parsedPath,$=Q.objectName,Z=Q.propertyName,W=Q.propertyIndex;if(!J)J=GJ.findNode(this.rootNode,Q.nodeName),this.node=J;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!J){O0("PropertyBinding: No target node found for track: "+this.path+".");return}if($){let H=Q.objectIndex;switch($){case"materials":if(!J.material){v0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){v0("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}J=J.material.materials;break;case"bones":if(!J.skeleton){v0("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}J=J.skeleton.bones;for(let U=0;U<J.length;U++)if(J[U].name===H){H=U;break}break;case"map":if("map"in J){J=J.map;break}if(!J.material){v0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){v0("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}J=J.material.map;break;default:if(J[$]===void 0){v0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(H!==void 0){if(J[H]===void 0){v0("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,J);return}J=J[H]}}let Y=J[Z];if(Y===void 0){let H=Q.nodeName;v0("PropertyBinding: Trying to update property for track: "+H+"."+Z+" but it wasn't found.",J);return}let X=this.Versioning.None;if(this.targetObject=J,J.isMaterial===!0)X=this.Versioning.NeedsUpdate;else if(J.isObject3D===!0)X=this.Versioning.MatrixWorldNeedsUpdate;let K=this.BindingType.Direct;if(W!==void 0){if(Z==="morphTargetInfluences"){if(!J.geometry){v0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){v0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(J.morphTargetDictionary[W]!==void 0)W=J.morphTargetDictionary[W]}K=this.BindingType.ArrayElement,this.resolvedProperty=Y,this.propertyIndex=W}else if(Y.fromArray!==void 0&&Y.toArray!==void 0)K=this.BindingType.HasFromToArray,this.resolvedProperty=Y;else if(Array.isArray(Y))K=this.BindingType.EntireArray,this.resolvedProperty=Y;else this.propertyName=Z;this.getValue=this.GetterByBindingType[K],this.setValue=this.SetterByBindingTypeAndVersioning[K][X]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}GJ.Composite=z5;GJ.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};GJ.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};GJ.prototype.GetterByBindingType=[GJ.prototype._getValue_direct,GJ.prototype._getValue_array,GJ.prototype._getValue_arrayElement,GJ.prototype._getValue_toArray];GJ.prototype.SetterByBindingTypeAndVersioning=[[GJ.prototype._setValue_direct,GJ.prototype._setValue_direct_setNeedsUpdate,GJ.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[GJ.prototype._setValue_array,GJ.prototype._setValue_array_setNeedsUpdate,GJ.prototype._setValue_array_setMatrixWorldNeedsUpdate],[GJ.prototype._setValue_arrayElement,GJ.prototype._setValue_arrayElement_setNeedsUpdate,GJ.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[GJ.prototype._setValue_fromArray,GJ.prototype._setValue_fromArray_setNeedsUpdate,GJ.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AK{constructor(){this.isAnimationObjectGroup=!0,this.uuid=M9(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let J={};this._indicesByUUID=J;for(let $=0,Z=arguments.length;$!==Z;++$)J[arguments[$].uuid]=$;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let Q=this;this.stats={objects:{get total(){return Q._objects.length},get inUse(){return this.total-Q.nCachedObjects_}},get bindingsPerObject(){return Q._bindings.length}}}add(){let J=this._objects,Q=this._indicesByUUID,$=this._paths,Z=this._parsedPaths,W=this._bindings,Y=W.length,X=void 0,K=J.length,H=this.nCachedObjects_;for(let U=0,G=arguments.length;U!==G;++U){let F=arguments[U],E=F.uuid,O=Q[E];if(O===void 0){O=K++,Q[E]=O,J.push(F);for(let R=0,M=Y;R!==M;++R)W[R].push(new GJ(F,$[R],Z[R]))}else if(O<H){X=J[O];let R=--H,M=J[R];Q[M.uuid]=O,J[O]=M,Q[E]=R,J[R]=F;for(let q=0,N=Y;q!==N;++q){let L=W[q],D=L[R],V=L[O];if(L[O]=D,V===void 0)V=new GJ(F,$[q],Z[q]);L[R]=V}}else if(J[O]!==X)v0("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=H}remove(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_;for(let Y=0,X=arguments.length;Y!==X;++Y){let K=arguments[Y],H=K.uuid,U=Q[H];if(U!==void 0&&U>=W){let G=W++,F=J[G];Q[F.uuid]=U,J[U]=F,Q[H]=G,J[G]=K;for(let E=0,O=Z;E!==O;++E){let R=$[E],M=R[G],q=R[U];R[U]=M,R[G]=q}}}this.nCachedObjects_=W}uncache(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_,Y=J.length;for(let X=0,K=arguments.length;X!==K;++X){let H=arguments[X],U=H.uuid,G=Q[U];if(G!==void 0)if(delete Q[U],G<W){let F=--W,E=J[F],O=--Y,R=J[O];Q[E.uuid]=G,J[G]=E,Q[R.uuid]=F,J[F]=R,J.pop();for(let M=0,q=Z;M!==q;++M){let N=$[M],L=N[F],D=N[O];N[G]=L,N[F]=D,N.pop()}}else{let F=--Y,E=J[F];if(F>0)Q[E.uuid]=G;J[G]=E,J.pop();for(let O=0,R=Z;O!==R;++O){let M=$[O];M[G]=M[F],M.pop()}}}this.nCachedObjects_=W}subscribe_(J,Q){let $=this._bindingsIndicesByPath,Z=$[J],W=this._bindings;if(Z!==void 0)return W[Z];let Y=this._paths,X=this._parsedPaths,K=this._objects,H=K.length,U=this.nCachedObjects_,G=Array(H);Z=W.length,$[J]=Z,Y.push(J),X.push(Q),W.push(G);for(let F=U,E=K.length;F!==E;++F){let O=K[F];G[F]=new GJ(O,J,Q)}return G}unsubscribe_(J){let Q=this._bindingsIndicesByPath,$=Q[J];if($!==void 0){let Z=this._paths,W=this._parsedPaths,Y=this._bindings,X=Y.length-1,K=Y[X],H=J[X];Q[H]=$,Y[$]=K,Y.pop(),W[$]=W[X],W.pop(),Z[$]=Z[X],Z.pop()}}}class cW{constructor(J,Q,$=null,Z=Q.blendMode){this._mixer=J,this._clip=Q,this._localRoot=$,this.blendMode=Z;let W=Q.tracks,Y=W.length,X=Array(Y),K={endingStart:2400,endingEnd:2400};for(let H=0;H!==Y;++H){let U=W[H].createInterpolant(null);if(X[H]=U,U.settings)Object.assign(K,U.settings);U.settings=K}this._interpolantSettings=K,this._interpolants=X,this._propertyBindings=Array(Y),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(J){return this._startTime=J,this}setLoop(J,Q){return this.loop=J,this.repetitions=Q,this}setEffectiveWeight(J){return this.weight=J,this._effectiveWeight=this.enabled?J:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(J){return this._scheduleFading(J,0,1)}fadeOut(J){return this._scheduleFading(J,1,0)}crossFadeFrom(J,Q,$=!1){if(J.fadeOut(Q),this.fadeIn(Q),$===!0){let Z=this._clip.duration,W=J._clip.duration,Y=W/Z,X=Z/W;J.warp(1,Y,Q),this.warp(X,1,Q)}return this}crossFadeTo(J,Q,$=!1){return J.crossFadeFrom(this,Q,$)}stopFading(){let J=this._weightInterpolant;if(J!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}setEffectiveTimeScale(J){return this.timeScale=J,this._effectiveTimeScale=this.paused?0:J,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(J){return this.timeScale=this._clip.duration/J,this.stopWarping()}syncWith(J){return this.time=J.time,this.timeScale=J.timeScale,this.stopWarping()}halt(J){return this.warp(this._effectiveTimeScale,0,J)}warp(J,Q,$){let Z=this._mixer,W=Z.time,Y=this.timeScale,X=this._timeScaleInterpolant;if(X===null)X=Z._lendControlInterpolant(),this._timeScaleInterpolant=X;let{parameterPositions:K,sampleValues:H}=X;return K[0]=W,K[1]=W+$,H[0]=J/Y,H[1]=Q/Y,this}stopWarping(){let J=this._timeScaleInterpolant;if(J!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(J,Q,$,Z){if(!this.enabled){this._updateWeight(J);return}let W=this._startTime;if(W!==null){let K=(J-W)*$;if(K<0||$===0)Q=0;else this._startTime=null,Q=$*K}Q*=this._updateTimeScale(J);let Y=this._updateTime(Q),X=this._updateWeight(J);if(X>0){let K=this._interpolants,H=this._propertyBindings;switch(this.blendMode){case 2501:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulateAdditive(X);break;case 2500:default:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulate(Z,X)}}}_updateWeight(J){let Q=0;if(this.enabled){Q=this.weight;let $=this._weightInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1]){if(this.stopFading(),Z===0)this.enabled=!1}}}return this._effectiveWeight=Q,Q}_updateTimeScale(J){let Q=0;if(!this.paused){Q=this.timeScale;let $=this._timeScaleInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1])if(this.stopWarping(),Q===0)this.paused=!0;else this.timeScale=Q}}return this._effectiveTimeScale=Q,Q}_updateTime(J){let Q=this._clip.duration,$=this.loop,Z=this.time+J,W=this._loopCount,Y=$===2202;if(J===0){if(W===-1)return Z;return Y&&(W&1)===1?Q-Z:Z}if($===2200){if(W===-1)this._loopCount=0,this._setEndings(!0,!0,!1);J:{if(Z>=Q)Z=Q;else if(Z<0)Z=0;else{this.time=Z;break J}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J<0?-1:1})}}else{if(W===-1)if(J>=0)W=0,this._setEndings(!0,this.repetitions===0,Y);else this._setEndings(this.repetitions===0,!0,Y);if(Z>=Q||Z<0){let X=Math.floor(Z/Q);Z-=Q*X,W+=Math.abs(X);let K=this.repetitions-W;if(K<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;Z=J>0?Q:0,this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J>0?1:-1})}else{if(K===1){let H=J<0;this._setEndings(H,!H,Y)}else this._setEndings(!1,!1,Y);this._loopCount=W,this.time=Z,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:X})}}else this._loopCount=W,this.time=Z;if(Y&&(W&1)===1)return Q-Z}return Z}_setEndings(J,Q,$){let Z=this._interpolantSettings;if($)Z.endingStart=2401,Z.endingEnd=2401;else{if(J)Z.endingStart=this.zeroSlopeAtStart?2401:2400;else Z.endingStart=2402;if(Q)Z.endingEnd=this.zeroSlopeAtEnd?2401:2400;else Z.endingEnd=2402}}_scheduleFading(J,Q,$){let Z=this._mixer,W=Z.time,Y=this._weightInterpolant;if(Y===null)Y=Z._lendControlInterpolant(),this._weightInterpolant=Y;let{parameterPositions:X,sampleValues:K}=Y;return X[0]=W,K[0]=Q,X[1]=W+J,K[1]=$,this}}var BN=new Float32Array(1);class D$ extends B9{constructor(J){super();if(this._root=J,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(J,Q){let $=J._localRoot||this._root,Z=J._clip.tracks,W=Z.length,Y=J._propertyBindings,X=J._interpolants,K=$.uuid,H=this._bindingsByRootAndName,U=H[K];if(U===void 0)U={},H[K]=U;for(let G=0;G!==W;++G){let F=Z[G],E=F.name,O=U[E];if(O!==void 0)++O.referenceCount,Y[G]=O;else{if(O=Y[G],O!==void 0){if(O._cacheIndex===null)++O.referenceCount,this._addInactiveBinding(O,K,E);continue}let R=Q&&Q._propertyBindings[G].binding.parsedPath;O=new lW(GJ.create($,E,R),F.ValueTypeName,F.getValueSize()),++O.referenceCount,this._addInactiveBinding(O,K,E),Y[G]=O}X[G].resultBuffer=O.buffer}}_activateAction(J){if(!this._isActiveAction(J)){if(J._cacheIndex===null){let $=(J._localRoot||this._root).uuid,Z=J._clip.uuid,W=this._actionsByClip[Z];this._bindAction(J,W&&W.knownActions[0]),this._addInactiveAction(J,Z,$)}let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(W.useCount++===0)this._lendBinding(W),W.saveOriginalState()}this._lendAction(J)}}_deactivateAction(J){if(this._isActiveAction(J)){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.useCount===0)W.restoreOriginalState(),this._takeBackBinding(W)}this._takeBackAction(J)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let J=this;this.stats={actions:{get total(){return J._actions.length},get inUse(){return J._nActiveActions}},bindings:{get total(){return J._bindings.length},get inUse(){return J._nActiveBindings}},controlInterpolants:{get total(){return J._controlInterpolants.length},get inUse(){return J._nActiveControlInterpolants}}}}_isActiveAction(J){let Q=J._cacheIndex;return Q!==null&&Q<this._nActiveActions}_addInactiveAction(J,Q,$){let Z=this._actions,W=this._actionsByClip,Y=W[Q];if(Y===void 0)Y={knownActions:[J],actionByRoot:{}},J._byClipCacheIndex=0,W[Q]=Y;else{let X=Y.knownActions;J._byClipCacheIndex=X.length,X.push(J)}J._cacheIndex=Z.length,Z.push(J),Y.actionByRoot[$]=J}_removeInactiveAction(J){let Q=this._actions,$=Q[Q.length-1],Z=J._cacheIndex;$._cacheIndex=Z,Q[Z]=$,Q.pop(),J._cacheIndex=null;let W=J._clip.uuid,Y=this._actionsByClip,X=Y[W],K=X.knownActions,H=K[K.length-1],U=J._byClipCacheIndex;H._byClipCacheIndex=U,K[U]=H,K.pop(),J._byClipCacheIndex=null;let G=X.actionByRoot,F=(J._localRoot||this._root).uuid;if(delete G[F],K.length===0)delete Y[W];this._removeInactiveBindingsForAction(J)}_removeInactiveBindingsForAction(J){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.referenceCount===0)this._removeInactiveBinding(W)}}_lendAction(J){let Q=this._actions,$=J._cacheIndex,Z=this._nActiveActions++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackAction(J){let Q=this._actions,$=J._cacheIndex,Z=--this._nActiveActions,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_addInactiveBinding(J,Q,$){let Z=this._bindingsByRootAndName,W=this._bindings,Y=Z[Q];if(Y===void 0)Y={},Z[Q]=Y;Y[$]=J,J._cacheIndex=W.length,W.push(J)}_removeInactiveBinding(J){let Q=this._bindings,$=J.binding,Z=$.rootNode.uuid,W=$.path,Y=this._bindingsByRootAndName,X=Y[Z],K=Q[Q.length-1],H=J._cacheIndex;if(K._cacheIndex=H,Q[H]=K,Q.pop(),delete X[W],Object.keys(X).length===0)delete Y[Z]}_lendBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=this._nActiveBindings++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=--this._nActiveBindings,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_lendControlInterpolant(){let J=this._controlInterpolants,Q=this._nActiveControlInterpolants++,$=J[Q];if($===void 0)$=new G$(new Float32Array(2),new Float32Array(2),1,BN),$.__cacheIndex=Q,J[Q]=$;return $}_takeBackControlInterpolant(J){let Q=this._controlInterpolants,$=J.__cacheIndex,Z=--this._nActiveControlInterpolants,W=Q[Z];J.__cacheIndex=Z,Q[Z]=J,W.__cacheIndex=$,Q[$]=W}clipAction(J,Q,$){let Z=Q||this._root,W=Z.uuid,Y=typeof J==="string"?I8.findByName(Z,J):J,X=Y!==null?Y.uuid:J,K=this._actionsByClip[X],H=null;if($===void 0)if(Y!==null)$=Y.blendMode;else $=2500;if(K!==void 0){let G=K.actionByRoot[W];if(G!==void 0&&G.blendMode===$)return G;if(H=K.knownActions[0],Y===null)Y=H._clip}if(Y===null)return null;let U=new cW(this,Y,Q,$);return this._bindAction(U,H),this._addInactiveAction(U,X,W),U}existingAction(J,Q){let $=Q||this._root,Z=$.uuid,W=typeof J==="string"?I8.findByName($,J):J,Y=W?W.uuid:J,X=this._actionsByClip[Y];if(X!==void 0)return X.actionByRoot[Z]||null;return null}stopAllAction(){let J=this._actions,Q=this._nActiveActions;for(let $=Q-1;$>=0;--$)J[$].stop();return this}update(J){J*=this.timeScale;let Q=this._actions,$=this._nActiveActions,Z=this.time+=J,W=Math.sign(J),Y=this._accuIndex^=1;for(let H=0;H!==$;++H)Q[H]._update(Z,J,W,Y);let X=this._bindings,K=this._nActiveBindings;for(let H=0;H!==K;++H)X[H].apply(Y);return this}setTime(J){this.time=0;for(let Q=0;Q<this._actions.length;Q++)this._actions[Q].time=0;return this.update(J)}getRoot(){return this._root}uncacheClip(J){let Q=this._actions,$=J.uuid,Z=this._actionsByClip,W=Z[$];if(W!==void 0){let Y=W.knownActions;for(let X=0,K=Y.length;X!==K;++X){let H=Y[X];this._deactivateAction(H);let U=H._cacheIndex,G=Q[Q.length-1];H._cacheIndex=null,H._byClipCacheIndex=null,G._cacheIndex=U,Q[U]=G,Q.pop(),this._removeInactiveBindingsForAction(H)}delete Z[$]}}uncacheRoot(J){let Q=J.uuid,$=this._actionsByClip;for(let Y in $){let X=$[Y].actionByRoot,K=X[Q];if(K!==void 0)this._deactivateAction(K),this._removeInactiveAction(K)}let Z=this._bindingsByRootAndName,W=Z[Q];if(W!==void 0)for(let Y in W){let X=W[Y];X.restoreOriginalState(),this._removeInactiveBinding(X)}}uncacheAction(J,Q){let $=this.existingAction(J,Q);if($!==null)this._deactivateAction($),this._removeInactiveAction($)}}class TK extends fQ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isRenderTarget3D=!0,this.depth=$,this.texture=new b7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}}class nW{constructor(J){this.value=J}clone(){return new nW(this.value.clone===void 0?this.value:this.value.clone())}}var CN=0;class SK extends B9{constructor(){super();this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:CN++}),this.name="",this.usage=35044,this.uniforms=[]}add(J){return this.uniforms.push(J),this}remove(J){let Q=this.uniforms.indexOf(J);if(Q!==-1)this.uniforms.splice(Q,1);return this}setName(J){return this.name=J,this}setUsage(J){return this.usage=J,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(J){this.name=J.name,this.usage=J.usage;let Q=J.uniforms;this.uniforms.length=0;for(let $=0,Z=Q.length;$<Z;$++){let W=Array.isArray(Q[$])?Q[$]:[Q[$]];for(let Y=0;Y<W.length;Y++)this.uniforms.push(W[Y].clone())}return this}clone(){return new this.constructor().copy(this)}}class jK extends P8{constructor(J,Q,$=1){super(J,Q);this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=$}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}clone(J){let Q=super.clone(J);return Q.meshPerAttribute=this.meshPerAttribute,Q}toJSON(J){let Q=super.toJSON(J);return Q.isInstancedInterleavedBuffer=!0,Q.meshPerAttribute=this.meshPerAttribute,Q}}class vK{constructor(J,Q,$,Z,W,Y=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=J,this.type=Q,this.itemSize=$,this.elementSize=Z,this.count=W,this.normalized=Y,this.version=0}set needsUpdate(J){if(J===!0)this.version++}setBuffer(J){return this.buffer=J,this}setType(J,Q){return this.type=J,this.elementSize=Q,this}setItemSize(J){return this.itemSize=J,this}setCount(J){return this.count=J,this}}var mU=new y0;class yK{constructor(J,Q,$=0,Z=1/0){this.ray=new Q6(J,Q),this.near=$,this.far=Z,this.camera=null,this.layers=new h7,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(J,Q){this.ray.set(J,Q)}setFromCamera(J,Q){if(Q.isPerspectiveCamera)this.ray.origin.setFromMatrixPosition(Q.matrixWorld),this.ray.direction.set(J.x,J.y,0.5).unproject(Q).sub(this.ray.origin).normalize(),this.camera=Q;else if(Q.isOrthographicCamera)this.ray.origin.set(J.x,J.y,(Q.near+Q.far)/(Q.near-Q.far)).unproject(Q),this.ray.direction.set(0,0,-1).transformDirection(Q.matrixWorld),this.camera=Q;else v0("Raycaster: Unsupported camera type: "+Q.type)}setFromXRController(J){return mU.identity().extractRotation(J.matrixWorld),this.ray.origin.setFromMatrixPosition(J.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(mU),this}intersectObject(J,Q=!0,$=[]){return ZX(J,this,$,Q),$.sort(lU),$}intersectObjects(J,Q=!0,$=[]){for(let Z=0,W=J.length;Z<W;Z++)ZX(J[Z],this,$,Q);return $.sort(lU),$}}function lU(J,Q){return J.distance-Q.distance}function ZX(J,Q,$,Z){let W=!0;if(J.layers.test(Q.layers)){if(J.raycast(Q,$)===!1)W=!1}if(W===!0&&Z===!0){let Y=J.children;for(let X=0,K=Y.length;X<K;X++)ZX(Y[X],Q,$,!0)}}class xK{constructor(J=!0){this.autoStart=J,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,O0("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let J=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let Q=performance.now();J=(Q-this.oldTime)/1000,this.oldTime=Q,this.elapsedTime+=J}return J}}class bK{constructor(J=1,Q=0,$=0){this.radius=J,this.phi=Q,this.theta=$}set(J,Q,$){return this.radius=J,this.phi=Q,this.theta=$,this}copy(J){return this.radius=J.radius,this.phi=J.phi,this.theta=J.theta,this}makeSafe(){return this.phi=s0(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){if(this.radius=Math.sqrt(J*J+Q*Q+$*$),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(J,$),this.phi=Math.acos(s0(Q/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class hK{constructor(J=1,Q=0,$=0){this.radius=J,this.theta=Q,this.y=$}set(J,Q,$){return this.radius=J,this.theta=Q,this.y=$,this}copy(J){return this.radius=J.radius,this.theta=J.theta,this.y=J.y,this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){return this.radius=Math.sqrt(J*J+$*$),this.theta=Math.atan2(J,$),this.y=Q,this}clone(){return new this.constructor().copy(this)}}class sW{static{sW.prototype.isMatrix2=!0}constructor(J,Q,$,Z){if(this.elements=[1,0,0,1],J!==void 0)this.set(J,Q,$,Z)}identity(){return this.set(1,0,0,1),this}fromArray(J,Q=0){for(let $=0;$<4;$++)this.elements[$]=J[$+Q];return this}set(J,Q,$,Z){let W=this.elements;return W[0]=J,W[2]=Q,W[1]=$,W[3]=Z,this}}var cU=new i;class fK{constructor(J=new i(1/0,1/0),Q=new i(-1/0,-1/0)){this.isBox2=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=cU.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(J){return this.isEmpty()?J.set(0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,cU).distanceTo(J)}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}}var nU=new A,OZ=new A,L7=new A,D7=new A,aY=new A,zN=new A,IN=new A;class gK{constructor(J=new A,Q=new A){this.start=J,this.end=Q}set(J,Q){return this.start.copy(J),this.end.copy(Q),this}copy(J){return this.start.copy(J.start),this.end.copy(J.end),this}getCenter(J){return J.addVectors(this.start,this.end).multiplyScalar(0.5)}delta(J){return J.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(J,Q){return this.delta(Q).multiplyScalar(J).add(this.start)}closestPointToPointParameter(J,Q){nU.subVectors(J,this.start),OZ.subVectors(this.end,this.start);let $=OZ.dot(OZ);if($===0)return 0;let W=OZ.dot(nU)/$;if(Q)W=s0(W,0,1);return W}closestPointToPoint(J,Q,$){let Z=this.closestPointToPointParameter(J,Q);return this.delta($).multiplyScalar(Z).add(this.start)}distanceSqToLine3(J,Q=zN,$=IN){let W,Y,X=this.start,K=J.start,H=this.end,U=J.end;L7.subVectors(H,X),D7.subVectors(U,K),aY.subVectors(X,K);let G=L7.dot(L7),F=D7.dot(D7),E=D7.dot(aY);if(G<=0.00000000000000010000000000000001&&F<=0.00000000000000010000000000000001)return Q.copy(X),$.copy(K),Q.sub($),Q.dot(Q);if(G<=0.00000000000000010000000000000001)W=0,Y=E/F,Y=s0(Y,0,1);else{let O=L7.dot(aY);if(F<=0.00000000000000010000000000000001)Y=0,W=s0(-O/G,0,1);else{let R=L7.dot(D7),M=G*F-R*R;if(M!==0)W=s0((R*E-O*F)/M,0,1);else W=0;if(Y=(R*W+E)/F,Y<0)Y=0,W=s0(-O/G,0,1);else if(Y>1)Y=1,W=s0((R-O)/G,0,1)}}return Q.copy(X).addScaledVector(L7,W),$.copy(K).addScaledVector(D7,Y),Q.distanceToSquared($)}applyMatrix4(J){return this.start.applyMatrix4(J),this.end.applyMatrix4(J),this}equals(J){return J.start.equals(this.start)&&J.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}var sU=new A;class pK extends HJ{constructor(J,Q){super();this.light=J,this.matrixAutoUpdate=!1,this.color=Q,this.type="SpotLightHelper";let $=new u0,Z=[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];for(let Y=0,X=1,K=32;Y<K;Y++,X++){let H=Y/K*Math.PI*2,U=X/K*Math.PI*2;Z.push(Math.cos(H),Math.sin(H),1,Math.cos(U),Math.sin(U),1)}$.setAttribute("position",new z0(Z,3));let W=new dJ({fog:!1,toneMapped:!1});this.cone=new O9($,W),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent)this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld);else this.matrix.copy(this.light.matrixWorld);this.matrixWorld.copy(this.light.matrixWorld);let J=this.light.distance?this.light.distance:1000,Q=J*Math.tan(this.light.angle);if(this.cone.scale.set(Q,Q,J),sU.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(sU),this.color!==void 0)this.cone.material.color.set(this.color);else this.cone.material.color.copy(this.light.color)}}var d8=new A,qZ=new y0,rY=new y0;class uK extends O9{constructor(J){let Q=I5(J),$=new u0,Z=[],W=[];for(let H=0;H<Q.length;H++){let U=Q[H];if(U.parent&&U.parent.isBone)Z.push(0,0,0),Z.push(0,0,0),W.push(0,0,0),W.push(0,0,0)}$.setAttribute("position",new z0(Z,3)),$.setAttribute("color",new z0(W,3));let Y=new dJ({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super($,Y);this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=J,this.bones=Q,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1;let X=new e(255),K=new e(65280);this.setColors(X,K)}updateMatrixWorld(J){let Q=this.bones,$=this.geometry,Z=$.getAttribute("position");rY.copy(this.root.matrixWorld).invert();for(let W=0,Y=0;W<Q.length;W++){let X=Q[W];if(X.parent&&X.parent.isBone)qZ.multiplyMatrices(rY,X.matrixWorld),d8.setFromMatrixPosition(qZ),Z.setXYZ(Y,d8.x,d8.y,d8.z),qZ.multiplyMatrices(rY,X.parent.matrixWorld),d8.setFromMatrixPosition(qZ),Z.setXYZ(Y+1,d8.x,d8.y,d8.z),Y+=2}$.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(J)}setColors(J,Q){let Z=this.geometry.getAttribute("color");for(let W=0;W<Z.count;W+=2)Z.setXYZ(W,J.r,J.g,J.b),Z.setXYZ(W+1,Q.r,Q.g,Q.b);return Z.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function I5(J){let Q=[];if(J.isBone===!0)Q.push(J);for(let $=0;$<J.children.length;$++)Q.push(...I5(J.children[$]));return Q}class dK extends a0{constructor(J,Q,$){let Z=new Z6(Q,4,2),W=new nJ({wireframe:!0,fog:!1,toneMapped:!1});super(Z,W);this.light=J,this.color=$,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.color!==void 0)this.material.color.set(this.color);else this.material.color.copy(this.light.color)}}var _N=new A,iU=new e,oU=new e;class mK extends HJ{constructor(J,Q,$){super();this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="HemisphereLightHelper";let Z=new c7(Q);if(Z.rotateY(Math.PI*0.5),this.material=new nJ({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0)this.material.vertexColors=!0;let W=Z.getAttribute("position"),Y=new Float32Array(W.count*3);Z.setAttribute("color",new i0(Y,3)),this.add(new a0(Z,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let J=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let Q=J.geometry.getAttribute("color");iU.copy(this.light.color),oU.copy(this.light.groundColor);for(let $=0,Z=Q.count;$<Z;$++){let W=$<Z/2?iU:oU;Q.setXYZ($,W.r,W.g,W.b)}Q.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),J.lookAt(_N.setFromMatrixPosition(this.light.matrixWorld).negate())}}class lK extends O9{constructor(J=10,Q=10,$=4473924,Z=8947848){$=new e($),Z=new e(Z);let W=Q/2,Y=J/Q,X=J/2,K=[],H=[];for(let F=0,E=0,O=-X;F<=Q;F++,O+=Y){K.push(-X,0,O,X,0,O),K.push(O,0,-X,O,0,X);let R=F===W?$:Z;R.toArray(H,E),E+=3,R.toArray(H,E),E+=3,R.toArray(H,E),E+=3,R.toArray(H,E),E+=3}let U=new u0;U.setAttribute("position",new z0(K,3)),U.setAttribute("color",new z0(H,3));let G=new dJ({vertexColors:!0,toneMapped:!1});super(U,G);this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class cK extends O9{constructor(J=10,Q=16,$=8,Z=64,W=4473924,Y=8947848){W=new e(W),Y=new e(Y);let X=[],K=[];if(Q>1)for(let G=0;G<Q;G++){let F=G/Q*(Math.PI*2),E=Math.sin(F)*J,O=Math.cos(F)*J;X.push(0,0,0),X.push(E,0,O);let R=G&1?W:Y;K.push(R.r,R.g,R.b),K.push(R.r,R.g,R.b)}for(let G=0;G<$;G++){let F=G&1?W:Y,E=J-J/$*G;for(let O=0;O<Z;O++){let R=O/Z*(Math.PI*2),M=Math.sin(R)*E,q=Math.cos(R)*E;X.push(M,0,q),K.push(F.r,F.g,F.b),R=(O+1)/Z*(Math.PI*2),M=Math.sin(R)*E,q=Math.cos(R)*E,X.push(M,0,q),K.push(F.r,F.g,F.b)}}let H=new u0;H.setAttribute("position",new z0(X,3)),H.setAttribute("color",new z0(K,3));let U=new dJ({vertexColors:!0,toneMapped:!1});super(H,U);this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}var aU=new A,RZ=new A,rU=new A;class nK extends HJ{constructor(J,Q,$){super();if(this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="DirectionalLightHelper",Q===void 0)Q=1;let Z=new u0;Z.setAttribute("position",new z0([-Q,Q,0,Q,Q,0,Q,-Q,0,-Q,-Q,0,-Q,Q,0],3));let W=new dJ({fog:!1,toneMapped:!1});this.lightPlane=new T9(Z,W),this.add(this.lightPlane),Z=new u0,Z.setAttribute("position",new z0([0,0,0,0,0,1],3)),this.targetLine=new T9(Z,W),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),aU.setFromMatrixPosition(this.light.matrixWorld),RZ.setFromMatrixPosition(this.light.target.matrixWorld),rU.subVectors(RZ,aU),this.lightPlane.lookAt(RZ),this.color!==void 0)this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color);else this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color);this.targetLine.lookAt(RZ),this.targetLine.scale.z=rU.length()}}var LZ=new A,TJ=new i7;class sK extends O9{constructor(J){let Q=new u0,$=new dJ({color:16777215,vertexColors:!0,toneMapped:!1}),Z=[],W=[],Y={};X("n1","n2"),X("n2","n4"),X("n4","n3"),X("n3","n1"),X("f1","f2"),X("f2","f4"),X("f4","f3"),X("f3","f1"),X("n1","f1"),X("n2","f2"),X("n3","f3"),X("n4","f4"),X("p","n1"),X("p","n2"),X("p","n3"),X("p","n4"),X("u1","u2"),X("u2","u3"),X("u3","u1"),X("c","t"),X("p","c"),X("cn1","cn2"),X("cn3","cn4"),X("cf1","cf2"),X("cf3","cf4");function X(O,R){K(O),K(R)}function K(O){if(Z.push(0,0,0),W.push(0,0,0),Y[O]===void 0)Y[O]=[];Y[O].push(Z.length/3-1)}Q.setAttribute("position",new z0(Z,3)),Q.setAttribute("color",new z0(W,3));super(Q,$);if(this.type="CameraHelper",this.camera=J,this.camera.updateProjectionMatrix)this.camera.updateProjectionMatrix();this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=Y,this.update();let H=new e(16755200),U=new e(16711680),G=new e(43775),F=new e(16777215),E=new e(3355443);this.setColors(H,U,G,F,E)}setColors(J,Q,$,Z,W){let X=this.geometry.getAttribute("color");return X.setXYZ(0,J.r,J.g,J.b),X.setXYZ(1,J.r,J.g,J.b),X.setXYZ(2,J.r,J.g,J.b),X.setXYZ(3,J.r,J.g,J.b),X.setXYZ(4,J.r,J.g,J.b),X.setXYZ(5,J.r,J.g,J.b),X.setXYZ(6,J.r,J.g,J.b),X.setXYZ(7,J.r,J.g,J.b),X.setXYZ(8,J.r,J.g,J.b),X.setXYZ(9,J.r,J.g,J.b),X.setXYZ(10,J.r,J.g,J.b),X.setXYZ(11,J.r,J.g,J.b),X.setXYZ(12,J.r,J.g,J.b),X.setXYZ(13,J.r,J.g,J.b),X.setXYZ(14,J.r,J.g,J.b),X.setXYZ(15,J.r,J.g,J.b),X.setXYZ(16,J.r,J.g,J.b),X.setXYZ(17,J.r,J.g,J.b),X.setXYZ(18,J.r,J.g,J.b),X.setXYZ(19,J.r,J.g,J.b),X.setXYZ(20,J.r,J.g,J.b),X.setXYZ(21,J.r,J.g,J.b),X.setXYZ(22,J.r,J.g,J.b),X.setXYZ(23,J.r,J.g,J.b),X.setXYZ(24,Q.r,Q.g,Q.b),X.setXYZ(25,Q.r,Q.g,Q.b),X.setXYZ(26,Q.r,Q.g,Q.b),X.setXYZ(27,Q.r,Q.g,Q.b),X.setXYZ(28,Q.r,Q.g,Q.b),X.setXYZ(29,Q.r,Q.g,Q.b),X.setXYZ(30,Q.r,Q.g,Q.b),X.setXYZ(31,Q.r,Q.g,Q.b),X.setXYZ(32,$.r,$.g,$.b),X.setXYZ(33,$.r,$.g,$.b),X.setXYZ(34,$.r,$.g,$.b),X.setXYZ(35,$.r,$.g,$.b),X.setXYZ(36,$.r,$.g,$.b),X.setXYZ(37,$.r,$.g,$.b),X.setXYZ(38,Z.r,Z.g,Z.b),X.setXYZ(39,Z.r,Z.g,Z.b),X.setXYZ(40,W.r,W.g,W.b),X.setXYZ(41,W.r,W.g,W.b),X.setXYZ(42,W.r,W.g,W.b),X.setXYZ(43,W.r,W.g,W.b),X.setXYZ(44,W.r,W.g,W.b),X.setXYZ(45,W.r,W.g,W.b),X.setXYZ(46,W.r,W.g,W.b),X.setXYZ(47,W.r,W.g,W.b),X.setXYZ(48,W.r,W.g,W.b),X.setXYZ(49,W.r,W.g,W.b),X.needsUpdate=!0,this}update(){let J=this.geometry,Q=this.pointMap,$=1,Z=1,W,Y;if(TJ.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)W=1,Y=0;else if(this.camera.coordinateSystem===2000)W=-1,Y=1;else if(this.camera.coordinateSystem===2001)W=0,Y=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);bJ("c",Q,J,TJ,0,0,W),bJ("t",Q,J,TJ,0,0,Y),bJ("n1",Q,J,TJ,-1,-1,W),bJ("n2",Q,J,TJ,1,-1,W),bJ("n3",Q,J,TJ,-1,1,W),bJ("n4",Q,J,TJ,1,1,W),bJ("f1",Q,J,TJ,-1,-1,Y),bJ("f2",Q,J,TJ,1,-1,Y),bJ("f3",Q,J,TJ,-1,1,Y),bJ("f4",Q,J,TJ,1,1,Y),bJ("u1",Q,J,TJ,0.7,1.1,W),bJ("u2",Q,J,TJ,-0.7,1.1,W),bJ("u3",Q,J,TJ,0,2,W),bJ("cf1",Q,J,TJ,-1,0,Y),bJ("cf2",Q,J,TJ,1,0,Y),bJ("cf3",Q,J,TJ,0,-1,Y),bJ("cf4",Q,J,TJ,0,1,Y),bJ("cn1",Q,J,TJ,-1,0,W),bJ("cn2",Q,J,TJ,1,0,W),bJ("cn3",Q,J,TJ,0,-1,W),bJ("cn4",Q,J,TJ,0,1,W),J.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function bJ(J,Q,$,Z,W,Y,X){LZ.set(W,Y,X).unproject(Z);let K=Q[J];if(K!==void 0){let H=$.getAttribute("position");for(let U=0,G=K.length;U<G;U++)H.setXYZ(K[U],LZ.x,LZ.y,LZ.z)}}var DZ=new SJ;class iK extends O9{constructor(J,Q=16776960){let $=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]),Z=new Float32Array(24),W=new u0;W.setIndex(new i0($,1)),W.setAttribute("position",new i0(Z,3));super(W,new dJ({color:Q,toneMapped:!1}));this.object=J,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0)DZ.setFromObject(this.object);if(DZ.isEmpty())return;let{min:J,max:Q}=DZ,$=this.geometry.attributes.position,Z=$.array;Z[0]=Q.x,Z[1]=Q.y,Z[2]=Q.z,Z[3]=J.x,Z[4]=Q.y,Z[5]=Q.z,Z[6]=J.x,Z[7]=J.y,Z[8]=Q.z,Z[9]=Q.x,Z[10]=J.y,Z[11]=Q.z,Z[12]=Q.x,Z[13]=Q.y,Z[14]=J.z,Z[15]=J.x,Z[16]=Q.y,Z[17]=J.z,Z[18]=J.x,Z[19]=J.y,Z[20]=J.z,Z[21]=Q.x,Z[22]=J.y,Z[23]=J.z,$.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(J){return this.object=J,this.update(),this}copy(J,Q){return super.copy(J,Q),this.object=J.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oK extends O9{constructor(J,Q=16776960){let $=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]),Z=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],W=new u0;W.setIndex(new i0($,1)),W.setAttribute("position",new z0(Z,3));super(W,new dJ({color:Q,toneMapped:!1}));this.box=J,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(J){let Q=this.box;if(Q.isEmpty())return;Q.getCenter(this.position),Q.getSize(this.scale),this.scale.multiplyScalar(0.5),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose()}}class aK extends T9{constructor(J,Q=1,$=16776960){let Z=$,W=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],Y=new u0;Y.setAttribute("position",new z0(W,3)),Y.computeBoundingSphere();super(Y,new dJ({color:Z,toneMapped:!1}));this.type="PlaneHelper",this.plane=J,this.size=Q;let X=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],K=new u0;K.setAttribute("position",new z0(X,3)),K.computeBoundingSphere(),this.add(new a0(K,new nJ({color:Z,opacity:0.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(J){this.position.set(0,0,0),this.scale.set(0.5*this.size,0.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}var tU=new A,MZ,tY;class rK extends HJ{constructor(J=new A(0,0,1),Q=new A(0,0,0),$=1,Z=16776960,W=$*0.2,Y=W*0.2){super();if(this.type="ArrowHelper",MZ===void 0)MZ=new u0,MZ.setAttribute("position",new z0([0,0,0,0,1,0],3)),tY=new d7(0.5,1,5,1),tY.translate(0,-0.5,0);this.position.copy(Q),this.line=new T9(MZ,new dJ({color:Z,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new a0(tY,new nJ({color:Z,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(J),this.setLength($,W,Y)}setDirection(J){if(J.y>0.99999)this.quaternion.set(0,0,0,1);else if(J.y<-0.99999)this.quaternion.set(1,0,0,0);else{tU.set(J.z,0,-J.x).normalize();let Q=Math.acos(J.y);this.quaternion.setFromAxisAngle(tU,Q)}}setLength(J,Q=J*0.2,$=Q*0.2){this.line.scale.set(1,Math.max(0.0001,J-Q),1),this.line.updateMatrix(),this.cone.scale.set($,Q,$),this.cone.position.y=J,this.cone.updateMatrix()}setColor(J){this.line.material.color.set(J),this.cone.material.color.set(J)}copy(J){return super.copy(J,!1),this.line.copy(J.line),this.cone.copy(J.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class tK extends O9{constructor(J=1){let Q=[0,0,0,J,0,0,0,0,0,0,J,0,0,0,0,0,0,J],$=[1,0,0,1,0.6,0,0,1,0,0.6,1,0,0,0,1,0,0.6,1],Z=new u0;Z.setAttribute("position",new z0(Q,3)),Z.setAttribute("color",new z0($,3));let W=new dJ({vertexColors:!0,toneMapped:!1});super(Z,W);this.type="AxesHelper"}setColors(J,Q,$){let Z=new e,W=this.geometry.attributes.color.array;return Z.set(J),Z.toArray(W,0),Z.toArray(W,3),Z.set(Q),Z.toArray(W,6),Z.toArray(W,9),Z.set($),Z.toArray(W,12),Z.toArray(W,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class eK{constructor(){this.type="ShapePath",this.color=new e,this.subPaths=[],this.currentPath=null}moveTo(J,Q){return this.currentPath=new C7,this.subPaths.push(this.currentPath),this.currentPath.moveTo(J,Q),this}lineTo(J,Q){return this.currentPath.lineTo(J,Q),this}quadraticCurveTo(J,Q,$,Z){return this.currentPath.quadraticCurveTo(J,Q,$,Z),this}bezierCurveTo(J,Q,$,Z,W,Y){return this.currentPath.bezierCurveTo(J,Q,$,Z,W,Y),this}splineThru(J){return this.currentPath.splineThru(J),this}toShapes(J){function Q(q){let N=[];for(let L=0,D=q.length;L<D;L++){let V=q[L],z=new z8;z.curves=V.curves,N.push(z)}return N}function $(q,N){let L=N.length,D=!1;for(let V=L-1,z=0;z<L;V=z++){let I=N[V],B=N[z],k=B.x-I.x,C=B.y-I.y;if(Math.abs(C)>Number.EPSILON){if(C<0)I=N[z],k=-k,B=N[V],C=-C;if(q.y<I.y||q.y>B.y)continue;if(q.y===I.y){if(q.x===I.x)return!0}else{let j=C*(q.x-I.x)-k*(q.y-I.y);if(j===0)return!0;if(j<0)continue;D=!D}}else{if(q.y!==I.y)continue;if(B.x<=q.x&&q.x<=I.x||I.x<=q.x&&q.x<=B.x)return!0}}return D}let Z=P9.isClockWise,W=this.subPaths;if(W.length===0)return[];let Y,X,K,H=[];if(W.length===1)return X=W[0],K=new z8,K.curves=X.curves,H.push(K),H;let U=!Z(W[0].getPoints());U=J?!U:U;let G=[],F=[],E=[],O=0,R;F[O]=void 0,E[O]=[];for(let q=0,N=W.length;q<N;q++)if(X=W[q],R=X.getPoints(),Y=Z(R),Y=J?!Y:Y,Y){if(!U&&F[O])O++;if(F[O]={s:new z8,p:R},F[O].s.curves=X.curves,U)O++;E[O]=[]}else E[O].push({h:X,p:R[0]});if(!F[0])return Q(W);if(F.length>1){let q=!1,N=0;for(let L=0,D=F.length;L<D;L++)G[L]=[];for(let L=0,D=F.length;L<D;L++){let V=E[L];for(let z=0;z<V.length;z++){let I=V[z],B=!0;for(let k=0;k<F.length;k++)if($(I.p,F[k].p)){if(L!==k)N++;if(B)B=!1,G[k].push(I);else q=!0}if(B)G[L].push(I)}}if(N>0&&q===!1)E=G}let M;for(let q=0,N=F.length;q<N;q++){K=F[q].s,H.push(K),M=E[q];for(let L=0,D=M.length;L<D;L++)K.holes.push(M[L].h)}return H}}class JH extends B9{constructor(J,Q=null){super();this.object=J,this.domElement=Q,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(J){if(J===void 0){O0("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=J}disconnect(){}dispose(){}update(){}}function wN(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;else J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;return J}function PN(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;else J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;return J}function AN(J){return J.repeat.x=1,J.repeat.y=1,J.offset.x=0,J.offset.y=0,J}function iW(J,Q,$,Z){let W=TN(Z);switch($){case 1021:return J*Q;case 1028:return J*Q/W.components*W.byteLength;case 1029:return J*Q/W.components*W.byteLength;case 1030:return J*Q*2/W.components*W.byteLength;case 1031:return J*Q*2/W.components*W.byteLength;case 1022:return J*Q*3/W.components*W.byteLength;case 1023:return J*Q*4/W.components*W.byteLength;case 1033:return J*Q*4/W.components*W.byteLength;case 33776:case 33777:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 33778:case 33779:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 35841:case 35843:return Math.max(J,16)*Math.max(Q,8)/4;case 35840:case 35842:return Math.max(J,8)*Math.max(Q,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37808:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37809:return Math.floor((J+4)/5)*Math.floor((Q+3)/4)*16;case 37810:return Math.floor((J+4)/5)*Math.floor((Q+4)/5)*16;case 37811:return Math.floor((J+5)/6)*Math.floor((Q+4)/5)*16;case 37812:return Math.floor((J+5)/6)*Math.floor((Q+5)/6)*16;case 37813:return Math.floor((J+7)/8)*Math.floor((Q+4)/5)*16;case 37814:return Math.floor((J+7)/8)*Math.floor((Q+5)/6)*16;case 37815:return Math.floor((J+7)/8)*Math.floor((Q+7)/8)*16;case 37816:return Math.floor((J+9)/10)*Math.floor((Q+4)/5)*16;case 37817:return Math.floor((J+9)/10)*Math.floor((Q+5)/6)*16;case 37818:return Math.floor((J+9)/10)*Math.floor((Q+7)/8)*16;case 37819:return Math.floor((J+9)/10)*Math.floor((Q+9)/10)*16;case 37820:return Math.floor((J+11)/12)*Math.floor((Q+9)/10)*16;case 37821:return Math.floor((J+11)/12)*Math.floor((Q+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(J/4)*Math.ceil(Q/4)*16;case 36283:case 36284:return Math.ceil(J/4)*Math.ceil(Q/4)*8;case 36285:case 36286:return Math.ceil(J/4)*Math.ceil(Q/4)*16}throw Error(`Unable to determine texture byte length for ${$} format.`)}function TN(J){switch(J){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${J}.`)}class QH{static contain(J,Q){return wN(J,Q)}static cover(J,Q){return PN(J,Q)}static fill(J){return AN(J)}static getByteLength(J,Q,$,Z){return iW(J,Q,$,Z)}}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));if(typeof window<"u")if(window.__THREE__)O0("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="184";function i5(){let J=null,Q=!1,$=null,Z=null;function W(Y,X){$(Y,X),Z=J.requestAnimationFrame(W)}return{start:function(){if(Q===!0)return;if($===null)return;if(J===null)return;Z=J.requestAnimationFrame(W),Q=!0},stop:function(){if(J!==null)J.cancelAnimationFrame(Z);Q=!1},setAnimationLoop:function(Y){$=Y},setContext:function(Y){J=Y}}}function SN(J){let Q=new WeakMap;function $(K,H){let{array:U,usage:G}=K,F=U.byteLength,E=J.createBuffer();J.bindBuffer(H,E),J.bufferData(H,U,G),K.onUploadCallback();let O;if(U instanceof Float32Array)O=J.FLOAT;else if(typeof Float16Array<"u"&&U instanceof Float16Array)O=J.HALF_FLOAT;else if(U instanceof Uint16Array)if(K.isFloat16BufferAttribute)O=J.HALF_FLOAT;else O=J.UNSIGNED_SHORT;else if(U instanceof Int16Array)O=J.SHORT;else if(U instanceof Uint32Array)O=J.UNSIGNED_INT;else if(U instanceof Int32Array)O=J.INT;else if(U instanceof Int8Array)O=J.BYTE;else if(U instanceof Uint8Array)O=J.UNSIGNED_BYTE;else if(U instanceof Uint8ClampedArray)O=J.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+U);return{buffer:E,type:O,bytesPerElement:U.BYTES_PER_ELEMENT,version:K.version,size:F}}function Z(K,H,U){let{array:G,updateRanges:F}=H;if(J.bindBuffer(U,K),F.length===0)J.bufferSubData(U,0,G);else{F.sort((O,R)=>O.start-R.start);let E=0;for(let O=1;O<F.length;O++){let R=F[E],M=F[O];if(M.start<=R.start+R.count+1)R.count=Math.max(R.count,M.start+M.count-R.start);else++E,F[E]=M}F.length=E+1;for(let O=0,R=F.length;O<R;O++){let M=F[O];J.bufferSubData(U,M.start*G.BYTES_PER_ELEMENT,G,M.start,M.count)}H.clearUpdateRanges()}H.onUploadCallback()}function W(K){if(K.isInterleavedBufferAttribute)K=K.data;return Q.get(K)}function Y(K){if(K.isInterleavedBufferAttribute)K=K.data;let H=Q.get(K);if(H)J.deleteBuffer(H.buffer),Q.delete(K)}function X(K,H){if(K.isInterleavedBufferAttribute)K=K.data;if(K.isGLBufferAttribute){let G=Q.get(K);if(!G||G.version<K.version)Q.set(K,{buffer:K.buffer,type:K.type,bytesPerElement:K.elementSize,version:K.version});return}let U=Q.get(K);if(U===void 0)Q.set(K,$(K,H));else if(U.version<K.version){if(U.size!==K.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");Z(U.buffer,K,H),U.version=K.version}}return{get:W,remove:Y,update:X}}var jN=`#ifdef USE_ALPHAHASH
6
6
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
- #endif`,xU=`#ifdef USE_ALPHAHASH
7
+ #endif`,vN=`#ifdef USE_ALPHAHASH
8
8
  const float ALPHA_HASH_SCALE = 0.05;
9
9
  float hash2D( vec2 value ) {
10
10
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -39,20 +39,20 @@ var LY="184";var DY=0,T$=1,kY=2;var n6=1,MY=2,G6=3,A9=0,yJ=1,sJ=2,H9=0,w8=1,P8=2
39
39
  : cases.z;
40
40
  return clamp( threshold , 1.0e-6, 1.0 );
41
41
  }
42
- #endif`,bU=`#ifdef USE_ALPHAMAP
42
+ #endif`,yN=`#ifdef USE_ALPHAMAP
43
43
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44
- #endif`,hU=`#ifdef USE_ALPHAMAP
44
+ #endif`,xN=`#ifdef USE_ALPHAMAP
45
45
  uniform sampler2D alphaMap;
46
- #endif`,fU=`#ifdef USE_ALPHATEST
46
+ #endif`,bN=`#ifdef USE_ALPHATEST
47
47
  #ifdef ALPHA_TO_COVERAGE
48
48
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49
49
  if ( diffuseColor.a == 0.0 ) discard;
50
50
  #else
51
51
  if ( diffuseColor.a < alphaTest ) discard;
52
52
  #endif
53
- #endif`,gU=`#ifdef USE_ALPHATEST
53
+ #endif`,hN=`#ifdef USE_ALPHATEST
54
54
  uniform float alphaTest;
55
- #endif`,pU=`#ifdef USE_AOMAP
55
+ #endif`,fN=`#ifdef USE_AOMAP
56
56
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57
57
  reflectedLight.indirectDiffuse *= ambientOcclusion;
58
58
  #if defined( USE_CLEARCOAT )
@@ -65,10 +65,10 @@ var LY="184";var DY=0,T$=1,kY=2;var n6=1,MY=2,G6=3,A9=0,yJ=1,sJ=2,H9=0,w8=1,P8=2
65
65
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66
66
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67
67
  #endif
68
- #endif`,uU=`#ifdef USE_AOMAP
68
+ #endif`,gN=`#ifdef USE_AOMAP
69
69
  uniform sampler2D aoMap;
70
70
  uniform float aoMapIntensity;
71
- #endif`,dU=`#ifdef USE_BATCHING
71
+ #endif`,pN=`#ifdef USE_BATCHING
72
72
  #if ! defined( GL_ANGLE_multi_draw )
73
73
  #define gl_DrawID _gl_DrawID
74
74
  uniform int _gl_DrawID;
@@ -102,15 +102,15 @@ var LY="184";var DY=0,T$=1,kY=2;var n6=1,MY=2,G6=3,A9=0,yJ=1,sJ=2,H9=0,w8=1,P8=2
102
102
  int y = j / size;
103
103
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104
104
  }
105
- #endif`,mU=`#ifdef USE_BATCHING
105
+ #endif`,uN=`#ifdef USE_BATCHING
106
106
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107
- #endif`,lU=`vec3 transformed = vec3( position );
107
+ #endif`,dN=`vec3 transformed = vec3( position );
108
108
  #ifdef USE_ALPHAHASH
109
109
  vPosition = vec3( position );
110
- #endif`,cU=`vec3 objectNormal = vec3( normal );
110
+ #endif`,mN=`vec3 objectNormal = vec3( normal );
111
111
  #ifdef USE_TANGENT
112
112
  vec3 objectTangent = vec3( tangent.xyz );
113
- #endif`,nU=`float G_BlinnPhong_Implicit( ) {
113
+ #endif`,lN=`float G_BlinnPhong_Implicit( ) {
114
114
  return 0.25;
115
115
  }
116
116
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -124,7 +124,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
124
124
  float G = G_BlinnPhong_Implicit( );
125
125
  float D = D_BlinnPhong( shininess, dotNH );
126
126
  return F * ( G * D );
127
- } // validated`,sU=`#ifdef USE_IRIDESCENCE
127
+ } // validated`,cN=`#ifdef USE_IRIDESCENCE
128
128
  const mat3 XYZ_TO_REC709 = mat3(
129
129
  3.2404542, -0.9692660, 0.0556434,
130
130
  -1.5371385, 1.8760108, -0.2040259,
@@ -187,7 +187,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
187
187
  }
188
188
  return max( I, vec3( 0.0 ) );
189
189
  }
190
- #endif`,iU=`#ifdef USE_BUMPMAP
190
+ #endif`,nN=`#ifdef USE_BUMPMAP
191
191
  uniform sampler2D bumpMap;
192
192
  uniform float bumpScale;
193
193
  vec2 dHdxy_fwd() {
@@ -208,7 +208,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
208
208
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209
209
  return normalize( abs( fDet ) * surf_norm - vGrad );
210
210
  }
211
- #endif`,oU=`#if NUM_CLIPPING_PLANES > 0
211
+ #endif`,sN=`#if NUM_CLIPPING_PLANES > 0
212
212
  vec4 plane;
213
213
  #ifdef ALPHA_TO_COVERAGE
214
214
  float distanceToPlane, distanceGradient;
@@ -254,20 +254,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
254
254
  if ( clipped ) discard;
255
255
  #endif
256
256
  #endif
257
- #endif`,aU=`#if NUM_CLIPPING_PLANES > 0
257
+ #endif`,iN=`#if NUM_CLIPPING_PLANES > 0
258
258
  varying vec3 vClipPosition;
259
259
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260
- #endif`,rU=`#if NUM_CLIPPING_PLANES > 0
260
+ #endif`,oN=`#if NUM_CLIPPING_PLANES > 0
261
261
  varying vec3 vClipPosition;
262
- #endif`,tU=`#if NUM_CLIPPING_PLANES > 0
262
+ #endif`,aN=`#if NUM_CLIPPING_PLANES > 0
263
263
  vClipPosition = - mvPosition.xyz;
264
- #endif`,eU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
264
+ #endif`,rN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265
265
  diffuseColor *= vColor;
266
- #endif`,JG=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
266
+ #endif`,tN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267
267
  varying vec4 vColor;
268
- #endif`,QG=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
268
+ #endif`,eN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269
269
  varying vec4 vColor;
270
- #endif`,$G=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
270
+ #endif`,JO=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
271
271
  vColor = vec4( 1.0 );
272
272
  #endif
273
273
  #ifdef USE_COLOR_ALPHA
@@ -280,7 +280,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
280
280
  #endif
281
281
  #ifdef USE_BATCHING_COLOR
282
282
  vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
283
- #endif`,ZG=`#define PI 3.141592653589793
283
+ #endif`,QO=`#define PI 3.141592653589793
284
284
  #define PI2 6.283185307179586
285
285
  #define PI_HALF 1.5707963267948966
286
286
  #define RECIPROCAL_PI 0.3183098861837907
@@ -347,7 +347,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
347
347
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
348
348
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349
349
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350
- } // validated`,WG=`#ifdef ENVMAP_TYPE_CUBE_UV
350
+ } // validated`,$O=`#ifdef ENVMAP_TYPE_CUBE_UV
351
351
  #define cubeUV_minMipLevel 4.0
352
352
  #define cubeUV_minTileSize 16.0
353
353
  float getFace( vec3 direction ) {
@@ -440,7 +440,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
440
440
  return vec4( mix( color0, color1, mipF ), 1.0 );
441
441
  }
442
442
  }
443
- #endif`,YG=`vec3 transformedNormal = objectNormal;
443
+ #endif`,ZO=`vec3 transformedNormal = objectNormal;
444
444
  #ifdef USE_TANGENT
445
445
  vec3 transformedTangent = objectTangent;
446
446
  #endif
@@ -469,21 +469,21 @@ transformedNormal = normalMatrix * transformedNormal;
469
469
  #ifdef FLIP_SIDED
470
470
  transformedTangent = - transformedTangent;
471
471
  #endif
472
- #endif`,XG=`#ifdef USE_DISPLACEMENTMAP
472
+ #endif`,WO=`#ifdef USE_DISPLACEMENTMAP
473
473
  uniform sampler2D displacementMap;
474
474
  uniform float displacementScale;
475
475
  uniform float displacementBias;
476
- #endif`,KG=`#ifdef USE_DISPLACEMENTMAP
476
+ #endif`,YO=`#ifdef USE_DISPLACEMENTMAP
477
477
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
478
- #endif`,HG=`#ifdef USE_EMISSIVEMAP
478
+ #endif`,XO=`#ifdef USE_EMISSIVEMAP
479
479
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
480
480
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
481
481
  emissiveColor = sRGBTransferEOTF( emissiveColor );
482
482
  #endif
483
483
  totalEmissiveRadiance *= emissiveColor.rgb;
484
- #endif`,UG=`#ifdef USE_EMISSIVEMAP
484
+ #endif`,KO=`#ifdef USE_EMISSIVEMAP
485
485
  uniform sampler2D emissiveMap;
486
- #endif`,GG="gl_FragColor = linearToOutputTexel( gl_FragColor );",EG=`vec4 LinearTransferOETF( in vec4 value ) {
486
+ #endif`,HO="gl_FragColor = linearToOutputTexel( gl_FragColor );",UO=`vec4 LinearTransferOETF( in vec4 value ) {
487
487
  return value;
488
488
  }
489
489
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -491,7 +491,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
491
491
  }
492
492
  vec4 sRGBTransferOETF( in vec4 value ) {
493
493
  return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
494
- }`,FG=`#ifdef USE_ENVMAP
494
+ }`,GO=`#ifdef USE_ENVMAP
495
495
  #ifdef ENV_WORLDPOS
496
496
  vec3 cameraToFrag;
497
497
  if ( isOrthographic ) {
@@ -518,7 +518,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
518
518
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
519
519
  #endif
520
520
  #endif
521
- #endif`,NG=`#ifdef USE_ENVMAP
521
+ #endif`,EO=`#ifdef USE_ENVMAP
522
522
  uniform float envMapIntensity;
523
523
  uniform mat3 envMapRotation;
524
524
  #ifdef ENVMAP_TYPE_CUBE
@@ -526,7 +526,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
526
526
  #else
527
527
  uniform sampler2D envMap;
528
528
  #endif
529
- #endif`,OG=`#ifdef USE_ENVMAP
529
+ #endif`,FO=`#ifdef USE_ENVMAP
530
530
  uniform float reflectivity;
531
531
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
532
532
  #define ENV_WORLDPOS
@@ -537,7 +537,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
537
537
  #else
538
538
  varying vec3 vReflect;
539
539
  #endif
540
- #endif`,qG=`#ifdef USE_ENVMAP
540
+ #endif`,NO=`#ifdef USE_ENVMAP
541
541
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
542
542
  #define ENV_WORLDPOS
543
543
  #endif
@@ -548,7 +548,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
548
548
  varying vec3 vReflect;
549
549
  uniform float refractionRatio;
550
550
  #endif
551
- #endif`,RG=`#ifdef USE_ENVMAP
551
+ #endif`,OO=`#ifdef USE_ENVMAP
552
552
  #ifdef ENV_WORLDPOS
553
553
  vWorldPosition = worldPosition.xyz;
554
554
  #else
@@ -565,18 +565,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
565
565
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
566
566
  #endif
567
567
  #endif
568
- #endif`,LG=`#ifdef USE_FOG
568
+ #endif`,qO=`#ifdef USE_FOG
569
569
  vFogDepth = - mvPosition.z;
570
- #endif`,DG=`#ifdef USE_FOG
570
+ #endif`,RO=`#ifdef USE_FOG
571
571
  varying float vFogDepth;
572
- #endif`,kG=`#ifdef USE_FOG
572
+ #endif`,LO=`#ifdef USE_FOG
573
573
  #ifdef FOG_EXP2
574
574
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
575
575
  #else
576
576
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
577
577
  #endif
578
578
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
579
- #endif`,MG=`#ifdef USE_FOG
579
+ #endif`,DO=`#ifdef USE_FOG
580
580
  uniform vec3 fogColor;
581
581
  varying float vFogDepth;
582
582
  #ifdef FOG_EXP2
@@ -585,7 +585,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
585
585
  uniform float fogNear;
586
586
  uniform float fogFar;
587
587
  #endif
588
- #endif`,VG=`#ifdef USE_GRADIENTMAP
588
+ #endif`,MO=`#ifdef USE_GRADIENTMAP
589
589
  uniform sampler2D gradientMap;
590
590
  #endif
591
591
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -597,12 +597,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
597
597
  vec2 fw = fwidth( coord ) * 0.5;
598
598
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
599
599
  #endif
600
- }`,BG=`#ifdef USE_LIGHTMAP
600
+ }`,kO=`#ifdef USE_LIGHTMAP
601
601
  uniform sampler2D lightMap;
602
602
  uniform float lightMapIntensity;
603
- #endif`,CG=`LambertMaterial material;
603
+ #endif`,VO=`LambertMaterial material;
604
604
  material.diffuseColor = diffuseColor.rgb;
605
- material.specularStrength = specularStrength;`,IG=`varying vec3 vViewPosition;
605
+ material.specularStrength = specularStrength;`,BO=`varying vec3 vViewPosition;
606
606
  struct LambertMaterial {
607
607
  vec3 diffuseColor;
608
608
  float specularStrength;
@@ -616,7 +616,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
616
616
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
617
617
  }
618
618
  #define RE_Direct RE_Direct_Lambert
619
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,zG=`uniform bool receiveShadow;
619
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,CO=`uniform bool receiveShadow;
620
620
  uniform vec3 ambientLightColor;
621
621
  #if defined( USE_LIGHT_PROBES )
622
622
  uniform vec3 lightProbe[ 9 ];
@@ -733,7 +733,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
733
733
  return irradiance;
734
734
  }
735
735
  #endif
736
- #include <lightprobes_pars_fragment>`,_G=`#ifdef USE_ENVMAP
736
+ #include <lightprobes_pars_fragment>`,zO=`#ifdef USE_ENVMAP
737
737
  vec3 getIBLIrradiance( const in vec3 normal ) {
738
738
  #ifdef ENVMAP_TYPE_CUBE_UV
739
739
  vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -766,8 +766,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
766
766
  #endif
767
767
  }
768
768
  #endif
769
- #endif`,wG=`ToonMaterial material;
770
- material.diffuseColor = diffuseColor.rgb;`,PG=`varying vec3 vViewPosition;
769
+ #endif`,IO=`ToonMaterial material;
770
+ material.diffuseColor = diffuseColor.rgb;`,_O=`varying vec3 vViewPosition;
771
771
  struct ToonMaterial {
772
772
  vec3 diffuseColor;
773
773
  };
@@ -779,11 +779,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
779
779
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
780
780
  }
781
781
  #define RE_Direct RE_Direct_Toon
782
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,TG=`BlinnPhongMaterial material;
782
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,wO=`BlinnPhongMaterial material;
783
783
  material.diffuseColor = diffuseColor.rgb;
784
784
  material.specularColor = specular;
785
785
  material.specularShininess = shininess;
786
- material.specularStrength = specularStrength;`,AG=`varying vec3 vViewPosition;
786
+ material.specularStrength = specularStrength;`,PO=`varying vec3 vViewPosition;
787
787
  struct BlinnPhongMaterial {
788
788
  vec3 diffuseColor;
789
789
  vec3 specularColor;
@@ -800,7 +800,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
800
800
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
801
801
  }
802
802
  #define RE_Direct RE_Direct_BlinnPhong
803
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,SG=`PhysicalMaterial material;
803
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,AO=`PhysicalMaterial material;
804
804
  material.diffuseColor = diffuseColor.rgb;
805
805
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
806
806
  material.metalness = metalnessFactor;
@@ -890,7 +890,7 @@ material.roughness = min( material.roughness, 1.0 );
890
890
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
891
891
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
892
892
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
893
- #endif`,jG=`uniform sampler2D dfgLUT;
893
+ #endif`,TO=`uniform sampler2D dfgLUT;
894
894
  struct PhysicalMaterial {
895
895
  vec3 diffuseColor;
896
896
  vec3 diffuseContribution;
@@ -1250,7 +1250,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1250
1250
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1251
1251
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1252
1252
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1253
- }`,vG=`
1253
+ }`,SO=`
1254
1254
  vec3 geometryPosition = - vViewPosition;
1255
1255
  vec3 geometryNormal = normal;
1256
1256
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1372,7 +1372,7 @@ IncidentLight directLight;
1372
1372
  #if defined( RE_IndirectSpecular )
1373
1373
  vec3 radiance = vec3( 0.0 );
1374
1374
  vec3 clearcoatRadiance = vec3( 0.0 );
1375
- #endif`,yG=`#if defined( RE_IndirectDiffuse )
1375
+ #endif`,jO=`#if defined( RE_IndirectDiffuse )
1376
1376
  #ifdef USE_LIGHTMAP
1377
1377
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1378
1378
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1393,7 +1393,7 @@ IncidentLight directLight;
1393
1393
  #ifdef USE_CLEARCOAT
1394
1394
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1395
1395
  #endif
1396
- #endif`,xG=`#if defined( RE_IndirectDiffuse )
1396
+ #endif`,vO=`#if defined( RE_IndirectDiffuse )
1397
1397
  #if defined( LAMBERT ) || defined( PHONG )
1398
1398
  irradiance += iblIrradiance;
1399
1399
  #endif
@@ -1401,7 +1401,7 @@ IncidentLight directLight;
1401
1401
  #endif
1402
1402
  #if defined( RE_IndirectSpecular )
1403
1403
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1404
- #endif`,bG=`#ifdef USE_LIGHT_PROBES_GRID
1404
+ #endif`,yO=`#ifdef USE_LIGHT_PROBES_GRID
1405
1405
  uniform highp sampler3D probesSH;
1406
1406
  uniform vec3 probesMin;
1407
1407
  uniform vec3 probesMax;
@@ -1446,27 +1446,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1446
1446
  result += c8 * 0.429043 * ( x * x - y * y );
1447
1447
  return max( result, vec3( 0.0 ) );
1448
1448
  }
1449
- #endif`,hG=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1449
+ #endif`,xO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1450
1450
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1451
- #endif`,fG=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1451
+ #endif`,bO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1452
1452
  uniform float logDepthBufFC;
1453
1453
  varying float vFragDepth;
1454
1454
  varying float vIsPerspective;
1455
- #endif`,gG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1455
+ #endif`,hO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1456
1456
  varying float vFragDepth;
1457
1457
  varying float vIsPerspective;
1458
- #endif`,pG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1458
+ #endif`,fO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1459
1459
  vFragDepth = 1.0 + gl_Position.w;
1460
1460
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1461
- #endif`,uG=`#ifdef USE_MAP
1461
+ #endif`,gO=`#ifdef USE_MAP
1462
1462
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1463
1463
  #ifdef DECODE_VIDEO_TEXTURE
1464
1464
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1465
1465
  #endif
1466
1466
  diffuseColor *= sampledDiffuseColor;
1467
- #endif`,dG=`#ifdef USE_MAP
1467
+ #endif`,pO=`#ifdef USE_MAP
1468
1468
  uniform sampler2D map;
1469
- #endif`,mG=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1469
+ #endif`,uO=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1470
1470
  #if defined( USE_POINTS_UV )
1471
1471
  vec2 uv = vUv;
1472
1472
  #else
@@ -1478,7 +1478,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1478
1478
  #endif
1479
1479
  #ifdef USE_ALPHAMAP
1480
1480
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1481
- #endif`,lG=`#if defined( USE_POINTS_UV )
1481
+ #endif`,dO=`#if defined( USE_POINTS_UV )
1482
1482
  varying vec2 vUv;
1483
1483
  #else
1484
1484
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1490,19 +1490,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1490
1490
  #endif
1491
1491
  #ifdef USE_ALPHAMAP
1492
1492
  uniform sampler2D alphaMap;
1493
- #endif`,cG=`float metalnessFactor = metalness;
1493
+ #endif`,mO=`float metalnessFactor = metalness;
1494
1494
  #ifdef USE_METALNESSMAP
1495
1495
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1496
1496
  metalnessFactor *= texelMetalness.b;
1497
- #endif`,nG=`#ifdef USE_METALNESSMAP
1497
+ #endif`,lO=`#ifdef USE_METALNESSMAP
1498
1498
  uniform sampler2D metalnessMap;
1499
- #endif`,sG=`#ifdef USE_INSTANCING_MORPH
1499
+ #endif`,cO=`#ifdef USE_INSTANCING_MORPH
1500
1500
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1501
1501
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1502
1502
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1503
1503
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1504
1504
  }
1505
- #endif`,iG=`#if defined( USE_MORPHCOLORS )
1505
+ #endif`,nO=`#if defined( USE_MORPHCOLORS )
1506
1506
  vColor *= morphTargetBaseInfluence;
1507
1507
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1508
1508
  #if defined( USE_COLOR_ALPHA )
@@ -1511,12 +1511,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1511
1511
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1512
1512
  #endif
1513
1513
  }
1514
- #endif`,oG=`#ifdef USE_MORPHNORMALS
1514
+ #endif`,sO=`#ifdef USE_MORPHNORMALS
1515
1515
  objectNormal *= morphTargetBaseInfluence;
1516
1516
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1517
1517
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1518
1518
  }
1519
- #endif`,aG=`#ifdef USE_MORPHTARGETS
1519
+ #endif`,iO=`#ifdef USE_MORPHTARGETS
1520
1520
  #ifndef USE_INSTANCING_MORPH
1521
1521
  uniform float morphTargetBaseInfluence;
1522
1522
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1530,12 +1530,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1530
1530
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1531
1531
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1532
1532
  }
1533
- #endif`,rG=`#ifdef USE_MORPHTARGETS
1533
+ #endif`,oO=`#ifdef USE_MORPHTARGETS
1534
1534
  transformed *= morphTargetBaseInfluence;
1535
1535
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1536
1536
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1537
1537
  }
1538
- #endif`,tG=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1538
+ #endif`,aO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1539
1539
  #ifdef FLAT_SHADED
1540
1540
  vec3 fdx = dFdx( vViewPosition );
1541
1541
  vec3 fdy = dFdy( vViewPosition );
@@ -1576,7 +1576,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1576
1576
  tbn2[1] *= faceDirection;
1577
1577
  #endif
1578
1578
  #endif
1579
- vec3 nonPerturbedNormal = normal;`,eG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1579
+ vec3 nonPerturbedNormal = normal;`,rO=`#ifdef USE_NORMALMAP_OBJECTSPACE
1580
1580
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1581
1581
  #ifdef FLIP_SIDED
1582
1582
  normal = - normal;
@@ -1594,25 +1594,25 @@ vec3 nonPerturbedNormal = normal;`,eG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1594
1594
  normal = normalize( tbn * mapN );
1595
1595
  #elif defined( USE_BUMPMAP )
1596
1596
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1597
- #endif`,J5=`#ifndef FLAT_SHADED
1597
+ #endif`,tO=`#ifndef FLAT_SHADED
1598
1598
  varying vec3 vNormal;
1599
1599
  #ifdef USE_TANGENT
1600
1600
  varying vec3 vTangent;
1601
1601
  varying vec3 vBitangent;
1602
1602
  #endif
1603
- #endif`,Q5=`#ifndef FLAT_SHADED
1603
+ #endif`,eO=`#ifndef FLAT_SHADED
1604
1604
  varying vec3 vNormal;
1605
1605
  #ifdef USE_TANGENT
1606
1606
  varying vec3 vTangent;
1607
1607
  varying vec3 vBitangent;
1608
1608
  #endif
1609
- #endif`,$5=`#ifndef FLAT_SHADED
1609
+ #endif`,Jq=`#ifndef FLAT_SHADED
1610
1610
  vNormal = normalize( transformedNormal );
1611
1611
  #ifdef USE_TANGENT
1612
1612
  vTangent = normalize( transformedTangent );
1613
1613
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1614
1614
  #endif
1615
- #endif`,Z5=`#ifdef USE_NORMALMAP
1615
+ #endif`,Qq=`#ifdef USE_NORMALMAP
1616
1616
  uniform sampler2D normalMap;
1617
1617
  uniform vec2 normalScale;
1618
1618
  #endif
@@ -1634,13 +1634,13 @@ vec3 nonPerturbedNormal = normal;`,eG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1634
1634
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1635
1635
  return mat3( T * scale, B * scale, N );
1636
1636
  }
1637
- #endif`,W5=`#ifdef USE_CLEARCOAT
1637
+ #endif`,$q=`#ifdef USE_CLEARCOAT
1638
1638
  vec3 clearcoatNormal = nonPerturbedNormal;
1639
- #endif`,Y5=`#ifdef USE_CLEARCOAT_NORMALMAP
1639
+ #endif`,Zq=`#ifdef USE_CLEARCOAT_NORMALMAP
1640
1640
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1641
1641
  clearcoatMapN.xy *= clearcoatNormalScale;
1642
1642
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1643
- #endif`,X5=`#ifdef USE_CLEARCOATMAP
1643
+ #endif`,Wq=`#ifdef USE_CLEARCOATMAP
1644
1644
  uniform sampler2D clearcoatMap;
1645
1645
  #endif
1646
1646
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1649,18 +1649,18 @@ vec3 nonPerturbedNormal = normal;`,eG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1649
1649
  #endif
1650
1650
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1651
1651
  uniform sampler2D clearcoatRoughnessMap;
1652
- #endif`,K5=`#ifdef USE_IRIDESCENCEMAP
1652
+ #endif`,Yq=`#ifdef USE_IRIDESCENCEMAP
1653
1653
  uniform sampler2D iridescenceMap;
1654
1654
  #endif
1655
1655
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1656
1656
  uniform sampler2D iridescenceThicknessMap;
1657
- #endif`,H5=`#ifdef OPAQUE
1657
+ #endif`,Xq=`#ifdef OPAQUE
1658
1658
  diffuseColor.a = 1.0;
1659
1659
  #endif
1660
1660
  #ifdef USE_TRANSMISSION
1661
1661
  diffuseColor.a *= material.transmissionAlpha;
1662
1662
  #endif
1663
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,U5=`vec3 packNormalToRGB( const in vec3 normal ) {
1663
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Kq=`vec3 packNormalToRGB( const in vec3 normal ) {
1664
1664
  return normalize( normal ) * 0.5 + 0.5;
1665
1665
  }
1666
1666
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1739,9 +1739,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1739
1739
  #else
1740
1740
  return ( near * far ) / ( ( far - near ) * depth - far );
1741
1741
  #endif
1742
- }`,G5=`#ifdef PREMULTIPLIED_ALPHA
1742
+ }`,Hq=`#ifdef PREMULTIPLIED_ALPHA
1743
1743
  gl_FragColor.rgb *= gl_FragColor.a;
1744
- #endif`,E5=`vec4 mvPosition = vec4( transformed, 1.0 );
1744
+ #endif`,Uq=`vec4 mvPosition = vec4( transformed, 1.0 );
1745
1745
  #ifdef USE_BATCHING
1746
1746
  mvPosition = batchingMatrix * mvPosition;
1747
1747
  #endif
@@ -1749,22 +1749,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1749
1749
  mvPosition = instanceMatrix * mvPosition;
1750
1750
  #endif
1751
1751
  mvPosition = modelViewMatrix * mvPosition;
1752
- gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
1752
+ gl_Position = projectionMatrix * mvPosition;`,Gq=`#ifdef DITHERING
1753
1753
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1754
- #endif`,N5=`#ifdef DITHERING
1754
+ #endif`,Eq=`#ifdef DITHERING
1755
1755
  vec3 dithering( vec3 color ) {
1756
1756
  float grid_position = rand( gl_FragCoord.xy );
1757
1757
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1758
1758
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1759
1759
  return color + dither_shift_RGB;
1760
1760
  }
1761
- #endif`,O5=`float roughnessFactor = roughness;
1761
+ #endif`,Fq=`float roughnessFactor = roughness;
1762
1762
  #ifdef USE_ROUGHNESSMAP
1763
1763
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1764
1764
  roughnessFactor *= texelRoughness.g;
1765
- #endif`,q5=`#ifdef USE_ROUGHNESSMAP
1765
+ #endif`,Nq=`#ifdef USE_ROUGHNESSMAP
1766
1766
  uniform sampler2D roughnessMap;
1767
- #endif`,R5=`#if NUM_SPOT_LIGHT_COORDS > 0
1767
+ #endif`,Oq=`#if NUM_SPOT_LIGHT_COORDS > 0
1768
1768
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1769
1769
  #endif
1770
1770
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1964,7 +1964,7 @@ gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
1964
1964
  }
1965
1965
  #endif
1966
1966
  #endif
1967
- #endif`,L5=`#if NUM_SPOT_LIGHT_COORDS > 0
1967
+ #endif`,qq=`#if NUM_SPOT_LIGHT_COORDS > 0
1968
1968
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1969
1969
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1970
1970
  #endif
@@ -2005,7 +2005,7 @@ gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
2005
2005
  };
2006
2006
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2007
2007
  #endif
2008
- #endif`,D5=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2008
+ #endif`,Rq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2009
2009
  #ifdef HAS_NORMAL
2010
2010
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2011
2011
  #else
@@ -2041,7 +2041,7 @@ gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
2041
2041
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2042
2042
  }
2043
2043
  #pragma unroll_loop_end
2044
- #endif`,k5=`float getShadowMask() {
2044
+ #endif`,Lq=`float getShadowMask() {
2045
2045
  float shadow = 1.0;
2046
2046
  #ifdef USE_SHADOWMAP
2047
2047
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2073,12 +2073,12 @@ gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
2073
2073
  #endif
2074
2074
  #endif
2075
2075
  return shadow;
2076
- }`,M5=`#ifdef USE_SKINNING
2076
+ }`,Dq=`#ifdef USE_SKINNING
2077
2077
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
2078
2078
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
2079
2079
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2080
2080
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
2081
- #endif`,V5=`#ifdef USE_SKINNING
2081
+ #endif`,Mq=`#ifdef USE_SKINNING
2082
2082
  uniform mat4 bindMatrix;
2083
2083
  uniform mat4 bindMatrixInverse;
2084
2084
  uniform highp sampler2D boneTexture;
@@ -2093,7 +2093,7 @@ gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
2093
2093
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2094
2094
  return mat4( v1, v2, v3, v4 );
2095
2095
  }
2096
- #endif`,B5=`#ifdef USE_SKINNING
2096
+ #endif`,kq=`#ifdef USE_SKINNING
2097
2097
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2098
2098
  vec4 skinned = vec4( 0.0 );
2099
2099
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2101,7 +2101,7 @@ gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
2101
2101
  skinned += boneMatZ * skinVertex * skinWeight.z;
2102
2102
  skinned += boneMatW * skinVertex * skinWeight.w;
2103
2103
  transformed = ( bindMatrixInverse * skinned ).xyz;
2104
- #endif`,C5=`#ifdef USE_SKINNING
2104
+ #endif`,Vq=`#ifdef USE_SKINNING
2105
2105
  mat4 skinMatrix = mat4( 0.0 );
2106
2106
  skinMatrix += skinWeight.x * boneMatX;
2107
2107
  skinMatrix += skinWeight.y * boneMatY;
@@ -2112,17 +2112,17 @@ gl_Position = projectionMatrix * mvPosition;`,F5=`#ifdef DITHERING
2112
2112
  #ifdef USE_TANGENT
2113
2113
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2114
2114
  #endif
2115
- #endif`,I5=`float specularStrength;
2115
+ #endif`,Bq=`float specularStrength;
2116
2116
  #ifdef USE_SPECULARMAP
2117
2117
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2118
2118
  specularStrength = texelSpecular.r;
2119
2119
  #else
2120
2120
  specularStrength = 1.0;
2121
- #endif`,z5=`#ifdef USE_SPECULARMAP
2121
+ #endif`,Cq=`#ifdef USE_SPECULARMAP
2122
2122
  uniform sampler2D specularMap;
2123
- #endif`,_5=`#if defined( TONE_MAPPING )
2123
+ #endif`,zq=`#if defined( TONE_MAPPING )
2124
2124
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2125
- #endif`,w5=`#ifndef saturate
2125
+ #endif`,Iq=`#ifndef saturate
2126
2126
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2127
2127
  #endif
2128
2128
  uniform float toneMappingExposure;
@@ -2219,7 +2219,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2219
2219
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2220
2220
  return mix( color, vec3( newPeak ), g );
2221
2221
  }
2222
- vec3 CustomToneMapping( vec3 color ) { return color; }`,P5=`#ifdef USE_TRANSMISSION
2222
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,_q=`#ifdef USE_TRANSMISSION
2223
2223
  material.transmission = transmission;
2224
2224
  material.transmissionAlpha = 1.0;
2225
2225
  material.thickness = thickness;
@@ -2240,7 +2240,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,P5=`#ifdef USE_TRANSMISS
2240
2240
  material.attenuationColor, material.attenuationDistance );
2241
2241
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2242
2242
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2243
- #endif`,T5=`#ifdef USE_TRANSMISSION
2243
+ #endif`,wq=`#ifdef USE_TRANSMISSION
2244
2244
  uniform float transmission;
2245
2245
  uniform float thickness;
2246
2246
  uniform float attenuationDistance;
@@ -2366,7 +2366,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,P5=`#ifdef USE_TRANSMISS
2366
2366
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2367
2367
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2368
2368
  }
2369
- #endif`,A5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2369
+ #endif`,Pq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2370
2370
  varying vec2 vUv;
2371
2371
  #endif
2372
2372
  #ifdef USE_MAP
@@ -2436,7 +2436,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,P5=`#ifdef USE_TRANSMISS
2436
2436
  #ifdef USE_THICKNESSMAP
2437
2437
  uniform mat3 thicknessMapTransform;
2438
2438
  varying vec2 vThicknessMapUv;
2439
- #endif`,S5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2439
+ #endif`,Aq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2440
2440
  varying vec2 vUv;
2441
2441
  #endif
2442
2442
  #ifdef USE_MAP
@@ -2530,7 +2530,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,P5=`#ifdef USE_TRANSMISS
2530
2530
  #ifdef USE_THICKNESSMAP
2531
2531
  uniform mat3 thicknessMapTransform;
2532
2532
  varying vec2 vThicknessMapUv;
2533
- #endif`,j5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2533
+ #endif`,Tq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2534
2534
  vUv = vec3( uv, 1 ).xy;
2535
2535
  #endif
2536
2536
  #ifdef USE_MAP
@@ -2601,7 +2601,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,P5=`#ifdef USE_TRANSMISS
2601
2601
  #endif
2602
2602
  #ifdef USE_THICKNESSMAP
2603
2603
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2604
- #endif`,v5=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2604
+ #endif`,Sq=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2605
2605
  vec4 worldPosition = vec4( transformed, 1.0 );
2606
2606
  #ifdef USE_BATCHING
2607
2607
  worldPosition = batchingMatrix * worldPosition;
@@ -2610,12 +2610,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,P5=`#ifdef USE_TRANSMISS
2610
2610
  worldPosition = instanceMatrix * worldPosition;
2611
2611
  #endif
2612
2612
  worldPosition = modelMatrix * worldPosition;
2613
- #endif`,y5=`varying vec2 vUv;
2613
+ #endif`,jq=`varying vec2 vUv;
2614
2614
  uniform mat3 uvTransform;
2615
2615
  void main() {
2616
2616
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2617
2617
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2618
- }`,x5=`uniform sampler2D t2D;
2618
+ }`,vq=`uniform sampler2D t2D;
2619
2619
  uniform float backgroundIntensity;
2620
2620
  varying vec2 vUv;
2621
2621
  void main() {
@@ -2627,14 +2627,14 @@ void main() {
2627
2627
  gl_FragColor = texColor;
2628
2628
  #include <tonemapping_fragment>
2629
2629
  #include <colorspace_fragment>
2630
- }`,b5=`varying vec3 vWorldDirection;
2630
+ }`,yq=`varying vec3 vWorldDirection;
2631
2631
  #include <common>
2632
2632
  void main() {
2633
2633
  vWorldDirection = transformDirection( position, modelMatrix );
2634
2634
  #include <begin_vertex>
2635
2635
  #include <project_vertex>
2636
2636
  gl_Position.z = gl_Position.w;
2637
- }`,h5=`#ifdef ENVMAP_TYPE_CUBE
2637
+ }`,xq=`#ifdef ENVMAP_TYPE_CUBE
2638
2638
  uniform samplerCube envMap;
2639
2639
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2640
2640
  uniform sampler2D envMap;
@@ -2656,14 +2656,14 @@ void main() {
2656
2656
  gl_FragColor = texColor;
2657
2657
  #include <tonemapping_fragment>
2658
2658
  #include <colorspace_fragment>
2659
- }`,f5=`varying vec3 vWorldDirection;
2659
+ }`,bq=`varying vec3 vWorldDirection;
2660
2660
  #include <common>
2661
2661
  void main() {
2662
2662
  vWorldDirection = transformDirection( position, modelMatrix );
2663
2663
  #include <begin_vertex>
2664
2664
  #include <project_vertex>
2665
2665
  gl_Position.z = gl_Position.w;
2666
- }`,g5=`uniform samplerCube tCube;
2666
+ }`,hq=`uniform samplerCube tCube;
2667
2667
  uniform float tFlip;
2668
2668
  uniform float opacity;
2669
2669
  varying vec3 vWorldDirection;
@@ -2673,7 +2673,7 @@ void main() {
2673
2673
  gl_FragColor.a *= opacity;
2674
2674
  #include <tonemapping_fragment>
2675
2675
  #include <colorspace_fragment>
2676
- }`,p5=`#include <common>
2676
+ }`,fq=`#include <common>
2677
2677
  #include <batching_pars_vertex>
2678
2678
  #include <uv_pars_vertex>
2679
2679
  #include <displacementmap_pars_vertex>
@@ -2700,7 +2700,7 @@ void main() {
2700
2700
  #include <logdepthbuf_vertex>
2701
2701
  #include <clipping_planes_vertex>
2702
2702
  vHighPrecisionZW = gl_Position.zw;
2703
- }`,u5=`#if DEPTH_PACKING == 3200
2703
+ }`,gq=`#if DEPTH_PACKING == 3200
2704
2704
  uniform float opacity;
2705
2705
  #endif
2706
2706
  #include <common>
@@ -2738,7 +2738,7 @@ void main() {
2738
2738
  #elif DEPTH_PACKING == 3203
2739
2739
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2740
2740
  #endif
2741
- }`,d5=`#define DISTANCE
2741
+ }`,pq=`#define DISTANCE
2742
2742
  varying vec3 vWorldPosition;
2743
2743
  #include <common>
2744
2744
  #include <batching_pars_vertex>
@@ -2765,7 +2765,7 @@ void main() {
2765
2765
  #include <worldpos_vertex>
2766
2766
  #include <clipping_planes_vertex>
2767
2767
  vWorldPosition = worldPosition.xyz;
2768
- }`,m5=`#define DISTANCE
2768
+ }`,uq=`#define DISTANCE
2769
2769
  uniform vec3 referencePosition;
2770
2770
  uniform float nearDistance;
2771
2771
  uniform float farDistance;
@@ -2788,13 +2788,13 @@ void main () {
2788
2788
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2789
2789
  dist = saturate( dist );
2790
2790
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2791
- }`,l5=`varying vec3 vWorldDirection;
2791
+ }`,dq=`varying vec3 vWorldDirection;
2792
2792
  #include <common>
2793
2793
  void main() {
2794
2794
  vWorldDirection = transformDirection( position, modelMatrix );
2795
2795
  #include <begin_vertex>
2796
2796
  #include <project_vertex>
2797
- }`,c5=`uniform sampler2D tEquirect;
2797
+ }`,mq=`uniform sampler2D tEquirect;
2798
2798
  varying vec3 vWorldDirection;
2799
2799
  #include <common>
2800
2800
  void main() {
@@ -2803,7 +2803,7 @@ void main() {
2803
2803
  gl_FragColor = texture2D( tEquirect, sampleUV );
2804
2804
  #include <tonemapping_fragment>
2805
2805
  #include <colorspace_fragment>
2806
- }`,n5=`uniform float scale;
2806
+ }`,lq=`uniform float scale;
2807
2807
  attribute float lineDistance;
2808
2808
  varying float vLineDistance;
2809
2809
  #include <common>
@@ -2825,7 +2825,7 @@ void main() {
2825
2825
  #include <logdepthbuf_vertex>
2826
2826
  #include <clipping_planes_vertex>
2827
2827
  #include <fog_vertex>
2828
- }`,s5=`uniform vec3 diffuse;
2828
+ }`,cq=`uniform vec3 diffuse;
2829
2829
  uniform float opacity;
2830
2830
  uniform float dashSize;
2831
2831
  uniform float totalSize;
@@ -2853,7 +2853,7 @@ void main() {
2853
2853
  #include <colorspace_fragment>
2854
2854
  #include <fog_fragment>
2855
2855
  #include <premultiplied_alpha_fragment>
2856
- }`,i5=`#include <common>
2856
+ }`,nq=`#include <common>
2857
2857
  #include <batching_pars_vertex>
2858
2858
  #include <uv_pars_vertex>
2859
2859
  #include <envmap_pars_vertex>
@@ -2885,7 +2885,7 @@ void main() {
2885
2885
  #include <worldpos_vertex>
2886
2886
  #include <envmap_vertex>
2887
2887
  #include <fog_vertex>
2888
- }`,o5=`uniform vec3 diffuse;
2888
+ }`,sq=`uniform vec3 diffuse;
2889
2889
  uniform float opacity;
2890
2890
  #ifndef FLAT_SHADED
2891
2891
  varying vec3 vNormal;
@@ -2933,7 +2933,7 @@ void main() {
2933
2933
  #include <fog_fragment>
2934
2934
  #include <premultiplied_alpha_fragment>
2935
2935
  #include <dithering_fragment>
2936
- }`,a5=`#define LAMBERT
2936
+ }`,iq=`#define LAMBERT
2937
2937
  varying vec3 vViewPosition;
2938
2938
  #include <common>
2939
2939
  #include <batching_pars_vertex>
@@ -2972,7 +2972,7 @@ void main() {
2972
2972
  #include <envmap_vertex>
2973
2973
  #include <shadowmap_vertex>
2974
2974
  #include <fog_vertex>
2975
- }`,r5=`#define LAMBERT
2975
+ }`,oq=`#define LAMBERT
2976
2976
  uniform vec3 diffuse;
2977
2977
  uniform vec3 emissive;
2978
2978
  uniform float opacity;
@@ -3030,7 +3030,7 @@ void main() {
3030
3030
  #include <fog_fragment>
3031
3031
  #include <premultiplied_alpha_fragment>
3032
3032
  #include <dithering_fragment>
3033
- }`,t5=`#define MATCAP
3033
+ }`,aq=`#define MATCAP
3034
3034
  varying vec3 vViewPosition;
3035
3035
  #include <common>
3036
3036
  #include <batching_pars_vertex>
@@ -3064,7 +3064,7 @@ void main() {
3064
3064
  #include <clipping_planes_vertex>
3065
3065
  #include <fog_vertex>
3066
3066
  vViewPosition = - mvPosition.xyz;
3067
- }`,e5=`#define MATCAP
3067
+ }`,rq=`#define MATCAP
3068
3068
  uniform vec3 diffuse;
3069
3069
  uniform float opacity;
3070
3070
  uniform sampler2D matcap;
@@ -3110,7 +3110,7 @@ void main() {
3110
3110
  #include <fog_fragment>
3111
3111
  #include <premultiplied_alpha_fragment>
3112
3112
  #include <dithering_fragment>
3113
- }`,JE=`#define NORMAL
3113
+ }`,tq=`#define NORMAL
3114
3114
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3115
3115
  varying vec3 vViewPosition;
3116
3116
  #endif
@@ -3143,7 +3143,7 @@ void main() {
3143
3143
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3144
3144
  vViewPosition = - mvPosition.xyz;
3145
3145
  #endif
3146
- }`,QE=`#define NORMAL
3146
+ }`,eq=`#define NORMAL
3147
3147
  uniform float opacity;
3148
3148
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3149
3149
  varying vec3 vViewPosition;
@@ -3164,7 +3164,7 @@ void main() {
3164
3164
  #ifdef OPAQUE
3165
3165
  gl_FragColor.a = 1.0;
3166
3166
  #endif
3167
- }`,$E=`#define PHONG
3167
+ }`,JR=`#define PHONG
3168
3168
  varying vec3 vViewPosition;
3169
3169
  #include <common>
3170
3170
  #include <batching_pars_vertex>
@@ -3203,7 +3203,7 @@ void main() {
3203
3203
  #include <envmap_vertex>
3204
3204
  #include <shadowmap_vertex>
3205
3205
  #include <fog_vertex>
3206
- }`,ZE=`#define PHONG
3206
+ }`,QR=`#define PHONG
3207
3207
  uniform vec3 diffuse;
3208
3208
  uniform vec3 emissive;
3209
3209
  uniform vec3 specular;
@@ -3263,7 +3263,7 @@ void main() {
3263
3263
  #include <fog_fragment>
3264
3264
  #include <premultiplied_alpha_fragment>
3265
3265
  #include <dithering_fragment>
3266
- }`,WE=`#define STANDARD
3266
+ }`,$R=`#define STANDARD
3267
3267
  varying vec3 vViewPosition;
3268
3268
  #ifdef USE_TRANSMISSION
3269
3269
  varying vec3 vWorldPosition;
@@ -3306,7 +3306,7 @@ void main() {
3306
3306
  #ifdef USE_TRANSMISSION
3307
3307
  vWorldPosition = worldPosition.xyz;
3308
3308
  #endif
3309
- }`,YE=`#define STANDARD
3309
+ }`,ZR=`#define STANDARD
3310
3310
  #ifdef PHYSICAL
3311
3311
  #define IOR
3312
3312
  #define USE_SPECULAR
@@ -3431,7 +3431,7 @@ void main() {
3431
3431
  #include <fog_fragment>
3432
3432
  #include <premultiplied_alpha_fragment>
3433
3433
  #include <dithering_fragment>
3434
- }`,XE=`#define TOON
3434
+ }`,WR=`#define TOON
3435
3435
  varying vec3 vViewPosition;
3436
3436
  #include <common>
3437
3437
  #include <batching_pars_vertex>
@@ -3468,7 +3468,7 @@ void main() {
3468
3468
  #include <worldpos_vertex>
3469
3469
  #include <shadowmap_vertex>
3470
3470
  #include <fog_vertex>
3471
- }`,KE=`#define TOON
3471
+ }`,YR=`#define TOON
3472
3472
  uniform vec3 diffuse;
3473
3473
  uniform vec3 emissive;
3474
3474
  uniform float opacity;
@@ -3520,7 +3520,7 @@ void main() {
3520
3520
  #include <fog_fragment>
3521
3521
  #include <premultiplied_alpha_fragment>
3522
3522
  #include <dithering_fragment>
3523
- }`,HE=`uniform float size;
3523
+ }`,XR=`uniform float size;
3524
3524
  uniform float scale;
3525
3525
  #include <common>
3526
3526
  #include <color_pars_vertex>
@@ -3551,7 +3551,7 @@ void main() {
3551
3551
  #include <clipping_planes_vertex>
3552
3552
  #include <worldpos_vertex>
3553
3553
  #include <fog_vertex>
3554
- }`,UE=`uniform vec3 diffuse;
3554
+ }`,KR=`uniform vec3 diffuse;
3555
3555
  uniform float opacity;
3556
3556
  #include <common>
3557
3557
  #include <color_pars_fragment>
@@ -3576,7 +3576,7 @@ void main() {
3576
3576
  #include <colorspace_fragment>
3577
3577
  #include <fog_fragment>
3578
3578
  #include <premultiplied_alpha_fragment>
3579
- }`,GE=`#include <common>
3579
+ }`,HR=`#include <common>
3580
3580
  #include <batching_pars_vertex>
3581
3581
  #include <fog_pars_vertex>
3582
3582
  #include <morphtarget_pars_vertex>
@@ -3599,7 +3599,7 @@ void main() {
3599
3599
  #include <worldpos_vertex>
3600
3600
  #include <shadowmap_vertex>
3601
3601
  #include <fog_vertex>
3602
- }`,EE=`uniform vec3 color;
3602
+ }`,UR=`uniform vec3 color;
3603
3603
  uniform float opacity;
3604
3604
  #include <common>
3605
3605
  #include <fog_pars_fragment>
@@ -3615,7 +3615,7 @@ void main() {
3615
3615
  #include <colorspace_fragment>
3616
3616
  #include <fog_fragment>
3617
3617
  #include <premultiplied_alpha_fragment>
3618
- }`,FE=`uniform float rotation;
3618
+ }`,GR=`uniform float rotation;
3619
3619
  uniform vec2 center;
3620
3620
  #include <common>
3621
3621
  #include <uv_pars_vertex>
@@ -3639,7 +3639,7 @@ void main() {
3639
3639
  #include <logdepthbuf_vertex>
3640
3640
  #include <clipping_planes_vertex>
3641
3641
  #include <fog_vertex>
3642
- }`,NE=`uniform vec3 diffuse;
3642
+ }`,ER=`uniform vec3 diffuse;
3643
3643
  uniform float opacity;
3644
3644
  #include <common>
3645
3645
  #include <uv_pars_fragment>
@@ -3664,7 +3664,7 @@ void main() {
3664
3664
  #include <tonemapping_fragment>
3665
3665
  #include <colorspace_fragment>
3666
3666
  #include <fog_fragment>
3667
- }`,c0={alphahash_fragment:yU,alphahash_pars_fragment:xU,alphamap_fragment:bU,alphamap_pars_fragment:hU,alphatest_fragment:fU,alphatest_pars_fragment:gU,aomap_fragment:pU,aomap_pars_fragment:uU,batching_pars_vertex:dU,batching_vertex:mU,begin_vertex:lU,beginnormal_vertex:cU,bsdfs:nU,iridescence_fragment:sU,bumpmap_pars_fragment:iU,clipping_planes_fragment:oU,clipping_planes_pars_fragment:aU,clipping_planes_pars_vertex:rU,clipping_planes_vertex:tU,color_fragment:eU,color_pars_fragment:JG,color_pars_vertex:QG,color_vertex:$G,common:ZG,cube_uv_reflection_fragment:WG,defaultnormal_vertex:YG,displacementmap_pars_vertex:XG,displacementmap_vertex:KG,emissivemap_fragment:HG,emissivemap_pars_fragment:UG,colorspace_fragment:GG,colorspace_pars_fragment:EG,envmap_fragment:FG,envmap_common_pars_fragment:NG,envmap_pars_fragment:OG,envmap_pars_vertex:qG,envmap_physical_pars_fragment:_G,envmap_vertex:RG,fog_vertex:LG,fog_pars_vertex:DG,fog_fragment:kG,fog_pars_fragment:MG,gradientmap_pars_fragment:VG,lightmap_pars_fragment:BG,lights_lambert_fragment:CG,lights_lambert_pars_fragment:IG,lights_pars_begin:zG,lights_toon_fragment:wG,lights_toon_pars_fragment:PG,lights_phong_fragment:TG,lights_phong_pars_fragment:AG,lights_physical_fragment:SG,lights_physical_pars_fragment:jG,lights_fragment_begin:vG,lights_fragment_maps:yG,lights_fragment_end:xG,lightprobes_pars_fragment:bG,logdepthbuf_fragment:hG,logdepthbuf_pars_fragment:fG,logdepthbuf_pars_vertex:gG,logdepthbuf_vertex:pG,map_fragment:uG,map_pars_fragment:dG,map_particle_fragment:mG,map_particle_pars_fragment:lG,metalnessmap_fragment:cG,metalnessmap_pars_fragment:nG,morphinstance_vertex:sG,morphcolor_vertex:iG,morphnormal_vertex:oG,morphtarget_pars_vertex:aG,morphtarget_vertex:rG,normal_fragment_begin:tG,normal_fragment_maps:eG,normal_pars_fragment:J5,normal_pars_vertex:Q5,normal_vertex:$5,normalmap_pars_fragment:Z5,clearcoat_normal_fragment_begin:W5,clearcoat_normal_fragment_maps:Y5,clearcoat_pars_fragment:X5,iridescence_pars_fragment:K5,opaque_fragment:H5,packing:U5,premultiplied_alpha_fragment:G5,project_vertex:E5,dithering_fragment:F5,dithering_pars_fragment:N5,roughnessmap_fragment:O5,roughnessmap_pars_fragment:q5,shadowmap_pars_fragment:R5,shadowmap_pars_vertex:L5,shadowmap_vertex:D5,shadowmask_pars_fragment:k5,skinbase_vertex:M5,skinning_pars_vertex:V5,skinning_vertex:B5,skinnormal_vertex:C5,specularmap_fragment:I5,specularmap_pars_fragment:z5,tonemapping_fragment:_5,tonemapping_pars_fragment:w5,transmission_fragment:P5,transmission_pars_fragment:T5,uv_pars_fragment:A5,uv_pars_vertex:S5,uv_vertex:j5,worldpos_vertex:v5,background_vert:y5,background_frag:x5,backgroundCube_vert:b5,backgroundCube_frag:h5,cube_vert:f5,cube_frag:g5,depth_vert:p5,depth_frag:u5,distance_vert:d5,distance_frag:m5,equirect_vert:l5,equirect_frag:c5,linedashed_vert:n5,linedashed_frag:s5,meshbasic_vert:i5,meshbasic_frag:o5,meshlambert_vert:a5,meshlambert_frag:r5,meshmatcap_vert:t5,meshmatcap_frag:e5,meshnormal_vert:JE,meshnormal_frag:QE,meshphong_vert:$E,meshphong_frag:ZE,meshphysical_vert:WE,meshphysical_frag:YE,meshtoon_vert:XE,meshtoon_frag:KE,points_vert:HE,points_frag:UE,shadow_vert:GE,shadow_frag:EE,sprite_vert:FE,sprite_frag:NE},G0={common:{diffuse:{value:new X0(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new h0},alphaMap:{value:null},alphaMapTransform:{value:new h0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new h0}},envmap:{envMap:{value:null},envMapRotation:{value:new h0},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new h0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new h0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new h0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new h0},normalScale:{value:new T0(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new h0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new h0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new h0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new h0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new X0(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new S},probesMax:{value:new S},probesResolution:{value:new S}},points:{diffuse:{value:new X0(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new h0},alphaTest:{value:0},uvTransform:{value:new h0}},sprite:{diffuse:{value:new X0(16777215)},opacity:{value:1},center:{value:new T0(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new h0},alphaMap:{value:null},alphaMapTransform:{value:new h0},alphaTest:{value:0}}},h9={basic:{uniforms:pJ([G0.common,G0.specularmap,G0.envmap,G0.aomap,G0.lightmap,G0.fog]),vertexShader:c0.meshbasic_vert,fragmentShader:c0.meshbasic_frag},lambert:{uniforms:pJ([G0.common,G0.specularmap,G0.envmap,G0.aomap,G0.lightmap,G0.emissivemap,G0.bumpmap,G0.normalmap,G0.displacementmap,G0.fog,G0.lights,{emissive:{value:new X0(0)},envMapIntensity:{value:1}}]),vertexShader:c0.meshlambert_vert,fragmentShader:c0.meshlambert_frag},phong:{uniforms:pJ([G0.common,G0.specularmap,G0.envmap,G0.aomap,G0.lightmap,G0.emissivemap,G0.bumpmap,G0.normalmap,G0.displacementmap,G0.fog,G0.lights,{emissive:{value:new X0(0)},specular:{value:new X0(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:c0.meshphong_vert,fragmentShader:c0.meshphong_frag},standard:{uniforms:pJ([G0.common,G0.envmap,G0.aomap,G0.lightmap,G0.emissivemap,G0.bumpmap,G0.normalmap,G0.displacementmap,G0.roughnessmap,G0.metalnessmap,G0.fog,G0.lights,{emissive:{value:new X0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:c0.meshphysical_vert,fragmentShader:c0.meshphysical_frag},toon:{uniforms:pJ([G0.common,G0.aomap,G0.lightmap,G0.emissivemap,G0.bumpmap,G0.normalmap,G0.displacementmap,G0.gradientmap,G0.fog,G0.lights,{emissive:{value:new X0(0)}}]),vertexShader:c0.meshtoon_vert,fragmentShader:c0.meshtoon_frag},matcap:{uniforms:pJ([G0.common,G0.bumpmap,G0.normalmap,G0.displacementmap,G0.fog,{matcap:{value:null}}]),vertexShader:c0.meshmatcap_vert,fragmentShader:c0.meshmatcap_frag},points:{uniforms:pJ([G0.points,G0.fog]),vertexShader:c0.points_vert,fragmentShader:c0.points_frag},dashed:{uniforms:pJ([G0.common,G0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:c0.linedashed_vert,fragmentShader:c0.linedashed_frag},depth:{uniforms:pJ([G0.common,G0.displacementmap]),vertexShader:c0.depth_vert,fragmentShader:c0.depth_frag},normal:{uniforms:pJ([G0.common,G0.bumpmap,G0.normalmap,G0.displacementmap,{opacity:{value:1}}]),vertexShader:c0.meshnormal_vert,fragmentShader:c0.meshnormal_frag},sprite:{uniforms:pJ([G0.sprite,G0.fog]),vertexShader:c0.sprite_vert,fragmentShader:c0.sprite_frag},background:{uniforms:{uvTransform:{value:new h0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:c0.background_vert,fragmentShader:c0.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new h0}},vertexShader:c0.backgroundCube_vert,fragmentShader:c0.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:c0.cube_vert,fragmentShader:c0.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:c0.equirect_vert,fragmentShader:c0.equirect_frag},distance:{uniforms:pJ([G0.common,G0.displacementmap,{referencePosition:{value:new S},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:c0.distance_vert,fragmentShader:c0.distance_frag},shadow:{uniforms:pJ([G0.lights,G0.fog,{color:{value:new X0(0)},opacity:{value:1}}]),vertexShader:c0.shadow_vert,fragmentShader:c0.shadow_frag}};h9.physical={uniforms:pJ([h9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new h0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new h0},clearcoatNormalScale:{value:new T0(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new h0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new h0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new h0},sheen:{value:0},sheenColor:{value:new X0(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new h0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new h0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new h0},transmissionSamplerSize:{value:new T0},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new h0},attenuationDistance:{value:0},attenuationColor:{value:new X0(0)},specularColor:{value:new X0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new h0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new h0},anisotropyVector:{value:new T0},anisotropyMap:{value:null},anisotropyMapTransform:{value:new h0}}]),vertexShader:c0.meshphysical_vert,fragmentShader:c0.meshphysical_frag};var hQ={r:0,b:0,g:0},OE=new j0,nX=new h0;nX.set(-1,0,0,0,1,0,0,0,1);function qE(J,Q,$,Z,W,Y){let X=new X0(0),K=W===!0?0:1,H,U,G=null,F=0,E=null;function O(L){let k=L.isScene===!0?L.background:null;if(k&&k.isTexture){let M=L.backgroundBlurriness>0;k=Q.get(k,M)}return k}function R(L){let k=!1,M=O(L);if(M===null)q(X,K);else if(M&&M.isColor)q(M,1),k=!0;let P=J.xr.getEnvironmentBlendMode();if(P==="additive")$.buffers.color.setClear(0,0,0,1,Y);else if(P==="alpha-blend")$.buffers.color.setClear(0,0,0,0,Y);if(J.autoClear||k)$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function C(L,k){let M=O(k);if(M&&(M.isCubeTexture||M.mapping===e6)){if(U===void 0)U=new a0(new aJ(1,1,1),new OJ({name:"BackgroundCubeMaterial",uniforms:f8(h9.backgroundCube.uniforms),vertexShader:h9.backgroundCube.vertexShader,fragmentShader:h9.backgroundCube.fragmentShader,side:yJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(P,w,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(U.material.uniforms.envMap.value=M,U.material.uniforms.backgroundBlurriness.value=k.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=k.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(OE.makeRotationFromEuler(k.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1)U.material.uniforms.backgroundRotation.value.premultiply(nX);if(U.material.toneMapped=u0.getTransfer(M.colorSpace)!==YJ,G!==M||F!==M.version||E!==J.toneMapping)U.material.needsUpdate=!0,G=M,F=M.version,E=J.toneMapping;U.layers.enableAll(),L.unshift(U,U.geometry,U.material,0,0,null)}else if(M&&M.isTexture){if(H===void 0)H=new a0(new C9(2,2),new OJ({name:"BackgroundMaterial",uniforms:f8(h9.background.uniforms),vertexShader:h9.background.vertexShader,fragmentShader:h9.background.fragmentShader,side:A9,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),H.geometry.deleteAttribute("normal"),Object.defineProperty(H.material,"map",{get:function(){return this.uniforms.t2D.value}}),Z.update(H);if(H.material.uniforms.t2D.value=M,H.material.uniforms.backgroundIntensity.value=k.backgroundIntensity,H.material.toneMapped=u0.getTransfer(M.colorSpace)!==YJ,M.matrixAutoUpdate===!0)M.updateMatrix();if(H.material.uniforms.uvTransform.value.copy(M.matrix),G!==M||F!==M.version||E!==J.toneMapping)H.material.needsUpdate=!0,G=M,F=M.version,E=J.toneMapping;H.layers.enableAll(),L.unshift(H,H.geometry,H.material,0,0,null)}}function q(L,k){L.getRGB(hQ,PZ(J)),$.buffers.color.setClear(hQ.r,hQ.g,hQ.b,k,Y)}function N(){if(U!==void 0)U.geometry.dispose(),U.material.dispose(),U=void 0;if(H!==void 0)H.geometry.dispose(),H.material.dispose(),H=void 0}return{getClearColor:function(){return X},setClearColor:function(L,k=1){X.set(L),K=k,q(X,K)},getClearAlpha:function(){return K},setClearAlpha:function(L){K=L,q(X,K)},render:R,addToRenderList:C,dispose:N}}function RE(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=E(null),Y=W,X=!1;function K(z,v,y,A,x){let b=!1,p=F(z,A,y,v);if(Y!==p)Y=p,U(Y.object);if(b=O(z,A,y,x),b)R(z,A,y,x);if(x!==null)Q.update(x,J.ELEMENT_ARRAY_BUFFER);if(b||X){if(X=!1,M(z,v,y,A),x!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(x).buffer)}}function H(){return J.createVertexArray()}function U(z){return J.bindVertexArray(z)}function G(z){return J.deleteVertexArray(z)}function F(z,v,y,A){let x=A.wireframe===!0,b=Z[v.id];if(b===void 0)b={},Z[v.id]=b;let p=z.isInstancedMesh===!0?z.id:0,c=b[p];if(c===void 0)c={},b[p]=c;let o=c[y.id];if(o===void 0)o={},c[y.id]=o;let Q0=o[x];if(Q0===void 0)Q0=E(H()),o[x]=Q0;return Q0}function E(z){let v=[],y=[],A=[];for(let x=0;x<$;x++)v[x]=0,y[x]=0,A[x]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:v,enabledAttributes:y,attributeDivisors:A,object:z,attributes:{},index:null}}function O(z,v,y,A){let x=Y.attributes,b=v.attributes,p=0,c=y.getAttributes();for(let o in c)if(c[o].location>=0){let Y0=x[o],J0=b[o];if(J0===void 0){if(o==="instanceMatrix"&&z.instanceMatrix)J0=z.instanceMatrix;if(o==="instanceColor"&&z.instanceColor)J0=z.instanceColor}if(Y0===void 0)return!0;if(Y0.attribute!==J0)return!0;if(J0&&Y0.data!==J0.data)return!0;p++}if(Y.attributesNum!==p)return!0;if(Y.index!==A)return!0;return!1}function R(z,v,y,A){let x={},b=v.attributes,p=0,c=y.getAttributes();for(let o in c)if(c[o].location>=0){let Y0=b[o];if(Y0===void 0){if(o==="instanceMatrix"&&z.instanceMatrix)Y0=z.instanceMatrix;if(o==="instanceColor"&&z.instanceColor)Y0=z.instanceColor}let J0={};if(J0.attribute=Y0,Y0&&Y0.data)J0.data=Y0.data;x[o]=J0,p++}Y.attributes=x,Y.attributesNum=p,Y.index=A}function C(){let z=Y.newAttributes;for(let v=0,y=z.length;v<y;v++)z[v]=0}function q(z){N(z,0)}function N(z,v){let{newAttributes:y,enabledAttributes:A,attributeDivisors:x}=Y;if(y[z]=1,A[z]===0)J.enableVertexAttribArray(z),A[z]=1;if(x[z]!==v)J.vertexAttribDivisor(z,v),x[z]=v}function L(){let{newAttributes:z,enabledAttributes:v}=Y;for(let y=0,A=v.length;y<A;y++)if(v[y]!==z[y])J.disableVertexAttribArray(y),v[y]=0}function k(z,v,y,A,x,b,p){if(p===!0)J.vertexAttribIPointer(z,v,y,x,b);else J.vertexAttribPointer(z,v,y,A,x,b)}function M(z,v,y,A){C();let x=A.attributes,b=y.getAttributes(),p=v.defaultAttributeValues;for(let c in b){let o=b[c];if(o.location>=0){let Q0=x[c];if(Q0===void 0){if(c==="instanceMatrix"&&z.instanceMatrix)Q0=z.instanceMatrix;if(c==="instanceColor"&&z.instanceColor)Q0=z.instanceColor}if(Q0!==void 0){let{normalized:Y0,itemSize:J0}=Q0,x0=Q.get(Q0);if(x0===void 0)continue;let{buffer:v0,type:s,bytesPerElement:K0}=x0,D0=s===J.INT||s===J.UNSIGNED_INT||Q0.gpuType===v$;if(Q0.isInterleavedBufferAttribute){let E0=Q0.data,_0=E0.stride,i0=Q0.offset;if(E0.isInstancedInterleavedBuffer){for(let y0=0;y0<o.locationSize;y0++)N(o.location+y0,E0.meshPerAttribute);if(z.isInstancedMesh!==!0&&A._maxInstanceCount===void 0)A._maxInstanceCount=E0.meshPerAttribute*E0.count}else for(let y0=0;y0<o.locationSize;y0++)q(o.location+y0);J.bindBuffer(J.ARRAY_BUFFER,v0);for(let y0=0;y0<o.locationSize;y0++)k(o.location+y0,J0/o.locationSize,s,Y0,_0*K0,(i0+J0/o.locationSize*y0)*K0,D0)}else{if(Q0.isInstancedBufferAttribute){for(let E0=0;E0<o.locationSize;E0++)N(o.location+E0,Q0.meshPerAttribute);if(z.isInstancedMesh!==!0&&A._maxInstanceCount===void 0)A._maxInstanceCount=Q0.meshPerAttribute*Q0.count}else for(let E0=0;E0<o.locationSize;E0++)q(o.location+E0);J.bindBuffer(J.ARRAY_BUFFER,v0);for(let E0=0;E0<o.locationSize;E0++)k(o.location+E0,J0/o.locationSize,s,Y0,J0*K0,J0/o.locationSize*E0*K0,D0)}}else if(p!==void 0){let Y0=p[c];if(Y0!==void 0)switch(Y0.length){case 2:J.vertexAttrib2fv(o.location,Y0);break;case 3:J.vertexAttrib3fv(o.location,Y0);break;case 4:J.vertexAttrib4fv(o.location,Y0);break;default:J.vertexAttrib1fv(o.location,Y0)}}}}L()}function P(){V();for(let z in Z){let v=Z[z];for(let y in v){let A=v[y];for(let x in A){let b=A[x];for(let p in b)G(b[p].object),delete b[p];delete A[x]}}delete Z[z]}}function w(z){if(Z[z.id]===void 0)return;let v=Z[z.id];for(let y in v){let A=v[y];for(let x in A){let b=A[x];for(let p in b)G(b[p].object),delete b[p];delete A[x]}}delete Z[z.id]}function B(z){for(let v in Z){let y=Z[v];for(let A in y){let x=y[A];if(x[z.id]===void 0)continue;let b=x[z.id];for(let p in b)G(b[p].object),delete b[p];delete x[z.id]}}}function D(z){for(let v in Z){let y=Z[v],A=z.isInstancedMesh===!0?z.id:0,x=y[A];if(x===void 0)continue;for(let b in x){let p=x[b];for(let c in p)G(p[c].object),delete p[c];delete x[b]}if(delete y[A],Object.keys(y).length===0)delete Z[v]}}function V(){if(j(),X=!0,Y===W)return;Y=W,U(Y.object)}function j(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:K,reset:V,resetDefaultState:j,dispose:P,releaseStatesOfGeometry:w,releaseStatesOfObject:D,releaseStatesOfProgram:B,initAttributes:C,enableAttribute:q,disableUnusedAttributes:L}}function LE(J,Q,$){let Z;function W(H){Z=H}function Y(H,U){J.drawArrays(Z,H,U),$.update(U,Z,1)}function X(H,U,G){if(G===0)return;J.drawArraysInstanced(Z,H,U,G),$.update(U,Z,G)}function K(H,U,G){if(G===0)return;Q.get("WEBGL_multi_draw").multiDrawArraysWEBGL(Z,H,0,U,0,G);let E=0;for(let O=0;O<G;O++)E+=U[O];$.update(E,Z,1)}this.setMode=W,this.render=Y,this.renderInstances=X,this.renderMultiDraw=K}function DE(J,Q,$,Z){let W;function Y(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let B=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function X(B){if(B!==j9&&Z.convert(B)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function K(B){let D=B===kJ&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(B!==B9&&Z.convert(B)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&B!==$9&&!D)return!1;return!0}function H(B){if(B==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";B="mediump"}if(B==="mediump"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.MEDIUM_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let U=$.precision!==void 0?$.precision:"highp",G=H(U);if(G!==U)C0("WebGLRenderer:",U,"not supported, using",G,"instead."),U=G;let F=$.logarithmicDepthBuffer===!0,E=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control");if($.reversedDepthBuffer===!0&&E===!1)C0("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let O=J.getParameter(J.MAX_TEXTURE_IMAGE_UNITS),R=J.getParameter(J.MAX_VERTEX_TEXTURE_IMAGE_UNITS),C=J.getParameter(J.MAX_TEXTURE_SIZE),q=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),N=J.getParameter(J.MAX_VERTEX_ATTRIBS),L=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),k=J.getParameter(J.MAX_VARYING_VECTORS),M=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),P=J.getParameter(J.MAX_SAMPLES),w=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:Y,getMaxPrecision:H,textureFormatReadable:X,textureTypeReadable:K,precision:U,logarithmicDepthBuffer:F,reversedDepthBuffer:E,maxTextures:O,maxVertexTextures:R,maxTextureSize:C,maxCubemapSize:q,maxAttributes:N,maxVertexUniforms:L,maxVaryings:k,maxFragmentUniforms:M,maxSamples:P,samples:w}}function kE(J){let Q=this,$=null,Z=0,W=!1,Y=!1,X=new D9,K=new h0,H={value:null,needsUpdate:!1};this.uniform=H,this.numPlanes=0,this.numIntersection=0,this.init=function(F,E){let O=F.length!==0||E||Z!==0||W;return W=E,Z=F.length,O},this.beginShadows=function(){Y=!0,G(null)},this.endShadows=function(){Y=!1},this.setGlobalState=function(F,E){$=G(F,E,0)},this.setState=function(F,E,O){let{clippingPlanes:R,clipIntersection:C,clipShadows:q}=F,N=J.get(F);if(!W||R===null||R.length===0||Y&&!q)if(Y)G(null);else U();else{let L=Y?0:Z,k=L*4,M=N.clippingState||null;H.value=M,M=G(R,E,k,O);for(let P=0;P!==k;++P)M[P]=$[P];N.clippingState=M,this.numIntersection=C?this.numPlanes:0,this.numPlanes+=L}};function U(){if(H.value!==$)H.value=$,H.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function G(F,E,O,R){let C=F!==null?F.length:0,q=null;if(C!==0){if(q=H.value,R!==!0||q===null){let N=O+C*4,L=E.matrixWorldInverse;if(K.getNormalMatrix(L),q===null||q.length<N)q=new Float32Array(N);for(let k=0,M=O;k!==C;++k,M+=4)X.copy(F[k]).applyMatrix4(L,K),X.normal.toArray(q,M),q[M+3]=X.constant}H.value=q,H.needsUpdate=!0}return Q.numPlanes=C,Q.numIntersection=0,q}}var D8=4,CX=[0.125,0.215,0.35,0.446,0.526,0.582],g8=20,ME=256,q7=new e9,IX=new X0,cZ=null,nZ=0,sZ=0,iZ=!1,VE=new S;class P6{constructor(J){this._renderer=J,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(J,Q=0,$=0.1,Z=100,W={}){let{size:Y=256,position:X=VE}=W;cZ=this._renderer.getRenderTarget(),nZ=this._renderer.getActiveCubeFace(),sZ=this._renderer.getActiveMipmapLevel(),iZ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(Y);let K=this._allocateTargets();if(K.depthBuffer=!0,this._sceneToCubeUV(J,$,Z,K,X),Q>0)this._blur(K,0,0,Q);return this._applyPMREM(K),this._cleanup(K),K}fromEquirectangular(J,Q=null){return this._fromTexture(J,Q)}fromCubemap(J,Q=null){return this._fromTexture(J,Q)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=wX(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=_X(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(J){this._lodMax=Math.floor(Math.log2(J)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let J=0;J<this._lodMeshes.length;J++)this._lodMeshes[J].geometry.dispose()}_cleanup(J){this._renderer.setRenderTarget(cZ,nZ,sZ),this._renderer.xr.enabled=iZ,J.scissorTest=!1,w6(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===F6||J.mapping===A8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);cZ=this._renderer.getRenderTarget(),nZ=this._renderer.getActiveCubeFace(),sZ=this._renderer.getActiveMipmapLevel(),iZ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let $=Q||this._allocateTargets();return this._textureToCubeUV(J,$),this._applyPMREM($),this._cleanup($),$}_allocateTargets(){let J=3*Math.max(this._cubeSize,112),Q=4*this._cubeSize,$={magFilter:CJ,minFilter:CJ,generateMipmaps:!1,type:kJ,format:j9,colorSpace:mJ,depthBuffer:!1},Z=zX(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=zX(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=BE(W)),this._blurMaterial=IE(W,J,Q),this._ggxMaterial=CE(W,J,Q)}return Z}_compileMaterial(J){let Q=new a0(new qJ,J);this._renderer.compile(Q,q7)}_sceneToCubeUV(J,Q,$,Z,W){let K=new BJ(90,1,Q,$),H=[1,-1,1,1,1,1],U=[1,1,1,-1,-1,-1],G=this._renderer,F=G.autoClear,E=G.toneMapping;if(G.getClearColor(IX),G.toneMapping=Q9,G.autoClear=!1,G.state.buffers.depth.getReversed())G.setRenderTarget(Z),G.clearDepth(),G.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new a0(new aJ,new U9({name:"PMREM.Background",side:yJ,depthWrite:!1,depthTest:!1}));let R=this._backgroundBox,C=R.material,q=!1,N=J.background;if(N){if(N.isColor)C.color.copy(N),J.background=null,q=!0}else C.color.copy(IX),q=!0;for(let L=0;L<6;L++){let k=L%3;if(k===0)K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x+U[L],W.y,W.z);else if(k===1)K.up.set(0,0,H[L]),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y+U[L],W.z);else K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y,W.z+U[L]);let M=this._cubeSize;if(w6(Z,k*M,L>2?M:0,M,M),G.setRenderTarget(Z),q)G.render(R,K);G.render(J,K)}G.toneMapping=E,G.autoClear=F,J.background=N}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===F6||J.mapping===A8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=wX();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=_X();let W=Z?this._cubemapMaterial:this._equirectMaterial,Y=this._lodMeshes[0];Y.material=W;let X=W.uniforms;X.envMap.value=J;let K=this._cubeSize;w6(Q,0,0,3*K,2*K),$.setRenderTarget(Q),$.render(Y,q7)}_applyPMREM(J){let Q=this._renderer,$=Q.autoClear;Q.autoClear=!1;let Z=this._lodMeshes.length;for(let W=1;W<Z;W++)this._applyGGXFilter(J,W-1,W);Q.autoClear=$}_applyGGXFilter(J,Q,$){let Z=this._renderer,W=this._pingPongRenderTarget,Y=this._ggxMaterial,X=this._lodMeshes[$];X.material=Y;let K=Y.uniforms,H=$/(this._lodMeshes.length-1),U=Q/(this._lodMeshes.length-1),G=Math.sqrt(H*H-U*U),F=0+H*1.25,E=G*F,{_lodMax:O}=this,R=this._sizeLods[$],C=3*R*($>O-D8?$-O+D8:0),q=4*(this._cubeSize-R);K.envMap.value=J.texture,K.roughness.value=E,K.mipInt.value=O-Q,w6(W,C,q,3*R,2*R),Z.setRenderTarget(W),Z.render(X,q7),K.envMap.value=W.texture,K.roughness.value=0,K.mipInt.value=O-$,w6(J,C,q,3*R,2*R),Z.setRenderTarget(J),Z.render(X,q7)}_blur(J,Q,$,Z,W){let Y=this._pingPongRenderTarget;this._halfBlur(J,Y,Q,$,Z,"latitudinal",W),this._halfBlur(Y,J,$,$,Z,"longitudinal",W)}_halfBlur(J,Q,$,Z,W,Y,X){let K=this._renderer,H=this._blurMaterial;if(Y!=="latitudinal"&&Y!=="longitudinal")S0("blur direction must be either latitudinal or longitudinal!");let U=3,G=this._lodMeshes[Z];G.material=H;let F=H.uniforms,E=this._sizeLods[$]-1,O=isFinite(W)?Math.PI/(2*E):2*Math.PI/(2*g8-1),R=W/O,C=isFinite(W)?1+Math.floor(U*R):g8;if(C>g8)C0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${g8}`);let q=[],N=0;for(let w=0;w<g8;++w){let B=w/R,D=Math.exp(-B*B/2);if(q.push(D),w===0)N+=D;else if(w<C)N+=2*D}for(let w=0;w<q.length;w++)q[w]=q[w]/N;if(F.envMap.value=J.texture,F.samples.value=C,F.weights.value=q,F.latitudinal.value=Y==="latitudinal",X)F.poleAxis.value=X;let{_lodMax:L}=this;F.dTheta.value=O,F.mipInt.value=L-$;let k=this._sizeLods[Z],M=3*k*(Z>L-D8?Z-L+D8:0),P=4*(this._cubeSize-k);w6(Q,M,P,3*k,2*k),K.setRenderTarget(Q),K.render(G,q7)}}function BE(J){let Q=[],$=[],Z=[],W=J,Y=J-D8+1+CX.length;for(let X=0;X<Y;X++){let K=Math.pow(2,W);Q.push(K);let H=1/K;if(X>J-D8)H=CX[X-J+D8-1];else if(X===0)H=0;$.push(H);let U=1/(K-2),G=-U,F=1+U,E=[G,G,F,G,F,F,G,G,F,F,G,F],O=6,R=6,C=3,q=2,N=1,L=new Float32Array(C*R*O),k=new Float32Array(q*R*O),M=new Float32Array(N*R*O);for(let w=0;w<O;w++){let B=w%3*2/3-1,D=w>2?0:-1,V=[B,D,0,B+0.6666666666666666,D,0,B+0.6666666666666666,D+1,0,B,D,0,B+0.6666666666666666,D+1,0,B,D+1,0];L.set(V,C*R*w),k.set(E,q*R*w);let j=[w,w,w,w,w,w];M.set(j,N*R*w)}let P=new qJ;if(P.setAttribute("position",new QJ(L,C)),P.setAttribute("uv",new QJ(k,q)),P.setAttribute("faceIndex",new QJ(M,N)),Z.push(new a0(P,null)),W>D8)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function zX(J,Q,$){let Z=new TJ(J,Q,$);return Z.texture.mapping=e6,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function w6(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function CE(J,Q,$){return new OJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:ME,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:gQ(),fragmentShader:`
3667
+ }`,ZJ={alphahash_fragment:jN,alphahash_pars_fragment:vN,alphamap_fragment:yN,alphamap_pars_fragment:xN,alphatest_fragment:bN,alphatest_pars_fragment:hN,aomap_fragment:fN,aomap_pars_fragment:gN,batching_pars_vertex:pN,batching_vertex:uN,begin_vertex:dN,beginnormal_vertex:mN,bsdfs:lN,iridescence_fragment:cN,bumpmap_pars_fragment:nN,clipping_planes_fragment:sN,clipping_planes_pars_fragment:iN,clipping_planes_pars_vertex:oN,clipping_planes_vertex:aN,color_fragment:rN,color_pars_fragment:tN,color_pars_vertex:eN,color_vertex:JO,common:QO,cube_uv_reflection_fragment:$O,defaultnormal_vertex:ZO,displacementmap_pars_vertex:WO,displacementmap_vertex:YO,emissivemap_fragment:XO,emissivemap_pars_fragment:KO,colorspace_fragment:HO,colorspace_pars_fragment:UO,envmap_fragment:GO,envmap_common_pars_fragment:EO,envmap_pars_fragment:FO,envmap_pars_vertex:NO,envmap_physical_pars_fragment:zO,envmap_vertex:OO,fog_vertex:qO,fog_pars_vertex:RO,fog_fragment:LO,fog_pars_fragment:DO,gradientmap_pars_fragment:MO,lightmap_pars_fragment:kO,lights_lambert_fragment:VO,lights_lambert_pars_fragment:BO,lights_pars_begin:CO,lights_toon_fragment:IO,lights_toon_pars_fragment:_O,lights_phong_fragment:wO,lights_phong_pars_fragment:PO,lights_physical_fragment:AO,lights_physical_pars_fragment:TO,lights_fragment_begin:SO,lights_fragment_maps:jO,lights_fragment_end:vO,lightprobes_pars_fragment:yO,logdepthbuf_fragment:xO,logdepthbuf_pars_fragment:bO,logdepthbuf_pars_vertex:hO,logdepthbuf_vertex:fO,map_fragment:gO,map_pars_fragment:pO,map_particle_fragment:uO,map_particle_pars_fragment:dO,metalnessmap_fragment:mO,metalnessmap_pars_fragment:lO,morphinstance_vertex:cO,morphcolor_vertex:nO,morphnormal_vertex:sO,morphtarget_pars_vertex:iO,morphtarget_vertex:oO,normal_fragment_begin:aO,normal_fragment_maps:rO,normal_pars_fragment:tO,normal_pars_vertex:eO,normal_vertex:Jq,normalmap_pars_fragment:Qq,clearcoat_normal_fragment_begin:$q,clearcoat_normal_fragment_maps:Zq,clearcoat_pars_fragment:Wq,iridescence_pars_fragment:Yq,opaque_fragment:Xq,packing:Kq,premultiplied_alpha_fragment:Hq,project_vertex:Uq,dithering_fragment:Gq,dithering_pars_fragment:Eq,roughnessmap_fragment:Fq,roughnessmap_pars_fragment:Nq,shadowmap_pars_fragment:Oq,shadowmap_pars_vertex:qq,shadowmap_vertex:Rq,shadowmask_pars_fragment:Lq,skinbase_vertex:Dq,skinning_pars_vertex:Mq,skinning_vertex:kq,skinnormal_vertex:Vq,specularmap_fragment:Bq,specularmap_pars_fragment:Cq,tonemapping_fragment:zq,tonemapping_pars_fragment:Iq,transmission_fragment:_q,transmission_pars_fragment:wq,uv_pars_fragment:Pq,uv_pars_vertex:Aq,uv_vertex:Tq,worldpos_vertex:Sq,background_vert:jq,background_frag:vq,backgroundCube_vert:yq,backgroundCube_frag:xq,cube_vert:bq,cube_frag:hq,depth_vert:fq,depth_frag:gq,distance_vert:pq,distance_frag:uq,equirect_vert:dq,equirect_frag:mq,linedashed_vert:lq,linedashed_frag:cq,meshbasic_vert:nq,meshbasic_frag:sq,meshlambert_vert:iq,meshlambert_frag:oq,meshmatcap_vert:aq,meshmatcap_frag:rq,meshnormal_vert:tq,meshnormal_frag:eq,meshphong_vert:JR,meshphong_frag:QR,meshphysical_vert:$R,meshphysical_frag:ZR,meshtoon_vert:WR,meshtoon_frag:YR,points_vert:XR,points_frag:KR,shadow_vert:HR,shadow_frag:UR,sprite_vert:GR,sprite_frag:ER},D0={common:{diffuse:{value:new e(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new o0},alphaMap:{value:null},alphaMapTransform:{value:new o0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new o0}},envmap:{envMap:{value:null},envMapRotation:{value:new o0},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new o0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new o0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new o0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new o0},normalScale:{value:new i(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new o0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new o0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new o0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new o0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new e(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new A},probesMax:{value:new A},probesResolution:{value:new A}},points:{diffuse:{value:new e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new o0},alphaTest:{value:0},uvTransform:{value:new o0}},sprite:{diffuse:{value:new e(16777215)},opacity:{value:1},center:{value:new i(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new o0},alphaMap:{value:null},alphaMapTransform:{value:new o0},alphaTest:{value:0}}},e9={basic:{uniforms:$9([D0.common,D0.specularmap,D0.envmap,D0.aomap,D0.lightmap,D0.fog]),vertexShader:ZJ.meshbasic_vert,fragmentShader:ZJ.meshbasic_frag},lambert:{uniforms:$9([D0.common,D0.specularmap,D0.envmap,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.fog,D0.lights,{emissive:{value:new e(0)},envMapIntensity:{value:1}}]),vertexShader:ZJ.meshlambert_vert,fragmentShader:ZJ.meshlambert_frag},phong:{uniforms:$9([D0.common,D0.specularmap,D0.envmap,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.fog,D0.lights,{emissive:{value:new e(0)},specular:{value:new e(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:ZJ.meshphong_vert,fragmentShader:ZJ.meshphong_frag},standard:{uniforms:$9([D0.common,D0.envmap,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.roughnessmap,D0.metalnessmap,D0.fog,D0.lights,{emissive:{value:new e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ZJ.meshphysical_vert,fragmentShader:ZJ.meshphysical_frag},toon:{uniforms:$9([D0.common,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.gradientmap,D0.fog,D0.lights,{emissive:{value:new e(0)}}]),vertexShader:ZJ.meshtoon_vert,fragmentShader:ZJ.meshtoon_frag},matcap:{uniforms:$9([D0.common,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.fog,{matcap:{value:null}}]),vertexShader:ZJ.meshmatcap_vert,fragmentShader:ZJ.meshmatcap_frag},points:{uniforms:$9([D0.points,D0.fog]),vertexShader:ZJ.points_vert,fragmentShader:ZJ.points_frag},dashed:{uniforms:$9([D0.common,D0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ZJ.linedashed_vert,fragmentShader:ZJ.linedashed_frag},depth:{uniforms:$9([D0.common,D0.displacementmap]),vertexShader:ZJ.depth_vert,fragmentShader:ZJ.depth_frag},normal:{uniforms:$9([D0.common,D0.bumpmap,D0.normalmap,D0.displacementmap,{opacity:{value:1}}]),vertexShader:ZJ.meshnormal_vert,fragmentShader:ZJ.meshnormal_frag},sprite:{uniforms:$9([D0.sprite,D0.fog]),vertexShader:ZJ.sprite_vert,fragmentShader:ZJ.sprite_frag},background:{uniforms:{uvTransform:{value:new o0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ZJ.background_vert,fragmentShader:ZJ.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new o0}},vertexShader:ZJ.backgroundCube_vert,fragmentShader:ZJ.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ZJ.cube_vert,fragmentShader:ZJ.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ZJ.equirect_vert,fragmentShader:ZJ.equirect_frag},distance:{uniforms:$9([D0.common,D0.displacementmap,{referencePosition:{value:new A},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:ZJ.distance_vert,fragmentShader:ZJ.distance_frag},shadow:{uniforms:$9([D0.lights,D0.fog,{color:{value:new e(0)},opacity:{value:1}}]),vertexShader:ZJ.shadow_vert,fragmentShader:ZJ.shadow_frag}};e9.physical={uniforms:$9([e9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new o0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new o0},clearcoatNormalScale:{value:new i(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new o0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new o0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new o0},sheen:{value:0},sheenColor:{value:new e(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new o0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new o0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new o0},transmissionSamplerSize:{value:new i},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new o0},attenuationDistance:{value:0},attenuationColor:{value:new e(0)},specularColor:{value:new e(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new o0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new o0},anisotropyVector:{value:new i},anisotropyMap:{value:null},anisotropyMapTransform:{value:new o0}}]),vertexShader:ZJ.meshphysical_vert,fragmentShader:ZJ.meshphysical_frag};var oW={r:0,b:0,g:0},FR=new y0,o5=new o0;o5.set(-1,0,0,0,1,0,0,0,1);function NR(J,Q,$,Z,W,Y){let X=new e(0),K=W===!0?0:1,H,U,G=null,F=0,E=null;function O(L){let D=L.isScene===!0?L.background:null;if(D&&D.isTexture){let V=L.backgroundBlurriness>0;D=Q.get(D,V)}return D}function R(L){let D=!1,V=O(L);if(V===null)q(X,K);else if(V&&V.isColor)q(V,1),D=!0;let z=J.xr.getEnvironmentBlendMode();if(z==="additive")$.buffers.color.setClear(0,0,0,1,Y);else if(z==="alpha-blend")$.buffers.color.setClear(0,0,0,0,Y);if(J.autoClear||D)$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function M(L,D){let V=O(D);if(V&&(V.isCubeTexture||V.mapping===j7)){if(U===void 0)U=new a0(new Q9(1,1,1),new LJ({name:"BackgroundCubeMaterial",uniforms:p6(e9.backgroundCube.uniforms),vertexShader:e9.backgroundCube.vertexShader,fragmentShader:e9.backgroundCube.fragmentShader,side:uJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(z,I,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(U.material.uniforms.envMap.value=V,U.material.uniforms.backgroundBlurriness.value=D.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(FR.makeRotationFromEuler(D.backgroundRotation)).transpose(),V.isCubeTexture&&V.isRenderTargetTexture===!1)U.material.uniforms.backgroundRotation.value.premultiply(o5);if(U.material.toneMapped=t0.getTransfer(V.colorSpace)!==OJ,G!==V||F!==V.version||E!==J.toneMapping)U.material.needsUpdate=!0,G=V,F=V.version,E=J.toneMapping;U.layers.enableAll(),L.unshift(U,U.geometry,U.material,0,0,null)}else if(V&&V.isTexture){if(H===void 0)H=new a0(new z9(2,2),new LJ({name:"BackgroundMaterial",uniforms:p6(e9.background.uniforms),vertexShader:e9.background.vertexShader,fragmentShader:e9.background.fragmentShader,side:s9,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),H.geometry.deleteAttribute("normal"),Object.defineProperty(H.material,"map",{get:function(){return this.uniforms.t2D.value}}),Z.update(H);if(H.material.uniforms.t2D.value=V,H.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,H.material.toneMapped=t0.getTransfer(V.colorSpace)!==OJ,V.matrixAutoUpdate===!0)V.updateMatrix();if(H.material.uniforms.uvTransform.value.copy(V.matrix),G!==V||F!==V.version||E!==J.toneMapping)H.material.needsUpdate=!0,G=V,F=V.version,E=J.toneMapping;H.layers.enableAll(),L.unshift(H,H.geometry,H.material,0,0,null)}}function q(L,D){L.getRGB(oW,OK(J)),$.buffers.color.setClear(oW.r,oW.g,oW.b,D,Y)}function N(){if(U!==void 0)U.geometry.dispose(),U.material.dispose(),U=void 0;if(H!==void 0)H.geometry.dispose(),H.material.dispose(),H=void 0}return{getClearColor:function(){return X},setClearColor:function(L,D=1){X.set(L),K=D,q(X,K)},getClearAlpha:function(){return K},setClearAlpha:function(L){K=L,q(X,K)},render:R,addToRenderList:M,dispose:N}}function OR(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=E(null),Y=W,X=!1;function K(w,v,b,S,h){let x=!1,p=F(w,S,b,v);if(Y!==p)Y=p,U(Y.object);if(x=O(w,S,b,h),x)R(w,S,b,h);if(h!==null)Q.update(h,J.ELEMENT_ARRAY_BUFFER);if(x||X){if(X=!1,V(w,v,b,S),h!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(h).buffer)}}function H(){return J.createVertexArray()}function U(w){return J.bindVertexArray(w)}function G(w){return J.deleteVertexArray(w)}function F(w,v,b,S){let h=S.wireframe===!0,x=Z[v.id];if(x===void 0)x={},Z[v.id]=x;let p=w.isInstancedMesh===!0?w.id:0,c=x[p];if(c===void 0)c={},x[p]=c;let o=c[b.id];if(o===void 0)o={},c[b.id]=o;let W0=o[h];if(W0===void 0)W0=E(H()),o[h]=W0;return W0}function E(w){let v=[],b=[],S=[];for(let h=0;h<$;h++)v[h]=0,b[h]=0,S[h]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:v,enabledAttributes:b,attributeDivisors:S,object:w,attributes:{},index:null}}function O(w,v,b,S){let h=Y.attributes,x=v.attributes,p=0,c=b.getAttributes();for(let o in c)if(c[o].location>=0){let H0=h[o],J0=x[o];if(J0===void 0){if(o==="instanceMatrix"&&w.instanceMatrix)J0=w.instanceMatrix;if(o==="instanceColor"&&w.instanceColor)J0=w.instanceColor}if(H0===void 0)return!0;if(H0.attribute!==J0)return!0;if(J0&&H0.data!==J0.data)return!0;p++}if(Y.attributesNum!==p)return!0;if(Y.index!==S)return!0;return!1}function R(w,v,b,S){let h={},x=v.attributes,p=0,c=b.getAttributes();for(let o in c)if(c[o].location>=0){let H0=x[o];if(H0===void 0){if(o==="instanceMatrix"&&w.instanceMatrix)H0=w.instanceMatrix;if(o==="instanceColor"&&w.instanceColor)H0=w.instanceColor}let J0={};if(J0.attribute=H0,H0&&H0.data)J0.data=H0.data;h[o]=J0,p++}Y.attributes=h,Y.attributesNum=p,Y.index=S}function M(){let w=Y.newAttributes;for(let v=0,b=w.length;v<b;v++)w[v]=0}function q(w){N(w,0)}function N(w,v){let{newAttributes:b,enabledAttributes:S,attributeDivisors:h}=Y;if(b[w]=1,S[w]===0)J.enableVertexAttribArray(w),S[w]=1;if(h[w]!==v)J.vertexAttribDivisor(w,v),h[w]=v}function L(){let{newAttributes:w,enabledAttributes:v}=Y;for(let b=0,S=v.length;b<S;b++)if(v[b]!==w[b])J.disableVertexAttribArray(b),v[b]=0}function D(w,v,b,S,h,x,p){if(p===!0)J.vertexAttribIPointer(w,v,b,h,x);else J.vertexAttribPointer(w,v,b,S,h,x)}function V(w,v,b,S){M();let h=S.attributes,x=b.getAttributes(),p=v.defaultAttributeValues;for(let c in x){let o=x[c];if(o.location>=0){let W0=h[c];if(W0===void 0){if(c==="instanceMatrix"&&w.instanceMatrix)W0=w.instanceMatrix;if(c==="instanceColor"&&w.instanceColor)W0=w.instanceColor}if(W0!==void 0){let{normalized:H0,itemSize:J0}=W0,c0=Q.get(W0);if(c0===void 0)continue;let{buffer:d0,type:s,bytesPerElement:F0}=c0,I0=s===J.INT||s===J.UNSIGNED_INT||W0.gpuType===wZ;if(W0.isInterleavedBufferAttribute){let E0=W0.data,j0=E0.stride,WJ=W0.offset;if(E0.isInstancedInterleavedBuffer){for(let x0=0;x0<o.locationSize;x0++)N(o.location+x0,E0.meshPerAttribute);if(w.isInstancedMesh!==!0&&S._maxInstanceCount===void 0)S._maxInstanceCount=E0.meshPerAttribute*E0.count}else for(let x0=0;x0<o.locationSize;x0++)q(o.location+x0);J.bindBuffer(J.ARRAY_BUFFER,d0);for(let x0=0;x0<o.locationSize;x0++)D(o.location+x0,J0/o.locationSize,s,H0,j0*F0,(WJ+J0/o.locationSize*x0)*F0,I0)}else{if(W0.isInstancedBufferAttribute){for(let E0=0;E0<o.locationSize;E0++)N(o.location+E0,W0.meshPerAttribute);if(w.isInstancedMesh!==!0&&S._maxInstanceCount===void 0)S._maxInstanceCount=W0.meshPerAttribute*W0.count}else for(let E0=0;E0<o.locationSize;E0++)q(o.location+E0);J.bindBuffer(J.ARRAY_BUFFER,d0);for(let E0=0;E0<o.locationSize;E0++)D(o.location+E0,J0/o.locationSize,s,H0,J0*F0,J0/o.locationSize*E0*F0,I0)}}else if(p!==void 0){let H0=p[c];if(H0!==void 0)switch(H0.length){case 2:J.vertexAttrib2fv(o.location,H0);break;case 3:J.vertexAttrib3fv(o.location,H0);break;case 4:J.vertexAttrib4fv(o.location,H0);break;default:J.vertexAttrib1fv(o.location,H0)}}}}L()}function z(){C();for(let w in Z){let v=Z[w];for(let b in v){let S=v[b];for(let h in S){let x=S[h];for(let p in x)G(x[p].object),delete x[p];delete S[h]}}delete Z[w]}}function I(w){if(Z[w.id]===void 0)return;let v=Z[w.id];for(let b in v){let S=v[b];for(let h in S){let x=S[h];for(let p in x)G(x[p].object),delete x[p];delete S[h]}}delete Z[w.id]}function B(w){for(let v in Z){let b=Z[v];for(let S in b){let h=b[S];if(h[w.id]===void 0)continue;let x=h[w.id];for(let p in x)G(x[p].object),delete x[p];delete h[w.id]}}}function k(w){for(let v in Z){let b=Z[v],S=w.isInstancedMesh===!0?w.id:0,h=b[S];if(h===void 0)continue;for(let x in h){let p=h[x];for(let c in p)G(p[c].object),delete p[c];delete h[x]}if(delete b[S],Object.keys(b).length===0)delete Z[v]}}function C(){if(j(),X=!0,Y===W)return;Y=W,U(Y.object)}function j(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:K,reset:C,resetDefaultState:j,dispose:z,releaseStatesOfGeometry:I,releaseStatesOfObject:k,releaseStatesOfProgram:B,initAttributes:M,enableAttribute:q,disableUnusedAttributes:L}}function qR(J,Q,$){let Z;function W(H){Z=H}function Y(H,U){J.drawArrays(Z,H,U),$.update(U,Z,1)}function X(H,U,G){if(G===0)return;J.drawArraysInstanced(Z,H,U,G),$.update(U,Z,G)}function K(H,U,G){if(G===0)return;Q.get("WEBGL_multi_draw").multiDrawArraysWEBGL(Z,H,0,U,0,G);let E=0;for(let O=0;O<G;O++)E+=U[O];$.update(E,Z,1)}this.setMode=W,this.render=Y,this.renderInstances=X,this.renderMultiDraw=K}function RR(J,Q,$,Z){let W;function Y(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let B=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function X(B){if(B!==o9&&Z.convert(B)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function K(B){let k=B===wJ&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(B!==j9&&Z.convert(B)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&B!==N9&&!k)return!1;return!0}function H(B){if(B==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";B="mediump"}if(B==="mediump"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.MEDIUM_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let U=$.precision!==void 0?$.precision:"highp",G=H(U);if(G!==U)O0("WebGLRenderer:",U,"not supported, using",G,"instead."),U=G;let F=$.logarithmicDepthBuffer===!0,E=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control");if($.reversedDepthBuffer===!0&&E===!1)O0("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let O=J.getParameter(J.MAX_TEXTURE_IMAGE_UNITS),R=J.getParameter(J.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=J.getParameter(J.MAX_TEXTURE_SIZE),q=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),N=J.getParameter(J.MAX_VERTEX_ATTRIBS),L=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),D=J.getParameter(J.MAX_VARYING_VECTORS),V=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),z=J.getParameter(J.MAX_SAMPLES),I=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:Y,getMaxPrecision:H,textureFormatReadable:X,textureTypeReadable:K,precision:U,logarithmicDepthBuffer:F,reversedDepthBuffer:E,maxTextures:O,maxVertexTextures:R,maxTextureSize:M,maxCubemapSize:q,maxAttributes:N,maxVertexUniforms:L,maxVaryings:D,maxFragmentUniforms:V,maxSamples:z,samples:I}}function LR(J){let Q=this,$=null,Z=0,W=!1,Y=!1,X=new w9,K=new o0,H={value:null,needsUpdate:!1};this.uniform=H,this.numPlanes=0,this.numIntersection=0,this.init=function(F,E){let O=F.length!==0||E||Z!==0||W;return W=E,Z=F.length,O},this.beginShadows=function(){Y=!0,G(null)},this.endShadows=function(){Y=!1},this.setGlobalState=function(F,E){$=G(F,E,0)},this.setState=function(F,E,O){let{clippingPlanes:R,clipIntersection:M,clipShadows:q}=F,N=J.get(F);if(!W||R===null||R.length===0||Y&&!q)if(Y)G(null);else U();else{let L=Y?0:Z,D=L*4,V=N.clippingState||null;H.value=V,V=G(R,E,D,O);for(let z=0;z!==D;++z)V[z]=$[z];N.clippingState=V,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=L}};function U(){if(H.value!==$)H.value=$,H.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function G(F,E,O,R){let M=F!==null?F.length:0,q=null;if(M!==0){if(q=H.value,R!==!0||q===null){let N=O+M*4,L=E.matrixWorldInverse;if(K.getNormalMatrix(L),q===null||q.length<N)q=new Float32Array(N);for(let D=0,V=O;D!==M;++D,V+=4)X.copy(F[D]).applyMatrix4(L,K),X.normal.toArray(q,V),q[V+3]=X.constant}H.value=q,H.needsUpdate=!0}return Q.numPlanes=M,Q.numIntersection=0,q}}var Y6=4,_5=[0.125,0.215,0.35,0.446,0.526,0.582],l6=20,DR=256,M$=new t9,w5=new e,$H=null,ZH=0,WH=0,YH=!1,MR=new A;class c6{constructor(J){this._renderer=J,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(J,Q=0,$=0.1,Z=100,W={}){let{size:Y=256,position:X=MR}=W;$H=this._renderer.getRenderTarget(),ZH=this._renderer.getActiveCubeFace(),WH=this._renderer.getActiveMipmapLevel(),YH=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(Y);let K=this._allocateTargets();if(K.depthBuffer=!0,this._sceneToCubeUV(J,$,Z,K,X),Q>0)this._blur(K,0,0,Q);return this._applyPMREM(K),this._cleanup(K),K}fromEquirectangular(J,Q=null){return this._fromTexture(J,Q)}fromCubemap(J,Q=null){return this._fromTexture(J,Q)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=T5(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=A5(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(J){this._lodMax=Math.floor(Math.log2(J)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let J=0;J<this._lodMeshes.length;J++)this._lodMeshes[J].geometry.dispose()}_cleanup(J){this._renderer.setRenderTarget($H,ZH,WH),this._renderer.xr.enabled=YH,J.scissorTest=!1,r7(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===w6||J.mapping===s8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);$H=this._renderer.getRenderTarget(),ZH=this._renderer.getActiveCubeFace(),WH=this._renderer.getActiveMipmapLevel(),YH=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let $=Q||this._allocateTargets();return this._textureToCubeUV(J,$),this._applyPMREM($),this._cleanup($),$}_allocateTargets(){let J=3*Math.max(this._cubeSize,112),Q=4*this._cubeSize,$={magFilter:jJ,minFilter:jJ,generateMipmaps:!1,type:wJ,format:o9,colorSpace:J9,depthBuffer:!1},Z=P5(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=P5(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=kR(W)),this._blurMaterial=BR(W,J,Q),this._ggxMaterial=VR(W,J,Q)}return Z}_compileMaterial(J){let Q=new a0(new u0,J);this._renderer.compile(Q,M$)}_sceneToCubeUV(J,Q,$,Z,W){let K=new BJ(90,1,Q,$),H=[1,-1,1,1,1,1],U=[1,1,1,-1,-1,-1],G=this._renderer,F=G.autoClear,E=G.toneMapping;if(G.getClearColor(w5),G.toneMapping=F9,G.autoClear=!1,G.state.buffers.depth.getReversed())G.setRenderTarget(Z),G.clearDepth(),G.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new a0(new Q9,new nJ({name:"PMREM.Background",side:uJ,depthWrite:!1,depthTest:!1}));let R=this._backgroundBox,M=R.material,q=!1,N=J.background;if(N){if(N.isColor)M.color.copy(N),J.background=null,q=!0}else M.color.copy(w5),q=!0;for(let L=0;L<6;L++){let D=L%3;if(D===0)K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x+U[L],W.y,W.z);else if(D===1)K.up.set(0,0,H[L]),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y+U[L],W.z);else K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y,W.z+U[L]);let V=this._cubeSize;if(r7(Z,D*V,L>2?V:0,V,V),G.setRenderTarget(Z),q)G.render(R,K);G.render(J,K)}G.toneMapping=E,G.autoClear=F,J.background=N}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===w6||J.mapping===s8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=T5();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=A5();let W=Z?this._cubemapMaterial:this._equirectMaterial,Y=this._lodMeshes[0];Y.material=W;let X=W.uniforms;X.envMap.value=J;let K=this._cubeSize;r7(Q,0,0,3*K,2*K),$.setRenderTarget(Q),$.render(Y,M$)}_applyPMREM(J){let Q=this._renderer,$=Q.autoClear;Q.autoClear=!1;let Z=this._lodMeshes.length;for(let W=1;W<Z;W++)this._applyGGXFilter(J,W-1,W);Q.autoClear=$}_applyGGXFilter(J,Q,$){let Z=this._renderer,W=this._pingPongRenderTarget,Y=this._ggxMaterial,X=this._lodMeshes[$];X.material=Y;let K=Y.uniforms,H=$/(this._lodMeshes.length-1),U=Q/(this._lodMeshes.length-1),G=Math.sqrt(H*H-U*U),F=0+H*1.25,E=G*F,{_lodMax:O}=this,R=this._sizeLods[$],M=3*R*($>O-Y6?$-O+Y6:0),q=4*(this._cubeSize-R);K.envMap.value=J.texture,K.roughness.value=E,K.mipInt.value=O-Q,r7(W,M,q,3*R,2*R),Z.setRenderTarget(W),Z.render(X,M$),K.envMap.value=W.texture,K.roughness.value=0,K.mipInt.value=O-$,r7(J,M,q,3*R,2*R),Z.setRenderTarget(J),Z.render(X,M$)}_blur(J,Q,$,Z,W){let Y=this._pingPongRenderTarget;this._halfBlur(J,Y,Q,$,Z,"latitudinal",W),this._halfBlur(Y,J,$,$,Z,"longitudinal",W)}_halfBlur(J,Q,$,Z,W,Y,X){let K=this._renderer,H=this._blurMaterial;if(Y!=="latitudinal"&&Y!=="longitudinal")v0("blur direction must be either latitudinal or longitudinal!");let U=3,G=this._lodMeshes[Z];G.material=H;let F=H.uniforms,E=this._sizeLods[$]-1,O=isFinite(W)?Math.PI/(2*E):2*Math.PI/(2*l6-1),R=W/O,M=isFinite(W)?1+Math.floor(U*R):l6;if(M>l6)O0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${M} samples when the maximum is set to ${l6}`);let q=[],N=0;for(let I=0;I<l6;++I){let B=I/R,k=Math.exp(-B*B/2);if(q.push(k),I===0)N+=k;else if(I<M)N+=2*k}for(let I=0;I<q.length;I++)q[I]=q[I]/N;if(F.envMap.value=J.texture,F.samples.value=M,F.weights.value=q,F.latitudinal.value=Y==="latitudinal",X)F.poleAxis.value=X;let{_lodMax:L}=this;F.dTheta.value=O,F.mipInt.value=L-$;let D=this._sizeLods[Z],V=3*D*(Z>L-Y6?Z-L+Y6:0),z=4*(this._cubeSize-D);r7(Q,V,z,3*D,2*D),K.setRenderTarget(Q),K.render(G,M$)}}function kR(J){let Q=[],$=[],Z=[],W=J,Y=J-Y6+1+_5.length;for(let X=0;X<Y;X++){let K=Math.pow(2,W);Q.push(K);let H=1/K;if(X>J-Y6)H=_5[X-J+Y6-1];else if(X===0)H=0;$.push(H);let U=1/(K-2),G=-U,F=1+U,E=[G,G,F,G,F,F,G,G,F,F,G,F],O=6,R=6,M=3,q=2,N=1,L=new Float32Array(M*R*O),D=new Float32Array(q*R*O),V=new Float32Array(N*R*O);for(let I=0;I<O;I++){let B=I%3*2/3-1,k=I>2?0:-1,C=[B,k,0,B+0.6666666666666666,k,0,B+0.6666666666666666,k+1,0,B,k,0,B+0.6666666666666666,k+1,0,B,k+1,0];L.set(C,M*R*I),D.set(E,q*R*I);let j=[I,I,I,I,I,I];V.set(j,N*R*I)}let z=new u0;if(z.setAttribute("position",new i0(L,M)),z.setAttribute("uv",new i0(D,q)),z.setAttribute("faceIndex",new i0(V,N)),Z.push(new a0(z,null)),W>Y6)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function P5(J,Q,$){let Z=new PJ(J,Q,$);return Z.texture.mapping=j7,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function r7(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function VR(J,Q,$){return new LJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:DR,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:rW(),fragmentShader:`
3668
3668
 
3669
3669
  precision highp float;
3670
3670
  precision highp int;
@@ -3768,7 +3768,7 @@ void main() {
3768
3768
 
3769
3769
  gl_FragColor = vec4(prefilteredColor, 1.0);
3770
3770
  }
3771
- `,blending:H9,depthTest:!1,depthWrite:!1})}function IE(J,Q,$){let Z=new Float32Array(g8),W=new S(0,1,0);return new OJ({name:"SphericalGaussianBlur",defines:{n:g8,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:Z},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:W}},vertexShader:gQ(),fragmentShader:`
3771
+ `,blending:V9,depthTest:!1,depthWrite:!1})}function BR(J,Q,$){let Z=new Float32Array(l6),W=new A(0,1,0);return new LJ({name:"SphericalGaussianBlur",defines:{n:l6,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:Z},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:W}},vertexShader:rW(),fragmentShader:`
3772
3772
 
3773
3773
  precision mediump float;
3774
3774
  precision mediump int;
@@ -3828,7 +3828,7 @@ void main() {
3828
3828
  }
3829
3829
 
3830
3830
  }
3831
- `,blending:H9,depthTest:!1,depthWrite:!1})}function _X(){return new OJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:gQ(),fragmentShader:`
3831
+ `,blending:V9,depthTest:!1,depthWrite:!1})}function A5(){return new LJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:rW(),fragmentShader:`
3832
3832
 
3833
3833
  precision mediump float;
3834
3834
  precision mediump int;
@@ -3847,7 +3847,7 @@ void main() {
3847
3847
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3848
3848
 
3849
3849
  }
3850
- `,blending:H9,depthTest:!1,depthWrite:!1})}function wX(){return new OJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:gQ(),fragmentShader:`
3850
+ `,blending:V9,depthTest:!1,depthWrite:!1})}function T5(){return new LJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:rW(),fragmentShader:`
3851
3851
 
3852
3852
  precision mediump float;
3853
3853
  precision mediump int;
@@ -3863,7 +3863,7 @@ void main() {
3863
3863
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3864
3864
 
3865
3865
  }
3866
- `,blending:H9,depthTest:!1,depthWrite:!1})}function gQ(){return`
3866
+ `,blending:V9,depthTest:!1,depthWrite:!1})}function rW(){return`
3867
3867
 
3868
3868
  precision mediump float;
3869
3869
  precision mediump int;
@@ -3918,7 +3918,7 @@ void main() {
3918
3918
  gl_Position = vec4( position, 1.0 );
3919
3919
 
3920
3920
  }
3921
- `}class eZ extends TJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new CQ(Z),this._setTextureOptions(Q),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(J,Q){this.texture.type=Q.type,this.texture.colorSpace=Q.colorSpace,this.texture.generateMipmaps=Q.generateMipmaps,this.texture.minFilter=Q.minFilter,this.texture.magFilter=Q.magFilter;let $={uniforms:{tEquirect:{value:null}},vertexShader:`
3921
+ `}class tW extends PJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new h6(Z),this._setTextureOptions(Q),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(J,Q){this.texture.type=Q.type,this.texture.colorSpace=Q.colorSpace,this.texture.generateMipmaps=Q.generateMipmaps,this.texture.minFilter=Q.minFilter,this.texture.magFilter=Q.magFilter;let $={uniforms:{tEquirect:{value:null}},vertexShader:`
3922
3922
 
3923
3923
  varying vec3 vWorldDirection;
3924
3924
 
@@ -3953,7 +3953,7 @@ void main() {
3953
3953
  gl_FragColor = texture2D( tEquirect, sampleUV );
3954
3954
 
3955
3955
  }
3956
- `},Z=new aJ(5,5,5),W=new OJ({name:"CubemapFromEquirect",uniforms:f8($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:yJ,blending:H9});W.uniforms.tEquirect.value=Q;let Y=new a0(Z,W),X=Q.minFilter;if(Q.minFilter===S9)Q.minFilter=CJ;return new hZ(1,10,this).update(J,Y),Q.minFilter=X,Y.geometry.dispose(),Y.material.dispose(),this}clear(J,Q=!0,$=!0,Z=!0){let W=J.getRenderTarget();for(let Y=0;Y<6;Y++)J.setRenderTarget(this,Y),J.clear(Q,$,Z);J.setRenderTarget(W)}}function zE(J){let Q=new WeakMap,$=new WeakMap,Z=null;function W(E,O=!1){if(E===null||E===void 0)return null;if(O)return X(E);return Y(E)}function Y(E){if(E&&E.isTexture){let O=E.mapping;if(O===ZQ||O===WQ)if(Q.has(E)){let R=Q.get(E).texture;return K(R,E.mapping)}else{let R=E.image;if(R&&R.height>0){let C=new eZ(R.height);return C.fromEquirectangularTexture(J,E),Q.set(E,C),E.addEventListener("dispose",U),K(C.texture,E.mapping)}else return null}}return E}function X(E){if(E&&E.isTexture){let O=E.mapping,R=O===ZQ||O===WQ,C=O===F6||O===A8;if(R||C){let q=$.get(E),N=q!==void 0?q.texture.pmremVersion:0;if(E.isRenderTargetTexture&&E.pmremVersion!==N){if(Z===null)Z=new P6(J);return q=R?Z.fromEquirectangular(E,q):Z.fromCubemap(E,q),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),q.texture}else if(q!==void 0)return q.texture;else{let L=E.image;if(R&&L&&L.height>0||C&&L&&H(L)){if(Z===null)Z=new P6(J);return q=R?Z.fromEquirectangular(E):Z.fromCubemap(E),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),E.addEventListener("dispose",G),q.texture}else return null}}}return E}function K(E,O){if(O===ZQ)E.mapping=F6;else if(O===WQ)E.mapping=A8;return E}function H(E){let O=0,R=6;for(let C=0;C<R;C++)if(E[C]!==void 0)O++;return O===R}function U(E){let O=E.target;O.removeEventListener("dispose",U);let R=Q.get(O);if(R!==void 0)Q.delete(O),R.dispose()}function G(E){let O=E.target;O.removeEventListener("dispose",G);let R=$.get(O);if(R!==void 0)$.delete(O),R.dispose()}function F(){if(Q=new WeakMap,$=new WeakMap,Z!==null)Z.dispose(),Z=null}return{get:W,dispose:F}}function _E(J){let Q={};function $(Z){if(Q[Z]!==void 0)return Q[Z];let W=J.getExtension(Z);return Q[Z]=W,W}return{has:function(Z){return $(Z)!==null},init:function(){$("EXT_color_buffer_float"),$("WEBGL_clip_cull_distance"),$("OES_texture_float_linear"),$("EXT_color_buffer_half_float"),$("WEBGL_multisampled_render_to_texture"),$("WEBGL_render_shared_exponent")},get:function(Z){let W=$(Z);if(W===null)JQ("WebGLRenderer: "+Z+" extension not supported.");return W}}}function wE(J,Q,$,Z){let W={},Y=new WeakMap;function X(F){let E=F.target;if(E.index!==null)Q.remove(E.index);for(let R in E.attributes)Q.remove(E.attributes[R]);E.removeEventListener("dispose",X),delete W[E.id];let O=Y.get(E);if(O)Q.remove(O),Y.delete(E);if(Z.releaseStatesOfGeometry(E),E.isInstancedBufferGeometry===!0)delete E._maxInstanceCount;$.memory.geometries--}function K(F,E){if(W[E.id]===!0)return E;return E.addEventListener("dispose",X),W[E.id]=!0,$.memory.geometries++,E}function H(F){let E=F.attributes;for(let O in E)Q.update(E[O],J.ARRAY_BUFFER)}function U(F){let E=[],O=F.index,R=F.attributes.position,C=0;if(R===void 0)return;if(O!==null){let L=O.array;C=O.version;for(let k=0,M=L.length;k<M;k+=3){let P=L[k+0],w=L[k+1],B=L[k+2];E.push(P,w,w,B,B,P)}}else{let L=R.array;C=R.version;for(let k=0,M=L.length/3-1;k<M;k+=3){let P=k+0,w=k+1,B=k+2;E.push(P,w,w,B,B,P)}}let q=new(R.count>=65535?kQ:DQ)(E,1);q.version=C;let N=Y.get(F);if(N)Q.remove(N);Y.set(F,q)}function G(F){let E=Y.get(F);if(E){let O=F.index;if(O!==null){if(E.version<O.version)U(F)}}else U(F);return Y.get(F)}return{get:K,update:H,getWireframeAttribute:G}}function PE(J,Q,$){let Z;function W(F){Z=F}let Y,X;function K(F){Y=F.type,X=F.bytesPerElement}function H(F,E){J.drawElements(Z,E,Y,F*X),$.update(E,Z,1)}function U(F,E,O){if(O===0)return;J.drawElementsInstanced(Z,E,Y,F*X,O),$.update(E,Z,O)}function G(F,E,O){if(O===0)return;Q.get("WEBGL_multi_draw").multiDrawElementsWEBGL(Z,E,0,Y,F,0,O);let C=0;for(let q=0;q<O;q++)C+=E[q];$.update(C,Z,1)}this.setMode=W,this.setIndex=K,this.render=H,this.renderInstances=U,this.renderMultiDraw=G}function TE(J){let Q={geometries:0,textures:0},$={frame:0,calls:0,triangles:0,points:0,lines:0};function Z(Y,X,K){switch($.calls++,X){case J.TRIANGLES:$.triangles+=K*(Y/3);break;case J.LINES:$.lines+=K*(Y/2);break;case J.LINE_STRIP:$.lines+=K*(Y-1);break;case J.LINE_LOOP:$.lines+=K*Y;break;case J.POINTS:$.points+=K*Y;break;default:S0("WebGLInfo: Unknown draw mode:",X);break}}function W(){$.calls=0,$.triangles=0,$.points=0,$.lines=0}return{memory:Q,render:$,programs:null,autoReset:!0,reset:W,update:Z}}function AE(J,Q,$){let Z=new WeakMap,W=new $J;function Y(X,K,H){let U=X.morphTargetInfluences,G=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,F=G!==void 0?G.length:0,E=Z.get(K);if(E===void 0||E.count!==F){let V=function(){B.dispose(),Z.delete(K),K.removeEventListener("dispose",V)};if(E!==void 0)E.texture.dispose();let O=K.morphAttributes.position!==void 0,R=K.morphAttributes.normal!==void 0,C=K.morphAttributes.color!==void 0,q=K.morphAttributes.position||[],N=K.morphAttributes.normal||[],L=K.morphAttributes.color||[],k=0;if(O===!0)k=1;if(R===!0)k=2;if(C===!0)k=3;let M=K.attributes.position.count*k,P=1;if(M>Q.maxTextureSize)P=Math.ceil(M/Q.maxTextureSize),M=Q.maxTextureSize;let w=new Float32Array(M*P*4*F),B=new RQ(w,M,P,F);B.type=$9,B.needsUpdate=!0;let D=k*4;for(let j=0;j<F;j++){let z=q[j],v=N[j],y=L[j],A=M*P*4*j;for(let x=0;x<z.count;x++){let b=x*D;if(O===!0)W.fromBufferAttribute(z,x),w[A+b+0]=W.x,w[A+b+1]=W.y,w[A+b+2]=W.z,w[A+b+3]=0;if(R===!0)W.fromBufferAttribute(v,x),w[A+b+4]=W.x,w[A+b+5]=W.y,w[A+b+6]=W.z,w[A+b+7]=0;if(C===!0)W.fromBufferAttribute(y,x),w[A+b+8]=W.x,w[A+b+9]=W.y,w[A+b+10]=W.z,w[A+b+11]=y.itemSize===4?W.w:1}}E={count:F,texture:B,size:new T0(M,P)},Z.set(K,E),K.addEventListener("dispose",V)}if(X.isInstancedMesh===!0&&X.morphTexture!==null)H.getUniforms().setValue(J,"morphTexture",X.morphTexture,$);else{let O=0;for(let C=0;C<U.length;C++)O+=U[C];let R=K.morphTargetsRelative?1:1-O;H.getUniforms().setValue(J,"morphTargetBaseInfluence",R),H.getUniforms().setValue(J,"morphTargetInfluences",U)}H.getUniforms().setValue(J,"morphTargetsTexture",E.texture,$),H.getUniforms().setValue(J,"morphTargetsTextureSize",E.size)}return{update:Y}}function SE(J,Q,$,Z,W){let Y=new WeakMap;function X(U){let G=W.render.frame,F=U.geometry,E=Q.get(U,F);if(Y.get(E)!==G)Q.update(E),Y.set(E,G);if(U.isInstancedMesh){if(U.hasEventListener("dispose",H)===!1)U.addEventListener("dispose",H);if(Y.get(U)!==G){if($.update(U.instanceMatrix,J.ARRAY_BUFFER),U.instanceColor!==null)$.update(U.instanceColor,J.ARRAY_BUFFER);Y.set(U,G)}}if(U.isSkinnedMesh){let O=U.skeleton;if(Y.get(O)!==G)O.update(),Y.set(O,G)}return E}function K(){Y=new WeakMap}function H(U){let G=U.target;if(G.removeEventListener("dispose",H),Z.releaseStatesOfObject(G),$.remove(G.instanceMatrix),G.instanceColor!==null)$.remove(G.instanceColor)}return{update:X,dispose:K}}var jE={[s6]:"LINEAR_TONE_MAPPING",[i6]:"REINHARD_TONE_MAPPING",[o6]:"CINEON_TONE_MAPPING",[T8]:"ACES_FILMIC_TONE_MAPPING",[r6]:"AGX_TONE_MAPPING",[t6]:"NEUTRAL_TONE_MAPPING",[a6]:"CUSTOM_TONE_MAPPING"};function vE(J,Q,$,Z,W){let Y=new TJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W,depthTexture:Z?new N8(Q,$):void 0}),X=new TJ(Q,$,{type:kJ,depthBuffer:!1,stencilBuffer:!1}),K=new qJ;K.setAttribute("position",new WJ([-1,3,0,-1,-1,0,3,-1,0],3)),K.setAttribute("uv",new WJ([0,2,0,0,2,0],2));let H=new N7({uniforms:{tDiffuse:{value:null}},vertexShader:`
3956
+ `},Z=new Q9(5,5,5),W=new LJ({name:"CubemapFromEquirect",uniforms:p6($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:uJ,blending:V9});W.uniforms.tEquirect.value=Q;let Y=new a0(Z,W),X=Q.minFilter;if(Q.minFilter===i9)Q.minFilter=jJ;return new uW(1,10,this).update(J,Y),Q.minFilter=X,Y.geometry.dispose(),Y.material.dispose(),this}clear(J,Q=!0,$=!0,Z=!0){let W=J.getRenderTarget();for(let Y=0;Y<6;Y++)J.setRenderTarget(this,Y),J.clear(Q,$,Z);J.setRenderTarget(W)}}function CR(J){let Q=new WeakMap,$=new WeakMap,Z=null;function W(E,O=!1){if(E===null||E===void 0)return null;if(O)return X(E);return Y(E)}function Y(E){if(E&&E.isTexture){let O=E.mapping;if(O===IQ||O===_Q)if(Q.has(E)){let R=Q.get(E).texture;return K(R,E.mapping)}else{let R=E.image;if(R&&R.height>0){let M=new tW(R.height);return M.fromEquirectangularTexture(J,E),Q.set(E,M),E.addEventListener("dispose",U),K(M.texture,E.mapping)}else return null}}return E}function X(E){if(E&&E.isTexture){let O=E.mapping,R=O===IQ||O===_Q,M=O===w6||O===s8;if(R||M){let q=$.get(E),N=q!==void 0?q.texture.pmremVersion:0;if(E.isRenderTargetTexture&&E.pmremVersion!==N){if(Z===null)Z=new c6(J);return q=R?Z.fromEquirectangular(E,q):Z.fromCubemap(E,q),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),q.texture}else if(q!==void 0)return q.texture;else{let L=E.image;if(R&&L&&L.height>0||M&&L&&H(L)){if(Z===null)Z=new c6(J);return q=R?Z.fromEquirectangular(E):Z.fromCubemap(E),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),E.addEventListener("dispose",G),q.texture}else return null}}}return E}function K(E,O){if(O===IQ)E.mapping=w6;else if(O===_Q)E.mapping=s8;return E}function H(E){let O=0,R=6;for(let M=0;M<R;M++)if(E[M]!==void 0)O++;return O===R}function U(E){let O=E.target;O.removeEventListener("dispose",U);let R=Q.get(O);if(R!==void 0)Q.delete(O),R.dispose()}function G(E){let O=E.target;O.removeEventListener("dispose",G);let R=$.get(O);if(R!==void 0)$.delete(O),R.dispose()}function F(){if(Q=new WeakMap,$=new WeakMap,Z!==null)Z.dispose(),Z=null}return{get:W,dispose:F}}function zR(J){let Q={};function $(Z){if(Q[Z]!==void 0)return Q[Z];let W=J.getExtension(Z);return Q[Z]=W,W}return{has:function(Z){return $(Z)!==null},init:function(){$("EXT_color_buffer_float"),$("WEBGL_clip_cull_distance"),$("OES_texture_float_linear"),$("EXT_color_buffer_half_float"),$("WEBGL_multisampled_render_to_texture"),$("WEBGL_render_shared_exponent")},get:function(Z){let W=$(Z);if(W===null)VQ("WebGLRenderer: "+Z+" extension not supported.");return W}}}function IR(J,Q,$,Z){let W={},Y=new WeakMap;function X(F){let E=F.target;if(E.index!==null)Q.remove(E.index);for(let R in E.attributes)Q.remove(E.attributes[R]);E.removeEventListener("dispose",X),delete W[E.id];let O=Y.get(E);if(O)Q.remove(O),Y.delete(E);if(Z.releaseStatesOfGeometry(E),E.isInstancedBufferGeometry===!0)delete E._maxInstanceCount;$.memory.geometries--}function K(F,E){if(W[E.id]===!0)return E;return E.addEventListener("dispose",X),W[E.id]=!0,$.memory.geometries++,E}function H(F){let E=F.attributes;for(let O in E)Q.update(E[O],J.ARRAY_BUFFER)}function U(F){let E=[],O=F.index,R=F.attributes.position,M=0;if(R===void 0)return;if(O!==null){let L=O.array;M=O.version;for(let D=0,V=L.length;D<V;D+=3){let z=L[D+0],I=L[D+1],B=L[D+2];E.push(z,I,I,B,B,z)}}else{let L=R.array;M=R.version;for(let D=0,V=L.length/3-1;D<V;D+=3){let z=D+0,I=D+1,B=D+2;E.push(z,I,I,B,B,z)}}let q=new(R.count>=65535?dQ:uQ)(E,1);q.version=M;let N=Y.get(F);if(N)Q.remove(N);Y.set(F,q)}function G(F){let E=Y.get(F);if(E){let O=F.index;if(O!==null){if(E.version<O.version)U(F)}}else U(F);return Y.get(F)}return{get:K,update:H,getWireframeAttribute:G}}function _R(J,Q,$){let Z;function W(F){Z=F}let Y,X;function K(F){Y=F.type,X=F.bytesPerElement}function H(F,E){J.drawElements(Z,E,Y,F*X),$.update(E,Z,1)}function U(F,E,O){if(O===0)return;J.drawElementsInstanced(Z,E,Y,F*X,O),$.update(E,Z,O)}function G(F,E,O){if(O===0)return;Q.get("WEBGL_multi_draw").multiDrawElementsWEBGL(Z,E,0,Y,F,0,O);let M=0;for(let q=0;q<O;q++)M+=E[q];$.update(M,Z,1)}this.setMode=W,this.setIndex=K,this.render=H,this.renderInstances=U,this.renderMultiDraw=G}function wR(J){let Q={geometries:0,textures:0},$={frame:0,calls:0,triangles:0,points:0,lines:0};function Z(Y,X,K){switch($.calls++,X){case J.TRIANGLES:$.triangles+=K*(Y/3);break;case J.LINES:$.lines+=K*(Y/2);break;case J.LINE_STRIP:$.lines+=K*(Y-1);break;case J.LINE_LOOP:$.lines+=K*Y;break;case J.POINTS:$.points+=K*Y;break;default:v0("WebGLInfo: Unknown draw mode:",X);break}}function W(){$.calls=0,$.triangles=0,$.points=0,$.lines=0}return{memory:Q,render:$,programs:null,autoReset:!0,reset:W,update:Z}}function PR(J,Q,$){let Z=new WeakMap,W=new FJ;function Y(X,K,H){let U=X.morphTargetInfluences,G=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,F=G!==void 0?G.length:0,E=Z.get(K);if(E===void 0||E.count!==F){let C=function(){B.dispose(),Z.delete(K),K.removeEventListener("dispose",C)};if(E!==void 0)E.texture.dispose();let O=K.morphAttributes.position!==void 0,R=K.morphAttributes.normal!==void 0,M=K.morphAttributes.color!==void 0,q=K.morphAttributes.position||[],N=K.morphAttributes.normal||[],L=K.morphAttributes.color||[],D=0;if(O===!0)D=1;if(R===!0)D=2;if(M===!0)D=3;let V=K.attributes.position.count*D,z=1;if(V>Q.maxTextureSize)z=Math.ceil(V/Q.maxTextureSize),V=Q.maxTextureSize;let I=new Float32Array(V*z*4*F),B=new x7(I,V,z,F);B.type=N9,B.needsUpdate=!0;let k=D*4;for(let j=0;j<F;j++){let w=q[j],v=N[j],b=L[j],S=V*z*4*j;for(let h=0;h<w.count;h++){let x=h*k;if(O===!0)W.fromBufferAttribute(w,h),I[S+x+0]=W.x,I[S+x+1]=W.y,I[S+x+2]=W.z,I[S+x+3]=0;if(R===!0)W.fromBufferAttribute(v,h),I[S+x+4]=W.x,I[S+x+5]=W.y,I[S+x+6]=W.z,I[S+x+7]=0;if(M===!0)W.fromBufferAttribute(b,h),I[S+x+8]=W.x,I[S+x+9]=W.y,I[S+x+10]=W.z,I[S+x+11]=b.itemSize===4?W.w:1}}E={count:F,texture:B,size:new i(V,z)},Z.set(K,E),K.addEventListener("dispose",C)}if(X.isInstancedMesh===!0&&X.morphTexture!==null)H.getUniforms().setValue(J,"morphTexture",X.morphTexture,$);else{let O=0;for(let M=0;M<U.length;M++)O+=U[M];let R=K.morphTargetsRelative?1:1-O;H.getUniforms().setValue(J,"morphTargetBaseInfluence",R),H.getUniforms().setValue(J,"morphTargetInfluences",U)}H.getUniforms().setValue(J,"morphTargetsTexture",E.texture,$),H.getUniforms().setValue(J,"morphTargetsTextureSize",E.size)}return{update:Y}}function AR(J,Q,$,Z,W){let Y=new WeakMap;function X(U){let G=W.render.frame,F=U.geometry,E=Q.get(U,F);if(Y.get(E)!==G)Q.update(E),Y.set(E,G);if(U.isInstancedMesh){if(U.hasEventListener("dispose",H)===!1)U.addEventListener("dispose",H);if(Y.get(U)!==G){if($.update(U.instanceMatrix,J.ARRAY_BUFFER),U.instanceColor!==null)$.update(U.instanceColor,J.ARRAY_BUFFER);Y.set(U,G)}}if(U.isSkinnedMesh){let O=U.skeleton;if(Y.get(O)!==G)O.update(),Y.set(O,G)}return E}function K(){Y=new WeakMap}function H(U){let G=U.target;if(G.removeEventListener("dispose",H),Z.releaseStatesOfObject(G),$.remove(G.instanceMatrix),G.instanceColor!==null)$.remove(G.instanceColor)}return{update:X,dispose:K}}var TR={[_7]:"LINEAR_TONE_MAPPING",[w7]:"REINHARD_TONE_MAPPING",[P7]:"CINEON_TONE_MAPPING",[n8]:"ACES_FILMIC_TONE_MAPPING",[T7]:"AGX_TONE_MAPPING",[S7]:"NEUTRAL_TONE_MAPPING",[A7]:"CUSTOM_TONE_MAPPING"};function SR(J,Q,$,Z,W){let Y=new PJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W,depthTexture:Z?new A8(Q,$):void 0}),X=new PJ(Q,$,{type:wJ,depthBuffer:!1,stencilBuffer:!1}),K=new u0;K.setAttribute("position",new z0([-1,3,0,-1,-1,0,3,-1,0],3)),K.setAttribute("uv",new z0([0,2,0,0,2,0],2));let H=new u6({uniforms:{tDiffuse:{value:null}},vertexShader:`
3957
3957
  precision highp float;
3958
3958
 
3959
3959
  uniform mat4 modelViewMatrix;
@@ -3999,17 +3999,17 @@ void main() {
3999
3999
  #ifdef SRGB_TRANSFER
4000
4000
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
4001
4001
  #endif
4002
- }`,depthTest:!1,depthWrite:!1}),U=new a0(K,H),G=new e9(-1,1,1,-1,0,1),F=null,E=null,O=!1,R,C=null,q=[],N=!1;this.setSize=function(L,k){Y.setSize(L,k),X.setSize(L,k);for(let M=0;M<q.length;M++){let P=q[M];if(P.setSize)P.setSize(L,k)}},this.setEffects=function(L){q=L,N=q.length>0&&q[0].isRenderPass===!0;let{width:k,height:M}=Y;for(let P=0;P<q.length;P++){let w=q[P];if(w.setSize)w.setSize(k,M)}},this.begin=function(L,k){if(O)return!1;if(L.toneMapping===Q9&&q.length===0)return!1;if(C=k,k!==null){let{width:M,height:P}=k;if(Y.width!==M||Y.height!==P)this.setSize(M,P)}if(N===!1)L.setRenderTarget(Y);return R=L.toneMapping,L.toneMapping=Q9,!0},this.hasRenderPass=function(){return N},this.end=function(L,k){L.toneMapping=R,O=!0;let M=Y,P=X;for(let w=0;w<q.length;w++){let B=q[w];if(B.enabled===!1)continue;if(B.render(L,P,M,k),B.needsSwap!==!1){let D=M;M=P,P=D}}if(F!==L.outputColorSpace||E!==L.toneMapping){if(F=L.outputColorSpace,E=L.toneMapping,H.defines={},u0.getTransfer(F)===YJ)H.defines.SRGB_TRANSFER="";let w=jE[E];if(w)H.defines[w]="";H.needsUpdate=!0}H.uniforms.tDiffuse.value=M.texture,L.setRenderTarget(C),L.render(U,G),C=null,O=!1},this.isCompositing=function(){return O},this.dispose=function(){if(Y.depthTexture)Y.depthTexture.dispose();Y.dispose(),X.dispose(),K.dispose(),H.dispose()}}var sX=new PJ,rZ=new N8(1,1),iX=new RQ,oX=new IZ,aX=new CQ,PX=[],TX=[],AX=new Float32Array(16),SX=new Float32Array(9),jX=new Float32Array(4);function T6(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,Y=PX[W];if(Y===void 0)Y=new Float32Array(W),PX[W]=Y;if(Q!==0){Z.toArray(Y,0);for(let X=1,K=0;X!==Q;++X)K+=$,J[X].toArray(Y,K)}return Y}function SJ(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$<Z;$++)if(J[$]!==Q[$])return!1;return!0}function jJ(J,Q){for(let $=0,Z=Q.length;$<Z;$++)J[$]=Q[$]}function pQ(J,Q){let $=TX[Q];if($===void 0)$=new Int32Array(Q),TX[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function yE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function xE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2f(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(SJ($,Q))return;J.uniform2fv(this.addr,Q),jJ($,Q)}}function bE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3f(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else if(Q.r!==void 0){if($[0]!==Q.r||$[1]!==Q.g||$[2]!==Q.b)J.uniform3f(this.addr,Q.r,Q.g,Q.b),$[0]=Q.r,$[1]=Q.g,$[2]=Q.b}else{if(SJ($,Q))return;J.uniform3fv(this.addr,Q),jJ($,Q)}}function hE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4f(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(SJ($,Q))return;J.uniform4fv(this.addr,Q),jJ($,Q)}}function fE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(SJ($,Q))return;J.uniformMatrix2fv(this.addr,!1,Q),jJ($,Q)}else{if(SJ($,Z))return;jX.set(Z),J.uniformMatrix2fv(this.addr,!1,jX),jJ($,Z)}}function gE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(SJ($,Q))return;J.uniformMatrix3fv(this.addr,!1,Q),jJ($,Q)}else{if(SJ($,Z))return;SX.set(Z),J.uniformMatrix3fv(this.addr,!1,SX),jJ($,Z)}}function pE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(SJ($,Q))return;J.uniformMatrix4fv(this.addr,!1,Q),jJ($,Q)}else{if(SJ($,Z))return;AX.set(Z),J.uniformMatrix4fv(this.addr,!1,AX),jJ($,Z)}}function uE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function dE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2i(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(SJ($,Q))return;J.uniform2iv(this.addr,Q),jJ($,Q)}}function mE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3i(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(SJ($,Q))return;J.uniform3iv(this.addr,Q),jJ($,Q)}}function lE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4i(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(SJ($,Q))return;J.uniform4iv(this.addr,Q),jJ($,Q)}}function cE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function nE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2ui(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(SJ($,Q))return;J.uniform2uiv(this.addr,Q),jJ($,Q)}}function sE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3ui(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(SJ($,Q))return;J.uniform3uiv(this.addr,Q),jJ($,Q)}}function iE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4ui(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(SJ($,Q))return;J.uniform4uiv(this.addr,Q),jJ($,Q)}}function oE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;let Y;if(this.type===J.SAMPLER_2D_SHADOW)rZ.compareFunction=$.isReversedDepthBuffer()?qQ:OQ,Y=rZ;else Y=sX;$.setTexture2D(Q||Y,W)}function aE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||oX,W)}function rE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||aX,W)}function tE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||iX,W)}function eE(J){switch(J){case 5126:return yE;case 35664:return xE;case 35665:return bE;case 35666:return hE;case 35674:return fE;case 35675:return gE;case 35676:return pE;case 5124:case 35670:return uE;case 35667:case 35671:return dE;case 35668:case 35672:return mE;case 35669:case 35673:return lE;case 5125:return cE;case 36294:return nE;case 36295:return sE;case 36296:return iE;case 35678:case 36198:case 36298:case 36306:case 35682:return oE;case 35679:case 36299:case 36307:return aE;case 35680:case 36300:case 36308:case 36293:return rE;case 36289:case 36303:case 36311:case 36292:return tE}}function J1(J,Q){J.uniform1fv(this.addr,Q)}function Q1(J,Q){let $=T6(Q,this.size,2);J.uniform2fv(this.addr,$)}function $1(J,Q){let $=T6(Q,this.size,3);J.uniform3fv(this.addr,$)}function Z1(J,Q){let $=T6(Q,this.size,4);J.uniform4fv(this.addr,$)}function W1(J,Q){let $=T6(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function Y1(J,Q){let $=T6(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function X1(J,Q){let $=T6(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function K1(J,Q){J.uniform1iv(this.addr,Q)}function H1(J,Q){J.uniform2iv(this.addr,Q)}function U1(J,Q){J.uniform3iv(this.addr,Q)}function G1(J,Q){J.uniform4iv(this.addr,Q)}function E1(J,Q){J.uniform1uiv(this.addr,Q)}function F1(J,Q){J.uniform2uiv(this.addr,Q)}function N1(J,Q){J.uniform3uiv(this.addr,Q)}function O1(J,Q){J.uniform4uiv(this.addr,Q)}function q1(J,Q,$){let Z=this.cache,W=Q.length,Y=pQ($,W);if(!SJ(Z,Y))J.uniform1iv(this.addr,Y),jJ(Z,Y);let X;if(this.type===J.SAMPLER_2D_SHADOW)X=rZ;else X=sX;for(let K=0;K!==W;++K)$.setTexture2D(Q[K]||X,Y[K])}function R1(J,Q,$){let Z=this.cache,W=Q.length,Y=pQ($,W);if(!SJ(Z,Y))J.uniform1iv(this.addr,Y),jJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture3D(Q[X]||oX,Y[X])}function L1(J,Q,$){let Z=this.cache,W=Q.length,Y=pQ($,W);if(!SJ(Z,Y))J.uniform1iv(this.addr,Y),jJ(Z,Y);for(let X=0;X!==W;++X)$.setTextureCube(Q[X]||aX,Y[X])}function D1(J,Q,$){let Z=this.cache,W=Q.length,Y=pQ($,W);if(!SJ(Z,Y))J.uniform1iv(this.addr,Y),jJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture2DArray(Q[X]||iX,Y[X])}function k1(J){switch(J){case 5126:return J1;case 35664:return Q1;case 35665:return $1;case 35666:return Z1;case 35674:return W1;case 35675:return Y1;case 35676:return X1;case 5124:case 35670:return K1;case 35667:case 35671:return H1;case 35668:case 35672:return U1;case 35669:case 35673:return G1;case 5125:return E1;case 36294:return F1;case 36295:return N1;case 36296:return O1;case 35678:case 36198:case 36298:case 36306:case 35682:return q1;case 35679:case 36299:case 36307:return R1;case 35680:case 36300:case 36308:case 36293:return L1;case 36289:case 36303:case 36311:case 36292:return D1}}class rX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=eE(Q.type)}}class tX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=k1(Q.type)}}class eX{constructor(J){this.id=J,this.seq=[],this.map={}}setValue(J,Q,$){let Z=this.seq;for(let W=0,Y=Z.length;W!==Y;++W){let X=Z[W];X.setValue(J,Q[X.id],$)}}}var oZ=/(\w+)(\])?(\[|\.)?/g;function vX(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function M1(J,Q,$){let Z=J.name,W=Z.length;oZ.lastIndex=0;while(!0){let Y=oZ.exec(Z),X=oZ.lastIndex,K=Y[1],H=Y[2]==="]",U=Y[3];if(H)K=K|0;if(U===void 0||U==="["&&X+2===W){vX($,U===void 0?new rX(K,J,Q):new tX(K,J,Q));break}else{let F=$.map[K];if(F===void 0)F=new eX(K),vX($,F);$=F}}}class D7{constructor(J,Q){this.seq=[],this.map={};let $=J.getProgramParameter(Q,J.ACTIVE_UNIFORMS);for(let Y=0;Y<$;++Y){let X=J.getActiveUniform(Q,Y),K=J.getUniformLocation(Q,X.name);M1(X,K,this)}let Z=[],W=[];for(let Y of this.seq)if(Y.type===J.SAMPLER_2D_SHADOW||Y.type===J.SAMPLER_CUBE_SHADOW||Y.type===J.SAMPLER_2D_ARRAY_SHADOW)Z.push(Y);else W.push(Y);if(Z.length>0)this.seq=Z.concat(W)}setValue(J,Q,$,Z){let W=this.map[Q];if(W!==void 0)W.setValue(J,$,Z)}setOptional(J,Q,$){let Z=Q[$];if(Z!==void 0)this.setValue(J,$,Z)}static upload(J,Q,$,Z){for(let W=0,Y=Q.length;W!==Y;++W){let X=Q[W],K=$[X.id];if(K.needsUpdate!==!1)X.setValue(J,K.value,Z)}}static seqWithValue(J,Q){let $=[];for(let Z=0,W=J.length;Z!==W;++Z){let Y=J[Z];if(Y.id in Q)$.push(Y)}return $}}function yX(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var V1=37297,B1=0;function C1(J,Q){let $=J.split(`
4002
+ }`,depthTest:!1,depthWrite:!1}),U=new a0(K,H),G=new t9(-1,1,1,-1,0,1),F=null,E=null,O=!1,R,M=null,q=[],N=!1;this.setSize=function(L,D){Y.setSize(L,D),X.setSize(L,D);for(let V=0;V<q.length;V++){let z=q[V];if(z.setSize)z.setSize(L,D)}},this.setEffects=function(L){q=L,N=q.length>0&&q[0].isRenderPass===!0;let{width:D,height:V}=Y;for(let z=0;z<q.length;z++){let I=q[z];if(I.setSize)I.setSize(D,V)}},this.begin=function(L,D){if(O)return!1;if(L.toneMapping===F9&&q.length===0)return!1;if(M=D,D!==null){let{width:V,height:z}=D;if(Y.width!==V||Y.height!==z)this.setSize(V,z)}if(N===!1)L.setRenderTarget(Y);return R=L.toneMapping,L.toneMapping=F9,!0},this.hasRenderPass=function(){return N},this.end=function(L,D){L.toneMapping=R,O=!0;let V=Y,z=X;for(let I=0;I<q.length;I++){let B=q[I];if(B.enabled===!1)continue;if(B.render(L,z,V,D),B.needsSwap!==!1){let k=V;V=z,z=k}}if(F!==L.outputColorSpace||E!==L.toneMapping){if(F=L.outputColorSpace,E=L.toneMapping,H.defines={},t0.getTransfer(F)===OJ)H.defines.SRGB_TRANSFER="";let I=TR[E];if(I)H.defines[I]="";H.needsUpdate=!0}H.uniforms.tDiffuse.value=V.texture,L.setRenderTarget(M),L.render(U,G),M=null,O=!1},this.isCompositing=function(){return O},this.dispose=function(){if(Y.depthTexture)Y.depthTexture.dispose();Y.dispose(),X.dispose(),K.dispose(),H.dispose()}}var a5=new kJ,HH=new A8(1,1),r5=new x7,t5=new b7,e5=new h6,S5=[],j5=[],v5=new Float32Array(16),y5=new Float32Array(9),x5=new Float32Array(4);function t7(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,Y=S5[W];if(Y===void 0)Y=new Float32Array(W),S5[W]=Y;if(Q!==0){Z.toArray(Y,0);for(let X=1,K=0;X!==Q;++X)K+=$,J[X].toArray(Y,K)}return Y}function mJ(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$<Z;$++)if(J[$]!==Q[$])return!1;return!0}function lJ(J,Q){for(let $=0,Z=Q.length;$<Z;$++)J[$]=Q[$]}function eW(J,Q){let $=j5[Q];if($===void 0)$=new Int32Array(Q),j5[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function jR(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function vR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2f(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(mJ($,Q))return;J.uniform2fv(this.addr,Q),lJ($,Q)}}function yR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3f(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else if(Q.r!==void 0){if($[0]!==Q.r||$[1]!==Q.g||$[2]!==Q.b)J.uniform3f(this.addr,Q.r,Q.g,Q.b),$[0]=Q.r,$[1]=Q.g,$[2]=Q.b}else{if(mJ($,Q))return;J.uniform3fv(this.addr,Q),lJ($,Q)}}function xR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4f(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(mJ($,Q))return;J.uniform4fv(this.addr,Q),lJ($,Q)}}function bR(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(mJ($,Q))return;J.uniformMatrix2fv(this.addr,!1,Q),lJ($,Q)}else{if(mJ($,Z))return;x5.set(Z),J.uniformMatrix2fv(this.addr,!1,x5),lJ($,Z)}}function hR(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(mJ($,Q))return;J.uniformMatrix3fv(this.addr,!1,Q),lJ($,Q)}else{if(mJ($,Z))return;y5.set(Z),J.uniformMatrix3fv(this.addr,!1,y5),lJ($,Z)}}function fR(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(mJ($,Q))return;J.uniformMatrix4fv(this.addr,!1,Q),lJ($,Q)}else{if(mJ($,Z))return;v5.set(Z),J.uniformMatrix4fv(this.addr,!1,v5),lJ($,Z)}}function gR(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function pR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2i(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(mJ($,Q))return;J.uniform2iv(this.addr,Q),lJ($,Q)}}function uR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3i(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(mJ($,Q))return;J.uniform3iv(this.addr,Q),lJ($,Q)}}function dR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4i(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(mJ($,Q))return;J.uniform4iv(this.addr,Q),lJ($,Q)}}function mR(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function lR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2ui(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(mJ($,Q))return;J.uniform2uiv(this.addr,Q),lJ($,Q)}}function cR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3ui(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(mJ($,Q))return;J.uniform3uiv(this.addr,Q),lJ($,Q)}}function nR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4ui(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(mJ($,Q))return;J.uniform4uiv(this.addr,Q),lJ($,Q)}}function sR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;let Y;if(this.type===J.SAMPLER_2D_SHADOW)HH.compareFunction=$.isReversedDepthBuffer()?hQ:bQ,Y=HH;else Y=a5;$.setTexture2D(Q||Y,W)}function iR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||t5,W)}function oR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||e5,W)}function aR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||r5,W)}function rR(J){switch(J){case 5126:return jR;case 35664:return vR;case 35665:return yR;case 35666:return xR;case 35674:return bR;case 35675:return hR;case 35676:return fR;case 5124:case 35670:return gR;case 35667:case 35671:return pR;case 35668:case 35672:return uR;case 35669:case 35673:return dR;case 5125:return mR;case 36294:return lR;case 36295:return cR;case 36296:return nR;case 35678:case 36198:case 36298:case 36306:case 35682:return sR;case 35679:case 36299:case 36307:return iR;case 35680:case 36300:case 36308:case 36293:return oR;case 36289:case 36303:case 36311:case 36292:return aR}}function tR(J,Q){J.uniform1fv(this.addr,Q)}function eR(J,Q){let $=t7(Q,this.size,2);J.uniform2fv(this.addr,$)}function JL(J,Q){let $=t7(Q,this.size,3);J.uniform3fv(this.addr,$)}function QL(J,Q){let $=t7(Q,this.size,4);J.uniform4fv(this.addr,$)}function $L(J,Q){let $=t7(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function ZL(J,Q){let $=t7(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function WL(J,Q){let $=t7(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function YL(J,Q){J.uniform1iv(this.addr,Q)}function XL(J,Q){J.uniform2iv(this.addr,Q)}function KL(J,Q){J.uniform3iv(this.addr,Q)}function HL(J,Q){J.uniform4iv(this.addr,Q)}function UL(J,Q){J.uniform1uiv(this.addr,Q)}function GL(J,Q){J.uniform2uiv(this.addr,Q)}function EL(J,Q){J.uniform3uiv(this.addr,Q)}function FL(J,Q){J.uniform4uiv(this.addr,Q)}function NL(J,Q,$){let Z=this.cache,W=Q.length,Y=eW($,W);if(!mJ(Z,Y))J.uniform1iv(this.addr,Y),lJ(Z,Y);let X;if(this.type===J.SAMPLER_2D_SHADOW)X=HH;else X=a5;for(let K=0;K!==W;++K)$.setTexture2D(Q[K]||X,Y[K])}function OL(J,Q,$){let Z=this.cache,W=Q.length,Y=eW($,W);if(!mJ(Z,Y))J.uniform1iv(this.addr,Y),lJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture3D(Q[X]||t5,Y[X])}function qL(J,Q,$){let Z=this.cache,W=Q.length,Y=eW($,W);if(!mJ(Z,Y))J.uniform1iv(this.addr,Y),lJ(Z,Y);for(let X=0;X!==W;++X)$.setTextureCube(Q[X]||e5,Y[X])}function RL(J,Q,$){let Z=this.cache,W=Q.length,Y=eW($,W);if(!mJ(Z,Y))J.uniform1iv(this.addr,Y),lJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture2DArray(Q[X]||r5,Y[X])}function LL(J){switch(J){case 5126:return tR;case 35664:return eR;case 35665:return JL;case 35666:return QL;case 35674:return $L;case 35675:return ZL;case 35676:return WL;case 5124:case 35670:return YL;case 35667:case 35671:return XL;case 35668:case 35672:return KL;case 35669:case 35673:return HL;case 5125:return UL;case 36294:return GL;case 36295:return EL;case 36296:return FL;case 35678:case 36198:case 36298:case 36306:case 35682:return NL;case 35679:case 36299:case 36307:return OL;case 35680:case 36300:case 36308:case 36293:return qL;case 36289:case 36303:case 36311:case 36292:return RL}}class JE{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=rR(Q.type)}}class QE{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=LL(Q.type)}}class $E{constructor(J){this.id=J,this.seq=[],this.map={}}setValue(J,Q,$){let Z=this.seq;for(let W=0,Y=Z.length;W!==Y;++W){let X=Z[W];X.setValue(J,Q[X.id],$)}}}var XH=/(\w+)(\])?(\[|\.)?/g;function b5(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function DL(J,Q,$){let Z=J.name,W=Z.length;XH.lastIndex=0;while(!0){let Y=XH.exec(Z),X=XH.lastIndex,K=Y[1],H=Y[2]==="]",U=Y[3];if(H)K=K|0;if(U===void 0||U==="["&&X+2===W){b5($,U===void 0?new JE(K,J,Q):new QE(K,J,Q));break}else{let F=$.map[K];if(F===void 0)F=new $E(K),b5($,F);$=F}}}class B${constructor(J,Q){this.seq=[],this.map={};let $=J.getProgramParameter(Q,J.ACTIVE_UNIFORMS);for(let Y=0;Y<$;++Y){let X=J.getActiveUniform(Q,Y),K=J.getUniformLocation(Q,X.name);DL(X,K,this)}let Z=[],W=[];for(let Y of this.seq)if(Y.type===J.SAMPLER_2D_SHADOW||Y.type===J.SAMPLER_CUBE_SHADOW||Y.type===J.SAMPLER_2D_ARRAY_SHADOW)Z.push(Y);else W.push(Y);if(Z.length>0)this.seq=Z.concat(W)}setValue(J,Q,$,Z){let W=this.map[Q];if(W!==void 0)W.setValue(J,$,Z)}setOptional(J,Q,$){let Z=Q[$];if(Z!==void 0)this.setValue(J,$,Z)}static upload(J,Q,$,Z){for(let W=0,Y=Q.length;W!==Y;++W){let X=Q[W],K=$[X.id];if(K.needsUpdate!==!1)X.setValue(J,K.value,Z)}}static seqWithValue(J,Q){let $=[];for(let Z=0,W=J.length;Z!==W;++Z){let Y=J[Z];if(Y.id in Q)$.push(Y)}return $}}function h5(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var ML=37297,kL=0;function VL(J,Q){let $=J.split(`
4003
4003
  `),Z=[],W=Math.max(Q-6,0),Y=Math.min(Q+6,$.length);for(let X=W;X<Y;X++){let K=X+1;Z.push(`${K===Q?">":" "} ${K}: ${$[X]}`)}return Z.join(`
4004
- `)}var xX=new h0;function I1(J){u0._getMatrix(xX,u0.workingColorSpace,J);let Q=`mat3( ${xX.elements.map(($)=>$.toFixed(4))} )`;switch(u0.getTransfer(J)){case DZ:return[Q,"LinearTransferOETF"];case YJ:return[Q,"sRGBTransferOETF"];default:return C0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function bX(J,Q,$){let Z=J.getShaderParameter(Q,J.COMPILE_STATUS),Y=(J.getShaderInfoLog(Q)||"").trim();if(Z&&Y==="")return"";let X=/ERROR: 0:(\d+)/.exec(Y);if(X){let K=parseInt(X[1]);return $.toUpperCase()+`
4004
+ `)}var f5=new o0;function BL(J){t0._getMatrix(f5,t0.workingColorSpace,J);let Q=`mat3( ${f5.elements.map(($)=>$.toFixed(4))} )`;switch(t0.getTransfer(J)){case FW:return[Q,"LinearTransferOETF"];case OJ:return[Q,"sRGBTransferOETF"];default:return O0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function g5(J,Q,$){let Z=J.getShaderParameter(Q,J.COMPILE_STATUS),Y=(J.getShaderInfoLog(Q)||"").trim();if(Z&&Y==="")return"";let X=/ERROR: 0:(\d+)/.exec(Y);if(X){let K=parseInt(X[1]);return $.toUpperCase()+`
4005
4005
 
4006
4006
  `+Y+`
4007
4007
 
4008
- `+C1(J.getShaderSource(Q),K)}else return Y}function z1(J,Q){let $=I1(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
4009
- `)}var _1={[s6]:"Linear",[i6]:"Reinhard",[o6]:"Cineon",[T8]:"ACESFilmic",[r6]:"AgX",[t6]:"Neutral",[a6]:"Custom"};function w1(J,Q){let $=_1[Q];if($===void 0)return C0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}var fQ=new S;function P1(){u0.getLuminanceCoefficients(fQ);let J=fQ.x.toFixed(4),Q=fQ.y.toFixed(4),$=fQ.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
4010
- `)}function T1(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(L7).join(`
4011
- `)}function A1(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
4012
- `)}function S1(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W<Z;W++){let Y=J.getActiveAttrib(Q,W),X=Y.name,K=1;if(Y.type===J.FLOAT_MAT2)K=2;if(Y.type===J.FLOAT_MAT3)K=3;if(Y.type===J.FLOAT_MAT4)K=4;$[X]={type:Y.type,location:J.getAttribLocation(Q,X),locationSize:K}}return $}function L7(J){return J!==""}function hX(J,Q){let $=Q.numSpotLightShadows+Q.numSpotLightMaps-Q.numSpotLightShadowsWithMaps;return J.replace(/NUM_DIR_LIGHTS/g,Q.numDirLights).replace(/NUM_SPOT_LIGHTS/g,Q.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,Q.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,$).replace(/NUM_RECT_AREA_LIGHTS/g,Q.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,Q.numPointLights).replace(/NUM_HEMI_LIGHTS/g,Q.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,Q.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,Q.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,Q.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,Q.numPointLightShadows)}function fX(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}var j1=/^[ \t]*#include +<([\w\d./]+)>/gm;function tZ(J){return J.replace(j1,y1)}var v1=new Map;function y1(J,Q){let $=c0[Q];if($===void 0){let Z=v1.get(Q);if(Z!==void 0)$=c0[Z],C0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return tZ($)}var x1=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function gX(J){return J.replace(x1,b1)}function b1(J,Q,$,Z){let W="";for(let Y=parseInt(Q);Y<parseInt($);Y++)W+=Z.replace(/\[\s*i\s*\]/g,"[ "+Y+" ]").replace(/UNROLLED_LOOP_INDEX/g,Y);return W}function pX(J){let Q=`precision ${J.precision} float;
4008
+ `+VL(J.getShaderSource(Q),K)}else return Y}function CL(J,Q){let $=BL(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
4009
+ `)}var zL={[_7]:"Linear",[w7]:"Reinhard",[P7]:"Cineon",[n8]:"ACESFilmic",[T7]:"AgX",[S7]:"Neutral",[A7]:"Custom"};function IL(J,Q){let $=zL[Q];if($===void 0)return O0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}var aW=new A;function _L(){t0.getLuminanceCoefficients(aW);let J=aW.x.toFixed(4),Q=aW.y.toFixed(4),$=aW.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
4010
+ `)}function wL(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(V$).join(`
4011
+ `)}function PL(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
4012
+ `)}function AL(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W<Z;W++){let Y=J.getActiveAttrib(Q,W),X=Y.name,K=1;if(Y.type===J.FLOAT_MAT2)K=2;if(Y.type===J.FLOAT_MAT3)K=3;if(Y.type===J.FLOAT_MAT4)K=4;$[X]={type:Y.type,location:J.getAttribLocation(Q,X),locationSize:K}}return $}function V$(J){return J!==""}function p5(J,Q){let $=Q.numSpotLightShadows+Q.numSpotLightMaps-Q.numSpotLightShadowsWithMaps;return J.replace(/NUM_DIR_LIGHTS/g,Q.numDirLights).replace(/NUM_SPOT_LIGHTS/g,Q.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,Q.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,$).replace(/NUM_RECT_AREA_LIGHTS/g,Q.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,Q.numPointLights).replace(/NUM_HEMI_LIGHTS/g,Q.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,Q.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,Q.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,Q.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,Q.numPointLightShadows)}function u5(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}var TL=/^[ \t]*#include +<([\w\d./]+)>/gm;function UH(J){return J.replace(TL,jL)}var SL=new Map;function jL(J,Q){let $=ZJ[Q];if($===void 0){let Z=SL.get(Q);if(Z!==void 0)$=ZJ[Z],O0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return UH($)}var vL=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function d5(J){return J.replace(vL,yL)}function yL(J,Q,$,Z){let W="";for(let Y=parseInt(Q);Y<parseInt($);Y++)W+=Z.replace(/\[\s*i\s*\]/g,"[ "+Y+" ]").replace(/UNROLLED_LOOP_INDEX/g,Y);return W}function m5(J){let Q=`precision ${J.precision} float;
4013
4013
  precision ${J.precision} int;
4014
4014
  precision ${J.precision} sampler2D;
4015
4015
  precision ${J.precision} samplerCube;
@@ -4029,30 +4029,30 @@ void main() {
4029
4029
  `;if(J.precision==="highp")Q+=`
4030
4030
  #define HIGH_PRECISION`;else if(J.precision==="mediump")Q+=`
4031
4031
  #define MEDIUM_PRECISION`;else if(J.precision==="lowp")Q+=`
4032
- #define LOW_PRECISION`;return Q}var h1={[n6]:"SHADOWMAP_TYPE_PCF",[G6]:"SHADOWMAP_TYPE_VSM"};function f1(J){return h1[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var g1={[F6]:"ENVMAP_TYPE_CUBE",[A8]:"ENVMAP_TYPE_CUBE",[e6]:"ENVMAP_TYPE_CUBE_UV"};function p1(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return g1[J.envMapMode]||"ENVMAP_TYPE_CUBE"}var u1={[A8]:"ENVMAP_MODE_REFRACTION"};function d1(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return u1[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}var m1={[iY]:"ENVMAP_BLENDING_MULTIPLY",[oY]:"ENVMAP_BLENDING_MIX",[aY]:"ENVMAP_BLENDING_ADD"};function l1(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return m1[J.combine]||"ENVMAP_BLENDING_NONE"}function c1(J){let Q=J.envMapCubeUVHeight;if(Q===null)return null;let $=Math.log2(Q)-2,Z=1/Q;return{texelWidth:1/(3*Math.max(Math.pow(2,$),112)),texelHeight:Z,maxMip:$}}function n1(J,Q,$,Z){let W=J.getContext(),Y=$.defines,X=$.vertexShader,K=$.fragmentShader,H=f1($),U=p1($),G=d1($),F=l1($),E=c1($),O=T1($),R=A1(Y),C=W.createProgram(),q,N,L=$.glslVersion?"#version "+$.glslVersion+`
4033
- `:"";if($.isRawShaderMaterial){if(q=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(L7).join(`
4032
+ #define LOW_PRECISION`;return Q}var xL={[I7]:"SHADOWMAP_TYPE_PCF",[I6]:"SHADOWMAP_TYPE_VSM"};function bL(J){return xL[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var hL={[w6]:"ENVMAP_TYPE_CUBE",[s8]:"ENVMAP_TYPE_CUBE",[j7]:"ENVMAP_TYPE_CUBE_UV"};function fL(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return hL[J.envMapMode]||"ENVMAP_TYPE_CUBE"}var gL={[s8]:"ENVMAP_MODE_REFRACTION"};function pL(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return gL[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}var uL={[xX]:"ENVMAP_BLENDING_MULTIPLY",[bX]:"ENVMAP_BLENDING_MIX",[hX]:"ENVMAP_BLENDING_ADD"};function dL(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return uL[J.combine]||"ENVMAP_BLENDING_NONE"}function mL(J){let Q=J.envMapCubeUVHeight;if(Q===null)return null;let $=Math.log2(Q)-2,Z=1/Q;return{texelWidth:1/(3*Math.max(Math.pow(2,$),112)),texelHeight:Z,maxMip:$}}function lL(J,Q,$,Z){let W=J.getContext(),Y=$.defines,X=$.vertexShader,K=$.fragmentShader,H=bL($),U=fL($),G=pL($),F=dL($),E=mL($),O=wL($),R=PL(Y),M=W.createProgram(),q,N,L=$.glslVersion?"#version "+$.glslVersion+`
4033
+ `:"";if($.isRawShaderMaterial){if(q=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(V$).join(`
4034
4034
  `),q.length>0)q+=`
4035
- `;if(N=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(L7).join(`
4035
+ `;if(N=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(V$).join(`
4036
4036
  `),N.length>0)N+=`
4037
- `}else q=[pX($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",$.batching?"#define USE_BATCHING":"",$.batchingColor?"#define USE_BATCHING_COLOR":"",$.instancing?"#define USE_INSTANCING":"",$.instancingColor?"#define USE_INSTANCING_COLOR":"",$.instancingMorph?"#define USE_INSTANCING_MORPH":"",$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.map?"#define USE_MAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+G:"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.displacementMap?"#define USE_DISPLACEMENTMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.mapUv?"#define MAP_UV "+$.mapUv:"",$.alphaMapUv?"#define ALPHAMAP_UV "+$.alphaMapUv:"",$.lightMapUv?"#define LIGHTMAP_UV "+$.lightMapUv:"",$.aoMapUv?"#define AOMAP_UV "+$.aoMapUv:"",$.emissiveMapUv?"#define EMISSIVEMAP_UV "+$.emissiveMapUv:"",$.bumpMapUv?"#define BUMPMAP_UV "+$.bumpMapUv:"",$.normalMapUv?"#define NORMALMAP_UV "+$.normalMapUv:"",$.displacementMapUv?"#define DISPLACEMENTMAP_UV "+$.displacementMapUv:"",$.metalnessMapUv?"#define METALNESSMAP_UV "+$.metalnessMapUv:"",$.roughnessMapUv?"#define ROUGHNESSMAP_UV "+$.roughnessMapUv:"",$.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+$.anisotropyMapUv:"",$.clearcoatMapUv?"#define CLEARCOATMAP_UV "+$.clearcoatMapUv:"",$.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+$.clearcoatNormalMapUv:"",$.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+$.clearcoatRoughnessMapUv:"",$.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+$.iridescenceMapUv:"",$.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+$.iridescenceThicknessMapUv:"",$.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+$.sheenColorMapUv:"",$.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+$.sheenRoughnessMapUv:"",$.specularMapUv?"#define SPECULARMAP_UV "+$.specularMapUv:"",$.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+$.specularColorMapUv:"",$.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+$.specularIntensityMapUv:"",$.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+$.transmissionMapUv:"",$.thicknessMapUv?"#define THICKNESSMAP_UV "+$.thicknessMapUv:"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexNormals?"#define HAS_NORMAL":"",$.vertexColors?"#define USE_COLOR":"",$.vertexAlphas?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.flatShading?"#define FLAT_SHADED":"",$.skinning?"#define USE_SKINNING":"",$.morphTargets?"#define USE_MORPHTARGETS":"",$.morphNormals&&$.flatShading===!1?"#define USE_MORPHNORMALS":"",$.morphColors?"#define USE_MORPHCOLORS":"",$.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+$.morphTextureStride:"",$.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+$.morphTargetsCount:"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.sizeAttenuation?"#define USE_SIZEATTENUATION":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",`
4038
- `].filter(L7).join(`
4039
- `),N=[pX($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",$.map?"#define USE_MAP":"",$.matcap?"#define USE_MATCAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+U:"",$.envMap?"#define "+G:"",$.envMap?"#define "+F:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoat?"#define USE_CLEARCOAT":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.dispersion?"#define USE_DISPERSION":"",$.iridescence?"#define USE_IRIDESCENCE":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaTest?"#define USE_ALPHATEST":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.sheen?"#define USE_SHEEN":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexColors||$.instancingColor?"#define USE_COLOR":"",$.vertexAlphas||$.batchingColor?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.gradientMap?"#define USE_GRADIENTMAP":"",$.flatShading?"#define FLAT_SHADED":"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",$.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",$.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",$.toneMapping!==Q9?"#define TONE_MAPPING":"",$.toneMapping!==Q9?c0.tonemapping_pars_fragment:"",$.toneMapping!==Q9?w1("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",c0.colorspace_pars_fragment,z1("linearToOutputTexel",$.outputColorSpace),P1(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
4040
- `].filter(L7).join(`
4041
- `);if(X=tZ(X),X=hX(X,$),X=fX(X,$),K=tZ(K),K=hX(K,$),K=fX(K,$),X=gX(X),K=gX(K),$.isRawShaderMaterial!==!0)L=`#version 300 es
4037
+ `}else q=[m5($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",$.batching?"#define USE_BATCHING":"",$.batchingColor?"#define USE_BATCHING_COLOR":"",$.instancing?"#define USE_INSTANCING":"",$.instancingColor?"#define USE_INSTANCING_COLOR":"",$.instancingMorph?"#define USE_INSTANCING_MORPH":"",$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.map?"#define USE_MAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+G:"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.displacementMap?"#define USE_DISPLACEMENTMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.mapUv?"#define MAP_UV "+$.mapUv:"",$.alphaMapUv?"#define ALPHAMAP_UV "+$.alphaMapUv:"",$.lightMapUv?"#define LIGHTMAP_UV "+$.lightMapUv:"",$.aoMapUv?"#define AOMAP_UV "+$.aoMapUv:"",$.emissiveMapUv?"#define EMISSIVEMAP_UV "+$.emissiveMapUv:"",$.bumpMapUv?"#define BUMPMAP_UV "+$.bumpMapUv:"",$.normalMapUv?"#define NORMALMAP_UV "+$.normalMapUv:"",$.displacementMapUv?"#define DISPLACEMENTMAP_UV "+$.displacementMapUv:"",$.metalnessMapUv?"#define METALNESSMAP_UV "+$.metalnessMapUv:"",$.roughnessMapUv?"#define ROUGHNESSMAP_UV "+$.roughnessMapUv:"",$.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+$.anisotropyMapUv:"",$.clearcoatMapUv?"#define CLEARCOATMAP_UV "+$.clearcoatMapUv:"",$.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+$.clearcoatNormalMapUv:"",$.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+$.clearcoatRoughnessMapUv:"",$.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+$.iridescenceMapUv:"",$.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+$.iridescenceThicknessMapUv:"",$.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+$.sheenColorMapUv:"",$.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+$.sheenRoughnessMapUv:"",$.specularMapUv?"#define SPECULARMAP_UV "+$.specularMapUv:"",$.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+$.specularColorMapUv:"",$.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+$.specularIntensityMapUv:"",$.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+$.transmissionMapUv:"",$.thicknessMapUv?"#define THICKNESSMAP_UV "+$.thicknessMapUv:"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexNormals?"#define HAS_NORMAL":"",$.vertexColors?"#define USE_COLOR":"",$.vertexAlphas?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.flatShading?"#define FLAT_SHADED":"",$.skinning?"#define USE_SKINNING":"",$.morphTargets?"#define USE_MORPHTARGETS":"",$.morphNormals&&$.flatShading===!1?"#define USE_MORPHNORMALS":"",$.morphColors?"#define USE_MORPHCOLORS":"",$.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+$.morphTextureStride:"",$.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+$.morphTargetsCount:"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.sizeAttenuation?"#define USE_SIZEATTENUATION":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",`
4038
+ `].filter(V$).join(`
4039
+ `),N=[m5($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",$.map?"#define USE_MAP":"",$.matcap?"#define USE_MATCAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+U:"",$.envMap?"#define "+G:"",$.envMap?"#define "+F:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoat?"#define USE_CLEARCOAT":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.dispersion?"#define USE_DISPERSION":"",$.iridescence?"#define USE_IRIDESCENCE":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaTest?"#define USE_ALPHATEST":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.sheen?"#define USE_SHEEN":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexColors||$.instancingColor?"#define USE_COLOR":"",$.vertexAlphas||$.batchingColor?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.gradientMap?"#define USE_GRADIENTMAP":"",$.flatShading?"#define FLAT_SHADED":"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",$.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",$.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",$.toneMapping!==F9?"#define TONE_MAPPING":"",$.toneMapping!==F9?ZJ.tonemapping_pars_fragment:"",$.toneMapping!==F9?IL("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",ZJ.colorspace_pars_fragment,CL("linearToOutputTexel",$.outputColorSpace),_L(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
4040
+ `].filter(V$).join(`
4041
+ `);if(X=UH(X),X=p5(X,$),X=u5(X,$),K=UH(K),K=p5(K,$),K=u5(K,$),X=d5(X),K=d5(K),$.isRawShaderMaterial!==!0)L=`#version 300 es
4042
4042
  `,q=[O,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4043
4043
  `)+`
4044
- `+q,N=["#define varying in",$.glslVersion===kZ?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===kZ?"":"#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(`
4044
+ `+q,N=["#define varying in",$.glslVersion===NW?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===NW?"":"#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(`
4045
4045
  `)+`
4046
- `+N;let k=L+q+X,M=L+N+K,P=yX(W,W.VERTEX_SHADER,k),w=yX(W,W.FRAGMENT_SHADER,M);if(W.attachShader(C,P),W.attachShader(C,w),$.index0AttributeName!==void 0)W.bindAttribLocation(C,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(C,0,"position");W.linkProgram(C);function B(z){if(J.debug.checkShaderErrors){let v=W.getProgramInfoLog(C)||"",y=W.getShaderInfoLog(P)||"",A=W.getShaderInfoLog(w)||"",x=v.trim(),b=y.trim(),p=A.trim(),c=!0,o=!0;if(W.getProgramParameter(C,W.LINK_STATUS)===!1)if(c=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,C,P,w);else{let Q0=bX(W,P,"vertex"),Y0=bX(W,w,"fragment");S0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(C,W.VALIDATE_STATUS)+`
4046
+ `+N;let D=L+q+X,V=L+N+K,z=h5(W,W.VERTEX_SHADER,D),I=h5(W,W.FRAGMENT_SHADER,V);if(W.attachShader(M,z),W.attachShader(M,I),$.index0AttributeName!==void 0)W.bindAttribLocation(M,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(M,0,"position");W.linkProgram(M);function B(w){if(J.debug.checkShaderErrors){let v=W.getProgramInfoLog(M)||"",b=W.getShaderInfoLog(z)||"",S=W.getShaderInfoLog(I)||"",h=v.trim(),x=b.trim(),p=S.trim(),c=!0,o=!0;if(W.getProgramParameter(M,W.LINK_STATUS)===!1)if(c=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,M,z,I);else{let W0=g5(W,z,"vertex"),H0=g5(W,I,"fragment");v0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(M,W.VALIDATE_STATUS)+`
4047
4047
 
4048
- Material Name: `+z.name+`
4049
- Material Type: `+z.type+`
4048
+ Material Name: `+w.name+`
4049
+ Material Type: `+w.type+`
4050
4050
 
4051
- Program Info Log: `+x+`
4052
- `+Q0+`
4053
- `+Y0)}else if(x!=="")C0("WebGLProgram: Program Info Log:",x);else if(b===""||p==="")o=!1;if(o)z.diagnostics={runnable:c,programLog:x,vertexShader:{log:b,prefix:q},fragmentShader:{log:p,prefix:N}}}W.deleteShader(P),W.deleteShader(w),D=new D7(W,C),V=S1(W,C)}let D;this.getUniforms=function(){if(D===void 0)B(this);return D};let V;this.getAttributes=function(){if(V===void 0)B(this);return V};let j=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(j===!1)j=W.getProgramParameter(C,V1);return j},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(C),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=B1++,this.cacheKey=Q,this.usedTimes=1,this.program=C,this.vertexShader=P,this.fragmentShader=w,this}var s1=0;class JK{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(J){let{vertexShader:Q,fragmentShader:$}=J,Z=this._getShaderStage(Q),W=this._getShaderStage($),Y=this._getShaderCacheForMaterial(J);if(Y.has(Z)===!1)Y.add(Z),Z.usedTimes++;if(Y.has(W)===!1)Y.add(W),W.usedTimes++;return this}remove(J){let Q=this.materialCache.get(J);for(let $ of Q)if($.usedTimes--,$.usedTimes===0)this.shaderCache.delete($.code);return this.materialCache.delete(J),this}getVertexShaderID(J){return this._getShaderStage(J.vertexShader).id}getFragmentShaderID(J){return this._getShaderStage(J.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(J){let Q=this.materialCache,$=Q.get(J);if($===void 0)$=new Set,Q.set(J,$);return $}_getShaderStage(J){let Q=this.shaderCache,$=Q.get(J);if($===void 0)$=new QK(J),Q.set(J,$);return $}}class QK{constructor(J){this.id=s1++,this.code=J,this.usedTimes=0}}function i1(J){return J===y8||J===EQ||J===FQ}function o1(J,Q,$,Z,W,Y){let X=new LQ,K=new JK,H=new Set,U=[],G=new Map,F=Z.logarithmicDepthBuffer,E=Z.precision,O={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function R(D){if(H.add(D),D===0)return"uv";return`uv${D}`}function C(D,V,j,z,v,y){let A=z.fog,x=v.geometry,b=D.isMeshStandardMaterial||D.isMeshLambertMaterial||D.isMeshPhongMaterial?z.environment:null,p=D.isMeshStandardMaterial||D.isMeshLambertMaterial&&!D.envMap||D.isMeshPhongMaterial&&!D.envMap,c=Q.get(D.envMap||b,p),o=!!c&&c.mapping===e6?c.image.height:null,Q0=O[D.type];if(D.precision!==null){if(E=Z.getMaxPrecision(D.precision),E!==D.precision)C0("WebGLProgram.getParameters:",D.precision,"not supported, using",E,"instead.")}let Y0=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,J0=Y0!==void 0?Y0.length:0,x0=0;if(x.morphAttributes.position!==void 0)x0=1;if(x.morphAttributes.normal!==void 0)x0=2;if(x.morphAttributes.color!==void 0)x0=3;let v0,s,K0,D0;if(Q0){let f0=h9[Q0];v0=f0.vertexShader,s=f0.fragmentShader}else v0=D.vertexShader,s=D.fragmentShader,K.update(D),K0=K.getVertexShaderID(D),D0=K.getFragmentShaderID(D);let E0=J.getRenderTarget(),_0=J.state.buffers.depth.getReversed(),i0=v.isInstancedMesh===!0,y0=v.isBatchedMesh===!0,d0=!!D.map,UJ=!!D.matcap,GJ=!!c,m0=!!D.aoMap,xJ=!!D.lightMap,bJ=!!D.bumpMap,zJ=!!D.normalMap,f=!!D.displacementMap,uJ=!!D.emissiveMap,r0=!!D.metalnessMap,e0=!!D.roughnessMap,R0=D.anisotropy>0,LJ=D.clearcoat>0,A0=D.dispersion>0,T=D.iridescence>0,I=D.sheen>0,u=D.transmission>0,r=R0&&!!D.anisotropyMap,t=LJ&&!!D.clearcoatMap,$0=LJ&&!!D.clearcoatNormalMap,F0=LJ&&!!D.clearcoatRoughnessMap,n=T&&!!D.iridescenceMap,a=T&&!!D.iridescenceThicknessMap,U0=I&&!!D.sheenColorMap,V0=I&&!!D.sheenRoughnessMap,W0=!!D.specularMap,N0=!!D.specularColorMap,b0=!!D.specularIntensityMap,p0=u&&!!D.transmissionMap,n0=u&&!!D.thicknessMap,h=!!D.gradientMap,H0=!!D.alphaMap,i=D.alphaTest>0,Z0=!!D.alphaHash,B0=!!D.extensions,e=Q9;if(D.toneMapped){if(E0===null||E0.isXRRenderTarget===!0)e=J.toneMapping}let z0={shaderID:Q0,shaderType:D.type,shaderName:D.name,vertexShader:v0,fragmentShader:s,defines:D.defines,customVertexShaderID:K0,customFragmentShaderID:D0,isRawShaderMaterial:D.isRawShaderMaterial===!0,glslVersion:D.glslVersion,precision:E,batching:y0,batchingColor:y0&&v._colorsTexture!==null,instancing:i0,instancingColor:i0&&v.instanceColor!==null,instancingMorph:i0&&v.morphTexture!==null,outputColorSpace:E0===null?J.outputColorSpace:E0.isXRRenderTarget===!0?E0.texture.colorSpace:u0.workingColorSpace,alphaToCoverage:!!D.alphaToCoverage,map:d0,matcap:UJ,envMap:GJ,envMapMode:GJ&&c.mapping,envMapCubeUVHeight:o,aoMap:m0,lightMap:xJ,bumpMap:bJ,normalMap:zJ,displacementMap:f,emissiveMap:uJ,normalMapObjectSpace:zJ&&D.normalMapType===WX,normalMapTangentSpace:zJ&&D.normalMapType===LZ,packedNormalMap:zJ&&D.normalMapType===LZ&&i1(D.normalMap.format),metalnessMap:r0,roughnessMap:e0,anisotropy:R0,anisotropyMap:r,clearcoat:LJ,clearcoatMap:t,clearcoatNormalMap:$0,clearcoatRoughnessMap:F0,dispersion:A0,iridescence:T,iridescenceMap:n,iridescenceThicknessMap:a,sheen:I,sheenColorMap:U0,sheenRoughnessMap:V0,specularMap:W0,specularColorMap:N0,specularIntensityMap:b0,transmission:u,transmissionMap:p0,thicknessMap:n0,gradientMap:h,opaque:D.transparent===!1&&D.blending===w8&&D.alphaToCoverage===!1,alphaMap:H0,alphaTest:i,alphaHash:Z0,combine:D.combine,mapUv:d0&&R(D.map.channel),aoMapUv:m0&&R(D.aoMap.channel),lightMapUv:xJ&&R(D.lightMap.channel),bumpMapUv:bJ&&R(D.bumpMap.channel),normalMapUv:zJ&&R(D.normalMap.channel),displacementMapUv:f&&R(D.displacementMap.channel),emissiveMapUv:uJ&&R(D.emissiveMap.channel),metalnessMapUv:r0&&R(D.metalnessMap.channel),roughnessMapUv:e0&&R(D.roughnessMap.channel),anisotropyMapUv:r&&R(D.anisotropyMap.channel),clearcoatMapUv:t&&R(D.clearcoatMap.channel),clearcoatNormalMapUv:$0&&R(D.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:F0&&R(D.clearcoatRoughnessMap.channel),iridescenceMapUv:n&&R(D.iridescenceMap.channel),iridescenceThicknessMapUv:a&&R(D.iridescenceThicknessMap.channel),sheenColorMapUv:U0&&R(D.sheenColorMap.channel),sheenRoughnessMapUv:V0&&R(D.sheenRoughnessMap.channel),specularMapUv:W0&&R(D.specularMap.channel),specularColorMapUv:N0&&R(D.specularColorMap.channel),specularIntensityMapUv:b0&&R(D.specularIntensityMap.channel),transmissionMapUv:p0&&R(D.transmissionMap.channel),thicknessMapUv:n0&&R(D.thicknessMap.channel),alphaMapUv:H0&&R(D.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(zJ||R0),vertexNormals:!!x.attributes.normal,vertexColors:D.vertexColors,vertexAlphas:D.vertexColors===!0&&!!x.attributes.color&&x.attributes.color.itemSize===4,pointsUvs:v.isPoints===!0&&!!x.attributes.uv&&(d0||H0),fog:!!A,useFog:D.fog===!0,fogExp2:!!A&&A.isFogExp2,flatShading:D.wireframe===!1&&(D.flatShading===!0||x.attributes.normal===void 0&&zJ===!1&&(D.isMeshLambertMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isMeshPhysicalMaterial)),sizeAttenuation:D.sizeAttenuation===!0,logarithmicDepthBuffer:F,reversedDepthBuffer:_0,skinning:v.isSkinnedMesh===!0,morphTargets:x.morphAttributes.position!==void 0,morphNormals:x.morphAttributes.normal!==void 0,morphColors:x.morphAttributes.color!==void 0,morphTargetsCount:J0,morphTextureStride:x0,numDirLights:V.directional.length,numPointLights:V.point.length,numSpotLights:V.spot.length,numSpotLightMaps:V.spotLightMap.length,numRectAreaLights:V.rectArea.length,numHemiLights:V.hemi.length,numDirLightShadows:V.directionalShadowMap.length,numPointLightShadows:V.pointShadowMap.length,numSpotLightShadows:V.spotShadowMap.length,numSpotLightShadowsWithMaps:V.numSpotLightShadowsWithMaps,numLightProbes:V.numLightProbes,numLightProbeGrids:y.length,numClippingPlanes:Y.numPlanes,numClipIntersection:Y.numIntersection,dithering:D.dithering,shadowMapEnabled:J.shadowMap.enabled&&j.length>0,shadowMapType:J.shadowMap.type,toneMapping:e,decodeVideoTexture:d0&&D.map.isVideoTexture===!0&&u0.getTransfer(D.map.colorSpace)===YJ,decodeVideoTextureEmissive:uJ&&D.emissiveMap.isVideoTexture===!0&&u0.getTransfer(D.emissiveMap.colorSpace)===YJ,premultipliedAlpha:D.premultipliedAlpha,doubleSided:D.side===sJ,flipSided:D.side===yJ,useDepthPacking:D.depthPacking>=0,depthPacking:D.depthPacking||0,index0AttributeName:D.index0AttributeName,extensionClipCullDistance:B0&&D.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(B0&&D.extensions.multiDraw===!0||y0)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:D.customProgramCacheKey()};return z0.vertexUv1s=H.has(1),z0.vertexUv2s=H.has(2),z0.vertexUv3s=H.has(3),H.clear(),z0}function q(D){let V=[];if(D.shaderID)V.push(D.shaderID);else V.push(D.customVertexShaderID),V.push(D.customFragmentShaderID);if(D.defines!==void 0)for(let j in D.defines)V.push(j),V.push(D.defines[j]);if(D.isRawShaderMaterial===!1)N(V,D),L(V,D),V.push(J.outputColorSpace);return V.push(D.customProgramCacheKey),V.join()}function N(D,V){D.push(V.precision),D.push(V.outputColorSpace),D.push(V.envMapMode),D.push(V.envMapCubeUVHeight),D.push(V.mapUv),D.push(V.alphaMapUv),D.push(V.lightMapUv),D.push(V.aoMapUv),D.push(V.bumpMapUv),D.push(V.normalMapUv),D.push(V.displacementMapUv),D.push(V.emissiveMapUv),D.push(V.metalnessMapUv),D.push(V.roughnessMapUv),D.push(V.anisotropyMapUv),D.push(V.clearcoatMapUv),D.push(V.clearcoatNormalMapUv),D.push(V.clearcoatRoughnessMapUv),D.push(V.iridescenceMapUv),D.push(V.iridescenceThicknessMapUv),D.push(V.sheenColorMapUv),D.push(V.sheenRoughnessMapUv),D.push(V.specularMapUv),D.push(V.specularColorMapUv),D.push(V.specularIntensityMapUv),D.push(V.transmissionMapUv),D.push(V.thicknessMapUv),D.push(V.combine),D.push(V.fogExp2),D.push(V.sizeAttenuation),D.push(V.morphTargetsCount),D.push(V.morphAttributeCount),D.push(V.numDirLights),D.push(V.numPointLights),D.push(V.numSpotLights),D.push(V.numSpotLightMaps),D.push(V.numHemiLights),D.push(V.numRectAreaLights),D.push(V.numDirLightShadows),D.push(V.numPointLightShadows),D.push(V.numSpotLightShadows),D.push(V.numSpotLightShadowsWithMaps),D.push(V.numLightProbes),D.push(V.shadowMapType),D.push(V.toneMapping),D.push(V.numClippingPlanes),D.push(V.numClipIntersection),D.push(V.depthPacking)}function L(D,V){if(X.disableAll(),V.instancing)X.enable(0);if(V.instancingColor)X.enable(1);if(V.instancingMorph)X.enable(2);if(V.matcap)X.enable(3);if(V.envMap)X.enable(4);if(V.normalMapObjectSpace)X.enable(5);if(V.normalMapTangentSpace)X.enable(6);if(V.clearcoat)X.enable(7);if(V.iridescence)X.enable(8);if(V.alphaTest)X.enable(9);if(V.vertexColors)X.enable(10);if(V.vertexAlphas)X.enable(11);if(V.vertexUv1s)X.enable(12);if(V.vertexUv2s)X.enable(13);if(V.vertexUv3s)X.enable(14);if(V.vertexTangents)X.enable(15);if(V.anisotropy)X.enable(16);if(V.alphaHash)X.enable(17);if(V.batching)X.enable(18);if(V.dispersion)X.enable(19);if(V.batchingColor)X.enable(20);if(V.gradientMap)X.enable(21);if(V.packedNormalMap)X.enable(22);if(V.vertexNormals)X.enable(23);if(D.push(X.mask),X.disableAll(),V.fog)X.enable(0);if(V.useFog)X.enable(1);if(V.flatShading)X.enable(2);if(V.logarithmicDepthBuffer)X.enable(3);if(V.reversedDepthBuffer)X.enable(4);if(V.skinning)X.enable(5);if(V.morphTargets)X.enable(6);if(V.morphNormals)X.enable(7);if(V.morphColors)X.enable(8);if(V.premultipliedAlpha)X.enable(9);if(V.shadowMapEnabled)X.enable(10);if(V.doubleSided)X.enable(11);if(V.flipSided)X.enable(12);if(V.useDepthPacking)X.enable(13);if(V.dithering)X.enable(14);if(V.transmission)X.enable(15);if(V.sheen)X.enable(16);if(V.opaque)X.enable(17);if(V.pointsUvs)X.enable(18);if(V.decodeVideoTexture)X.enable(19);if(V.decodeVideoTextureEmissive)X.enable(20);if(V.alphaToCoverage)X.enable(21);if(V.numLightProbeGrids>0)X.enable(22);D.push(X.mask)}function k(D){let V=O[D.type],j;if(V){let z=h9[V];j=rJ.clone(z.uniforms)}else j=D.uniforms;return j}function M(D,V){let j=G.get(V);if(j!==void 0)++j.usedTimes;else j=new n1(J,V,D,W),U.push(j),G.set(V,j);return j}function P(D){if(--D.usedTimes===0){let V=U.indexOf(D);U[V]=U[U.length-1],U.pop(),G.delete(D.cacheKey),D.destroy()}}function w(D){K.remove(D)}function B(){K.dispose()}return{getParameters:C,getProgramCacheKey:q,getUniforms:k,acquireProgram:M,releaseProgram:P,releaseShaderCache:w,programs:U,dispose:B}}function a1(){let J=new WeakMap;function Q(X){return J.has(X)}function $(X){let K=J.get(X);if(K===void 0)K={},J.set(X,K);return K}function Z(X){J.delete(X)}function W(X,K,H){J.get(X)[K]=H}function Y(){J=new WeakMap}return{has:Q,get:$,remove:Z,update:W,dispose:Y}}function r1(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.material.id!==Q.material.id)return J.material.id-Q.material.id;else if(J.materialVariant!==Q.materialVariant)return J.materialVariant-Q.materialVariant;else if(J.z!==Q.z)return J.z-Q.z;else return J.id-Q.id}function uX(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.z!==Q.z)return Q.z-J.z;else return J.id-Q.id}function dX(){let J=[],Q=0,$=[],Z=[],W=[];function Y(){Q=0,$.length=0,Z.length=0,W.length=0}function X(E){let O=0;if(E.isInstancedMesh)O+=2;if(E.isSkinnedMesh)O+=1;return O}function K(E,O,R,C,q,N){let L=J[Q];if(L===void 0)L={id:E.id,object:E,geometry:O,material:R,materialVariant:X(E),groupOrder:C,renderOrder:E.renderOrder,z:q,group:N},J[Q]=L;else L.id=E.id,L.object=E,L.geometry=O,L.material=R,L.materialVariant=X(E),L.groupOrder=C,L.renderOrder=E.renderOrder,L.z=q,L.group=N;return Q++,L}function H(E,O,R,C,q,N){let L=K(E,O,R,C,q,N);if(R.transmission>0)Z.push(L);else if(R.transparent===!0)W.push(L);else $.push(L)}function U(E,O,R,C,q,N){let L=K(E,O,R,C,q,N);if(R.transmission>0)Z.unshift(L);else if(R.transparent===!0)W.unshift(L);else $.unshift(L)}function G(E,O){if($.length>1)$.sort(E||r1);if(Z.length>1)Z.sort(O||uX);if(W.length>1)W.sort(O||uX)}function F(){for(let E=Q,O=J.length;E<O;E++){let R=J[E];if(R.id===null)break;R.id=null,R.object=null,R.geometry=null,R.material=null,R.group=null}}return{opaque:$,transmissive:Z,transparent:W,init:Y,push:H,unshift:U,finish:F,sort:G}}function t1(){let J=new WeakMap;function Q(Z,W){let Y=J.get(Z),X;if(Y===void 0)X=new dX,J.set(Z,[X]);else if(W>=Y.length)X=new dX,Y.push(X);else X=Y[W];return X}function $(){J=new WeakMap}return{get:Q,dispose:$}}function e1(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new S,color:new X0};break;case"SpotLight":$={position:new S,direction:new S,color:new X0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new S,color:new X0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new S,skyColor:new X0,groundColor:new X0};break;case"RectAreaLight":$={color:new X0,position:new S,halfWidth:new S,halfHeight:new S};break}return J[Q.id]=$,$}}}function JF(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new T0};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new T0};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new T0,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}var QF=0;function $F(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function ZF(J){let Q=new e1,$=JF(),Z={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let U=0;U<9;U++)Z.probe.push(new S);let W=new S,Y=new j0,X=new j0;function K(U){let G=0,F=0,E=0;for(let V=0;V<9;V++)Z.probe[V].set(0,0,0);let O=0,R=0,C=0,q=0,N=0,L=0,k=0,M=0,P=0,w=0,B=0;U.sort($F);for(let V=0,j=U.length;V<j;V++){let z=U[V],v=z.color,y=z.intensity,A=z.distance,x=null;if(z.shadow&&z.shadow.map)if(z.shadow.map.texture.format===y8)x=z.shadow.map.texture;else x=z.shadow.map.depthTexture||z.shadow.map.texture;if(z.isAmbientLight)G+=v.r*y,F+=v.g*y,E+=v.b*y;else if(z.isLightProbe){for(let b=0;b<9;b++)Z.probe[b].addScaledVector(z.sh.coefficients[b],y);B++}else if(z.isDirectionalLight){let b=Q.get(z);if(b.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let p=z.shadow,c=$.get(z);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.directionalShadow[O]=c,Z.directionalShadowMap[O]=x,Z.directionalShadowMatrix[O]=z.shadow.matrix,L++}Z.directional[O]=b,O++}else if(z.isSpotLight){let b=Q.get(z);b.position.setFromMatrixPosition(z.matrixWorld),b.color.copy(v).multiplyScalar(y),b.distance=A,b.coneCos=Math.cos(z.angle),b.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),b.decay=z.decay,Z.spot[C]=b;let p=z.shadow;if(z.map){if(Z.spotLightMap[P]=z.map,P++,p.updateMatrices(z),z.castShadow)w++}if(Z.spotLightMatrix[C]=p.matrix,z.castShadow){let c=$.get(z);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.spotShadow[C]=c,Z.spotShadowMap[C]=x,M++}C++}else if(z.isRectAreaLight){let b=Q.get(z);b.color.copy(v).multiplyScalar(y),b.halfWidth.set(z.width*0.5,0,0),b.halfHeight.set(0,z.height*0.5,0),Z.rectArea[q]=b,q++}else if(z.isPointLight){let b=Q.get(z);if(b.color.copy(z.color).multiplyScalar(z.intensity),b.distance=z.distance,b.decay=z.decay,z.castShadow){let p=z.shadow,c=$.get(z);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,c.shadowCameraNear=p.camera.near,c.shadowCameraFar=p.camera.far,Z.pointShadow[R]=c,Z.pointShadowMap[R]=x,Z.pointShadowMatrix[R]=z.shadow.matrix,k++}Z.point[R]=b,R++}else if(z.isHemisphereLight){let b=Q.get(z);b.skyColor.copy(z.color).multiplyScalar(y),b.groundColor.copy(z.groundColor).multiplyScalar(y),Z.hemi[N]=b,N++}}if(q>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=G0.LTC_FLOAT_1,Z.rectAreaLTC2=G0.LTC_FLOAT_2;else Z.rectAreaLTC1=G0.LTC_HALF_1,Z.rectAreaLTC2=G0.LTC_HALF_2;Z.ambient[0]=G,Z.ambient[1]=F,Z.ambient[2]=E;let D=Z.hash;if(D.directionalLength!==O||D.pointLength!==R||D.spotLength!==C||D.rectAreaLength!==q||D.hemiLength!==N||D.numDirectionalShadows!==L||D.numPointShadows!==k||D.numSpotShadows!==M||D.numSpotMaps!==P||D.numLightProbes!==B)Z.directional.length=O,Z.spot.length=C,Z.rectArea.length=q,Z.point.length=R,Z.hemi.length=N,Z.directionalShadow.length=L,Z.directionalShadowMap.length=L,Z.pointShadow.length=k,Z.pointShadowMap.length=k,Z.spotShadow.length=M,Z.spotShadowMap.length=M,Z.directionalShadowMatrix.length=L,Z.pointShadowMatrix.length=k,Z.spotLightMatrix.length=M+P-w,Z.spotLightMap.length=P,Z.numSpotLightShadowsWithMaps=w,Z.numLightProbes=B,D.directionalLength=O,D.pointLength=R,D.spotLength=C,D.rectAreaLength=q,D.hemiLength=N,D.numDirectionalShadows=L,D.numPointShadows=k,D.numSpotShadows=M,D.numSpotMaps=P,D.numLightProbes=B,Z.version=QF++}function H(U,G){let F=0,E=0,O=0,R=0,C=0,q=G.matrixWorldInverse;for(let N=0,L=U.length;N<L;N++){let k=U[N];if(k.isDirectionalLight){let M=Z.directional[F];M.direction.setFromMatrixPosition(k.matrixWorld),W.setFromMatrixPosition(k.target.matrixWorld),M.direction.sub(W),M.direction.transformDirection(q),F++}else if(k.isSpotLight){let M=Z.spot[O];M.position.setFromMatrixPosition(k.matrixWorld),M.position.applyMatrix4(q),M.direction.setFromMatrixPosition(k.matrixWorld),W.setFromMatrixPosition(k.target.matrixWorld),M.direction.sub(W),M.direction.transformDirection(q),O++}else if(k.isRectAreaLight){let M=Z.rectArea[R];M.position.setFromMatrixPosition(k.matrixWorld),M.position.applyMatrix4(q),X.identity(),Y.copy(k.matrixWorld),Y.premultiply(q),X.extractRotation(Y),M.halfWidth.set(k.width*0.5,0,0),M.halfHeight.set(0,k.height*0.5,0),M.halfWidth.applyMatrix4(X),M.halfHeight.applyMatrix4(X),R++}else if(k.isPointLight){let M=Z.point[E];M.position.setFromMatrixPosition(k.matrixWorld),M.position.applyMatrix4(q),E++}else if(k.isHemisphereLight){let M=Z.hemi[C];M.direction.setFromMatrixPosition(k.matrixWorld),M.direction.transformDirection(q),C++}}}return{setup:K,setupView:H,state:Z}}function mX(J){let Q=new ZF(J),$=[],Z=[],W=[];function Y(E){F.camera=E,$.length=0,Z.length=0,W.length=0}function X(E){$.push(E)}function K(E){Z.push(E)}function H(E){W.push(E)}function U(){Q.setup($)}function G(E){Q.setupView($,E)}let F={lightsArray:$,shadowsArray:Z,lightProbeGridArray:W,camera:null,lights:Q,transmissionRenderTarget:{},textureUnits:0};return{init:Y,state:F,setupLights:U,setupLightsView:G,pushLight:X,pushShadow:K,pushLightProbeGrid:H}}function WF(J){let Q=new WeakMap;function $(W,Y=0){let X=Q.get(W),K;if(X===void 0)K=new mX(J),Q.set(W,[K]);else if(Y>=X.length)K=new mX(J),X.push(K);else K=X[Y];return K}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var YF=`void main() {
4051
+ Program Info Log: `+h+`
4052
+ `+W0+`
4053
+ `+H0)}else if(h!=="")O0("WebGLProgram: Program Info Log:",h);else if(x===""||p==="")o=!1;if(o)w.diagnostics={runnable:c,programLog:h,vertexShader:{log:x,prefix:q},fragmentShader:{log:p,prefix:N}}}W.deleteShader(z),W.deleteShader(I),k=new B$(W,M),C=AL(W,M)}let k;this.getUniforms=function(){if(k===void 0)B(this);return k};let C;this.getAttributes=function(){if(C===void 0)B(this);return C};let j=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(j===!1)j=W.getProgramParameter(M,ML);return j},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(M),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=kL++,this.cacheKey=Q,this.usedTimes=1,this.program=M,this.vertexShader=z,this.fragmentShader=I,this}var cL=0;class ZE{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(J){let{vertexShader:Q,fragmentShader:$}=J,Z=this._getShaderStage(Q),W=this._getShaderStage($),Y=this._getShaderCacheForMaterial(J);if(Y.has(Z)===!1)Y.add(Z),Z.usedTimes++;if(Y.has(W)===!1)Y.add(W),W.usedTimes++;return this}remove(J){let Q=this.materialCache.get(J);for(let $ of Q)if($.usedTimes--,$.usedTimes===0)this.shaderCache.delete($.code);return this.materialCache.delete(J),this}getVertexShaderID(J){return this._getShaderStage(J.vertexShader).id}getFragmentShaderID(J){return this._getShaderStage(J.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(J){let Q=this.materialCache,$=Q.get(J);if($===void 0)$=new Set,Q.set(J,$);return $}_getShaderStage(J){let Q=this.shaderCache,$=Q.get(J);if($===void 0)$=new WE(J),Q.set(J,$);return $}}class WE{constructor(J){this.id=cL++,this.code=J,this.usedTimes=0}}function nL(J){return J===r8||J===vQ||J===yQ}function sL(J,Q,$,Z,W,Y){let X=new h7,K=new ZE,H=new Set,U=[],G=new Map,F=Z.logarithmicDepthBuffer,E=Z.precision,O={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function R(k){if(H.add(k),k===0)return"uv";return`uv${k}`}function M(k,C,j,w,v,b){let S=w.fog,h=v.geometry,x=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?w.environment:null,p=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,c=Q.get(k.envMap||x,p),o=!!c&&c.mapping===j7?c.image.height:null,W0=O[k.type];if(k.precision!==null){if(E=Z.getMaxPrecision(k.precision),E!==k.precision)O0("WebGLProgram.getParameters:",k.precision,"not supported, using",E,"instead.")}let H0=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,J0=H0!==void 0?H0.length:0,c0=0;if(h.morphAttributes.position!==void 0)c0=1;if(h.morphAttributes.normal!==void 0)c0=2;if(h.morphAttributes.color!==void 0)c0=3;let d0,s,F0,I0;if(W0){let e0=e9[W0];d0=e0.vertexShader,s=e0.fragmentShader}else d0=k.vertexShader,s=k.fragmentShader,K.update(k),F0=K.getVertexShaderID(k),I0=K.getFragmentShaderID(k);let E0=J.getRenderTarget(),j0=J.state.buffers.depth.getReversed(),WJ=v.isInstancedMesh===!0,x0=v.isBatchedMesh===!0,n0=!!k.map,Q0=!!k.matcap,X0=!!c,$0=!!k.aoMap,_0=!!k.lightMap,C0=!!k.bumpMap,m0=!!k.normalMap,y=!!k.displacementMap,YJ=!!k.emissiveMap,h0=!!k.metalnessMap,l0=!!k.roughnessMap,U0=k.anisotropy>0,NJ=k.clearcoat>0,A0=k.dispersion>0,T=k.iridescence>0,_=k.sheen>0,u=k.transmission>0,r=U0&&!!k.anisotropyMap,Z0=NJ&&!!k.clearcoatMap,K0=NJ&&!!k.clearcoatNormalMap,M0=NJ&&!!k.clearcoatRoughnessMap,n=T&&!!k.iridescenceMap,t=T&&!!k.iridescenceThicknessMap,R0=_&&!!k.sheenColorMap,T0=_&&!!k.sheenRoughnessMap,N0=!!k.specularMap,k0=!!k.specularColorMap,r0=!!k.specularIntensityMap,$J=u&&!!k.transmissionMap,XJ=u&&!!k.thicknessMap,f=!!k.gradientMap,q0=!!k.alphaMap,a=k.alphaTest>0,G0=!!k.alphaHash,S0=!!k.extensions,Y0=F9;if(k.toneMapped){if(E0===null||E0.isXRRenderTarget===!0)Y0=J.toneMapping}let f0={shaderID:W0,shaderType:k.type,shaderName:k.name,vertexShader:d0,fragmentShader:s,defines:k.defines,customVertexShaderID:F0,customFragmentShaderID:I0,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:E,batching:x0,batchingColor:x0&&v._colorsTexture!==null,instancing:WJ,instancingColor:WJ&&v.instanceColor!==null,instancingMorph:WJ&&v.morphTexture!==null,outputColorSpace:E0===null?J.outputColorSpace:E0.isXRRenderTarget===!0?E0.texture.colorSpace:t0.workingColorSpace,alphaToCoverage:!!k.alphaToCoverage,map:n0,matcap:Q0,envMap:X0,envMapMode:X0&&c.mapping,envMapCubeUVHeight:o,aoMap:$0,lightMap:_0,bumpMap:C0,normalMap:m0,displacementMap:y,emissiveMap:YJ,normalMapObjectSpace:m0&&k.normalMapType===cX,normalMapTangentSpace:m0&&k.normalMapType===EW,packedNormalMap:m0&&k.normalMapType===EW&&nL(k.normalMap.format),metalnessMap:h0,roughnessMap:l0,anisotropy:U0,anisotropyMap:r,clearcoat:NJ,clearcoatMap:Z0,clearcoatNormalMap:K0,clearcoatRoughnessMap:M0,dispersion:A0,iridescence:T,iridescenceMap:n,iridescenceThicknessMap:t,sheen:_,sheenColorMap:R0,sheenRoughnessMap:T0,specularMap:N0,specularColorMap:k0,specularIntensityMap:r0,transmission:u,transmissionMap:$J,thicknessMap:XJ,gradientMap:f,opaque:k.transparent===!1&&k.blending===l8&&k.alphaToCoverage===!1,alphaMap:q0,alphaTest:a,alphaHash:G0,combine:k.combine,mapUv:n0&&R(k.map.channel),aoMapUv:$0&&R(k.aoMap.channel),lightMapUv:_0&&R(k.lightMap.channel),bumpMapUv:C0&&R(k.bumpMap.channel),normalMapUv:m0&&R(k.normalMap.channel),displacementMapUv:y&&R(k.displacementMap.channel),emissiveMapUv:YJ&&R(k.emissiveMap.channel),metalnessMapUv:h0&&R(k.metalnessMap.channel),roughnessMapUv:l0&&R(k.roughnessMap.channel),anisotropyMapUv:r&&R(k.anisotropyMap.channel),clearcoatMapUv:Z0&&R(k.clearcoatMap.channel),clearcoatNormalMapUv:K0&&R(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:M0&&R(k.clearcoatRoughnessMap.channel),iridescenceMapUv:n&&R(k.iridescenceMap.channel),iridescenceThicknessMapUv:t&&R(k.iridescenceThicknessMap.channel),sheenColorMapUv:R0&&R(k.sheenColorMap.channel),sheenRoughnessMapUv:T0&&R(k.sheenRoughnessMap.channel),specularMapUv:N0&&R(k.specularMap.channel),specularColorMapUv:k0&&R(k.specularColorMap.channel),specularIntensityMapUv:r0&&R(k.specularIntensityMap.channel),transmissionMapUv:$J&&R(k.transmissionMap.channel),thicknessMapUv:XJ&&R(k.thicknessMap.channel),alphaMapUv:q0&&R(k.alphaMap.channel),vertexTangents:!!h.attributes.tangent&&(m0||U0),vertexNormals:!!h.attributes.normal,vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!h.attributes.color&&h.attributes.color.itemSize===4,pointsUvs:v.isPoints===!0&&!!h.attributes.uv&&(n0||q0),fog:!!S,useFog:k.fog===!0,fogExp2:!!S&&S.isFogExp2,flatShading:k.wireframe===!1&&(k.flatShading===!0||h.attributes.normal===void 0&&m0===!1&&(k.isMeshLambertMaterial||k.isMeshPhongMaterial||k.isMeshStandardMaterial||k.isMeshPhysicalMaterial)),sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:F,reversedDepthBuffer:j0,skinning:v.isSkinnedMesh===!0,morphTargets:h.morphAttributes.position!==void 0,morphNormals:h.morphAttributes.normal!==void 0,morphColors:h.morphAttributes.color!==void 0,morphTargetsCount:J0,morphTextureStride:c0,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numLightProbeGrids:b.length,numClippingPlanes:Y.numPlanes,numClipIntersection:Y.numIntersection,dithering:k.dithering,shadowMapEnabled:J.shadowMap.enabled&&j.length>0,shadowMapType:J.shadowMap.type,toneMapping:Y0,decodeVideoTexture:n0&&k.map.isVideoTexture===!0&&t0.getTransfer(k.map.colorSpace)===OJ,decodeVideoTextureEmissive:YJ&&k.emissiveMap.isVideoTexture===!0&&t0.getTransfer(k.emissiveMap.colorSpace)===OJ,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===X9,flipSided:k.side===uJ,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:S0&&k.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(S0&&k.extensions.multiDraw===!0||x0)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return f0.vertexUv1s=H.has(1),f0.vertexUv2s=H.has(2),f0.vertexUv3s=H.has(3),H.clear(),f0}function q(k){let C=[];if(k.shaderID)C.push(k.shaderID);else C.push(k.customVertexShaderID),C.push(k.customFragmentShaderID);if(k.defines!==void 0)for(let j in k.defines)C.push(j),C.push(k.defines[j]);if(k.isRawShaderMaterial===!1)N(C,k),L(C,k),C.push(J.outputColorSpace);return C.push(k.customProgramCacheKey),C.join()}function N(k,C){k.push(C.precision),k.push(C.outputColorSpace),k.push(C.envMapMode),k.push(C.envMapCubeUVHeight),k.push(C.mapUv),k.push(C.alphaMapUv),k.push(C.lightMapUv),k.push(C.aoMapUv),k.push(C.bumpMapUv),k.push(C.normalMapUv),k.push(C.displacementMapUv),k.push(C.emissiveMapUv),k.push(C.metalnessMapUv),k.push(C.roughnessMapUv),k.push(C.anisotropyMapUv),k.push(C.clearcoatMapUv),k.push(C.clearcoatNormalMapUv),k.push(C.clearcoatRoughnessMapUv),k.push(C.iridescenceMapUv),k.push(C.iridescenceThicknessMapUv),k.push(C.sheenColorMapUv),k.push(C.sheenRoughnessMapUv),k.push(C.specularMapUv),k.push(C.specularColorMapUv),k.push(C.specularIntensityMapUv),k.push(C.transmissionMapUv),k.push(C.thicknessMapUv),k.push(C.combine),k.push(C.fogExp2),k.push(C.sizeAttenuation),k.push(C.morphTargetsCount),k.push(C.morphAttributeCount),k.push(C.numDirLights),k.push(C.numPointLights),k.push(C.numSpotLights),k.push(C.numSpotLightMaps),k.push(C.numHemiLights),k.push(C.numRectAreaLights),k.push(C.numDirLightShadows),k.push(C.numPointLightShadows),k.push(C.numSpotLightShadows),k.push(C.numSpotLightShadowsWithMaps),k.push(C.numLightProbes),k.push(C.shadowMapType),k.push(C.toneMapping),k.push(C.numClippingPlanes),k.push(C.numClipIntersection),k.push(C.depthPacking)}function L(k,C){if(X.disableAll(),C.instancing)X.enable(0);if(C.instancingColor)X.enable(1);if(C.instancingMorph)X.enable(2);if(C.matcap)X.enable(3);if(C.envMap)X.enable(4);if(C.normalMapObjectSpace)X.enable(5);if(C.normalMapTangentSpace)X.enable(6);if(C.clearcoat)X.enable(7);if(C.iridescence)X.enable(8);if(C.alphaTest)X.enable(9);if(C.vertexColors)X.enable(10);if(C.vertexAlphas)X.enable(11);if(C.vertexUv1s)X.enable(12);if(C.vertexUv2s)X.enable(13);if(C.vertexUv3s)X.enable(14);if(C.vertexTangents)X.enable(15);if(C.anisotropy)X.enable(16);if(C.alphaHash)X.enable(17);if(C.batching)X.enable(18);if(C.dispersion)X.enable(19);if(C.batchingColor)X.enable(20);if(C.gradientMap)X.enable(21);if(C.packedNormalMap)X.enable(22);if(C.vertexNormals)X.enable(23);if(k.push(X.mask),X.disableAll(),C.fog)X.enable(0);if(C.useFog)X.enable(1);if(C.flatShading)X.enable(2);if(C.logarithmicDepthBuffer)X.enable(3);if(C.reversedDepthBuffer)X.enable(4);if(C.skinning)X.enable(5);if(C.morphTargets)X.enable(6);if(C.morphNormals)X.enable(7);if(C.morphColors)X.enable(8);if(C.premultipliedAlpha)X.enable(9);if(C.shadowMapEnabled)X.enable(10);if(C.doubleSided)X.enable(11);if(C.flipSided)X.enable(12);if(C.useDepthPacking)X.enable(13);if(C.dithering)X.enable(14);if(C.transmission)X.enable(15);if(C.sheen)X.enable(16);if(C.opaque)X.enable(17);if(C.pointsUvs)X.enable(18);if(C.decodeVideoTexture)X.enable(19);if(C.decodeVideoTextureEmissive)X.enable(20);if(C.alphaToCoverage)X.enable(21);if(C.numLightProbeGrids>0)X.enable(22);k.push(X.mask)}function D(k){let C=O[k.type],j;if(C){let w=e9[C];j=K9.clone(w.uniforms)}else j=k.uniforms;return j}function V(k,C){let j=G.get(C);if(j!==void 0)++j.usedTimes;else j=new lL(J,C,k,W),U.push(j),G.set(C,j);return j}function z(k){if(--k.usedTimes===0){let C=U.indexOf(k);U[C]=U[U.length-1],U.pop(),G.delete(k.cacheKey),k.destroy()}}function I(k){K.remove(k)}function B(){K.dispose()}return{getParameters:M,getProgramCacheKey:q,getUniforms:D,acquireProgram:V,releaseProgram:z,releaseShaderCache:I,programs:U,dispose:B}}function iL(){let J=new WeakMap;function Q(X){return J.has(X)}function $(X){let K=J.get(X);if(K===void 0)K={},J.set(X,K);return K}function Z(X){J.delete(X)}function W(X,K,H){J.get(X)[K]=H}function Y(){J=new WeakMap}return{has:Q,get:$,remove:Z,update:W,dispose:Y}}function oL(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.material.id!==Q.material.id)return J.material.id-Q.material.id;else if(J.materialVariant!==Q.materialVariant)return J.materialVariant-Q.materialVariant;else if(J.z!==Q.z)return J.z-Q.z;else return J.id-Q.id}function l5(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.z!==Q.z)return Q.z-J.z;else return J.id-Q.id}function c5(){let J=[],Q=0,$=[],Z=[],W=[];function Y(){Q=0,$.length=0,Z.length=0,W.length=0}function X(E){let O=0;if(E.isInstancedMesh)O+=2;if(E.isSkinnedMesh)O+=1;return O}function K(E,O,R,M,q,N){let L=J[Q];if(L===void 0)L={id:E.id,object:E,geometry:O,material:R,materialVariant:X(E),groupOrder:M,renderOrder:E.renderOrder,z:q,group:N},J[Q]=L;else L.id=E.id,L.object=E,L.geometry=O,L.material=R,L.materialVariant=X(E),L.groupOrder=M,L.renderOrder=E.renderOrder,L.z=q,L.group=N;return Q++,L}function H(E,O,R,M,q,N){let L=K(E,O,R,M,q,N);if(R.transmission>0)Z.push(L);else if(R.transparent===!0)W.push(L);else $.push(L)}function U(E,O,R,M,q,N){let L=K(E,O,R,M,q,N);if(R.transmission>0)Z.unshift(L);else if(R.transparent===!0)W.unshift(L);else $.unshift(L)}function G(E,O){if($.length>1)$.sort(E||oL);if(Z.length>1)Z.sort(O||l5);if(W.length>1)W.sort(O||l5)}function F(){for(let E=Q,O=J.length;E<O;E++){let R=J[E];if(R.id===null)break;R.id=null,R.object=null,R.geometry=null,R.material=null,R.group=null}}return{opaque:$,transmissive:Z,transparent:W,init:Y,push:H,unshift:U,finish:F,sort:G}}function aL(){let J=new WeakMap;function Q(Z,W){let Y=J.get(Z),X;if(Y===void 0)X=new c5,J.set(Z,[X]);else if(W>=Y.length)X=new c5,Y.push(X);else X=Y[W];return X}function $(){J=new WeakMap}return{get:Q,dispose:$}}function rL(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new A,color:new e};break;case"SpotLight":$={position:new A,direction:new A,color:new e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new A,color:new e,distance:0,decay:0};break;case"HemisphereLight":$={direction:new A,skyColor:new e,groundColor:new e};break;case"RectAreaLight":$={color:new e,position:new A,halfWidth:new A,halfHeight:new A};break}return J[Q.id]=$,$}}}function tL(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new i,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}var eL=0;function JD(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function QD(J){let Q=new rL,$=tL(),Z={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let U=0;U<9;U++)Z.probe.push(new A);let W=new A,Y=new y0,X=new y0;function K(U){let G=0,F=0,E=0;for(let C=0;C<9;C++)Z.probe[C].set(0,0,0);let O=0,R=0,M=0,q=0,N=0,L=0,D=0,V=0,z=0,I=0,B=0;U.sort(JD);for(let C=0,j=U.length;C<j;C++){let w=U[C],v=w.color,b=w.intensity,S=w.distance,h=null;if(w.shadow&&w.shadow.map)if(w.shadow.map.texture.format===r8)h=w.shadow.map.texture;else h=w.shadow.map.depthTexture||w.shadow.map.texture;if(w.isAmbientLight)G+=v.r*b,F+=v.g*b,E+=v.b*b;else if(w.isLightProbe){for(let x=0;x<9;x++)Z.probe[x].addScaledVector(w.sh.coefficients[x],b);B++}else if(w.isDirectionalLight){let x=Q.get(w);if(x.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){let p=w.shadow,c=$.get(w);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.directionalShadow[O]=c,Z.directionalShadowMap[O]=h,Z.directionalShadowMatrix[O]=w.shadow.matrix,L++}Z.directional[O]=x,O++}else if(w.isSpotLight){let x=Q.get(w);x.position.setFromMatrixPosition(w.matrixWorld),x.color.copy(v).multiplyScalar(b),x.distance=S,x.coneCos=Math.cos(w.angle),x.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),x.decay=w.decay,Z.spot[M]=x;let p=w.shadow;if(w.map){if(Z.spotLightMap[z]=w.map,z++,p.updateMatrices(w),w.castShadow)I++}if(Z.spotLightMatrix[M]=p.matrix,w.castShadow){let c=$.get(w);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.spotShadow[M]=c,Z.spotShadowMap[M]=h,V++}M++}else if(w.isRectAreaLight){let x=Q.get(w);x.color.copy(v).multiplyScalar(b),x.halfWidth.set(w.width*0.5,0,0),x.halfHeight.set(0,w.height*0.5,0),Z.rectArea[q]=x,q++}else if(w.isPointLight){let x=Q.get(w);if(x.color.copy(w.color).multiplyScalar(w.intensity),x.distance=w.distance,x.decay=w.decay,w.castShadow){let p=w.shadow,c=$.get(w);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,c.shadowCameraNear=p.camera.near,c.shadowCameraFar=p.camera.far,Z.pointShadow[R]=c,Z.pointShadowMap[R]=h,Z.pointShadowMatrix[R]=w.shadow.matrix,D++}Z.point[R]=x,R++}else if(w.isHemisphereLight){let x=Q.get(w);x.skyColor.copy(w.color).multiplyScalar(b),x.groundColor.copy(w.groundColor).multiplyScalar(b),Z.hemi[N]=x,N++}}if(q>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=D0.LTC_FLOAT_1,Z.rectAreaLTC2=D0.LTC_FLOAT_2;else Z.rectAreaLTC1=D0.LTC_HALF_1,Z.rectAreaLTC2=D0.LTC_HALF_2;Z.ambient[0]=G,Z.ambient[1]=F,Z.ambient[2]=E;let k=Z.hash;if(k.directionalLength!==O||k.pointLength!==R||k.spotLength!==M||k.rectAreaLength!==q||k.hemiLength!==N||k.numDirectionalShadows!==L||k.numPointShadows!==D||k.numSpotShadows!==V||k.numSpotMaps!==z||k.numLightProbes!==B)Z.directional.length=O,Z.spot.length=M,Z.rectArea.length=q,Z.point.length=R,Z.hemi.length=N,Z.directionalShadow.length=L,Z.directionalShadowMap.length=L,Z.pointShadow.length=D,Z.pointShadowMap.length=D,Z.spotShadow.length=V,Z.spotShadowMap.length=V,Z.directionalShadowMatrix.length=L,Z.pointShadowMatrix.length=D,Z.spotLightMatrix.length=V+z-I,Z.spotLightMap.length=z,Z.numSpotLightShadowsWithMaps=I,Z.numLightProbes=B,k.directionalLength=O,k.pointLength=R,k.spotLength=M,k.rectAreaLength=q,k.hemiLength=N,k.numDirectionalShadows=L,k.numPointShadows=D,k.numSpotShadows=V,k.numSpotMaps=z,k.numLightProbes=B,Z.version=eL++}function H(U,G){let F=0,E=0,O=0,R=0,M=0,q=G.matrixWorldInverse;for(let N=0,L=U.length;N<L;N++){let D=U[N];if(D.isDirectionalLight){let V=Z.directional[F];V.direction.setFromMatrixPosition(D.matrixWorld),W.setFromMatrixPosition(D.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(q),F++}else if(D.isSpotLight){let V=Z.spot[O];V.position.setFromMatrixPosition(D.matrixWorld),V.position.applyMatrix4(q),V.direction.setFromMatrixPosition(D.matrixWorld),W.setFromMatrixPosition(D.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(q),O++}else if(D.isRectAreaLight){let V=Z.rectArea[R];V.position.setFromMatrixPosition(D.matrixWorld),V.position.applyMatrix4(q),X.identity(),Y.copy(D.matrixWorld),Y.premultiply(q),X.extractRotation(Y),V.halfWidth.set(D.width*0.5,0,0),V.halfHeight.set(0,D.height*0.5,0),V.halfWidth.applyMatrix4(X),V.halfHeight.applyMatrix4(X),R++}else if(D.isPointLight){let V=Z.point[E];V.position.setFromMatrixPosition(D.matrixWorld),V.position.applyMatrix4(q),E++}else if(D.isHemisphereLight){let V=Z.hemi[M];V.direction.setFromMatrixPosition(D.matrixWorld),V.direction.transformDirection(q),M++}}}return{setup:K,setupView:H,state:Z}}function n5(J){let Q=new QD(J),$=[],Z=[],W=[];function Y(E){F.camera=E,$.length=0,Z.length=0,W.length=0}function X(E){$.push(E)}function K(E){Z.push(E)}function H(E){W.push(E)}function U(){Q.setup($)}function G(E){Q.setupView($,E)}let F={lightsArray:$,shadowsArray:Z,lightProbeGridArray:W,camera:null,lights:Q,transmissionRenderTarget:{},textureUnits:0};return{init:Y,state:F,setupLights:U,setupLightsView:G,pushLight:X,pushShadow:K,pushLightProbeGrid:H}}function $D(J){let Q=new WeakMap;function $(W,Y=0){let X=Q.get(W),K;if(X===void 0)K=new n5(J),Q.set(W,[K]);else if(Y>=X.length)K=new n5(J),X.push(K);else K=X[Y];return K}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var ZD=`void main() {
4054
4054
  gl_Position = vec4( position, 1.0 );
4055
- }`,XF=`uniform sampler2D shadow_pass;
4055
+ }`,WD=`uniform sampler2D shadow_pass;
4056
4056
  uniform vec2 resolution;
4057
4057
  uniform float radius;
4058
4058
  void main() {
@@ -4077,12 +4077,12 @@ void main() {
4077
4077
  squared_mean = squared_mean / samples;
4078
4078
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4079
4079
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4080
- }`,KF=[new S(1,0,0),new S(-1,0,0),new S(0,1,0),new S(0,-1,0),new S(0,0,1),new S(0,0,-1)],HF=[new S(0,-1,0),new S(0,-1,0),new S(0,0,1),new S(0,0,-1),new S(0,-1,0),new S(0,-1,0)],lX=new j0,R7=new S,aZ=new S;function UF(J,Q,$){let Z=new h8,W=new T0,Y=new T0,X=new $J,K=new TZ,H=new AZ,U={},G=$.maxTextureSize,F={[A9]:yJ,[yJ]:A9,[sJ]:sJ},E=new OJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new T0},radius:{value:4}},vertexShader:YF,fragmentShader:XF}),O=E.clone();O.defines.HORIZONTAL_PASS=1;let R=new qJ;R.setAttribute("position",new QJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let C=new a0(R,E),q=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=n6;let N=this.type;this.render=function(w,B,D){if(q.enabled===!1)return;if(q.autoUpdate===!1&&q.needsUpdate===!1)return;if(w.length===0)return;if(this.type===MY)C0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=n6;let V=J.getRenderTarget(),j=J.getActiveCubeFace(),z=J.getActiveMipmapLevel(),v=J.state;if(v.setBlending(H9),v.buffers.depth.getReversed()===!0)v.buffers.color.setClear(0,0,0,0);else v.buffers.color.setClear(1,1,1,1);v.buffers.depth.setTest(!0),v.setScissorTest(!1);let y=N!==this.type;if(y)B.traverse(function(A){if(A.material)if(Array.isArray(A.material))A.material.forEach((x)=>x.needsUpdate=!0);else A.material.needsUpdate=!0});for(let A=0,x=w.length;A<x;A++){let b=w[A],p=b.shadow;if(p===void 0){C0("WebGLShadowMap:",b,"has no shadow.");continue}if(p.autoUpdate===!1&&p.needsUpdate===!1)continue;W.copy(p.mapSize);let c=p.getFrameExtents();if(W.multiply(c),Y.copy(p.mapSize),W.x>G||W.y>G){if(W.x>G)Y.x=Math.floor(G/c.x),W.x=Y.x*c.x,p.mapSize.x=Y.x;if(W.y>G)Y.y=Math.floor(G/c.y),W.y=Y.y*c.y,p.mapSize.y=Y.y}let o=J.state.buffers.depth.getReversed();if(p.camera._reversedDepth=o,p.map===null||y===!0){if(p.map!==null){if(p.map.depthTexture!==null)p.map.depthTexture.dispose(),p.map.depthTexture=null;p.map.dispose()}if(this.type===G6){if(b.isPointLight){C0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}p.map=new TJ(W.x,W.y,{format:y8,type:kJ,minFilter:CJ,magFilter:CJ,generateMipmaps:!1}),p.map.texture.name=b.name+".shadowMap",p.map.depthTexture=new N8(W.x,W.y,$9),p.map.depthTexture.name=b.name+".shadowMapDepth",p.map.depthTexture.format=j8,p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=V9,p.map.depthTexture.magFilter=V9}else{if(b.isPointLight)p.map=new eZ(W.x),p.map.depthTexture=new zZ(W.x,G8);else p.map=new TJ(W.x,W.y),p.map.depthTexture=new N8(W.x,W.y,G8);if(p.map.depthTexture.name=b.name+".shadowMap",p.map.depthTexture.format=j8,this.type===n6)p.map.depthTexture.compareFunction=o?qQ:OQ,p.map.depthTexture.minFilter=CJ,p.map.depthTexture.magFilter=CJ;else p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=V9,p.map.depthTexture.magFilter=V9}p.camera.updateProjectionMatrix()}let Q0=p.map.isWebGLCubeRenderTarget?6:1;for(let Y0=0;Y0<Q0;Y0++){if(p.map.isWebGLCubeRenderTarget)J.setRenderTarget(p.map,Y0),J.clear();else{if(Y0===0)J.setRenderTarget(p.map),J.clear();let J0=p.getViewport(Y0);X.set(Y.x*J0.x,Y.y*J0.y,Y.x*J0.z,Y.y*J0.w),v.viewport(X)}if(b.isPointLight){let{camera:J0,matrix:x0}=p,v0=b.distance||J0.far;if(v0!==J0.far)J0.far=v0,J0.updateProjectionMatrix();R7.setFromMatrixPosition(b.matrixWorld),J0.position.copy(R7),aZ.copy(J0.position),aZ.add(KF[Y0]),J0.up.copy(HF[Y0]),J0.lookAt(aZ),J0.updateMatrixWorld(),x0.makeTranslation(-R7.x,-R7.y,-R7.z),lX.multiplyMatrices(J0.projectionMatrix,J0.matrixWorldInverse),p._frustum.setFromProjectionMatrix(lX,J0.coordinateSystem,J0.reversedDepth)}else p.updateMatrices(b);Z=p.getFrustum(),M(B,D,p.camera,b,this.type)}if(p.isPointLightShadow!==!0&&this.type===G6)L(p,D);p.needsUpdate=!1}N=this.type,q.needsUpdate=!1,J.setRenderTarget(V,j,z)};function L(w,B){let D=Q.update(C);if(E.defines.VSM_SAMPLES!==w.blurSamples)E.defines.VSM_SAMPLES=w.blurSamples,O.defines.VSM_SAMPLES=w.blurSamples,E.needsUpdate=!0,O.needsUpdate=!0;if(w.mapPass===null)w.mapPass=new TJ(W.x,W.y,{format:y8,type:kJ});E.uniforms.shadow_pass.value=w.map.depthTexture,E.uniforms.resolution.value=w.mapSize,E.uniforms.radius.value=w.radius,J.setRenderTarget(w.mapPass),J.clear(),J.renderBufferDirect(B,null,D,E,C,null),O.uniforms.shadow_pass.value=w.mapPass.texture,O.uniforms.resolution.value=w.mapSize,O.uniforms.radius.value=w.radius,J.setRenderTarget(w.map),J.clear(),J.renderBufferDirect(B,null,D,O,C,null)}function k(w,B,D,V){let j=null,z=D.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(z!==void 0)j=z;else if(j=D.isPointLight===!0?H:K,J.localClippingEnabled&&B.clipShadows===!0&&Array.isArray(B.clippingPlanes)&&B.clippingPlanes.length!==0||B.displacementMap&&B.displacementScale!==0||B.alphaMap&&B.alphaTest>0||B.map&&B.alphaTest>0||B.alphaToCoverage===!0){let v=j.uuid,y=B.uuid,A=U[v];if(A===void 0)A={},U[v]=A;let x=A[y];if(x===void 0)x=j.clone(),A[y]=x,B.addEventListener("dispose",P);j=x}if(j.visible=B.visible,j.wireframe=B.wireframe,V===G6)j.side=B.shadowSide!==null?B.shadowSide:B.side;else j.side=B.shadowSide!==null?B.shadowSide:F[B.side];if(j.alphaMap=B.alphaMap,j.alphaTest=B.alphaToCoverage===!0?0.5:B.alphaTest,j.map=B.map,j.clipShadows=B.clipShadows,j.clippingPlanes=B.clippingPlanes,j.clipIntersection=B.clipIntersection,j.displacementMap=B.displacementMap,j.displacementScale=B.displacementScale,j.displacementBias=B.displacementBias,j.wireframeLinewidth=B.wireframeLinewidth,j.linewidth=B.linewidth,D.isPointLight===!0&&j.isMeshDistanceMaterial===!0){let v=J.properties.get(j);v.light=D}return j}function M(w,B,D,V,j){if(w.visible===!1)return;if(w.layers.test(B.layers)&&(w.isMesh||w.isLine||w.isPoints)){if((w.castShadow||w.receiveShadow&&j===G6)&&(!w.frustumCulled||Z.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,w.matrixWorld);let y=Q.update(w),A=w.material;if(Array.isArray(A)){let x=y.groups;for(let b=0,p=x.length;b<p;b++){let c=x[b],o=A[c.materialIndex];if(o&&o.visible){let Q0=k(w,o,V,j);w.onBeforeShadow(J,w,B,D,y,Q0,c),J.renderBufferDirect(D,null,y,Q0,w,c),w.onAfterShadow(J,w,B,D,y,Q0,c)}}}else if(A.visible){let x=k(w,A,V,j);w.onBeforeShadow(J,w,B,D,y,x,null),J.renderBufferDirect(D,null,y,x,w,null),w.onAfterShadow(J,w,B,D,y,x,null)}}}let v=w.children;for(let y=0,A=v.length;y<A;y++)M(v[y],B,D,V,j)}function P(w){w.target.removeEventListener("dispose",P);for(let D in U){let V=U[D],j=w.target.uuid;if(j in V)V[j].dispose(),delete V[j]}}}function GF(J,Q){function $(){let h=!1,H0=new $J,i=null,Z0=new $J(0,0,0,0);return{setMask:function(B0){if(i!==B0&&!h)J.colorMask(B0,B0,B0,B0),i=B0},setLocked:function(B0){h=B0},setClear:function(B0,e,z0,f0,_J){if(_J===!0)B0*=f0,e*=f0,z0*=f0;if(H0.set(B0,e,z0,f0),Z0.equals(H0)===!1)J.clearColor(B0,e,z0,f0),Z0.copy(H0)},reset:function(){h=!1,i=null,Z0.set(-1,0,0,0)}}}function Z(){let h=!1,H0=!1,i=null,Z0=null,B0=null;return{setReversed:function(e){if(H0!==e){let z0=Q.get("EXT_clip_control");if(e)z0.clipControlEXT(z0.LOWER_LEFT_EXT,z0.ZERO_TO_ONE_EXT);else z0.clipControlEXT(z0.LOWER_LEFT_EXT,z0.NEGATIVE_ONE_TO_ONE_EXT);H0=e;let f0=B0;B0=null,this.setClear(f0)}},getReversed:function(){return H0},setTest:function(e){if(e)E0(J.DEPTH_TEST);else _0(J.DEPTH_TEST)},setMask:function(e){if(i!==e&&!h)J.depthMask(e),i=e},setFunc:function(e){if(H0)e=OX[e];if(Z0!==e){switch(e){case uY:J.depthFunc(J.NEVER);break;case dY:J.depthFunc(J.ALWAYS);break;case mY:J.depthFunc(J.LESS);break;case j$:J.depthFunc(J.LEQUAL);break;case lY:J.depthFunc(J.EQUAL);break;case cY:J.depthFunc(J.GEQUAL);break;case nY:J.depthFunc(J.GREATER);break;case sY:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}Z0=e}},setLocked:function(e){h=e},setClear:function(e){if(B0!==e){if(B0=e,H0)e=1-e;J.clearDepth(e)}},reset:function(){h=!1,i=null,Z0=null,B0=null,H0=!1}}}function W(){let h=!1,H0=null,i=null,Z0=null,B0=null,e=null,z0=null,f0=null,_J=null;return{setTest:function(XJ){if(!h)if(XJ)E0(J.STENCIL_TEST);else _0(J.STENCIL_TEST)},setMask:function(XJ){if(H0!==XJ&&!h)J.stencilMask(XJ),H0=XJ},setFunc:function(XJ,z9,O9){if(i!==XJ||Z0!==z9||B0!==O9)J.stencilFunc(XJ,z9,O9),i=XJ,Z0=z9,B0=O9},setOp:function(XJ,z9,O9){if(e!==XJ||z0!==z9||f0!==O9)J.stencilOp(XJ,z9,O9),e=XJ,z0=z9,f0=O9},setLocked:function(XJ){h=XJ},setClear:function(XJ){if(_J!==XJ)J.clearStencil(XJ),_J=XJ},reset:function(){h=!1,H0=null,i=null,Z0=null,B0=null,e=null,z0=null,f0=null,_J=null}}}let Y=new $,X=new Z,K=new W,H=new WeakMap,U=new WeakMap,G={},F={},E={},O=new WeakMap,R=[],C=null,q=!1,N=null,L=null,k=null,M=null,P=null,w=null,B=null,D=new X0(0,0,0),V=0,j=!1,z=null,v=null,y=null,A=null,x=null,b=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),p=!1,c=0,o=J.getParameter(J.VERSION);if(o.indexOf("WebGL")!==-1)c=parseFloat(/^WebGL (\d)/.exec(o)[1]),p=c>=1;else if(o.indexOf("OpenGL ES")!==-1)c=parseFloat(/^OpenGL ES (\d)/.exec(o)[1]),p=c>=2;let Q0=null,Y0={},J0=J.getParameter(J.SCISSOR_BOX),x0=J.getParameter(J.VIEWPORT),v0=new $J().fromArray(J0),s=new $J().fromArray(x0);function K0(h,H0,i,Z0){let B0=new Uint8Array(4),e=J.createTexture();J.bindTexture(h,e),J.texParameteri(h,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(h,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let z0=0;z0<i;z0++)if(h===J.TEXTURE_3D||h===J.TEXTURE_2D_ARRAY)J.texImage3D(H0,0,J.RGBA,1,1,Z0,0,J.RGBA,J.UNSIGNED_BYTE,B0);else J.texImage2D(H0+z0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,B0);return e}let D0={};D0[J.TEXTURE_2D]=K0(J.TEXTURE_2D,J.TEXTURE_2D,1),D0[J.TEXTURE_CUBE_MAP]=K0(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),D0[J.TEXTURE_2D_ARRAY]=K0(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),D0[J.TEXTURE_3D]=K0(J.TEXTURE_3D,J.TEXTURE_3D,1,1),Y.setClear(0,0,0,1),X.setClear(1),K.setClear(0),E0(J.DEPTH_TEST),X.setFunc(j$),bJ(!1),zJ(T$),E0(J.CULL_FACE),m0(H9);function E0(h){if(G[h]!==!0)J.enable(h),G[h]=!0}function _0(h){if(G[h]!==!1)J.disable(h),G[h]=!1}function i0(h,H0){if(E[h]!==H0){if(J.bindFramebuffer(h,H0),E[h]=H0,h===J.DRAW_FRAMEBUFFER)E[J.FRAMEBUFFER]=H0;if(h===J.FRAMEBUFFER)E[J.DRAW_FRAMEBUFFER]=H0;return!0}return!1}function y0(h,H0){let i=R,Z0=!1;if(h){if(i=O.get(H0),i===void 0)i=[],O.set(H0,i);let B0=h.textures;if(i.length!==B0.length||i[0]!==J.COLOR_ATTACHMENT0){for(let e=0,z0=B0.length;e<z0;e++)i[e]=J.COLOR_ATTACHMENT0+e;i.length=B0.length,Z0=!0}}else if(i[0]!==J.BACK)i[0]=J.BACK,Z0=!0;if(Z0)J.drawBuffers(i)}function d0(h){if(C!==h)return J.useProgram(h),C=h,!0;return!1}let UJ={[E6]:J.FUNC_ADD,[BY]:J.FUNC_SUBTRACT,[CY]:J.FUNC_REVERSE_SUBTRACT};UJ[IY]=J.MIN,UJ[zY]=J.MAX;let GJ={[_Y]:J.ZERO,[wY]:J.ONE,[PY]:J.SRC_COLOR,[AY]:J.SRC_ALPHA,[bY]:J.SRC_ALPHA_SATURATE,[yY]:J.DST_COLOR,[jY]:J.DST_ALPHA,[TY]:J.ONE_MINUS_SRC_COLOR,[SY]:J.ONE_MINUS_SRC_ALPHA,[xY]:J.ONE_MINUS_DST_COLOR,[vY]:J.ONE_MINUS_DST_ALPHA,[hY]:J.CONSTANT_COLOR,[fY]:J.ONE_MINUS_CONSTANT_COLOR,[gY]:J.CONSTANT_ALPHA,[pY]:J.ONE_MINUS_CONSTANT_ALPHA};function m0(h,H0,i,Z0,B0,e,z0,f0,_J,XJ){if(h===H9){if(q===!0)_0(J.BLEND),q=!1;return}if(q===!1)E0(J.BLEND),q=!0;if(h!==VY){if(h!==N||XJ!==j){if(L!==E6||P!==E6)J.blendEquation(J.FUNC_ADD),L=E6,P=E6;if(XJ)switch(h){case w8:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case P8:J.blendFunc(J.ONE,J.ONE);break;case A$:J.blendFuncSeparate(J.ZERO,J.ONE_MINUS_SRC_COLOR,J.ZERO,J.ONE);break;case S$:J.blendFuncSeparate(J.DST_COLOR,J.ONE_MINUS_SRC_ALPHA,J.ZERO,J.ONE);break;default:S0("WebGLState: Invalid blending: ",h);break}else switch(h){case w8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case P8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case A$:S0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case S$:S0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:S0("WebGLState: Invalid blending: ",h);break}k=null,M=null,w=null,B=null,D.set(0,0,0),V=0,N=h,j=XJ}return}if(B0=B0||H0,e=e||i,z0=z0||Z0,H0!==L||B0!==P)J.blendEquationSeparate(UJ[H0],UJ[B0]),L=H0,P=B0;if(i!==k||Z0!==M||e!==w||z0!==B)J.blendFuncSeparate(GJ[i],GJ[Z0],GJ[e],GJ[z0]),k=i,M=Z0,w=e,B=z0;if(f0.equals(D)===!1||_J!==V)J.blendColor(f0.r,f0.g,f0.b,_J),D.copy(f0),V=_J;N=h,j=!1}function xJ(h,H0){h.side===sJ?_0(J.CULL_FACE):E0(J.CULL_FACE);let i=h.side===yJ;if(H0)i=!i;bJ(i),h.blending===w8&&h.transparent===!1?m0(H9):m0(h.blending,h.blendEquation,h.blendSrc,h.blendDst,h.blendEquationAlpha,h.blendSrcAlpha,h.blendDstAlpha,h.blendColor,h.blendAlpha,h.premultipliedAlpha),X.setFunc(h.depthFunc),X.setTest(h.depthTest),X.setMask(h.depthWrite),Y.setMask(h.colorWrite);let Z0=h.stencilWrite;if(K.setTest(Z0),Z0)K.setMask(h.stencilWriteMask),K.setFunc(h.stencilFunc,h.stencilRef,h.stencilFuncMask),K.setOp(h.stencilFail,h.stencilZFail,h.stencilZPass);uJ(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits),h.alphaToCoverage===!0?E0(J.SAMPLE_ALPHA_TO_COVERAGE):_0(J.SAMPLE_ALPHA_TO_COVERAGE)}function bJ(h){if(z!==h){if(h)J.frontFace(J.CW);else J.frontFace(J.CCW);z=h}}function zJ(h){if(h!==DY){if(E0(J.CULL_FACE),h!==v)if(h===T$)J.cullFace(J.BACK);else if(h===kY)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else _0(J.CULL_FACE);v=h}function f(h){if(h!==y){if(p)J.lineWidth(h);y=h}}function uJ(h,H0,i){if(h){if(E0(J.POLYGON_OFFSET_FILL),A!==H0||x!==i){if(A=H0,x=i,X.getReversed())H0=-H0;J.polygonOffset(H0,i)}}else _0(J.POLYGON_OFFSET_FILL)}function r0(h){if(h)E0(J.SCISSOR_TEST);else _0(J.SCISSOR_TEST)}function e0(h){if(h===void 0)h=J.TEXTURE0+b-1;if(Q0!==h)J.activeTexture(h),Q0=h}function R0(h,H0,i){if(i===void 0)if(Q0===null)i=J.TEXTURE0+b-1;else i=Q0;let Z0=Y0[i];if(Z0===void 0)Z0={type:void 0,texture:void 0},Y0[i]=Z0;if(Z0.type!==h||Z0.texture!==H0){if(Q0!==i)J.activeTexture(i),Q0=i;J.bindTexture(h,H0||D0[h]),Z0.type=h,Z0.texture=H0}}function LJ(){let h=Y0[Q0];if(h!==void 0&&h.type!==void 0)J.bindTexture(h.type,null),h.type=void 0,h.texture=void 0}function A0(){try{J.compressedTexImage2D(...arguments)}catch(h){S0("WebGLState:",h)}}function T(){try{J.compressedTexImage3D(...arguments)}catch(h){S0("WebGLState:",h)}}function I(){try{J.texSubImage2D(...arguments)}catch(h){S0("WebGLState:",h)}}function u(){try{J.texSubImage3D(...arguments)}catch(h){S0("WebGLState:",h)}}function r(){try{J.compressedTexSubImage2D(...arguments)}catch(h){S0("WebGLState:",h)}}function t(){try{J.compressedTexSubImage3D(...arguments)}catch(h){S0("WebGLState:",h)}}function $0(){try{J.texStorage2D(...arguments)}catch(h){S0("WebGLState:",h)}}function F0(){try{J.texStorage3D(...arguments)}catch(h){S0("WebGLState:",h)}}function n(){try{J.texImage2D(...arguments)}catch(h){S0("WebGLState:",h)}}function a(){try{J.texImage3D(...arguments)}catch(h){S0("WebGLState:",h)}}function U0(h){if(F[h]!==void 0)return F[h];else return J.getParameter(h)}function V0(h,H0){if(F[h]!==H0)J.pixelStorei(h,H0),F[h]=H0}function W0(h){if(v0.equals(h)===!1)J.scissor(h.x,h.y,h.z,h.w),v0.copy(h)}function N0(h){if(s.equals(h)===!1)J.viewport(h.x,h.y,h.z,h.w),s.copy(h)}function b0(h,H0){let i=U.get(H0);if(i===void 0)i=new WeakMap,U.set(H0,i);let Z0=i.get(h);if(Z0===void 0)Z0=J.getUniformBlockIndex(H0,h.name),i.set(h,Z0)}function p0(h,H0){let Z0=U.get(H0).get(h);if(H.get(H0)!==Z0)J.uniformBlockBinding(H0,Z0,h.__bindingPointIndex),H.set(H0,Z0)}function n0(){J.disable(J.BLEND),J.disable(J.CULL_FACE),J.disable(J.DEPTH_TEST),J.disable(J.POLYGON_OFFSET_FILL),J.disable(J.SCISSOR_TEST),J.disable(J.STENCIL_TEST),J.disable(J.SAMPLE_ALPHA_TO_COVERAGE),J.blendEquation(J.FUNC_ADD),J.blendFunc(J.ONE,J.ZERO),J.blendFuncSeparate(J.ONE,J.ZERO,J.ONE,J.ZERO),J.blendColor(0,0,0,0),J.colorMask(!0,!0,!0,!0),J.clearColor(0,0,0,0),J.depthMask(!0),J.depthFunc(J.LESS),X.setReversed(!1),J.clearDepth(1),J.stencilMask(4294967295),J.stencilFunc(J.ALWAYS,0,4294967295),J.stencilOp(J.KEEP,J.KEEP,J.KEEP),J.clearStencil(0),J.cullFace(J.BACK),J.frontFace(J.CCW),J.polygonOffset(0,0),J.activeTexture(J.TEXTURE0),J.bindFramebuffer(J.FRAMEBUFFER,null),J.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),J.bindFramebuffer(J.READ_FRAMEBUFFER,null),J.useProgram(null),J.lineWidth(1),J.scissor(0,0,J.canvas.width,J.canvas.height),J.viewport(0,0,J.canvas.width,J.canvas.height),J.pixelStorei(J.PACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,!1),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),J.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,J.BROWSER_DEFAULT_WEBGL),J.pixelStorei(J.PACK_ROW_LENGTH,0),J.pixelStorei(J.PACK_SKIP_PIXELS,0),J.pixelStorei(J.PACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_ROW_LENGTH,0),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,0),J.pixelStorei(J.UNPACK_SKIP_PIXELS,0),J.pixelStorei(J.UNPACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_SKIP_IMAGES,0),G={},F={},Q0=null,Y0={},E={},O=new WeakMap,R=[],C=null,q=!1,N=null,L=null,k=null,M=null,P=null,w=null,B=null,D=new X0(0,0,0),V=0,j=!1,z=null,v=null,y=null,A=null,x=null,v0.set(0,0,J.canvas.width,J.canvas.height),s.set(0,0,J.canvas.width,J.canvas.height),Y.reset(),X.reset(),K.reset()}return{buffers:{color:Y,depth:X,stencil:K},enable:E0,disable:_0,bindFramebuffer:i0,drawBuffers:y0,useProgram:d0,setBlending:m0,setMaterial:xJ,setFlipSided:bJ,setCullFace:zJ,setLineWidth:f,setPolygonOffset:uJ,setScissorTest:r0,activeTexture:e0,bindTexture:R0,unbindTexture:LJ,compressedTexImage2D:A0,compressedTexImage3D:T,texImage2D:n,texImage3D:a,pixelStorei:V0,getParameter:U0,updateUBOMapping:b0,uniformBlockBinding:p0,texStorage2D:$0,texStorage3D:F0,texSubImage2D:I,texSubImage3D:u,compressedTexSubImage2D:r,compressedTexSubImage3D:t,scissor:W0,viewport:N0,reset:n0}}function EF(J,Q,$,Z,W,Y,X){let K=Q.has("WEBGL_multisampled_render_to_texture")?Q.get("WEBGL_multisampled_render_to_texture"):null,H=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),U=new T0,G=new WeakMap,F=new Set,E,O=new WeakMap,R=!1;try{R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(T){}function C(T,I){return R?new OffscreenCanvas(T,I):K6("canvas")}function q(T,I,u){let r=1,t=A0(T);if(t.width>u||t.height>u)r=u/Math.max(t.width,t.height);if(r<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){let $0=Math.floor(r*t.width),F0=Math.floor(r*t.height);if(E===void 0)E=C($0,F0);let n=I?C($0,F0):E;return n.width=$0,n.height=F0,n.getContext("2d").drawImage(T,0,0,$0,F0),C0("WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+$0+"x"+F0+")."),n}else{if("data"in T)C0("WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+").");return T}return T}function N(T){return T.generateMipmaps}function L(T){J.generateMipmap(T)}function k(T){if(T.isWebGLCubeRenderTarget)return J.TEXTURE_CUBE_MAP;if(T.isWebGL3DRenderTarget)return J.TEXTURE_3D;if(T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture)return J.TEXTURE_2D_ARRAY;return J.TEXTURE_2D}function M(T,I,u,r,t,$0=!1){if(T!==null){if(J[T]!==void 0)return J[T];C0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let F0;if(r){if(F0=Q.get("EXT_texture_norm16"),!F0)C0("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let n=I;if(I===J.RED){if(u===J.FLOAT)n=J.R32F;if(u===J.HALF_FLOAT)n=J.R16F;if(u===J.UNSIGNED_BYTE)n=J.R8;if(u===J.UNSIGNED_SHORT&&F0)n=F0.R16_EXT;if(u===J.SHORT&&F0)n=F0.R16_SNORM_EXT}if(I===J.RED_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.R8UI;if(u===J.UNSIGNED_SHORT)n=J.R16UI;if(u===J.UNSIGNED_INT)n=J.R32UI;if(u===J.BYTE)n=J.R8I;if(u===J.SHORT)n=J.R16I;if(u===J.INT)n=J.R32I}if(I===J.RG){if(u===J.FLOAT)n=J.RG32F;if(u===J.HALF_FLOAT)n=J.RG16F;if(u===J.UNSIGNED_BYTE)n=J.RG8;if(u===J.UNSIGNED_SHORT&&F0)n=F0.RG16_EXT;if(u===J.SHORT&&F0)n=F0.RG16_SNORM_EXT}if(I===J.RG_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RG8UI;if(u===J.UNSIGNED_SHORT)n=J.RG16UI;if(u===J.UNSIGNED_INT)n=J.RG32UI;if(u===J.BYTE)n=J.RG8I;if(u===J.SHORT)n=J.RG16I;if(u===J.INT)n=J.RG32I}if(I===J.RGB_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RGB8UI;if(u===J.UNSIGNED_SHORT)n=J.RGB16UI;if(u===J.UNSIGNED_INT)n=J.RGB32UI;if(u===J.BYTE)n=J.RGB8I;if(u===J.SHORT)n=J.RGB16I;if(u===J.INT)n=J.RGB32I}if(I===J.RGBA_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RGBA8UI;if(u===J.UNSIGNED_SHORT)n=J.RGBA16UI;if(u===J.UNSIGNED_INT)n=J.RGBA32UI;if(u===J.BYTE)n=J.RGBA8I;if(u===J.SHORT)n=J.RGBA16I;if(u===J.INT)n=J.RGBA32I}if(I===J.RGB){if(u===J.UNSIGNED_SHORT&&F0)n=F0.RGB16_EXT;if(u===J.SHORT&&F0)n=F0.RGB16_SNORM_EXT;if(u===J.UNSIGNED_INT_5_9_9_9_REV)n=J.RGB9_E5;if(u===J.UNSIGNED_INT_10F_11F_11F_REV)n=J.R11F_G11F_B10F}if(I===J.RGBA){let a=$0?DZ:u0.getTransfer(t);if(u===J.FLOAT)n=J.RGBA32F;if(u===J.HALF_FLOAT)n=J.RGBA16F;if(u===J.UNSIGNED_BYTE)n=a===YJ?J.SRGB8_ALPHA8:J.RGBA8;if(u===J.UNSIGNED_SHORT&&F0)n=F0.RGBA16_EXT;if(u===J.SHORT&&F0)n=F0.RGBA16_SNORM_EXT;if(u===J.UNSIGNED_SHORT_4_4_4_4)n=J.RGBA4;if(u===J.UNSIGNED_SHORT_5_5_5_1)n=J.RGB5_A1}if(n===J.R16F||n===J.R32F||n===J.RG16F||n===J.RG32F||n===J.RGBA16F||n===J.RGBA32F)Q.get("EXT_color_buffer_float");return n}function P(T,I){let u;if(T){if(I===null||I===G8||I===q6)u=J.DEPTH24_STENCIL8;else if(I===$9)u=J.DEPTH32F_STENCIL8;else if(I===J7)u=J.DEPTH24_STENCIL8,C0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(I===null||I===G8||I===q6)u=J.DEPTH_COMPONENT24;else if(I===$9)u=J.DEPTH_COMPONENT32F;else if(I===J7)u=J.DEPTH_COMPONENT16;return u}function w(T,I){if(N(T)===!0||T.isFramebufferTexture&&T.minFilter!==V9&&T.minFilter!==CJ)return Math.log2(Math.max(I.width,I.height))+1;else if(T.mipmaps!==void 0&&T.mipmaps.length>0)return T.mipmaps.length;else if(T.isCompressedTexture&&Array.isArray(T.image))return I.mipmaps.length;else return 1}function B(T){let I=T.target;if(I.removeEventListener("dispose",B),V(I),I.isVideoTexture)G.delete(I);if(I.isHTMLTexture)F.delete(I)}function D(T){let I=T.target;I.removeEventListener("dispose",D),z(I)}function V(T){let I=Z.get(T);if(I.__webglInit===void 0)return;let u=T.source,r=O.get(u);if(r){let t=r[I.__cacheKey];if(t.usedTimes--,t.usedTimes===0)j(T);if(Object.keys(r).length===0)O.delete(u)}Z.remove(T)}function j(T){let I=Z.get(T);J.deleteTexture(I.__webglTexture);let u=T.source,r=O.get(u);delete r[I.__cacheKey],X.memory.textures--}function z(T){let I=Z.get(T);if(T.depthTexture)T.depthTexture.dispose(),Z.remove(T.depthTexture);if(T.isWebGLCubeRenderTarget)for(let r=0;r<6;r++){if(Array.isArray(I.__webglFramebuffer[r]))for(let t=0;t<I.__webglFramebuffer[r].length;t++)J.deleteFramebuffer(I.__webglFramebuffer[r][t]);else J.deleteFramebuffer(I.__webglFramebuffer[r]);if(I.__webglDepthbuffer)J.deleteRenderbuffer(I.__webglDepthbuffer[r])}else{if(Array.isArray(I.__webglFramebuffer))for(let r=0;r<I.__webglFramebuffer.length;r++)J.deleteFramebuffer(I.__webglFramebuffer[r]);else J.deleteFramebuffer(I.__webglFramebuffer);if(I.__webglDepthbuffer)J.deleteRenderbuffer(I.__webglDepthbuffer);if(I.__webglMultisampledFramebuffer)J.deleteFramebuffer(I.__webglMultisampledFramebuffer);if(I.__webglColorRenderbuffer){for(let r=0;r<I.__webglColorRenderbuffer.length;r++)if(I.__webglColorRenderbuffer[r])J.deleteRenderbuffer(I.__webglColorRenderbuffer[r])}if(I.__webglDepthRenderbuffer)J.deleteRenderbuffer(I.__webglDepthRenderbuffer)}let u=T.textures;for(let r=0,t=u.length;r<t;r++){let $0=Z.get(u[r]);if($0.__webglTexture)J.deleteTexture($0.__webglTexture),X.memory.textures--;Z.remove(u[r])}Z.remove(T)}let v=0;function y(){v=0}function A(){return v}function x(T){v=T}function b(){let T=v;if(T>=W.maxTextures)C0("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+W.maxTextures);return v+=1,T}function p(T){let I=[];return I.push(T.wrapS),I.push(T.wrapT),I.push(T.wrapR||0),I.push(T.magFilter),I.push(T.minFilter),I.push(T.anisotropy),I.push(T.internalFormat),I.push(T.format),I.push(T.type),I.push(T.generateMipmaps),I.push(T.premultiplyAlpha),I.push(T.flipY),I.push(T.unpackAlignment),I.push(T.colorSpace),I.join()}function c(T,I){let u=Z.get(T);if(T.isVideoTexture)R0(T);if(T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&u.__version!==T.version){let r=T.image;if(r===null)C0("WebGLRenderer: Texture marked for update but no image data found.");else if(r.complete===!1)C0("WebGLRenderer: Texture marked for update but image is incomplete");else{_0(u,T,I);return}}else if(T.isExternalTexture)u.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,u.__webglTexture,J.TEXTURE0+I)}function o(T,I){let u=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&u.__version!==T.version){_0(u,T,I);return}else if(T.isExternalTexture)u.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,u.__webglTexture,J.TEXTURE0+I)}function Q0(T,I){let u=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&u.__version!==T.version){_0(u,T,I);return}$.bindTexture(J.TEXTURE_3D,u.__webglTexture,J.TEXTURE0+I)}function Y0(T,I){let u=Z.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&u.__version!==T.version){i0(u,T,I);return}$.bindTexture(J.TEXTURE_CUBE_MAP,u.__webglTexture,J.TEXTURE0+I)}let J0={[U8]:J.REPEAT,[N6]:J.CLAMP_TO_EDGE,[YQ]:J.MIRRORED_REPEAT},x0={[V9]:J.NEAREST,[XQ]:J.NEAREST_MIPMAP_NEAREST,[S8]:J.NEAREST_MIPMAP_LINEAR,[CJ]:J.LINEAR,[O6]:J.LINEAR_MIPMAP_NEAREST,[S9]:J.LINEAR_MIPMAP_LINEAR},v0={[YX]:J.NEVER,[GX]:J.ALWAYS,[XX]:J.LESS,[OQ]:J.LEQUAL,[KX]:J.EQUAL,[qQ]:J.GEQUAL,[HX]:J.GREATER,[UX]:J.NOTEQUAL};function s(T,I){if(I.type===$9&&Q.has("OES_texture_float_linear")===!1&&(I.magFilter===CJ||I.magFilter===O6||I.magFilter===S8||I.magFilter===S9||I.minFilter===CJ||I.minFilter===O6||I.minFilter===S8||I.minFilter===S9))C0("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(J.texParameteri(T,J.TEXTURE_WRAP_S,J0[I.wrapS]),J.texParameteri(T,J.TEXTURE_WRAP_T,J0[I.wrapT]),T===J.TEXTURE_3D||T===J.TEXTURE_2D_ARRAY)J.texParameteri(T,J.TEXTURE_WRAP_R,J0[I.wrapR]);if(J.texParameteri(T,J.TEXTURE_MAG_FILTER,x0[I.magFilter]),J.texParameteri(T,J.TEXTURE_MIN_FILTER,x0[I.minFilter]),I.compareFunction)J.texParameteri(T,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(T,J.TEXTURE_COMPARE_FUNC,v0[I.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(I.magFilter===V9)return;if(I.minFilter!==S8&&I.minFilter!==S9)return;if(I.type===$9&&Q.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||Z.get(I).__currentAnisotropy){let u=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(T,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,W.getMaxAnisotropy())),Z.get(I).__currentAnisotropy=I.anisotropy}}}function K0(T,I){let u=!1;if(T.__webglInit===void 0)T.__webglInit=!0,I.addEventListener("dispose",B);let r=I.source,t=O.get(r);if(t===void 0)t={},O.set(r,t);let $0=p(I);if($0!==T.__cacheKey){if(t[$0]===void 0)t[$0]={texture:J.createTexture(),usedTimes:0},X.memory.textures++,u=!0;t[$0].usedTimes++;let F0=t[T.__cacheKey];if(F0!==void 0){if(t[T.__cacheKey].usedTimes--,F0.usedTimes===0)j(I)}T.__cacheKey=$0,T.__webglTexture=t[$0].texture}return u}function D0(T,I,u){return Math.floor(Math.floor(T/u)/I)}function E0(T,I,u,r){let $0=T.updateRanges;if($0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,I.width,I.height,u,r,I.data);else{$0.sort((V0,W0)=>V0.start-W0.start);let F0=0;for(let V0=1;V0<$0.length;V0++){let W0=$0[F0],N0=$0[V0],b0=W0.start+W0.count,p0=D0(N0.start,I.width,4),n0=D0(W0.start,I.width,4);if(N0.start<=b0+1&&p0===n0&&D0(N0.start+N0.count-1,I.width,4)===p0)W0.count=Math.max(W0.count,N0.start+N0.count-W0.start);else++F0,$0[F0]=N0}$0.length=F0+1;let n=$.getParameter(J.UNPACK_ROW_LENGTH),a=$.getParameter(J.UNPACK_SKIP_PIXELS),U0=$.getParameter(J.UNPACK_SKIP_ROWS);$.pixelStorei(J.UNPACK_ROW_LENGTH,I.width);for(let V0=0,W0=$0.length;V0<W0;V0++){let N0=$0[V0],b0=Math.floor(N0.start/4),p0=Math.ceil(N0.count/4),n0=b0%I.width,h=Math.floor(b0/I.width),H0=p0,i=1;$.pixelStorei(J.UNPACK_SKIP_PIXELS,n0),$.pixelStorei(J.UNPACK_SKIP_ROWS,h),$.texSubImage2D(J.TEXTURE_2D,0,n0,h,H0,1,u,r,I.data)}T.clearUpdateRanges(),$.pixelStorei(J.UNPACK_ROW_LENGTH,n),$.pixelStorei(J.UNPACK_SKIP_PIXELS,a),$.pixelStorei(J.UNPACK_SKIP_ROWS,U0)}}function _0(T,I,u){let r=J.TEXTURE_2D;if(I.isDataArrayTexture||I.isCompressedArrayTexture)r=J.TEXTURE_2D_ARRAY;if(I.isData3DTexture)r=J.TEXTURE_3D;let t=K0(T,I),$0=I.source;$.bindTexture(r,T.__webglTexture,J.TEXTURE0+u);let F0=Z.get($0);if($0.version!==F0.__version||t===!0){if($.activeTexture(J.TEXTURE0+u),(typeof ImageBitmap<"u"&&I.image instanceof ImageBitmap)===!1){let i=u0.getPrimaries(u0.workingColorSpace),Z0=I.colorSpace===x8?null:u0.getPrimaries(I.colorSpace),B0=I.colorSpace===x8||i===Z0?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,I.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,B0)}$.pixelStorei(J.UNPACK_ALIGNMENT,I.unpackAlignment);let a=q(I.image,!1,W.maxTextureSize);a=LJ(I,a);let U0=Y.convert(I.format,I.colorSpace),V0=Y.convert(I.type),W0=M(I.internalFormat,U0,V0,I.normalized,I.colorSpace,I.isVideoTexture);s(r,I);let N0,b0=I.mipmaps,p0=I.isVideoTexture!==!0,n0=F0.__version===void 0||t===!0,h=$0.dataReady,H0=w(I,a);if(I.isDepthTexture){if(W0=P(I.format===v8,I.type),n0)if(p0)$.texStorage2D(J.TEXTURE_2D,1,W0,a.width,a.height);else $.texImage2D(J.TEXTURE_2D,0,W0,a.width,a.height,0,U0,V0,null)}else if(I.isDataTexture)if(b0.length>0){if(p0&&n0)$.texStorage2D(J.TEXTURE_2D,H0,W0,b0[0].width,b0[0].height);for(let i=0,Z0=b0.length;i<Z0;i++)if(N0=b0[i],p0){if(h)$.texSubImage2D(J.TEXTURE_2D,i,0,0,N0.width,N0.height,U0,V0,N0.data)}else $.texImage2D(J.TEXTURE_2D,i,W0,N0.width,N0.height,0,U0,V0,N0.data);I.generateMipmaps=!1}else if(p0){if(n0)$.texStorage2D(J.TEXTURE_2D,H0,W0,a.width,a.height);if(h)E0(I,a,U0,V0)}else $.texImage2D(J.TEXTURE_2D,0,W0,a.width,a.height,0,U0,V0,a.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){if(p0&&n0)$.texStorage3D(J.TEXTURE_2D_ARRAY,H0,W0,b0[0].width,b0[0].height,a.depth);for(let i=0,Z0=b0.length;i<Z0;i++)if(N0=b0[i],I.format!==j9)if(U0!==null)if(p0){if(h)if(I.layerUpdates.size>0){let B0=lZ(N0.width,N0.height,I.format,I.type);for(let e of I.layerUpdates){let z0=N0.data.subarray(e*B0/N0.data.BYTES_PER_ELEMENT,(e+1)*B0/N0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,e,N0.width,N0.height,1,U0,z0)}I.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,N0.width,N0.height,a.depth,U0,N0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,i,W0,N0.width,N0.height,a.depth,0,N0.data,0,0);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(p0){if(h)$.texSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,N0.width,N0.height,a.depth,U0,V0,N0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,i,W0,N0.width,N0.height,a.depth,0,U0,V0,N0.data)}else{if(p0&&n0)$.texStorage2D(J.TEXTURE_2D,H0,W0,b0[0].width,b0[0].height);for(let i=0,Z0=b0.length;i<Z0;i++)if(N0=b0[i],I.format!==j9)if(U0!==null)if(p0){if(h)$.compressedTexSubImage2D(J.TEXTURE_2D,i,0,0,N0.width,N0.height,U0,N0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,i,W0,N0.width,N0.height,0,N0.data);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(p0){if(h)$.texSubImage2D(J.TEXTURE_2D,i,0,0,N0.width,N0.height,U0,V0,N0.data)}else $.texImage2D(J.TEXTURE_2D,i,W0,N0.width,N0.height,0,U0,V0,N0.data)}else if(I.isDataArrayTexture)if(p0){if(n0)$.texStorage3D(J.TEXTURE_2D_ARRAY,H0,W0,a.width,a.height,a.depth);if(h)if(I.layerUpdates.size>0){let i=lZ(a.width,a.height,I.format,I.type);for(let Z0 of I.layerUpdates){let B0=a.data.subarray(Z0*i/a.data.BYTES_PER_ELEMENT,(Z0+1)*i/a.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,Z0,a.width,a.height,1,U0,V0,B0)}I.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,a.width,a.height,a.depth,U0,V0,a.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,W0,a.width,a.height,a.depth,0,U0,V0,a.data);else if(I.isData3DTexture)if(p0){if(n0)$.texStorage3D(J.TEXTURE_3D,H0,W0,a.width,a.height,a.depth);if(h)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,a.width,a.height,a.depth,U0,V0,a.data)}else $.texImage3D(J.TEXTURE_3D,0,W0,a.width,a.height,a.depth,0,U0,V0,a.data);else if(I.isFramebufferTexture){if(n0)if(p0)$.texStorage2D(J.TEXTURE_2D,H0,W0,a.width,a.height);else{let{width:i,height:Z0}=a;for(let B0=0;B0<H0;B0++)$.texImage2D(J.TEXTURE_2D,B0,W0,i,Z0,0,U0,V0,null),i>>=1,Z0>>=1}}else if(I.isHTMLTexture){if("texElementImage2D"in J){let i=J.canvas;if(!i.hasAttribute("layoutsubtree"))i.setAttribute("layoutsubtree","true");if(a.parentNode!==i){i.appendChild(a),F.add(I),i.onpaint=(f0)=>{let _J=f0.changedElements;for(let XJ of F)if(_J.includes(XJ.image))XJ.needsUpdate=!0},i.requestPaint();return}let Z0=0,B0=J.RGBA,e=J.RGBA,z0=J.UNSIGNED_BYTE;J.texElementImage2D(J.TEXTURE_2D,Z0,B0,e,z0,a),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_MIN_FILTER,J.LINEAR),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_S,J.CLAMP_TO_EDGE),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_T,J.CLAMP_TO_EDGE)}}else if(b0.length>0){if(p0&&n0){let i=A0(b0[0]);$.texStorage2D(J.TEXTURE_2D,H0,W0,i.width,i.height)}for(let i=0,Z0=b0.length;i<Z0;i++)if(N0=b0[i],p0){if(h)$.texSubImage2D(J.TEXTURE_2D,i,0,0,U0,V0,N0)}else $.texImage2D(J.TEXTURE_2D,i,W0,U0,V0,N0);I.generateMipmaps=!1}else if(p0){if(n0){let i=A0(a);$.texStorage2D(J.TEXTURE_2D,H0,W0,i.width,i.height)}if(h)$.texSubImage2D(J.TEXTURE_2D,0,0,0,U0,V0,a)}else $.texImage2D(J.TEXTURE_2D,0,W0,U0,V0,a);if(N(I))L(r);if(F0.__version=$0.version,I.onUpdate)I.onUpdate(I)}T.__version=I.version}function i0(T,I,u){if(I.image.length!==6)return;let r=K0(T,I),t=I.source;$.bindTexture(J.TEXTURE_CUBE_MAP,T.__webglTexture,J.TEXTURE0+u);let $0=Z.get(t);if(t.version!==$0.__version||r===!0){$.activeTexture(J.TEXTURE0+u);let F0=u0.getPrimaries(u0.workingColorSpace),n=I.colorSpace===x8?null:u0.getPrimaries(I.colorSpace),a=I.colorSpace===x8||F0===n?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,I.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),$.pixelStorei(J.UNPACK_ALIGNMENT,I.unpackAlignment),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,a);let U0=I.isCompressedTexture||I.image[0].isCompressedTexture,V0=I.image[0]&&I.image[0].isDataTexture,W0=[];for(let e=0;e<6;e++){if(!U0&&!V0)W0[e]=q(I.image[e],!0,W.maxCubemapSize);else W0[e]=V0?I.image[e].image:I.image[e];W0[e]=LJ(I,W0[e])}let N0=W0[0],b0=Y.convert(I.format,I.colorSpace),p0=Y.convert(I.type),n0=M(I.internalFormat,b0,p0,I.normalized,I.colorSpace),h=I.isVideoTexture!==!0,H0=$0.__version===void 0||r===!0,i=t.dataReady,Z0=w(I,N0);s(J.TEXTURE_CUBE_MAP,I);let B0;if(U0){if(h&&H0)$.texStorage2D(J.TEXTURE_CUBE_MAP,Z0,n0,N0.width,N0.height);for(let e=0;e<6;e++){B0=W0[e].mipmaps;for(let z0=0;z0<B0.length;z0++){let f0=B0[z0];if(I.format!==j9)if(b0!==null)if(h){if(i)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,0,0,f0.width,f0.height,b0,f0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,n0,f0.width,f0.height,0,f0.data);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(h){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,0,0,f0.width,f0.height,b0,p0,f0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,n0,f0.width,f0.height,0,b0,p0,f0.data)}}}else{if(B0=I.mipmaps,h&&H0){if(B0.length>0)Z0++;let e=A0(W0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,Z0,n0,e.width,e.height)}for(let e=0;e<6;e++)if(V0){if(h){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,W0[e].width,W0[e].height,b0,p0,W0[e].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n0,W0[e].width,W0[e].height,0,b0,p0,W0[e].data);for(let z0=0;z0<B0.length;z0++){let _J=B0[z0].image[e].image;if(h){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,0,0,_J.width,_J.height,b0,p0,_J.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,n0,_J.width,_J.height,0,b0,p0,_J.data)}}else{if(h){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,b0,p0,W0[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n0,b0,p0,W0[e]);for(let z0=0;z0<B0.length;z0++){let f0=B0[z0];if(h){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,0,0,b0,p0,f0.image[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,n0,b0,p0,f0.image[e])}}}if(N(I))L(J.TEXTURE_CUBE_MAP);if($0.__version=t.version,I.onUpdate)I.onUpdate(I)}T.__version=I.version}function y0(T,I,u,r,t,$0){let F0=Y.convert(u.format,u.colorSpace),n=Y.convert(u.type),a=M(u.internalFormat,F0,n,u.normalized,u.colorSpace),U0=Z.get(I),V0=Z.get(u);if(V0.__renderTarget=I,!U0.__hasExternalTextures){let W0=Math.max(1,I.width>>$0),N0=Math.max(1,I.height>>$0);if(t===J.TEXTURE_3D||t===J.TEXTURE_2D_ARRAY)$.texImage3D(t,$0,a,W0,N0,I.depth,0,F0,n,null);else $.texImage2D(t,$0,a,W0,N0,0,F0,n,null)}if($.bindFramebuffer(J.FRAMEBUFFER,T),e0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,r,t,V0.__webglTexture,0,r0(I));else if(t===J.TEXTURE_2D||t>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&t<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,r,t,V0.__webglTexture,$0);$.bindFramebuffer(J.FRAMEBUFFER,null)}function d0(T,I,u){if(J.bindRenderbuffer(J.RENDERBUFFER,T),I.depthBuffer){let r=I.depthTexture,t=r&&r.isDepthTexture?r.type:null,$0=P(I.stencilBuffer,t),F0=I.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(e0(I))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,r0(I),$0,I.width,I.height);else if(u)J.renderbufferStorageMultisample(J.RENDERBUFFER,r0(I),$0,I.width,I.height);else J.renderbufferStorage(J.RENDERBUFFER,$0,I.width,I.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,F0,J.RENDERBUFFER,T)}else{let r=I.textures;for(let t=0;t<r.length;t++){let $0=r[t],F0=Y.convert($0.format,$0.colorSpace),n=Y.convert($0.type),a=M($0.internalFormat,F0,n,$0.normalized,$0.colorSpace);if(e0(I))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,r0(I),a,I.width,I.height);else if(u)J.renderbufferStorageMultisample(J.RENDERBUFFER,r0(I),a,I.width,I.height);else J.renderbufferStorage(J.RENDERBUFFER,a,I.width,I.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function UJ(T,I,u){let r=I.isWebGLCubeRenderTarget===!0;if($.bindFramebuffer(J.FRAMEBUFFER,T),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let t=Z.get(I.depthTexture);if(t.__renderTarget=I,!t.__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;if(r){if(t.__webglInit===void 0)t.__webglInit=!0,I.depthTexture.addEventListener("dispose",B);if(t.__webglTexture===void 0){t.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,t.__webglTexture),s(J.TEXTURE_CUBE_MAP,I.depthTexture);let U0=Y.convert(I.depthTexture.format),V0=Y.convert(I.depthTexture.type),W0;if(I.depthTexture.format===j8)W0=J.DEPTH_COMPONENT24;else if(I.depthTexture.format===v8)W0=J.DEPTH24_STENCIL8;for(let N0=0;N0<6;N0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+N0,0,W0,I.width,I.height,0,U0,V0,null)}}else c(I.depthTexture,0);let $0=t.__webglTexture,F0=r0(I),n=r?J.TEXTURE_CUBE_MAP_POSITIVE_X+u:J.TEXTURE_2D,a=I.depthTexture.format===v8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(I.depthTexture.format===j8)if(e0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,a,n,$0,0,F0);else J.framebufferTexture2D(J.FRAMEBUFFER,a,n,$0,0);else if(I.depthTexture.format===v8)if(e0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,a,n,$0,0,F0);else J.framebufferTexture2D(J.FRAMEBUFFER,a,n,$0,0);else throw Error("Unknown depthTexture format")}function GJ(T){let I=Z.get(T),u=T.isWebGLCubeRenderTarget===!0;if(I.__boundDepthTexture!==T.depthTexture){let r=T.depthTexture;if(I.__depthDisposeCallback)I.__depthDisposeCallback();if(r){let t=()=>{delete I.__boundDepthTexture,delete I.__depthDisposeCallback,r.removeEventListener("dispose",t)};r.addEventListener("dispose",t),I.__depthDisposeCallback=t}I.__boundDepthTexture=r}if(T.depthTexture&&!I.__autoAllocateDepthBuffer)if(u)for(let r=0;r<6;r++)UJ(I.__webglFramebuffer[r],T,r);else{let r=T.texture.mipmaps;if(r&&r.length>0)UJ(I.__webglFramebuffer[0],T,0);else UJ(I.__webglFramebuffer,T,0)}else if(u){I.__webglDepthbuffer=[];for(let r=0;r<6;r++)if($.bindFramebuffer(J.FRAMEBUFFER,I.__webglFramebuffer[r]),I.__webglDepthbuffer[r]===void 0)I.__webglDepthbuffer[r]=J.createRenderbuffer(),d0(I.__webglDepthbuffer[r],T,!1);else{let t=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,$0=I.__webglDepthbuffer[r];J.bindRenderbuffer(J.RENDERBUFFER,$0),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,$0)}}else{let r=T.texture.mipmaps;if(r&&r.length>0)$.bindFramebuffer(J.FRAMEBUFFER,I.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,I.__webglFramebuffer);if(I.__webglDepthbuffer===void 0)I.__webglDepthbuffer=J.createRenderbuffer(),d0(I.__webglDepthbuffer,T,!1);else{let t=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,$0=I.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,$0),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,$0)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function m0(T,I,u){let r=Z.get(T);if(I!==void 0)y0(r.__webglFramebuffer,T,T.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(u!==void 0)GJ(T)}function xJ(T){let I=T.texture,u=Z.get(T),r=Z.get(I);T.addEventListener("dispose",D);let t=T.textures,$0=T.isWebGLCubeRenderTarget===!0,F0=t.length>1;if(!F0){if(r.__webglTexture===void 0)r.__webglTexture=J.createTexture();r.__version=I.version,X.memory.textures++}if($0){u.__webglFramebuffer=[];for(let n=0;n<6;n++)if(I.mipmaps&&I.mipmaps.length>0){u.__webglFramebuffer[n]=[];for(let a=0;a<I.mipmaps.length;a++)u.__webglFramebuffer[n][a]=J.createFramebuffer()}else u.__webglFramebuffer[n]=J.createFramebuffer()}else{if(I.mipmaps&&I.mipmaps.length>0){u.__webglFramebuffer=[];for(let n=0;n<I.mipmaps.length;n++)u.__webglFramebuffer[n]=J.createFramebuffer()}else u.__webglFramebuffer=J.createFramebuffer();if(F0)for(let n=0,a=t.length;n<a;n++){let U0=Z.get(t[n]);if(U0.__webglTexture===void 0)U0.__webglTexture=J.createTexture(),X.memory.textures++}if(T.samples>0&&e0(T)===!1){u.__webglMultisampledFramebuffer=J.createFramebuffer(),u.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,u.__webglMultisampledFramebuffer);for(let n=0;n<t.length;n++){let a=t[n];u.__webglColorRenderbuffer[n]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,u.__webglColorRenderbuffer[n]);let U0=Y.convert(a.format,a.colorSpace),V0=Y.convert(a.type),W0=M(a.internalFormat,U0,V0,a.normalized,a.colorSpace,T.isXRRenderTarget===!0),N0=r0(T);J.renderbufferStorageMultisample(J.RENDERBUFFER,N0,W0,T.width,T.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+n,J.RENDERBUFFER,u.__webglColorRenderbuffer[n])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),T.depthBuffer)u.__webglDepthRenderbuffer=J.createRenderbuffer(),d0(u.__webglDepthRenderbuffer,T,!0);$.bindFramebuffer(J.FRAMEBUFFER,null)}}if($0){$.bindTexture(J.TEXTURE_CUBE_MAP,r.__webglTexture),s(J.TEXTURE_CUBE_MAP,I);for(let n=0;n<6;n++)if(I.mipmaps&&I.mipmaps.length>0)for(let a=0;a<I.mipmaps.length;a++)y0(u.__webglFramebuffer[n][a],T,I,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,a);else y0(u.__webglFramebuffer[n],T,I,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);if(N(I))L(J.TEXTURE_CUBE_MAP);$.unbindTexture()}else if(F0){for(let n=0,a=t.length;n<a;n++){let U0=t[n],V0=Z.get(U0),W0=J.TEXTURE_2D;if(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)W0=T.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(W0,V0.__webglTexture),s(W0,U0),y0(u.__webglFramebuffer,T,U0,J.COLOR_ATTACHMENT0+n,W0,0),N(U0))L(W0)}$.unbindTexture()}else{let n=J.TEXTURE_2D;if(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)n=T.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(n,r.__webglTexture),s(n,I),I.mipmaps&&I.mipmaps.length>0)for(let a=0;a<I.mipmaps.length;a++)y0(u.__webglFramebuffer[a],T,I,J.COLOR_ATTACHMENT0,n,a);else y0(u.__webglFramebuffer,T,I,J.COLOR_ATTACHMENT0,n,0);if(N(I))L(n);$.unbindTexture()}if(T.depthBuffer)GJ(T)}function bJ(T){let I=T.textures;for(let u=0,r=I.length;u<r;u++){let t=I[u];if(N(t)){let $0=k(T),F0=Z.get(t).__webglTexture;$.bindTexture($0,F0),L($0),$.unbindTexture()}}}let zJ=[],f=[];function uJ(T){if(T.samples>0){if(e0(T)===!1){let{textures:I,width:u,height:r}=T,t=J.COLOR_BUFFER_BIT,$0=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,F0=Z.get(T),n=I.length>1;if(n)for(let U0=0;U0<I.length;U0++)$.bindFramebuffer(J.FRAMEBUFFER,F0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+U0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,F0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+U0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,F0.__webglMultisampledFramebuffer);let a=T.texture.mipmaps;if(a&&a.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,F0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,F0.__webglFramebuffer);for(let U0=0;U0<I.length;U0++){if(T.resolveDepthBuffer){if(T.depthBuffer)t|=J.DEPTH_BUFFER_BIT;if(T.stencilBuffer&&T.resolveStencilBuffer)t|=J.STENCIL_BUFFER_BIT}if(n){J.framebufferRenderbuffer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.RENDERBUFFER,F0.__webglColorRenderbuffer[U0]);let V0=Z.get(I[U0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,V0,0)}if(J.blitFramebuffer(0,0,u,r,0,0,u,r,t,J.NEAREST),H===!0){if(zJ.length=0,f.length=0,zJ.push(J.COLOR_ATTACHMENT0+U0),T.depthBuffer&&T.resolveDepthBuffer===!1)zJ.push($0),f.push($0),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,f);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,zJ)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),n)for(let U0=0;U0<I.length;U0++){$.bindFramebuffer(J.FRAMEBUFFER,F0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+U0,J.RENDERBUFFER,F0.__webglColorRenderbuffer[U0]);let V0=Z.get(I[U0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,F0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+U0,J.TEXTURE_2D,V0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,F0.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&H){let I=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,[I])}}}function r0(T){return Math.min(W.maxSamples,T.samples)}function e0(T){let I=Z.get(T);return T.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function R0(T){let I=X.render.frame;if(G.get(T)!==I)G.set(T,I),T.update()}function LJ(T,I){let{colorSpace:u,format:r,type:t}=T;if(T.isCompressedTexture===!0||T.isVideoTexture===!0)return I;if(u!==mJ&&u!==x8)if(u0.getTransfer(u)===YJ){if(r!==j9||t!==B9)C0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else S0("WebGLTextures: Unsupported texture color space:",u);return I}function A0(T){if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement)U.width=T.naturalWidth||T.width,U.height=T.naturalHeight||T.height;else if(typeof VideoFrame<"u"&&T instanceof VideoFrame)U.width=T.displayWidth,U.height=T.displayHeight;else U.width=T.width,U.height=T.height;return U}this.allocateTextureUnit=b,this.resetTextureUnits=y,this.getTextureUnits=A,this.setTextureUnits=x,this.setTexture2D=c,this.setTexture2DArray=o,this.setTexture3D=Q0,this.setTextureCube=Y0,this.rebindTextures=m0,this.setupRenderTarget=xJ,this.updateRenderTargetMipmap=bJ,this.updateMultisampleRenderTarget=uJ,this.setupDepthRenderbuffer=GJ,this.setupFrameBufferTexture=y0,this.useMultisampledRTT=e0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function FF(J,Q){function $(Z,W=x8){let Y,X=u0.getTransfer(W);if(Z===B9)return J.UNSIGNED_BYTE;if(Z===y$)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===x$)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===eY)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===JX)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===rY)return J.BYTE;if(Z===tY)return J.SHORT;if(Z===J7)return J.UNSIGNED_SHORT;if(Z===v$)return J.INT;if(Z===G8)return J.UNSIGNED_INT;if(Z===$9)return J.FLOAT;if(Z===kJ)return J.HALF_FLOAT;if(Z===QX)return J.ALPHA;if(Z===$X)return J.RGB;if(Z===j9)return J.RGBA;if(Z===j8)return J.DEPTH_COMPONENT;if(Z===v8)return J.DEPTH_STENCIL;if(Z===ZX)return J.RED;if(Z===b$)return J.RED_INTEGER;if(Z===y8)return J.RG;if(Z===h$)return J.RG_INTEGER;if(Z===f$)return J.RGBA_INTEGER;if(Z===KQ||Z===HQ||Z===UQ||Z===GQ)if(X===YJ)if(Y=Q.get("WEBGL_compressed_texture_s3tc_srgb"),Y!==null){if(Z===KQ)return Y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===HQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===UQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===GQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(Y=Q.get("WEBGL_compressed_texture_s3tc"),Y!==null){if(Z===KQ)return Y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===HQ)return Y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===UQ)return Y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===GQ)return Y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===g$||Z===p$||Z===u$||Z===d$)if(Y=Q.get("WEBGL_compressed_texture_pvrtc"),Y!==null){if(Z===g$)return Y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===p$)return Y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===u$)return Y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===d$)return Y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===m$||Z===l$||Z===c$||Z===n$||Z===s$||Z===EQ||Z===i$)if(Y=Q.get("WEBGL_compressed_texture_etc"),Y!==null){if(Z===m$||Z===l$)return X===YJ?Y.COMPRESSED_SRGB8_ETC2:Y.COMPRESSED_RGB8_ETC2;if(Z===c$)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:Y.COMPRESSED_RGBA8_ETC2_EAC;if(Z===n$)return Y.COMPRESSED_R11_EAC;if(Z===s$)return Y.COMPRESSED_SIGNED_R11_EAC;if(Z===EQ)return Y.COMPRESSED_RG11_EAC;if(Z===i$)return Y.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===o$||Z===a$||Z===r$||Z===t$||Z===e$||Z===JZ||Z===QZ||Z===$Z||Z===ZZ||Z===WZ||Z===YZ||Z===XZ||Z===KZ||Z===HZ)if(Y=Q.get("WEBGL_compressed_texture_astc"),Y!==null){if(Z===o$)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:Y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===a$)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:Y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===r$)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:Y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===t$)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:Y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===e$)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:Y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===JZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:Y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===QZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:Y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===$Z)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:Y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===ZZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:Y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===WZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:Y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===YZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:Y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===XZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:Y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===KZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:Y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===HZ)return X===YJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:Y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===UZ||Z===GZ||Z===EZ)if(Y=Q.get("EXT_texture_compression_bptc"),Y!==null){if(Z===UZ)return X===YJ?Y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:Y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===GZ)return Y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===EZ)return Y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===FZ||Z===NZ||Z===FQ||Z===OZ)if(Y=Q.get("EXT_texture_compression_rgtc"),Y!==null){if(Z===FZ)return Y.COMPRESSED_RED_RGTC1_EXT;if(Z===NZ)return Y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===FQ)return Y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===OZ)return Y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===q6)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}var NF=`
4080
+ }`,YD=[new A(1,0,0),new A(-1,0,0),new A(0,1,0),new A(0,-1,0),new A(0,0,1),new A(0,0,-1)],XD=[new A(0,-1,0),new A(0,-1,0),new A(0,0,1),new A(0,0,-1),new A(0,-1,0),new A(0,-1,0)],s5=new y0,k$=new A,KH=new A;function KD(J,Q,$){let Z=new G8,W=new i,Y=new i,X=new FJ,K=new H$,H=new U$,U={},G=$.maxTextureSize,F={[s9]:uJ,[uJ]:s9,[X9]:X9},E=new LJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new i},radius:{value:4}},vertexShader:ZD,fragmentShader:WD}),O=E.clone();O.defines.HORIZONTAL_PASS=1;let R=new u0;R.setAttribute("position",new i0(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let M=new a0(R,E),q=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=I7;let N=this.type;this.render=function(I,B,k){if(q.enabled===!1)return;if(q.autoUpdate===!1&&q.needsUpdate===!1)return;if(I.length===0)return;if(this.type===KX)O0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=I7;let C=J.getRenderTarget(),j=J.getActiveCubeFace(),w=J.getActiveMipmapLevel(),v=J.state;if(v.setBlending(V9),v.buffers.depth.getReversed()===!0)v.buffers.color.setClear(0,0,0,0);else v.buffers.color.setClear(1,1,1,1);v.buffers.depth.setTest(!0),v.setScissorTest(!1);let b=N!==this.type;if(b)B.traverse(function(S){if(S.material)if(Array.isArray(S.material))S.material.forEach((h)=>h.needsUpdate=!0);else S.material.needsUpdate=!0});for(let S=0,h=I.length;S<h;S++){let x=I[S],p=x.shadow;if(p===void 0){O0("WebGLShadowMap:",x,"has no shadow.");continue}if(p.autoUpdate===!1&&p.needsUpdate===!1)continue;W.copy(p.mapSize);let c=p.getFrameExtents();if(W.multiply(c),Y.copy(p.mapSize),W.x>G||W.y>G){if(W.x>G)Y.x=Math.floor(G/c.x),W.x=Y.x*c.x,p.mapSize.x=Y.x;if(W.y>G)Y.y=Math.floor(G/c.y),W.y=Y.y*c.y,p.mapSize.y=Y.y}let o=J.state.buffers.depth.getReversed();if(p.camera._reversedDepth=o,p.map===null||b===!0){if(p.map!==null){if(p.map.depthTexture!==null)p.map.depthTexture.dispose(),p.map.depthTexture=null;p.map.dispose()}if(this.type===I6){if(x.isPointLight){O0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}p.map=new PJ(W.x,W.y,{format:r8,type:wJ,minFilter:jJ,magFilter:jJ,generateMipmaps:!1}),p.map.texture.name=x.name+".shadowMap",p.map.depthTexture=new A8(W.x,W.y,N9),p.map.depthTexture.name=x.name+".shadowMapDepth",p.map.depthTexture.format=o8,p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=S9,p.map.depthTexture.magFilter=S9}else{if(x.isPointLight)p.map=new tW(W.x),p.map.depthTexture=new kW(W.x,w8);else p.map=new PJ(W.x,W.y),p.map.depthTexture=new A8(W.x,W.y,w8);if(p.map.depthTexture.name=x.name+".shadowMap",p.map.depthTexture.format=o8,this.type===I7)p.map.depthTexture.compareFunction=o?hQ:bQ,p.map.depthTexture.minFilter=jJ,p.map.depthTexture.magFilter=jJ;else p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=S9,p.map.depthTexture.magFilter=S9}p.camera.updateProjectionMatrix()}let W0=p.map.isWebGLCubeRenderTarget?6:1;for(let H0=0;H0<W0;H0++){if(p.map.isWebGLCubeRenderTarget)J.setRenderTarget(p.map,H0),J.clear();else{if(H0===0)J.setRenderTarget(p.map),J.clear();let J0=p.getViewport(H0);X.set(Y.x*J0.x,Y.y*J0.y,Y.x*J0.z,Y.y*J0.w),v.viewport(X)}if(x.isPointLight){let{camera:J0,matrix:c0}=p,d0=x.distance||J0.far;if(d0!==J0.far)J0.far=d0,J0.updateProjectionMatrix();k$.setFromMatrixPosition(x.matrixWorld),J0.position.copy(k$),KH.copy(J0.position),KH.add(YD[H0]),J0.up.copy(XD[H0]),J0.lookAt(KH),J0.updateMatrixWorld(),c0.makeTranslation(-k$.x,-k$.y,-k$.z),s5.multiplyMatrices(J0.projectionMatrix,J0.matrixWorldInverse),p._frustum.setFromProjectionMatrix(s5,J0.coordinateSystem,J0.reversedDepth)}else p.updateMatrices(x);Z=p.getFrustum(),V(B,k,p.camera,x,this.type)}if(p.isPointLightShadow!==!0&&this.type===I6)L(p,k);p.needsUpdate=!1}N=this.type,q.needsUpdate=!1,J.setRenderTarget(C,j,w)};function L(I,B){let k=Q.update(M);if(E.defines.VSM_SAMPLES!==I.blurSamples)E.defines.VSM_SAMPLES=I.blurSamples,O.defines.VSM_SAMPLES=I.blurSamples,E.needsUpdate=!0,O.needsUpdate=!0;if(I.mapPass===null)I.mapPass=new PJ(W.x,W.y,{format:r8,type:wJ});E.uniforms.shadow_pass.value=I.map.depthTexture,E.uniforms.resolution.value=I.mapSize,E.uniforms.radius.value=I.radius,J.setRenderTarget(I.mapPass),J.clear(),J.renderBufferDirect(B,null,k,E,M,null),O.uniforms.shadow_pass.value=I.mapPass.texture,O.uniforms.resolution.value=I.mapSize,O.uniforms.radius.value=I.radius,J.setRenderTarget(I.map),J.clear(),J.renderBufferDirect(B,null,k,O,M,null)}function D(I,B,k,C){let j=null,w=k.isPointLight===!0?I.customDistanceMaterial:I.customDepthMaterial;if(w!==void 0)j=w;else if(j=k.isPointLight===!0?H:K,J.localClippingEnabled&&B.clipShadows===!0&&Array.isArray(B.clippingPlanes)&&B.clippingPlanes.length!==0||B.displacementMap&&B.displacementScale!==0||B.alphaMap&&B.alphaTest>0||B.map&&B.alphaTest>0||B.alphaToCoverage===!0){let v=j.uuid,b=B.uuid,S=U[v];if(S===void 0)S={},U[v]=S;let h=S[b];if(h===void 0)h=j.clone(),S[b]=h,B.addEventListener("dispose",z);j=h}if(j.visible=B.visible,j.wireframe=B.wireframe,C===I6)j.side=B.shadowSide!==null?B.shadowSide:B.side;else j.side=B.shadowSide!==null?B.shadowSide:F[B.side];if(j.alphaMap=B.alphaMap,j.alphaTest=B.alphaToCoverage===!0?0.5:B.alphaTest,j.map=B.map,j.clipShadows=B.clipShadows,j.clippingPlanes=B.clippingPlanes,j.clipIntersection=B.clipIntersection,j.displacementMap=B.displacementMap,j.displacementScale=B.displacementScale,j.displacementBias=B.displacementBias,j.wireframeLinewidth=B.wireframeLinewidth,j.linewidth=B.linewidth,k.isPointLight===!0&&j.isMeshDistanceMaterial===!0){let v=J.properties.get(j);v.light=k}return j}function V(I,B,k,C,j){if(I.visible===!1)return;if(I.layers.test(B.layers)&&(I.isMesh||I.isLine||I.isPoints)){if((I.castShadow||I.receiveShadow&&j===I6)&&(!I.frustumCulled||Z.intersectsObject(I))){I.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,I.matrixWorld);let b=Q.update(I),S=I.material;if(Array.isArray(S)){let h=b.groups;for(let x=0,p=h.length;x<p;x++){let c=h[x],o=S[c.materialIndex];if(o&&o.visible){let W0=D(I,o,C,j);I.onBeforeShadow(J,I,B,k,b,W0,c),J.renderBufferDirect(k,null,b,W0,I,c),I.onAfterShadow(J,I,B,k,b,W0,c)}}}else if(S.visible){let h=D(I,S,C,j);I.onBeforeShadow(J,I,B,k,b,h,null),J.renderBufferDirect(k,null,b,h,I,null),I.onAfterShadow(J,I,B,k,b,h,null)}}}let v=I.children;for(let b=0,S=v.length;b<S;b++)V(v[b],B,k,C,j)}function z(I){I.target.removeEventListener("dispose",z);for(let k in U){let C=U[k],j=I.target.uuid;if(j in C)C[j].dispose(),delete C[j]}}}function HD(J,Q){function $(){let f=!1,q0=new FJ,a=null,G0=new FJ(0,0,0,0);return{setMask:function(S0){if(a!==S0&&!f)J.colorMask(S0,S0,S0,S0),a=S0},setLocked:function(S0){f=S0},setClear:function(S0,Y0,f0,e0,gJ){if(gJ===!0)S0*=e0,Y0*=e0,f0*=e0;if(q0.set(S0,Y0,f0,e0),G0.equals(q0)===!1)J.clearColor(S0,Y0,f0,e0),G0.copy(q0)},reset:function(){f=!1,a=null,G0.set(-1,0,0,0)}}}function Z(){let f=!1,q0=!1,a=null,G0=null,S0=null;return{setReversed:function(Y0){if(q0!==Y0){let f0=Q.get("EXT_clip_control");if(Y0)f0.clipControlEXT(f0.LOWER_LEFT_EXT,f0.ZERO_TO_ONE_EXT);else f0.clipControlEXT(f0.LOWER_LEFT_EXT,f0.NEGATIVE_ONE_TO_ONE_EXT);q0=Y0;let e0=S0;S0=null,this.setClear(e0)}},getReversed:function(){return q0},setTest:function(Y0){if(Y0)E0(J.DEPTH_TEST);else j0(J.DEPTH_TEST)},setMask:function(Y0){if(a!==Y0&&!f)J.depthMask(Y0),a=Y0},setFunc:function(Y0){if(q0)Y0=G5[Y0];if(G0!==Y0){switch(Y0){case PX:J.depthFunc(J.NEVER);break;case AX:J.depthFunc(J.ALWAYS);break;case TX:J.depthFunc(J.LESS);break;case _Z:J.depthFunc(J.LEQUAL);break;case SX:J.depthFunc(J.EQUAL);break;case jX:J.depthFunc(J.GEQUAL);break;case vX:J.depthFunc(J.GREATER);break;case yX:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}G0=Y0}},setLocked:function(Y0){f=Y0},setClear:function(Y0){if(S0!==Y0){if(S0=Y0,q0)Y0=1-Y0;J.clearDepth(Y0)}},reset:function(){f=!1,a=null,G0=null,S0=null,q0=!1}}}function W(){let f=!1,q0=null,a=null,G0=null,S0=null,Y0=null,f0=null,e0=null,gJ=null;return{setTest:function(qJ){if(!f)if(qJ)E0(J.STENCIL_TEST);else j0(J.STENCIL_TEST)},setMask:function(qJ){if(q0!==qJ&&!f)J.stencilMask(qJ),q0=qJ},setFunc:function(qJ,Q8,g9){if(a!==qJ||G0!==Q8||S0!==g9)J.stencilFunc(qJ,Q8,g9),a=qJ,G0=Q8,S0=g9},setOp:function(qJ,Q8,g9){if(Y0!==qJ||f0!==Q8||e0!==g9)J.stencilOp(qJ,Q8,g9),Y0=qJ,f0=Q8,e0=g9},setLocked:function(qJ){f=qJ},setClear:function(qJ){if(gJ!==qJ)J.clearStencil(qJ),gJ=qJ},reset:function(){f=!1,q0=null,a=null,G0=null,S0=null,Y0=null,f0=null,e0=null,gJ=null}}}let Y=new $,X=new Z,K=new W,H=new WeakMap,U=new WeakMap,G={},F={},E={},O=new WeakMap,R=[],M=null,q=!1,N=null,L=null,D=null,V=null,z=null,I=null,B=null,k=new e(0,0,0),C=0,j=!1,w=null,v=null,b=null,S=null,h=null,x=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),p=!1,c=0,o=J.getParameter(J.VERSION);if(o.indexOf("WebGL")!==-1)c=parseFloat(/^WebGL (\d)/.exec(o)[1]),p=c>=1;else if(o.indexOf("OpenGL ES")!==-1)c=parseFloat(/^OpenGL ES (\d)/.exec(o)[1]),p=c>=2;let W0=null,H0={},J0=J.getParameter(J.SCISSOR_BOX),c0=J.getParameter(J.VIEWPORT),d0=new FJ().fromArray(J0),s=new FJ().fromArray(c0);function F0(f,q0,a,G0){let S0=new Uint8Array(4),Y0=J.createTexture();J.bindTexture(f,Y0),J.texParameteri(f,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(f,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let f0=0;f0<a;f0++)if(f===J.TEXTURE_3D||f===J.TEXTURE_2D_ARRAY)J.texImage3D(q0,0,J.RGBA,1,1,G0,0,J.RGBA,J.UNSIGNED_BYTE,S0);else J.texImage2D(q0+f0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,S0);return Y0}let I0={};I0[J.TEXTURE_2D]=F0(J.TEXTURE_2D,J.TEXTURE_2D,1),I0[J.TEXTURE_CUBE_MAP]=F0(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),I0[J.TEXTURE_2D_ARRAY]=F0(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),I0[J.TEXTURE_3D]=F0(J.TEXTURE_3D,J.TEXTURE_3D,1,1),Y.setClear(0,0,0,1),X.setClear(1),K.setClear(0),E0(J.DEPTH_TEST),X.setFunc(_Z),C0(!1),m0(CZ),E0(J.CULL_FACE),$0(V9);function E0(f){if(G[f]!==!0)J.enable(f),G[f]=!0}function j0(f){if(G[f]!==!1)J.disable(f),G[f]=!1}function WJ(f,q0){if(E[f]!==q0){if(J.bindFramebuffer(f,q0),E[f]=q0,f===J.DRAW_FRAMEBUFFER)E[J.FRAMEBUFFER]=q0;if(f===J.FRAMEBUFFER)E[J.DRAW_FRAMEBUFFER]=q0;return!0}return!1}function x0(f,q0){let a=R,G0=!1;if(f){if(a=O.get(q0),a===void 0)a=[],O.set(q0,a);let S0=f.textures;if(a.length!==S0.length||a[0]!==J.COLOR_ATTACHMENT0){for(let Y0=0,f0=S0.length;Y0<f0;Y0++)a[Y0]=J.COLOR_ATTACHMENT0+Y0;a.length=S0.length,G0=!0}}else if(a[0]!==J.BACK)a[0]=J.BACK,G0=!0;if(G0)J.drawBuffers(a)}function n0(f){if(M!==f)return J.useProgram(f),M=f,!0;return!1}let Q0={[_6]:J.FUNC_ADD,[UX]:J.FUNC_SUBTRACT,[GX]:J.FUNC_REVERSE_SUBTRACT};Q0[EX]=J.MIN,Q0[FX]=J.MAX;let X0={[NX]:J.ZERO,[OX]:J.ONE,[qX]:J.SRC_COLOR,[LX]:J.SRC_ALPHA,[CX]:J.SRC_ALPHA_SATURATE,[VX]:J.DST_COLOR,[MX]:J.DST_ALPHA,[RX]:J.ONE_MINUS_SRC_COLOR,[DX]:J.ONE_MINUS_SRC_ALPHA,[BX]:J.ONE_MINUS_DST_COLOR,[kX]:J.ONE_MINUS_DST_ALPHA,[zX]:J.CONSTANT_COLOR,[IX]:J.ONE_MINUS_CONSTANT_COLOR,[_X]:J.CONSTANT_ALPHA,[wX]:J.ONE_MINUS_CONSTANT_ALPHA};function $0(f,q0,a,G0,S0,Y0,f0,e0,gJ,qJ){if(f===V9){if(q===!0)j0(J.BLEND),q=!1;return}if(q===!1)E0(J.BLEND),q=!0;if(f!==HX){if(f!==N||qJ!==j){if(L!==_6||z!==_6)J.blendEquation(J.FUNC_ADD),L=_6,z=_6;if(qJ)switch(f){case l8:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case c8:J.blendFunc(J.ONE,J.ONE);break;case zZ:J.blendFuncSeparate(J.ZERO,J.ONE_MINUS_SRC_COLOR,J.ZERO,J.ONE);break;case IZ:J.blendFuncSeparate(J.DST_COLOR,J.ONE_MINUS_SRC_ALPHA,J.ZERO,J.ONE);break;default:v0("WebGLState: Invalid blending: ",f);break}else switch(f){case l8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case c8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case zZ:v0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case IZ:v0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:v0("WebGLState: Invalid blending: ",f);break}D=null,V=null,I=null,B=null,k.set(0,0,0),C=0,N=f,j=qJ}return}if(S0=S0||q0,Y0=Y0||a,f0=f0||G0,q0!==L||S0!==z)J.blendEquationSeparate(Q0[q0],Q0[S0]),L=q0,z=S0;if(a!==D||G0!==V||Y0!==I||f0!==B)J.blendFuncSeparate(X0[a],X0[G0],X0[Y0],X0[f0]),D=a,V=G0,I=Y0,B=f0;if(e0.equals(k)===!1||gJ!==C)J.blendColor(e0.r,e0.g,e0.b,gJ),k.copy(e0),C=gJ;N=f,j=!1}function _0(f,q0){f.side===X9?j0(J.CULL_FACE):E0(J.CULL_FACE);let a=f.side===uJ;if(q0)a=!a;C0(a),f.blending===l8&&f.transparent===!1?$0(V9):$0(f.blending,f.blendEquation,f.blendSrc,f.blendDst,f.blendEquationAlpha,f.blendSrcAlpha,f.blendDstAlpha,f.blendColor,f.blendAlpha,f.premultipliedAlpha),X.setFunc(f.depthFunc),X.setTest(f.depthTest),X.setMask(f.depthWrite),Y.setMask(f.colorWrite);let G0=f.stencilWrite;if(K.setTest(G0),G0)K.setMask(f.stencilWriteMask),K.setFunc(f.stencilFunc,f.stencilRef,f.stencilFuncMask),K.setOp(f.stencilFail,f.stencilZFail,f.stencilZPass);YJ(f.polygonOffset,f.polygonOffsetFactor,f.polygonOffsetUnits),f.alphaToCoverage===!0?E0(J.SAMPLE_ALPHA_TO_COVERAGE):j0(J.SAMPLE_ALPHA_TO_COVERAGE)}function C0(f){if(w!==f){if(f)J.frontFace(J.CW);else J.frontFace(J.CCW);w=f}}function m0(f){if(f!==YX){if(E0(J.CULL_FACE),f!==v)if(f===CZ)J.cullFace(J.BACK);else if(f===XX)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else j0(J.CULL_FACE);v=f}function y(f){if(f!==b){if(p)J.lineWidth(f);b=f}}function YJ(f,q0,a){if(f){if(E0(J.POLYGON_OFFSET_FILL),S!==q0||h!==a){if(S=q0,h=a,X.getReversed())q0=-q0;J.polygonOffset(q0,a)}}else j0(J.POLYGON_OFFSET_FILL)}function h0(f){if(f)E0(J.SCISSOR_TEST);else j0(J.SCISSOR_TEST)}function l0(f){if(f===void 0)f=J.TEXTURE0+x-1;if(W0!==f)J.activeTexture(f),W0=f}function U0(f,q0,a){if(a===void 0)if(W0===null)a=J.TEXTURE0+x-1;else a=W0;let G0=H0[a];if(G0===void 0)G0={type:void 0,texture:void 0},H0[a]=G0;if(G0.type!==f||G0.texture!==q0){if(W0!==a)J.activeTexture(a),W0=a;J.bindTexture(f,q0||I0[f]),G0.type=f,G0.texture=q0}}function NJ(){let f=H0[W0];if(f!==void 0&&f.type!==void 0)J.bindTexture(f.type,null),f.type=void 0,f.texture=void 0}function A0(){try{J.compressedTexImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function T(){try{J.compressedTexImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function _(){try{J.texSubImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function u(){try{J.texSubImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function r(){try{J.compressedTexSubImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function Z0(){try{J.compressedTexSubImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function K0(){try{J.texStorage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function M0(){try{J.texStorage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function n(){try{J.texImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function t(){try{J.texImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function R0(f){if(F[f]!==void 0)return F[f];else return J.getParameter(f)}function T0(f,q0){if(F[f]!==q0)J.pixelStorei(f,q0),F[f]=q0}function N0(f){if(d0.equals(f)===!1)J.scissor(f.x,f.y,f.z,f.w),d0.copy(f)}function k0(f){if(s.equals(f)===!1)J.viewport(f.x,f.y,f.z,f.w),s.copy(f)}function r0(f,q0){let a=U.get(q0);if(a===void 0)a=new WeakMap,U.set(q0,a);let G0=a.get(f);if(G0===void 0)G0=J.getUniformBlockIndex(q0,f.name),a.set(f,G0)}function $J(f,q0){let G0=U.get(q0).get(f);if(H.get(q0)!==G0)J.uniformBlockBinding(q0,G0,f.__bindingPointIndex),H.set(q0,G0)}function XJ(){J.disable(J.BLEND),J.disable(J.CULL_FACE),J.disable(J.DEPTH_TEST),J.disable(J.POLYGON_OFFSET_FILL),J.disable(J.SCISSOR_TEST),J.disable(J.STENCIL_TEST),J.disable(J.SAMPLE_ALPHA_TO_COVERAGE),J.blendEquation(J.FUNC_ADD),J.blendFunc(J.ONE,J.ZERO),J.blendFuncSeparate(J.ONE,J.ZERO,J.ONE,J.ZERO),J.blendColor(0,0,0,0),J.colorMask(!0,!0,!0,!0),J.clearColor(0,0,0,0),J.depthMask(!0),J.depthFunc(J.LESS),X.setReversed(!1),J.clearDepth(1),J.stencilMask(4294967295),J.stencilFunc(J.ALWAYS,0,4294967295),J.stencilOp(J.KEEP,J.KEEP,J.KEEP),J.clearStencil(0),J.cullFace(J.BACK),J.frontFace(J.CCW),J.polygonOffset(0,0),J.activeTexture(J.TEXTURE0),J.bindFramebuffer(J.FRAMEBUFFER,null),J.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),J.bindFramebuffer(J.READ_FRAMEBUFFER,null),J.useProgram(null),J.lineWidth(1),J.scissor(0,0,J.canvas.width,J.canvas.height),J.viewport(0,0,J.canvas.width,J.canvas.height),J.pixelStorei(J.PACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,!1),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),J.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,J.BROWSER_DEFAULT_WEBGL),J.pixelStorei(J.PACK_ROW_LENGTH,0),J.pixelStorei(J.PACK_SKIP_PIXELS,0),J.pixelStorei(J.PACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_ROW_LENGTH,0),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,0),J.pixelStorei(J.UNPACK_SKIP_PIXELS,0),J.pixelStorei(J.UNPACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_SKIP_IMAGES,0),G={},F={},W0=null,H0={},E={},O=new WeakMap,R=[],M=null,q=!1,N=null,L=null,D=null,V=null,z=null,I=null,B=null,k=new e(0,0,0),C=0,j=!1,w=null,v=null,b=null,S=null,h=null,d0.set(0,0,J.canvas.width,J.canvas.height),s.set(0,0,J.canvas.width,J.canvas.height),Y.reset(),X.reset(),K.reset()}return{buffers:{color:Y,depth:X,stencil:K},enable:E0,disable:j0,bindFramebuffer:WJ,drawBuffers:x0,useProgram:n0,setBlending:$0,setMaterial:_0,setFlipSided:C0,setCullFace:m0,setLineWidth:y,setPolygonOffset:YJ,setScissorTest:h0,activeTexture:l0,bindTexture:U0,unbindTexture:NJ,compressedTexImage2D:A0,compressedTexImage3D:T,texImage2D:n,texImage3D:t,pixelStorei:T0,getParameter:R0,updateUBOMapping:r0,uniformBlockBinding:$J,texStorage2D:K0,texStorage3D:M0,texSubImage2D:_,texSubImage3D:u,compressedTexSubImage2D:r,compressedTexSubImage3D:Z0,scissor:N0,viewport:k0,reset:XJ}}function UD(J,Q,$,Z,W,Y,X){let K=Q.has("WEBGL_multisampled_render_to_texture")?Q.get("WEBGL_multisampled_render_to_texture"):null,H=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),U=new i,G=new WeakMap,F=new Set,E,O=new WeakMap,R=!1;try{R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(T){}function M(T,_){return R?new OffscreenCanvas(T,_):V7("canvas")}function q(T,_,u){let r=1,Z0=A0(T);if(Z0.width>u||Z0.height>u)r=u/Math.max(Z0.width,Z0.height);if(r<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){let K0=Math.floor(r*Z0.width),M0=Math.floor(r*Z0.height);if(E===void 0)E=M(K0,M0);let n=_?M(K0,M0):E;return n.width=K0,n.height=M0,n.getContext("2d").drawImage(T,0,0,K0,M0),O0("WebGLRenderer: Texture has been resized from ("+Z0.width+"x"+Z0.height+") to ("+K0+"x"+M0+")."),n}else{if("data"in T)O0("WebGLRenderer: Image in DataTexture is too big ("+Z0.width+"x"+Z0.height+").");return T}return T}function N(T){return T.generateMipmaps}function L(T){J.generateMipmap(T)}function D(T){if(T.isWebGLCubeRenderTarget)return J.TEXTURE_CUBE_MAP;if(T.isWebGL3DRenderTarget)return J.TEXTURE_3D;if(T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture)return J.TEXTURE_2D_ARRAY;return J.TEXTURE_2D}function V(T,_,u,r,Z0,K0=!1){if(T!==null){if(J[T]!==void 0)return J[T];O0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let M0;if(r){if(M0=Q.get("EXT_texture_norm16"),!M0)O0("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let n=_;if(_===J.RED){if(u===J.FLOAT)n=J.R32F;if(u===J.HALF_FLOAT)n=J.R16F;if(u===J.UNSIGNED_BYTE)n=J.R8;if(u===J.UNSIGNED_SHORT&&M0)n=M0.R16_EXT;if(u===J.SHORT&&M0)n=M0.R16_SNORM_EXT}if(_===J.RED_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.R8UI;if(u===J.UNSIGNED_SHORT)n=J.R16UI;if(u===J.UNSIGNED_INT)n=J.R32UI;if(u===J.BYTE)n=J.R8I;if(u===J.SHORT)n=J.R16I;if(u===J.INT)n=J.R32I}if(_===J.RG){if(u===J.FLOAT)n=J.RG32F;if(u===J.HALF_FLOAT)n=J.RG16F;if(u===J.UNSIGNED_BYTE)n=J.RG8;if(u===J.UNSIGNED_SHORT&&M0)n=M0.RG16_EXT;if(u===J.SHORT&&M0)n=M0.RG16_SNORM_EXT}if(_===J.RG_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RG8UI;if(u===J.UNSIGNED_SHORT)n=J.RG16UI;if(u===J.UNSIGNED_INT)n=J.RG32UI;if(u===J.BYTE)n=J.RG8I;if(u===J.SHORT)n=J.RG16I;if(u===J.INT)n=J.RG32I}if(_===J.RGB_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RGB8UI;if(u===J.UNSIGNED_SHORT)n=J.RGB16UI;if(u===J.UNSIGNED_INT)n=J.RGB32UI;if(u===J.BYTE)n=J.RGB8I;if(u===J.SHORT)n=J.RGB16I;if(u===J.INT)n=J.RGB32I}if(_===J.RGBA_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RGBA8UI;if(u===J.UNSIGNED_SHORT)n=J.RGBA16UI;if(u===J.UNSIGNED_INT)n=J.RGBA32UI;if(u===J.BYTE)n=J.RGBA8I;if(u===J.SHORT)n=J.RGBA16I;if(u===J.INT)n=J.RGBA32I}if(_===J.RGB){if(u===J.UNSIGNED_SHORT&&M0)n=M0.RGB16_EXT;if(u===J.SHORT&&M0)n=M0.RGB16_SNORM_EXT;if(u===J.UNSIGNED_INT_5_9_9_9_REV)n=J.RGB9_E5;if(u===J.UNSIGNED_INT_10F_11F_11F_REV)n=J.R11F_G11F_B10F}if(_===J.RGBA){let t=K0?FW:t0.getTransfer(Z0);if(u===J.FLOAT)n=J.RGBA32F;if(u===J.HALF_FLOAT)n=J.RGBA16F;if(u===J.UNSIGNED_BYTE)n=t===OJ?J.SRGB8_ALPHA8:J.RGBA8;if(u===J.UNSIGNED_SHORT&&M0)n=M0.RGBA16_EXT;if(u===J.SHORT&&M0)n=M0.RGBA16_SNORM_EXT;if(u===J.UNSIGNED_SHORT_4_4_4_4)n=J.RGBA4;if(u===J.UNSIGNED_SHORT_5_5_5_1)n=J.RGB5_A1}if(n===J.R16F||n===J.R32F||n===J.RG16F||n===J.RG32F||n===J.RGBA16F||n===J.RGBA32F)Q.get("EXT_color_buffer_float");return n}function z(T,_){let u;if(T){if(_===null||_===w8||_===T6)u=J.DEPTH24_STENCIL8;else if(_===N9)u=J.DEPTH32F_STENCIL8;else if(_===v7)u=J.DEPTH24_STENCIL8,O0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(_===null||_===w8||_===T6)u=J.DEPTH_COMPONENT24;else if(_===N9)u=J.DEPTH_COMPONENT32F;else if(_===v7)u=J.DEPTH_COMPONENT16;return u}function I(T,_){if(N(T)===!0||T.isFramebufferTexture&&T.minFilter!==S9&&T.minFilter!==jJ)return Math.log2(Math.max(_.width,_.height))+1;else if(T.mipmaps!==void 0&&T.mipmaps.length>0)return T.mipmaps.length;else if(T.isCompressedTexture&&Array.isArray(T.image))return _.mipmaps.length;else return 1}function B(T){let _=T.target;if(_.removeEventListener("dispose",B),C(_),_.isVideoTexture)G.delete(_);if(_.isHTMLTexture)F.delete(_)}function k(T){let _=T.target;_.removeEventListener("dispose",k),w(_)}function C(T){let _=Z.get(T);if(_.__webglInit===void 0)return;let u=T.source,r=O.get(u);if(r){let Z0=r[_.__cacheKey];if(Z0.usedTimes--,Z0.usedTimes===0)j(T);if(Object.keys(r).length===0)O.delete(u)}Z.remove(T)}function j(T){let _=Z.get(T);J.deleteTexture(_.__webglTexture);let u=T.source,r=O.get(u);delete r[_.__cacheKey],X.memory.textures--}function w(T){let _=Z.get(T);if(T.depthTexture)T.depthTexture.dispose(),Z.remove(T.depthTexture);if(T.isWebGLCubeRenderTarget)for(let r=0;r<6;r++){if(Array.isArray(_.__webglFramebuffer[r]))for(let Z0=0;Z0<_.__webglFramebuffer[r].length;Z0++)J.deleteFramebuffer(_.__webglFramebuffer[r][Z0]);else J.deleteFramebuffer(_.__webglFramebuffer[r]);if(_.__webglDepthbuffer)J.deleteRenderbuffer(_.__webglDepthbuffer[r])}else{if(Array.isArray(_.__webglFramebuffer))for(let r=0;r<_.__webglFramebuffer.length;r++)J.deleteFramebuffer(_.__webglFramebuffer[r]);else J.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer)J.deleteRenderbuffer(_.__webglDepthbuffer);if(_.__webglMultisampledFramebuffer)J.deleteFramebuffer(_.__webglMultisampledFramebuffer);if(_.__webglColorRenderbuffer){for(let r=0;r<_.__webglColorRenderbuffer.length;r++)if(_.__webglColorRenderbuffer[r])J.deleteRenderbuffer(_.__webglColorRenderbuffer[r])}if(_.__webglDepthRenderbuffer)J.deleteRenderbuffer(_.__webglDepthRenderbuffer)}let u=T.textures;for(let r=0,Z0=u.length;r<Z0;r++){let K0=Z.get(u[r]);if(K0.__webglTexture)J.deleteTexture(K0.__webglTexture),X.memory.textures--;Z.remove(u[r])}Z.remove(T)}let v=0;function b(){v=0}function S(){return v}function h(T){v=T}function x(){let T=v;if(T>=W.maxTextures)O0("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+W.maxTextures);return v+=1,T}function p(T){let _=[];return _.push(T.wrapS),_.push(T.wrapT),_.push(T.wrapR||0),_.push(T.magFilter),_.push(T.minFilter),_.push(T.anisotropy),_.push(T.internalFormat),_.push(T.format),_.push(T.type),_.push(T.generateMipmaps),_.push(T.premultiplyAlpha),_.push(T.flipY),_.push(T.unpackAlignment),_.push(T.colorSpace),_.join()}function c(T,_){let u=Z.get(T);if(T.isVideoTexture)U0(T);if(T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&u.__version!==T.version){let r=T.image;if(r===null)O0("WebGLRenderer: Texture marked for update but no image data found.");else if(r.complete===!1)O0("WebGLRenderer: Texture marked for update but image is incomplete");else{j0(u,T,_);return}}else if(T.isExternalTexture)u.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,u.__webglTexture,J.TEXTURE0+_)}function o(T,_){let u=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&u.__version!==T.version){j0(u,T,_);return}else if(T.isExternalTexture)u.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,u.__webglTexture,J.TEXTURE0+_)}function W0(T,_){let u=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&u.__version!==T.version){j0(u,T,_);return}$.bindTexture(J.TEXTURE_3D,u.__webglTexture,J.TEXTURE0+_)}function H0(T,_){let u=Z.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&u.__version!==T.version){WJ(u,T,_);return}$.bindTexture(J.TEXTURE_CUBE_MAP,u.__webglTexture,J.TEXTURE0+_)}let J0={[_8]:J.REPEAT,[P6]:J.CLAMP_TO_EDGE,[wQ]:J.MIRRORED_REPEAT},c0={[S9]:J.NEAREST,[PQ]:J.NEAREST_MIPMAP_NEAREST,[i8]:J.NEAREST_MIPMAP_LINEAR,[jJ]:J.LINEAR,[A6]:J.LINEAR_MIPMAP_NEAREST,[i9]:J.LINEAR_MIPMAP_LINEAR},d0={[nX]:J.NEVER,[rX]:J.ALWAYS,[sX]:J.LESS,[bQ]:J.LEQUAL,[iX]:J.EQUAL,[hQ]:J.GEQUAL,[oX]:J.GREATER,[aX]:J.NOTEQUAL};function s(T,_){if(_.type===N9&&Q.has("OES_texture_float_linear")===!1&&(_.magFilter===jJ||_.magFilter===A6||_.magFilter===i8||_.magFilter===i9||_.minFilter===jJ||_.minFilter===A6||_.minFilter===i8||_.minFilter===i9))O0("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(J.texParameteri(T,J.TEXTURE_WRAP_S,J0[_.wrapS]),J.texParameteri(T,J.TEXTURE_WRAP_T,J0[_.wrapT]),T===J.TEXTURE_3D||T===J.TEXTURE_2D_ARRAY)J.texParameteri(T,J.TEXTURE_WRAP_R,J0[_.wrapR]);if(J.texParameteri(T,J.TEXTURE_MAG_FILTER,c0[_.magFilter]),J.texParameteri(T,J.TEXTURE_MIN_FILTER,c0[_.minFilter]),_.compareFunction)J.texParameteri(T,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(T,J.TEXTURE_COMPARE_FUNC,d0[_.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===S9)return;if(_.minFilter!==i8&&_.minFilter!==i9)return;if(_.type===N9&&Q.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||Z.get(_).__currentAnisotropy){let u=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(T,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,W.getMaxAnisotropy())),Z.get(_).__currentAnisotropy=_.anisotropy}}}function F0(T,_){let u=!1;if(T.__webglInit===void 0)T.__webglInit=!0,_.addEventListener("dispose",B);let r=_.source,Z0=O.get(r);if(Z0===void 0)Z0={},O.set(r,Z0);let K0=p(_);if(K0!==T.__cacheKey){if(Z0[K0]===void 0)Z0[K0]={texture:J.createTexture(),usedTimes:0},X.memory.textures++,u=!0;Z0[K0].usedTimes++;let M0=Z0[T.__cacheKey];if(M0!==void 0){if(Z0[T.__cacheKey].usedTimes--,M0.usedTimes===0)j(_)}T.__cacheKey=K0,T.__webglTexture=Z0[K0].texture}return u}function I0(T,_,u){return Math.floor(Math.floor(T/u)/_)}function E0(T,_,u,r){let K0=T.updateRanges;if(K0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,_.width,_.height,u,r,_.data);else{K0.sort((T0,N0)=>T0.start-N0.start);let M0=0;for(let T0=1;T0<K0.length;T0++){let N0=K0[M0],k0=K0[T0],r0=N0.start+N0.count,$J=I0(k0.start,_.width,4),XJ=I0(N0.start,_.width,4);if(k0.start<=r0+1&&$J===XJ&&I0(k0.start+k0.count-1,_.width,4)===$J)N0.count=Math.max(N0.count,k0.start+k0.count-N0.start);else++M0,K0[M0]=k0}K0.length=M0+1;let n=$.getParameter(J.UNPACK_ROW_LENGTH),t=$.getParameter(J.UNPACK_SKIP_PIXELS),R0=$.getParameter(J.UNPACK_SKIP_ROWS);$.pixelStorei(J.UNPACK_ROW_LENGTH,_.width);for(let T0=0,N0=K0.length;T0<N0;T0++){let k0=K0[T0],r0=Math.floor(k0.start/4),$J=Math.ceil(k0.count/4),XJ=r0%_.width,f=Math.floor(r0/_.width),q0=$J,a=1;$.pixelStorei(J.UNPACK_SKIP_PIXELS,XJ),$.pixelStorei(J.UNPACK_SKIP_ROWS,f),$.texSubImage2D(J.TEXTURE_2D,0,XJ,f,q0,1,u,r,_.data)}T.clearUpdateRanges(),$.pixelStorei(J.UNPACK_ROW_LENGTH,n),$.pixelStorei(J.UNPACK_SKIP_PIXELS,t),$.pixelStorei(J.UNPACK_SKIP_ROWS,R0)}}function j0(T,_,u){let r=J.TEXTURE_2D;if(_.isDataArrayTexture||_.isCompressedArrayTexture)r=J.TEXTURE_2D_ARRAY;if(_.isData3DTexture)r=J.TEXTURE_3D;let Z0=F0(T,_),K0=_.source;$.bindTexture(r,T.__webglTexture,J.TEXTURE0+u);let M0=Z.get(K0);if(K0.version!==M0.__version||Z0===!0){if($.activeTexture(J.TEXTURE0+u),(typeof ImageBitmap<"u"&&_.image instanceof ImageBitmap)===!1){let a=t0.getPrimaries(t0.workingColorSpace),G0=_.colorSpace===t8?null:t0.getPrimaries(_.colorSpace),S0=_.colorSpace===t8||a===G0?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,_.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,S0)}$.pixelStorei(J.UNPACK_ALIGNMENT,_.unpackAlignment);let t=q(_.image,!1,W.maxTextureSize);t=NJ(_,t);let R0=Y.convert(_.format,_.colorSpace),T0=Y.convert(_.type),N0=V(_.internalFormat,R0,T0,_.normalized,_.colorSpace,_.isVideoTexture);s(r,_);let k0,r0=_.mipmaps,$J=_.isVideoTexture!==!0,XJ=M0.__version===void 0||Z0===!0,f=K0.dataReady,q0=I(_,t);if(_.isDepthTexture){if(N0=z(_.format===a8,_.type),XJ)if($J)$.texStorage2D(J.TEXTURE_2D,1,N0,t.width,t.height);else $.texImage2D(J.TEXTURE_2D,0,N0,t.width,t.height,0,R0,T0,null)}else if(_.isDataTexture)if(r0.length>0){if($J&&XJ)$.texStorage2D(J.TEXTURE_2D,q0,N0,r0[0].width,r0[0].height);for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],$J){if(f)$.texSubImage2D(J.TEXTURE_2D,a,0,0,k0.width,k0.height,R0,T0,k0.data)}else $.texImage2D(J.TEXTURE_2D,a,N0,k0.width,k0.height,0,R0,T0,k0.data);_.generateMipmaps=!1}else if($J){if(XJ)$.texStorage2D(J.TEXTURE_2D,q0,N0,t.width,t.height);if(f)E0(_,t,R0,T0)}else $.texImage2D(J.TEXTURE_2D,0,N0,t.width,t.height,0,R0,T0,t.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){if($J&&XJ)$.texStorage3D(J.TEXTURE_2D_ARRAY,q0,N0,r0[0].width,r0[0].height,t.depth);for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],_.format!==o9)if(R0!==null)if($J){if(f)if(_.layerUpdates.size>0){let S0=iW(k0.width,k0.height,_.format,_.type);for(let Y0 of _.layerUpdates){let f0=k0.data.subarray(Y0*S0/k0.data.BYTES_PER_ELEMENT,(Y0+1)*S0/k0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,a,0,0,Y0,k0.width,k0.height,1,R0,f0)}_.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,a,0,0,0,k0.width,k0.height,t.depth,R0,k0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,a,N0,k0.width,k0.height,t.depth,0,k0.data,0,0);else O0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if($J){if(f)$.texSubImage3D(J.TEXTURE_2D_ARRAY,a,0,0,0,k0.width,k0.height,t.depth,R0,T0,k0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,a,N0,k0.width,k0.height,t.depth,0,R0,T0,k0.data)}else{if($J&&XJ)$.texStorage2D(J.TEXTURE_2D,q0,N0,r0[0].width,r0[0].height);for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],_.format!==o9)if(R0!==null)if($J){if(f)$.compressedTexSubImage2D(J.TEXTURE_2D,a,0,0,k0.width,k0.height,R0,k0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,a,N0,k0.width,k0.height,0,k0.data);else O0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if($J){if(f)$.texSubImage2D(J.TEXTURE_2D,a,0,0,k0.width,k0.height,R0,T0,k0.data)}else $.texImage2D(J.TEXTURE_2D,a,N0,k0.width,k0.height,0,R0,T0,k0.data)}else if(_.isDataArrayTexture)if($J){if(XJ)$.texStorage3D(J.TEXTURE_2D_ARRAY,q0,N0,t.width,t.height,t.depth);if(f)if(_.layerUpdates.size>0){let a=iW(t.width,t.height,_.format,_.type);for(let G0 of _.layerUpdates){let S0=t.data.subarray(G0*a/t.data.BYTES_PER_ELEMENT,(G0+1)*a/t.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,G0,t.width,t.height,1,R0,T0,S0)}_.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,R0,T0,t.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,N0,t.width,t.height,t.depth,0,R0,T0,t.data);else if(_.isData3DTexture)if($J){if(XJ)$.texStorage3D(J.TEXTURE_3D,q0,N0,t.width,t.height,t.depth);if(f)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,R0,T0,t.data)}else $.texImage3D(J.TEXTURE_3D,0,N0,t.width,t.height,t.depth,0,R0,T0,t.data);else if(_.isFramebufferTexture){if(XJ)if($J)$.texStorage2D(J.TEXTURE_2D,q0,N0,t.width,t.height);else{let{width:a,height:G0}=t;for(let S0=0;S0<q0;S0++)$.texImage2D(J.TEXTURE_2D,S0,N0,a,G0,0,R0,T0,null),a>>=1,G0>>=1}}else if(_.isHTMLTexture){if("texElementImage2D"in J){let a=J.canvas;if(!a.hasAttribute("layoutsubtree"))a.setAttribute("layoutsubtree","true");if(t.parentNode!==a){a.appendChild(t),F.add(_),a.onpaint=(e0)=>{let gJ=e0.changedElements;for(let qJ of F)if(gJ.includes(qJ.image))qJ.needsUpdate=!0},a.requestPaint();return}let G0=0,S0=J.RGBA,Y0=J.RGBA,f0=J.UNSIGNED_BYTE;J.texElementImage2D(J.TEXTURE_2D,G0,S0,Y0,f0,t),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_MIN_FILTER,J.LINEAR),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_S,J.CLAMP_TO_EDGE),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_T,J.CLAMP_TO_EDGE)}}else if(r0.length>0){if($J&&XJ){let a=A0(r0[0]);$.texStorage2D(J.TEXTURE_2D,q0,N0,a.width,a.height)}for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],$J){if(f)$.texSubImage2D(J.TEXTURE_2D,a,0,0,R0,T0,k0)}else $.texImage2D(J.TEXTURE_2D,a,N0,R0,T0,k0);_.generateMipmaps=!1}else if($J){if(XJ){let a=A0(t);$.texStorage2D(J.TEXTURE_2D,q0,N0,a.width,a.height)}if(f)$.texSubImage2D(J.TEXTURE_2D,0,0,0,R0,T0,t)}else $.texImage2D(J.TEXTURE_2D,0,N0,R0,T0,t);if(N(_))L(r);if(M0.__version=K0.version,_.onUpdate)_.onUpdate(_)}T.__version=_.version}function WJ(T,_,u){if(_.image.length!==6)return;let r=F0(T,_),Z0=_.source;$.bindTexture(J.TEXTURE_CUBE_MAP,T.__webglTexture,J.TEXTURE0+u);let K0=Z.get(Z0);if(Z0.version!==K0.__version||r===!0){$.activeTexture(J.TEXTURE0+u);let M0=t0.getPrimaries(t0.workingColorSpace),n=_.colorSpace===t8?null:t0.getPrimaries(_.colorSpace),t=_.colorSpace===t8||M0===n?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,_.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),$.pixelStorei(J.UNPACK_ALIGNMENT,_.unpackAlignment),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,t);let R0=_.isCompressedTexture||_.image[0].isCompressedTexture,T0=_.image[0]&&_.image[0].isDataTexture,N0=[];for(let Y0=0;Y0<6;Y0++){if(!R0&&!T0)N0[Y0]=q(_.image[Y0],!0,W.maxCubemapSize);else N0[Y0]=T0?_.image[Y0].image:_.image[Y0];N0[Y0]=NJ(_,N0[Y0])}let k0=N0[0],r0=Y.convert(_.format,_.colorSpace),$J=Y.convert(_.type),XJ=V(_.internalFormat,r0,$J,_.normalized,_.colorSpace),f=_.isVideoTexture!==!0,q0=K0.__version===void 0||r===!0,a=Z0.dataReady,G0=I(_,k0);s(J.TEXTURE_CUBE_MAP,_);let S0;if(R0){if(f&&q0)$.texStorage2D(J.TEXTURE_CUBE_MAP,G0,XJ,k0.width,k0.height);for(let Y0=0;Y0<6;Y0++){S0=N0[Y0].mipmaps;for(let f0=0;f0<S0.length;f0++){let e0=S0[f0];if(_.format!==o9)if(r0!==null)if(f){if(a)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,0,0,e0.width,e0.height,r0,e0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,XJ,e0.width,e0.height,0,e0.data);else O0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,0,0,e0.width,e0.height,r0,$J,e0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,XJ,e0.width,e0.height,0,r0,$J,e0.data)}}}else{if(S0=_.mipmaps,f&&q0){if(S0.length>0)G0++;let Y0=A0(N0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,G0,XJ,Y0.width,Y0.height)}for(let Y0=0;Y0<6;Y0++)if(T0){if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,0,0,N0[Y0].width,N0[Y0].height,r0,$J,N0[Y0].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,XJ,N0[Y0].width,N0[Y0].height,0,r0,$J,N0[Y0].data);for(let f0=0;f0<S0.length;f0++){let gJ=S0[f0].image[Y0].image;if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,0,0,gJ.width,gJ.height,r0,$J,gJ.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,XJ,gJ.width,gJ.height,0,r0,$J,gJ.data)}}else{if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,0,0,r0,$J,N0[Y0])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,XJ,r0,$J,N0[Y0]);for(let f0=0;f0<S0.length;f0++){let e0=S0[f0];if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,0,0,r0,$J,e0.image[Y0])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,XJ,r0,$J,e0.image[Y0])}}}if(N(_))L(J.TEXTURE_CUBE_MAP);if(K0.__version=Z0.version,_.onUpdate)_.onUpdate(_)}T.__version=_.version}function x0(T,_,u,r,Z0,K0){let M0=Y.convert(u.format,u.colorSpace),n=Y.convert(u.type),t=V(u.internalFormat,M0,n,u.normalized,u.colorSpace),R0=Z.get(_),T0=Z.get(u);if(T0.__renderTarget=_,!R0.__hasExternalTextures){let N0=Math.max(1,_.width>>K0),k0=Math.max(1,_.height>>K0);if(Z0===J.TEXTURE_3D||Z0===J.TEXTURE_2D_ARRAY)$.texImage3D(Z0,K0,t,N0,k0,_.depth,0,M0,n,null);else $.texImage2D(Z0,K0,t,N0,k0,0,M0,n,null)}if($.bindFramebuffer(J.FRAMEBUFFER,T),l0(_))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,r,Z0,T0.__webglTexture,0,h0(_));else if(Z0===J.TEXTURE_2D||Z0>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&Z0<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,r,Z0,T0.__webglTexture,K0);$.bindFramebuffer(J.FRAMEBUFFER,null)}function n0(T,_,u){if(J.bindRenderbuffer(J.RENDERBUFFER,T),_.depthBuffer){let r=_.depthTexture,Z0=r&&r.isDepthTexture?r.type:null,K0=z(_.stencilBuffer,Z0),M0=_.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(l0(_))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,h0(_),K0,_.width,_.height);else if(u)J.renderbufferStorageMultisample(J.RENDERBUFFER,h0(_),K0,_.width,_.height);else J.renderbufferStorage(J.RENDERBUFFER,K0,_.width,_.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,M0,J.RENDERBUFFER,T)}else{let r=_.textures;for(let Z0=0;Z0<r.length;Z0++){let K0=r[Z0],M0=Y.convert(K0.format,K0.colorSpace),n=Y.convert(K0.type),t=V(K0.internalFormat,M0,n,K0.normalized,K0.colorSpace);if(l0(_))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,h0(_),t,_.width,_.height);else if(u)J.renderbufferStorageMultisample(J.RENDERBUFFER,h0(_),t,_.width,_.height);else J.renderbufferStorage(J.RENDERBUFFER,t,_.width,_.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function Q0(T,_,u){let r=_.isWebGLCubeRenderTarget===!0;if($.bindFramebuffer(J.FRAMEBUFFER,T),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let Z0=Z.get(_.depthTexture);if(Z0.__renderTarget=_,!Z0.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0;if(r){if(Z0.__webglInit===void 0)Z0.__webglInit=!0,_.depthTexture.addEventListener("dispose",B);if(Z0.__webglTexture===void 0){Z0.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,Z0.__webglTexture),s(J.TEXTURE_CUBE_MAP,_.depthTexture);let R0=Y.convert(_.depthTexture.format),T0=Y.convert(_.depthTexture.type),N0;if(_.depthTexture.format===o8)N0=J.DEPTH_COMPONENT24;else if(_.depthTexture.format===a8)N0=J.DEPTH24_STENCIL8;for(let k0=0;k0<6;k0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+k0,0,N0,_.width,_.height,0,R0,T0,null)}}else c(_.depthTexture,0);let K0=Z0.__webglTexture,M0=h0(_),n=r?J.TEXTURE_CUBE_MAP_POSITIVE_X+u:J.TEXTURE_2D,t=_.depthTexture.format===a8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(_.depthTexture.format===o8)if(l0(_))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,t,n,K0,0,M0);else J.framebufferTexture2D(J.FRAMEBUFFER,t,n,K0,0);else if(_.depthTexture.format===a8)if(l0(_))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,t,n,K0,0,M0);else J.framebufferTexture2D(J.FRAMEBUFFER,t,n,K0,0);else throw Error("Unknown depthTexture format")}function X0(T){let _=Z.get(T),u=T.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==T.depthTexture){let r=T.depthTexture;if(_.__depthDisposeCallback)_.__depthDisposeCallback();if(r){let Z0=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,r.removeEventListener("dispose",Z0)};r.addEventListener("dispose",Z0),_.__depthDisposeCallback=Z0}_.__boundDepthTexture=r}if(T.depthTexture&&!_.__autoAllocateDepthBuffer)if(u)for(let r=0;r<6;r++)Q0(_.__webglFramebuffer[r],T,r);else{let r=T.texture.mipmaps;if(r&&r.length>0)Q0(_.__webglFramebuffer[0],T,0);else Q0(_.__webglFramebuffer,T,0)}else if(u){_.__webglDepthbuffer=[];for(let r=0;r<6;r++)if($.bindFramebuffer(J.FRAMEBUFFER,_.__webglFramebuffer[r]),_.__webglDepthbuffer[r]===void 0)_.__webglDepthbuffer[r]=J.createRenderbuffer(),n0(_.__webglDepthbuffer[r],T,!1);else{let Z0=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,K0=_.__webglDepthbuffer[r];J.bindRenderbuffer(J.RENDERBUFFER,K0),J.framebufferRenderbuffer(J.FRAMEBUFFER,Z0,J.RENDERBUFFER,K0)}}else{let r=T.texture.mipmaps;if(r&&r.length>0)$.bindFramebuffer(J.FRAMEBUFFER,_.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,_.__webglFramebuffer);if(_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=J.createRenderbuffer(),n0(_.__webglDepthbuffer,T,!1);else{let Z0=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,K0=_.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,K0),J.framebufferRenderbuffer(J.FRAMEBUFFER,Z0,J.RENDERBUFFER,K0)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function $0(T,_,u){let r=Z.get(T);if(_!==void 0)x0(r.__webglFramebuffer,T,T.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(u!==void 0)X0(T)}function _0(T){let _=T.texture,u=Z.get(T),r=Z.get(_);T.addEventListener("dispose",k);let Z0=T.textures,K0=T.isWebGLCubeRenderTarget===!0,M0=Z0.length>1;if(!M0){if(r.__webglTexture===void 0)r.__webglTexture=J.createTexture();r.__version=_.version,X.memory.textures++}if(K0){u.__webglFramebuffer=[];for(let n=0;n<6;n++)if(_.mipmaps&&_.mipmaps.length>0){u.__webglFramebuffer[n]=[];for(let t=0;t<_.mipmaps.length;t++)u.__webglFramebuffer[n][t]=J.createFramebuffer()}else u.__webglFramebuffer[n]=J.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){u.__webglFramebuffer=[];for(let n=0;n<_.mipmaps.length;n++)u.__webglFramebuffer[n]=J.createFramebuffer()}else u.__webglFramebuffer=J.createFramebuffer();if(M0)for(let n=0,t=Z0.length;n<t;n++){let R0=Z.get(Z0[n]);if(R0.__webglTexture===void 0)R0.__webglTexture=J.createTexture(),X.memory.textures++}if(T.samples>0&&l0(T)===!1){u.__webglMultisampledFramebuffer=J.createFramebuffer(),u.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,u.__webglMultisampledFramebuffer);for(let n=0;n<Z0.length;n++){let t=Z0[n];u.__webglColorRenderbuffer[n]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,u.__webglColorRenderbuffer[n]);let R0=Y.convert(t.format,t.colorSpace),T0=Y.convert(t.type),N0=V(t.internalFormat,R0,T0,t.normalized,t.colorSpace,T.isXRRenderTarget===!0),k0=h0(T);J.renderbufferStorageMultisample(J.RENDERBUFFER,k0,N0,T.width,T.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+n,J.RENDERBUFFER,u.__webglColorRenderbuffer[n])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),T.depthBuffer)u.__webglDepthRenderbuffer=J.createRenderbuffer(),n0(u.__webglDepthRenderbuffer,T,!0);$.bindFramebuffer(J.FRAMEBUFFER,null)}}if(K0){$.bindTexture(J.TEXTURE_CUBE_MAP,r.__webglTexture),s(J.TEXTURE_CUBE_MAP,_);for(let n=0;n<6;n++)if(_.mipmaps&&_.mipmaps.length>0)for(let t=0;t<_.mipmaps.length;t++)x0(u.__webglFramebuffer[n][t],T,_,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,t);else x0(u.__webglFramebuffer[n],T,_,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);if(N(_))L(J.TEXTURE_CUBE_MAP);$.unbindTexture()}else if(M0){for(let n=0,t=Z0.length;n<t;n++){let R0=Z0[n],T0=Z.get(R0),N0=J.TEXTURE_2D;if(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)N0=T.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(N0,T0.__webglTexture),s(N0,R0),x0(u.__webglFramebuffer,T,R0,J.COLOR_ATTACHMENT0+n,N0,0),N(R0))L(N0)}$.unbindTexture()}else{let n=J.TEXTURE_2D;if(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)n=T.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(n,r.__webglTexture),s(n,_),_.mipmaps&&_.mipmaps.length>0)for(let t=0;t<_.mipmaps.length;t++)x0(u.__webglFramebuffer[t],T,_,J.COLOR_ATTACHMENT0,n,t);else x0(u.__webglFramebuffer,T,_,J.COLOR_ATTACHMENT0,n,0);if(N(_))L(n);$.unbindTexture()}if(T.depthBuffer)X0(T)}function C0(T){let _=T.textures;for(let u=0,r=_.length;u<r;u++){let Z0=_[u];if(N(Z0)){let K0=D(T),M0=Z.get(Z0).__webglTexture;$.bindTexture(K0,M0),L(K0),$.unbindTexture()}}}let m0=[],y=[];function YJ(T){if(T.samples>0){if(l0(T)===!1){let{textures:_,width:u,height:r}=T,Z0=J.COLOR_BUFFER_BIT,K0=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,M0=Z.get(T),n=_.length>1;if(n)for(let R0=0;R0<_.length;R0++)$.bindFramebuffer(J.FRAMEBUFFER,M0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,M0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,M0.__webglMultisampledFramebuffer);let t=T.texture.mipmaps;if(t&&t.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,M0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,M0.__webglFramebuffer);for(let R0=0;R0<_.length;R0++){if(T.resolveDepthBuffer){if(T.depthBuffer)Z0|=J.DEPTH_BUFFER_BIT;if(T.stencilBuffer&&T.resolveStencilBuffer)Z0|=J.STENCIL_BUFFER_BIT}if(n){J.framebufferRenderbuffer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.RENDERBUFFER,M0.__webglColorRenderbuffer[R0]);let T0=Z.get(_[R0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,T0,0)}if(J.blitFramebuffer(0,0,u,r,0,0,u,r,Z0,J.NEAREST),H===!0){if(m0.length=0,y.length=0,m0.push(J.COLOR_ATTACHMENT0+R0),T.depthBuffer&&T.resolveDepthBuffer===!1)m0.push(K0),y.push(K0),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,y);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,m0)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),n)for(let R0=0;R0<_.length;R0++){$.bindFramebuffer(J.FRAMEBUFFER,M0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.RENDERBUFFER,M0.__webglColorRenderbuffer[R0]);let T0=Z.get(_[R0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,M0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.TEXTURE_2D,T0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,M0.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&H){let _=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,[_])}}}function h0(T){return Math.min(W.maxSamples,T.samples)}function l0(T){let _=Z.get(T);return T.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function U0(T){let _=X.render.frame;if(G.get(T)!==_)G.set(T,_),T.update()}function NJ(T,_){let{colorSpace:u,format:r,type:Z0}=T;if(T.isCompressedTexture===!0||T.isVideoTexture===!0)return _;if(u!==J9&&u!==t8)if(t0.getTransfer(u)===OJ){if(r!==o9||Z0!==j9)O0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else v0("WebGLTextures: Unsupported texture color space:",u);return _}function A0(T){if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement)U.width=T.naturalWidth||T.width,U.height=T.naturalHeight||T.height;else if(typeof VideoFrame<"u"&&T instanceof VideoFrame)U.width=T.displayWidth,U.height=T.displayHeight;else U.width=T.width,U.height=T.height;return U}this.allocateTextureUnit=x,this.resetTextureUnits=b,this.getTextureUnits=S,this.setTextureUnits=h,this.setTexture2D=c,this.setTexture2DArray=o,this.setTexture3D=W0,this.setTextureCube=H0,this.rebindTextures=$0,this.setupRenderTarget=_0,this.updateRenderTargetMipmap=C0,this.updateMultisampleRenderTarget=YJ,this.setupDepthRenderbuffer=X0,this.setupFrameBufferTexture=x0,this.useMultisampledRTT=l0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function YE(J,Q){function $(Z,W=t8){let Y,X=t0.getTransfer(W);if(Z===j9)return J.UNSIGNED_BYTE;if(Z===PZ)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===AZ)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===pX)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===uX)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===fX)return J.BYTE;if(Z===gX)return J.SHORT;if(Z===v7)return J.UNSIGNED_SHORT;if(Z===wZ)return J.INT;if(Z===w8)return J.UNSIGNED_INT;if(Z===N9)return J.FLOAT;if(Z===wJ)return J.HALF_FLOAT;if(Z===dX)return J.ALPHA;if(Z===mX)return J.RGB;if(Z===o9)return J.RGBA;if(Z===o8)return J.DEPTH_COMPONENT;if(Z===a8)return J.DEPTH_STENCIL;if(Z===lX)return J.RED;if(Z===TZ)return J.RED_INTEGER;if(Z===r8)return J.RG;if(Z===SZ)return J.RG_INTEGER;if(Z===jZ)return J.RGBA_INTEGER;if(Z===AQ||Z===TQ||Z===SQ||Z===jQ)if(X===OJ)if(Y=Q.get("WEBGL_compressed_texture_s3tc_srgb"),Y!==null){if(Z===AQ)return Y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===TQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===SQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===jQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(Y=Q.get("WEBGL_compressed_texture_s3tc"),Y!==null){if(Z===AQ)return Y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===TQ)return Y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===SQ)return Y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===jQ)return Y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===vZ||Z===yZ||Z===xZ||Z===bZ)if(Y=Q.get("WEBGL_compressed_texture_pvrtc"),Y!==null){if(Z===vZ)return Y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===yZ)return Y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===xZ)return Y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===bZ)return Y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===hZ||Z===fZ||Z===gZ||Z===pZ||Z===uZ||Z===vQ||Z===dZ)if(Y=Q.get("WEBGL_compressed_texture_etc"),Y!==null){if(Z===hZ||Z===fZ)return X===OJ?Y.COMPRESSED_SRGB8_ETC2:Y.COMPRESSED_RGB8_ETC2;if(Z===gZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:Y.COMPRESSED_RGBA8_ETC2_EAC;if(Z===pZ)return Y.COMPRESSED_R11_EAC;if(Z===uZ)return Y.COMPRESSED_SIGNED_R11_EAC;if(Z===vQ)return Y.COMPRESSED_RG11_EAC;if(Z===dZ)return Y.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===mZ||Z===lZ||Z===cZ||Z===nZ||Z===sZ||Z===iZ||Z===oZ||Z===aZ||Z===rZ||Z===tZ||Z===eZ||Z===JW||Z===QW||Z===$W)if(Y=Q.get("WEBGL_compressed_texture_astc"),Y!==null){if(Z===mZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:Y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===lZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:Y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===cZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:Y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===nZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:Y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===sZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:Y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===iZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:Y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===oZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:Y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===aZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:Y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===rZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:Y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===tZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:Y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===eZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:Y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===JW)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:Y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===QW)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:Y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===$W)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:Y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===ZW||Z===WW||Z===YW)if(Y=Q.get("EXT_texture_compression_bptc"),Y!==null){if(Z===ZW)return X===OJ?Y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:Y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===WW)return Y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===YW)return Y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===XW||Z===KW||Z===yQ||Z===HW)if(Y=Q.get("EXT_texture_compression_rgtc"),Y!==null){if(Z===XW)return Y.COMPRESSED_RED_RGTC1_EXT;if(Z===KW)return Y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===yQ)return Y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===HW)return Y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===T6)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}var GD=`
4081
4081
  void main() {
4082
4082
 
4083
4083
  gl_Position = vec4( position, 1.0 );
4084
4084
 
4085
- }`,OF=`
4085
+ }`,ED=`
4086
4086
  uniform sampler2DArray depthColor;
4087
4087
  uniform float depthWidth;
4088
4088
  uniform float depthHeight;
@@ -4101,11 +4101,11 @@ void main() {
4101
4101
 
4102
4102
  }
4103
4103
 
4104
- }`;class $K{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new IQ(J.texture);if(J.depthNear!==Q.depthNear||J.depthFar!==Q.depthFar)this.depthNear=J.depthNear,this.depthFar=J.depthFar;this.texture=$}}getMesh(J){if(this.texture!==null){if(this.mesh===null){let Q=J.cameras[0].viewport,$=new OJ({vertexShader:NF,fragmentShader:OF,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new a0(new C9(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ZK extends v9{constructor(J,Q){super();let $=this,Z=null,W=1,Y=null,X="local-floor",K=1,H=null,U=null,G=null,F=null,E=null,O=null,R=typeof XRWebGLBinding<"u",C=new $K,q={},N=Q.getContextAttributes(),L=null,k=null,M=[],P=[],w=new T0,B=null,D=new BJ;D.viewport=new $J;let V=new BJ;V.viewport=new $J;let j=[D,V],z=new fZ,v=null,y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(s){let K0=M[s];if(K0===void 0)K0=new Z7,M[s]=K0;return K0.getTargetRaySpace()},this.getControllerGrip=function(s){let K0=M[s];if(K0===void 0)K0=new Z7,M[s]=K0;return K0.getGripSpace()},this.getHand=function(s){let K0=M[s];if(K0===void 0)K0=new Z7,M[s]=K0;return K0.getHandSpace()};function A(s){let K0=P.indexOf(s.inputSource);if(K0===-1)return;let D0=M[K0];if(D0!==void 0)D0.update(s.inputSource,s.frame,H||Y),D0.dispatchEvent({type:s.type,data:s.inputSource})}function x(){Z.removeEventListener("select",A),Z.removeEventListener("selectstart",A),Z.removeEventListener("selectend",A),Z.removeEventListener("squeeze",A),Z.removeEventListener("squeezestart",A),Z.removeEventListener("squeezeend",A),Z.removeEventListener("end",x),Z.removeEventListener("inputsourceschange",b);for(let s=0;s<M.length;s++){let K0=P[s];if(K0===null)continue;P[s]=null,M[s].disconnect(K0)}v=null,y=null,C.reset();for(let s in q)delete q[s];J.setRenderTarget(L),E=null,F=null,G=null,Z=null,k=null,v0.stop(),$.isPresenting=!1,J.setPixelRatio(B),J.setSize(w.width,w.height,!1),$.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(s){if(W=s,$.isPresenting===!0)C0("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(s){if(X=s,$.isPresenting===!0)C0("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return H||Y},this.setReferenceSpace=function(s){H=s},this.getBaseLayer=function(){return F!==null?F:E},this.getBinding=function(){if(G===null&&R)G=new XRWebGLBinding(Z,Q);return G},this.getFrame=function(){return O},this.getSession=function(){return Z},this.setSession=async function(s){if(Z=s,Z!==null){if(L=J.getRenderTarget(),Z.addEventListener("select",A),Z.addEventListener("selectstart",A),Z.addEventListener("selectend",A),Z.addEventListener("squeeze",A),Z.addEventListener("squeezestart",A),Z.addEventListener("squeezeend",A),Z.addEventListener("end",x),Z.addEventListener("inputsourceschange",b),N.xrCompatible!==!0)await Q.makeXRCompatible();if(B=J.getPixelRatio(),J.getSize(w),!(R&&("createProjectionLayer"in XRWebGLBinding.prototype))){let D0={antialias:N.antialias,alpha:!0,depth:N.depth,stencil:N.stencil,framebufferScaleFactor:W};E=new XRWebGLLayer(Z,Q,D0),Z.updateRenderState({baseLayer:E}),J.setPixelRatio(1),J.setSize(E.framebufferWidth,E.framebufferHeight,!1),k=new TJ(E.framebufferWidth,E.framebufferHeight,{format:j9,type:B9,colorSpace:J.outputColorSpace,stencilBuffer:N.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}else{let D0=null,E0=null,_0=null;if(N.depth)_0=N.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,D0=N.stencil?v8:j8,E0=N.stencil?q6:G8;let i0={colorFormat:Q.RGBA8,depthFormat:_0,scaleFactor:W};G=this.getBinding(),F=G.createProjectionLayer(i0),Z.updateRenderState({layers:[F]}),J.setPixelRatio(1),J.setSize(F.textureWidth,F.textureHeight,!1),k=new TJ(F.textureWidth,F.textureHeight,{format:j9,type:B9,depthTexture:new N8(F.textureWidth,F.textureHeight,E0,void 0,void 0,void 0,void 0,void 0,void 0,D0),stencilBuffer:N.stencil,colorSpace:J.outputColorSpace,samples:N.antialias?4:0,resolveDepthBuffer:F.ignoreDepthValues===!1,resolveStencilBuffer:F.ignoreDepthValues===!1})}k.isXRRenderTarget=!0,this.setFoveation(K),H=null,Y=await Z.requestReferenceSpace(X),v0.setContext(Z),v0.start(),$.isPresenting=!0,$.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Z!==null)return Z.environmentBlendMode},this.getDepthTexture=function(){return C.getDepthTexture()};function b(s){for(let K0=0;K0<s.removed.length;K0++){let D0=s.removed[K0],E0=P.indexOf(D0);if(E0>=0)P[E0]=null,M[E0].disconnect(D0)}for(let K0=0;K0<s.added.length;K0++){let D0=s.added[K0],E0=P.indexOf(D0);if(E0===-1){for(let i0=0;i0<M.length;i0++)if(i0>=P.length){P.push(D0),E0=i0;break}else if(P[i0]===null){P[i0]=D0,E0=i0;break}if(E0===-1)break}let _0=M[E0];if(_0)_0.connect(D0)}}let p=new S,c=new S;function o(s,K0,D0){p.setFromMatrixPosition(K0.matrixWorld),c.setFromMatrixPosition(D0.matrixWorld);let E0=p.distanceTo(c),_0=K0.projectionMatrix.elements,i0=D0.projectionMatrix.elements,y0=_0[14]/(_0[10]-1),d0=_0[14]/(_0[10]+1),UJ=(_0[9]+1)/_0[5],GJ=(_0[9]-1)/_0[5],m0=(_0[8]-1)/_0[0],xJ=(i0[8]+1)/i0[0],bJ=y0*m0,zJ=y0*xJ,f=E0/(-m0+xJ),uJ=f*-m0;if(K0.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(uJ),s.translateZ(f),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),_0[10]===-1)s.projectionMatrix.copy(K0.projectionMatrix),s.projectionMatrixInverse.copy(K0.projectionMatrixInverse);else{let r0=y0+f,e0=d0+f,R0=bJ-uJ,LJ=zJ+(E0-uJ),A0=UJ*d0/e0*r0,T=GJ*d0/e0*r0;s.projectionMatrix.makePerspective(R0,LJ,A0,T,r0,e0),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function Q0(s,K0){if(K0===null)s.matrixWorld.copy(s.matrix);else s.matrixWorld.multiplyMatrices(K0.matrixWorld,s.matrix);s.matrixWorldInverse.copy(s.matrixWorld).invert()}this.updateCamera=function(s){if(Z===null)return;let{near:K0,far:D0}=s;if(C.texture!==null){if(C.depthNear>0)K0=C.depthNear;if(C.depthFar>0)D0=C.depthFar}if(z.near=V.near=D.near=K0,z.far=V.far=D.far=D0,v!==z.near||y!==z.far)Z.updateRenderState({depthNear:z.near,depthFar:z.far}),v=z.near,y=z.far;z.layers.mask=s.layers.mask|6,D.layers.mask=z.layers.mask&-5,V.layers.mask=z.layers.mask&-3;let E0=s.parent,_0=z.cameras;Q0(z,E0);for(let i0=0;i0<_0.length;i0++)Q0(_0[i0],E0);if(_0.length===2)o(z,D,V);else z.projectionMatrix.copy(D.projectionMatrix);Y0(s,z,E0)};function Y0(s,K0,D0){if(D0===null)s.matrix.copy(K0.matrixWorld);else s.matrix.copy(D0.matrixWorld),s.matrix.invert(),s.matrix.multiply(K0.matrixWorld);if(s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(K0.projectionMatrix),s.projectionMatrixInverse.copy(K0.projectionMatrixInverse),s.isPerspectiveCamera)s.fov=z8*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1}this.getCamera=function(){return z},this.getFoveation=function(){if(F===null&&E===null)return;return K},this.setFoveation=function(s){if(K=s,F!==null)F.fixedFoveation=s;if(E!==null&&E.fixedFoveation!==void 0)E.fixedFoveation=s},this.hasDepthSensing=function(){return C.texture!==null},this.getDepthSensingMesh=function(){return C.getMesh(z)},this.getCameraTexture=function(s){return q[s]};let J0=null;function x0(s,K0){if(U=K0.getViewerPose(H||Y),O=K0,U!==null){let D0=U.views;if(E!==null)J.setRenderTargetFramebuffer(k,E.framebuffer),J.setRenderTarget(k);let E0=!1;if(D0.length!==z.cameras.length)z.cameras.length=0,E0=!0;for(let d0=0;d0<D0.length;d0++){let UJ=D0[d0],GJ=null;if(E!==null)GJ=E.getViewport(UJ);else{let xJ=G.getViewSubImage(F,UJ);if(GJ=xJ.viewport,d0===0)J.setRenderTargetTextures(k,xJ.colorTexture,xJ.depthStencilTexture),J.setRenderTarget(k)}let m0=j[d0];if(m0===void 0)m0=new BJ,m0.layers.enable(d0),m0.viewport=new $J,j[d0]=m0;if(m0.matrix.fromArray(UJ.transform.matrix),m0.matrix.decompose(m0.position,m0.quaternion,m0.scale),m0.projectionMatrix.fromArray(UJ.projectionMatrix),m0.projectionMatrixInverse.copy(m0.projectionMatrix).invert(),m0.viewport.set(GJ.x,GJ.y,GJ.width,GJ.height),d0===0)z.matrix.copy(m0.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale);if(E0===!0)z.cameras.push(m0)}let _0=Z.enabledFeatures;if(_0&&_0.includes("depth-sensing")&&Z.depthUsage=="gpu-optimized"&&R){G=$.getBinding();let d0=G.getDepthInformation(D0[0]);if(d0&&d0.isValid&&d0.texture)C.init(d0,Z.renderState)}if(_0&&_0.includes("camera-access")&&R){J.state.unbindTexture(),G=$.getBinding();for(let d0=0;d0<D0.length;d0++){let UJ=D0[d0].camera;if(UJ){let GJ=q[UJ];if(!GJ)GJ=new IQ,q[UJ]=GJ;let m0=G.getCameraImage(UJ);GJ.sourceTexture=m0}}}}for(let D0=0;D0<M.length;D0++){let E0=P[D0],_0=M[D0];if(E0!==null&&_0!==void 0)_0.update(E0,K0,H||Y)}if(J0)J0(s,K0);if(K0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:K0});O=null}let v0=new cX;v0.setAnimationLoop(x0),this.setAnimationLoop=function(s){J0=s},this.dispose=function(){}}}var qF=new j0,WK=new h0;WK.set(-1,0,0,0,1,0,0,0,1);function RF(J,Q){function $(q,N){if(q.matrixAutoUpdate===!0)q.updateMatrix();N.value.copy(q.matrix)}function Z(q,N){if(N.color.getRGB(q.fogColor.value,PZ(J)),N.isFog)q.fogNear.value=N.near,q.fogFar.value=N.far;else if(N.isFogExp2)q.fogDensity.value=N.density}function W(q,N,L,k,M){if(N.isNodeMaterial)N.uniformsNeedUpdate=!1;else if(N.isMeshBasicMaterial)Y(q,N);else if(N.isMeshLambertMaterial){if(Y(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshToonMaterial)Y(q,N),F(q,N);else if(N.isMeshPhongMaterial){if(Y(q,N),G(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshStandardMaterial){if(Y(q,N),E(q,N),N.isMeshPhysicalMaterial)O(q,N,M)}else if(N.isMeshMatcapMaterial)Y(q,N),R(q,N);else if(N.isMeshDepthMaterial)Y(q,N);else if(N.isMeshDistanceMaterial)Y(q,N),C(q,N);else if(N.isMeshNormalMaterial)Y(q,N);else if(N.isLineBasicMaterial){if(X(q,N),N.isLineDashedMaterial)K(q,N)}else if(N.isPointsMaterial)H(q,N,L,k);else if(N.isSpriteMaterial)U(q,N);else if(N.isShadowMaterial)q.color.value.copy(N.color),q.opacity.value=N.opacity;else if(N.isShaderMaterial)N.uniformsNeedUpdate=!1}function Y(q,N){if(q.opacity.value=N.opacity,N.color)q.diffuse.value.copy(N.color);if(N.emissive)q.emissive.value.copy(N.emissive).multiplyScalar(N.emissiveIntensity);if(N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.bumpMap){if(q.bumpMap.value=N.bumpMap,$(N.bumpMap,q.bumpMapTransform),q.bumpScale.value=N.bumpScale,N.side===yJ)q.bumpScale.value*=-1}if(N.normalMap){if(q.normalMap.value=N.normalMap,$(N.normalMap,q.normalMapTransform),q.normalScale.value.copy(N.normalScale),N.side===yJ)q.normalScale.value.negate()}if(N.displacementMap)q.displacementMap.value=N.displacementMap,$(N.displacementMap,q.displacementMapTransform),q.displacementScale.value=N.displacementScale,q.displacementBias.value=N.displacementBias;if(N.emissiveMap)q.emissiveMap.value=N.emissiveMap,$(N.emissiveMap,q.emissiveMapTransform);if(N.specularMap)q.specularMap.value=N.specularMap,$(N.specularMap,q.specularMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest;let L=Q.get(N),k=L.envMap,M=L.envMapRotation;if(k){if(q.envMap.value=k,q.envMapRotation.value.setFromMatrix4(qF.makeRotationFromEuler(M)).transpose(),k.isCubeTexture&&k.isRenderTargetTexture===!1)q.envMapRotation.value.premultiply(WK);q.reflectivity.value=N.reflectivity,q.ior.value=N.ior,q.refractionRatio.value=N.refractionRatio}if(N.lightMap)q.lightMap.value=N.lightMap,q.lightMapIntensity.value=N.lightMapIntensity,$(N.lightMap,q.lightMapTransform);if(N.aoMap)q.aoMap.value=N.aoMap,q.aoMapIntensity.value=N.aoMapIntensity,$(N.aoMap,q.aoMapTransform)}function X(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,N.map)q.map.value=N.map,$(N.map,q.mapTransform)}function K(q,N){q.dashSize.value=N.dashSize,q.totalSize.value=N.dashSize+N.gapSize,q.scale.value=N.scale}function H(q,N,L,k){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.size.value=N.size*L,q.scale.value=k*0.5,N.map)q.map.value=N.map,$(N.map,q.uvTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function U(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.rotation.value=N.rotation,N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function G(q,N){q.specular.value.copy(N.specular),q.shininess.value=Math.max(N.shininess,0.0001)}function F(q,N){if(N.gradientMap)q.gradientMap.value=N.gradientMap}function E(q,N){if(q.metalness.value=N.metalness,N.metalnessMap)q.metalnessMap.value=N.metalnessMap,$(N.metalnessMap,q.metalnessMapTransform);if(q.roughness.value=N.roughness,N.roughnessMap)q.roughnessMap.value=N.roughnessMap,$(N.roughnessMap,q.roughnessMapTransform);if(N.envMap)q.envMapIntensity.value=N.envMapIntensity}function O(q,N,L){if(q.ior.value=N.ior,N.sheen>0){if(q.sheenColor.value.copy(N.sheenColor).multiplyScalar(N.sheen),q.sheenRoughness.value=N.sheenRoughness,N.sheenColorMap)q.sheenColorMap.value=N.sheenColorMap,$(N.sheenColorMap,q.sheenColorMapTransform);if(N.sheenRoughnessMap)q.sheenRoughnessMap.value=N.sheenRoughnessMap,$(N.sheenRoughnessMap,q.sheenRoughnessMapTransform)}if(N.clearcoat>0){if(q.clearcoat.value=N.clearcoat,q.clearcoatRoughness.value=N.clearcoatRoughness,N.clearcoatMap)q.clearcoatMap.value=N.clearcoatMap,$(N.clearcoatMap,q.clearcoatMapTransform);if(N.clearcoatRoughnessMap)q.clearcoatRoughnessMap.value=N.clearcoatRoughnessMap,$(N.clearcoatRoughnessMap,q.clearcoatRoughnessMapTransform);if(N.clearcoatNormalMap){if(q.clearcoatNormalMap.value=N.clearcoatNormalMap,$(N.clearcoatNormalMap,q.clearcoatNormalMapTransform),q.clearcoatNormalScale.value.copy(N.clearcoatNormalScale),N.side===yJ)q.clearcoatNormalScale.value.negate()}}if(N.dispersion>0)q.dispersion.value=N.dispersion;if(N.iridescence>0){if(q.iridescence.value=N.iridescence,q.iridescenceIOR.value=N.iridescenceIOR,q.iridescenceThicknessMinimum.value=N.iridescenceThicknessRange[0],q.iridescenceThicknessMaximum.value=N.iridescenceThicknessRange[1],N.iridescenceMap)q.iridescenceMap.value=N.iridescenceMap,$(N.iridescenceMap,q.iridescenceMapTransform);if(N.iridescenceThicknessMap)q.iridescenceThicknessMap.value=N.iridescenceThicknessMap,$(N.iridescenceThicknessMap,q.iridescenceThicknessMapTransform)}if(N.transmission>0){if(q.transmission.value=N.transmission,q.transmissionSamplerMap.value=L.texture,q.transmissionSamplerSize.value.set(L.width,L.height),N.transmissionMap)q.transmissionMap.value=N.transmissionMap,$(N.transmissionMap,q.transmissionMapTransform);if(q.thickness.value=N.thickness,N.thicknessMap)q.thicknessMap.value=N.thicknessMap,$(N.thicknessMap,q.thicknessMapTransform);q.attenuationDistance.value=N.attenuationDistance,q.attenuationColor.value.copy(N.attenuationColor)}if(N.anisotropy>0){if(q.anisotropyVector.value.set(N.anisotropy*Math.cos(N.anisotropyRotation),N.anisotropy*Math.sin(N.anisotropyRotation)),N.anisotropyMap)q.anisotropyMap.value=N.anisotropyMap,$(N.anisotropyMap,q.anisotropyMapTransform)}if(q.specularIntensity.value=N.specularIntensity,q.specularColor.value.copy(N.specularColor),N.specularColorMap)q.specularColorMap.value=N.specularColorMap,$(N.specularColorMap,q.specularColorMapTransform);if(N.specularIntensityMap)q.specularIntensityMap.value=N.specularIntensityMap,$(N.specularIntensityMap,q.specularIntensityMapTransform)}function R(q,N){if(N.matcap)q.matcap.value=N.matcap}function C(q,N){let L=Q.get(N).light;q.referencePosition.value.setFromMatrixPosition(L.matrixWorld),q.nearDistance.value=L.shadow.camera.near,q.farDistance.value=L.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function LF(J,Q,$,Z){let W={},Y={},X=[],K=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function H(L,k){let M=k.program;Z.uniformBlockBinding(L,M)}function U(L,k){let M=W[L.id];if(M===void 0)R(L),M=G(L),W[L.id]=M,L.addEventListener("dispose",q);let P=k.program;Z.updateUBOMapping(L,P);let w=Q.render.frame;if(Y[L.id]!==w)E(L),Y[L.id]=w}function G(L){let k=F();L.__bindingPointIndex=k;let M=J.createBuffer(),P=L.__size,w=L.usage;return J.bindBuffer(J.UNIFORM_BUFFER,M),J.bufferData(J.UNIFORM_BUFFER,P,w),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,k,M),M}function F(){for(let L=0;L<K;L++)if(X.indexOf(L)===-1)return X.push(L),L;return S0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(L){let k=W[L.id],M=L.uniforms,P=L.__cache;J.bindBuffer(J.UNIFORM_BUFFER,k);for(let w=0,B=M.length;w<B;w++){let D=Array.isArray(M[w])?M[w]:[M[w]];for(let V=0,j=D.length;V<j;V++){let z=D[V];if(O(z,w,V,P)===!0){let v=z.__offset,y=Array.isArray(z.value)?z.value:[z.value],A=0;for(let x=0;x<y.length;x++){let b=y[x],p=C(b);if(typeof b==="number"||typeof b==="boolean")z.__data[0]=b,J.bufferSubData(J.UNIFORM_BUFFER,v+A,z.__data);else if(b.isMatrix3)z.__data[0]=b.elements[0],z.__data[1]=b.elements[1],z.__data[2]=b.elements[2],z.__data[3]=0,z.__data[4]=b.elements[3],z.__data[5]=b.elements[4],z.__data[6]=b.elements[5],z.__data[7]=0,z.__data[8]=b.elements[6],z.__data[9]=b.elements[7],z.__data[10]=b.elements[8],z.__data[11]=0;else if(ArrayBuffer.isView(b))z.__data.set(new b.constructor(b.buffer,b.byteOffset,z.__data.length));else b.toArray(z.__data,A),A+=p.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,v,z.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function O(L,k,M,P){let w=L.value,B=k+"_"+M;if(P[B]===void 0){if(typeof w==="number"||typeof w==="boolean")P[B]=w;else if(ArrayBuffer.isView(w))P[B]=w.slice();else P[B]=w.clone();return!0}else{let D=P[B];if(typeof w==="number"||typeof w==="boolean"){if(D!==w)return P[B]=w,!0}else if(ArrayBuffer.isView(w))return!0;else if(D.equals(w)===!1)return D.copy(w),!0}return!1}function R(L){let k=L.uniforms,M=0,P=16;for(let B=0,D=k.length;B<D;B++){let V=Array.isArray(k[B])?k[B]:[k[B]];for(let j=0,z=V.length;j<z;j++){let v=V[j],y=Array.isArray(v.value)?v.value:[v.value];for(let A=0,x=y.length;A<x;A++){let b=y[A],p=C(b),c=M%P,o=c%p.boundary,Q0=c+o;if(M+=o,Q0!==0&&P-Q0<p.storage)M+=P-Q0;v.__data=new Float32Array(p.storage/Float32Array.BYTES_PER_ELEMENT),v.__offset=M,M+=p.storage}}}let w=M%P;if(w>0)M+=P-w;return L.__size=M,L.__cache={},this}function C(L){let k={boundary:0,storage:0};if(typeof L==="number"||typeof L==="boolean")k.boundary=4,k.storage=4;else if(L.isVector2)k.boundary=8,k.storage=8;else if(L.isVector3||L.isColor)k.boundary=16,k.storage=12;else if(L.isVector4)k.boundary=16,k.storage=16;else if(L.isMatrix3)k.boundary=48,k.storage=48;else if(L.isMatrix4)k.boundary=64,k.storage=64;else if(L.isTexture)C0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(L))k.boundary=16,k.storage=L.byteLength;else C0("WebGLRenderer: Unsupported uniform value type.",L);return k}function q(L){let k=L.target;k.removeEventListener("dispose",q);let M=X.indexOf(k.__bindingPointIndex);X.splice(M,1),J.deleteBuffer(W[k.id]),delete W[k.id],delete Y[k.id]}function N(){for(let L in W)J.deleteBuffer(W[L]);X=[],W={},Y={}}return{bind:H,update:U,dispose:N}}var DF=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),b9=null;function kF(){if(b9===null)b9=new B6(DF,16,16,y8,kJ),b9.name="DFG_LUT",b9.minFilter=CJ,b9.magFilter=CJ,b9.wrapS=N6,b9.wrapT=N6,b9.generateMipmaps=!1,b9.needsUpdate=!0;return b9}class JW{constructor(J={}){let{canvas:Q=EX(),context:$=null,depth:Z=!0,stencil:W=!1,alpha:Y=!1,antialias:X=!1,premultipliedAlpha:K=!0,preserveDrawingBuffer:H=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:G=!1,reversedDepthBuffer:F=!1,outputBufferType:E=B9}=J;this.isWebGLRenderer=!0;let O;if($!==null){if(typeof WebGLRenderingContext<"u"&&$ instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");O=$.getContextAttributes().alpha}else O=Y;let R=E,C=new Set([f$,h$,b$]),q=new Set([B9,G8,J7,q6,y$,x$]),N=new Uint32Array(4),L=new Int32Array(4),k=new S,M=null,P=null,w=[],B=[],D=null;this.domElement=Q,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Q9,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let V=this,j=!1,z=null;this._outputColorSpace=E8;let v=0,y=0,A=null,x=-1,b=null,p=new $J,c=new $J,o=null,Q0=new X0(0),Y0=0,J0=Q.width,x0=Q.height,v0=1,s=null,K0=null,D0=new $J(0,0,J0,x0),E0=new $J(0,0,J0,x0),_0=!1,i0=new h8,y0=!1,d0=!1,UJ=new j0,GJ=new S,m0=new $J,xJ={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},bJ=!1;function zJ(){return A===null?v0:1}let f=$;function uJ(_,g){return Q.getContext(_,g)}try{let _={alpha:!0,depth:Z,stencil:W,antialias:X,premultipliedAlpha:K,preserveDrawingBuffer:H,powerPreference:U,failIfMajorPerformanceCaveat:G};if("setAttribute"in Q)Q.setAttribute("data-engine",`three.js r${LY}`);if(Q.addEventListener("webglcontextlost",B0,!1),Q.addEventListener("webglcontextrestored",e,!1),Q.addEventListener("webglcontextcreationerror",z0,!1),f===null){if(f=uJ("webgl2",_),f===null)if(uJ("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(_){throw S0("WebGLRenderer: "+_.message),_}let r0,e0,R0,LJ,A0,T,I,u,r,t,$0,F0,n,a,U0,V0,W0,N0,b0,p0,n0,h,H0;function i(){if(r0=new _E(f),r0.init(),n0=new FF(f,r0),e0=new DE(f,r0,J,n0),R0=new GF(f,r0),e0.reversedDepthBuffer&&F)R0.buffers.depth.setReversed(!0);LJ=new TE(f),A0=new a1,T=new EF(f,r0,R0,A0,e0,n0,LJ),I=new zE(V),u=new vU(f),h=new RE(f,u),r=new wE(f,u,LJ,h),t=new SE(f,r,u,h,LJ),N0=new AE(f,e0,T),U0=new kE(A0),$0=new o1(V,I,r0,e0,h,U0),F0=new RF(V,A0),n=new t1,a=new WF(r0),W0=new qE(V,I,R0,t,O,K),V0=new UF(V,t,e0),H0=new LF(f,LJ,e0,R0),b0=new LE(f,r0,LJ),p0=new PE(f,r0,LJ),LJ.programs=$0.programs,V.capabilities=e0,V.extensions=r0,V.properties=A0,V.renderLists=n,V.shadowMap=V0,V.state=R0,V.info=LJ}if(i(),R!==B9)D=new vE(R,Q.width,Q.height,Z,W);let Z0=new ZK(V,f);this.xr=Z0,this.getContext=function(){return f},this.getContextAttributes=function(){return f.getContextAttributes()},this.forceContextLoss=function(){let _=r0.get("WEBGL_lose_context");if(_)_.loseContext()},this.forceContextRestore=function(){let _=r0.get("WEBGL_lose_context");if(_)_.restoreContext()},this.getPixelRatio=function(){return v0},this.setPixelRatio=function(_){if(_===void 0)return;v0=_,this.setSize(J0,x0,!1)},this.getSize=function(_){return _.set(J0,x0)},this.setSize=function(_,g,l=!0){if(Z0.isPresenting){C0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(J0=_,x0=g,Q.width=Math.floor(_*v0),Q.height=Math.floor(g*v0),l===!0)Q.style.width=_+"px",Q.style.height=g+"px";if(D!==null)D.setSize(Q.width,Q.height);this.setViewport(0,0,_,g)},this.getDrawingBufferSize=function(_){return _.set(J0*v0,x0*v0).floor()},this.setDrawingBufferSize=function(_,g,l){J0=_,x0=g,v0=l,Q.width=Math.floor(_*l),Q.height=Math.floor(g*l),this.setViewport(0,0,_,g)},this.setEffects=function(_){if(R===B9){S0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(_){for(let g=0;g<_.length;g++)if(_[g].isOutputPass===!0){C0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}D.setEffects(_||[])},this.getCurrentViewport=function(_){return _.copy(p)},this.getViewport=function(_){return _.copy(D0)},this.setViewport=function(_,g,l,d){if(_.isVector4)D0.set(_.x,_.y,_.z,_.w);else D0.set(_,g,l,d);R0.viewport(p.copy(D0).multiplyScalar(v0).round())},this.getScissor=function(_){return _.copy(E0)},this.setScissor=function(_,g,l,d){if(_.isVector4)E0.set(_.x,_.y,_.z,_.w);else E0.set(_,g,l,d);R0.scissor(c.copy(E0).multiplyScalar(v0).round())},this.getScissorTest=function(){return _0},this.setScissorTest=function(_){R0.setScissorTest(_0=_)},this.setOpaqueSort=function(_){s=_},this.setTransparentSort=function(_){K0=_},this.getClearColor=function(_){return _.copy(W0.getClearColor())},this.setClearColor=function(){W0.setClearColor(...arguments)},this.getClearAlpha=function(){return W0.getClearAlpha()},this.setClearAlpha=function(){W0.setClearAlpha(...arguments)},this.clear=function(_=!0,g=!0,l=!0){let d=0;if(_){let m=!1;if(A!==null){let L0=A.texture.format;m=C.has(L0)}if(m){let L0=A.texture.type,M0=q.has(L0),O0=W0.getClearColor(),I0=W0.getClearAlpha(),w0=O0.r,g0=O0.g,s0=O0.b;if(M0)N[0]=w0,N[1]=g0,N[2]=s0,N[3]=I0,f.clearBufferuiv(f.COLOR,0,N);else L[0]=w0,L[1]=g0,L[2]=s0,L[3]=I0,f.clearBufferiv(f.COLOR,0,L)}else d|=f.COLOR_BUFFER_BIT}if(g)d|=f.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(l)d|=f.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(d!==0)f.clear(d)},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.setNodesHandler=function(_){_.setRenderer(this),z=_},this.dispose=function(){Q.removeEventListener("webglcontextlost",B0,!1),Q.removeEventListener("webglcontextrestored",e,!1),Q.removeEventListener("webglcontextcreationerror",z0,!1),W0.dispose(),n.dispose(),a.dispose(),A0.dispose(),I.dispose(),t.dispose(),h.dispose(),H0.dispose(),$0.dispose(),Z0.dispose(),Z0.removeEventListener("sessionstart",zW),Z0.removeEventListener("sessionend",_W),M8.stop()};function B0(_){_.preventDefault(),c6("WebGLRenderer: Context Lost."),j=!0}function e(){c6("WebGLRenderer: Context Restored."),j=!1;let _=LJ.autoReset,g=V0.enabled,l=V0.autoUpdate,d=V0.needsUpdate,m=V0.type;i(),LJ.autoReset=_,V0.enabled=g,V0.autoUpdate=l,V0.needsUpdate=d,V0.type=m}function z0(_){S0("WebGLRenderer: A WebGL context could not be created. Reason: ",_.statusMessage)}function f0(_){let g=_.target;g.removeEventListener("dispose",f0),_J(g)}function _J(_){XJ(_),A0.remove(_)}function XJ(_){let g=A0.get(_).programs;if(g!==void 0){if(g.forEach(function(l){$0.releaseProgram(l)}),_.isShaderMaterial)$0.releaseShaderCache(_)}}this.renderBufferDirect=function(_,g,l,d,m,L0){if(g===null)g=xJ;let M0=m.isMesh&&m.matrixWorld.determinant()<0,O0=BH(_,g,l,d,m);R0.setMaterial(d,M0);let I0=l.index,w0=1;if(d.wireframe===!0){if(I0=r.getWireframeAttribute(l),I0===void 0)return;w0=2}let g0=l.drawRange,s0=l.attributes.position,P0=g0.start*w0,KJ=(g0.start+g0.count)*w0;if(L0!==null)P0=Math.max(P0,L0.start*w0),KJ=Math.min(KJ,(L0.start+L0.count)*w0);if(I0!==null)P0=Math.max(P0,0),KJ=Math.min(KJ,I0.count);else if(s0!==void 0&&s0!==null)P0=Math.max(P0,0),KJ=Math.min(KJ,s0.count);let MJ=KJ-P0;if(MJ<0||MJ===1/0)return;h.setup(m,d,O0,l,I0);let DJ,EJ=b0;if(I0!==null)DJ=u.get(I0),EJ=p0,EJ.setIndex(DJ);if(m.isMesh)if(d.wireframe===!0)R0.setLineWidth(d.wireframeLinewidth*zJ()),EJ.setMode(f.LINES);else EJ.setMode(f.TRIANGLES);else if(m.isLine){let hJ=d.linewidth;if(hJ===void 0)hJ=1;if(R0.setLineWidth(hJ*zJ()),m.isLineSegments)EJ.setMode(f.LINES);else if(m.isLineLoop)EJ.setMode(f.LINE_LOOP);else EJ.setMode(f.LINE_STRIP)}else if(m.isPoints)EJ.setMode(f.POINTS);else if(m.isSprite)EJ.setMode(f.TRIANGLES);if(m.isBatchedMesh)if(!r0.get("WEBGL_multi_draw")){let{_multiDrawStarts:hJ,_multiDrawCounts:k0,_multiDrawCount:tJ}=m,t0=I0?u.get(I0).bytesPerElement:1,W9=A0.get(d).currentProgram.getUniforms();for(let _9=0;_9<tJ;_9++)W9.setValue(f,"_gl_DrawID",_9),EJ.render(hJ[_9]/t0,k0[_9])}else EJ.renderMultiDraw(m._multiDrawStarts,m._multiDrawCounts,m._multiDrawCount);else if(m.isInstancedMesh)EJ.renderInstances(P0,MJ,m.count);else if(l.isInstancedBufferGeometry){let hJ=l._maxInstanceCount!==void 0?l._maxInstanceCount:1/0,k0=Math.min(l.instanceCount,hJ);EJ.renderInstances(P0,MJ,k0)}else EJ.render(P0,MJ)};function z9(_,g,l){if(_.transparent===!0&&_.side===sJ&&_.forceSinglePass===!1)_.side=yJ,_.needsUpdate=!0,w7(_,g,l),_.side=A9,_.needsUpdate=!0,w7(_,g,l),_.side=sJ;else w7(_,g,l)}this.compile=function(_,g,l=null){if(l===null)l=_;if(P=a.get(l),P.init(g),B.push(P),l.traverseVisible(function(m){if(m.isLight&&m.layers.test(g.layers)){if(P.pushLight(m),m.castShadow)P.pushShadow(m)}}),_!==l)_.traverseVisible(function(m){if(m.isLight&&m.layers.test(g.layers)){if(P.pushLight(m),m.castShadow)P.pushShadow(m)}});P.setupLights();let d=new Set;return _.traverse(function(m){if(!(m.isMesh||m.isPoints||m.isLine||m.isSprite))return;let L0=m.material;if(L0)if(Array.isArray(L0))for(let M0=0;M0<L0.length;M0++){let O0=L0[M0];z9(O0,l,m),d.add(O0)}else z9(L0,l,m),d.add(L0)}),P=B.pop(),d},this.compileAsync=function(_,g,l=null){let d=this.compile(_,g,l);return new Promise((m)=>{function L0(){if(d.forEach(function(M0){if(A0.get(M0).currentProgram.isReady())d.delete(M0)}),d.size===0){m(_);return}setTimeout(L0,10)}if(r0.get("KHR_parallel_shader_compile")!==null)L0();else setTimeout(L0,10)})};let O9=null;function MH(_){if(O9)O9(_)}function zW(){M8.stop()}function _W(){M8.start()}let M8=new cX;if(M8.setAnimationLoop(MH),typeof self<"u")M8.setContext(self);this.setAnimationLoop=function(_){O9=_,Z0.setAnimationLoop(_),_===null?M8.stop():M8.start()},Z0.addEventListener("sessionstart",zW),Z0.addEventListener("sessionend",_W),this.render=function(_,g){if(g!==void 0&&g.isCamera!==!0){S0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(j===!0)return;if(z!==null)z.renderStart(_,g);let l=Z0.enabled===!0&&Z0.isPresenting===!0,d=D!==null&&(A===null||l)&&D.begin(V,A);if(_.matrixWorldAutoUpdate===!0)_.updateMatrixWorld();if(g.parent===null&&g.matrixWorldAutoUpdate===!0)g.updateMatrixWorld();if(Z0.enabled===!0&&Z0.isPresenting===!0&&(D===null||D.isCompositing()===!1)){if(Z0.cameraAutoUpdate===!0)Z0.updateCamera(g);g=Z0.getCamera()}if(_.isScene===!0)_.onBeforeRender(V,_,g,A);if(P=a.get(_,B.length),P.init(g),P.state.textureUnits=T.getTextureUnits(),B.push(P),UJ.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),i0.setFromProjectionMatrix(UJ,MZ,g.reversedDepth),d0=this.localClippingEnabled,y0=U0.init(this.clippingPlanes,d0),M=n.get(_,w.length),M.init(),w.push(M),Z0.enabled===!0&&Z0.isPresenting===!0){let M0=V.xr.getDepthSensingMesh();if(M0!==null)tQ(M0,g,-1/0,V.sortObjects)}if(tQ(_,g,0,V.sortObjects),M.finish(),V.sortObjects===!0)M.sort(s,K0);if(bJ=Z0.enabled===!1||Z0.isPresenting===!1||Z0.hasDepthSensing()===!1,bJ)W0.addToRenderList(M,_);if(this.info.render.frame++,y0===!0)U0.beginShadows();let m=P.state.shadowsArray;if(V0.render(m,_,g),y0===!0)U0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((d&&D.hasRenderPass())===!1){let{opaque:M0,transmissive:O0}=M;if(P.setupLights(),g.isArrayCamera){let I0=g.cameras;if(O0.length>0)for(let w0=0,g0=I0.length;w0<g0;w0++){let s0=I0[w0];PW(M0,O0,_,s0)}if(bJ)W0.render(_);for(let w0=0,g0=I0.length;w0<g0;w0++){let s0=I0[w0];wW(M,_,s0,s0.viewport)}}else{if(O0.length>0)PW(M0,O0,_,g);if(bJ)W0.render(_);wW(M,_,g)}}if(A!==null&&y===0)T.updateMultisampleRenderTarget(A),T.updateRenderTargetMipmap(A);if(d)D.end(V);if(_.isScene===!0)_.onAfterRender(V,_,g);if(h.resetDefaultState(),x=-1,b=null,B.pop(),B.length>0){if(P=B[B.length-1],T.setTextureUnits(P.state.textureUnits),y0===!0)U0.setGlobalState(V.clippingPlanes,P.state.camera)}else P=null;if(w.pop(),w.length>0)M=w[w.length-1];else M=null;if(z!==null)z.renderEnd()};function tQ(_,g,l,d){if(_.visible===!1)return;if(_.layers.test(g.layers)){if(_.isGroup)l=_.renderOrder;else if(_.isLOD){if(_.autoUpdate===!0)_.update(g)}else if(_.isLightProbeGrid)P.pushLightProbeGrid(_);else if(_.isLight){if(P.pushLight(_),_.castShadow)P.pushShadow(_)}else if(_.isSprite){if(!_.frustumCulled||i0.intersectsSprite(_)){if(d)m0.setFromMatrixPosition(_.matrixWorld).applyMatrix4(UJ);let M0=t.update(_),O0=_.material;if(O0.visible)M.push(_,M0,O0,l,m0.z,null)}}else if(_.isMesh||_.isLine||_.isPoints){if(!_.frustumCulled||i0.intersectsObject(_)){let M0=t.update(_),O0=_.material;if(d){if(_.boundingSphere!==void 0){if(_.boundingSphere===null)_.computeBoundingSphere();m0.copy(_.boundingSphere.center)}else{if(M0.boundingSphere===null)M0.computeBoundingSphere();m0.copy(M0.boundingSphere.center)}m0.applyMatrix4(_.matrixWorld).applyMatrix4(UJ)}if(Array.isArray(O0)){let I0=M0.groups;for(let w0=0,g0=I0.length;w0<g0;w0++){let s0=I0[w0],P0=O0[s0.materialIndex];if(P0&&P0.visible)M.push(_,M0,P0,l,m0.z,s0)}}else if(O0.visible)M.push(_,M0,O0,l,m0.z,null)}}}let L0=_.children;for(let M0=0,O0=L0.length;M0<O0;M0++)tQ(L0[M0],g,l,d)}function wW(_,g,l,d){let{opaque:m,transmissive:L0,transparent:M0}=_;if(P.setupLightsView(l),y0===!0)U0.setGlobalState(V.clippingPlanes,l);if(d)R0.viewport(p.copy(d));if(m.length>0)_7(m,g,l);if(L0.length>0)_7(L0,g,l);if(M0.length>0)_7(M0,g,l);R0.buffers.depth.setTest(!0),R0.buffers.depth.setMask(!0),R0.buffers.color.setMask(!0),R0.setPolygonOffset(!1)}function PW(_,g,l,d){if((l.isScene===!0?l.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[d.id]===void 0){let P0=r0.has("EXT_color_buffer_half_float")||r0.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[d.id]=new TJ(1,1,{generateMipmaps:!0,type:P0?kJ:B9,minFilter:S9,samples:Math.max(4,e0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:u0.workingColorSpace})}let L0=P.state.transmissionRenderTarget[d.id],M0=d.viewport||p;L0.setSize(M0.z*V.transmissionResolutionScale,M0.w*V.transmissionResolutionScale);let O0=V.getRenderTarget(),I0=V.getActiveCubeFace(),w0=V.getActiveMipmapLevel();if(V.setRenderTarget(L0),V.getClearColor(Q0),Y0=V.getClearAlpha(),Y0<1)V.setClearColor(16777215,0.5);if(V.clear(),bJ)W0.render(l);let g0=V.toneMapping;V.toneMapping=Q9;let s0=d.viewport;if(d.viewport!==void 0)d.viewport=void 0;if(P.setupLightsView(d),y0===!0)U0.setGlobalState(V.clippingPlanes,d);if(_7(_,l,d),T.updateMultisampleRenderTarget(L0),T.updateRenderTargetMipmap(L0),r0.has("WEBGL_multisampled_render_to_texture")===!1){let P0=!1;for(let KJ=0,MJ=g.length;KJ<MJ;KJ++){let DJ=g[KJ],{object:EJ,geometry:hJ,material:k0,group:tJ}=DJ;if(k0.side===sJ&&EJ.layers.test(d.layers)){let t0=k0.side;k0.side=yJ,k0.needsUpdate=!0,TW(EJ,l,d,hJ,k0,tJ),k0.side=t0,k0.needsUpdate=!0,P0=!0}}if(P0===!0)T.updateMultisampleRenderTarget(L0),T.updateRenderTargetMipmap(L0)}if(V.setRenderTarget(O0,I0,w0),V.setClearColor(Q0,Y0),s0!==void 0)d.viewport=s0;V.toneMapping=g0}function _7(_,g,l){let d=g.isScene===!0?g.overrideMaterial:null;for(let m=0,L0=_.length;m<L0;m++){let M0=_[m],{object:O0,geometry:I0,group:w0}=M0,g0=M0.material;if(g0.allowOverride===!0&&d!==null)g0=d;if(O0.layers.test(l.layers))TW(O0,g,l,I0,g0,w0)}}function TW(_,g,l,d,m,L0){if(_.onBeforeRender(V,g,l,d,m,L0),_.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,_.matrixWorld),_.normalMatrix.getNormalMatrix(_.modelViewMatrix),m.onBeforeRender(V,g,l,d,_,L0),m.transparent===!0&&m.side===sJ&&m.forceSinglePass===!1)m.side=yJ,m.needsUpdate=!0,V.renderBufferDirect(l,g,d,m,_,L0),m.side=A9,m.needsUpdate=!0,V.renderBufferDirect(l,g,d,m,_,L0),m.side=sJ;else V.renderBufferDirect(l,g,d,m,_,L0);_.onAfterRender(V,g,l,d,m,L0)}function w7(_,g,l){if(g.isScene!==!0)g=xJ;let d=A0.get(_),m=P.state.lights,L0=P.state.shadowsArray,M0=m.state.version,O0=$0.getParameters(_,m.state,L0,g,l,P.state.lightProbeGridArray),I0=$0.getProgramCacheKey(O0),w0=d.programs;d.environment=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?g.environment:null,d.fog=g.fog;let g0=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap;if(d.envMap=I.get(_.envMap||d.environment,g0),d.envMapRotation=d.environment!==null&&_.envMap===null?g.environmentRotation:_.envMapRotation,w0===void 0)_.addEventListener("dispose",f0),w0=new Map,d.programs=w0;let s0=w0.get(I0);if(s0!==void 0){if(d.currentProgram===s0&&d.lightsStateVersion===M0)return SW(_,O0),s0}else{if(O0.uniforms=$0.getUniforms(_),z!==null&&_.isNodeMaterial)z.build(_,l,O0);_.onBeforeCompile(O0,V),s0=$0.acquireProgram(O0,I0),w0.set(I0,s0),d.uniforms=O0.uniforms}let P0=d.uniforms;if(!_.isShaderMaterial&&!_.isRawShaderMaterial||_.clipping===!0)P0.clippingPlanes=U0.uniform;if(SW(_,O0),d.needsLights=IH(_),d.lightsStateVersion=M0,d.needsLights)P0.ambientLightColor.value=m.state.ambient,P0.lightProbe.value=m.state.probe,P0.directionalLights.value=m.state.directional,P0.directionalLightShadows.value=m.state.directionalShadow,P0.spotLights.value=m.state.spot,P0.spotLightShadows.value=m.state.spotShadow,P0.rectAreaLights.value=m.state.rectArea,P0.ltc_1.value=m.state.rectAreaLTC1,P0.ltc_2.value=m.state.rectAreaLTC2,P0.pointLights.value=m.state.point,P0.pointLightShadows.value=m.state.pointShadow,P0.hemisphereLights.value=m.state.hemi,P0.directionalShadowMatrix.value=m.state.directionalShadowMatrix,P0.spotLightMatrix.value=m.state.spotLightMatrix,P0.spotLightMap.value=m.state.spotLightMap,P0.pointShadowMatrix.value=m.state.pointShadowMatrix;return d.lightProbeGrid=P.state.lightProbeGridArray.length>0,d.currentProgram=s0,d.uniformsList=null,s0}function AW(_){if(_.uniformsList===null){let g=_.currentProgram.getUniforms();_.uniformsList=D7.seqWithValue(g.seq,_.uniforms)}return _.uniformsList}function SW(_,g){let l=A0.get(_);l.outputColorSpace=g.outputColorSpace,l.batching=g.batching,l.batchingColor=g.batchingColor,l.instancing=g.instancing,l.instancingColor=g.instancingColor,l.instancingMorph=g.instancingMorph,l.skinning=g.skinning,l.morphTargets=g.morphTargets,l.morphNormals=g.morphNormals,l.morphColors=g.morphColors,l.morphTargetsCount=g.morphTargetsCount,l.numClippingPlanes=g.numClippingPlanes,l.numIntersection=g.numClipIntersection,l.vertexAlphas=g.vertexAlphas,l.vertexTangents=g.vertexTangents,l.toneMapping=g.toneMapping}function VH(_,g){if(_.length===0)return null;if(_.length===1)return _[0].texture!==null?_[0]:null;k.setFromMatrixPosition(g.matrixWorld);for(let l=0,d=_.length;l<d;l++){let m=_[l];if(m.texture!==null&&m.boundingBox.containsPoint(k))return m}return null}function BH(_,g,l,d,m){if(g.isScene!==!0)g=xJ;T.resetTextureUnits();let L0=g.fog,M0=d.isMeshStandardMaterial||d.isMeshLambertMaterial||d.isMeshPhongMaterial?g.environment:null,O0=A===null?V.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:u0.workingColorSpace,I0=d.isMeshStandardMaterial||d.isMeshLambertMaterial&&!d.envMap||d.isMeshPhongMaterial&&!d.envMap,w0=I.get(d.envMap||M0,I0),g0=d.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,s0=!!l.attributes.tangent&&(!!d.normalMap||d.anisotropy>0),P0=!!l.morphAttributes.position,KJ=!!l.morphAttributes.normal,MJ=!!l.morphAttributes.color,DJ=Q9;if(d.toneMapped){if(A===null||A.isXRRenderTarget===!0)DJ=V.toneMapping}let EJ=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,hJ=EJ!==void 0?EJ.length:0,k0=A0.get(d),tJ=P.state.lights;if(y0===!0){if(d0===!0||_!==b){let NJ=_===b&&d.id===x;U0.setState(d,_,NJ)}}let t0=!1;if(d.version===k0.__version){if(k0.needsLights&&k0.lightsStateVersion!==tJ.state.version)t0=!0;else if(k0.outputColorSpace!==O0)t0=!0;else if(m.isBatchedMesh&&k0.batching===!1)t0=!0;else if(!m.isBatchedMesh&&k0.batching===!0)t0=!0;else if(m.isBatchedMesh&&k0.batchingColor===!0&&m.colorTexture===null)t0=!0;else if(m.isBatchedMesh&&k0.batchingColor===!1&&m.colorTexture!==null)t0=!0;else if(m.isInstancedMesh&&k0.instancing===!1)t0=!0;else if(!m.isInstancedMesh&&k0.instancing===!0)t0=!0;else if(m.isSkinnedMesh&&k0.skinning===!1)t0=!0;else if(!m.isSkinnedMesh&&k0.skinning===!0)t0=!0;else if(m.isInstancedMesh&&k0.instancingColor===!0&&m.instanceColor===null)t0=!0;else if(m.isInstancedMesh&&k0.instancingColor===!1&&m.instanceColor!==null)t0=!0;else if(m.isInstancedMesh&&k0.instancingMorph===!0&&m.morphTexture===null)t0=!0;else if(m.isInstancedMesh&&k0.instancingMorph===!1&&m.morphTexture!==null)t0=!0;else if(k0.envMap!==w0)t0=!0;else if(d.fog===!0&&k0.fog!==L0)t0=!0;else if(k0.numClippingPlanes!==void 0&&(k0.numClippingPlanes!==U0.numPlanes||k0.numIntersection!==U0.numIntersection))t0=!0;else if(k0.vertexAlphas!==g0)t0=!0;else if(k0.vertexTangents!==s0)t0=!0;else if(k0.morphTargets!==P0)t0=!0;else if(k0.morphNormals!==KJ)t0=!0;else if(k0.morphColors!==MJ)t0=!0;else if(k0.toneMapping!==DJ)t0=!0;else if(k0.morphTargetsCount!==hJ)t0=!0;else if(!!k0.lightProbeGrid!==P.state.lightProbeGridArray.length>0)t0=!0}else t0=!0,k0.__version=d.version;let W9=k0.currentProgram;if(t0===!0){if(W9=w7(d,g,m),z&&d.isNodeMaterial)z.onUpdateProgram(d,W9,k0)}let _9=!1,J8=!1,l8=!1,FJ=W9.getUniforms(),VJ=k0.uniforms;if(R0.useProgram(W9.program))_9=!0,J8=!0,l8=!0;if(d.id!==x)x=d.id,J8=!0;if(k0.needsLights){let NJ=VH(P.state.lightProbeGridArray,m);if(k0.lightProbeGrid!==NJ)k0.lightProbeGrid=NJ,J8=!0}if(_9||b!==_){if(R0.buffers.depth.getReversed()&&_.reversedDepth!==!0)_._reversedDepth=!0,_.updateProjectionMatrix();FJ.setValue(f,"projectionMatrix",_.projectionMatrix),FJ.setValue(f,"viewMatrix",_.matrixWorldInverse);let $8=FJ.map.cameraPosition;if($8!==void 0)$8.setValue(f,GJ.setFromMatrixPosition(_.matrixWorld));if(e0.logarithmicDepthBuffer)FJ.setValue(f,"logDepthBufFC",2/(Math.log(_.far+1)/Math.LN2));if(d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshLambertMaterial||d.isMeshBasicMaterial||d.isMeshStandardMaterial||d.isShaderMaterial)FJ.setValue(f,"isOrthographic",_.isOrthographicCamera===!0);if(b!==_)b=_,J8=!0,l8=!0}if(k0.needsLights){if(tJ.state.directionalShadowMap.length>0)FJ.setValue(f,"directionalShadowMap",tJ.state.directionalShadowMap,T);if(tJ.state.spotShadowMap.length>0)FJ.setValue(f,"spotShadowMap",tJ.state.spotShadowMap,T);if(tJ.state.pointShadowMap.length>0)FJ.setValue(f,"pointShadowMap",tJ.state.pointShadowMap,T)}if(m.isSkinnedMesh){FJ.setOptional(f,m,"bindMatrix"),FJ.setOptional(f,m,"bindMatrixInverse");let NJ=m.skeleton;if(NJ){if(NJ.boneTexture===null)NJ.computeBoneTexture();FJ.setValue(f,"boneTexture",NJ.boneTexture,T)}}if(m.isBatchedMesh){if(FJ.setOptional(f,m,"batchingTexture"),FJ.setValue(f,"batchingTexture",m._matricesTexture,T),FJ.setOptional(f,m,"batchingIdTexture"),FJ.setValue(f,"batchingIdTexture",m._indirectTexture,T),FJ.setOptional(f,m,"batchingColorTexture"),m._colorsTexture!==null)FJ.setValue(f,"batchingColorTexture",m._colorsTexture,T)}let Q8=l.morphAttributes;if(Q8.position!==void 0||Q8.normal!==void 0||Q8.color!==void 0)N0.update(m,l,W9);if(J8||k0.receiveShadow!==m.receiveShadow)k0.receiveShadow=m.receiveShadow,FJ.setValue(f,"receiveShadow",m.receiveShadow);if((d.isMeshStandardMaterial||d.isMeshLambertMaterial||d.isMeshPhongMaterial)&&d.envMap===null&&g.environment!==null)VJ.envMapIntensity.value=g.environmentIntensity;if(VJ.dfgLUT!==void 0)VJ.dfgLUT.value=kF();if(J8){if(FJ.setValue(f,"toneMappingExposure",V.toneMappingExposure),k0.needsLights)CH(VJ,l8);if(L0&&d.fog===!0)F0.refreshFogUniforms(VJ,L0);if(F0.refreshMaterialUniforms(VJ,d,v0,x0,P.state.transmissionRenderTarget[_.id]),k0.needsLights&&k0.lightProbeGrid){let NJ=k0.lightProbeGrid;VJ.probesSH.value=NJ.texture,VJ.probesMin.value.copy(NJ.boundingBox.min),VJ.probesMax.value.copy(NJ.boundingBox.max),VJ.probesResolution.value.copy(NJ.resolution)}D7.upload(f,AW(k0),VJ,T)}if(d.isShaderMaterial&&d.uniformsNeedUpdate===!0)D7.upload(f,AW(k0),VJ,T),d.uniformsNeedUpdate=!1;if(d.isSpriteMaterial)FJ.setValue(f,"center",m.center);if(FJ.setValue(f,"modelViewMatrix",m.modelViewMatrix),FJ.setValue(f,"normalMatrix",m.normalMatrix),FJ.setValue(f,"modelMatrix",m.matrixWorld),d.uniformsGroups!==void 0){let NJ=d.uniformsGroups;for(let $8=0,c8=NJ.length;$8<c8;$8++){let jW=NJ[$8];H0.update(jW,W9),H0.bind(jW,W9)}}return W9}function CH(_,g){_.ambientLightColor.needsUpdate=g,_.lightProbe.needsUpdate=g,_.directionalLights.needsUpdate=g,_.directionalLightShadows.needsUpdate=g,_.pointLights.needsUpdate=g,_.pointLightShadows.needsUpdate=g,_.spotLights.needsUpdate=g,_.spotLightShadows.needsUpdate=g,_.rectAreaLights.needsUpdate=g,_.hemisphereLights.needsUpdate=g}function IH(_){return _.isMeshLambertMaterial||_.isMeshToonMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isShadowMaterial||_.isShaderMaterial&&_.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(_,g,l){let d=A0.get(_);if(d.__autoAllocateDepthBuffer=_.resolveDepthBuffer===!1,d.__autoAllocateDepthBuffer===!1)d.__useRenderToTexture=!1;A0.get(_.texture).__webglTexture=g,A0.get(_.depthTexture).__webglTexture=d.__autoAllocateDepthBuffer?void 0:l,d.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(_,g){let l=A0.get(_);l.__webglFramebuffer=g,l.__useDefaultFramebuffer=g===void 0};let zH=f.createFramebuffer();this.setRenderTarget=function(_,g=0,l=0){A=_,v=g,y=l;let d=null,m=!1,L0=!1;if(_){let O0=A0.get(_);if(O0.__useDefaultFramebuffer!==void 0){R0.bindFramebuffer(f.FRAMEBUFFER,O0.__webglFramebuffer),p.copy(_.viewport),c.copy(_.scissor),o=_.scissorTest,R0.viewport(p),R0.scissor(c),R0.setScissorTest(o),x=-1;return}else if(O0.__webglFramebuffer===void 0)T.setupRenderTarget(_);else if(O0.__hasExternalTextures)T.rebindTextures(_,A0.get(_.texture).__webglTexture,A0.get(_.depthTexture).__webglTexture);else if(_.depthBuffer){let g0=_.depthTexture;if(O0.__boundDepthTexture!==g0){if(g0!==null&&A0.has(g0)&&(_.width!==g0.image.width||_.height!==g0.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");T.setupDepthRenderbuffer(_)}}let I0=_.texture;if(I0.isData3DTexture||I0.isDataArrayTexture||I0.isCompressedArrayTexture)L0=!0;let w0=A0.get(_).__webglFramebuffer;if(_.isWebGLCubeRenderTarget){if(Array.isArray(w0[g]))d=w0[g][l];else d=w0[g];m=!0}else if(_.samples>0&&T.useMultisampledRTT(_)===!1)d=A0.get(_).__webglMultisampledFramebuffer;else if(Array.isArray(w0))d=w0[l];else d=w0;p.copy(_.viewport),c.copy(_.scissor),o=_.scissorTest}else p.copy(D0).multiplyScalar(v0).floor(),c.copy(E0).multiplyScalar(v0).floor(),o=_0;if(l!==0)d=zH;if(R0.bindFramebuffer(f.FRAMEBUFFER,d))R0.drawBuffers(_,d);if(R0.viewport(p),R0.scissor(c),R0.setScissorTest(o),m){let O0=A0.get(_.texture);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+g,O0.__webglTexture,l)}else if(L0){let O0=g;for(let I0=0;I0<_.textures.length;I0++){let w0=A0.get(_.textures[I0]);f.framebufferTextureLayer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0+I0,w0.__webglTexture,l,O0)}}else if(_!==null&&l!==0){let O0=A0.get(_.texture);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,O0.__webglTexture,l)}x=-1},this.readRenderTargetPixels=function(_,g,l,d,m,L0,M0,O0=0){if(!(_&&_.isWebGLRenderTarget)){S0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let I0=A0.get(_).__webglFramebuffer;if(_.isWebGLCubeRenderTarget&&M0!==void 0)I0=I0[M0];if(I0){R0.bindFramebuffer(f.FRAMEBUFFER,I0);try{let w0=_.textures[O0],g0=w0.format,s0=w0.type;if(_.textures.length>1)f.readBuffer(f.COLOR_ATTACHMENT0+O0);if(!e0.textureFormatReadable(g0)){S0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!e0.textureTypeReadable(s0)){S0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(g>=0&&g<=_.width-d&&(l>=0&&l<=_.height-m))f.readPixels(g,l,d,m,n0.convert(g0),n0.convert(s0),L0)}finally{let w0=A!==null?A0.get(A).__webglFramebuffer:null;R0.bindFramebuffer(f.FRAMEBUFFER,w0)}}},this.readRenderTargetPixelsAsync=async function(_,g,l,d,m,L0,M0,O0=0){if(!(_&&_.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let I0=A0.get(_).__webglFramebuffer;if(_.isWebGLCubeRenderTarget&&M0!==void 0)I0=I0[M0];if(I0)if(g>=0&&g<=_.width-d&&(l>=0&&l<=_.height-m)){R0.bindFramebuffer(f.FRAMEBUFFER,I0);let w0=_.textures[O0],g0=w0.format,s0=w0.type;if(_.textures.length>1)f.readBuffer(f.COLOR_ATTACHMENT0+O0);if(!e0.textureFormatReadable(g0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!e0.textureTypeReadable(s0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let P0=f.createBuffer();f.bindBuffer(f.PIXEL_PACK_BUFFER,P0),f.bufferData(f.PIXEL_PACK_BUFFER,L0.byteLength,f.STREAM_READ),f.readPixels(g,l,d,m,n0.convert(g0),n0.convert(s0),0);let KJ=A!==null?A0.get(A).__webglFramebuffer:null;R0.bindFramebuffer(f.FRAMEBUFFER,KJ);let MJ=f.fenceSync(f.SYNC_GPU_COMMANDS_COMPLETE,0);return f.flush(),await NX(f,MJ,4),f.bindBuffer(f.PIXEL_PACK_BUFFER,P0),f.getBufferSubData(f.PIXEL_PACK_BUFFER,0,L0),f.deleteBuffer(P0),f.deleteSync(MJ),L0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(_,g=null,l=0){let d=Math.pow(2,-l),m=Math.floor(_.image.width*d),L0=Math.floor(_.image.height*d),M0=g!==null?g.x:0,O0=g!==null?g.y:0;T.setTexture2D(_,0),f.copyTexSubImage2D(f.TEXTURE_2D,l,0,0,M0,O0,m,L0),R0.unbindTexture()};let _H=f.createFramebuffer(),wH=f.createFramebuffer();if(this.copyTextureToTexture=function(_,g,l=null,d=null,m=0,L0=0){let M0,O0,I0,w0,g0,s0,P0,KJ,MJ,DJ=_.isCompressedTexture?_.mipmaps[L0]:_.image;if(l!==null)M0=l.max.x-l.min.x,O0=l.max.y-l.min.y,I0=l.isBox3?l.max.z-l.min.z:1,w0=l.min.x,g0=l.min.y,s0=l.isBox3?l.min.z:0;else{let VJ=Math.pow(2,-m);if(M0=Math.floor(DJ.width*VJ),O0=Math.floor(DJ.height*VJ),_.isDataArrayTexture)I0=DJ.depth;else if(_.isData3DTexture)I0=Math.floor(DJ.depth*VJ);else I0=1;w0=0,g0=0,s0=0}if(d!==null)P0=d.x,KJ=d.y,MJ=d.z;else P0=0,KJ=0,MJ=0;let EJ=n0.convert(g.format),hJ=n0.convert(g.type),k0;if(g.isData3DTexture)T.setTexture3D(g,0),k0=f.TEXTURE_3D;else if(g.isDataArrayTexture||g.isCompressedArrayTexture)T.setTexture2DArray(g,0),k0=f.TEXTURE_2D_ARRAY;else T.setTexture2D(g,0),k0=f.TEXTURE_2D;R0.activeTexture(f.TEXTURE0),R0.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,g.flipY),R0.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),R0.pixelStorei(f.UNPACK_ALIGNMENT,g.unpackAlignment);let tJ=R0.getParameter(f.UNPACK_ROW_LENGTH),t0=R0.getParameter(f.UNPACK_IMAGE_HEIGHT),W9=R0.getParameter(f.UNPACK_SKIP_PIXELS),_9=R0.getParameter(f.UNPACK_SKIP_ROWS),J8=R0.getParameter(f.UNPACK_SKIP_IMAGES);R0.pixelStorei(f.UNPACK_ROW_LENGTH,DJ.width),R0.pixelStorei(f.UNPACK_IMAGE_HEIGHT,DJ.height),R0.pixelStorei(f.UNPACK_SKIP_PIXELS,w0),R0.pixelStorei(f.UNPACK_SKIP_ROWS,g0),R0.pixelStorei(f.UNPACK_SKIP_IMAGES,s0);let l8=_.isDataArrayTexture||_.isData3DTexture,FJ=g.isDataArrayTexture||g.isData3DTexture;if(_.isDepthTexture){let VJ=A0.get(_),Q8=A0.get(g),NJ=A0.get(VJ.__renderTarget),$8=A0.get(Q8.__renderTarget);R0.bindFramebuffer(f.READ_FRAMEBUFFER,NJ.__webglFramebuffer),R0.bindFramebuffer(f.DRAW_FRAMEBUFFER,$8.__webglFramebuffer);for(let c8=0;c8<I0;c8++){if(l8)f.framebufferTextureLayer(f.READ_FRAMEBUFFER,f.COLOR_ATTACHMENT0,A0.get(_).__webglTexture,m,s0+c8),f.framebufferTextureLayer(f.DRAW_FRAMEBUFFER,f.COLOR_ATTACHMENT0,A0.get(g).__webglTexture,L0,MJ+c8);f.blitFramebuffer(w0,g0,M0,O0,P0,KJ,M0,O0,f.DEPTH_BUFFER_BIT,f.NEAREST)}R0.bindFramebuffer(f.READ_FRAMEBUFFER,null),R0.bindFramebuffer(f.DRAW_FRAMEBUFFER,null)}else if(m!==0||_.isRenderTargetTexture||A0.has(_)){let VJ=A0.get(_),Q8=A0.get(g);R0.bindFramebuffer(f.READ_FRAMEBUFFER,_H),R0.bindFramebuffer(f.DRAW_FRAMEBUFFER,wH);for(let NJ=0;NJ<I0;NJ++){if(l8)f.framebufferTextureLayer(f.READ_FRAMEBUFFER,f.COLOR_ATTACHMENT0,VJ.__webglTexture,m,s0+NJ);else f.framebufferTexture2D(f.READ_FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,VJ.__webglTexture,m);if(FJ)f.framebufferTextureLayer(f.DRAW_FRAMEBUFFER,f.COLOR_ATTACHMENT0,Q8.__webglTexture,L0,MJ+NJ);else f.framebufferTexture2D(f.DRAW_FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,Q8.__webglTexture,L0);if(m!==0)f.blitFramebuffer(w0,g0,M0,O0,P0,KJ,M0,O0,f.COLOR_BUFFER_BIT,f.NEAREST);else if(FJ)f.copyTexSubImage3D(k0,L0,P0,KJ,MJ+NJ,w0,g0,M0,O0);else f.copyTexSubImage2D(k0,L0,P0,KJ,w0,g0,M0,O0)}R0.bindFramebuffer(f.READ_FRAMEBUFFER,null),R0.bindFramebuffer(f.DRAW_FRAMEBUFFER,null)}else if(FJ)if(_.isDataTexture||_.isData3DTexture)f.texSubImage3D(k0,L0,P0,KJ,MJ,M0,O0,I0,EJ,hJ,DJ.data);else if(g.isCompressedArrayTexture)f.compressedTexSubImage3D(k0,L0,P0,KJ,MJ,M0,O0,I0,EJ,DJ.data);else f.texSubImage3D(k0,L0,P0,KJ,MJ,M0,O0,I0,EJ,hJ,DJ);else if(_.isDataTexture)f.texSubImage2D(f.TEXTURE_2D,L0,P0,KJ,M0,O0,EJ,hJ,DJ.data);else if(_.isCompressedTexture)f.compressedTexSubImage2D(f.TEXTURE_2D,L0,P0,KJ,DJ.width,DJ.height,EJ,DJ.data);else f.texSubImage2D(f.TEXTURE_2D,L0,P0,KJ,M0,O0,EJ,hJ,DJ);if(R0.pixelStorei(f.UNPACK_ROW_LENGTH,tJ),R0.pixelStorei(f.UNPACK_IMAGE_HEIGHT,t0),R0.pixelStorei(f.UNPACK_SKIP_PIXELS,W9),R0.pixelStorei(f.UNPACK_SKIP_ROWS,_9),R0.pixelStorei(f.UNPACK_SKIP_IMAGES,J8),L0===0&&g.generateMipmaps)f.generateMipmap(k0);R0.unbindTexture()},this.initRenderTarget=function(_){if(A0.get(_).__webglFramebuffer===void 0)T.setupRenderTarget(_)},this.initTexture=function(_){if(_.isCubeTexture)T.setTextureCube(_,0);else if(_.isData3DTexture)T.setTexture3D(_,0);else if(_.isDataArrayTexture||_.isCompressedArrayTexture)T.setTexture2DArray(_,0);else T.setTexture2D(_,0);R0.unbindTexture()},this.resetState=function(){v=0,y=0,A=null,R0.reset(),h.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return MZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=u0._getDrawingBufferColorSpace(J),Q.unpackColorSpace=u0._getUnpackColorSpace()}}function q0(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J);return Number.isFinite($)?$:Q}function RJ(J,Q){if(J==null||J.trim()==="")return[...Q];let $=J.trim().split(/\s+/).map(Number);return[Number.isFinite($[0])?$[0]:Q[0],Number.isFinite($[1])?$[1]:Q[1],Number.isFinite($[2])?$[2]:Q[2]]}function YK(J){if(J==null||J.trim()==="")return[1,1,1];let Q=J.trim().split(/\s+/).map(Number);if(Q.length===1&&Number.isFinite(Q[0]))return[Q[0],Q[0],Q[0]];return RJ(J,[1,1,1])}function A6(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J.trim().replace(/deg$/i,""));return Number.isFinite($)?$:Q}function QW(J){return J*Math.PI/180}function XK(J){let Q=RJ(J,[0,0,0]);return[QW(Q[0]),QW(Q[1]),QW(Q[2])]}function G9(J,Q){if(J==null||J.trim()==="")return Q;return J.trim()}function I9(J,Q){return q0(J,Q)}function uQ(J){return(Q)=>Math.pow(Q,J)}function dQ(J){return(Q)=>1-Math.pow(1-Q,J)}function mQ(J){return(Q)=>Q<0.5?Math.pow(2*Q,J)/2:1-Math.pow(2*(1-Q),J)/2}var k7=1.70158,lQ={linear:(J)=>J,none:(J)=>J,"power1.in":uQ(2),"power1.out":dQ(2),"power1.inOut":mQ(2),"power2.in":uQ(3),"power2.out":dQ(3),"power2.inOut":mQ(3),"power3.in":uQ(4),"power3.out":dQ(4),"power3.inOut":mQ(4),"power4.in":uQ(5),"power4.out":dQ(5),"power4.inOut":mQ(5),"sine.in":(J)=>1-Math.cos(J*Math.PI/2),"sine.out":(J)=>Math.sin(J*Math.PI/2),"sine.inOut":(J)=>-(Math.cos(Math.PI*J)-1)/2,"expo.in":(J)=>J===0?0:Math.pow(2,10*J-10),"expo.out":(J)=>J===1?1:1-Math.pow(2,-10*J),"expo.inOut":(J)=>J===0?0:J===1?1:J<0.5?Math.pow(2,20*J-10)/2:(2-Math.pow(2,-20*J+10))/2,"circ.in":(J)=>1-Math.sqrt(1-J*J),"circ.out":(J)=>Math.sqrt(1-(J-1)*(J-1)),"circ.inOut":(J)=>J<0.5?(1-Math.sqrt(1-4*J*J))/2:(Math.sqrt(1-Math.pow(-2*J+2,2))+1)/2,"back.in":(J)=>J*J*((k7+1)*J-k7),"back.out":(J)=>{let Q=J-1;return Q*Q*((k7+1)*Q+k7)+1},"back.inOut":(J)=>{let Q=k7*1.525;return J<0.5?Math.pow(2*J,2)*((Q+1)*2*J-Q)/2:(Math.pow(2*J-2,2)*((Q+1)*(2*J-2)+Q)+2)/2},"elastic.out":(J)=>J===0?0:J===1?1:Math.pow(2,-10*J)*Math.sin((J*10-0.75)*(2*Math.PI)/3)+1,"bounce.out":(J)=>{if(J<0.36363636363636365)return 7.5625*J*J;if(J<0.7272727272727273){let W=J-0.5454545454545454;return 7.5625*W*W+0.75}if(J<0.9090909090909091){let W=J-0.8181818181818182;return 7.5625*W*W+0.9375}let Z=J-0.9545454545454546;return 7.5625*Z*Z+0.984375}};function cQ(J,Q="power1.out"){if(J){let $=lQ[J.trim()];if($)return $}return lQ[Q]??lQ.linear}var UR=Object.keys(lQ);function p8(J,Q){let $=Q.duration??0;if($<=0)return J<Q.start?0:1;let Z=(J-Q.start)/$;return Q.ease(Math.min(1,Math.max(0,Z)))}function $W(J,Q){return p8(J,Q)}function KK(J,Q,$){let Z=Math.max(0.000001,1-$);return Math.min(1,Math.max(0,(J-Q)/Z))}function HK(J,Q){return Math.max(0,J-Q.start)}function UK(J){return{start:J.start??0,duration:J.duration??void 0,ease:cQ(J.ease??null,J.defaultEase??"power1.out")}}function GK(J,Q,$){let Z=J.rotation[$.axis],W=$.rpm/60*Math.PI*2;return(Y)=>{J.rotation[$.axis]=Z+W*HK(Y,Q)}}function EK(J,Q,$){let Z=$.fromDeg*Math.PI/180,W=$.toDeg*Math.PI/180;return(Y)=>{let X=Z+(W-Z)*p8(Y,Q),K=$.center();J.position.x=K.x+$.radius*Math.sin(X),J.position.z=K.z+$.radius*Math.cos(X),J.position.y=K.y+$.height}}function FK(J,Q,$){let Z={x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=$.toward(),X=Y.x-Z.x,K=Y.y-Z.y,H=Y.z-Z.z,U=Math.sqrt(X*X+K*K+H*H)||1,G=$.distance*p8(W,Q);J.position.x=Z.x+X/U*G,J.position.y=Z.y+K/U*G,J.position.z=Z.z+H/U*G}}function NK(J,Q){let $={x:J.scale.x,y:J.scale.y,z:J.scale.z};return(Z)=>{let W=Z<Q.start?0:p8(Z,Q);J.scale.x=$.x*W,J.scale.y=$.y*W,J.scale.z=$.z*W}}function ZW(J,Q){return($)=>{J($<Q.start?0:p8($,Q))}}function OK(J,Q,$){let Z=$.from??{x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=p8(W,Q);J.position.x=Z.x+($.to.x-Z.x)*Y,J.position.y=Z.y+($.to.y-Z.y)*Y,J.position.z=Z.z+($.to.z-Z.z)*Y}}function qK(J,Q){return()=>{let $=Q.subject();J.position.x=$.x+Q.offset.x,J.position.y=$.y+Q.offset.y,J.position.z=$.z+Q.offset.z}}function RK(J,Q){return($)=>{let Z=$<Q.start?0:p8($,Q);J(1-Z,Z)}}function LK(J,Q,$){let Z=J.position.y,W=Math.PI*2/Math.max(0.0001,$.period);return(Y)=>{J.position.y=Z+$.amplitude*Math.sin(W*HK(Y,Q))}}var nQ=new S;function DK(J,Q){if(!Q)return null;if(Q==="camera")return J.camera;if(Q.startsWith("#"))return J.objectsById.get(Q.slice(1))??null;return null}function WW(J,Q){if(Q&&Q.startsWith("#")){let Z=J.objectsById.get(Q.slice(1));if(Z)return()=>{return Z.getWorldPosition(nQ),{x:nQ.x,y:nQ.y,z:nQ.z}}}let $=RJ(Q,[0,0,0]);return()=>({x:$[0],y:$[1],z:$[2]})}function BF(J){let Q=[],$=new Set;return J.traverse((Z)=>{let W=Z.material,Y=Array.isArray(W)?W:W?[W]:[];for(let X of Y){if($.has(X))continue;$.add(X),Q.push({material:X,baseOpacity:X.opacity,baseTransparent:X.transparent})}}),(Z)=>{for(let W of Q)W.material.opacity=W.baseOpacity*Z,W.material.transparent=Z<1?!0:W.baseTransparent}}function kK(J){let Q=[];for(let $ of Array.from(J.host.querySelectorAll("sf-animate"))){let Z=($.getAttribute("verb")??"").toLowerCase(),W={orbit:4,dolly:1.5,"bounce-in":0.6,"fade-in":0.6,move:2,"crossfade-clip":0.5,"camera-path":8,variant:0.8},Y=$.getAttribute("duration"),X=UK({start:I9($.getAttribute("start"),0),duration:Y?I9(Y,0):W[Z]??null,ease:$.getAttribute("ease"),defaultEase:Z==="bounce-in"?"back.out":"power1.out"});if(Z==="variant"){Q.push({el:$,timing:X});continue}let K=DK(J,$.getAttribute("target"));if(!K){let H=$.getAttribute("target")??"",U=H.startsWith("#")?document.querySelector(H):null;if(U&&(Z==="fade-in"||Z==="bounce-in")){let G=q0($.getAttribute("rise"),0);J.seekFns.push(ZW((F)=>{if(Z==="fade-in"){if(U.style.opacity=String(F),G!==0)U.style.transform=`translateY(${(1-F)*G}px)`}else U.style.opacity=F>0?"1":"0",U.style.transform=`scale(${F})`},X))}continue}if(Z==="turntable")J.seekFns.push(GK(K,X,{rpm:q0($.getAttribute("rpm"),6),axis:$.getAttribute("axis")??"y"}));else if(Z==="orbit"){let H=WW(J,$.getAttribute("around")),U=H(),G=K.position.x-U.x,F=K.position.z-U.z,E=Math.sqrt(G*G+F*F),O=Math.atan2(G,F)*180/Math.PI,R=A6($.getAttribute("from"),O);J.seekFns.push(EK(K,X,{center:H,radius:q0($.getAttribute("radius"),E||5),fromDeg:R,toDeg:A6($.getAttribute("to"),R+360),height:q0($.getAttribute("height"),K.position.y-U.y)}))}else if(Z==="dolly")J.seekFns.push(FK(K,X,{toward:WW(J,$.getAttribute("toward")),distance:q0($.getAttribute("distance"),1)}));else if(Z==="move"){let H=$.getAttribute("to");if(!H)continue;let U=RJ(H,[0,0,0]),G=$.getAttribute("from"),F=G?RJ(G,[0,0,0]):null;J.seekFns.push(OK(K,X,{from:F?{x:F[0],y:F[1],z:F[2]}:void 0,to:{x:U[0],y:U[1],z:U[2]}}))}else if(Z==="follow"){let H=WW(J,$.getAttribute("subject")),U=$.getAttribute("offset"),G;if(U){let F=RJ(U,[0,2,5]);G={x:F[0],y:F[1],z:F[2]}}else{let F=H();G={x:K.position.x-F.x,y:K.position.y-F.y,z:K.position.z-F.z}}J.lateSeekFns.push(qK(K,{subject:H,offset:G}))}else if(Z==="camera-path"){let H=($.getAttribute("points")??"").split(",").map((O)=>RJ(O.trim(),[Number.NaN,Number.NaN,Number.NaN])).filter((O)=>O.every(Number.isFinite)).map((O)=>new S(O[0],O[1],O[2]));if(H.length<2)continue;let U=new _Q(H,!1,"centripetal"),G=($.getAttribute("look")??"ahead").toLowerCase(),F=new S,E=new S;J.lateSeekFns.push((O)=>{let R=$W(O,X);if(U.getPointAt(Math.min(1,Math.max(0,R)),F),K.position.set(F.x,F.y,F.z),G==="ahead"){if(U.getPointAt(Math.min(1,Math.max(0,R)+0.02),E),E.distanceToSquared(F)<0.000000001)U.getPointAt(Math.max(0,R-0.02),E),E.lerpVectors(E,F,2);K.lookAt(E)}})}else if(Z==="crossfade-clip"){let H=J.actionsByObject.get(K),U=$.getAttribute("from"),G=$.getAttribute("to");if(!H||!U||!G)continue;let F=H.get(U),E=H.get(G);if(!F||!E)continue;J.seekFns.push(RK((O,R)=>{F.setEffectiveWeight(O),E.setEffectiveWeight(R)},X))}else if(Z==="bounce-in")J.seekFns.push(NK(K,X));else if(Z==="fade-in")J.seekFns.push(ZW(BF(K),X));else if(Z==="float")J.seekFns.push(LK(K,X,{amplitude:q0($.getAttribute("amplitude"),0.1),period:q0($.getAttribute("period"),4)}))}CF(J,Q)}function CF(J,Q){let $=new Map;for(let W of Q){let Y=`${W.el.getAttribute("target")??""}|${W.el.getAttribute("material")??"*"}`;($.get(Y)??$.set(Y,[]).get(Y)).push(W)}let Z=new X0;for(let W of $.values()){let Y=W[0],X=DK(J,Y.el.getAttribute("target"));if(!X)continue;let K=Y.el.getAttribute("material"),H=[],U=new Set;if(X.traverse((E)=>{let O=E.material;for(let R of Array.isArray(O)?O:O?[O]:[]){if(U.has(R))continue;if(U.add(R),!(R instanceof cJ))continue;if(K&&R.name!==K)continue;H.push(R)}}),H.length===0)continue;let G={color:H[0].color.clone(),roughness:H[0].roughness,metalness:H[0].metalness};J.seekFns.push(()=>{for(let E of H){if(E.color.copy(G.color),G.roughness!==null)E.roughness=G.roughness;if(G.metalness!==null)E.metalness=G.metalness}}),W.sort((E,O)=>E.timing.start-O.timing.start);let F=G;for(let{el:E,timing:O}of W){let R={color:E.getAttribute("color")?new X0(G9(E.getAttribute("color"),"#ffffff")):F.color.clone(),roughness:E.getAttribute("roughness")?q0(E.getAttribute("roughness"),0.5):F.roughness,metalness:E.getAttribute("metalness")?q0(E.getAttribute("metalness"),0):F.metalness},C=F;J.seekFns.push((q)=>{if(q<O.start)return;let N=$W(q,O);Z.lerpColors(C.color,R.color,N);for(let L of H){if(L.color.copy(Z),R.roughness!==null&&C.roughness!==null)L.roughness=C.roughness+(R.roughness-C.roughness)*N;if(R.metalness!==null&&C.metalness!==null)L.metalness=C.metalness+(R.metalness-C.metalness)*N}}),F=R}}}function YW(J,Q){if(Q===RZ)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===R6||Q===Q7){let $=J.getIndex();if($===null){let X=[],K=J.getAttribute("position");if(K!==void 0){for(let H=0;H<K.count;H++)X.push(H);J.setIndex(X),$=J.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),J}let Z=$.count-2,W=[];if(Q===R6)for(let X=1;X<=Z;X++)W.push($.getX(0)),W.push($.getX(X)),W.push($.getX(X+1));else for(let X=0;X<Z;X++)if(X%2===0)W.push($.getX(X)),W.push($.getX(X+1)),W.push($.getX(X+2));else W.push($.getX(X+2)),W.push($.getX(X+1)),W.push($.getX(X));if(W.length/3!==Z)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let Y=J.clone();return Y.setIndex(W),Y.clearGroups(),Y}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",Q),J}function MK(J){let Q=new Map,$=new Map,Z=J.clone();return VK(J,Z,function(W,Y){Q.set(Y,W),$.set(W,Y)}),Z.traverse(function(W){if(!W.isSkinnedMesh)return;let Y=W,X=Q.get(W),K=X.skeleton.bones;Y.skeleton=X.skeleton.clone(),Y.bindMatrix.copy(X.bindMatrix),Y.skeleton.bones=K.map(function(H){return $.get(H)}),Y.bind(Y.skeleton,Y.bindMatrix)}),Z}function VK(J,Q,$){$(J,Q);for(let Z=0;Z<J.children.length;Z++)VK(J.children[Z],Q.children[Z],$)}class FW extends y9{constructor(J){super(J);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(Q){return new TK(Q)}),this.register(function(Q){return new AK(Q)}),this.register(function(Q){return new gK(Q)}),this.register(function(Q){return new pK(Q)}),this.register(function(Q){return new uK(Q)}),this.register(function(Q){return new jK(Q)}),this.register(function(Q){return new vK(Q)}),this.register(function(Q){return new yK(Q)}),this.register(function(Q){return new xK(Q)}),this.register(function(Q){return new PK(Q)}),this.register(function(Q){return new bK(Q)}),this.register(function(Q){return new SK(Q)}),this.register(function(Q){return new fK(Q)}),this.register(function(Q){return new hK(Q)}),this.register(function(Q){return new _K(Q)}),this.register(function(Q){return new UW(Q,o0.EXT_MESHOPT_COMPRESSION)}),this.register(function(Q){return new UW(Q,o0.KHR_MESHOPT_COMPRESSION)}),this.register(function(Q){return new dK(Q)})}load(J,Q,$,Z){let W=this,Y;if(this.resourcePath!=="")Y=this.resourcePath;else if(this.path!==""){let H=L8.extractUrlBase(J);Y=L8.resolveURL(H,this.path)}else Y=L8.extractUrlBase(J);this.manager.itemStart(J);let X=function(H){if(Z)Z(H);else console.error(H);W.manager.itemError(J),W.manager.itemEnd(J)},K=new I6(this.manager);K.setPath(this.path),K.setResponseType("arraybuffer"),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(H){try{W.parse(H,Y,function(U){Q(U),W.manager.itemEnd(J)},X)}catch(U){X(U)}},$,X)}setDRACOLoader(J){return this.dracoLoader=J,this}setKTX2Loader(J){return this.ktx2Loader=J,this}setMeshoptDecoder(J){return this.meshoptDecoder=J,this}register(J){if(this.pluginCallbacks.indexOf(J)===-1)this.pluginCallbacks.push(J);return this}unregister(J){if(this.pluginCallbacks.indexOf(J)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(J),1);return this}parse(J,Q,$,Z){let W,Y={},X={},K=new TextDecoder;if(typeof J==="string")W=JSON.parse(J);else if(J instanceof ArrayBuffer)if(K.decode(new Uint8Array(J,0,4))===mK){try{Y[o0.KHR_BINARY_GLTF]=new lK(J)}catch(G){if(Z)Z(G);return}W=JSON.parse(Y[o0.KHR_BINARY_GLTF].content)}else W=JSON.parse(K.decode(J));else W=J;if(W.asset===void 0||W.asset.version[0]<2){if(Z)Z(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let H=new oK(W,{path:Q||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});H.fileLoader.setRequestHeader(this.requestHeader);for(let U=0;U<this.pluginCallbacks.length;U++){let G=this.pluginCallbacks[U](H);if(!G.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");X[G.name]=G,Y[G.name]=!0}if(W.extensionsUsed)for(let U=0;U<W.extensionsUsed.length;++U){let G=W.extensionsUsed[U],F=W.extensionsRequired||[];switch(G){case o0.KHR_MATERIALS_UNLIT:Y[G]=new wK;break;case o0.KHR_DRACO_MESH_COMPRESSION:Y[G]=new cK(W,this.dracoLoader);break;case o0.KHR_TEXTURE_TRANSFORM:Y[G]=new nK;break;case o0.KHR_MESH_QUANTIZATION:Y[G]=new sK;break;default:if(F.indexOf(G)>=0&&X[G]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+G+'".')}}H.setExtensions(Y),H.setPlugins(X),H.parse($,Z)}parseAsync(J,Q){let $=this;return new Promise(function(Z,W){$.parse(J,Q,Z,W)})}}function IF(){let J={};return{get:function(Q){return J[Q]},add:function(Q,$){J[Q]=$},remove:function(Q){delete J[Q]},removeAll:function(){J={}}}}function IJ(J,Q,$){let Z=J.json.materials[Q];if(Z.extensions&&Z.extensions[$])return Z.extensions[$];return null}var o0={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class _K{constructor(J){this.parser=J,this.name=o0.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let J=this.parser,Q=this.parser.json.nodes||[];for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(W.extensions&&W.extensions[this.name]&&W.extensions[this.name].light!==void 0)J._addNodeRef(this.cache,W.extensions[this.name].light)}}_loadLight(J){let Q=this.parser,$="light:"+J,Z=Q.cache.get($);if(Z)return Z;let W=Q.json,K=((W.extensions&&W.extensions[this.name]||{}).lights||[])[J],H,U=new X0(16777215);if(K.color!==void 0)U.setRGB(K.color[0],K.color[1],K.color[2],mJ);let G=K.range!==void 0?K.range:0;switch(K.type){case"directional":H=new x9(U),H.target.position.set(0,0,-1),H.add(H.target);break;case"point":H=new R8(U),H.distance=G;break;case"spot":H=new vQ(U),H.distance=G,K.spot=K.spot||{},K.spot.innerConeAngle=K.spot.innerConeAngle!==void 0?K.spot.innerConeAngle:0,K.spot.outerConeAngle=K.spot.outerConeAngle!==void 0?K.spot.outerConeAngle:Math.PI/4,H.angle=K.spot.outerConeAngle,H.penumbra=1-K.spot.innerConeAngle/K.spot.outerConeAngle,H.target.position.set(0,0,-1),H.add(H.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+K.type)}if(H.position.set(0,0,0),f9(H,K),K.intensity!==void 0)H.intensity=K.intensity;return H.name=Q.createUniqueName(K.name||"light_"+J),Z=Promise.resolve(H),Q.cache.add($,Z),Z}getDependency(J,Q){if(J!=="light")return;return this._loadLight(Q)}createNodeAttachment(J){let Q=this,$=this.parser,W=$.json.nodes[J],X=(W.extensions&&W.extensions[this.name]||{}).light;if(X===void 0)return null;return this._loadLight(X).then(function(K){return $._getNodeRef(Q.cache,X,K)})}}class wK{constructor(){this.name=o0.KHR_MATERIALS_UNLIT}getMaterialType(){return U9}extendParams(J,Q,$){let Z=[];J.color=new X0(1,1,1),J.opacity=1;let W=Q.pbrMetallicRoughness;if(W){if(Array.isArray(W.baseColorFactor)){let Y=W.baseColorFactor;J.color.setRGB(Y[0],Y[1],Y[2],mJ),J.opacity=Y[3]}if(W.baseColorTexture!==void 0)Z.push($.assignTexture(J,"map",W.baseColorTexture,E8))}return Promise.all(Z)}}class PK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();if($.emissiveStrength!==void 0)Q.emissiveIntensity=$.emissiveStrength;return Promise.resolve()}}class TK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_CLEARCOAT}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.clearcoatFactor!==void 0)Q.clearcoat=$.clearcoatFactor;if($.clearcoatTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatMap",$.clearcoatTexture));if($.clearcoatRoughnessFactor!==void 0)Q.clearcoatRoughness=$.clearcoatRoughnessFactor;if($.clearcoatRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatRoughnessMap",$.clearcoatRoughnessTexture));if($.clearcoatNormalTexture!==void 0){if(Z.push(this.parser.assignTexture(Q,"clearcoatNormalMap",$.clearcoatNormalTexture)),$.clearcoatNormalTexture.scale!==void 0){let W=$.clearcoatNormalTexture.scale;Q.clearcoatNormalScale=new T0(W,W)}}return Promise.all(Z)}}class AK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_DISPERSION}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();return Q.dispersion=$.dispersion!==void 0?$.dispersion:0,Promise.resolve()}}class SK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_IRIDESCENCE}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.iridescenceFactor!==void 0)Q.iridescence=$.iridescenceFactor;if($.iridescenceTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceMap",$.iridescenceTexture));if($.iridescenceIor!==void 0)Q.iridescenceIOR=$.iridescenceIor;if(Q.iridescenceThicknessRange===void 0)Q.iridescenceThicknessRange=[100,400];if($.iridescenceThicknessMinimum!==void 0)Q.iridescenceThicknessRange[0]=$.iridescenceThicknessMinimum;if($.iridescenceThicknessMaximum!==void 0)Q.iridescenceThicknessRange[1]=$.iridescenceThicknessMaximum;if($.iridescenceThicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceThicknessMap",$.iridescenceThicknessTexture));return Promise.all(Z)}}class jK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_SHEEN}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.sheenColor=new X0(0,0,0),Q.sheenRoughness=0,Q.sheen=1,$.sheenColorFactor!==void 0){let W=$.sheenColorFactor;Q.sheenColor.setRGB(W[0],W[1],W[2],mJ)}if($.sheenRoughnessFactor!==void 0)Q.sheenRoughness=$.sheenRoughnessFactor;if($.sheenColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenColorMap",$.sheenColorTexture,E8));if($.sheenRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenRoughnessMap",$.sheenRoughnessTexture));return Promise.all(Z)}}class vK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_TRANSMISSION}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.transmissionFactor!==void 0)Q.transmission=$.transmissionFactor;if($.transmissionTexture!==void 0)Z.push(this.parser.assignTexture(Q,"transmissionMap",$.transmissionTexture));return Promise.all(Z)}}class yK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_VOLUME}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.thickness=$.thicknessFactor!==void 0?$.thicknessFactor:0,$.thicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"thicknessMap",$.thicknessTexture));Q.attenuationDistance=$.attenuationDistance||1/0;let W=$.attenuationColor||[1,1,1];return Q.attenuationColor=new X0().setRGB(W[0],W[1],W[2],mJ),Promise.all(Z)}}class xK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_IOR}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();if(Q.ior=$.ior!==void 0?$.ior:1.5,Q.ior===0)Q.ior=1000;return Promise.resolve()}}class bK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_SPECULAR}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.specularIntensity=$.specularFactor!==void 0?$.specularFactor:1,$.specularTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularIntensityMap",$.specularTexture));let W=$.specularColorFactor||[1,1,1];if(Q.specularColor=new X0().setRGB(W[0],W[1],W[2],mJ),$.specularColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularColorMap",$.specularColorTexture,E8));return Promise.all(Z)}}class hK{constructor(J){this.parser=J,this.name=o0.EXT_MATERIALS_BUMP}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.bumpScale=$.bumpFactor!==void 0?$.bumpFactor:1,$.bumpTexture!==void 0)Z.push(this.parser.assignTexture(Q,"bumpMap",$.bumpTexture));return Promise.all(Z)}}class fK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_ANISOTROPY}getMaterialType(J){return IJ(this.parser,J,this.name)!==null?nJ:null}extendMaterialParams(J,Q){let $=IJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.anisotropyStrength!==void 0)Q.anisotropy=$.anisotropyStrength;if($.anisotropyRotation!==void 0)Q.anisotropyRotation=$.anisotropyRotation;if($.anisotropyTexture!==void 0)Z.push(this.parser.assignTexture(Q,"anisotropyMap",$.anisotropyTexture));return Promise.all(Z)}}class gK{constructor(J){this.parser=J,this.name=o0.KHR_TEXTURE_BASISU}loadTexture(J){let Q=this.parser,$=Q.json,Z=$.textures[J];if(!Z.extensions||!Z.extensions[this.name])return null;let W=Z.extensions[this.name],Y=Q.options.ktx2Loader;if(!Y)if($.extensionsRequired&&$.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return Q.loadTextureImage(J,W.source,Y)}}class pK{constructor(J){this.parser=J,this.name=o0.EXT_TEXTURE_WEBP}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class uK{constructor(J){this.parser=J,this.name=o0.EXT_TEXTURE_AVIF}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class UW{constructor(J,Q){this.name=Q,this.parser=J}loadBufferView(J){let Q=this.parser.json,$=Q.bufferViews[J];if($.extensions&&$.extensions[this.name]){let Z=$.extensions[this.name],W=this.parser.getDependency("buffer",Z.buffer),Y=this.parser.options.meshoptDecoder;if(!Y||!Y.supported)if(Q.extensionsRequired&&Q.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return W.then(function(X){let K=Z.byteOffset||0,H=Z.byteLength||0,U=Z.count,G=Z.byteStride,F=new Uint8Array(X,K,H);if(Y.decodeGltfBufferAsync)return Y.decodeGltfBufferAsync(U,G,F,Z.mode,Z.filter).then(function(E){return E.buffer});else return Y.ready.then(function(){let E=new ArrayBuffer(U*G);return Y.decodeGltfBuffer(new Uint8Array(E),U,G,F,Z.mode,Z.filter),E})})}else return null}}class dK{constructor(J){this.name=o0.EXT_MESH_GPU_INSTANCING,this.parser=J}createNodeMesh(J){let Q=this.parser.json,$=Q.nodes[J];if(!$.extensions||!$.extensions[this.name]||$.mesh===void 0)return null;let Z=Q.meshes[$.mesh];for(let H of Z.primitives)if(H.mode!==E9.TRIANGLES&&H.mode!==E9.TRIANGLE_STRIP&&H.mode!==E9.TRIANGLE_FAN&&H.mode!==void 0)return null;let Y=$.extensions[this.name].attributes,X=[],K={};for(let H in Y)X.push(this.parser.getDependency("accessor",Y[H]).then((U)=>{return K[H]=U,K[H]}));if(X.length<1)return null;return X.push(this.parser.createNodeMesh(J)),Promise.all(X).then((H)=>{let U=H.pop(),G=U.isGroup?U.children:[U],F=H[0].count,E=[];for(let O of G){let R=new j0,C=new S,q=new AJ,N=new S(1,1,1),L=new F8(O.geometry,O.material,F);for(let k=0;k<F;k++){if(K.TRANSLATION)C.fromBufferAttribute(K.TRANSLATION,k);if(K.ROTATION)q.fromBufferAttribute(K.ROTATION,k);if(K.SCALE)N.fromBufferAttribute(K.SCALE,k);L.setMatrixAt(k,R.compose(C,q,N))}for(let k in K)if(k==="_COLOR_0"){let M=K[k];L.instanceColor=new _8(M.array,M.itemSize,M.normalized)}else if(k!=="TRANSLATION"&&k!=="ROTATION"&&k!=="SCALE")O.geometry.setAttribute(k,K[k]);HJ.prototype.copy.call(L,O),this.parser.assignFinalMaterial(L),E.push(L)}if(U.isGroup)return U.clear(),U.add(...E),U;return E[0]})}}var mK="glTF",M7=12,BK={JSON:1313821514,BIN:5130562};class lK{constructor(J){this.name=o0.KHR_BINARY_GLTF,this.content=null,this.body=null;let Q=new DataView(J,0,M7),$=new TextDecoder;if(this.header={magic:$.decode(new Uint8Array(J.slice(0,4))),version:Q.getUint32(4,!0),length:Q.getUint32(8,!0)},this.header.magic!==mK)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let Z=this.header.length-M7,W=new DataView(J,M7),Y=0;while(Y<Z){let X=W.getUint32(Y,!0);Y+=4;let K=W.getUint32(Y,!0);if(Y+=4,K===BK.JSON){let H=new Uint8Array(J,M7+Y,X);this.content=$.decode(H)}else if(K===BK.BIN){let H=M7+Y;this.body=J.slice(H,H+X)}Y+=X}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class cK{constructor(J,Q){if(!Q)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=o0.KHR_DRACO_MESH_COMPRESSION,this.json=J,this.dracoLoader=Q,this.dracoLoader.preload()}decodePrimitive(J,Q){let $=this.json,Z=this.dracoLoader,W=J.extensions[this.name].bufferView,Y=J.extensions[this.name].attributes,X={},K={},H={};for(let U in Y){let G=GW[U]||U.toLowerCase();X[G]=Y[U]}for(let U in J.attributes){let G=GW[U]||U.toLowerCase();if(Y[U]!==void 0){let F=$.accessors[J.attributes[U]],E=S6[F.componentType];H[G]=E.name,K[G]=F.normalized===!0}}return Q.getDependency("bufferView",W).then(function(U){return new Promise(function(G,F){Z.decodeDracoFile(U,function(E){for(let O in E.attributes){let R=E.attributes[O],C=K[O];if(C!==void 0)R.normalized=C}G(E)},X,H,mJ,F)})})}}class nK{constructor(){this.name=o0.KHR_TEXTURE_TRANSFORM}extendTexture(J,Q){if((Q.texCoord===void 0||Q.texCoord===J.channel)&&Q.offset===void 0&&Q.rotation===void 0&&Q.scale===void 0)return J;if(J=J.clone(),Q.texCoord!==void 0)J.channel=Q.texCoord;if(Q.offset!==void 0)J.offset.fromArray(Q.offset);if(Q.rotation!==void 0)J.rotation=Q.rotation;if(Q.scale!==void 0)J.repeat.fromArray(Q.scale);return J.needsUpdate=!0,J}}class sK{constructor(){this.name=o0.KHR_MESH_QUANTIZATION}}class NW extends a9{constructor(J,Q,$,Z){super(J,Q,$,Z)}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z*3+Z;for(let Y=0;Y!==Z;Y++)Q[Y]=$[W+Y];return Q}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=X*2,H=X*3,U=Z-Q,G=($-Q)/U,F=G*G,E=F*G,O=J*H,R=O-H,C=-2*E+3*F,q=E-F,N=1-C,L=q-F+G;for(let k=0;k!==X;k++){let M=Y[R+k+X],P=Y[R+k+K]*U,w=Y[O+k+X],B=Y[O+k]*U;W[k]=N*M+L*P+C*w+q*B}return W}}var zF=new AJ;class iK extends NW{interpolate_(J,Q,$,Z){let W=super.interpolate_(J,Q,$,Z);return zF.fromArray(W).normalize().toArray(W),W}}var E9={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},S6={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},CK={9728:V9,9729:CJ,9984:XQ,9985:O6,9986:S8,9987:S9},IK={33071:N6,33648:YQ,10497:U8},XW={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},GW={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},k8={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},_F={CUBICSPLINE:void 0,LINEAR:NQ,STEP:qZ},KW={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function wF(J){if(J.DefaultMaterial===void 0)J.DefaultMaterial=new cJ({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:A9});return J.DefaultMaterial}function u8(J,Q,$){for(let Z in $.extensions)if(J[Z]===void 0)Q.userData.gltfExtensions=Q.userData.gltfExtensions||{},Q.userData.gltfExtensions[Z]=$.extensions[Z]}function f9(J,Q){if(Q.extras!==void 0)if(typeof Q.extras==="object")Object.assign(J.userData,Q.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+Q.extras)}function PF(J,Q,$){let Z=!1,W=!1,Y=!1;for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(F.POSITION!==void 0)Z=!0;if(F.NORMAL!==void 0)W=!0;if(F.COLOR_0!==void 0)Y=!0;if(Z&&W&&Y)break}if(!Z&&!W&&!Y)return Promise.resolve(J);let X=[],K=[],H=[];for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(Z){let E=F.POSITION!==void 0?$.getDependency("accessor",F.POSITION):J.attributes.position;X.push(E)}if(W){let E=F.NORMAL!==void 0?$.getDependency("accessor",F.NORMAL):J.attributes.normal;K.push(E)}if(Y){let E=F.COLOR_0!==void 0?$.getDependency("accessor",F.COLOR_0):J.attributes.color;H.push(E)}}return Promise.all([Promise.all(X),Promise.all(K),Promise.all(H)]).then(function(U){let G=U[0],F=U[1],E=U[2];if(Z)J.morphAttributes.position=G;if(W)J.morphAttributes.normal=F;if(Y)J.morphAttributes.color=E;return J.morphTargetsRelative=!0,J})}function TF(J,Q){if(J.updateMorphTargets(),Q.weights!==void 0)for(let $=0,Z=Q.weights.length;$<Z;$++)J.morphTargetInfluences[$]=Q.weights[$];if(Q.extras&&Array.isArray(Q.extras.targetNames)){let $=Q.extras.targetNames;if(J.morphTargetInfluences.length===$.length){J.morphTargetDictionary={};for(let Z=0,W=$.length;Z<W;Z++)J.morphTargetDictionary[$[Z]]=Z}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function AF(J){let Q,$=J.extensions&&J.extensions[o0.KHR_DRACO_MESH_COMPRESSION];if($)Q="draco:"+$.bufferView+":"+$.indices+":"+HW($.attributes);else Q=J.indices+":"+HW(J.attributes)+":"+J.mode;if(J.targets!==void 0)for(let Z=0,W=J.targets.length;Z<W;Z++)Q+=":"+HW(J.targets[Z]);return Q}function HW(J){let Q="",$=Object.keys(J).sort();for(let Z=0,W=$.length;Z<W;Z++)Q+=$[Z]+":"+J[$[Z]]+";";return Q}function EW(J){switch(J){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function SF(J){if(J.search(/\.jpe?g($|\?)/i)>0||J.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(J.search(/\.webp($|\?)/i)>0||J.search(/^data\:image\/webp/)===0)return"image/webp";if(J.search(/\.ktx2($|\?)/i)>0||J.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var jF=new j0;class oK{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new IF,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let $=!1,Z=-1,W=!1,Y=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let X=navigator.userAgent;$=/^((?!chrome|android).)*safari/i.test(X)===!0;let K=X.match(/Version\/(\d+)/);Z=$&&K?parseInt(K[1],10):-1,W=X.indexOf("Firefox")>-1,Y=W?X.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||$&&Z<17||W&&Y<98)this.textureLoader=new z6(this.options.manager);else this.textureLoader=new yQ(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new I6(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(J){this.extensions=J}setPlugins(J){this.plugins=J}parse(J,Q){let $=this,Z=this.json,W=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(Y){return Y._markDefs&&Y._markDefs()}),Promise.all(this._invokeAll(function(Y){return Y.beforeRoot&&Y.beforeRoot()})).then(function(){return Promise.all([$.getDependencies("scene"),$.getDependencies("animation"),$.getDependencies("camera")])}).then(function(Y){let X={scene:Y[0][Z.scene||0],scenes:Y[0],animations:Y[1],cameras:Y[2],asset:Z.asset,parser:$,userData:{}};return u8(W,X,Z),f9(X,Z),Promise.all($._invokeAll(function(K){return K.afterRoot&&K.afterRoot(X)})).then(function(){for(let K of X.scenes)K.updateMatrixWorld();J(X)})}).catch(Q)}_markDefs(){let J=this.json.nodes||[],Q=this.json.skins||[],$=this.json.meshes||[];for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z].joints;for(let X=0,K=Y.length;X<K;X++)J[Y[X]].isBone=!0}for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];if(Y.mesh!==void 0){if(this._addNodeRef(this.meshCache,Y.mesh),Y.skin!==void 0)$[Y.mesh].isSkinnedMesh=!0}if(Y.camera!==void 0)this._addNodeRef(this.cameraCache,Y.camera)}}_addNodeRef(J,Q){if(Q===void 0)return;if(J.refs[Q]===void 0)J.refs[Q]=J.uses[Q]=0;J.refs[Q]++}_getNodeRef(J,Q,$){if(J.refs[Q]<=1)return $;let Z=$.clone(),W=(Y,X)=>{let K=this.associations.get(Y);if(K!=null)this.associations.set(X,K);for(let[H,U]of Y.children.entries())W(U,X.children[H])};return W($,Z),Z.name+="_instance_"+J.uses[Q]++,Z}_invokeOne(J){let Q=Object.values(this.plugins);Q.push(this);for(let $=0;$<Q.length;$++){let Z=J(Q[$]);if(Z)return Z}return null}_invokeAll(J){let Q=Object.values(this.plugins);Q.unshift(this);let $=[];for(let Z=0;Z<Q.length;Z++){let W=J(Q[Z]);if(W)$.push(W)}return $}getDependency(J,Q){let $=J+":"+Q,Z=this.cache.get($);if(!Z){switch(J){case"scene":Z=this.loadScene(Q);break;case"node":Z=this._invokeOne(function(W){return W.loadNode&&W.loadNode(Q)});break;case"mesh":Z=this._invokeOne(function(W){return W.loadMesh&&W.loadMesh(Q)});break;case"accessor":Z=this.loadAccessor(Q);break;case"bufferView":Z=this._invokeOne(function(W){return W.loadBufferView&&W.loadBufferView(Q)});break;case"buffer":Z=this.loadBuffer(Q);break;case"material":Z=this._invokeOne(function(W){return W.loadMaterial&&W.loadMaterial(Q)});break;case"texture":Z=this._invokeOne(function(W){return W.loadTexture&&W.loadTexture(Q)});break;case"skin":Z=this.loadSkin(Q);break;case"animation":Z=this._invokeOne(function(W){return W.loadAnimation&&W.loadAnimation(Q)});break;case"camera":Z=this.loadCamera(Q);break;default:if(Z=this._invokeOne(function(W){return W!=this&&W.getDependency&&W.getDependency(J,Q)}),!Z)throw Error("Unknown type: "+J);break}this.cache.add($,Z)}return Z}getDependencies(J){let Q=this.cache.get(J);if(!Q){let $=this,Z=this.json[J+(J==="mesh"?"es":"s")]||[];Q=Promise.all(Z.map(function(W,Y){return $.getDependency(J,Y)})),this.cache.add(J,Q)}return Q}loadBuffer(J){let Q=this.json.buffers[J],$=this.fileLoader;if(Q.type&&Q.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+Q.type+" buffer type is not supported.");if(Q.uri===void 0&&J===0)return Promise.resolve(this.extensions[o0.KHR_BINARY_GLTF].body);let Z=this.options;return new Promise(function(W,Y){$.load(L8.resolveURL(Q.uri,Z.path),W,void 0,function(){Y(Error('THREE.GLTFLoader: Failed to load buffer "'+Q.uri+'".'))})})}loadBufferView(J){let Q=this.json.bufferViews[J];return this.getDependency("buffer",Q.buffer).then(function($){let Z=Q.byteLength||0,W=Q.byteOffset||0;return $.slice(W,W+Z)})}loadAccessor(J){let Q=this,$=this.json,Z=this.json.accessors[J];if(Z.bufferView===void 0&&Z.sparse===void 0){let Y=XW[Z.type],X=S6[Z.componentType],K=Z.normalized===!0,H=new X(Z.count*Y);return Promise.resolve(new QJ(H,Y,K))}let W=[];if(Z.bufferView!==void 0)W.push(this.getDependency("bufferView",Z.bufferView));else W.push(null);if(Z.sparse!==void 0)W.push(this.getDependency("bufferView",Z.sparse.indices.bufferView)),W.push(this.getDependency("bufferView",Z.sparse.values.bufferView));return Promise.all(W).then(function(Y){let X=Y[0],K=XW[Z.type],H=S6[Z.componentType],U=H.BYTES_PER_ELEMENT,G=U*K,F=Z.byteOffset||0,E=Z.bufferView!==void 0?$.bufferViews[Z.bufferView].byteStride:void 0,O=Z.normalized===!0,R,C;if(E&&E!==G){let q=Math.floor(F/E),N="InterleavedBuffer:"+Z.bufferView+":"+Z.componentType+":"+q+":"+Z.count,L=Q.cache.get(N);if(!L)R=new H(X,q*E,Z.count*E/U),L=new W7(R,E/U),Q.cache.add(N,L);C=new M6(L,K,F%E/U,O)}else{if(X===null)R=new H(Z.count*K);else R=new H(X,F,Z.count*K);C=new QJ(R,K,O)}if(Z.sparse!==void 0){let q=XW.SCALAR,N=S6[Z.sparse.indices.componentType],L=Z.sparse.indices.byteOffset||0,k=Z.sparse.values.byteOffset||0,M=new N(Y[1],L,Z.sparse.count*q),P=new H(Y[2],k,Z.sparse.count*K);if(X!==null)C=new QJ(C.array.slice(),C.itemSize,C.normalized);C.normalized=!1;for(let w=0,B=M.length;w<B;w++){let D=M[w];if(C.setX(D,P[w*K]),K>=2)C.setY(D,P[w*K+1]);if(K>=3)C.setZ(D,P[w*K+2]);if(K>=4)C.setW(D,P[w*K+3]);if(K>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}C.normalized=O}return C})}loadTexture(J){let Q=this.json,$=this.options,W=Q.textures[J].source,Y=Q.images[W],X=this.textureLoader;if(Y.uri){let K=$.manager.getHandler(Y.uri);if(K!==null)X=K}return this.loadTextureImage(J,W,X)}loadTextureImage(J,Q,$){let Z=this,W=this.json,Y=W.textures[J],X=W.images[Q],K=(X.uri||X.bufferView)+":"+Y.sampler;if(this.textureCache[K])return this.textureCache[K];let H=this.loadImageSource(Q,$).then(function(U){if(U.flipY=!1,U.name=Y.name||X.name||"",U.name===""&&typeof X.uri==="string"&&X.uri.startsWith("data:image/")===!1)U.name=X.uri;let F=(W.samplers||{})[Y.sampler]||{};return U.magFilter=CK[F.magFilter]||CJ,U.minFilter=CK[F.minFilter]||S9,U.wrapS=IK[F.wrapS]||U8,U.wrapT=IK[F.wrapT]||U8,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==V9&&U.minFilter!==CJ,Z.associations.set(U,{textures:J}),U}).catch(function(){return null});return this.textureCache[K]=H,H}loadImageSource(J,Q){let $=this,Z=this.json,W=this.options;if(this.sourceCache[J]!==void 0)return this.sourceCache[J].then((G)=>G.clone());let Y=Z.images[J],X=self.URL||self.webkitURL,K=Y.uri||"",H=!1;if(Y.bufferView!==void 0)K=$.getDependency("bufferView",Y.bufferView).then(function(G){H=!0;let F=new Blob([G],{type:Y.mimeType});return K=X.createObjectURL(F),K});else if(Y.uri===void 0)throw Error("THREE.GLTFLoader: Image "+J+" is missing URI and bufferView");let U=Promise.resolve(K).then(function(G){return new Promise(function(F,E){let O=F;if(Q.isImageBitmapLoader===!0)O=function(R){let C=new PJ(R);C.needsUpdate=!0,F(C)};Q.load(L8.resolveURL(G,W.path),O,void 0,E)})}).then(function(G){if(H===!0)X.revokeObjectURL(K);return f9(G,Y),G.userData.mimeType=Y.mimeType||SF(Y.uri),G}).catch(function(G){throw console.error("THREE.GLTFLoader: Couldn't load texture",K),G});return this.sourceCache[J]=U,U}assignTexture(J,Q,$,Z){let W=this;return this.getDependency("texture",$.index).then(function(Y){if(!Y)return null;if($.texCoord!==void 0&&$.texCoord>0)Y=Y.clone(),Y.channel=$.texCoord;if(W.extensions[o0.KHR_TEXTURE_TRANSFORM]){let X=$.extensions!==void 0?$.extensions[o0.KHR_TEXTURE_TRANSFORM]:void 0;if(X){let K=W.associations.get(Y);Y=W.extensions[o0.KHR_TEXTURE_TRANSFORM].extendTexture(Y,X),W.associations.set(Y,K)}}if(Z!==void 0)Y.colorSpace=Z;return J[Q]=Y,Y})}assignFinalMaterial(J){let{geometry:Q,material:$}=J,Z=Q.attributes.tangent===void 0,W=Q.attributes.color!==void 0,Y=Q.attributes.normal===void 0;if(J.isPoints){let X="PointsMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new H7,oJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,K.sizeAttenuation=!1,this.cache.add(X,K);$=K}else if(J.isLine){let X="LineBasicMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new K7,oJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,this.cache.add(X,K);$=K}if(Z||W||Y){let X="ClonedMaterial:"+$.uuid+":";if(Z)X+="derivative-tangents:";if(W)X+="vertex-colors:";if(Y)X+="flat-shading:";let K=this.cache.get(X);if(!K){if(K=$.clone(),W)K.vertexColors=!0;if(Y)K.flatShading=!0;if(Z){if(K.normalScale)K.normalScale.y*=-1;if(K.clearcoatNormalScale)K.clearcoatNormalScale.y*=-1}this.cache.add(X,K),this.associations.set(K,this.associations.get($))}$=K}J.material=$}getMaterialType(){return cJ}loadMaterial(J){let Q=this,$=this.json,Z=this.extensions,W=$.materials[J],Y,X={},K=W.extensions||{},H=[];if(K[o0.KHR_MATERIALS_UNLIT]){let G=Z[o0.KHR_MATERIALS_UNLIT];Y=G.getMaterialType(),H.push(G.extendParams(X,W,Q))}else{let G=W.pbrMetallicRoughness||{};if(X.color=new X0(1,1,1),X.opacity=1,Array.isArray(G.baseColorFactor)){let F=G.baseColorFactor;X.color.setRGB(F[0],F[1],F[2],mJ),X.opacity=F[3]}if(G.baseColorTexture!==void 0)H.push(Q.assignTexture(X,"map",G.baseColorTexture,E8));if(X.metalness=G.metallicFactor!==void 0?G.metallicFactor:1,X.roughness=G.roughnessFactor!==void 0?G.roughnessFactor:1,G.metallicRoughnessTexture!==void 0)H.push(Q.assignTexture(X,"metalnessMap",G.metallicRoughnessTexture)),H.push(Q.assignTexture(X,"roughnessMap",G.metallicRoughnessTexture));Y=this._invokeOne(function(F){return F.getMaterialType&&F.getMaterialType(J)}),H.push(Promise.all(this._invokeAll(function(F){return F.extendMaterialParams&&F.extendMaterialParams(J,X)})))}if(W.doubleSided===!0)X.side=sJ;let U=W.alphaMode||KW.OPAQUE;if(U===KW.BLEND)X.transparent=!0,X.depthWrite=!1;else if(X.transparent=!1,U===KW.MASK)X.alphaTest=W.alphaCutoff!==void 0?W.alphaCutoff:0.5;if(W.normalTexture!==void 0&&Y!==U9){if(H.push(Q.assignTexture(X,"normalMap",W.normalTexture)),X.normalScale=new T0(1,1),W.normalTexture.scale!==void 0){let G=W.normalTexture.scale;X.normalScale.set(G,G)}}if(W.occlusionTexture!==void 0&&Y!==U9){if(H.push(Q.assignTexture(X,"aoMap",W.occlusionTexture)),W.occlusionTexture.strength!==void 0)X.aoMapIntensity=W.occlusionTexture.strength}if(W.emissiveFactor!==void 0&&Y!==U9){let G=W.emissiveFactor;X.emissive=new X0().setRGB(G[0],G[1],G[2],mJ)}if(W.emissiveTexture!==void 0&&Y!==U9)H.push(Q.assignTexture(X,"emissiveMap",W.emissiveTexture,E8));return Promise.all(H).then(function(){let G=new Y(X);if(W.name)G.name=W.name;if(f9(G,W),Q.associations.set(G,{materials:J}),W.extensions)u8(Z,G,W);return G})}createUniqueName(J){let Q=JJ.sanitizeNodeName(J||"");if(Q in this.nodeNamesUsed)return Q+"_"+ ++this.nodeNamesUsed[Q];else return this.nodeNamesUsed[Q]=0,Q}loadGeometries(J){let Q=this,$=this.extensions,Z=this.primitiveCache;function W(X){return $[o0.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(X,Q).then(function(K){return zK(K,X,Q)})}let Y=[];for(let X=0,K=J.length;X<K;X++){let H=J[X],U=AF(H),G=Z[U];if(G)Y.push(G.promise);else{let F;if(H.extensions&&H.extensions[o0.KHR_DRACO_MESH_COMPRESSION])F=W(H);else F=zK(new qJ,H,Q);Z[U]={primitive:H,promise:F},Y.push(F)}}return Promise.all(Y)}loadMesh(J){let Q=this,$=this.json,Z=this.extensions,W=$.meshes[J],Y=W.primitives,X=[];for(let K=0,H=Y.length;K<H;K++){let U=Y[K].material===void 0?wF(this.cache):this.getDependency("material",Y[K].material);X.push(U)}return X.push(Q.loadGeometries(Y)),Promise.all(X).then(function(K){let H=K.slice(0,K.length-1),U=K[K.length-1],G=[];for(let E=0,O=U.length;E<O;E++){let R=U[E],C=Y[E],q,N=H[E];if(C.mode===E9.TRIANGLES||C.mode===E9.TRIANGLE_STRIP||C.mode===E9.TRIANGLE_FAN||C.mode===void 0){if(q=W.isSkinnedMesh===!0?new MQ(R,N):new a0(R,N),q.isSkinnedMesh===!0)q.normalizeSkinWeights();if(C.mode===E9.TRIANGLE_STRIP)q.geometry=YW(q.geometry,Q7);else if(C.mode===E9.TRIANGLE_FAN)q.geometry=YW(q.geometry,R6)}else if(C.mode===E9.LINES)q=new VQ(R,N);else if(C.mode===E9.LINE_STRIP)q=new C6(R,N);else if(C.mode===E9.LINE_LOOP)q=new BQ(R,N);else if(C.mode===E9.POINTS)q=new o9(R,N);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+C.mode);if(Object.keys(q.geometry.morphAttributes).length>0)TF(q,W);if(q.name=Q.createUniqueName(W.name||"mesh_"+J),f9(q,W),C.extensions)u8(Z,q,C);Q.assignFinalMaterial(q),G.push(q)}for(let E=0,O=G.length;E<O;E++)Q.associations.set(G[E],{meshes:J,primitives:E});if(G.length===1){if(W.extensions)u8(Z,G[0],W);return G[0]}let F=new K9;if(W.extensions)u8(Z,F,W);Q.associations.set(F,{meshes:J});for(let E=0,O=G.length;E<O;E++)F.add(G[E]);return F})}loadCamera(J){let Q,$=this.json.cameras[J],Z=$[$.type];if(!Z){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if($.type==="perspective")Q=new BJ(D6.radToDeg(Z.yfov),Z.aspectRatio||1,Z.znear||1,Z.zfar||2000000);else if($.type==="orthographic")Q=new e9(-Z.xmag,Z.xmag,Z.ymag,-Z.ymag,Z.znear,Z.zfar);if($.name)Q.name=this.createUniqueName($.name);return f9(Q,$),Promise.resolve(Q)}loadSkin(J){let Q=this.json.skins[J],$=[];for(let Z=0,W=Q.joints.length;Z<W;Z++)$.push(this._loadNodeShallow(Q.joints[Z]));if(Q.inverseBindMatrices!==void 0)$.push(this.getDependency("accessor",Q.inverseBindMatrices));else $.push(null);return Promise.all($).then(function(Z){let W=Z.pop(),Y=Z,X=[],K=[];for(let H=0,U=Y.length;H<U;H++){let G=Y[H];if(G){X.push(G);let F=new j0;if(W!==null)F.fromArray(W.array,H*16);K.push(F)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',Q.joints[H])}return new X7(X,K)})}loadAnimation(J){let Q=this.json,$=this,Z=Q.animations[J],W=Z.name?Z.name:"animation_"+J,Y=[],X=[],K=[],H=[],U=[];for(let G=0,F=Z.channels.length;G<F;G++){let E=Z.channels[G],O=Z.samplers[E.sampler],R=E.target,C=R.node,q=Z.parameters!==void 0?Z.parameters[O.input]:O.input,N=Z.parameters!==void 0?Z.parameters[O.output]:O.output;if(R.node===void 0)continue;Y.push(this.getDependency("node",C)),X.push(this.getDependency("accessor",q)),K.push(this.getDependency("accessor",N)),H.push(O),U.push(R)}return Promise.all([Promise.all(Y),Promise.all(X),Promise.all(K),Promise.all(H),Promise.all(U)]).then(function(G){let F=G[0],E=G[1],O=G[2],R=G[3],C=G[4],q=[];for(let L=0,k=F.length;L<k;L++){let M=F[L],P=E[L],w=O[L],B=R[L],D=C[L];if(M===void 0)continue;if(M.updateMatrix)M.updateMatrix();let V=$._createAnimationTracks(M,P,w,B,D);if(V)for(let j=0;j<V.length;j++)q.push(V[j])}let N=new U6(W,void 0,q);return f9(N,Z),N})}createNodeMesh(J){let Q=this.json,$=this,Z=Q.nodes[J];if(Z.mesh===void 0)return null;return $.getDependency("mesh",Z.mesh).then(function(W){let Y=$._getNodeRef($.meshCache,Z.mesh,W);if(Z.weights!==void 0)Y.traverse(function(X){if(!X.isMesh)return;for(let K=0,H=Z.weights.length;K<H;K++)X.morphTargetInfluences[K]=Z.weights[K]});return Y})}loadNode(J){let Q=this.json,$=this,Z=Q.nodes[J],W=$._loadNodeShallow(J),Y=[],X=Z.children||[];for(let H=0,U=X.length;H<U;H++)Y.push($.getDependency("node",X[H]));let K=Z.skin===void 0?Promise.resolve(null):$.getDependency("skin",Z.skin);return Promise.all([W,Promise.all(Y),K]).then(function(H){let U=H[0],G=H[1],F=H[2];if(F!==null)U.traverse(function(E){if(!E.isSkinnedMesh)return;E.bind(F,jF)});for(let E=0,O=G.length;E<O;E++)U.add(G[E]);if(U.userData.pivot!==void 0&&G.length>0){let E=U.userData.pivot,O=G[0];U.pivot=new S().fromArray(E),U.position.x-=E[0],U.position.y-=E[1],U.position.z-=E[2],O.position.set(0,0,0),delete U.userData.pivot}return U})}_loadNodeShallow(J){let Q=this.json,$=this.extensions,Z=this;if(this.nodeCache[J]!==void 0)return this.nodeCache[J];let W=Q.nodes[J],Y=W.name?Z.createUniqueName(W.name):"",X=[],K=Z._invokeOne(function(H){return H.createNodeMesh&&H.createNodeMesh(J)});if(K)X.push(K);if(W.camera!==void 0)X.push(Z.getDependency("camera",W.camera).then(function(H){return Z._getNodeRef(Z.cameraCache,W.camera,H)}));return Z._invokeAll(function(H){return H.createNodeAttachment&&H.createNodeAttachment(J)}).forEach(function(H){X.push(H)}),this.nodeCache[J]=Promise.all(X).then(function(H){let U;if(W.isBone===!0)U=new Y7;else if(H.length>1)U=new K9;else if(H.length===1)U=H[0];else U=new HJ;if(U!==H[0])for(let G=0,F=H.length;G<F;G++)U.add(H[G]);if(W.name)U.userData.name=W.name,U.name=Y;if(f9(U,W),W.extensions)u8($,U,W);if(W.matrix!==void 0){let G=new j0;G.fromArray(W.matrix),U.applyMatrix4(G)}else{if(W.translation!==void 0)U.position.fromArray(W.translation);if(W.rotation!==void 0)U.quaternion.fromArray(W.rotation);if(W.scale!==void 0)U.scale.fromArray(W.scale)}if(!Z.associations.has(U))Z.associations.set(U,{});else if(W.mesh!==void 0&&Z.meshCache.refs[W.mesh]>1){let G=Z.associations.get(U);Z.associations.set(U,{...G})}return Z.associations.get(U).nodes=J,U}),this.nodeCache[J]}loadScene(J){let Q=this.extensions,$=this.json.scenes[J],Z=this,W=new K9;if($.name)W.name=Z.createUniqueName($.name);if(f9(W,$),$.extensions)u8(Q,W,$);let Y=$.nodes||[],X=[];for(let K=0,H=Y.length;K<H;K++)X.push(Z.getDependency("node",Y[K]));return Promise.all(X).then(function(K){for(let U=0,G=K.length;U<G;U++){let F=K[U];if(F.parent!==null)W.add(MK(F));else W.add(F)}let H=(U)=>{let G=new Map;for(let[F,E]of Z.associations)if(F instanceof oJ||F instanceof PJ)G.set(F,E);return U.traverse((F)=>{let E=Z.associations.get(F);if(E!=null)G.set(F,E)}),G};return Z.associations=H(W),W})}_createAnimationTracks(J,Q,$,Z,W){let Y=[],X=J.name?J.name:J.uuid,K=[];function H(E){if(E.morphTargetInfluences)K.push(E.name?E.name:E.uuid)}if(k8[W.path]===k8.weights){if(H(J),J.isGroup)J.children.forEach(H)}else K.push(X);let U;switch(k8[W.path]){case k8.weights:U=s9;break;case k8.rotation:U=r9;break;case k8.translation:case k8.scale:U=i9;break;default:switch($.itemSize){case 1:U=s9;break;case 2:case 3:default:U=i9;break}break}let G=Z.interpolation!==void 0?_F[Z.interpolation]:NQ,F=this._getArrayFromAccessor($);for(let E=0,O=K.length;E<O;E++){let R=new U(K[E]+"."+k8[W.path],Q.array,F,G);if(Z.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(R);Y.push(R)}return Y}_getArrayFromAccessor(J){let Q=J.array;if(J.normalized){let $=EW(Q.constructor),Z=new Float32Array(Q.length);for(let W=0,Y=Q.length;W<Y;W++)Z[W]=Q[W]*$;Q=Z}return Q}_createCubicSplineTrackInterpolant(J){J.createInterpolant=function($){return new(this instanceof r9?iK:NW)(this.times,this.values,this.getValueSize()/3,$)},J.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function vF(J,Q,$){let Z=Q.attributes,W=new iJ;if(Z.POSITION!==void 0){let K=$.json.accessors[Z.POSITION],H=K.min,U=K.max;if(H!==void 0&&U!==void 0){if(W.set(new S(H[0],H[1],H[2]),new S(U[0],U[1],U[2])),K.normalized){let G=EW(S6[K.componentType]);W.min.multiplyScalar(G),W.max.multiplyScalar(G)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let Y=Q.targets;if(Y!==void 0){let K=new S,H=new S;for(let U=0,G=Y.length;U<G;U++){let F=Y[U];if(F.POSITION!==void 0){let E=$.json.accessors[F.POSITION],O=E.min,R=E.max;if(O!==void 0&&R!==void 0){if(H.setX(Math.max(Math.abs(O[0]),Math.abs(R[0]))),H.setY(Math.max(Math.abs(O[1]),Math.abs(R[1]))),H.setZ(Math.max(Math.abs(O[2]),Math.abs(R[2]))),E.normalized){let C=EW(S6[E.componentType]);H.multiplyScalar(C)}K.max(H)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}W.expandByVector(K)}J.boundingBox=W;let X=new lJ;W.getCenter(X.center),X.radius=W.min.distanceTo(W.max)/2,J.boundingSphere=X}function zK(J,Q,$){let Z=Q.attributes,W=[];function Y(X,K){return $.getDependency("accessor",X).then(function(H){J.setAttribute(K,H)})}for(let X in Z){let K=GW[X]||X.toLowerCase();if(K in J.attributes)continue;W.push(Y(Z[X],K))}if(Q.indices!==void 0&&!J.index){let X=$.getDependency("accessor",Q.indices).then(function(K){J.setIndex(K)});W.push(X)}if(u0.workingColorSpace!==mJ&&"COLOR_0"in Z)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${u0.workingColorSpace}" not supported.`);return f9(J,Q),vF(J,Q,$),Promise.all(W).then(function(){return Q.targets!==void 0?PF(J,Q.targets,$):J})}class OW extends AQ{constructor(J){super(J);this.type=kJ}parse(J){let Y=function(B,D){switch(B){case 1:throw Error("THREE.HDRLoader: Read Error: "+(D||""));case 2:throw Error("THREE.HDRLoader: Write Error: "+(D||""));case 3:throw Error("THREE.HDRLoader: Bad File Format: "+(D||""));default:case 4:throw Error("THREE.HDRLoader: Memory Error: "+(D||""))}},G=function(B,D,V){D=!D?1024:D;let z=B.pos,v=-1,y=0,A="",x=String.fromCharCode.apply(null,new Uint16Array(B.subarray(z,z+128)));while(0>(v=x.indexOf(`
4105
- `))&&y<D&&z<B.byteLength)A+=x,y+=x.length,z+=128,x=String.fromCharCode.apply(null,new Uint16Array(B.subarray(z,z+128)));if(-1<v){if(V!==!1)B.pos+=y+v+1;return A+x.slice(0,v)}return!1},F=function(B){let D=/^#\?(\S+)/,V=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,j=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,z=/^\s*FORMAT=(\S+)\s*$/,v=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,y={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},A,x;if(B.pos>=B.byteLength||!(A=G(B)))Y(1,"no header found");if(!(x=A.match(D)))Y(3,"bad initial token");y.valid|=1,y.programtype=x[1],y.string+=A+`
4106
- `;while(!0){if(A=G(B),A===!1)break;if(y.string+=A+`
4107
- `,A.charAt(0)==="#"){y.comments+=A+`
4108
- `;continue}if(x=A.match(V))y.gamma=parseFloat(x[1]);if(x=A.match(j))y.exposure=parseFloat(x[1]);if(x=A.match(z))y.valid|=2,y.format=x[1];if(x=A.match(v))y.valid|=4,y.height=parseInt(x[1],10),y.width=parseInt(x[2],10);if(y.valid&2&&y.valid&4)break}if(!(y.valid&2))Y(3,"missing format specifier");if(!(y.valid&4))Y(3,"missing image size specifier");return y},E=function(B,D,V){let j=D;if(j<8||j>32767||(B[0]!==2||B[1]!==2||B[2]&128))return new Uint8Array(B);if(j!==(B[2]<<8|B[3]))Y(3,"wrong scanline width");let z=new Uint8Array(4*D*V);if(!z.length)Y(4,"unable to allocate buffer space");let v=0,y=0,A=4*j,x=new Uint8Array(4),b=new Uint8Array(A),p=V;while(p>0&&y<B.byteLength){if(y+4>B.byteLength)Y(1);if(x[0]=B[y++],x[1]=B[y++],x[2]=B[y++],x[3]=B[y++],x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=j)Y(3,"bad rgbe scanline format");let c=0,o;while(c<A&&y<B.byteLength){o=B[y++];let Y0=o>128;if(Y0)o-=128;if(o===0||c+o>A)Y(3,"bad scanline data");if(Y0){let J0=B[y++];for(let x0=0;x0<o;x0++)b[c++]=J0}else b.set(B.subarray(y,y+o),c),c+=o,y+=o}let Q0=j;for(let Y0=0;Y0<Q0;Y0++){let J0=0;z[v]=b[Y0+J0],J0+=j,z[v+1]=b[Y0+J0],J0+=j,z[v+2]=b[Y0+J0],J0+=j,z[v+3]=b[Y0+J0],v+=4}p--}return z},O=function(B,D,V,j){let z=B[D+3],v=Math.pow(2,z-128)/255;V[j+0]=B[D+0]*v,V[j+1]=B[D+1]*v,V[j+2]=B[D+2]*v,V[j+3]=1},R=function(B,D,V,j){let z=B[D+3],v=Math.pow(2,z-128)/255;V[j+0]=b8.toHalfFloat(Math.min(B[D+0]*v,65504)),V[j+1]=b8.toHalfFloat(Math.min(B[D+1]*v,65504)),V[j+2]=b8.toHalfFloat(Math.min(B[D+2]*v,65504)),V[j+3]=b8.toHalfFloat(1)},C=new Uint8Array(J);C.pos=0;let q=F(C),N=q.width,L=q.height,k=E(C.subarray(C.pos),N,L),M,P,w;switch(this.type){case $9:w=k.length/4;let B=new Float32Array(w*4);for(let V=0;V<w;V++)O(k,V*4,B,V*4);M=B,P=$9;break;case kJ:w=k.length/4;let D=new Uint16Array(w*4);for(let V=0;V<w;V++)R(k,V*4,D,V*4);M=D,P=kJ;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:N,height:L,data:M,header:q.string,gamma:q.gamma,exposure:q.exposure,type:P}}setDataType(J){return this.type=J,this}load(J,Q,$,Z){function W(Y,X){switch(Y.type){case $9:case kJ:Y.colorSpace=mJ,Y.minFilter=CJ,Y.magFilter=CJ,Y.generateMipmaps=!1,Y.flipY=!0;break}if(Q)Q(Y,X)}return super.load(J,W,$,Z)}}var V7=new S;function F9(J,Q,$,Z,W,Y){let X=2*Math.PI*W/4,K=Math.max(Y-2*W,0),H=Math.PI/4;V7.copy(Q),V7[Z]=0,V7.normalize();let U=0.5*X/(X+K),G=1-V7.angleTo(J)/H;if(Math.sign(V7[$])===1)return G*U;else return K/(X+K)+U+U*(1-G)}class sQ extends aJ{constructor(J=1,Q=1,$=1,Z=2,W=0.1){let Y=Z*2+1;W=Math.min(J/2,Q/2,$/2,W);super(1,1,1,Y,Y,Y);if(this.type="RoundedBoxGeometry",this.parameters={width:J,height:Q,depth:$,segments:Z,radius:W},Y===1)return;let X=this.toNonIndexed();this.index=null,this.attributes.position=X.attributes.position,this.attributes.normal=X.attributes.normal,this.attributes.uv=X.attributes.uv;let K=new S,H=new S,U=new S(J,Q,$).divideScalar(2).subScalar(W),G=this.attributes.position.array,F=this.attributes.normal.array,E=this.attributes.uv.array,O=G.length/6,R=new S,C=0.5/Y;for(let q=0,N=0;q<G.length;q+=3,N+=2)switch(K.fromArray(G,q),H.copy(K),H.x-=Math.sign(H.x)*C,H.y-=Math.sign(H.y)*C,H.z-=Math.sign(H.z)*C,H.normalize(),G[q+0]=U.x*Math.sign(K.x)+H.x*W,G[q+1]=U.y*Math.sign(K.y)+H.y*W,G[q+2]=U.z*Math.sign(K.z)+H.z*W,F[q+0]=H.x,F[q+1]=H.y,F[q+2]=H.z,Math.floor(q/O)){case 0:R.set(1,0,0),E[N+0]=F9(R,H,"z","y",W,$),E[N+1]=1-F9(R,H,"y","z",W,Q);break;case 1:R.set(-1,0,0),E[N+0]=1-F9(R,H,"z","y",W,$),E[N+1]=1-F9(R,H,"y","z",W,Q);break;case 2:R.set(0,1,0),E[N+0]=1-F9(R,H,"x","z",W,J),E[N+1]=F9(R,H,"z","x",W,$);break;case 3:R.set(0,-1,0),E[N+0]=1-F9(R,H,"x","z",W,J),E[N+1]=1-F9(R,H,"z","x",W,$);break;case 4:R.set(0,0,1),E[N+0]=1-F9(R,H,"x","y",W,J),E[N+1]=1-F9(R,H,"y","x",W,Q);break;case 5:R.set(0,0,-1),E[N+0]=F9(R,H,"x","y",W,J),E[N+1]=1-F9(R,H,"y","x",W,Q);break}}static fromJSON(J){return new sQ(J.width,J.height,J.depth,J.segments,J.radius)}}class qW extends k6{constructor(){super();this.name="RoomEnvironment",this.position.y=-3.5;let J=new aJ;J.deleteAttribute("uv");let Q=new cJ({side:yJ}),$=new cJ,Z=new R8(16777215,900,28,2);Z.position.set(0.418,16.199,0.3),this.add(Z);let W=new a0(J,Q);W.position.set(-0.757,13.219,0.717),W.scale.set(31.713,28.305,28.591),this.add(W);let Y=new F8(J,$,6),X=new HJ;X.position.set(-10.906,2.009,1.846),X.rotation.set(0,-0.195,0),X.scale.set(2.328,7.905,4.651),X.updateMatrix(),Y.setMatrixAt(0,X.matrix),X.position.set(-5.607,-0.754,-0.758),X.rotation.set(0,0.994,0),X.scale.set(1.97,1.534,3.955),X.updateMatrix(),Y.setMatrixAt(1,X.matrix),X.position.set(6.167,0.857,7.803),X.rotation.set(0,0.561,0),X.scale.set(3.927,6.285,3.687),X.updateMatrix(),Y.setMatrixAt(2,X.matrix),X.position.set(-2.017,0.018,6.124),X.rotation.set(0,0.333,0),X.scale.set(2.002,4.566,2.064),X.updateMatrix(),Y.setMatrixAt(3,X.matrix),X.position.set(2.291,-0.756,-2.621),X.rotation.set(0,-0.286,0),X.scale.set(1.546,1.552,1.496),X.updateMatrix(),Y.setMatrixAt(4,X.matrix),X.position.set(-2.193,-0.369,-5.547),X.rotation.set(0,0.516,0),X.scale.set(3.875,3.487,2.986),X.updateMatrix(),Y.setMatrixAt(5,X.matrix),this.add(Y);let K=new a0(J,j6(50));K.position.set(-16.116,14.37,8.208),K.scale.set(0.1,2.428,2.739),this.add(K);let H=new a0(J,j6(50));H.position.set(-16.109,18.021,-8.207),H.scale.set(0.1,2.425,2.751),this.add(H);let U=new a0(J,j6(17));U.position.set(14.904,12.198,-1.832),U.scale.set(0.15,4.265,6.331),this.add(U);let G=new a0(J,j6(43));G.position.set(-0.462,8.89,14.52),G.scale.set(4.38,5.441,0.088),this.add(G);let F=new a0(J,j6(20));F.position.set(3.235,11.486,-12.541),F.scale.set(2.5,2,0.1),this.add(F);let E=new a0(J,j6(100));E.position.set(0,20,0),E.scale.set(1,0.1,1),this.add(E)}dispose(){let J=new Set;this.traverse((Q)=>{if(Q.isMesh)J.add(Q.geometry),J.add(Q.material)});for(let Q of J)Q.dispose()}}function j6(J){return new wQ({color:0,emissive:16777215,emissiveIntensity:J})}var v6={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
4104
+ }`;class XE{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new nQ(J.texture);if(J.depthNear!==Q.depthNear||J.depthFar!==Q.depthFar)this.depthNear=J.depthNear,this.depthFar=J.depthFar;this.texture=$}}getMesh(J){if(this.texture!==null){if(this.mesh===null){let Q=J.cameras[0].viewport,$=new LJ({vertexShader:GD,fragmentShader:ED,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new a0(new z9(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class KE extends B9{constructor(J,Q){super();let $=this,Z=null,W=1,Y=null,X="local-floor",K=1,H=null,U=null,G=null,F=null,E=null,O=null,R=typeof XRWebGLBinding<"u",M=new XE,q={},N=Q.getContextAttributes(),L=null,D=null,V=[],z=[],I=new i,B=null,k=new BJ;k.viewport=new FJ;let C=new BJ;C.viewport=new FJ;let j=[k,C],w=new dW,v=null,b=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(s){let F0=V[s];if(F0===void 0)F0=new f7,V[s]=F0;return F0.getTargetRaySpace()},this.getControllerGrip=function(s){let F0=V[s];if(F0===void 0)F0=new f7,V[s]=F0;return F0.getGripSpace()},this.getHand=function(s){let F0=V[s];if(F0===void 0)F0=new f7,V[s]=F0;return F0.getHandSpace()};function S(s){let F0=z.indexOf(s.inputSource);if(F0===-1)return;let I0=V[F0];if(I0!==void 0)I0.update(s.inputSource,s.frame,H||Y),I0.dispatchEvent({type:s.type,data:s.inputSource})}function h(){Z.removeEventListener("select",S),Z.removeEventListener("selectstart",S),Z.removeEventListener("selectend",S),Z.removeEventListener("squeeze",S),Z.removeEventListener("squeezestart",S),Z.removeEventListener("squeezeend",S),Z.removeEventListener("end",h),Z.removeEventListener("inputsourceschange",x);for(let s=0;s<V.length;s++){let F0=z[s];if(F0===null)continue;z[s]=null,V[s].disconnect(F0)}v=null,b=null,M.reset();for(let s in q)delete q[s];J.setRenderTarget(L),E=null,F=null,G=null,Z=null,D=null,d0.stop(),$.isPresenting=!1,J.setPixelRatio(B),J.setSize(I.width,I.height,!1),$.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(s){if(W=s,$.isPresenting===!0)O0("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(s){if(X=s,$.isPresenting===!0)O0("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return H||Y},this.setReferenceSpace=function(s){H=s},this.getBaseLayer=function(){return F!==null?F:E},this.getBinding=function(){if(G===null&&R)G=new XRWebGLBinding(Z,Q);return G},this.getFrame=function(){return O},this.getSession=function(){return Z},this.setSession=async function(s){if(Z=s,Z!==null){if(L=J.getRenderTarget(),Z.addEventListener("select",S),Z.addEventListener("selectstart",S),Z.addEventListener("selectend",S),Z.addEventListener("squeeze",S),Z.addEventListener("squeezestart",S),Z.addEventListener("squeezeend",S),Z.addEventListener("end",h),Z.addEventListener("inputsourceschange",x),N.xrCompatible!==!0)await Q.makeXRCompatible();if(B=J.getPixelRatio(),J.getSize(I),!(R&&("createProjectionLayer"in XRWebGLBinding.prototype))){let I0={antialias:N.antialias,alpha:!0,depth:N.depth,stencil:N.stencil,framebufferScaleFactor:W};E=new XRWebGLLayer(Z,Q,I0),Z.updateRenderState({baseLayer:E}),J.setPixelRatio(1),J.setSize(E.framebufferWidth,E.framebufferHeight,!1),D=new PJ(E.framebufferWidth,E.framebufferHeight,{format:o9,type:j9,colorSpace:J.outputColorSpace,stencilBuffer:N.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}else{let I0=null,E0=null,j0=null;if(N.depth)j0=N.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,I0=N.stencil?a8:o8,E0=N.stencil?T6:w8;let WJ={colorFormat:Q.RGBA8,depthFormat:j0,scaleFactor:W};G=this.getBinding(),F=G.createProjectionLayer(WJ),Z.updateRenderState({layers:[F]}),J.setPixelRatio(1),J.setSize(F.textureWidth,F.textureHeight,!1),D=new PJ(F.textureWidth,F.textureHeight,{format:o9,type:j9,depthTexture:new A8(F.textureWidth,F.textureHeight,E0,void 0,void 0,void 0,void 0,void 0,void 0,I0),stencilBuffer:N.stencil,colorSpace:J.outputColorSpace,samples:N.antialias?4:0,resolveDepthBuffer:F.ignoreDepthValues===!1,resolveStencilBuffer:F.ignoreDepthValues===!1})}D.isXRRenderTarget=!0,this.setFoveation(K),H=null,Y=await Z.requestReferenceSpace(X),d0.setContext(Z),d0.start(),$.isPresenting=!0,$.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Z!==null)return Z.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function x(s){for(let F0=0;F0<s.removed.length;F0++){let I0=s.removed[F0],E0=z.indexOf(I0);if(E0>=0)z[E0]=null,V[E0].disconnect(I0)}for(let F0=0;F0<s.added.length;F0++){let I0=s.added[F0],E0=z.indexOf(I0);if(E0===-1){for(let WJ=0;WJ<V.length;WJ++)if(WJ>=z.length){z.push(I0),E0=WJ;break}else if(z[WJ]===null){z[WJ]=I0,E0=WJ;break}if(E0===-1)break}let j0=V[E0];if(j0)j0.connect(I0)}}let p=new A,c=new A;function o(s,F0,I0){p.setFromMatrixPosition(F0.matrixWorld),c.setFromMatrixPosition(I0.matrixWorld);let E0=p.distanceTo(c),j0=F0.projectionMatrix.elements,WJ=I0.projectionMatrix.elements,x0=j0[14]/(j0[10]-1),n0=j0[14]/(j0[10]+1),Q0=(j0[9]+1)/j0[5],X0=(j0[9]-1)/j0[5],$0=(j0[8]-1)/j0[0],_0=(WJ[8]+1)/WJ[0],C0=x0*$0,m0=x0*_0,y=E0/(-$0+_0),YJ=y*-$0;if(F0.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(YJ),s.translateZ(y),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),j0[10]===-1)s.projectionMatrix.copy(F0.projectionMatrix),s.projectionMatrixInverse.copy(F0.projectionMatrixInverse);else{let h0=x0+y,l0=n0+y,U0=C0-YJ,NJ=m0+(E0-YJ),A0=Q0*n0/l0*h0,T=X0*n0/l0*h0;s.projectionMatrix.makePerspective(U0,NJ,A0,T,h0,l0),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function W0(s,F0){if(F0===null)s.matrixWorld.copy(s.matrix);else s.matrixWorld.multiplyMatrices(F0.matrixWorld,s.matrix);s.matrixWorldInverse.copy(s.matrixWorld).invert()}this.updateCamera=function(s){if(Z===null)return;let{near:F0,far:I0}=s;if(M.texture!==null){if(M.depthNear>0)F0=M.depthNear;if(M.depthFar>0)I0=M.depthFar}if(w.near=C.near=k.near=F0,w.far=C.far=k.far=I0,v!==w.near||b!==w.far)Z.updateRenderState({depthNear:w.near,depthFar:w.far}),v=w.near,b=w.far;w.layers.mask=s.layers.mask|6,k.layers.mask=w.layers.mask&-5,C.layers.mask=w.layers.mask&-3;let E0=s.parent,j0=w.cameras;W0(w,E0);for(let WJ=0;WJ<j0.length;WJ++)W0(j0[WJ],E0);if(j0.length===2)o(w,k,C);else w.projectionMatrix.copy(k.projectionMatrix);H0(s,w,E0)};function H0(s,F0,I0){if(I0===null)s.matrix.copy(F0.matrixWorld);else s.matrix.copy(I0.matrixWorld),s.matrix.invert(),s.matrix.multiply(F0.matrixWorld);if(s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(F0.projectionMatrix),s.projectionMatrixInverse.copy(F0.projectionMatrixInverse),s.isPerspectiveCamera)s.fov=B6*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1}this.getCamera=function(){return w},this.getFoveation=function(){if(F===null&&E===null)return;return K},this.setFoveation=function(s){if(K=s,F!==null)F.fixedFoveation=s;if(E!==null&&E.fixedFoveation!==void 0)E.fixedFoveation=s},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(w)},this.getCameraTexture=function(s){return q[s]};let J0=null;function c0(s,F0){if(U=F0.getViewerPose(H||Y),O=F0,U!==null){let I0=U.views;if(E!==null)J.setRenderTargetFramebuffer(D,E.framebuffer),J.setRenderTarget(D);let E0=!1;if(I0.length!==w.cameras.length)w.cameras.length=0,E0=!0;for(let n0=0;n0<I0.length;n0++){let Q0=I0[n0],X0=null;if(E!==null)X0=E.getViewport(Q0);else{let _0=G.getViewSubImage(F,Q0);if(X0=_0.viewport,n0===0)J.setRenderTargetTextures(D,_0.colorTexture,_0.depthStencilTexture),J.setRenderTarget(D)}let $0=j[n0];if($0===void 0)$0=new BJ,$0.layers.enable(n0),$0.viewport=new FJ,j[n0]=$0;if($0.matrix.fromArray(Q0.transform.matrix),$0.matrix.decompose($0.position,$0.quaternion,$0.scale),$0.projectionMatrix.fromArray(Q0.projectionMatrix),$0.projectionMatrixInverse.copy($0.projectionMatrix).invert(),$0.viewport.set(X0.x,X0.y,X0.width,X0.height),n0===0)w.matrix.copy($0.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale);if(E0===!0)w.cameras.push($0)}let j0=Z.enabledFeatures;if(j0&&j0.includes("depth-sensing")&&Z.depthUsage=="gpu-optimized"&&R){G=$.getBinding();let n0=G.getDepthInformation(I0[0]);if(n0&&n0.isValid&&n0.texture)M.init(n0,Z.renderState)}if(j0&&j0.includes("camera-access")&&R){J.state.unbindTexture(),G=$.getBinding();for(let n0=0;n0<I0.length;n0++){let Q0=I0[n0].camera;if(Q0){let X0=q[Q0];if(!X0)X0=new nQ,q[Q0]=X0;let $0=G.getCameraImage(Q0);X0.sourceTexture=$0}}}}for(let I0=0;I0<V.length;I0++){let E0=z[I0],j0=V[I0];if(E0!==null&&j0!==void 0)j0.update(E0,F0,H||Y)}if(J0)J0(s,F0);if(F0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:F0});O=null}let d0=new i5;d0.setAnimationLoop(c0),this.setAnimationLoop=function(s){J0=s},this.dispose=function(){}}}var FD=new y0,HE=new o0;HE.set(-1,0,0,0,1,0,0,0,1);function ND(J,Q){function $(q,N){if(q.matrixAutoUpdate===!0)q.updateMatrix();N.value.copy(q.matrix)}function Z(q,N){if(N.color.getRGB(q.fogColor.value,OK(J)),N.isFog)q.fogNear.value=N.near,q.fogFar.value=N.far;else if(N.isFogExp2)q.fogDensity.value=N.density}function W(q,N,L,D,V){if(N.isNodeMaterial)N.uniformsNeedUpdate=!1;else if(N.isMeshBasicMaterial)Y(q,N);else if(N.isMeshLambertMaterial){if(Y(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshToonMaterial)Y(q,N),F(q,N);else if(N.isMeshPhongMaterial){if(Y(q,N),G(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshStandardMaterial){if(Y(q,N),E(q,N),N.isMeshPhysicalMaterial)O(q,N,V)}else if(N.isMeshMatcapMaterial)Y(q,N),R(q,N);else if(N.isMeshDepthMaterial)Y(q,N);else if(N.isMeshDistanceMaterial)Y(q,N),M(q,N);else if(N.isMeshNormalMaterial)Y(q,N);else if(N.isLineBasicMaterial){if(X(q,N),N.isLineDashedMaterial)K(q,N)}else if(N.isPointsMaterial)H(q,N,L,D);else if(N.isSpriteMaterial)U(q,N);else if(N.isShadowMaterial)q.color.value.copy(N.color),q.opacity.value=N.opacity;else if(N.isShaderMaterial)N.uniformsNeedUpdate=!1}function Y(q,N){if(q.opacity.value=N.opacity,N.color)q.diffuse.value.copy(N.color);if(N.emissive)q.emissive.value.copy(N.emissive).multiplyScalar(N.emissiveIntensity);if(N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.bumpMap){if(q.bumpMap.value=N.bumpMap,$(N.bumpMap,q.bumpMapTransform),q.bumpScale.value=N.bumpScale,N.side===uJ)q.bumpScale.value*=-1}if(N.normalMap){if(q.normalMap.value=N.normalMap,$(N.normalMap,q.normalMapTransform),q.normalScale.value.copy(N.normalScale),N.side===uJ)q.normalScale.value.negate()}if(N.displacementMap)q.displacementMap.value=N.displacementMap,$(N.displacementMap,q.displacementMapTransform),q.displacementScale.value=N.displacementScale,q.displacementBias.value=N.displacementBias;if(N.emissiveMap)q.emissiveMap.value=N.emissiveMap,$(N.emissiveMap,q.emissiveMapTransform);if(N.specularMap)q.specularMap.value=N.specularMap,$(N.specularMap,q.specularMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest;let L=Q.get(N),D=L.envMap,V=L.envMapRotation;if(D){if(q.envMap.value=D,q.envMapRotation.value.setFromMatrix4(FD.makeRotationFromEuler(V)).transpose(),D.isCubeTexture&&D.isRenderTargetTexture===!1)q.envMapRotation.value.premultiply(HE);q.reflectivity.value=N.reflectivity,q.ior.value=N.ior,q.refractionRatio.value=N.refractionRatio}if(N.lightMap)q.lightMap.value=N.lightMap,q.lightMapIntensity.value=N.lightMapIntensity,$(N.lightMap,q.lightMapTransform);if(N.aoMap)q.aoMap.value=N.aoMap,q.aoMapIntensity.value=N.aoMapIntensity,$(N.aoMap,q.aoMapTransform)}function X(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,N.map)q.map.value=N.map,$(N.map,q.mapTransform)}function K(q,N){q.dashSize.value=N.dashSize,q.totalSize.value=N.dashSize+N.gapSize,q.scale.value=N.scale}function H(q,N,L,D){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.size.value=N.size*L,q.scale.value=D*0.5,N.map)q.map.value=N.map,$(N.map,q.uvTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function U(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.rotation.value=N.rotation,N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function G(q,N){q.specular.value.copy(N.specular),q.shininess.value=Math.max(N.shininess,0.0001)}function F(q,N){if(N.gradientMap)q.gradientMap.value=N.gradientMap}function E(q,N){if(q.metalness.value=N.metalness,N.metalnessMap)q.metalnessMap.value=N.metalnessMap,$(N.metalnessMap,q.metalnessMapTransform);if(q.roughness.value=N.roughness,N.roughnessMap)q.roughnessMap.value=N.roughnessMap,$(N.roughnessMap,q.roughnessMapTransform);if(N.envMap)q.envMapIntensity.value=N.envMapIntensity}function O(q,N,L){if(q.ior.value=N.ior,N.sheen>0){if(q.sheenColor.value.copy(N.sheenColor).multiplyScalar(N.sheen),q.sheenRoughness.value=N.sheenRoughness,N.sheenColorMap)q.sheenColorMap.value=N.sheenColorMap,$(N.sheenColorMap,q.sheenColorMapTransform);if(N.sheenRoughnessMap)q.sheenRoughnessMap.value=N.sheenRoughnessMap,$(N.sheenRoughnessMap,q.sheenRoughnessMapTransform)}if(N.clearcoat>0){if(q.clearcoat.value=N.clearcoat,q.clearcoatRoughness.value=N.clearcoatRoughness,N.clearcoatMap)q.clearcoatMap.value=N.clearcoatMap,$(N.clearcoatMap,q.clearcoatMapTransform);if(N.clearcoatRoughnessMap)q.clearcoatRoughnessMap.value=N.clearcoatRoughnessMap,$(N.clearcoatRoughnessMap,q.clearcoatRoughnessMapTransform);if(N.clearcoatNormalMap){if(q.clearcoatNormalMap.value=N.clearcoatNormalMap,$(N.clearcoatNormalMap,q.clearcoatNormalMapTransform),q.clearcoatNormalScale.value.copy(N.clearcoatNormalScale),N.side===uJ)q.clearcoatNormalScale.value.negate()}}if(N.dispersion>0)q.dispersion.value=N.dispersion;if(N.iridescence>0){if(q.iridescence.value=N.iridescence,q.iridescenceIOR.value=N.iridescenceIOR,q.iridescenceThicknessMinimum.value=N.iridescenceThicknessRange[0],q.iridescenceThicknessMaximum.value=N.iridescenceThicknessRange[1],N.iridescenceMap)q.iridescenceMap.value=N.iridescenceMap,$(N.iridescenceMap,q.iridescenceMapTransform);if(N.iridescenceThicknessMap)q.iridescenceThicknessMap.value=N.iridescenceThicknessMap,$(N.iridescenceThicknessMap,q.iridescenceThicknessMapTransform)}if(N.transmission>0){if(q.transmission.value=N.transmission,q.transmissionSamplerMap.value=L.texture,q.transmissionSamplerSize.value.set(L.width,L.height),N.transmissionMap)q.transmissionMap.value=N.transmissionMap,$(N.transmissionMap,q.transmissionMapTransform);if(q.thickness.value=N.thickness,N.thicknessMap)q.thicknessMap.value=N.thicknessMap,$(N.thicknessMap,q.thicknessMapTransform);q.attenuationDistance.value=N.attenuationDistance,q.attenuationColor.value.copy(N.attenuationColor)}if(N.anisotropy>0){if(q.anisotropyVector.value.set(N.anisotropy*Math.cos(N.anisotropyRotation),N.anisotropy*Math.sin(N.anisotropyRotation)),N.anisotropyMap)q.anisotropyMap.value=N.anisotropyMap,$(N.anisotropyMap,q.anisotropyMapTransform)}if(q.specularIntensity.value=N.specularIntensity,q.specularColor.value.copy(N.specularColor),N.specularColorMap)q.specularColorMap.value=N.specularColorMap,$(N.specularColorMap,q.specularColorMapTransform);if(N.specularIntensityMap)q.specularIntensityMap.value=N.specularIntensityMap,$(N.specularIntensityMap,q.specularIntensityMapTransform)}function R(q,N){if(N.matcap)q.matcap.value=N.matcap}function M(q,N){let L=Q.get(N).light;q.referencePosition.value.setFromMatrixPosition(L.matrixWorld),q.nearDistance.value=L.shadow.camera.near,q.farDistance.value=L.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function OD(J,Q,$,Z){let W={},Y={},X=[],K=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function H(L,D){let V=D.program;Z.uniformBlockBinding(L,V)}function U(L,D){let V=W[L.id];if(V===void 0)R(L),V=G(L),W[L.id]=V,L.addEventListener("dispose",q);let z=D.program;Z.updateUBOMapping(L,z);let I=Q.render.frame;if(Y[L.id]!==I)E(L),Y[L.id]=I}function G(L){let D=F();L.__bindingPointIndex=D;let V=J.createBuffer(),z=L.__size,I=L.usage;return J.bindBuffer(J.UNIFORM_BUFFER,V),J.bufferData(J.UNIFORM_BUFFER,z,I),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,D,V),V}function F(){for(let L=0;L<K;L++)if(X.indexOf(L)===-1)return X.push(L),L;return v0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(L){let D=W[L.id],V=L.uniforms,z=L.__cache;J.bindBuffer(J.UNIFORM_BUFFER,D);for(let I=0,B=V.length;I<B;I++){let k=Array.isArray(V[I])?V[I]:[V[I]];for(let C=0,j=k.length;C<j;C++){let w=k[C];if(O(w,I,C,z)===!0){let v=w.__offset,b=Array.isArray(w.value)?w.value:[w.value],S=0;for(let h=0;h<b.length;h++){let x=b[h],p=M(x);if(typeof x==="number"||typeof x==="boolean")w.__data[0]=x,J.bufferSubData(J.UNIFORM_BUFFER,v+S,w.__data);else if(x.isMatrix3)w.__data[0]=x.elements[0],w.__data[1]=x.elements[1],w.__data[2]=x.elements[2],w.__data[3]=0,w.__data[4]=x.elements[3],w.__data[5]=x.elements[4],w.__data[6]=x.elements[5],w.__data[7]=0,w.__data[8]=x.elements[6],w.__data[9]=x.elements[7],w.__data[10]=x.elements[8],w.__data[11]=0;else if(ArrayBuffer.isView(x))w.__data.set(new x.constructor(x.buffer,x.byteOffset,w.__data.length));else x.toArray(w.__data,S),S+=p.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,v,w.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function O(L,D,V,z){let I=L.value,B=D+"_"+V;if(z[B]===void 0){if(typeof I==="number"||typeof I==="boolean")z[B]=I;else if(ArrayBuffer.isView(I))z[B]=I.slice();else z[B]=I.clone();return!0}else{let k=z[B];if(typeof I==="number"||typeof I==="boolean"){if(k!==I)return z[B]=I,!0}else if(ArrayBuffer.isView(I))return!0;else if(k.equals(I)===!1)return k.copy(I),!0}return!1}function R(L){let D=L.uniforms,V=0,z=16;for(let B=0,k=D.length;B<k;B++){let C=Array.isArray(D[B])?D[B]:[D[B]];for(let j=0,w=C.length;j<w;j++){let v=C[j],b=Array.isArray(v.value)?v.value:[v.value];for(let S=0,h=b.length;S<h;S++){let x=b[S],p=M(x),c=V%z,o=c%p.boundary,W0=c+o;if(V+=o,W0!==0&&z-W0<p.storage)V+=z-W0;v.__data=new Float32Array(p.storage/Float32Array.BYTES_PER_ELEMENT),v.__offset=V,V+=p.storage}}}let I=V%z;if(I>0)V+=z-I;return L.__size=V,L.__cache={},this}function M(L){let D={boundary:0,storage:0};if(typeof L==="number"||typeof L==="boolean")D.boundary=4,D.storage=4;else if(L.isVector2)D.boundary=8,D.storage=8;else if(L.isVector3||L.isColor)D.boundary=16,D.storage=12;else if(L.isVector4)D.boundary=16,D.storage=16;else if(L.isMatrix3)D.boundary=48,D.storage=48;else if(L.isMatrix4)D.boundary=64,D.storage=64;else if(L.isTexture)O0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(L))D.boundary=16,D.storage=L.byteLength;else O0("WebGLRenderer: Unsupported uniform value type.",L);return D}function q(L){let D=L.target;D.removeEventListener("dispose",q);let V=X.indexOf(D.__bindingPointIndex);X.splice(V,1),J.deleteBuffer(W[D.id]),delete W[D.id],delete Y[D.id]}function N(){for(let L in W)J.deleteBuffer(W[L]);X=[],W={},Y={}}return{bind:H,update:U,dispose:N}}var qD=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),O8=null;function RD(){if(O8===null)O8=new k9(qD,16,16,r8,wJ),O8.name="DFG_LUT",O8.minFilter=jJ,O8.magFilter=jJ,O8.wrapS=P6,O8.wrapT=P6,O8.generateMipmaps=!1,O8.needsUpdate=!0;return O8}class JY{constructor(J={}){let{canvas:Q=tX(),context:$=null,depth:Z=!0,stencil:W=!1,alpha:Y=!1,antialias:X=!1,premultipliedAlpha:K=!0,preserveDrawingBuffer:H=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:G=!1,reversedDepthBuffer:F=!1,outputBufferType:E=j9}=J;this.isWebGLRenderer=!0;let O;if($!==null){if(typeof WebGLRenderingContext<"u"&&$ instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");O=$.getContextAttributes().alpha}else O=Y;let R=E,M=new Set([jZ,SZ,TZ]),q=new Set([j9,w8,v7,T6,PZ,AZ]),N=new Uint32Array(4),L=new Int32Array(4),D=new A,V=null,z=null,I=[],B=[],k=null;this.domElement=Q,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=F9,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let C=this,j=!1,w=null;this._outputColorSpace=a9;let v=0,b=0,S=null,h=-1,x=null,p=new FJ,c=new FJ,o=null,W0=new e(0),H0=0,J0=Q.width,c0=Q.height,d0=1,s=null,F0=null,I0=new FJ(0,0,J0,c0),E0=new FJ(0,0,J0,c0),j0=!1,WJ=new G8,x0=!1,n0=!1,Q0=new y0,X0=new A,$0=new FJ,_0={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},C0=!1;function m0(){return S===null?d0:1}let y=$;function YJ(P,g){return Q.getContext(P,g)}try{let P={alpha:!0,depth:Z,stencil:W,antialias:X,premultipliedAlpha:K,preserveDrawingBuffer:H,powerPreference:U,failIfMajorPerformanceCaveat:G};if("setAttribute"in Q)Q.setAttribute("data-engine",`three.js r${WX}`);if(Q.addEventListener("webglcontextlost",S0,!1),Q.addEventListener("webglcontextrestored",Y0,!1),Q.addEventListener("webglcontextcreationerror",f0,!1),y===null){if(y=YJ("webgl2",P),y===null)if(YJ("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(P){throw v0("WebGLRenderer: "+P.message),P}let h0,l0,U0,NJ,A0,T,_,u,r,Z0,K0,M0,n,t,R0,T0,N0,k0,r0,$J,XJ,f,q0;function a(){if(h0=new zR(y),h0.init(),XJ=new YE(y,h0),l0=new RR(y,h0,J,XJ),U0=new HD(y,h0),l0.reversedDepthBuffer&&F)U0.buffers.depth.setReversed(!0);NJ=new wR(y),A0=new iL,T=new UD(y,h0,U0,A0,l0,XJ,NJ),_=new CR(C),u=new SN(y),f=new OR(y,u),r=new IR(y,u,NJ,f),Z0=new AR(y,r,u,f,NJ),k0=new PR(y,l0,T),R0=new LR(A0),K0=new sL(C,_,h0,l0,f,R0),M0=new ND(C,A0),n=new aL,t=new $D(h0),N0=new NR(C,_,U0,Z0,O,K),T0=new KD(C,Z0,l0),q0=new OD(y,NJ,l0,U0),r0=new qR(y,h0,NJ),$J=new _R(y,h0,NJ),NJ.programs=K0.programs,C.capabilities=l0,C.extensions=h0,C.properties=A0,C.renderLists=n,C.shadowMap=T0,C.state=U0,C.info=NJ}if(a(),R!==j9)k=new SR(R,Q.width,Q.height,Z,W);let G0=new KE(C,y);this.xr=G0,this.getContext=function(){return y},this.getContextAttributes=function(){return y.getContextAttributes()},this.forceContextLoss=function(){let P=h0.get("WEBGL_lose_context");if(P)P.loseContext()},this.forceContextRestore=function(){let P=h0.get("WEBGL_lose_context");if(P)P.restoreContext()},this.getPixelRatio=function(){return d0},this.setPixelRatio=function(P){if(P===void 0)return;d0=P,this.setSize(J0,c0,!1)},this.getSize=function(P){return P.set(J0,c0)},this.setSize=function(P,g,l=!0){if(G0.isPresenting){O0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(J0=P,c0=g,Q.width=Math.floor(P*d0),Q.height=Math.floor(g*d0),l===!0)Q.style.width=P+"px",Q.style.height=g+"px";if(k!==null)k.setSize(Q.width,Q.height);this.setViewport(0,0,P,g)},this.getDrawingBufferSize=function(P){return P.set(J0*d0,c0*d0).floor()},this.setDrawingBufferSize=function(P,g,l){J0=P,c0=g,d0=l,Q.width=Math.floor(P*l),Q.height=Math.floor(g*l),this.setViewport(0,0,P,g)},this.setEffects=function(P){if(R===j9){v0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(P){for(let g=0;g<P.length;g++)if(P[g].isOutputPass===!0){O0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}k.setEffects(P||[])},this.getCurrentViewport=function(P){return P.copy(p)},this.getViewport=function(P){return P.copy(I0)},this.setViewport=function(P,g,l,d){if(P.isVector4)I0.set(P.x,P.y,P.z,P.w);else I0.set(P,g,l,d);U0.viewport(p.copy(I0).multiplyScalar(d0).round())},this.getScissor=function(P){return P.copy(E0)},this.setScissor=function(P,g,l,d){if(P.isVector4)E0.set(P.x,P.y,P.z,P.w);else E0.set(P,g,l,d);U0.scissor(c.copy(E0).multiplyScalar(d0).round())},this.getScissorTest=function(){return j0},this.setScissorTest=function(P){U0.setScissorTest(j0=P)},this.setOpaqueSort=function(P){s=P},this.setTransparentSort=function(P){F0=P},this.getClearColor=function(P){return P.copy(N0.getClearColor())},this.setClearColor=function(){N0.setClearColor(...arguments)},this.getClearAlpha=function(){return N0.getClearAlpha()},this.setClearAlpha=function(){N0.setClearAlpha(...arguments)},this.clear=function(P=!0,g=!0,l=!0){let d=0;if(P){let m=!1;if(S!==null){let B0=S.texture.format;m=M.has(B0)}if(m){let B0=S.texture.type,P0=q.has(B0),V0=N0.getClearColor(),b0=N0.getClearAlpha(),g0=V0.r,JJ=V0.g,KJ=V0.b;if(P0)N[0]=g0,N[1]=JJ,N[2]=KJ,N[3]=b0,y.clearBufferuiv(y.COLOR,0,N);else L[0]=g0,L[1]=JJ,L[2]=KJ,L[3]=b0,y.clearBufferiv(y.COLOR,0,L)}else d|=y.COLOR_BUFFER_BIT}if(g)d|=y.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(l)d|=y.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(d!==0)y.clear(d)},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.setNodesHandler=function(P){P.setRenderer(this),w=P},this.dispose=function(){Q.removeEventListener("webglcontextlost",S0,!1),Q.removeEventListener("webglcontextrestored",Y0,!1),Q.removeEventListener("webglcontextcreationerror",f0,!1),N0.dispose(),n.dispose(),t.dispose(),A0.dispose(),_.dispose(),Z0.dispose(),f.dispose(),q0.dispose(),K0.dispose(),G0.dispose(),G0.removeEventListener("sessionstart",bH),G0.removeEventListener("sessionend",hH),K6.stop()};function S0(P){P.preventDefault(),B7("WebGLRenderer: Context Lost."),j=!0}function Y0(){B7("WebGLRenderer: Context Restored."),j=!1;let P=NJ.autoReset,g=T0.enabled,l=T0.autoUpdate,d=T0.needsUpdate,m=T0.type;a(),NJ.autoReset=P,T0.enabled=g,T0.autoUpdate=l,T0.needsUpdate=d,T0.type=m}function f0(P){v0("WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function e0(P){let g=P.target;g.removeEventListener("dispose",e0),gJ(g)}function gJ(P){qJ(P),A0.remove(P)}function qJ(P){let g=A0.get(P).programs;if(g!==void 0){if(g.forEach(function(l){K0.releaseProgram(l)}),P.isShaderMaterial)K0.releaseShaderCache(P)}}this.renderBufferDirect=function(P,g,l,d,m,B0){if(g===null)g=_0;let P0=m.isMesh&&m.matrixWorld.determinant()<0,V0=P1(P,g,l,d,m);U0.setMaterial(d,P0);let b0=l.index,g0=1;if(d.wireframe===!0){if(b0=r.getWireframeAttribute(l),b0===void 0)return;g0=2}let JJ=l.drawRange,KJ=l.attributes.position,p0=JJ.start*g0,RJ=(JJ.start+JJ.count)*g0;if(B0!==null)p0=Math.max(p0,B0.start*g0),RJ=Math.min(RJ,(B0.start+B0.count)*g0);if(b0!==null)p0=Math.max(p0,0),RJ=Math.min(RJ,b0.count);else if(KJ!==void 0&&KJ!==null)p0=Math.max(p0,0),RJ=Math.min(RJ,KJ.count);let yJ=RJ-p0;if(yJ<0||yJ===1/0)return;f.setup(m,d,V0,l,b0);let AJ,DJ=r0;if(b0!==null)AJ=u.get(b0),DJ=$J,DJ.setIndex(AJ);if(m.isMesh)if(d.wireframe===!0)U0.setLineWidth(d.wireframeLinewidth*m0()),DJ.setMode(y.LINES);else DJ.setMode(y.TRIANGLES);else if(m.isLine){let aJ=d.linewidth;if(aJ===void 0)aJ=1;if(U0.setLineWidth(aJ*m0()),m.isLineSegments)DJ.setMode(y.LINES);else if(m.isLineLoop)DJ.setMode(y.LINE_LOOP);else DJ.setMode(y.LINE_STRIP)}else if(m.isPoints)DJ.setMode(y.POINTS);else if(m.isSprite)DJ.setMode(y.TRIANGLES);if(m.isBatchedMesh)if(!h0.get("WEBGL_multi_draw")){let{_multiDrawStarts:aJ,_multiDrawCounts:w0,_multiDrawCount:R9}=m,EJ=b0?u.get(b0).bytesPerElement:1,I9=A0.get(d).currentProgram.getUniforms();for(let $8=0;$8<R9;$8++)I9.setValue(y,"_gl_DrawID",$8),DJ.render(aJ[$8]/EJ,w0[$8])}else DJ.renderMultiDraw(m._multiDrawStarts,m._multiDrawCounts,m._multiDrawCount);else if(m.isInstancedMesh)DJ.renderInstances(p0,yJ,m.count);else if(l.isInstancedBufferGeometry){let aJ=l._maxInstanceCount!==void 0?l._maxInstanceCount:1/0,w0=Math.min(l.instanceCount,aJ);DJ.renderInstances(p0,yJ,w0)}else DJ.render(p0,yJ)};function Q8(P,g,l){if(P.transparent===!0&&P.side===X9&&P.forceSinglePass===!1)P.side=uJ,P.needsUpdate=!0,T$(P,g,l),P.side=s9,P.needsUpdate=!0,T$(P,g,l),P.side=X9;else T$(P,g,l)}this.compile=function(P,g,l=null){if(l===null)l=P;if(z=t.get(l),z.init(g),B.push(z),l.traverseVisible(function(m){if(m.isLight&&m.layers.test(g.layers)){if(z.pushLight(m),m.castShadow)z.pushShadow(m)}}),P!==l)P.traverseVisible(function(m){if(m.isLight&&m.layers.test(g.layers)){if(z.pushLight(m),m.castShadow)z.pushShadow(m)}});z.setupLights();let d=new Set;return P.traverse(function(m){if(!(m.isMesh||m.isPoints||m.isLine||m.isSprite))return;let B0=m.material;if(B0)if(Array.isArray(B0))for(let P0=0;P0<B0.length;P0++){let V0=B0[P0];Q8(V0,l,m),d.add(V0)}else Q8(B0,l,m),d.add(B0)}),z=B.pop(),d},this.compileAsync=function(P,g,l=null){let d=this.compile(P,g,l);return new Promise((m)=>{function B0(){if(d.forEach(function(P0){if(A0.get(P0).currentProgram.isReady())d.delete(P0)}),d.size===0){m(P);return}setTimeout(B0,10)}if(h0.get("KHR_parallel_shader_compile")!==null)B0();else setTimeout(B0,10)})};let g9=null;function _1(P){if(g9)g9(P)}function bH(){K6.stop()}function hH(){K6.start()}let K6=new i5;if(K6.setAnimationLoop(_1),typeof self<"u")K6.setContext(self);this.setAnimationLoop=function(P){g9=P,G0.setAnimationLoop(P),P===null?K6.stop():K6.start()},G0.addEventListener("sessionstart",bH),G0.addEventListener("sessionend",hH),this.render=function(P,g){if(g!==void 0&&g.isCamera!==!0){v0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(j===!0)return;if(w!==null)w.renderStart(P,g);let l=G0.enabled===!0&&G0.isPresenting===!0,d=k!==null&&(S===null||l)&&k.begin(C,S);if(P.matrixWorldAutoUpdate===!0)P.updateMatrixWorld();if(g.parent===null&&g.matrixWorldAutoUpdate===!0)g.updateMatrixWorld();if(G0.enabled===!0&&G0.isPresenting===!0&&(k===null||k.isCompositing()===!1)){if(G0.cameraAutoUpdate===!0)G0.updateCamera(g);g=G0.getCamera()}if(P.isScene===!0)P.onBeforeRender(C,P,g,S);if(z=t.get(P,B.length),z.init(g),z.state.textureUnits=T.getTextureUnits(),B.push(z),Q0.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),WJ.setFromProjectionMatrix(Q0,OW,g.reversedDepth),n0=this.localClippingEnabled,x0=R0.init(this.clippingPlanes,n0),V=n.get(P,I.length),V.init(),I.push(V),G0.enabled===!0&&G0.isPresenting===!0){let P0=C.xr.getDepthSensingMesh();if(P0!==null)OY(P0,g,-1/0,C.sortObjects)}if(OY(P,g,0,C.sortObjects),V.finish(),C.sortObjects===!0)V.sort(s,F0);if(C0=G0.enabled===!1||G0.isPresenting===!1||G0.hasDepthSensing()===!1,C0)N0.addToRenderList(V,P);if(this.info.render.frame++,x0===!0)R0.beginShadows();let m=z.state.shadowsArray;if(T0.render(m,P,g),x0===!0)R0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((d&&k.hasRenderPass())===!1){let{opaque:P0,transmissive:V0}=V;if(z.setupLights(),g.isArrayCamera){let b0=g.cameras;if(V0.length>0)for(let g0=0,JJ=b0.length;g0<JJ;g0++){let KJ=b0[g0];gH(P0,V0,P,KJ)}if(C0)N0.render(P);for(let g0=0,JJ=b0.length;g0<JJ;g0++){let KJ=b0[g0];fH(V,P,KJ,KJ.viewport)}}else{if(V0.length>0)gH(P0,V0,P,g);if(C0)N0.render(P);fH(V,P,g)}}if(S!==null&&b===0)T.updateMultisampleRenderTarget(S),T.updateRenderTargetMipmap(S);if(d)k.end(C);if(P.isScene===!0)P.onAfterRender(C,P,g);if(f.resetDefaultState(),h=-1,x=null,B.pop(),B.length>0){if(z=B[B.length-1],T.setTextureUnits(z.state.textureUnits),x0===!0)R0.setGlobalState(C.clippingPlanes,z.state.camera)}else z=null;if(I.pop(),I.length>0)V=I[I.length-1];else V=null;if(w!==null)w.renderEnd()};function OY(P,g,l,d){if(P.visible===!1)return;if(P.layers.test(g.layers)){if(P.isGroup)l=P.renderOrder;else if(P.isLOD){if(P.autoUpdate===!0)P.update(g)}else if(P.isLightProbeGrid)z.pushLightProbeGrid(P);else if(P.isLight){if(z.pushLight(P),P.castShadow)z.pushShadow(P)}else if(P.isSprite){if(!P.frustumCulled||WJ.intersectsSprite(P)){if(d)$0.setFromMatrixPosition(P.matrixWorld).applyMatrix4(Q0);let P0=Z0.update(P),V0=P.material;if(V0.visible)V.push(P,P0,V0,l,$0.z,null)}}else if(P.isMesh||P.isLine||P.isPoints){if(!P.frustumCulled||WJ.intersectsObject(P)){let P0=Z0.update(P),V0=P.material;if(d){if(P.boundingSphere!==void 0){if(P.boundingSphere===null)P.computeBoundingSphere();$0.copy(P.boundingSphere.center)}else{if(P0.boundingSphere===null)P0.computeBoundingSphere();$0.copy(P0.boundingSphere.center)}$0.applyMatrix4(P.matrixWorld).applyMatrix4(Q0)}if(Array.isArray(V0)){let b0=P0.groups;for(let g0=0,JJ=b0.length;g0<JJ;g0++){let KJ=b0[g0],p0=V0[KJ.materialIndex];if(p0&&p0.visible)V.push(P,P0,p0,l,$0.z,KJ)}}else if(V0.visible)V.push(P,P0,V0,l,$0.z,null)}}}let B0=P.children;for(let P0=0,V0=B0.length;P0<V0;P0++)OY(B0[P0],g,l,d)}function fH(P,g,l,d){let{opaque:m,transmissive:B0,transparent:P0}=P;if(z.setupLightsView(l),x0===!0)R0.setGlobalState(C.clippingPlanes,l);if(d)U0.viewport(p.copy(d));if(m.length>0)A$(m,g,l);if(B0.length>0)A$(B0,g,l);if(P0.length>0)A$(P0,g,l);U0.buffers.depth.setTest(!0),U0.buffers.depth.setMask(!0),U0.buffers.color.setMask(!0),U0.setPolygonOffset(!1)}function gH(P,g,l,d){if((l.isScene===!0?l.overrideMaterial:null)!==null)return;if(z.state.transmissionRenderTarget[d.id]===void 0){let p0=h0.has("EXT_color_buffer_half_float")||h0.has("EXT_color_buffer_float");z.state.transmissionRenderTarget[d.id]=new PJ(1,1,{generateMipmaps:!0,type:p0?wJ:j9,minFilter:i9,samples:Math.max(4,l0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:t0.workingColorSpace})}let B0=z.state.transmissionRenderTarget[d.id],P0=d.viewport||p;B0.setSize(P0.z*C.transmissionResolutionScale,P0.w*C.transmissionResolutionScale);let V0=C.getRenderTarget(),b0=C.getActiveCubeFace(),g0=C.getActiveMipmapLevel();if(C.setRenderTarget(B0),C.getClearColor(W0),H0=C.getClearAlpha(),H0<1)C.setClearColor(16777215,0.5);if(C.clear(),C0)N0.render(l);let JJ=C.toneMapping;C.toneMapping=F9;let KJ=d.viewport;if(d.viewport!==void 0)d.viewport=void 0;if(z.setupLightsView(d),x0===!0)R0.setGlobalState(C.clippingPlanes,d);if(A$(P,l,d),T.updateMultisampleRenderTarget(B0),T.updateRenderTargetMipmap(B0),h0.has("WEBGL_multisampled_render_to_texture")===!1){let p0=!1;for(let RJ=0,yJ=g.length;RJ<yJ;RJ++){let AJ=g[RJ],{object:DJ,geometry:aJ,material:w0,group:R9}=AJ;if(w0.side===X9&&DJ.layers.test(d.layers)){let EJ=w0.side;w0.side=uJ,w0.needsUpdate=!0,pH(DJ,l,d,aJ,w0,R9),w0.side=EJ,w0.needsUpdate=!0,p0=!0}}if(p0===!0)T.updateMultisampleRenderTarget(B0),T.updateRenderTargetMipmap(B0)}if(C.setRenderTarget(V0,b0,g0),C.setClearColor(W0,H0),KJ!==void 0)d.viewport=KJ;C.toneMapping=JJ}function A$(P,g,l){let d=g.isScene===!0?g.overrideMaterial:null;for(let m=0,B0=P.length;m<B0;m++){let P0=P[m],{object:V0,geometry:b0,group:g0}=P0,JJ=P0.material;if(JJ.allowOverride===!0&&d!==null)JJ=d;if(V0.layers.test(l.layers))pH(V0,g,l,b0,JJ,g0)}}function pH(P,g,l,d,m,B0){if(P.onBeforeRender(C,g,l,d,m,B0),P.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),m.onBeforeRender(C,g,l,d,P,B0),m.transparent===!0&&m.side===X9&&m.forceSinglePass===!1)m.side=uJ,m.needsUpdate=!0,C.renderBufferDirect(l,g,d,m,P,B0),m.side=s9,m.needsUpdate=!0,C.renderBufferDirect(l,g,d,m,P,B0),m.side=X9;else C.renderBufferDirect(l,g,d,m,P,B0);P.onAfterRender(C,g,l,d,m,B0)}function T$(P,g,l){if(g.isScene!==!0)g=_0;let d=A0.get(P),m=z.state.lights,B0=z.state.shadowsArray,P0=m.state.version,V0=K0.getParameters(P,m.state,B0,g,l,z.state.lightProbeGridArray),b0=K0.getProgramCacheKey(V0),g0=d.programs;d.environment=P.isMeshStandardMaterial||P.isMeshLambertMaterial||P.isMeshPhongMaterial?g.environment:null,d.fog=g.fog;let JJ=P.isMeshStandardMaterial||P.isMeshLambertMaterial&&!P.envMap||P.isMeshPhongMaterial&&!P.envMap;if(d.envMap=_.get(P.envMap||d.environment,JJ),d.envMapRotation=d.environment!==null&&P.envMap===null?g.environmentRotation:P.envMapRotation,g0===void 0)P.addEventListener("dispose",e0),g0=new Map,d.programs=g0;let KJ=g0.get(b0);if(KJ!==void 0){if(d.currentProgram===KJ&&d.lightsStateVersion===P0)return dH(P,V0),KJ}else{if(V0.uniforms=K0.getUniforms(P),w!==null&&P.isNodeMaterial)w.build(P,l,V0);P.onBeforeCompile(V0,C),KJ=K0.acquireProgram(V0,b0),g0.set(b0,KJ),d.uniforms=V0.uniforms}let p0=d.uniforms;if(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)p0.clippingPlanes=R0.uniform;if(dH(P,V0),d.needsLights=T1(P),d.lightsStateVersion=P0,d.needsLights)p0.ambientLightColor.value=m.state.ambient,p0.lightProbe.value=m.state.probe,p0.directionalLights.value=m.state.directional,p0.directionalLightShadows.value=m.state.directionalShadow,p0.spotLights.value=m.state.spot,p0.spotLightShadows.value=m.state.spotShadow,p0.rectAreaLights.value=m.state.rectArea,p0.ltc_1.value=m.state.rectAreaLTC1,p0.ltc_2.value=m.state.rectAreaLTC2,p0.pointLights.value=m.state.point,p0.pointLightShadows.value=m.state.pointShadow,p0.hemisphereLights.value=m.state.hemi,p0.directionalShadowMatrix.value=m.state.directionalShadowMatrix,p0.spotLightMatrix.value=m.state.spotLightMatrix,p0.spotLightMap.value=m.state.spotLightMap,p0.pointShadowMatrix.value=m.state.pointShadowMatrix;return d.lightProbeGrid=z.state.lightProbeGridArray.length>0,d.currentProgram=KJ,d.uniformsList=null,KJ}function uH(P){if(P.uniformsList===null){let g=P.currentProgram.getUniforms();P.uniformsList=B$.seqWithValue(g.seq,P.uniforms)}return P.uniformsList}function dH(P,g){let l=A0.get(P);l.outputColorSpace=g.outputColorSpace,l.batching=g.batching,l.batchingColor=g.batchingColor,l.instancing=g.instancing,l.instancingColor=g.instancingColor,l.instancingMorph=g.instancingMorph,l.skinning=g.skinning,l.morphTargets=g.morphTargets,l.morphNormals=g.morphNormals,l.morphColors=g.morphColors,l.morphTargetsCount=g.morphTargetsCount,l.numClippingPlanes=g.numClippingPlanes,l.numIntersection=g.numClipIntersection,l.vertexAlphas=g.vertexAlphas,l.vertexTangents=g.vertexTangents,l.toneMapping=g.toneMapping}function w1(P,g){if(P.length===0)return null;if(P.length===1)return P[0].texture!==null?P[0]:null;D.setFromMatrixPosition(g.matrixWorld);for(let l=0,d=P.length;l<d;l++){let m=P[l];if(m.texture!==null&&m.boundingBox.containsPoint(D))return m}return null}function P1(P,g,l,d,m){if(g.isScene!==!0)g=_0;T.resetTextureUnits();let B0=g.fog,P0=d.isMeshStandardMaterial||d.isMeshLambertMaterial||d.isMeshPhongMaterial?g.environment:null,V0=S===null?C.outputColorSpace:S.isXRRenderTarget===!0?S.texture.colorSpace:t0.workingColorSpace,b0=d.isMeshStandardMaterial||d.isMeshLambertMaterial&&!d.envMap||d.isMeshPhongMaterial&&!d.envMap,g0=_.get(d.envMap||P0,b0),JJ=d.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,KJ=!!l.attributes.tangent&&(!!d.normalMap||d.anisotropy>0),p0=!!l.morphAttributes.position,RJ=!!l.morphAttributes.normal,yJ=!!l.morphAttributes.color,AJ=F9;if(d.toneMapped){if(S===null||S.isXRRenderTarget===!0)AJ=C.toneMapping}let DJ=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,aJ=DJ!==void 0?DJ.length:0,w0=A0.get(d),R9=z.state.lights;if(x0===!0){if(n0===!0||P!==x){let VJ=P===x&&d.id===h;R0.setState(d,P,VJ)}}let EJ=!1;if(d.version===w0.__version){if(w0.needsLights&&w0.lightsStateVersion!==R9.state.version)EJ=!0;else if(w0.outputColorSpace!==V0)EJ=!0;else if(m.isBatchedMesh&&w0.batching===!1)EJ=!0;else if(!m.isBatchedMesh&&w0.batching===!0)EJ=!0;else if(m.isBatchedMesh&&w0.batchingColor===!0&&m.colorTexture===null)EJ=!0;else if(m.isBatchedMesh&&w0.batchingColor===!1&&m.colorTexture!==null)EJ=!0;else if(m.isInstancedMesh&&w0.instancing===!1)EJ=!0;else if(!m.isInstancedMesh&&w0.instancing===!0)EJ=!0;else if(m.isSkinnedMesh&&w0.skinning===!1)EJ=!0;else if(!m.isSkinnedMesh&&w0.skinning===!0)EJ=!0;else if(m.isInstancedMesh&&w0.instancingColor===!0&&m.instanceColor===null)EJ=!0;else if(m.isInstancedMesh&&w0.instancingColor===!1&&m.instanceColor!==null)EJ=!0;else if(m.isInstancedMesh&&w0.instancingMorph===!0&&m.morphTexture===null)EJ=!0;else if(m.isInstancedMesh&&w0.instancingMorph===!1&&m.morphTexture!==null)EJ=!0;else if(w0.envMap!==g0)EJ=!0;else if(d.fog===!0&&w0.fog!==B0)EJ=!0;else if(w0.numClippingPlanes!==void 0&&(w0.numClippingPlanes!==R0.numPlanes||w0.numIntersection!==R0.numIntersection))EJ=!0;else if(w0.vertexAlphas!==JJ)EJ=!0;else if(w0.vertexTangents!==KJ)EJ=!0;else if(w0.morphTargets!==p0)EJ=!0;else if(w0.morphNormals!==RJ)EJ=!0;else if(w0.morphColors!==yJ)EJ=!0;else if(w0.toneMapping!==AJ)EJ=!0;else if(w0.morphTargetsCount!==aJ)EJ=!0;else if(!!w0.lightProbeGrid!==z.state.lightProbeGridArray.length>0)EJ=!0}else EJ=!0,w0.__version=d.version;let I9=w0.currentProgram;if(EJ===!0){if(I9=T$(d,g,m),w&&d.isNodeMaterial)w.onUpdateProgram(d,I9,w0)}let $8=!1,v8=!1,r6=!1,MJ=I9.getUniforms(),xJ=w0.uniforms;if(U0.useProgram(I9.program))$8=!0,v8=!0,r6=!0;if(d.id!==h)h=d.id,v8=!0;if(w0.needsLights){let VJ=w1(z.state.lightProbeGridArray,m);if(w0.lightProbeGrid!==VJ)w0.lightProbeGrid=VJ,v8=!0}if($8||x!==P){if(U0.buffers.depth.getReversed()&&P.reversedDepth!==!0)P._reversedDepth=!0,P.updateProjectionMatrix();MJ.setValue(y,"projectionMatrix",P.projectionMatrix),MJ.setValue(y,"viewMatrix",P.matrixWorldInverse);let x8=MJ.map.cameraPosition;if(x8!==void 0)x8.setValue(y,X0.setFromMatrixPosition(P.matrixWorld));if(l0.logarithmicDepthBuffer)MJ.setValue(y,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2));if(d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshLambertMaterial||d.isMeshBasicMaterial||d.isMeshStandardMaterial||d.isShaderMaterial)MJ.setValue(y,"isOrthographic",P.isOrthographicCamera===!0);if(x!==P)x=P,v8=!0,r6=!0}if(w0.needsLights){if(R9.state.directionalShadowMap.length>0)MJ.setValue(y,"directionalShadowMap",R9.state.directionalShadowMap,T);if(R9.state.spotShadowMap.length>0)MJ.setValue(y,"spotShadowMap",R9.state.spotShadowMap,T);if(R9.state.pointShadowMap.length>0)MJ.setValue(y,"pointShadowMap",R9.state.pointShadowMap,T)}if(m.isSkinnedMesh){MJ.setOptional(y,m,"bindMatrix"),MJ.setOptional(y,m,"bindMatrixInverse");let VJ=m.skeleton;if(VJ){if(VJ.boneTexture===null)VJ.computeBoneTexture();MJ.setValue(y,"boneTexture",VJ.boneTexture,T)}}if(m.isBatchedMesh){if(MJ.setOptional(y,m,"batchingTexture"),MJ.setValue(y,"batchingTexture",m._matricesTexture,T),MJ.setOptional(y,m,"batchingIdTexture"),MJ.setValue(y,"batchingIdTexture",m._indirectTexture,T),MJ.setOptional(y,m,"batchingColorTexture"),m._colorsTexture!==null)MJ.setValue(y,"batchingColorTexture",m._colorsTexture,T)}let y8=l.morphAttributes;if(y8.position!==void 0||y8.normal!==void 0||y8.color!==void 0)k0.update(m,l,I9);if(v8||w0.receiveShadow!==m.receiveShadow)w0.receiveShadow=m.receiveShadow,MJ.setValue(y,"receiveShadow",m.receiveShadow);if((d.isMeshStandardMaterial||d.isMeshLambertMaterial||d.isMeshPhongMaterial)&&d.envMap===null&&g.environment!==null)xJ.envMapIntensity.value=g.environmentIntensity;if(xJ.dfgLUT!==void 0)xJ.dfgLUT.value=RD();if(v8){if(MJ.setValue(y,"toneMappingExposure",C.toneMappingExposure),w0.needsLights)A1(xJ,r6);if(B0&&d.fog===!0)M0.refreshFogUniforms(xJ,B0);if(M0.refreshMaterialUniforms(xJ,d,d0,c0,z.state.transmissionRenderTarget[P.id]),w0.needsLights&&w0.lightProbeGrid){let VJ=w0.lightProbeGrid;xJ.probesSH.value=VJ.texture,xJ.probesMin.value.copy(VJ.boundingBox.min),xJ.probesMax.value.copy(VJ.boundingBox.max),xJ.probesResolution.value.copy(VJ.resolution)}B$.upload(y,uH(w0),xJ,T)}if(d.isShaderMaterial&&d.uniformsNeedUpdate===!0)B$.upload(y,uH(w0),xJ,T),d.uniformsNeedUpdate=!1;if(d.isSpriteMaterial)MJ.setValue(y,"center",m.center);if(MJ.setValue(y,"modelViewMatrix",m.modelViewMatrix),MJ.setValue(y,"normalMatrix",m.normalMatrix),MJ.setValue(y,"modelMatrix",m.matrixWorld),d.uniformsGroups!==void 0){let VJ=d.uniformsGroups;for(let x8=0,t6=VJ.length;x8<t6;x8++){let mH=VJ[x8];q0.update(mH,I9),q0.bind(mH,I9)}}return I9}function A1(P,g){P.ambientLightColor.needsUpdate=g,P.lightProbe.needsUpdate=g,P.directionalLights.needsUpdate=g,P.directionalLightShadows.needsUpdate=g,P.pointLights.needsUpdate=g,P.pointLightShadows.needsUpdate=g,P.spotLights.needsUpdate=g,P.spotLightShadows.needsUpdate=g,P.rectAreaLights.needsUpdate=g,P.hemisphereLights.needsUpdate=g}function T1(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return S},this.setRenderTargetTextures=function(P,g,l){let d=A0.get(P);if(d.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,d.__autoAllocateDepthBuffer===!1)d.__useRenderToTexture=!1;A0.get(P.texture).__webglTexture=g,A0.get(P.depthTexture).__webglTexture=d.__autoAllocateDepthBuffer?void 0:l,d.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,g){let l=A0.get(P);l.__webglFramebuffer=g,l.__useDefaultFramebuffer=g===void 0};let S1=y.createFramebuffer();this.setRenderTarget=function(P,g=0,l=0){S=P,v=g,b=l;let d=null,m=!1,B0=!1;if(P){let V0=A0.get(P);if(V0.__useDefaultFramebuffer!==void 0){U0.bindFramebuffer(y.FRAMEBUFFER,V0.__webglFramebuffer),p.copy(P.viewport),c.copy(P.scissor),o=P.scissorTest,U0.viewport(p),U0.scissor(c),U0.setScissorTest(o),h=-1;return}else if(V0.__webglFramebuffer===void 0)T.setupRenderTarget(P);else if(V0.__hasExternalTextures)T.rebindTextures(P,A0.get(P.texture).__webglTexture,A0.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){let JJ=P.depthTexture;if(V0.__boundDepthTexture!==JJ){if(JJ!==null&&A0.has(JJ)&&(P.width!==JJ.image.width||P.height!==JJ.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");T.setupDepthRenderbuffer(P)}}let b0=P.texture;if(b0.isData3DTexture||b0.isDataArrayTexture||b0.isCompressedArrayTexture)B0=!0;let g0=A0.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget){if(Array.isArray(g0[g]))d=g0[g][l];else d=g0[g];m=!0}else if(P.samples>0&&T.useMultisampledRTT(P)===!1)d=A0.get(P).__webglMultisampledFramebuffer;else if(Array.isArray(g0))d=g0[l];else d=g0;p.copy(P.viewport),c.copy(P.scissor),o=P.scissorTest}else p.copy(I0).multiplyScalar(d0).floor(),c.copy(E0).multiplyScalar(d0).floor(),o=j0;if(l!==0)d=S1;if(U0.bindFramebuffer(y.FRAMEBUFFER,d))U0.drawBuffers(P,d);if(U0.viewport(p),U0.scissor(c),U0.setScissorTest(o),m){let V0=A0.get(P.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_CUBE_MAP_POSITIVE_X+g,V0.__webglTexture,l)}else if(B0){let V0=g;for(let b0=0;b0<P.textures.length;b0++){let g0=A0.get(P.textures[b0]);y.framebufferTextureLayer(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0+b0,g0.__webglTexture,l,V0)}}else if(P!==null&&l!==0){let V0=A0.get(P.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,V0.__webglTexture,l)}h=-1},this.readRenderTargetPixels=function(P,g,l,d,m,B0,P0,V0=0){if(!(P&&P.isWebGLRenderTarget)){v0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let b0=A0.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&P0!==void 0)b0=b0[P0];if(b0){U0.bindFramebuffer(y.FRAMEBUFFER,b0);try{let g0=P.textures[V0],JJ=g0.format,KJ=g0.type;if(P.textures.length>1)y.readBuffer(y.COLOR_ATTACHMENT0+V0);if(!l0.textureFormatReadable(JJ)){v0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!l0.textureTypeReadable(KJ)){v0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(g>=0&&g<=P.width-d&&(l>=0&&l<=P.height-m))y.readPixels(g,l,d,m,XJ.convert(JJ),XJ.convert(KJ),B0)}finally{let g0=S!==null?A0.get(S).__webglFramebuffer:null;U0.bindFramebuffer(y.FRAMEBUFFER,g0)}}},this.readRenderTargetPixelsAsync=async function(P,g,l,d,m,B0,P0,V0=0){if(!(P&&P.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let b0=A0.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&P0!==void 0)b0=b0[P0];if(b0)if(g>=0&&g<=P.width-d&&(l>=0&&l<=P.height-m)){U0.bindFramebuffer(y.FRAMEBUFFER,b0);let g0=P.textures[V0],JJ=g0.format,KJ=g0.type;if(P.textures.length>1)y.readBuffer(y.COLOR_ATTACHMENT0+V0);if(!l0.textureFormatReadable(JJ))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!l0.textureTypeReadable(KJ))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let p0=y.createBuffer();y.bindBuffer(y.PIXEL_PACK_BUFFER,p0),y.bufferData(y.PIXEL_PACK_BUFFER,B0.byteLength,y.STREAM_READ),y.readPixels(g,l,d,m,XJ.convert(JJ),XJ.convert(KJ),0);let RJ=S!==null?A0.get(S).__webglFramebuffer:null;U0.bindFramebuffer(y.FRAMEBUFFER,RJ);let yJ=y.fenceSync(y.SYNC_GPU_COMMANDS_COMPLETE,0);return y.flush(),await U5(y,yJ,4),y.bindBuffer(y.PIXEL_PACK_BUFFER,p0),y.getBufferSubData(y.PIXEL_PACK_BUFFER,0,B0),y.deleteBuffer(p0),y.deleteSync(yJ),B0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,g=null,l=0){let d=Math.pow(2,-l),m=Math.floor(P.image.width*d),B0=Math.floor(P.image.height*d),P0=g!==null?g.x:0,V0=g!==null?g.y:0;T.setTexture2D(P,0),y.copyTexSubImage2D(y.TEXTURE_2D,l,0,0,P0,V0,m,B0),U0.unbindTexture()};let j1=y.createFramebuffer(),v1=y.createFramebuffer();if(this.copyTextureToTexture=function(P,g,l=null,d=null,m=0,B0=0){let P0,V0,b0,g0,JJ,KJ,p0,RJ,yJ,AJ=P.isCompressedTexture?P.mipmaps[B0]:P.image;if(l!==null)P0=l.max.x-l.min.x,V0=l.max.y-l.min.y,b0=l.isBox3?l.max.z-l.min.z:1,g0=l.min.x,JJ=l.min.y,KJ=l.isBox3?l.min.z:0;else{let xJ=Math.pow(2,-m);if(P0=Math.floor(AJ.width*xJ),V0=Math.floor(AJ.height*xJ),P.isDataArrayTexture)b0=AJ.depth;else if(P.isData3DTexture)b0=Math.floor(AJ.depth*xJ);else b0=1;g0=0,JJ=0,KJ=0}if(d!==null)p0=d.x,RJ=d.y,yJ=d.z;else p0=0,RJ=0,yJ=0;let DJ=XJ.convert(g.format),aJ=XJ.convert(g.type),w0;if(g.isData3DTexture)T.setTexture3D(g,0),w0=y.TEXTURE_3D;else if(g.isDataArrayTexture||g.isCompressedArrayTexture)T.setTexture2DArray(g,0),w0=y.TEXTURE_2D_ARRAY;else T.setTexture2D(g,0),w0=y.TEXTURE_2D;U0.activeTexture(y.TEXTURE0),U0.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,g.flipY),U0.pixelStorei(y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),U0.pixelStorei(y.UNPACK_ALIGNMENT,g.unpackAlignment);let R9=U0.getParameter(y.UNPACK_ROW_LENGTH),EJ=U0.getParameter(y.UNPACK_IMAGE_HEIGHT),I9=U0.getParameter(y.UNPACK_SKIP_PIXELS),$8=U0.getParameter(y.UNPACK_SKIP_ROWS),v8=U0.getParameter(y.UNPACK_SKIP_IMAGES);U0.pixelStorei(y.UNPACK_ROW_LENGTH,AJ.width),U0.pixelStorei(y.UNPACK_IMAGE_HEIGHT,AJ.height),U0.pixelStorei(y.UNPACK_SKIP_PIXELS,g0),U0.pixelStorei(y.UNPACK_SKIP_ROWS,JJ),U0.pixelStorei(y.UNPACK_SKIP_IMAGES,KJ);let r6=P.isDataArrayTexture||P.isData3DTexture,MJ=g.isDataArrayTexture||g.isData3DTexture;if(P.isDepthTexture){let xJ=A0.get(P),y8=A0.get(g),VJ=A0.get(xJ.__renderTarget),x8=A0.get(y8.__renderTarget);U0.bindFramebuffer(y.READ_FRAMEBUFFER,VJ.__webglFramebuffer),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,x8.__webglFramebuffer);for(let t6=0;t6<b0;t6++){if(r6)y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,A0.get(P).__webglTexture,m,KJ+t6),y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,A0.get(g).__webglTexture,B0,yJ+t6);y.blitFramebuffer(g0,JJ,P0,V0,p0,RJ,P0,V0,y.DEPTH_BUFFER_BIT,y.NEAREST)}U0.bindFramebuffer(y.READ_FRAMEBUFFER,null),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else if(m!==0||P.isRenderTargetTexture||A0.has(P)){let xJ=A0.get(P),y8=A0.get(g);U0.bindFramebuffer(y.READ_FRAMEBUFFER,j1),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,v1);for(let VJ=0;VJ<b0;VJ++){if(r6)y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,xJ.__webglTexture,m,KJ+VJ);else y.framebufferTexture2D(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,xJ.__webglTexture,m);if(MJ)y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y8.__webglTexture,B0,yJ+VJ);else y.framebufferTexture2D(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,y8.__webglTexture,B0);if(m!==0)y.blitFramebuffer(g0,JJ,P0,V0,p0,RJ,P0,V0,y.COLOR_BUFFER_BIT,y.NEAREST);else if(MJ)y.copyTexSubImage3D(w0,B0,p0,RJ,yJ+VJ,g0,JJ,P0,V0);else y.copyTexSubImage2D(w0,B0,p0,RJ,g0,JJ,P0,V0)}U0.bindFramebuffer(y.READ_FRAMEBUFFER,null),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else if(MJ)if(P.isDataTexture||P.isData3DTexture)y.texSubImage3D(w0,B0,p0,RJ,yJ,P0,V0,b0,DJ,aJ,AJ.data);else if(g.isCompressedArrayTexture)y.compressedTexSubImage3D(w0,B0,p0,RJ,yJ,P0,V0,b0,DJ,AJ.data);else y.texSubImage3D(w0,B0,p0,RJ,yJ,P0,V0,b0,DJ,aJ,AJ);else if(P.isDataTexture)y.texSubImage2D(y.TEXTURE_2D,B0,p0,RJ,P0,V0,DJ,aJ,AJ.data);else if(P.isCompressedTexture)y.compressedTexSubImage2D(y.TEXTURE_2D,B0,p0,RJ,AJ.width,AJ.height,DJ,AJ.data);else y.texSubImage2D(y.TEXTURE_2D,B0,p0,RJ,P0,V0,DJ,aJ,AJ);if(U0.pixelStorei(y.UNPACK_ROW_LENGTH,R9),U0.pixelStorei(y.UNPACK_IMAGE_HEIGHT,EJ),U0.pixelStorei(y.UNPACK_SKIP_PIXELS,I9),U0.pixelStorei(y.UNPACK_SKIP_ROWS,$8),U0.pixelStorei(y.UNPACK_SKIP_IMAGES,v8),B0===0&&g.generateMipmaps)y.generateMipmap(w0);U0.unbindTexture()},this.initRenderTarget=function(P){if(A0.get(P).__webglFramebuffer===void 0)T.setupRenderTarget(P)},this.initTexture=function(P){if(P.isCubeTexture)T.setTextureCube(P,0);else if(P.isData3DTexture)T.setTexture3D(P,0);else if(P.isDataArrayTexture||P.isCompressedArrayTexture)T.setTexture2DArray(P,0);else T.setTexture2D(P,0);U0.unbindTexture()},this.resetState=function(){v=0,b=0,S=null,U0.reset(),f.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return OW}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=t0._getDrawingBufferColorSpace(J),Q.unpackColorSpace=t0._getUnpackColorSpace()}}function L0(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J);return Number.isFinite($)?$:Q}function CJ(J,Q){if(J==null||J.trim()==="")return[...Q];let $=J.trim().split(/\s+/).map(Number);return[Number.isFinite($[0])?$[0]:Q[0],Number.isFinite($[1])?$[1]:Q[1],Number.isFinite($[2])?$[2]:Q[2]]}function UE(J){if(J==null||J.trim()==="")return[1,1,1];let Q=J.trim().split(/\s+/).map(Number);if(Q.length===1&&Number.isFinite(Q[0]))return[Q[0],Q[0],Q[0]];return CJ(J,[1,1,1])}function e7(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J.trim().replace(/deg$/i,""));return Number.isFinite($)?$:Q}function GH(J){return J*Math.PI/180}function GE(J){let Q=CJ(J,[0,0,0]);return[GH(Q[0]),GH(Q[1]),GH(Q[2])]}function x9(J,Q){if(J==null||J.trim()==="")return Q;return J.trim()}function J8(J,Q){return L0(J,Q)}function $Y(J){return(Q)=>Math.pow(Q,J)}function ZY(J){return(Q)=>1-Math.pow(1-Q,J)}function WY(J){return(Q)=>Q<0.5?Math.pow(2*Q,J)/2:1-Math.pow(2*(1-Q),J)/2}var C$=1.70158,YY={linear:(J)=>J,none:(J)=>J,"power1.in":$Y(2),"power1.out":ZY(2),"power1.inOut":WY(2),"power2.in":$Y(3),"power2.out":ZY(3),"power2.inOut":WY(3),"power3.in":$Y(4),"power3.out":ZY(4),"power3.inOut":WY(4),"power4.in":$Y(5),"power4.out":ZY(5),"power4.inOut":WY(5),"sine.in":(J)=>1-Math.cos(J*Math.PI/2),"sine.out":(J)=>Math.sin(J*Math.PI/2),"sine.inOut":(J)=>-(Math.cos(Math.PI*J)-1)/2,"expo.in":(J)=>J===0?0:Math.pow(2,10*J-10),"expo.out":(J)=>J===1?1:1-Math.pow(2,-10*J),"expo.inOut":(J)=>J===0?0:J===1?1:J<0.5?Math.pow(2,20*J-10)/2:(2-Math.pow(2,-20*J+10))/2,"circ.in":(J)=>1-Math.sqrt(1-J*J),"circ.out":(J)=>Math.sqrt(1-(J-1)*(J-1)),"circ.inOut":(J)=>J<0.5?(1-Math.sqrt(1-4*J*J))/2:(Math.sqrt(1-Math.pow(-2*J+2,2))+1)/2,"back.in":(J)=>J*J*((C$+1)*J-C$),"back.out":(J)=>{let Q=J-1;return Q*Q*((C$+1)*Q+C$)+1},"back.inOut":(J)=>{let Q=C$*1.525;return J<0.5?Math.pow(2*J,2)*((Q+1)*2*J-Q)/2:(Math.pow(2*J-2,2)*((Q+1)*(2*J-2)+Q)+2)/2},"elastic.out":(J)=>J===0?0:J===1?1:Math.pow(2,-10*J)*Math.sin((J*10-0.75)*(2*Math.PI)/3)+1,"bounce.out":(J)=>{if(J<0.36363636363636365)return 7.5625*J*J;if(J<0.7272727272727273){let W=J-0.5454545454545454;return 7.5625*W*W+0.75}if(J<0.9090909090909091){let W=J-0.8181818181818182;return 7.5625*W*W+0.9375}let Z=J-0.9545454545454546;return 7.5625*Z*Z+0.984375}};function XY(J,Q="power1.out"){if(J){let $=YY[J.trim()];if($)return $}return YY[Q]??YY.linear}var KM=Object.keys(YY);function n6(J,Q){let $=Q.duration??0;if($<=0)return J<Q.start?0:1;let Z=(J-Q.start)/$;return Q.ease(Math.min(1,Math.max(0,Z)))}function EH(J,Q){return n6(J,Q)}function EE(J,Q,$){let Z=Math.max(0.000001,1-$);return Math.min(1,Math.max(0,(J-Q)/Z))}function FH(J,Q){return Math.max(0,J-Q.start)}function FE(J){return{start:J.start??0,duration:J.duration??void 0,ease:XY(J.ease??null,J.defaultEase??"power1.out")}}function NE(J,Q,$){let Z=J.rotation[$.axis],W=$.rpm/60*Math.PI*2;return(Y)=>{J.rotation[$.axis]=Z+W*FH(Y,Q)}}function OE(J,Q,$){let Z=$.fromDeg*Math.PI/180,W=$.toDeg*Math.PI/180;return(Y)=>{let X=Z+(W-Z)*n6(Y,Q),K=$.center();J.position.x=K.x+$.radius*Math.sin(X),J.position.z=K.z+$.radius*Math.cos(X),J.position.y=K.y+$.height}}function qE(J,Q,$){let Z={x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=$.toward(),X=Y.x-Z.x,K=Y.y-Z.y,H=Y.z-Z.z,U=Math.sqrt(X*X+K*K+H*H)||1,G=$.distance*n6(W,Q);J.position.x=Z.x+X/U*G,J.position.y=Z.y+K/U*G,J.position.z=Z.z+H/U*G}}function RE(J,Q){let $={x:J.scale.x,y:J.scale.y,z:J.scale.z};return(Z)=>{let W=Z<Q.start?0:n6(Z,Q);J.scale.x=$.x*W,J.scale.y=$.y*W,J.scale.z=$.z*W}}function NH(J,Q){return($)=>{J($<Q.start?0:n6($,Q))}}function LE(J,Q,$){let Z=$.from??{x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=n6(W,Q);J.position.x=Z.x+($.to.x-Z.x)*Y,J.position.y=Z.y+($.to.y-Z.y)*Y,J.position.z=Z.z+($.to.z-Z.z)*Y}}function DE(J,Q){return()=>{let $=Q.subject();J.position.x=$.x+Q.offset.x,J.position.y=$.y+Q.offset.y,J.position.z=$.z+Q.offset.z}}function ME(J,Q){return($)=>{let Z=$<Q.start?0:n6($,Q);J(1-Z,Z)}}function kE(J,Q,$){let Z=J.position.y,W=Math.PI*2/Math.max(0.0001,$.period);return(Y)=>{J.position.y=Z+$.amplitude*Math.sin(W*FH(Y,Q))}}function VE(J,Q,$){let Z={rx:J.rotation.x,ry:J.rotation.y,rz:J.rotation.z,px:J.position.x,py:J.position.y},W=Math.PI*2/Math.max(0.0001,$.period),Y=$.amount;return(X)=>{let K=FH(X,Q);J.rotation.z=Z.rz+Y*Math.sin(W*K),J.rotation.x=Z.rx+Y*0.6*Math.sin(W*0.73*K+1.7),J.rotation.y=Z.ry+Y*0.4*Math.sin(W*0.51*K+0.4),J.position.x=Z.px+Y*0.25*Math.sin(W*0.62*K+2.1),J.position.y=Z.py+Y*0.2*Math.sin(W*0.83*K)}}var KY=new A;function BE(J,Q){if(!Q)return null;if(Q==="camera")return J.camera;if(Q.startsWith("#"))return J.objectsById.get(Q.slice(1))??null;return null}function OH(J,Q){if(Q&&Q.startsWith("#")){let Z=J.objectsById.get(Q.slice(1));if(Z)return()=>{return Z.getWorldPosition(KY),{x:KY.x,y:KY.y,z:KY.z}}}let $=CJ(Q,[0,0,0]);return()=>({x:$[0],y:$[1],z:$[2]})}function DD(J){let Q=[],$=new Set;return J.traverse((Z)=>{let W=Z.material,Y=Array.isArray(W)?W:W?[W]:[];for(let X of Y){if($.has(X))continue;$.add(X),Q.push({material:X,baseOpacity:X.opacity,baseTransparent:X.transparent})}}),(Z)=>{for(let W of Q)W.material.opacity=W.baseOpacity*Z,W.material.transparent=Z<1?!0:W.baseTransparent}}function CE(J){let Q=[];for(let $ of Array.from(J.host.querySelectorAll("sf-animate"))){let Z=($.getAttribute("verb")??"").toLowerCase(),W={orbit:4,dolly:1.5,"bounce-in":0.6,"fade-in":0.6,move:2,"crossfade-clip":0.5,"camera-path":8,variant:0.8},Y=$.getAttribute("duration"),X=FE({start:J8($.getAttribute("start"),0),duration:Y?J8(Y,0):W[Z]??null,ease:$.getAttribute("ease"),defaultEase:Z==="bounce-in"?"back.out":"power1.out"});if(Z==="variant"){Q.push({el:$,timing:X});continue}let K=BE(J,$.getAttribute("target"));if(!K){let H=$.getAttribute("target")??"",U=H.startsWith("#")?document.querySelector(H):null;if(U&&(Z==="fade-in"||Z==="bounce-in")){let G=L0($.getAttribute("rise"),0);J.seekFns.push(NH((F)=>{if(Z==="fade-in"){if(U.style.opacity=String(F),G!==0)U.style.transform=`translateY(${(1-F)*G}px)`}else U.style.opacity=F>0?"1":"0",U.style.transform=`scale(${F})`},X))}continue}if(Z==="turntable")J.seekFns.push(NE(K,X,{rpm:L0($.getAttribute("rpm"),6),axis:$.getAttribute("axis")??"y"}));else if(Z==="orbit"){let H=OH(J,$.getAttribute("around")),U=H(),G=K.position.x-U.x,F=K.position.z-U.z,E=Math.sqrt(G*G+F*F),O=Math.atan2(G,F)*180/Math.PI,R=e7($.getAttribute("from"),O);J.seekFns.push(OE(K,X,{center:H,radius:L0($.getAttribute("radius"),E||5),fromDeg:R,toDeg:e7($.getAttribute("to"),R+360),height:L0($.getAttribute("height"),K.position.y-U.y)}))}else if(Z==="dolly")J.seekFns.push(qE(K,X,{toward:OH(J,$.getAttribute("toward")),distance:L0($.getAttribute("distance"),1)}));else if(Z==="move"){let H=$.getAttribute("to");if(!H)continue;let U=CJ(H,[0,0,0]),G=$.getAttribute("from"),F=G?CJ(G,[0,0,0]):null;J.seekFns.push(LE(K,X,{from:F?{x:F[0],y:F[1],z:F[2]}:void 0,to:{x:U[0],y:U[1],z:U[2]}}))}else if(Z==="follow"){let H=OH(J,$.getAttribute("subject")),U=$.getAttribute("offset"),G;if(U){let F=CJ(U,[0,2,5]);G={x:F[0],y:F[1],z:F[2]}}else{let F=H();G={x:K.position.x-F.x,y:K.position.y-F.y,z:K.position.z-F.z}}J.lateSeekFns.push(DE(K,{subject:H,offset:G}))}else if(Z==="camera-path"){let H=($.getAttribute("points")??"").split(",").map((O)=>CJ(O.trim(),[Number.NaN,Number.NaN,Number.NaN])).filter((O)=>O.every(Number.isFinite)).map((O)=>new A(O[0],O[1],O[2]));if(H.length<2)continue;let U=new l7(H,!1,"centripetal"),G=($.getAttribute("look")??"ahead").toLowerCase(),F=new A,E=new A;J.lateSeekFns.push((O)=>{let R=EH(O,X);if(U.getPointAt(Math.min(1,Math.max(0,R)),F),K.position.set(F.x,F.y,F.z),G==="ahead"){if(U.getPointAt(Math.min(1,Math.max(0,R)+0.02),E),E.distanceToSquared(F)<0.000000001)U.getPointAt(Math.max(0,R-0.02),E),E.lerpVectors(E,F,2);K.lookAt(E)}})}else if(Z==="crossfade-clip"){let H=J.actionsByObject.get(K),U=$.getAttribute("from"),G=$.getAttribute("to");if(!H||!U||!G)continue;let F=H.get(U),E=H.get(G);if(!F||!E)continue;J.seekFns.push(ME((O,R)=>{F.setEffectiveWeight(O),E.setEffectiveWeight(R)},X))}else if(Z==="bounce-in")J.seekFns.push(RE(K,X));else if(Z==="fade-in")J.seekFns.push(NH(DD(K),X));else if(Z==="float")J.seekFns.push(kE(K,X,{amplitude:L0($.getAttribute("amplitude"),0.1),period:L0($.getAttribute("period"),4)}));else if(Z==="sway")J.seekFns.push(VE(K,X,{amount:L0($.getAttribute("amount"),6)*Math.PI/180,period:L0($.getAttribute("period"),5)}))}MD(J,Q)}function MD(J,Q){let $=new Map;for(let W of Q){let Y=`${W.el.getAttribute("target")??""}|${W.el.getAttribute("material")??"*"}`;($.get(Y)??$.set(Y,[]).get(Y)).push(W)}let Z=new e;for(let W of $.values()){let Y=W[0],X=BE(J,Y.el.getAttribute("target"));if(!X)continue;let K=Y.el.getAttribute("material"),H=[],U=new Set;if(X.traverse((E)=>{let O=E.material;for(let R of Array.isArray(O)?O:O?[O]:[]){if(U.has(R))continue;if(U.add(R),!(R instanceof iJ))continue;if(K&&R.name!==K)continue;H.push(R)}}),H.length===0)continue;let G={color:H[0].color.clone(),roughness:H[0].roughness,metalness:H[0].metalness};J.seekFns.push(()=>{for(let E of H){if(E.color.copy(G.color),G.roughness!==null)E.roughness=G.roughness;if(G.metalness!==null)E.metalness=G.metalness}}),W.sort((E,O)=>E.timing.start-O.timing.start);let F=G;for(let{el:E,timing:O}of W){let R={color:E.getAttribute("color")?new e(x9(E.getAttribute("color"),"#ffffff")):F.color.clone(),roughness:E.getAttribute("roughness")?L0(E.getAttribute("roughness"),0.5):F.roughness,metalness:E.getAttribute("metalness")?L0(E.getAttribute("metalness"),0):F.metalness},M=F;J.seekFns.push((q)=>{if(q<O.start)return;let N=EH(q,O);Z.lerpColors(M.color,R.color,N);for(let L of H){if(L.color.copy(Z),R.roughness!==null&&M.roughness!==null)L.roughness=M.roughness+(R.roughness-M.roughness)*N;if(R.metalness!==null&&M.metalness!==null)L.metalness=M.metalness+(R.metalness-M.metalness)*N}}),F=R}}}function qH(J,Q){if(Q===GW)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===S6||Q===y7){let $=J.getIndex();if($===null){let X=[],K=J.getAttribute("position");if(K!==void 0){for(let H=0;H<K.count;H++)X.push(H);J.setIndex(X),$=J.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),J}let Z=$.count-2,W=[];if(Q===S6)for(let X=1;X<=Z;X++)W.push($.getX(0)),W.push($.getX(X)),W.push($.getX(X+1));else for(let X=0;X<Z;X++)if(X%2===0)W.push($.getX(X)),W.push($.getX(X+1)),W.push($.getX(X+2));else W.push($.getX(X+2)),W.push($.getX(X+1)),W.push($.getX(X));if(W.length/3!==Z)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let Y=J.clone();return Y.setIndex(W),Y.clearGroups(),Y}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",Q),J}function zE(J){let Q=new Map,$=new Map,Z=J.clone();return IE(J,Z,function(W,Y){Q.set(Y,W),$.set(W,Y)}),Z.traverse(function(W){if(!W.isSkinnedMesh)return;let Y=W,X=Q.get(W),K=X.skeleton.bones;Y.skeleton=X.skeleton.clone(),Y.bindMatrix.copy(X.bindMatrix),Y.skeleton.bones=K.map(function(H){return $.get(H)}),Y.bind(Y.skeleton,Y.bindMatrix)}),Z}function IE(J,Q,$){$(J,Q);for(let Z=0;Z<J.children.length;Z++)IE(J.children[Z],Q.children[Z],$)}class BH extends sJ{constructor(J){super(J);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(Q){return new vE(Q)}),this.register(function(Q){return new yE(Q)}),this.register(function(Q){return new mE(Q)}),this.register(function(Q){return new lE(Q)}),this.register(function(Q){return new cE(Q)}),this.register(function(Q){return new bE(Q)}),this.register(function(Q){return new hE(Q)}),this.register(function(Q){return new fE(Q)}),this.register(function(Q){return new gE(Q)}),this.register(function(Q){return new jE(Q)}),this.register(function(Q){return new pE(Q)}),this.register(function(Q){return new xE(Q)}),this.register(function(Q){return new dE(Q)}),this.register(function(Q){return new uE(Q)}),this.register(function(Q){return new TE(Q)}),this.register(function(Q){return new MH(Q,UJ.EXT_MESHOPT_COMPRESSION)}),this.register(function(Q){return new MH(Q,UJ.KHR_MESHOPT_COMPRESSION)}),this.register(function(Q){return new nE(Q)})}load(J,Q,$,Z){let W=this,Y;if(this.resourcePath!=="")Y=this.resourcePath;else if(this.path!==""){let H=n9.extractUrlBase(J);Y=n9.resolveURL(H,this.path)}else Y=n9.extractUrlBase(J);this.manager.itemStart(J);let X=function(H){if(Z)Z(H);else console.error(H);W.manager.itemError(J),W.manager.itemEnd(J)},K=new E9(this.manager);K.setPath(this.path),K.setResponseType("arraybuffer"),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(H){try{W.parse(H,Y,function(U){Q(U),W.manager.itemEnd(J)},X)}catch(U){X(U)}},$,X)}setDRACOLoader(J){return this.dracoLoader=J,this}setKTX2Loader(J){return this.ktx2Loader=J,this}setMeshoptDecoder(J){return this.meshoptDecoder=J,this}register(J){if(this.pluginCallbacks.indexOf(J)===-1)this.pluginCallbacks.push(J);return this}unregister(J){if(this.pluginCallbacks.indexOf(J)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(J),1);return this}parse(J,Q,$,Z){let W,Y={},X={},K=new TextDecoder;if(typeof J==="string")W=JSON.parse(J);else if(J instanceof ArrayBuffer)if(K.decode(new Uint8Array(J,0,4))===sE){try{Y[UJ.KHR_BINARY_GLTF]=new iE(J)}catch(G){if(Z)Z(G);return}W=JSON.parse(Y[UJ.KHR_BINARY_GLTF].content)}else W=JSON.parse(K.decode(J));else W=J;if(W.asset===void 0||W.asset.version[0]<2){if(Z)Z(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let H=new eE(W,{path:Q||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});H.fileLoader.setRequestHeader(this.requestHeader);for(let U=0;U<this.pluginCallbacks.length;U++){let G=this.pluginCallbacks[U](H);if(!G.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");X[G.name]=G,Y[G.name]=!0}if(W.extensionsUsed)for(let U=0;U<W.extensionsUsed.length;++U){let G=W.extensionsUsed[U],F=W.extensionsRequired||[];switch(G){case UJ.KHR_MATERIALS_UNLIT:Y[G]=new SE;break;case UJ.KHR_DRACO_MESH_COMPRESSION:Y[G]=new oE(W,this.dracoLoader);break;case UJ.KHR_TEXTURE_TRANSFORM:Y[G]=new aE;break;case UJ.KHR_MESH_QUANTIZATION:Y[G]=new rE;break;default:if(F.indexOf(G)>=0&&X[G]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+G+'".')}}H.setExtensions(Y),H.setPlugins(X),H.parse($,Z)}parseAsync(J,Q){let $=this;return new Promise(function(Z,W){$.parse(J,Q,Z,W)})}}function kD(){let J={};return{get:function(Q){return J[Q]},add:function(Q,$){J[Q]=$},remove:function(Q){delete J[Q]},removeAll:function(){J={}}}}function hJ(J,Q,$){let Z=J.json.materials[Q];if(Z.extensions&&Z.extensions[$])return Z.extensions[$];return null}var UJ={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class TE{constructor(J){this.parser=J,this.name=UJ.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let J=this.parser,Q=this.parser.json.nodes||[];for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(W.extensions&&W.extensions[this.name]&&W.extensions[this.name].light!==void 0)J._addNodeRef(this.cache,W.extensions[this.name].light)}}_loadLight(J){let Q=this.parser,$="light:"+J,Z=Q.cache.get($);if(Z)return Z;let W=Q.json,K=((W.extensions&&W.extensions[this.name]||{}).lights||[])[J],H,U=new e(16777215);if(K.color!==void 0)U.setRGB(K.color[0],K.color[1],K.color[2],J9);let G=K.range!==void 0?K.range:0;switch(K.type){case"directional":H=new y9(U),H.target.position.set(0,0,-1),H.add(H.target);break;case"point":H=new N8(U),H.distance=G;break;case"spot":H=new o7(U),H.distance=G,K.spot=K.spot||{},K.spot.innerConeAngle=K.spot.innerConeAngle!==void 0?K.spot.innerConeAngle:0,K.spot.outerConeAngle=K.spot.outerConeAngle!==void 0?K.spot.outerConeAngle:Math.PI/4,H.angle=K.spot.outerConeAngle,H.penumbra=1-K.spot.innerConeAngle/K.spot.outerConeAngle,H.target.position.set(0,0,-1),H.add(H.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+K.type)}if(H.position.set(0,0,0),q8(H,K),K.intensity!==void 0)H.intensity=K.intensity;return H.name=Q.createUniqueName(K.name||"light_"+J),Z=Promise.resolve(H),Q.cache.add($,Z),Z}getDependency(J,Q){if(J!=="light")return;return this._loadLight(Q)}createNodeAttachment(J){let Q=this,$=this.parser,W=$.json.nodes[J],X=(W.extensions&&W.extensions[this.name]||{}).light;if(X===void 0)return null;return this._loadLight(X).then(function(K){return $._getNodeRef(Q.cache,X,K)})}}class SE{constructor(){this.name=UJ.KHR_MATERIALS_UNLIT}getMaterialType(){return nJ}extendParams(J,Q,$){let Z=[];J.color=new e(1,1,1),J.opacity=1;let W=Q.pbrMetallicRoughness;if(W){if(Array.isArray(W.baseColorFactor)){let Y=W.baseColorFactor;J.color.setRGB(Y[0],Y[1],Y[2],J9),J.opacity=Y[3]}if(W.baseColorTexture!==void 0)Z.push($.assignTexture(J,"map",W.baseColorTexture,a9))}return Promise.all(Z)}}class jE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();if($.emissiveStrength!==void 0)Q.emissiveIntensity=$.emissiveStrength;return Promise.resolve()}}class vE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_CLEARCOAT}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.clearcoatFactor!==void 0)Q.clearcoat=$.clearcoatFactor;if($.clearcoatTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatMap",$.clearcoatTexture));if($.clearcoatRoughnessFactor!==void 0)Q.clearcoatRoughness=$.clearcoatRoughnessFactor;if($.clearcoatRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatRoughnessMap",$.clearcoatRoughnessTexture));if($.clearcoatNormalTexture!==void 0){if(Z.push(this.parser.assignTexture(Q,"clearcoatNormalMap",$.clearcoatNormalTexture)),$.clearcoatNormalTexture.scale!==void 0){let W=$.clearcoatNormalTexture.scale;Q.clearcoatNormalScale=new i(W,W)}}return Promise.all(Z)}}class yE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_DISPERSION}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();return Q.dispersion=$.dispersion!==void 0?$.dispersion:0,Promise.resolve()}}class xE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_IRIDESCENCE}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.iridescenceFactor!==void 0)Q.iridescence=$.iridescenceFactor;if($.iridescenceTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceMap",$.iridescenceTexture));if($.iridescenceIor!==void 0)Q.iridescenceIOR=$.iridescenceIor;if(Q.iridescenceThicknessRange===void 0)Q.iridescenceThicknessRange=[100,400];if($.iridescenceThicknessMinimum!==void 0)Q.iridescenceThicknessRange[0]=$.iridescenceThicknessMinimum;if($.iridescenceThicknessMaximum!==void 0)Q.iridescenceThicknessRange[1]=$.iridescenceThicknessMaximum;if($.iridescenceThicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceThicknessMap",$.iridescenceThicknessTexture));return Promise.all(Z)}}class bE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_SHEEN}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.sheenColor=new e(0,0,0),Q.sheenRoughness=0,Q.sheen=1,$.sheenColorFactor!==void 0){let W=$.sheenColorFactor;Q.sheenColor.setRGB(W[0],W[1],W[2],J9)}if($.sheenRoughnessFactor!==void 0)Q.sheenRoughness=$.sheenRoughnessFactor;if($.sheenColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenColorMap",$.sheenColorTexture,a9));if($.sheenRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenRoughnessMap",$.sheenRoughnessTexture));return Promise.all(Z)}}class hE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_TRANSMISSION}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.transmissionFactor!==void 0)Q.transmission=$.transmissionFactor;if($.transmissionTexture!==void 0)Z.push(this.parser.assignTexture(Q,"transmissionMap",$.transmissionTexture));return Promise.all(Z)}}class fE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_VOLUME}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.thickness=$.thicknessFactor!==void 0?$.thicknessFactor:0,$.thicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"thicknessMap",$.thicknessTexture));Q.attenuationDistance=$.attenuationDistance||1/0;let W=$.attenuationColor||[1,1,1];return Q.attenuationColor=new e().setRGB(W[0],W[1],W[2],J9),Promise.all(Z)}}class gE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_IOR}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();if(Q.ior=$.ior!==void 0?$.ior:1.5,Q.ior===0)Q.ior=1000;return Promise.resolve()}}class pE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_SPECULAR}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.specularIntensity=$.specularFactor!==void 0?$.specularFactor:1,$.specularTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularIntensityMap",$.specularTexture));let W=$.specularColorFactor||[1,1,1];if(Q.specularColor=new e().setRGB(W[0],W[1],W[2],J9),$.specularColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularColorMap",$.specularColorTexture,a9));return Promise.all(Z)}}class uE{constructor(J){this.parser=J,this.name=UJ.EXT_MATERIALS_BUMP}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.bumpScale=$.bumpFactor!==void 0?$.bumpFactor:1,$.bumpTexture!==void 0)Z.push(this.parser.assignTexture(Q,"bumpMap",$.bumpTexture));return Promise.all(Z)}}class dE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_ANISOTROPY}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?oJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.anisotropyStrength!==void 0)Q.anisotropy=$.anisotropyStrength;if($.anisotropyRotation!==void 0)Q.anisotropyRotation=$.anisotropyRotation;if($.anisotropyTexture!==void 0)Z.push(this.parser.assignTexture(Q,"anisotropyMap",$.anisotropyTexture));return Promise.all(Z)}}class mE{constructor(J){this.parser=J,this.name=UJ.KHR_TEXTURE_BASISU}loadTexture(J){let Q=this.parser,$=Q.json,Z=$.textures[J];if(!Z.extensions||!Z.extensions[this.name])return null;let W=Z.extensions[this.name],Y=Q.options.ktx2Loader;if(!Y)if($.extensionsRequired&&$.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return Q.loadTextureImage(J,W.source,Y)}}class lE{constructor(J){this.parser=J,this.name=UJ.EXT_TEXTURE_WEBP}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class cE{constructor(J){this.parser=J,this.name=UJ.EXT_TEXTURE_AVIF}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class MH{constructor(J,Q){this.name=Q,this.parser=J}loadBufferView(J){let Q=this.parser.json,$=Q.bufferViews[J];if($.extensions&&$.extensions[this.name]){let Z=$.extensions[this.name],W=this.parser.getDependency("buffer",Z.buffer),Y=this.parser.options.meshoptDecoder;if(!Y||!Y.supported)if(Q.extensionsRequired&&Q.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return W.then(function(X){let K=Z.byteOffset||0,H=Z.byteLength||0,U=Z.count,G=Z.byteStride,F=new Uint8Array(X,K,H);if(Y.decodeGltfBufferAsync)return Y.decodeGltfBufferAsync(U,G,F,Z.mode,Z.filter).then(function(E){return E.buffer});else return Y.ready.then(function(){let E=new ArrayBuffer(U*G);return Y.decodeGltfBuffer(new Uint8Array(E),U,G,F,Z.mode,Z.filter),E})})}else return null}}class nE{constructor(J){this.name=UJ.EXT_MESH_GPU_INSTANCING,this.parser=J}createNodeMesh(J){let Q=this.parser.json,$=Q.nodes[J];if(!$.extensions||!$.extensions[this.name]||$.mesh===void 0)return null;let Z=Q.meshes[$.mesh];for(let H of Z.primitives)if(H.mode!==b9.TRIANGLES&&H.mode!==b9.TRIANGLE_STRIP&&H.mode!==b9.TRIANGLE_FAN&&H.mode!==void 0)return null;let Y=$.extensions[this.name].attributes,X=[],K={};for(let H in Y)X.push(this.parser.getDependency("accessor",Y[H]).then((U)=>{return K[H]=U,K[H]}));if(X.length<1)return null;return X.push(this.parser.createNodeMesh(J)),Promise.all(X).then((H)=>{let U=H.pop(),G=U.isGroup?U.children:[U],F=H[0].count,E=[];for(let O of G){let R=new y0,M=new A,q=new zJ,N=new A(1,1,1),L=new U8(O.geometry,O.material,F);for(let D=0;D<F;D++){if(K.TRANSLATION)M.fromBufferAttribute(K.TRANSLATION,D);if(K.ROTATION)q.fromBufferAttribute(K.ROTATION,D);if(K.SCALE)N.fromBufferAttribute(K.SCALE,D);L.setMatrixAt(D,R.compose(M,q,N))}for(let D in K)if(D==="_COLOR_0"){let V=K[D];L.instanceColor=new c9(V.array,V.itemSize,V.normalized)}else if(D!=="TRANSLATION"&&D!=="ROTATION"&&D!=="SCALE")O.geometry.setAttribute(D,K[D]);HJ.prototype.copy.call(L,O),this.parser.assignFinalMaterial(L),E.push(L)}if(U.isGroup)return U.clear(),U.add(...E),U;return E[0]})}}var sE="glTF",z$=12,_E={JSON:1313821514,BIN:5130562};class iE{constructor(J){this.name=UJ.KHR_BINARY_GLTF,this.content=null,this.body=null;let Q=new DataView(J,0,z$),$=new TextDecoder;if(this.header={magic:$.decode(new Uint8Array(J.slice(0,4))),version:Q.getUint32(4,!0),length:Q.getUint32(8,!0)},this.header.magic!==sE)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let Z=this.header.length-z$,W=new DataView(J,z$),Y=0;while(Y<Z){let X=W.getUint32(Y,!0);Y+=4;let K=W.getUint32(Y,!0);if(Y+=4,K===_E.JSON){let H=new Uint8Array(J,z$+Y,X);this.content=$.decode(H)}else if(K===_E.BIN){let H=z$+Y;this.body=J.slice(H,H+X)}Y+=X}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class oE{constructor(J,Q){if(!Q)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=UJ.KHR_DRACO_MESH_COMPRESSION,this.json=J,this.dracoLoader=Q,this.dracoLoader.preload()}decodePrimitive(J,Q){let $=this.json,Z=this.dracoLoader,W=J.extensions[this.name].bufferView,Y=J.extensions[this.name].attributes,X={},K={},H={};for(let U in Y){let G=kH[U]||U.toLowerCase();X[G]=Y[U]}for(let U in J.attributes){let G=kH[U]||U.toLowerCase();if(Y[U]!==void 0){let F=$.accessors[J.attributes[U]],E=JQ[F.componentType];H[G]=E.name,K[G]=F.normalized===!0}}return Q.getDependency("bufferView",W).then(function(U){return new Promise(function(G,F){Z.decodeDracoFile(U,function(E){for(let O in E.attributes){let R=E.attributes[O],M=K[O];if(M!==void 0)R.normalized=M}G(E)},X,H,J9,F)})})}}class aE{constructor(){this.name=UJ.KHR_TEXTURE_TRANSFORM}extendTexture(J,Q){if((Q.texCoord===void 0||Q.texCoord===J.channel)&&Q.offset===void 0&&Q.rotation===void 0&&Q.scale===void 0)return J;if(J=J.clone(),Q.texCoord!==void 0)J.channel=Q.texCoord;if(Q.offset!==void 0)J.offset.fromArray(Q.offset);if(Q.rotation!==void 0)J.rotation=Q.rotation;if(Q.scale!==void 0)J.repeat.fromArray(Q.scale);return J.needsUpdate=!0,J}}class rE{constructor(){this.name=UJ.KHR_MESH_QUANTIZATION}}class CH extends E8{constructor(J,Q,$,Z){super(J,Q,$,Z)}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z*3+Z;for(let Y=0;Y!==Z;Y++)Q[Y]=$[W+Y];return Q}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=X*2,H=X*3,U=Z-Q,G=($-Q)/U,F=G*G,E=F*G,O=J*H,R=O-H,M=-2*E+3*F,q=E-F,N=1-M,L=q-F+G;for(let D=0;D!==X;D++){let V=Y[R+D+X],z=Y[R+D+K]*U,I=Y[O+D+X],B=Y[O+D]*U;W[D]=N*V+L*z+M*I+q*B}return W}}var VD=new zJ;class tE extends CH{interpolate_(J,Q,$,Z){let W=super.interpolate_(J,Q,$,Z);return VD.fromArray(W).normalize().toArray(W),W}}var b9={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},JQ={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},wE={9728:S9,9729:jJ,9984:PQ,9985:A6,9986:i8,9987:i9},PE={33071:P6,33648:wQ,10497:_8},RH={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},kH={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},X6={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},BD={CUBICSPLINE:void 0,LINEAR:xQ,STEP:UW},LH={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function CD(J){if(J.DefaultMaterial===void 0)J.DefaultMaterial=new iJ({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:s9});return J.DefaultMaterial}function s6(J,Q,$){for(let Z in $.extensions)if(J[Z]===void 0)Q.userData.gltfExtensions=Q.userData.gltfExtensions||{},Q.userData.gltfExtensions[Z]=$.extensions[Z]}function q8(J,Q){if(Q.extras!==void 0)if(typeof Q.extras==="object")Object.assign(J.userData,Q.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+Q.extras)}function zD(J,Q,$){let Z=!1,W=!1,Y=!1;for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(F.POSITION!==void 0)Z=!0;if(F.NORMAL!==void 0)W=!0;if(F.COLOR_0!==void 0)Y=!0;if(Z&&W&&Y)break}if(!Z&&!W&&!Y)return Promise.resolve(J);let X=[],K=[],H=[];for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(Z){let E=F.POSITION!==void 0?$.getDependency("accessor",F.POSITION):J.attributes.position;X.push(E)}if(W){let E=F.NORMAL!==void 0?$.getDependency("accessor",F.NORMAL):J.attributes.normal;K.push(E)}if(Y){let E=F.COLOR_0!==void 0?$.getDependency("accessor",F.COLOR_0):J.attributes.color;H.push(E)}}return Promise.all([Promise.all(X),Promise.all(K),Promise.all(H)]).then(function(U){let G=U[0],F=U[1],E=U[2];if(Z)J.morphAttributes.position=G;if(W)J.morphAttributes.normal=F;if(Y)J.morphAttributes.color=E;return J.morphTargetsRelative=!0,J})}function ID(J,Q){if(J.updateMorphTargets(),Q.weights!==void 0)for(let $=0,Z=Q.weights.length;$<Z;$++)J.morphTargetInfluences[$]=Q.weights[$];if(Q.extras&&Array.isArray(Q.extras.targetNames)){let $=Q.extras.targetNames;if(J.morphTargetInfluences.length===$.length){J.morphTargetDictionary={};for(let Z=0,W=$.length;Z<W;Z++)J.morphTargetDictionary[$[Z]]=Z}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function _D(J){let Q,$=J.extensions&&J.extensions[UJ.KHR_DRACO_MESH_COMPRESSION];if($)Q="draco:"+$.bufferView+":"+$.indices+":"+DH($.attributes);else Q=J.indices+":"+DH(J.attributes)+":"+J.mode;if(J.targets!==void 0)for(let Z=0,W=J.targets.length;Z<W;Z++)Q+=":"+DH(J.targets[Z]);return Q}function DH(J){let Q="",$=Object.keys(J).sort();for(let Z=0,W=$.length;Z<W;Z++)Q+=$[Z]+":"+J[$[Z]]+";";return Q}function VH(J){switch(J){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function wD(J){if(J.search(/\.jpe?g($|\?)/i)>0||J.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(J.search(/\.webp($|\?)/i)>0||J.search(/^data\:image\/webp/)===0)return"image/webp";if(J.search(/\.ktx2($|\?)/i)>0||J.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var PD=new y0;class eE{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new kD,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let $=!1,Z=-1,W=!1,Y=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let X=navigator.userAgent;$=/^((?!chrome|android).)*safari/i.test(X)===!0;let K=X.match(/Version\/(\d+)/);Z=$&&K?parseInt(K[1],10):-1,W=X.indexOf("Firefox")>-1,Y=W?X.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||$&&Z<17||W&&Y<98)this.textureLoader=new d6(this.options.manager);else this.textureLoader=new R$(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new E9(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(J){this.extensions=J}setPlugins(J){this.plugins=J}parse(J,Q){let $=this,Z=this.json,W=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(Y){return Y._markDefs&&Y._markDefs()}),Promise.all(this._invokeAll(function(Y){return Y.beforeRoot&&Y.beforeRoot()})).then(function(){return Promise.all([$.getDependencies("scene"),$.getDependencies("animation"),$.getDependencies("camera")])}).then(function(Y){let X={scene:Y[0][Z.scene||0],scenes:Y[0],animations:Y[1],cameras:Y[2],asset:Z.asset,parser:$,userData:{}};return s6(W,X,Z),q8(X,Z),Promise.all($._invokeAll(function(K){return K.afterRoot&&K.afterRoot(X)})).then(function(){for(let K of X.scenes)K.updateMatrixWorld();J(X)})}).catch(Q)}_markDefs(){let J=this.json.nodes||[],Q=this.json.skins||[],$=this.json.meshes||[];for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z].joints;for(let X=0,K=Y.length;X<K;X++)J[Y[X]].isBone=!0}for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];if(Y.mesh!==void 0){if(this._addNodeRef(this.meshCache,Y.mesh),Y.skin!==void 0)$[Y.mesh].isSkinnedMesh=!0}if(Y.camera!==void 0)this._addNodeRef(this.cameraCache,Y.camera)}}_addNodeRef(J,Q){if(Q===void 0)return;if(J.refs[Q]===void 0)J.refs[Q]=J.uses[Q]=0;J.refs[Q]++}_getNodeRef(J,Q,$){if(J.refs[Q]<=1)return $;let Z=$.clone(),W=(Y,X)=>{let K=this.associations.get(Y);if(K!=null)this.associations.set(X,K);for(let[H,U]of Y.children.entries())W(U,X.children[H])};return W($,Z),Z.name+="_instance_"+J.uses[Q]++,Z}_invokeOne(J){let Q=Object.values(this.plugins);Q.push(this);for(let $=0;$<Q.length;$++){let Z=J(Q[$]);if(Z)return Z}return null}_invokeAll(J){let Q=Object.values(this.plugins);Q.unshift(this);let $=[];for(let Z=0;Z<Q.length;Z++){let W=J(Q[Z]);if(W)$.push(W)}return $}getDependency(J,Q){let $=J+":"+Q,Z=this.cache.get($);if(!Z){switch(J){case"scene":Z=this.loadScene(Q);break;case"node":Z=this._invokeOne(function(W){return W.loadNode&&W.loadNode(Q)});break;case"mesh":Z=this._invokeOne(function(W){return W.loadMesh&&W.loadMesh(Q)});break;case"accessor":Z=this.loadAccessor(Q);break;case"bufferView":Z=this._invokeOne(function(W){return W.loadBufferView&&W.loadBufferView(Q)});break;case"buffer":Z=this.loadBuffer(Q);break;case"material":Z=this._invokeOne(function(W){return W.loadMaterial&&W.loadMaterial(Q)});break;case"texture":Z=this._invokeOne(function(W){return W.loadTexture&&W.loadTexture(Q)});break;case"skin":Z=this.loadSkin(Q);break;case"animation":Z=this._invokeOne(function(W){return W.loadAnimation&&W.loadAnimation(Q)});break;case"camera":Z=this.loadCamera(Q);break;default:if(Z=this._invokeOne(function(W){return W!=this&&W.getDependency&&W.getDependency(J,Q)}),!Z)throw Error("Unknown type: "+J);break}this.cache.add($,Z)}return Z}getDependencies(J){let Q=this.cache.get(J);if(!Q){let $=this,Z=this.json[J+(J==="mesh"?"es":"s")]||[];Q=Promise.all(Z.map(function(W,Y){return $.getDependency(J,Y)})),this.cache.add(J,Q)}return Q}loadBuffer(J){let Q=this.json.buffers[J],$=this.fileLoader;if(Q.type&&Q.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+Q.type+" buffer type is not supported.");if(Q.uri===void 0&&J===0)return Promise.resolve(this.extensions[UJ.KHR_BINARY_GLTF].body);let Z=this.options;return new Promise(function(W,Y){$.load(n9.resolveURL(Q.uri,Z.path),W,void 0,function(){Y(Error('THREE.GLTFLoader: Failed to load buffer "'+Q.uri+'".'))})})}loadBufferView(J){let Q=this.json.bufferViews[J];return this.getDependency("buffer",Q.buffer).then(function($){let Z=Q.byteLength||0,W=Q.byteOffset||0;return $.slice(W,W+Z)})}loadAccessor(J){let Q=this,$=this.json,Z=this.json.accessors[J];if(Z.bufferView===void 0&&Z.sparse===void 0){let Y=RH[Z.type],X=JQ[Z.componentType],K=Z.normalized===!0,H=new X(Z.count*Y);return Promise.resolve(new i0(H,Y,K))}let W=[];if(Z.bufferView!==void 0)W.push(this.getDependency("bufferView",Z.bufferView));else W.push(null);if(Z.sparse!==void 0)W.push(this.getDependency("bufferView",Z.sparse.indices.bufferView)),W.push(this.getDependency("bufferView",Z.sparse.values.bufferView));return Promise.all(W).then(function(Y){let X=Y[0],K=RH[Z.type],H=JQ[Z.componentType],U=H.BYTES_PER_ELEMENT,G=U*K,F=Z.byteOffset||0,E=Z.bufferView!==void 0?$.bufferViews[Z.bufferView].byteStride:void 0,O=Z.normalized===!0,R,M;if(E&&E!==G){let q=Math.floor(F/E),N="InterleavedBuffer:"+Z.bufferView+":"+Z.componentType+":"+q+":"+Z.count,L=Q.cache.get(N);if(!L)R=new H(X,q*E,Z.count*E/U),L=new P8(R,E/U),Q.cache.add(N,L);M=new l9(L,K,F%E/U,O)}else{if(X===null)R=new H(Z.count*K);else R=new H(X,F,Z.count*K);M=new i0(R,K,O)}if(Z.sparse!==void 0){let q=RH.SCALAR,N=JQ[Z.sparse.indices.componentType],L=Z.sparse.indices.byteOffset||0,D=Z.sparse.values.byteOffset||0,V=new N(Y[1],L,Z.sparse.count*q),z=new H(Y[2],D,Z.sparse.count*K);if(X!==null)M=new i0(M.array.slice(),M.itemSize,M.normalized);M.normalized=!1;for(let I=0,B=V.length;I<B;I++){let k=V[I];if(M.setX(k,z[I*K]),K>=2)M.setY(k,z[I*K+1]);if(K>=3)M.setZ(k,z[I*K+2]);if(K>=4)M.setW(k,z[I*K+3]);if(K>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}M.normalized=O}return M})}loadTexture(J){let Q=this.json,$=this.options,W=Q.textures[J].source,Y=Q.images[W],X=this.textureLoader;if(Y.uri){let K=$.manager.getHandler(Y.uri);if(K!==null)X=K}return this.loadTextureImage(J,W,X)}loadTextureImage(J,Q,$){let Z=this,W=this.json,Y=W.textures[J],X=W.images[Q],K=(X.uri||X.bufferView)+":"+Y.sampler;if(this.textureCache[K])return this.textureCache[K];let H=this.loadImageSource(Q,$).then(function(U){if(U.flipY=!1,U.name=Y.name||X.name||"",U.name===""&&typeof X.uri==="string"&&X.uri.startsWith("data:image/")===!1)U.name=X.uri;let F=(W.samplers||{})[Y.sampler]||{};return U.magFilter=wE[F.magFilter]||jJ,U.minFilter=wE[F.minFilter]||i9,U.wrapS=PE[F.wrapS]||_8,U.wrapT=PE[F.wrapT]||_8,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==S9&&U.minFilter!==jJ,Z.associations.set(U,{textures:J}),U}).catch(function(){return null});return this.textureCache[K]=H,H}loadImageSource(J,Q){let $=this,Z=this.json,W=this.options;if(this.sourceCache[J]!==void 0)return this.sourceCache[J].then((G)=>G.clone());let Y=Z.images[J],X=self.URL||self.webkitURL,K=Y.uri||"",H=!1;if(Y.bufferView!==void 0)K=$.getDependency("bufferView",Y.bufferView).then(function(G){H=!0;let F=new Blob([G],{type:Y.mimeType});return K=X.createObjectURL(F),K});else if(Y.uri===void 0)throw Error("THREE.GLTFLoader: Image "+J+" is missing URI and bufferView");let U=Promise.resolve(K).then(function(G){return new Promise(function(F,E){let O=F;if(Q.isImageBitmapLoader===!0)O=function(R){let M=new kJ(R);M.needsUpdate=!0,F(M)};Q.load(n9.resolveURL(G,W.path),O,void 0,E)})}).then(function(G){if(H===!0)X.revokeObjectURL(K);return q8(G,Y),G.userData.mimeType=Y.mimeType||wD(Y.uri),G}).catch(function(G){throw console.error("THREE.GLTFLoader: Couldn't load texture",K),G});return this.sourceCache[J]=U,U}assignTexture(J,Q,$,Z){let W=this;return this.getDependency("texture",$.index).then(function(Y){if(!Y)return null;if($.texCoord!==void 0&&$.texCoord>0)Y=Y.clone(),Y.channel=$.texCoord;if(W.extensions[UJ.KHR_TEXTURE_TRANSFORM]){let X=$.extensions!==void 0?$.extensions[UJ.KHR_TEXTURE_TRANSFORM]:void 0;if(X){let K=W.associations.get(Y);Y=W.extensions[UJ.KHR_TEXTURE_TRANSFORM].extendTexture(Y,X),W.associations.set(Y,K)}}if(Z!==void 0)Y.colorSpace=Z;return J[Q]=Y,Y})}assignFinalMaterial(J){let{geometry:Q,material:$}=J,Z=Q.attributes.tangent===void 0,W=Q.attributes.color!==void 0,Y=Q.attributes.normal===void 0;if(J.isPoints){let X="PointsMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new b6,vJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,K.sizeAttenuation=!1,this.cache.add(X,K);$=K}else if(J.isLine){let X="LineBasicMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new dJ,vJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,this.cache.add(X,K);$=K}if(Z||W||Y){let X="ClonedMaterial:"+$.uuid+":";if(Z)X+="derivative-tangents:";if(W)X+="vertex-colors:";if(Y)X+="flat-shading:";let K=this.cache.get(X);if(!K){if(K=$.clone(),W)K.vertexColors=!0;if(Y)K.flatShading=!0;if(Z){if(K.normalScale)K.normalScale.y*=-1;if(K.clearcoatNormalScale)K.clearcoatNormalScale.y*=-1}this.cache.add(X,K),this.associations.set(K,this.associations.get($))}$=K}J.material=$}getMaterialType(){return iJ}loadMaterial(J){let Q=this,$=this.json,Z=this.extensions,W=$.materials[J],Y,X={},K=W.extensions||{},H=[];if(K[UJ.KHR_MATERIALS_UNLIT]){let G=Z[UJ.KHR_MATERIALS_UNLIT];Y=G.getMaterialType(),H.push(G.extendParams(X,W,Q))}else{let G=W.pbrMetallicRoughness||{};if(X.color=new e(1,1,1),X.opacity=1,Array.isArray(G.baseColorFactor)){let F=G.baseColorFactor;X.color.setRGB(F[0],F[1],F[2],J9),X.opacity=F[3]}if(G.baseColorTexture!==void 0)H.push(Q.assignTexture(X,"map",G.baseColorTexture,a9));if(X.metalness=G.metallicFactor!==void 0?G.metallicFactor:1,X.roughness=G.roughnessFactor!==void 0?G.roughnessFactor:1,G.metallicRoughnessTexture!==void 0)H.push(Q.assignTexture(X,"metalnessMap",G.metallicRoughnessTexture)),H.push(Q.assignTexture(X,"roughnessMap",G.metallicRoughnessTexture));Y=this._invokeOne(function(F){return F.getMaterialType&&F.getMaterialType(J)}),H.push(Promise.all(this._invokeAll(function(F){return F.extendMaterialParams&&F.extendMaterialParams(J,X)})))}if(W.doubleSided===!0)X.side=X9;let U=W.alphaMode||LH.OPAQUE;if(U===LH.BLEND)X.transparent=!0,X.depthWrite=!1;else if(X.transparent=!1,U===LH.MASK)X.alphaTest=W.alphaCutoff!==void 0?W.alphaCutoff:0.5;if(W.normalTexture!==void 0&&Y!==nJ){if(H.push(Q.assignTexture(X,"normalMap",W.normalTexture)),X.normalScale=new i(1,1),W.normalTexture.scale!==void 0){let G=W.normalTexture.scale;X.normalScale.set(G,G)}}if(W.occlusionTexture!==void 0&&Y!==nJ){if(H.push(Q.assignTexture(X,"aoMap",W.occlusionTexture)),W.occlusionTexture.strength!==void 0)X.aoMapIntensity=W.occlusionTexture.strength}if(W.emissiveFactor!==void 0&&Y!==nJ){let G=W.emissiveFactor;X.emissive=new e().setRGB(G[0],G[1],G[2],J9)}if(W.emissiveTexture!==void 0&&Y!==nJ)H.push(Q.assignTexture(X,"emissiveMap",W.emissiveTexture,a9));return Promise.all(H).then(function(){let G=new Y(X);if(W.name)G.name=W.name;if(q8(G,W),Q.associations.set(G,{materials:J}),W.extensions)s6(Z,G,W);return G})}createUniqueName(J){let Q=GJ.sanitizeNodeName(J||"");if(Q in this.nodeNamesUsed)return Q+"_"+ ++this.nodeNamesUsed[Q];else return this.nodeNamesUsed[Q]=0,Q}loadGeometries(J){let Q=this,$=this.extensions,Z=this.primitiveCache;function W(X){return $[UJ.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(X,Q).then(function(K){return AE(K,X,Q)})}let Y=[];for(let X=0,K=J.length;X<K;X++){let H=J[X],U=_D(H),G=Z[U];if(G)Y.push(G.promise);else{let F;if(H.extensions&&H.extensions[UJ.KHR_DRACO_MESH_COMPRESSION])F=W(H);else F=AE(new u0,H,Q);Z[U]={primitive:H,promise:F},Y.push(F)}}return Promise.all(Y)}loadMesh(J){let Q=this,$=this.json,Z=this.extensions,W=$.meshes[J],Y=W.primitives,X=[];for(let K=0,H=Y.length;K<H;K++){let U=Y[K].material===void 0?CD(this.cache):this.getDependency("material",Y[K].material);X.push(U)}return X.push(Q.loadGeometries(Y)),Promise.all(X).then(function(K){let H=K.slice(0,K.length-1),U=K[K.length-1],G=[];for(let E=0,O=U.length;E<O;E++){let R=U[E],M=Y[E],q,N=H[E];if(M.mode===b9.TRIANGLES||M.mode===b9.TRIANGLE_STRIP||M.mode===b9.TRIANGLE_FAN||M.mode===void 0){if(q=W.isSkinnedMesh===!0?new g7(R,N):new a0(R,N),q.isSkinnedMesh===!0)q.normalizeSkinWeights();if(M.mode===b9.TRIANGLE_STRIP)q.geometry=qH(q.geometry,y7);else if(M.mode===b9.TRIANGLE_FAN)q.geometry=qH(q.geometry,S6)}else if(M.mode===b9.LINES)q=new O9(R,N);else if(M.mode===b9.LINE_STRIP)q=new T9(R,N);else if(M.mode===b9.LINE_LOOP)q=new p7(R,N);else if(M.mode===b9.POINTS)q=new r9(R,N);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+M.mode);if(Object.keys(q.geometry.morphAttributes).length>0)ID(q,W);if(q.name=Q.createUniqueName(W.name||"mesh_"+J),q8(q,W),M.extensions)s6(Z,q,M);Q.assignFinalMaterial(q),G.push(q)}for(let E=0,O=G.length;E<O;E++)Q.associations.set(G[E],{meshes:J,primitives:E});if(G.length===1){if(W.extensions)s6(Z,G[0],W);return G[0]}let F=new G9;if(W.extensions)s6(Z,F,W);Q.associations.set(F,{meshes:J});for(let E=0,O=G.length;E<O;E++)F.add(G[E]);return F})}loadCamera(J){let Q,$=this.json.cameras[J],Z=$[$.type];if(!Z){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if($.type==="perspective")Q=new BJ(v6.radToDeg(Z.yfov),Z.aspectRatio||1,Z.znear||1,Z.zfar||2000000);else if($.type==="orthographic")Q=new t9(-Z.xmag,Z.xmag,Z.ymag,-Z.ymag,Z.znear,Z.zfar);if($.name)Q.name=this.createUniqueName($.name);return q8(Q,$),Promise.resolve(Q)}loadSkin(J){let Q=this.json.skins[J],$=[];for(let Z=0,W=Q.joints.length;Z<W;Z++)$.push(this._loadNodeShallow(Q.joints[Z]));if(Q.inverseBindMatrices!==void 0)$.push(this.getDependency("accessor",Q.inverseBindMatrices));else $.push(null);return Promise.all($).then(function(Z){let W=Z.pop(),Y=Z,X=[],K=[];for(let H=0,U=Y.length;H<U;H++){let G=Y[H];if(G){X.push(G);let F=new y0;if(W!==null)F.fromArray(W.array,H*16);K.push(F)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',Q.joints[H])}return new x6(X,K)})}loadAnimation(J){let Q=this.json,$=this,Z=Q.animations[J],W=Z.name?Z.name:"animation_"+J,Y=[],X=[],K=[],H=[],U=[];for(let G=0,F=Z.channels.length;G<F;G++){let E=Z.channels[G],O=Z.samplers[E.sampler],R=E.target,M=R.node,q=Z.parameters!==void 0?Z.parameters[O.input]:O.input,N=Z.parameters!==void 0?Z.parameters[O.output]:O.output;if(R.node===void 0)continue;Y.push(this.getDependency("node",M)),X.push(this.getDependency("accessor",q)),K.push(this.getDependency("accessor",N)),H.push(O),U.push(R)}return Promise.all([Promise.all(Y),Promise.all(X),Promise.all(K),Promise.all(H),Promise.all(U)]).then(function(G){let F=G[0],E=G[1],O=G[2],R=G[3],M=G[4],q=[];for(let L=0,D=F.length;L<D;L++){let V=F[L],z=E[L],I=O[L],B=R[L],k=M[L];if(V===void 0)continue;if(V.updateMatrix)V.updateMatrix();let C=$._createAnimationTracks(V,z,I,B,k);if(C)for(let j=0;j<C.length;j++)q.push(C[j])}let N=new I8(W,void 0,q);return q8(N,Z),N})}createNodeMesh(J){let Q=this.json,$=this,Z=Q.nodes[J];if(Z.mesh===void 0)return null;return $.getDependency("mesh",Z.mesh).then(function(W){let Y=$._getNodeRef($.meshCache,Z.mesh,W);if(Z.weights!==void 0)Y.traverse(function(X){if(!X.isMesh)return;for(let K=0,H=Z.weights.length;K<H;K++)X.morphTargetInfluences[K]=Z.weights[K]});return Y})}loadNode(J){let Q=this.json,$=this,Z=Q.nodes[J],W=$._loadNodeShallow(J),Y=[],X=Z.children||[];for(let H=0,U=X.length;H<U;H++)Y.push($.getDependency("node",X[H]));let K=Z.skin===void 0?Promise.resolve(null):$.getDependency("skin",Z.skin);return Promise.all([W,Promise.all(Y),K]).then(function(H){let U=H[0],G=H[1],F=H[2];if(F!==null)U.traverse(function(E){if(!E.isSkinnedMesh)return;E.bind(F,PD)});for(let E=0,O=G.length;E<O;E++)U.add(G[E]);if(U.userData.pivot!==void 0&&G.length>0){let E=U.userData.pivot,O=G[0];U.pivot=new A().fromArray(E),U.position.x-=E[0],U.position.y-=E[1],U.position.z-=E[2],O.position.set(0,0,0),delete U.userData.pivot}return U})}_loadNodeShallow(J){let Q=this.json,$=this.extensions,Z=this;if(this.nodeCache[J]!==void 0)return this.nodeCache[J];let W=Q.nodes[J],Y=W.name?Z.createUniqueName(W.name):"",X=[],K=Z._invokeOne(function(H){return H.createNodeMesh&&H.createNodeMesh(J)});if(K)X.push(K);if(W.camera!==void 0)X.push(Z.getDependency("camera",W.camera).then(function(H){return Z._getNodeRef(Z.cameraCache,W.camera,H)}));return Z._invokeAll(function(H){return H.createNodeAttachment&&H.createNodeAttachment(J)}).forEach(function(H){X.push(H)}),this.nodeCache[J]=Promise.all(X).then(function(H){let U;if(W.isBone===!0)U=new y6;else if(H.length>1)U=new G9;else if(H.length===1)U=H[0];else U=new HJ;if(U!==H[0])for(let G=0,F=H.length;G<F;G++)U.add(H[G]);if(W.name)U.userData.name=W.name,U.name=Y;if(q8(U,W),W.extensions)s6($,U,W);if(W.matrix!==void 0){let G=new y0;G.fromArray(W.matrix),U.applyMatrix4(G)}else{if(W.translation!==void 0)U.position.fromArray(W.translation);if(W.rotation!==void 0)U.quaternion.fromArray(W.rotation);if(W.scale!==void 0)U.scale.fromArray(W.scale)}if(!Z.associations.has(U))Z.associations.set(U,{});else if(W.mesh!==void 0&&Z.meshCache.refs[W.mesh]>1){let G=Z.associations.get(U);Z.associations.set(U,{...G})}return Z.associations.get(U).nodes=J,U}),this.nodeCache[J]}loadScene(J){let Q=this.extensions,$=this.json.scenes[J],Z=this,W=new G9;if($.name)W.name=Z.createUniqueName($.name);if(q8(W,$),$.extensions)s6(Q,W,$);let Y=$.nodes||[],X=[];for(let K=0,H=Y.length;K<H;K++)X.push(Z.getDependency("node",Y[K]));return Promise.all(X).then(function(K){for(let U=0,G=K.length;U<G;U++){let F=K[U];if(F.parent!==null)W.add(zE(F));else W.add(F)}let H=(U)=>{let G=new Map;for(let[F,E]of Z.associations)if(F instanceof vJ||F instanceof kJ)G.set(F,E);return U.traverse((F)=>{let E=Z.associations.get(F);if(E!=null)G.set(F,E)}),G};return Z.associations=H(W),W})}_createAnimationTracks(J,Q,$,Z,W){let Y=[],X=J.name?J.name:J.uuid,K=[];function H(E){if(E.morphTargetInfluences)K.push(E.name?E.name:E.uuid)}if(X6[W.path]===X6.weights){if(H(J),J.isGroup)J.children.forEach(H)}else K.push(X);let U;switch(X6[W.path]){case X6.weights:U=K8;break;case X6.rotation:U=F8;break;case X6.translation:case X6.scale:U=H8;break;default:switch($.itemSize){case 1:U=K8;break;case 2:case 3:default:U=H8;break}break}let G=Z.interpolation!==void 0?BD[Z.interpolation]:xQ,F=this._getArrayFromAccessor($);for(let E=0,O=K.length;E<O;E++){let R=new U(K[E]+"."+X6[W.path],Q.array,F,G);if(Z.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(R);Y.push(R)}return Y}_getArrayFromAccessor(J){let Q=J.array;if(J.normalized){let $=VH(Q.constructor),Z=new Float32Array(Q.length);for(let W=0,Y=Q.length;W<Y;W++)Z[W]=Q[W]*$;Q=Z}return Q}_createCubicSplineTrackInterpolant(J){J.createInterpolant=function($){return new(this instanceof F8?tE:CH)(this.times,this.values,this.getValueSize()/3,$)},J.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function AD(J,Q,$){let Z=Q.attributes,W=new SJ;if(Z.POSITION!==void 0){let K=$.json.accessors[Z.POSITION],H=K.min,U=K.max;if(H!==void 0&&U!==void 0){if(W.set(new A(H[0],H[1],H[2]),new A(U[0],U[1],U[2])),K.normalized){let G=VH(JQ[K.componentType]);W.min.multiplyScalar(G),W.max.multiplyScalar(G)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let Y=Q.targets;if(Y!==void 0){let K=new A,H=new A;for(let U=0,G=Y.length;U<G;U++){let F=Y[U];if(F.POSITION!==void 0){let E=$.json.accessors[F.POSITION],O=E.min,R=E.max;if(O!==void 0&&R!==void 0){if(H.setX(Math.max(Math.abs(O[0]),Math.abs(R[0]))),H.setY(Math.max(Math.abs(O[1]),Math.abs(R[1]))),H.setZ(Math.max(Math.abs(O[2]),Math.abs(R[2]))),E.normalized){let M=VH(JQ[E.componentType]);H.multiplyScalar(M)}K.max(H)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}W.expandByVector(K)}J.boundingBox=W;let X=new _J;W.getCenter(X.center),X.radius=W.min.distanceTo(W.max)/2,J.boundingSphere=X}function AE(J,Q,$){let Z=Q.attributes,W=[];function Y(X,K){return $.getDependency("accessor",X).then(function(H){J.setAttribute(K,H)})}for(let X in Z){let K=kH[X]||X.toLowerCase();if(K in J.attributes)continue;W.push(Y(Z[X],K))}if(Q.indices!==void 0&&!J.index){let X=$.getDependency("accessor",Q.indices).then(function(K){J.setIndex(K)});W.push(X)}if(t0.workingColorSpace!==J9&&"COLOR_0"in Z)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${t0.workingColorSpace}" not supported.`);return q8(J,Q),AD(J,Q,$),Promise.all(W).then(function(){return Q.targets!==void 0?zD(J,Q.targets,$):J})}class zH extends N${constructor(J){super(J);this.type=wJ}parse(J){let Y=function(B,k){switch(B){case 1:throw Error("THREE.HDRLoader: Read Error: "+(k||""));case 2:throw Error("THREE.HDRLoader: Write Error: "+(k||""));case 3:throw Error("THREE.HDRLoader: Bad File Format: "+(k||""));default:case 4:throw Error("THREE.HDRLoader: Memory Error: "+(k||""))}},G=function(B,k,C){k=!k?1024:k;let w=B.pos,v=-1,b=0,S="",h=String.fromCharCode.apply(null,new Uint16Array(B.subarray(w,w+128)));while(0>(v=h.indexOf(`
4105
+ `))&&b<k&&w<B.byteLength)S+=h,b+=h.length,w+=128,h=String.fromCharCode.apply(null,new Uint16Array(B.subarray(w,w+128)));if(-1<v){if(C!==!1)B.pos+=b+v+1;return S+h.slice(0,v)}return!1},F=function(B){let k=/^#\?(\S+)/,C=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,j=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,w=/^\s*FORMAT=(\S+)\s*$/,v=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,b={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},S,h;if(B.pos>=B.byteLength||!(S=G(B)))Y(1,"no header found");if(!(h=S.match(k)))Y(3,"bad initial token");b.valid|=1,b.programtype=h[1],b.string+=S+`
4106
+ `;while(!0){if(S=G(B),S===!1)break;if(b.string+=S+`
4107
+ `,S.charAt(0)==="#"){b.comments+=S+`
4108
+ `;continue}if(h=S.match(C))b.gamma=parseFloat(h[1]);if(h=S.match(j))b.exposure=parseFloat(h[1]);if(h=S.match(w))b.valid|=2,b.format=h[1];if(h=S.match(v))b.valid|=4,b.height=parseInt(h[1],10),b.width=parseInt(h[2],10);if(b.valid&2&&b.valid&4)break}if(!(b.valid&2))Y(3,"missing format specifier");if(!(b.valid&4))Y(3,"missing image size specifier");return b},E=function(B,k,C){let j=k;if(j<8||j>32767||(B[0]!==2||B[1]!==2||B[2]&128))return new Uint8Array(B);if(j!==(B[2]<<8|B[3]))Y(3,"wrong scanline width");let w=new Uint8Array(4*k*C);if(!w.length)Y(4,"unable to allocate buffer space");let v=0,b=0,S=4*j,h=new Uint8Array(4),x=new Uint8Array(S),p=C;while(p>0&&b<B.byteLength){if(b+4>B.byteLength)Y(1);if(h[0]=B[b++],h[1]=B[b++],h[2]=B[b++],h[3]=B[b++],h[0]!=2||h[1]!=2||(h[2]<<8|h[3])!=j)Y(3,"bad rgbe scanline format");let c=0,o;while(c<S&&b<B.byteLength){o=B[b++];let H0=o>128;if(H0)o-=128;if(o===0||c+o>S)Y(3,"bad scanline data");if(H0){let J0=B[b++];for(let c0=0;c0<o;c0++)x[c++]=J0}else x.set(B.subarray(b,b+o),c),c+=o,b+=o}let W0=j;for(let H0=0;H0<W0;H0++){let J0=0;w[v]=x[H0+J0],J0+=j,w[v+1]=x[H0+J0],J0+=j,w[v+2]=x[H0+J0],J0+=j,w[v+3]=x[H0+J0],v+=4}p--}return w},O=function(B,k,C,j){let w=B[k+3],v=Math.pow(2,w-128)/255;C[j+0]=B[k+0]*v,C[j+1]=B[k+1]*v,C[j+2]=B[k+2]*v,C[j+3]=1},R=function(B,k,C,j){let w=B[k+3],v=Math.pow(2,w-128)/255;C[j+0]=J6.toHalfFloat(Math.min(B[k+0]*v,65504)),C[j+1]=J6.toHalfFloat(Math.min(B[k+1]*v,65504)),C[j+2]=J6.toHalfFloat(Math.min(B[k+2]*v,65504)),C[j+3]=J6.toHalfFloat(1)},M=new Uint8Array(J);M.pos=0;let q=F(M),N=q.width,L=q.height,D=E(M.subarray(M.pos),N,L),V,z,I;switch(this.type){case N9:I=D.length/4;let B=new Float32Array(I*4);for(let C=0;C<I;C++)O(D,C*4,B,C*4);V=B,z=N9;break;case wJ:I=D.length/4;let k=new Uint16Array(I*4);for(let C=0;C<I;C++)R(D,C*4,k,C*4);V=k,z=wJ;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:N,height:L,data:V,header:q.string,gamma:q.gamma,exposure:q.exposure,type:z}}setDataType(J){return this.type=J,this}load(J,Q,$,Z){function W(Y,X){switch(Y.type){case N9:case wJ:Y.colorSpace=J9,Y.minFilter=jJ,Y.magFilter=jJ,Y.generateMipmaps=!1,Y.flipY=!0;break}if(Q)Q(Y,X)}return super.load(J,W,$,Z)}}var I$=new A;function h9(J,Q,$,Z,W,Y){let X=2*Math.PI*W/4,K=Math.max(Y-2*W,0),H=Math.PI/4;I$.copy(Q),I$[Z]=0,I$.normalize();let U=0.5*X/(X+K),G=1-I$.angleTo(J)/H;if(Math.sign(I$[$])===1)return G*U;else return K/(X+K)+U+U*(1-G)}class HY extends Q9{constructor(J=1,Q=1,$=1,Z=2,W=0.1){let Y=Z*2+1;W=Math.min(J/2,Q/2,$/2,W);super(1,1,1,Y,Y,Y);if(this.type="RoundedBoxGeometry",this.parameters={width:J,height:Q,depth:$,segments:Z,radius:W},Y===1)return;let X=this.toNonIndexed();this.index=null,this.attributes.position=X.attributes.position,this.attributes.normal=X.attributes.normal,this.attributes.uv=X.attributes.uv;let K=new A,H=new A,U=new A(J,Q,$).divideScalar(2).subScalar(W),G=this.attributes.position.array,F=this.attributes.normal.array,E=this.attributes.uv.array,O=G.length/6,R=new A,M=0.5/Y;for(let q=0,N=0;q<G.length;q+=3,N+=2)switch(K.fromArray(G,q),H.copy(K),H.x-=Math.sign(H.x)*M,H.y-=Math.sign(H.y)*M,H.z-=Math.sign(H.z)*M,H.normalize(),G[q+0]=U.x*Math.sign(K.x)+H.x*W,G[q+1]=U.y*Math.sign(K.y)+H.y*W,G[q+2]=U.z*Math.sign(K.z)+H.z*W,F[q+0]=H.x,F[q+1]=H.y,F[q+2]=H.z,Math.floor(q/O)){case 0:R.set(1,0,0),E[N+0]=h9(R,H,"z","y",W,$),E[N+1]=1-h9(R,H,"y","z",W,Q);break;case 1:R.set(-1,0,0),E[N+0]=1-h9(R,H,"z","y",W,$),E[N+1]=1-h9(R,H,"y","z",W,Q);break;case 2:R.set(0,1,0),E[N+0]=1-h9(R,H,"x","z",W,J),E[N+1]=h9(R,H,"z","x",W,$);break;case 3:R.set(0,-1,0),E[N+0]=1-h9(R,H,"x","z",W,J),E[N+1]=1-h9(R,H,"z","x",W,$);break;case 4:R.set(0,0,1),E[N+0]=1-h9(R,H,"x","y",W,J),E[N+1]=1-h9(R,H,"y","x",W,Q);break;case 5:R.set(0,0,-1),E[N+0]=h9(R,H,"x","y",W,J),E[N+1]=1-h9(R,H,"y","x",W,Q);break}}static fromJSON(J){return new HY(J.width,J.height,J.depth,J.segments,J.radius)}}class IH extends e8{constructor(){super();this.name="RoomEnvironment",this.position.y=-3.5;let J=new Q9;J.deleteAttribute("uv");let Q=new iJ({side:uJ}),$=new iJ,Z=new N8(16777215,900,28,2);Z.position.set(0.418,16.199,0.3),this.add(Z);let W=new a0(J,Q);W.position.set(-0.757,13.219,0.717),W.scale.set(31.713,28.305,28.591),this.add(W);let Y=new U8(J,$,6),X=new HJ;X.position.set(-10.906,2.009,1.846),X.rotation.set(0,-0.195,0),X.scale.set(2.328,7.905,4.651),X.updateMatrix(),Y.setMatrixAt(0,X.matrix),X.position.set(-5.607,-0.754,-0.758),X.rotation.set(0,0.994,0),X.scale.set(1.97,1.534,3.955),X.updateMatrix(),Y.setMatrixAt(1,X.matrix),X.position.set(6.167,0.857,7.803),X.rotation.set(0,0.561,0),X.scale.set(3.927,6.285,3.687),X.updateMatrix(),Y.setMatrixAt(2,X.matrix),X.position.set(-2.017,0.018,6.124),X.rotation.set(0,0.333,0),X.scale.set(2.002,4.566,2.064),X.updateMatrix(),Y.setMatrixAt(3,X.matrix),X.position.set(2.291,-0.756,-2.621),X.rotation.set(0,-0.286,0),X.scale.set(1.546,1.552,1.496),X.updateMatrix(),Y.setMatrixAt(4,X.matrix),X.position.set(-2.193,-0.369,-5.547),X.rotation.set(0,0.516,0),X.scale.set(3.875,3.487,2.986),X.updateMatrix(),Y.setMatrixAt(5,X.matrix),this.add(Y);let K=new a0(J,QQ(50));K.position.set(-16.116,14.37,8.208),K.scale.set(0.1,2.428,2.739),this.add(K);let H=new a0(J,QQ(50));H.position.set(-16.109,18.021,-8.207),H.scale.set(0.1,2.425,2.751),this.add(H);let U=new a0(J,QQ(17));U.position.set(14.904,12.198,-1.832),U.scale.set(0.15,4.265,6.331),this.add(U);let G=new a0(J,QQ(43));G.position.set(-0.462,8.89,14.52),G.scale.set(4.38,5.441,0.088),this.add(G);let F=new a0(J,QQ(20));F.position.set(3.235,11.486,-12.541),F.scale.set(2.5,2,0.1),this.add(F);let E=new a0(J,QQ(100));E.position.set(0,20,0),E.scale.set(1,0.1,1),this.add(E)}dispose(){let J=new Set;this.traverse((Q)=>{if(Q.isMesh)J.add(Q.geometry),J.add(Q.material)});for(let Q of J)Q.dispose()}}function QQ(J){return new n7({color:0,emissive:16777215,emissiveIntensity:J})}var $Q={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
4109
4109
 
4110
4110
  varying vec2 vUv;
4111
4111
 
@@ -4128,7 +4128,7 @@ void main() {
4128
4128
  gl_FragColor = opacity * texel;
4129
4129
 
4130
4130
 
4131
- }`};class N9{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}var yF=new e9(-1,1,1,-1,0,1);class aK extends qJ{constructor(){super();this.setAttribute("position",new WJ([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new WJ([0,2,0,0,2,0],2))}}var xF=new aK;class d8{constructor(J){this._mesh=new a0(xF,J)}dispose(){this._mesh.geometry.dispose()}render(J){J.render(this._mesh,yF)}get material(){return this._mesh.material}set material(J){this._mesh.material=J}}class B7 extends N9{constructor(J,Q="tDiffuse"){super();if(this.textureID=Q,this.uniforms=null,this.material=null,J instanceof OJ)this.uniforms=J.uniforms,this.material=J;else if(J)this.uniforms=rJ.clone(J.uniforms),this.material=new OJ({name:J.name!==void 0?J.name:"unspecified",defines:Object.assign({},J.defines),uniforms:this.uniforms,vertexShader:J.vertexShader,fragmentShader:J.fragmentShader});this._fsQuad=new d8(this.material)}render(J,Q,$){if(this.uniforms[this.textureID])this.uniforms[this.textureID].value=$.texture;if(this._fsQuad.material=this.material,this.renderToScreen)J.setRenderTarget(null),this._fsQuad.render(J);else{if(J.setRenderTarget(Q),this.clear)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);this._fsQuad.render(J)}}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class iQ extends N9{constructor(J,Q){super();this.scene=J,this.camera=Q,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(J,Q,$){let Z=J.getContext(),W=J.state;W.buffers.color.setMask(!1),W.buffers.depth.setMask(!1),W.buffers.color.setLocked(!0),W.buffers.depth.setLocked(!0);let Y,X;if(this.inverse)Y=0,X=1;else Y=1,X=0;if(W.buffers.stencil.setTest(!0),W.buffers.stencil.setOp(Z.REPLACE,Z.REPLACE,Z.REPLACE),W.buffers.stencil.setFunc(Z.ALWAYS,Y,4294967295),W.buffers.stencil.setClear(X),W.buffers.stencil.setLocked(!0),J.setRenderTarget($),this.clear)J.clear();if(J.render(this.scene,this.camera),J.setRenderTarget(Q),this.clear)J.clear();J.render(this.scene,this.camera),W.buffers.color.setLocked(!1),W.buffers.depth.setLocked(!1),W.buffers.color.setMask(!0),W.buffers.depth.setMask(!0),W.buffers.stencil.setLocked(!1),W.buffers.stencil.setFunc(Z.EQUAL,1,4294967295),W.buffers.stencil.setOp(Z.KEEP,Z.KEEP,Z.KEEP),W.buffers.stencil.setLocked(!0)}}class RW extends N9{constructor(){super();this.needsSwap=!1}render(J){J.state.buffers.stencil.setLocked(!1),J.state.buffers.stencil.setTest(!1)}}class LW{constructor(J,Q){if(this.renderer=J,this._pixelRatio=J.getPixelRatio(),Q===void 0){let $=J.getSize(new T0);this._width=$.width,this._height=$.height,Q=new TJ(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:kJ}),Q.texture.name="EffectComposer.rt1"}else this._width=Q.width,this._height=Q.height;this.renderTarget1=Q,this.renderTarget2=Q.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new B7(v6),this.copyPass.material.blending=H9,this.timer=new xQ}swapBuffers(){let J=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=J}addPass(J){this.passes.push(J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(J,Q){this.passes.splice(Q,0,J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(J){let Q=this.passes.indexOf(J);if(Q!==-1)this.passes.splice(Q,1)}isLastEnabledPass(J){for(let Q=J+1;Q<this.passes.length;Q++)if(this.passes[Q].enabled)return!1;return!0}render(J){if(this.timer.update(),J===void 0)J=this.timer.getDelta();let Q=this.renderer.getRenderTarget(),$=!1;for(let Z=0,W=this.passes.length;Z<W;Z++){let Y=this.passes[Z];if(Y.enabled===!1)continue;if(Y.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(Z),Y.render(this.renderer,this.writeBuffer,this.readBuffer,J,$),Y.needsSwap){if($){let X=this.renderer.getContext(),K=this.renderer.state.buffers.stencil;K.setFunc(X.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,J),K.setFunc(X.EQUAL,1,4294967295)}this.swapBuffers()}if(iQ!==void 0){if(Y instanceof iQ)$=!0;else if(Y instanceof RW)$=!1}}this.renderer.setRenderTarget(Q)}reset(J){if(J===void 0){let Q=this.renderer.getSize(new T0);this._pixelRatio=this.renderer.getPixelRatio(),this._width=Q.width,this._height=Q.height,J=this.renderTarget1.clone(),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=J,this.renderTarget2=J.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(J,Q){this._width=J,this._height=Q;let $=this._width*this._pixelRatio,Z=this._height*this._pixelRatio;this.renderTarget1.setSize($,Z),this.renderTarget2.setSize($,Z);for(let W=0;W<this.passes.length;W++)this.passes[W].setSize($,Z)}setPixelRatio(J){this._pixelRatio=J,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class DW extends N9{constructor(J,Q,$=null,Z=null,W=null){super();this.scene=J,this.camera=Q,this.overrideMaterial=$,this.clearColor=Z,this.clearAlpha=W,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new X0}render(J,Q,$){let Z=J.autoClear;J.autoClear=!1;let W,Y;if(this.overrideMaterial!==null)Y=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial;if(this.clearColor!==null)J.getClearColor(this._oldClearColor),J.setClearColor(this.clearColor,J.getClearAlpha());if(this.clearAlpha!==null)W=J.getClearAlpha(),J.setClearAlpha(this.clearAlpha);if(this.clearDepth==!0)J.clearDepth();if(J.setRenderTarget(this.renderToScreen?null:$),this.clear===!0)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);if(J.render(this.scene,this.camera),this.clearColor!==null)J.setClearColor(this._oldClearColor);if(this.clearAlpha!==null)J.setClearAlpha(W);if(this.overrideMaterial!==null)this.scene.overrideMaterial=Y;J.autoClear=Z}}var rK={name:"LuminosityHighPassShader",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new X0(0)},defaultOpacity:{value:0}},vertexShader:`
4131
+ }`};class f9{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}var TD=new t9(-1,1,1,-1,0,1);class J1 extends u0{constructor(){super();this.setAttribute("position",new z0([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new z0([0,2,0,0,2,0],2))}}var SD=new J1;class i6{constructor(J){this._mesh=new a0(SD,J)}dispose(){this._mesh.geometry.dispose()}render(J){J.render(this._mesh,TD)}get material(){return this._mesh.material}set material(J){this._mesh.material=J}}class o6 extends f9{constructor(J,Q="tDiffuse"){super();if(this.textureID=Q,this.uniforms=null,this.material=null,J instanceof LJ)this.uniforms=J.uniforms,this.material=J;else if(J)this.uniforms=K9.clone(J.uniforms),this.material=new LJ({name:J.name!==void 0?J.name:"unspecified",defines:Object.assign({},J.defines),uniforms:this.uniforms,vertexShader:J.vertexShader,fragmentShader:J.fragmentShader});this._fsQuad=new i6(this.material)}render(J,Q,$){if(this.uniforms[this.textureID])this.uniforms[this.textureID].value=$.texture;if(this._fsQuad.material=this.material,this.renderToScreen)J.setRenderTarget(null),this._fsQuad.render(J);else{if(J.setRenderTarget(Q),this.clear)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);this._fsQuad.render(J)}}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class UY extends f9{constructor(J,Q){super();this.scene=J,this.camera=Q,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(J,Q,$){let Z=J.getContext(),W=J.state;W.buffers.color.setMask(!1),W.buffers.depth.setMask(!1),W.buffers.color.setLocked(!0),W.buffers.depth.setLocked(!0);let Y,X;if(this.inverse)Y=0,X=1;else Y=1,X=0;if(W.buffers.stencil.setTest(!0),W.buffers.stencil.setOp(Z.REPLACE,Z.REPLACE,Z.REPLACE),W.buffers.stencil.setFunc(Z.ALWAYS,Y,4294967295),W.buffers.stencil.setClear(X),W.buffers.stencil.setLocked(!0),J.setRenderTarget($),this.clear)J.clear();if(J.render(this.scene,this.camera),J.setRenderTarget(Q),this.clear)J.clear();J.render(this.scene,this.camera),W.buffers.color.setLocked(!1),W.buffers.depth.setLocked(!1),W.buffers.color.setMask(!0),W.buffers.depth.setMask(!0),W.buffers.stencil.setLocked(!1),W.buffers.stencil.setFunc(Z.EQUAL,1,4294967295),W.buffers.stencil.setOp(Z.KEEP,Z.KEEP,Z.KEEP),W.buffers.stencil.setLocked(!0)}}class _H extends f9{constructor(){super();this.needsSwap=!1}render(J){J.state.buffers.stencil.setLocked(!1),J.state.buffers.stencil.setTest(!1)}}class wH{constructor(J,Q){if(this.renderer=J,this._pixelRatio=J.getPixelRatio(),Q===void 0){let $=J.getSize(new i);this._width=$.width,this._height=$.height,Q=new PJ(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:wJ}),Q.texture.name="EffectComposer.rt1"}else this._width=Q.width,this._height=Q.height;this.renderTarget1=Q,this.renderTarget2=Q.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new o6($Q),this.copyPass.material.blending=V9,this.timer=new a7}swapBuffers(){let J=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=J}addPass(J){this.passes.push(J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(J,Q){this.passes.splice(Q,0,J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(J){let Q=this.passes.indexOf(J);if(Q!==-1)this.passes.splice(Q,1)}isLastEnabledPass(J){for(let Q=J+1;Q<this.passes.length;Q++)if(this.passes[Q].enabled)return!1;return!0}render(J){if(this.timer.update(),J===void 0)J=this.timer.getDelta();let Q=this.renderer.getRenderTarget(),$=!1;for(let Z=0,W=this.passes.length;Z<W;Z++){let Y=this.passes[Z];if(Y.enabled===!1)continue;if(Y.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(Z),Y.render(this.renderer,this.writeBuffer,this.readBuffer,J,$),Y.needsSwap){if($){let X=this.renderer.getContext(),K=this.renderer.state.buffers.stencil;K.setFunc(X.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,J),K.setFunc(X.EQUAL,1,4294967295)}this.swapBuffers()}if(UY!==void 0){if(Y instanceof UY)$=!0;else if(Y instanceof _H)$=!1}}this.renderer.setRenderTarget(Q)}reset(J){if(J===void 0){let Q=this.renderer.getSize(new i);this._pixelRatio=this.renderer.getPixelRatio(),this._width=Q.width,this._height=Q.height,J=this.renderTarget1.clone(),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=J,this.renderTarget2=J.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(J,Q){this._width=J,this._height=Q;let $=this._width*this._pixelRatio,Z=this._height*this._pixelRatio;this.renderTarget1.setSize($,Z),this.renderTarget2.setSize($,Z);for(let W=0;W<this.passes.length;W++)this.passes[W].setSize($,Z)}setPixelRatio(J){this._pixelRatio=J,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class PH extends f9{constructor(J,Q,$=null,Z=null,W=null){super();this.scene=J,this.camera=Q,this.overrideMaterial=$,this.clearColor=Z,this.clearAlpha=W,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new e}render(J,Q,$){let Z=J.autoClear;J.autoClear=!1;let W,Y;if(this.overrideMaterial!==null)Y=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial;if(this.clearColor!==null)J.getClearColor(this._oldClearColor),J.setClearColor(this.clearColor,J.getClearAlpha());if(this.clearAlpha!==null)W=J.getClearAlpha(),J.setClearAlpha(this.clearAlpha);if(this.clearDepth==!0)J.clearDepth();if(J.setRenderTarget(this.renderToScreen?null:$),this.clear===!0)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);if(J.render(this.scene,this.camera),this.clearColor!==null)J.setClearColor(this._oldClearColor);if(this.clearAlpha!==null)J.setClearAlpha(W);if(this.overrideMaterial!==null)this.scene.overrideMaterial=Y;J.autoClear=Z}}var Q1={name:"LuminosityHighPassShader",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new e(0)},defaultOpacity:{value:0}},vertexShader:`
4132
4132
 
4133
4133
  varying vec2 vUv;
4134
4134
 
@@ -4160,7 +4160,7 @@ void main() {
4160
4160
 
4161
4161
  gl_FragColor = mix( outputColor, texel, alpha );
4162
4162
 
4163
- }`};class m8 extends N9{constructor(J,Q=1,$,Z){super();this.strength=Q,this.radius=$,this.threshold=Z,this.resolution=J!==void 0?new T0(J.x,J.y):new T0(256,256),this.clearColor=new X0(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let W=Math.round(this.resolution.x/2),Y=Math.round(this.resolution.y/2);this.renderTargetBright=new TJ(W,Y,{type:kJ}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let U=0;U<this.nMips;U++){let G=new TJ(W,Y,{type:kJ});G.texture.name="UnrealBloomPass.h"+U,G.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(G);let F=new TJ(W,Y,{type:kJ});F.texture.name="UnrealBloomPass.v"+U,F.texture.generateMipmaps=!1,this.renderTargetsVertical.push(F),W=Math.round(W/2),Y=Math.round(Y/2)}let X=rK;this.highPassUniforms=rJ.clone(X.uniforms),this.highPassUniforms.luminosityThreshold.value=Z,this.highPassUniforms.smoothWidth.value=0.01,this.materialHighPassFilter=new OJ({uniforms:this.highPassUniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader}),this.separableBlurMaterials=[];let K=[6,10,14,18,22];W=Math.round(this.resolution.x/2),Y=Math.round(this.resolution.y/2);for(let U=0;U<this.nMips;U++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(K[U])),this.separableBlurMaterials[U].uniforms.invSize.value=new T0(1/W,1/Y),W=Math.round(W/2),Y=Math.round(Y/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=Q,this.compositeMaterial.uniforms.bloomRadius.value=0.1;let H=[1,0.8,0.6,0.4,0.2];this.compositeMaterial.uniforms.bloomFactors.value=H,this.bloomTintColors=[new S(1,1,1),new S(1,1,1),new S(1,1,1),new S(1,1,1),new S(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=rJ.clone(v6.uniforms),this.blendMaterial=new OJ({uniforms:this.copyUniforms,vertexShader:v6.vertexShader,fragmentShader:v6.fragmentShader,premultipliedAlpha:!0,blending:P8,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new X0,this._oldClearAlpha=1,this._basic=new U9,this._fsQuad=new d8(null)}dispose(){for(let J=0;J<this.renderTargetsHorizontal.length;J++)this.renderTargetsHorizontal[J].dispose();for(let J=0;J<this.renderTargetsVertical.length;J++)this.renderTargetsVertical[J].dispose();this.renderTargetBright.dispose();for(let J=0;J<this.separableBlurMaterials.length;J++)this.separableBlurMaterials[J].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(J,Q){let $=Math.round(J/2),Z=Math.round(Q/2);this.renderTargetBright.setSize($,Z);for(let W=0;W<this.nMips;W++)this.renderTargetsHorizontal[W].setSize($,Z),this.renderTargetsVertical[W].setSize($,Z),this.separableBlurMaterials[W].uniforms.invSize.value=new T0(1/$,1/Z),$=Math.round($/2),Z=Math.round(Z/2)}render(J,Q,$,Z,W){J.getClearColor(this._oldClearColor),this._oldClearAlpha=J.getClearAlpha();let Y=J.autoClear;if(J.autoClear=!1,J.setClearColor(this.clearColor,0),W)J.state.buffers.stencil.setTest(!1);if(this.renderToScreen)this._fsQuad.material=this._basic,this._basic.map=$.texture,J.setRenderTarget(null),J.clear(),this._fsQuad.render(J);this.highPassUniforms.tDiffuse.value=$.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,J.setRenderTarget(this.renderTargetBright),J.clear(),this._fsQuad.render(J);let X=this.renderTargetBright;for(let K=0;K<this.nMips;K++)this._fsQuad.material=this.separableBlurMaterials[K],this.separableBlurMaterials[K].uniforms.colorTexture.value=X.texture,this.separableBlurMaterials[K].uniforms.direction.value=m8.BlurDirectionX,J.setRenderTarget(this.renderTargetsHorizontal[K]),J.clear(),this._fsQuad.render(J),this.separableBlurMaterials[K].uniforms.colorTexture.value=this.renderTargetsHorizontal[K].texture,this.separableBlurMaterials[K].uniforms.direction.value=m8.BlurDirectionY,J.setRenderTarget(this.renderTargetsVertical[K]),J.clear(),this._fsQuad.render(J),X=this.renderTargetsVertical[K];if(this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,J.setRenderTarget(this.renderTargetsHorizontal[0]),J.clear(),this._fsQuad.render(J),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,W)J.state.buffers.stencil.setTest(!0);if(this.renderToScreen)J.setRenderTarget(null),this._fsQuad.render(J);else J.setRenderTarget($),this._fsQuad.render(J);J.setClearColor(this._oldClearColor,this._oldClearAlpha),J.autoClear=Y}_getSeparableBlurMaterial(J){let Q=[],$=J/3;for(let Z=0;Z<J;Z++)Q.push(0.39894*Math.exp(-0.5*Z*Z/($*$))/$);return new OJ({defines:{KERNEL_RADIUS:J},uniforms:{colorTexture:{value:null},invSize:{value:new T0(0.5,0.5)},direction:{value:new T0(0.5,0.5)},gaussianCoefficients:{value:Q}},vertexShader:`
4163
+ }`};class a6 extends f9{constructor(J,Q=1,$,Z){super();this.strength=Q,this.radius=$,this.threshold=Z,this.resolution=J!==void 0?new i(J.x,J.y):new i(256,256),this.clearColor=new e(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let W=Math.round(this.resolution.x/2),Y=Math.round(this.resolution.y/2);this.renderTargetBright=new PJ(W,Y,{type:wJ}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let U=0;U<this.nMips;U++){let G=new PJ(W,Y,{type:wJ});G.texture.name="UnrealBloomPass.h"+U,G.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(G);let F=new PJ(W,Y,{type:wJ});F.texture.name="UnrealBloomPass.v"+U,F.texture.generateMipmaps=!1,this.renderTargetsVertical.push(F),W=Math.round(W/2),Y=Math.round(Y/2)}let X=Q1;this.highPassUniforms=K9.clone(X.uniforms),this.highPassUniforms.luminosityThreshold.value=Z,this.highPassUniforms.smoothWidth.value=0.01,this.materialHighPassFilter=new LJ({uniforms:this.highPassUniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader}),this.separableBlurMaterials=[];let K=[6,10,14,18,22];W=Math.round(this.resolution.x/2),Y=Math.round(this.resolution.y/2);for(let U=0;U<this.nMips;U++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(K[U])),this.separableBlurMaterials[U].uniforms.invSize.value=new i(1/W,1/Y),W=Math.round(W/2),Y=Math.round(Y/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=Q,this.compositeMaterial.uniforms.bloomRadius.value=0.1;let H=[1,0.8,0.6,0.4,0.2];this.compositeMaterial.uniforms.bloomFactors.value=H,this.bloomTintColors=[new A(1,1,1),new A(1,1,1),new A(1,1,1),new A(1,1,1),new A(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=K9.clone($Q.uniforms),this.blendMaterial=new LJ({uniforms:this.copyUniforms,vertexShader:$Q.vertexShader,fragmentShader:$Q.fragmentShader,premultipliedAlpha:!0,blending:c8,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new e,this._oldClearAlpha=1,this._basic=new nJ,this._fsQuad=new i6(null)}dispose(){for(let J=0;J<this.renderTargetsHorizontal.length;J++)this.renderTargetsHorizontal[J].dispose();for(let J=0;J<this.renderTargetsVertical.length;J++)this.renderTargetsVertical[J].dispose();this.renderTargetBright.dispose();for(let J=0;J<this.separableBlurMaterials.length;J++)this.separableBlurMaterials[J].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(J,Q){let $=Math.round(J/2),Z=Math.round(Q/2);this.renderTargetBright.setSize($,Z);for(let W=0;W<this.nMips;W++)this.renderTargetsHorizontal[W].setSize($,Z),this.renderTargetsVertical[W].setSize($,Z),this.separableBlurMaterials[W].uniforms.invSize.value=new i(1/$,1/Z),$=Math.round($/2),Z=Math.round(Z/2)}render(J,Q,$,Z,W){J.getClearColor(this._oldClearColor),this._oldClearAlpha=J.getClearAlpha();let Y=J.autoClear;if(J.autoClear=!1,J.setClearColor(this.clearColor,0),W)J.state.buffers.stencil.setTest(!1);if(this.renderToScreen)this._fsQuad.material=this._basic,this._basic.map=$.texture,J.setRenderTarget(null),J.clear(),this._fsQuad.render(J);this.highPassUniforms.tDiffuse.value=$.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,J.setRenderTarget(this.renderTargetBright),J.clear(),this._fsQuad.render(J);let X=this.renderTargetBright;for(let K=0;K<this.nMips;K++)this._fsQuad.material=this.separableBlurMaterials[K],this.separableBlurMaterials[K].uniforms.colorTexture.value=X.texture,this.separableBlurMaterials[K].uniforms.direction.value=a6.BlurDirectionX,J.setRenderTarget(this.renderTargetsHorizontal[K]),J.clear(),this._fsQuad.render(J),this.separableBlurMaterials[K].uniforms.colorTexture.value=this.renderTargetsHorizontal[K].texture,this.separableBlurMaterials[K].uniforms.direction.value=a6.BlurDirectionY,J.setRenderTarget(this.renderTargetsVertical[K]),J.clear(),this._fsQuad.render(J),X=this.renderTargetsVertical[K];if(this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,J.setRenderTarget(this.renderTargetsHorizontal[0]),J.clear(),this._fsQuad.render(J),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,W)J.state.buffers.stencil.setTest(!0);if(this.renderToScreen)J.setRenderTarget(null),this._fsQuad.render(J);else J.setRenderTarget($),this._fsQuad.render(J);J.setClearColor(this._oldClearColor,this._oldClearAlpha),J.autoClear=Y}_getSeparableBlurMaterial(J){let Q=[],$=J/3;for(let Z=0;Z<J;Z++)Q.push(0.39894*Math.exp(-0.5*Z*Z/($*$))/$);return new LJ({defines:{KERNEL_RADIUS:J},uniforms:{colorTexture:{value:null},invSize:{value:new i(0.5,0.5)},direction:{value:new i(0.5,0.5)},gaussianCoefficients:{value:Q}},vertexShader:`
4164
4164
 
4165
4165
  varying vec2 vUv;
4166
4166
 
@@ -4198,7 +4198,7 @@ void main() {
4198
4198
 
4199
4199
  gl_FragColor = vec4( diffuseSum, 1.0 );
4200
4200
 
4201
- }`})}_getCompositeMaterial(J){return new OJ({defines:{NUM_MIPS:J},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`
4201
+ }`})}_getCompositeMaterial(J){return new LJ({defines:{NUM_MIPS:J},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`
4202
4202
 
4203
4203
  varying vec2 vUv;
4204
4204
 
@@ -4242,7 +4242,7 @@ void main() {
4242
4242
  float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
4243
4243
  gl_FragColor = vec4( bloom, bloomAlpha );
4244
4244
 
4245
- }`})}}m8.BlurDirectionX=new T0(1,0);m8.BlurDirectionY=new T0(0,1);var C7={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
4245
+ }`})}}a6.BlurDirectionX=new i(1,0);a6.BlurDirectionY=new i(0,1);var _$={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
4246
4246
  precision highp float;
4247
4247
 
4248
4248
  uniform mat4 modelViewMatrix;
@@ -4313,21 +4313,64 @@ void main() {
4313
4313
 
4314
4314
  #endif
4315
4315
 
4316
- }`};class kW extends N9{constructor(){super();this.isOutputPass=!0,this.uniforms=rJ.clone(C7.uniforms),this.material=new N7({name:C7.name,uniforms:this.uniforms,vertexShader:C7.vertexShader,fragmentShader:C7.fragmentShader}),this._fsQuad=new d8(this.material),this._outputColorSpace=null,this._toneMapping=null}render(J,Q,$){if(this.uniforms.tDiffuse.value=$.texture,this.uniforms.toneMappingExposure.value=J.toneMappingExposure,this._outputColorSpace!==J.outputColorSpace||this._toneMapping!==J.toneMapping){if(this._outputColorSpace=J.outputColorSpace,this._toneMapping=J.toneMapping,this.material.defines={},u0.getTransfer(this._outputColorSpace)===YJ)this.material.defines.SRGB_TRANSFER="";if(this._toneMapping===s6)this.material.defines.LINEAR_TONE_MAPPING="";else if(this._toneMapping===i6)this.material.defines.REINHARD_TONE_MAPPING="";else if(this._toneMapping===o6)this.material.defines.CINEON_TONE_MAPPING="";else if(this._toneMapping===T8)this.material.defines.ACES_FILMIC_TONE_MAPPING="";else if(this._toneMapping===r6)this.material.defines.AGX_TONE_MAPPING="";else if(this._toneMapping===t6)this.material.defines.NEUTRAL_TONE_MAPPING="";else if(this._toneMapping===a6)this.material.defines.CUSTOM_TONE_MAPPING="";this.material.needsUpdate=!0}if(this.renderToScreen===!0)J.setRenderTarget(null),this._fsQuad.render(J);else{if(J.setRenderTarget(Q),this.clear)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);this._fsQuad.render(J)}}dispose(){this.material.dispose(),this._fsQuad.dispose()}}var bF={uniforms:{tDiffuse:{value:null},offset:{value:1.1},darkness:{value:1}},vertexShader:`
4316
+ }`};class AH extends f9{constructor(){super();this.isOutputPass=!0,this.uniforms=K9.clone(_$.uniforms),this.material=new u6({name:_$.name,uniforms:this.uniforms,vertexShader:_$.vertexShader,fragmentShader:_$.fragmentShader}),this._fsQuad=new i6(this.material),this._outputColorSpace=null,this._toneMapping=null}render(J,Q,$){if(this.uniforms.tDiffuse.value=$.texture,this.uniforms.toneMappingExposure.value=J.toneMappingExposure,this._outputColorSpace!==J.outputColorSpace||this._toneMapping!==J.toneMapping){if(this._outputColorSpace=J.outputColorSpace,this._toneMapping=J.toneMapping,this.material.defines={},t0.getTransfer(this._outputColorSpace)===OJ)this.material.defines.SRGB_TRANSFER="";if(this._toneMapping===_7)this.material.defines.LINEAR_TONE_MAPPING="";else if(this._toneMapping===w7)this.material.defines.REINHARD_TONE_MAPPING="";else if(this._toneMapping===P7)this.material.defines.CINEON_TONE_MAPPING="";else if(this._toneMapping===n8)this.material.defines.ACES_FILMIC_TONE_MAPPING="";else if(this._toneMapping===T7)this.material.defines.AGX_TONE_MAPPING="";else if(this._toneMapping===S7)this.material.defines.NEUTRAL_TONE_MAPPING="";else if(this._toneMapping===A7)this.material.defines.CUSTOM_TONE_MAPPING="";this.material.needsUpdate=!0}if(this.renderToScreen===!0)J.setRenderTarget(null),this._fsQuad.render(J);else{if(J.setRenderTarget(Q),this.clear)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);this._fsQuad.render(J)}}dispose(){this.material.dispose(),this._fsQuad.dispose()}}var jD={uniforms:{tDiffuse:{value:null},vignette:{value:0},contrast:{value:1},saturation:{value:1}},vertexShader:`
4317
4317
  varying vec2 vUv;
4318
4318
  void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }
4319
4319
  `,fragmentShader:`
4320
4320
  uniform sampler2D tDiffuse;
4321
- uniform float offset;
4322
- uniform float darkness;
4321
+ uniform float vignette;
4322
+ uniform float contrast;
4323
+ uniform float saturation;
4323
4324
  varying vec2 vUv;
4324
4325
  void main() {
4325
- vec4 color = texture2D(tDiffuse, vUv);
4326
- vec2 uv = (vUv - 0.5) * offset;
4326
+ vec3 c = texture2D(tDiffuse, vUv).rgb;
4327
+ // contrast around mid-grey, then saturation
4328
+ c = (c - 0.5) * contrast + 0.5;
4329
+ float l = dot(c, vec3(0.2126, 0.7152, 0.0722));
4330
+ c = mix(vec3(l), c, saturation);
4331
+ // vignette
4332
+ vec2 uv = (vUv - 0.5) * 1.1;
4327
4333
  float vig = clamp(1.0 - dot(uv, uv), 0.0, 1.0);
4328
- gl_FragColor = vec4(color.rgb * mix(1.0, vig, darkness), color.a);
4334
+ c *= mix(1.0, vig, vignette);
4335
+ gl_FragColor = vec4(c, 1.0);
4329
4336
  }
4330
- `};function tK(J,Q,$,Z){let W=(Z.bloom??0)>0,Y=(Z.vignette??0)>0;if(!W&&!Y)return null;let X=new LW(J);if(X.setSize(Z.width,Z.height),X.addPass(new DW(Q,$)),W)X.addPass(new m8(new T0(Z.width,Z.height),Z.bloom??0.6,Z.bloomRadius??0.6,Z.bloomThreshold??0.85));if(Y){let K=new B7(bF);K.uniforms.darkness.value=Z.vignette,X.addPass(K)}return X.addPass(new kW),{render:()=>X.render(0),setSize:(K,H)=>X.setSize(K,H)}}class MW extends a0{constructor(J,Q,$=!1,Z=!1,W=1e4){let Y=new qJ;super(Y,Q);this.isMarchingCubes=!0;let X=this,K=new Float32Array(36),H=new Float32Array(36),U=new Float32Array(36);this.enableUvs=$,this.enableColors=Z,this.init=function(N){this.resolution=N,this.isolation=80,this.size=N,this.size2=this.size*this.size,this.size3=this.size2*this.size,this.halfsize=this.size/2,this.delta=2/this.size,this.yd=this.size,this.zd=this.size2,this.field=new Float32Array(this.size3),this.normal_cache=new Float32Array(this.size3*3),this.palette=new Float32Array(this.size3*3),this.count=0;let L=W*3;this.positionArray=new Float32Array(L*3);let k=new QJ(this.positionArray,3);k.setUsage(L6),Y.setAttribute("position",k),this.normalArray=new Float32Array(L*3);let M=new QJ(this.normalArray,3);if(M.setUsage(L6),Y.setAttribute("normal",M),this.enableUvs){this.uvArray=new Float32Array(L*2);let P=new QJ(this.uvArray,2);P.setUsage(L6),Y.setAttribute("uv",P)}if(this.enableColors){this.colorArray=new Float32Array(L*3);let P=new QJ(this.colorArray,3);P.setUsage(L6),Y.setAttribute("color",P)}Y.boundingSphere=new lJ(new S,1)};function G(N,L,k){return N+(L-N)*k}function F(N,L,k,M,P,w,B,D,V,j){let z=(k-B)/(D-B),v=X.normal_cache;K[L+0]=M+z*X.delta,K[L+1]=P,K[L+2]=w,H[L+0]=G(v[N+0],v[N+3],z),H[L+1]=G(v[N+1],v[N+4],z),H[L+2]=G(v[N+2],v[N+5],z),U[L+0]=G(X.palette[V*3+0],X.palette[j*3+0],z),U[L+1]=G(X.palette[V*3+1],X.palette[j*3+1],z),U[L+2]=G(X.palette[V*3+2],X.palette[j*3+2],z)}function E(N,L,k,M,P,w,B,D,V,j){let z=(k-B)/(D-B),v=X.normal_cache;K[L+0]=M,K[L+1]=P+z*X.delta,K[L+2]=w;let y=N+X.yd*3;H[L+0]=G(v[N+0],v[y+0],z),H[L+1]=G(v[N+1],v[y+1],z),H[L+2]=G(v[N+2],v[y+2],z),U[L+0]=G(X.palette[V*3+0],X.palette[j*3+0],z),U[L+1]=G(X.palette[V*3+1],X.palette[j*3+1],z),U[L+2]=G(X.palette[V*3+2],X.palette[j*3+2],z)}function O(N,L,k,M,P,w,B,D,V,j){let z=(k-B)/(D-B),v=X.normal_cache;K[L+0]=M,K[L+1]=P,K[L+2]=w+z*X.delta;let y=N+X.zd*3;H[L+0]=G(v[N+0],v[y+0],z),H[L+1]=G(v[N+1],v[y+1],z),H[L+2]=G(v[N+2],v[y+2],z),U[L+0]=G(X.palette[V*3+0],X.palette[j*3+0],z),U[L+1]=G(X.palette[V*3+1],X.palette[j*3+1],z),U[L+2]=G(X.palette[V*3+2],X.palette[j*3+2],z)}function R(N){let L=N*3;if(X.normal_cache[L]===0)X.normal_cache[L+0]=X.field[N-1]-X.field[N+1],X.normal_cache[L+1]=X.field[N-X.yd]-X.field[N+X.yd],X.normal_cache[L+2]=X.field[N-X.zd]-X.field[N+X.zd]}function C(N,L,k,M,P){let w=M+1,B=M+X.yd,D=M+X.zd,V=w+X.yd,j=w+X.zd,z=M+X.yd+X.zd,v=w+X.yd+X.zd,y=0,A=X.field[M],x=X.field[w],b=X.field[B],p=X.field[V],c=X.field[D],o=X.field[j],Q0=X.field[z],Y0=X.field[v];if(A<P)y|=1;if(x<P)y|=2;if(b<P)y|=8;if(p<P)y|=4;if(c<P)y|=16;if(o<P)y|=32;if(Q0<P)y|=128;if(Y0<P)y|=64;let J0=hF[y];if(J0===0)return 0;let x0=X.delta,v0=N+x0,s=L+x0,K0=k+x0;if(J0&1)R(M),R(w),F(M*3,0,P,N,L,k,A,x,M,w);if(J0&2)R(w),R(V),E(w*3,3,P,v0,L,k,x,p,w,V);if(J0&4)R(B),R(V),F(B*3,6,P,N,s,k,b,p,B,V);if(J0&8)R(M),R(B),E(M*3,9,P,N,L,k,A,b,M,B);if(J0&16)R(D),R(j),F(D*3,12,P,N,L,K0,c,o,D,j);if(J0&32)R(j),R(v),E(j*3,15,P,v0,L,K0,o,Y0,j,v);if(J0&64)R(z),R(v),F(z*3,18,P,N,s,K0,Q0,Y0,z,v);if(J0&128)R(D),R(z),E(D*3,21,P,N,L,K0,c,Q0,D,z);if(J0&256)R(M),R(D),O(M*3,24,P,N,L,k,A,c,M,D);if(J0&512)R(w),R(j),O(w*3,27,P,v0,L,k,x,o,w,j);if(J0&1024)R(V),R(v),O(V*3,30,P,v0,s,k,p,Y0,V,v);if(J0&2048)R(B),R(z),O(B*3,33,P,N,s,k,b,Q0,B,z);y<<=4;let D0,E0,_0,i0=0,y0=0;while(oQ[y+y0]!=-1)D0=y+y0,E0=D0+1,_0=D0+2,q(K,H,U,3*oQ[D0],3*oQ[E0],3*oQ[_0]),y0+=3,i0++;return i0}function q(N,L,k,M,P,w){let B=X.count*3;if(X.positionArray[B+0]=N[M],X.positionArray[B+1]=N[M+1],X.positionArray[B+2]=N[M+2],X.positionArray[B+3]=N[P],X.positionArray[B+4]=N[P+1],X.positionArray[B+5]=N[P+2],X.positionArray[B+6]=N[w],X.positionArray[B+7]=N[w+1],X.positionArray[B+8]=N[w+2],X.material.flatShading===!0){let D=(L[M+0]+L[P+0]+L[w+0])/3,V=(L[M+1]+L[P+1]+L[w+1])/3,j=(L[M+2]+L[P+2]+L[w+2])/3;X.normalArray[B+0]=D,X.normalArray[B+1]=V,X.normalArray[B+2]=j,X.normalArray[B+3]=D,X.normalArray[B+4]=V,X.normalArray[B+5]=j,X.normalArray[B+6]=D,X.normalArray[B+7]=V,X.normalArray[B+8]=j}else X.normalArray[B+0]=L[M+0],X.normalArray[B+1]=L[M+1],X.normalArray[B+2]=L[M+2],X.normalArray[B+3]=L[P+0],X.normalArray[B+4]=L[P+1],X.normalArray[B+5]=L[P+2],X.normalArray[B+6]=L[w+0],X.normalArray[B+7]=L[w+1],X.normalArray[B+8]=L[w+2];if(X.enableUvs){let D=X.count*2;X.uvArray[D+0]=N[M+0],X.uvArray[D+1]=N[M+2],X.uvArray[D+2]=N[P+0],X.uvArray[D+3]=N[P+2],X.uvArray[D+4]=N[w+0],X.uvArray[D+5]=N[w+2]}if(X.enableColors)X.colorArray[B+0]=k[M+0],X.colorArray[B+1]=k[M+1],X.colorArray[B+2]=k[M+2],X.colorArray[B+3]=k[P+0],X.colorArray[B+4]=k[P+1],X.colorArray[B+5]=k[P+2],X.colorArray[B+6]=k[w+0],X.colorArray[B+7]=k[w+1],X.colorArray[B+8]=k[w+2];X.count+=3}this.addBall=function(N,L,k,M,P,w){let B=Math.sign(M);M=Math.abs(M);let D=!(w===void 0||w===null),V=new X0(N,L,k);if(D)try{V=w instanceof X0?w:Array.isArray(w)?new X0(Math.min(Math.abs(w[0]),1),Math.min(Math.abs(w[1]),1),Math.min(Math.abs(w[2]),1)):new X0(w)}catch(y0){V=new X0(N,L,k)}let j=this.size*Math.sqrt(M/P),z=k*this.size,v=L*this.size,y=N*this.size,A=Math.floor(z-j);if(A<1)A=1;let x=Math.floor(z+j);if(x>this.size-1)x=this.size-1;let b=Math.floor(v-j);if(b<1)b=1;let p=Math.floor(v+j);if(p>this.size-1)p=this.size-1;let c=Math.floor(y-j);if(c<1)c=1;let o=Math.floor(y+j);if(o>this.size-1)o=this.size-1;let Q0,Y0,J0,x0,v0,s,K0,D0,E0,_0,i0;for(J0=A;J0<x;J0++){v0=this.size2*J0,D0=J0/this.size-k,E0=D0*D0;for(Y0=b;Y0<p;Y0++){x0=v0+this.size*Y0,K0=Y0/this.size-L,_0=K0*K0;for(Q0=c;Q0<o;Q0++)if(s=Q0/this.size-N,i0=M/(0.000001+s*s+_0+E0)-P,i0>0){this.field[x0+Q0]+=i0*B;let y0=Math.sqrt((Q0-y)*(Q0-y)+(Y0-v)*(Y0-v)+(J0-z)*(J0-z))/j,d0=1-y0*y0*y0*(y0*(y0*6-15)+10);this.palette[(x0+Q0)*3+0]+=V.r*d0,this.palette[(x0+Q0)*3+1]+=V.g*d0,this.palette[(x0+Q0)*3+2]+=V.b*d0}}}},this.addPlaneX=function(N,L){let k=this.size,M=this.yd,P=this.zd,w=this.field,B,D,V,j,z,v,y,A=k*Math.sqrt(N/L);if(A>k)A=k;for(B=0;B<A;B++)if(v=B/k,j=v*v,z=N/(0.0001+j)-L,z>0)for(D=0;D<k;D++){y=B+D*M;for(V=0;V<k;V++)w[P*V+y]+=z}},this.addPlaneY=function(N,L){let k=this.size,M=this.yd,P=this.zd,w=this.field,B,D,V,j,z,v,y,A,x=k*Math.sqrt(N/L);if(x>k)x=k;for(D=0;D<x;D++)if(v=D/k,j=v*v,z=N/(0.0001+j)-L,z>0){y=D*M;for(B=0;B<k;B++){A=y+B;for(V=0;V<k;V++)w[P*V+A]+=z}}},this.addPlaneZ=function(N,L){let k=this.size,M=this.yd,P=this.zd,w=this.field,B,D,V,j,z,v,y,A,x=k*Math.sqrt(N/L);if(x>k)x=k;for(V=0;V<x;V++)if(v=V/k,j=v*v,z=N/(0.0001+j)-L,z>0){y=P*V;for(D=0;D<k;D++){A=y+D*M;for(B=0;B<k;B++)w[A+B]+=z}}},this.setCell=function(N,L,k,M){let P=this.size2*k+this.size*L+N;this.field[P]=M},this.getCell=function(N,L,k){let M=this.size2*k+this.size*L+N;return this.field[M]},this.blur=function(N=1){let L=this.field,k=L.slice(),M=this.size,P=this.size2;for(let w=0;w<M;w++)for(let B=0;B<M;B++)for(let D=0;D<M;D++){let V=P*D+M*B+w,j=k[V],z=1;for(let v=-1;v<=1;v+=2){let y=v+w;if(y<0||y>=M)continue;for(let A=-1;A<=1;A+=2){let x=A+B;if(x<0||x>=M)continue;for(let b=-1;b<=1;b+=2){let p=b+D;if(p<0||p>=M)continue;let c=P*p+M*x+y,o=k[c];z++,j+=N*(o-j)/z}}}L[V]=j}},this.reset=function(){for(let N=0;N<this.size3;N++)this.normal_cache[N*3]=0,this.field[N]=0,this.palette[N*3]=this.palette[N*3+1]=this.palette[N*3+2]=0},this.update=function(){this.count=0;let N=this.size-2;for(let L=1;L<N;L++){let k=this.size2*L,M=(L-this.halfsize)/this.halfsize;for(let P=1;P<N;P++){let w=k+this.size*P,B=(P-this.halfsize)/this.halfsize;for(let D=1;D<N;D++){let V=(D-this.halfsize)/this.halfsize,j=w+D;C(V,B,M,j,this.isolation)}}}if(this.geometry.setDrawRange(0,this.count),Y.getAttribute("position").needsUpdate=!0,Y.getAttribute("normal").needsUpdate=!0,this.enableUvs)Y.getAttribute("uv").needsUpdate=!0;if(this.enableColors)Y.getAttribute("color").needsUpdate=!0;if(this.count/3>W)console.warn("THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.")},this.init(J)}}var hF=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]),oQ=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function y6(J){let Q=J>>>0;return()=>{Q=Q+1831565813>>>0;let $=Q;return $=Math.imul($^$>>>15,$|1),$^=$+Math.imul($^$>>>7,$|61),(($^$>>>14)>>>0)/4294967296}}function fF(J,Q,$){let Z=y6(Q),W=[];for(let Y=0;Y<J;Y++)W.push({cx:0.38+Z()*0.24,cy:0.38+Z()*0.24,cz:0.38+Z()*0.24,rx:0.06+Z()*0.16,ry:0.06+Z()*0.16,rz:0.04+Z()*0.1,wx:0.3+Z()*0.7,wy:0.3+Z()*0.7,wz:0.3+Z()*0.7,px:Z()*Math.PI*2,py:Z()*Math.PI*2,pz:Z()*Math.PI*2,strength:$*(0.7+Z()*0.6)});return W}function gF(J,Q){return{x:J.cx+J.rx*Math.sin(Q*J.wx+J.px),y:J.cy+J.ry*Math.sin(Q*J.wy+J.py),z:J.cz+J.rz*Math.cos(Q*J.wz+J.pz)}}function eK(J,Q){let $=Math.max(1,Math.floor(q0(J.getAttribute("count"),5))),Z=Math.floor(q0(J.getAttribute("seed"),1)),W=Math.max(16,Math.floor(q0(J.getAttribute("resolution"),56))),Y=q0(J.getAttribute("speed"),0.7),X=q0(J.getAttribute("strength"),0.7),K=q0(J.getAttribute("scale"),2),H=new MW(W,Q,!0,!0,60000);H.isolation=q0(J.getAttribute("isolation"),60),H.position.set(...RJ(J.getAttribute("position"),[0,0,0])),H.scale.setScalar(K),H.frustumCulled=!1;let U=fF($,Z,X),G=(F)=>{let E=F*Y;H.reset();for(let O of U){let R=gF(O,E);H.addBall(R.x,R.y,R.z,O.strength,12)}H.update()};return G(0),{mesh:H,writer:G}}class VW extends a0{constructor(J,Q={}){super(J);this.isWater=!0;let $=this,Z=Q.textureWidth!==void 0?Q.textureWidth:512,W=Q.textureHeight!==void 0?Q.textureHeight:512,Y=Q.clipBias!==void 0?Q.clipBias:0,X=Q.alpha!==void 0?Q.alpha:1,K=Q.time!==void 0?Q.time:0,H=Q.waterNormals!==void 0?Q.waterNormals:null,U=Q.sunDirection!==void 0?Q.sunDirection:new S(0.70707,0.70707,0),G=new X0(Q.sunColor!==void 0?Q.sunColor:16777215),F=new X0(Q.waterColor!==void 0?Q.waterColor:8355711),E=Q.eye!==void 0?Q.eye:new S(0,0,0),O=Q.distortionScale!==void 0?Q.distortionScale:20,R=Q.side!==void 0?Q.side:A9,C=Q.fog!==void 0?Q.fog:!1,q=new D9,N=new S,L=new S,k=new S,M=new j0,P=new S(0,0,-1),w=new $J,B=new S,D=new S,V=new $J,j=new j0,z=new BJ,v=new TJ(Z,W,{type:kJ}),y={name:"MirrorShader",uniforms:rJ.merge([G0.fog,G0.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new j0},sunColor:{value:new X0(8355711)},sunDirection:{value:new S(0.70707,0.70707,0)},eye:{value:new S},waterColor:{value:new X0(5592405)}}]),vertexShader:`
4337
+ `},vD={uniforms:{tDiffuse:{value:null},amount:{value:0}},vertexShader:`
4338
+ varying vec2 vUv;
4339
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }
4340
+ `,fragmentShader:`
4341
+ uniform sampler2D tDiffuse;
4342
+ uniform float amount;
4343
+ varying vec2 vUv;
4344
+ void main() {
4345
+ vec2 dir = vUv - 0.5;
4346
+ float d = dot(dir, dir);
4347
+ vec2 off = dir * d * amount;
4348
+ float r = texture2D(tDiffuse, vUv - off).r;
4349
+ float g = texture2D(tDiffuse, vUv).g;
4350
+ float b = texture2D(tDiffuse, vUv + off).b;
4351
+ float a = texture2D(tDiffuse, vUv).a;
4352
+ gl_FragColor = vec4(r, g, b, a);
4353
+ }
4354
+ `},yD={uniforms:{tDiffuse:{value:null},amount:{value:0},uTime:{value:0}},vertexShader:`
4355
+ varying vec2 vUv;
4356
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }
4357
+ `,fragmentShader:`
4358
+ uniform sampler2D tDiffuse;
4359
+ uniform float amount;
4360
+ uniform float uTime;
4361
+ varying vec2 vUv;
4362
+ // sin-free hash → identical for a given (uv, t), so seekable
4363
+ float hash(vec2 p){
4364
+ vec3 p3 = fract(vec3(p.xyx) * 0.1031);
4365
+ p3 += dot(p3, p3.yzx + 33.33);
4366
+ return fract((p3.x + p3.y) * p3.z);
4367
+ }
4368
+ void main() {
4369
+ vec3 c = texture2D(tDiffuse, vUv).rgb;
4370
+ float g = hash(vUv * vec2(1920.0, 1080.0) + uTime * 73.0) - 0.5;
4371
+ gl_FragColor = vec4(c + g * amount, 1.0);
4372
+ }
4373
+ `};function $1(J,Q,$,Z){let W=(Z.bloom??0)>0,Y=(Z.vignette??0)>0,X=(Z.contrast??1)!==1||(Z.saturation??1)!==1,K=(Z.chromaticAberration??0)>0,H=(Z.grain??0)>0;if(!W&&!Y&&!X&&!K&&!H)return null;let U=new wH(J);if(U.setSize(Z.width,Z.height),U.addPass(new PH(Q,$)),W)U.addPass(new a6(new i(Z.width,Z.height),Z.bloom??0.6,Z.bloomRadius??0.6,Z.bloomThreshold??0.85));if(K){let F=new o6(vD);F.uniforms.amount.value=Z.chromaticAberration,U.addPass(F)}let G=null;if(H)G=new o6(yD),G.uniforms.amount.value=Z.grain,U.addPass(G);if(Y||X){let F=new o6(jD);F.uniforms.vignette.value=Z.vignette??0,F.uniforms.contrast.value=Z.contrast??1,F.uniforms.saturation.value=Z.saturation??1,U.addPass(F)}return U.addPass(new AH),{render:(F)=>{if(G)G.uniforms.uTime.value=F;U.render(0)},setSize:(F,E)=>U.setSize(F,E)}}var fJ=256,Z1=new Map;function xD(J){let Q=document.createElement("canvas");Q.width=fJ,Q.height=fJ;let $=Q.getContext("2d");$.fillStyle="#000",$.fillRect(0,0,fJ,fJ),$.save(),$.beginPath(),$.arc(fJ/2,fJ/2,fJ/2,0,Math.PI*2),$.clip(),J($,fJ/2),$.restore();let Z=new cQ(Q);return Z.colorSpace=a9,Z}function GY(J,Q,$){let Z=J.createRadialGradient(Q*0.7,Q*0.6,Q*0.05,Q,Q,Q*1.25);for(let[W,Y]of $)Z.addColorStop(W,Y);J.fillStyle=Z,J.fillRect(0,0,fJ,fJ)}var TH={pearl:(J,Q)=>GY(J,Q,[[0,"#ffffff"],[0.45,"#e9ecf5"],[0.8,"#aab0c8"],[1,"#6b7090"]]),chrome:(J,Q)=>{let $=J.createLinearGradient(0,0,0,fJ);$.addColorStop(0,"#dfe6ef"),$.addColorStop(0.45,"#566074"),$.addColorStop(0.5,"#aeb8c8"),$.addColorStop(0.55,"#3a4254"),$.addColorStop(1,"#10141c"),J.fillStyle=$,J.fillRect(0,0,fJ,fJ),GY(J,Q,[[0,"rgba(255,255,255,0.9)"],[0.2,"rgba(255,255,255,0.0)"],[1,"rgba(0,0,0,0)"]])},clay:(J,Q)=>GY(J,Q,[[0,"#f6d9c6"],[0.5,"#d99a7e"],[0.85,"#9c5b48"],[1,"#5e3328"]]),iridescent:(J,Q)=>{J.fillStyle="#08060c",J.fillRect(0,0,fJ,fJ);let $=J.createRadialGradient(Q,Q,Q*0.45,Q,Q,Q);$.addColorStop(0,"rgba(8,6,12,1)"),$.addColorStop(0.55,"#1a1030"),$.addColorStop(0.7,"#2b6ccf"),$.addColorStop(0.8,"#28c6a8"),$.addColorStop(0.88,"#e8d24a"),$.addColorStop(0.95,"#e8568f"),$.addColorStop(1,"#7a3df0"),J.fillStyle=$,J.fillRect(0,0,fJ,fJ)},holo:(J,Q)=>{let $=J.createLinearGradient(0,0,fJ,fJ);$.addColorStop(0,"#ff6ec7"),$.addColorStop(0.35,"#7a5cff"),$.addColorStop(0.6,"#2bd4ff"),$.addColorStop(0.85,"#74ffd1"),$.addColorStop(1,"#fff1a8"),J.fillStyle=$,J.fillRect(0,0,fJ,fJ),GY(J,Q,[[0,"rgba(255,255,255,0.7)"],[0.3,"rgba(255,255,255,0)"],[1,"rgba(0,0,0,0.35)"]])}},Ek=Object.keys(TH);function W1(J){let Q=J&&TH[J]?J:"pearl",$=Z1.get(Q);if(!$)$=xD(TH[Q]),Z1.set(Q,$);return $}class SH extends a0{constructor(J,Q,$=!1,Z=!1,W=1e4){let Y=new u0;super(Y,Q);this.isMarchingCubes=!0;let X=this,K=new Float32Array(36),H=new Float32Array(36),U=new Float32Array(36);this.enableUvs=$,this.enableColors=Z,this.init=function(N){this.resolution=N,this.isolation=80,this.size=N,this.size2=this.size*this.size,this.size3=this.size2*this.size,this.halfsize=this.size/2,this.delta=2/this.size,this.yd=this.size,this.zd=this.size2,this.field=new Float32Array(this.size3),this.normal_cache=new Float32Array(this.size3*3),this.palette=new Float32Array(this.size3*3),this.count=0;let L=W*3;this.positionArray=new Float32Array(L*3);let D=new i0(this.positionArray,3);D.setUsage(j6),Y.setAttribute("position",D),this.normalArray=new Float32Array(L*3);let V=new i0(this.normalArray,3);if(V.setUsage(j6),Y.setAttribute("normal",V),this.enableUvs){this.uvArray=new Float32Array(L*2);let z=new i0(this.uvArray,2);z.setUsage(j6),Y.setAttribute("uv",z)}if(this.enableColors){this.colorArray=new Float32Array(L*3);let z=new i0(this.colorArray,3);z.setUsage(j6),Y.setAttribute("color",z)}Y.boundingSphere=new _J(new A,1)};function G(N,L,D){return N+(L-N)*D}function F(N,L,D,V,z,I,B,k,C,j){let w=(D-B)/(k-B),v=X.normal_cache;K[L+0]=V+w*X.delta,K[L+1]=z,K[L+2]=I,H[L+0]=G(v[N+0],v[N+3],w),H[L+1]=G(v[N+1],v[N+4],w),H[L+2]=G(v[N+2],v[N+5],w),U[L+0]=G(X.palette[C*3+0],X.palette[j*3+0],w),U[L+1]=G(X.palette[C*3+1],X.palette[j*3+1],w),U[L+2]=G(X.palette[C*3+2],X.palette[j*3+2],w)}function E(N,L,D,V,z,I,B,k,C,j){let w=(D-B)/(k-B),v=X.normal_cache;K[L+0]=V,K[L+1]=z+w*X.delta,K[L+2]=I;let b=N+X.yd*3;H[L+0]=G(v[N+0],v[b+0],w),H[L+1]=G(v[N+1],v[b+1],w),H[L+2]=G(v[N+2],v[b+2],w),U[L+0]=G(X.palette[C*3+0],X.palette[j*3+0],w),U[L+1]=G(X.palette[C*3+1],X.palette[j*3+1],w),U[L+2]=G(X.palette[C*3+2],X.palette[j*3+2],w)}function O(N,L,D,V,z,I,B,k,C,j){let w=(D-B)/(k-B),v=X.normal_cache;K[L+0]=V,K[L+1]=z,K[L+2]=I+w*X.delta;let b=N+X.zd*3;H[L+0]=G(v[N+0],v[b+0],w),H[L+1]=G(v[N+1],v[b+1],w),H[L+2]=G(v[N+2],v[b+2],w),U[L+0]=G(X.palette[C*3+0],X.palette[j*3+0],w),U[L+1]=G(X.palette[C*3+1],X.palette[j*3+1],w),U[L+2]=G(X.palette[C*3+2],X.palette[j*3+2],w)}function R(N){let L=N*3;if(X.normal_cache[L]===0)X.normal_cache[L+0]=X.field[N-1]-X.field[N+1],X.normal_cache[L+1]=X.field[N-X.yd]-X.field[N+X.yd],X.normal_cache[L+2]=X.field[N-X.zd]-X.field[N+X.zd]}function M(N,L,D,V,z){let I=V+1,B=V+X.yd,k=V+X.zd,C=I+X.yd,j=I+X.zd,w=V+X.yd+X.zd,v=I+X.yd+X.zd,b=0,S=X.field[V],h=X.field[I],x=X.field[B],p=X.field[C],c=X.field[k],o=X.field[j],W0=X.field[w],H0=X.field[v];if(S<z)b|=1;if(h<z)b|=2;if(x<z)b|=8;if(p<z)b|=4;if(c<z)b|=16;if(o<z)b|=32;if(W0<z)b|=128;if(H0<z)b|=64;let J0=bD[b];if(J0===0)return 0;let c0=X.delta,d0=N+c0,s=L+c0,F0=D+c0;if(J0&1)R(V),R(I),F(V*3,0,z,N,L,D,S,h,V,I);if(J0&2)R(I),R(C),E(I*3,3,z,d0,L,D,h,p,I,C);if(J0&4)R(B),R(C),F(B*3,6,z,N,s,D,x,p,B,C);if(J0&8)R(V),R(B),E(V*3,9,z,N,L,D,S,x,V,B);if(J0&16)R(k),R(j),F(k*3,12,z,N,L,F0,c,o,k,j);if(J0&32)R(j),R(v),E(j*3,15,z,d0,L,F0,o,H0,j,v);if(J0&64)R(w),R(v),F(w*3,18,z,N,s,F0,W0,H0,w,v);if(J0&128)R(k),R(w),E(k*3,21,z,N,L,F0,c,W0,k,w);if(J0&256)R(V),R(k),O(V*3,24,z,N,L,D,S,c,V,k);if(J0&512)R(I),R(j),O(I*3,27,z,d0,L,D,h,o,I,j);if(J0&1024)R(C),R(v),O(C*3,30,z,d0,s,D,p,H0,C,v);if(J0&2048)R(B),R(w),O(B*3,33,z,N,s,D,x,W0,B,w);b<<=4;let I0,E0,j0,WJ=0,x0=0;while(EY[b+x0]!=-1)I0=b+x0,E0=I0+1,j0=I0+2,q(K,H,U,3*EY[I0],3*EY[E0],3*EY[j0]),x0+=3,WJ++;return WJ}function q(N,L,D,V,z,I){let B=X.count*3;if(X.positionArray[B+0]=N[V],X.positionArray[B+1]=N[V+1],X.positionArray[B+2]=N[V+2],X.positionArray[B+3]=N[z],X.positionArray[B+4]=N[z+1],X.positionArray[B+5]=N[z+2],X.positionArray[B+6]=N[I],X.positionArray[B+7]=N[I+1],X.positionArray[B+8]=N[I+2],X.material.flatShading===!0){let k=(L[V+0]+L[z+0]+L[I+0])/3,C=(L[V+1]+L[z+1]+L[I+1])/3,j=(L[V+2]+L[z+2]+L[I+2])/3;X.normalArray[B+0]=k,X.normalArray[B+1]=C,X.normalArray[B+2]=j,X.normalArray[B+3]=k,X.normalArray[B+4]=C,X.normalArray[B+5]=j,X.normalArray[B+6]=k,X.normalArray[B+7]=C,X.normalArray[B+8]=j}else X.normalArray[B+0]=L[V+0],X.normalArray[B+1]=L[V+1],X.normalArray[B+2]=L[V+2],X.normalArray[B+3]=L[z+0],X.normalArray[B+4]=L[z+1],X.normalArray[B+5]=L[z+2],X.normalArray[B+6]=L[I+0],X.normalArray[B+7]=L[I+1],X.normalArray[B+8]=L[I+2];if(X.enableUvs){let k=X.count*2;X.uvArray[k+0]=N[V+0],X.uvArray[k+1]=N[V+2],X.uvArray[k+2]=N[z+0],X.uvArray[k+3]=N[z+2],X.uvArray[k+4]=N[I+0],X.uvArray[k+5]=N[I+2]}if(X.enableColors)X.colorArray[B+0]=D[V+0],X.colorArray[B+1]=D[V+1],X.colorArray[B+2]=D[V+2],X.colorArray[B+3]=D[z+0],X.colorArray[B+4]=D[z+1],X.colorArray[B+5]=D[z+2],X.colorArray[B+6]=D[I+0],X.colorArray[B+7]=D[I+1],X.colorArray[B+8]=D[I+2];X.count+=3}this.addBall=function(N,L,D,V,z,I){let B=Math.sign(V);V=Math.abs(V);let k=!(I===void 0||I===null),C=new e(N,L,D);if(k)try{C=I instanceof e?I:Array.isArray(I)?new e(Math.min(Math.abs(I[0]),1),Math.min(Math.abs(I[1]),1),Math.min(Math.abs(I[2]),1)):new e(I)}catch(x0){C=new e(N,L,D)}let j=this.size*Math.sqrt(V/z),w=D*this.size,v=L*this.size,b=N*this.size,S=Math.floor(w-j);if(S<1)S=1;let h=Math.floor(w+j);if(h>this.size-1)h=this.size-1;let x=Math.floor(v-j);if(x<1)x=1;let p=Math.floor(v+j);if(p>this.size-1)p=this.size-1;let c=Math.floor(b-j);if(c<1)c=1;let o=Math.floor(b+j);if(o>this.size-1)o=this.size-1;let W0,H0,J0,c0,d0,s,F0,I0,E0,j0,WJ;for(J0=S;J0<h;J0++){d0=this.size2*J0,I0=J0/this.size-D,E0=I0*I0;for(H0=x;H0<p;H0++){c0=d0+this.size*H0,F0=H0/this.size-L,j0=F0*F0;for(W0=c;W0<o;W0++)if(s=W0/this.size-N,WJ=V/(0.000001+s*s+j0+E0)-z,WJ>0){this.field[c0+W0]+=WJ*B;let x0=Math.sqrt((W0-b)*(W0-b)+(H0-v)*(H0-v)+(J0-w)*(J0-w))/j,n0=1-x0*x0*x0*(x0*(x0*6-15)+10);this.palette[(c0+W0)*3+0]+=C.r*n0,this.palette[(c0+W0)*3+1]+=C.g*n0,this.palette[(c0+W0)*3+2]+=C.b*n0}}}},this.addPlaneX=function(N,L){let D=this.size,V=this.yd,z=this.zd,I=this.field,B,k,C,j,w,v,b,S=D*Math.sqrt(N/L);if(S>D)S=D;for(B=0;B<S;B++)if(v=B/D,j=v*v,w=N/(0.0001+j)-L,w>0)for(k=0;k<D;k++){b=B+k*V;for(C=0;C<D;C++)I[z*C+b]+=w}},this.addPlaneY=function(N,L){let D=this.size,V=this.yd,z=this.zd,I=this.field,B,k,C,j,w,v,b,S,h=D*Math.sqrt(N/L);if(h>D)h=D;for(k=0;k<h;k++)if(v=k/D,j=v*v,w=N/(0.0001+j)-L,w>0){b=k*V;for(B=0;B<D;B++){S=b+B;for(C=0;C<D;C++)I[z*C+S]+=w}}},this.addPlaneZ=function(N,L){let D=this.size,V=this.yd,z=this.zd,I=this.field,B,k,C,j,w,v,b,S,h=D*Math.sqrt(N/L);if(h>D)h=D;for(C=0;C<h;C++)if(v=C/D,j=v*v,w=N/(0.0001+j)-L,w>0){b=z*C;for(k=0;k<D;k++){S=b+k*V;for(B=0;B<D;B++)I[S+B]+=w}}},this.setCell=function(N,L,D,V){let z=this.size2*D+this.size*L+N;this.field[z]=V},this.getCell=function(N,L,D){let V=this.size2*D+this.size*L+N;return this.field[V]},this.blur=function(N=1){let L=this.field,D=L.slice(),V=this.size,z=this.size2;for(let I=0;I<V;I++)for(let B=0;B<V;B++)for(let k=0;k<V;k++){let C=z*k+V*B+I,j=D[C],w=1;for(let v=-1;v<=1;v+=2){let b=v+I;if(b<0||b>=V)continue;for(let S=-1;S<=1;S+=2){let h=S+B;if(h<0||h>=V)continue;for(let x=-1;x<=1;x+=2){let p=x+k;if(p<0||p>=V)continue;let c=z*p+V*h+b,o=D[c];w++,j+=N*(o-j)/w}}}L[C]=j}},this.reset=function(){for(let N=0;N<this.size3;N++)this.normal_cache[N*3]=0,this.field[N]=0,this.palette[N*3]=this.palette[N*3+1]=this.palette[N*3+2]=0},this.update=function(){this.count=0;let N=this.size-2;for(let L=1;L<N;L++){let D=this.size2*L,V=(L-this.halfsize)/this.halfsize;for(let z=1;z<N;z++){let I=D+this.size*z,B=(z-this.halfsize)/this.halfsize;for(let k=1;k<N;k++){let C=(k-this.halfsize)/this.halfsize,j=I+k;M(C,B,V,j,this.isolation)}}}if(this.geometry.setDrawRange(0,this.count),Y.getAttribute("position").needsUpdate=!0,Y.getAttribute("normal").needsUpdate=!0,this.enableUvs)Y.getAttribute("uv").needsUpdate=!0;if(this.enableColors)Y.getAttribute("color").needsUpdate=!0;if(this.count/3>W)console.warn("THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.")},this.init(J)}}var bD=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]),EY=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function ZQ(J){let Q=J>>>0;return()=>{Q=Q+1831565813>>>0;let $=Q;return $=Math.imul($^$>>>15,$|1),$^=$+Math.imul($^$>>>7,$|61),(($^$>>>14)>>>0)/4294967296}}function hD(J,Q,$){let Z=ZQ(Q),W=[];for(let Y=0;Y<J;Y++)W.push({cx:0.38+Z()*0.24,cy:0.38+Z()*0.24,cz:0.38+Z()*0.24,rx:0.06+Z()*0.16,ry:0.06+Z()*0.16,rz:0.04+Z()*0.1,wx:0.3+Z()*0.7,wy:0.3+Z()*0.7,wz:0.3+Z()*0.7,px:Z()*Math.PI*2,py:Z()*Math.PI*2,pz:Z()*Math.PI*2,strength:$*(0.7+Z()*0.6)});return W}function fD(J,Q){return{x:J.cx+J.rx*Math.sin(Q*J.wx+J.px),y:J.cy+J.ry*Math.sin(Q*J.wy+J.py),z:J.cz+J.rz*Math.cos(Q*J.wz+J.pz)}}function Y1(J,Q){let $=Math.max(1,Math.floor(L0(J.getAttribute("count"),5))),Z=Math.floor(L0(J.getAttribute("seed"),1)),W=Math.max(16,Math.floor(L0(J.getAttribute("resolution"),56))),Y=L0(J.getAttribute("speed"),0.7),X=L0(J.getAttribute("strength"),0.7),K=L0(J.getAttribute("scale"),2),H=new SH(W,Q,!0,!0,60000);H.isolation=L0(J.getAttribute("isolation"),60),H.position.set(...CJ(J.getAttribute("position"),[0,0,0])),H.scale.setScalar(K),H.frustumCulled=!1;let U=hD($,Z,X),G=(F)=>{let E=F*Y;H.reset();for(let O of U){let R=fD(O,E);H.addBall(R.x,R.y,R.z,O.strength,12)}H.update()};return G(0),{mesh:H,writer:G}}class jH extends a0{constructor(J,Q={}){super(J);this.isWater=!0;let $=this,Z=Q.textureWidth!==void 0?Q.textureWidth:512,W=Q.textureHeight!==void 0?Q.textureHeight:512,Y=Q.clipBias!==void 0?Q.clipBias:0,X=Q.alpha!==void 0?Q.alpha:1,K=Q.time!==void 0?Q.time:0,H=Q.waterNormals!==void 0?Q.waterNormals:null,U=Q.sunDirection!==void 0?Q.sunDirection:new A(0.70707,0.70707,0),G=new e(Q.sunColor!==void 0?Q.sunColor:16777215),F=new e(Q.waterColor!==void 0?Q.waterColor:8355711),E=Q.eye!==void 0?Q.eye:new A(0,0,0),O=Q.distortionScale!==void 0?Q.distortionScale:20,R=Q.side!==void 0?Q.side:s9,M=Q.fog!==void 0?Q.fog:!1,q=new w9,N=new A,L=new A,D=new A,V=new y0,z=new A(0,0,-1),I=new FJ,B=new A,k=new A,C=new FJ,j=new y0,w=new BJ,v=new PJ(Z,W,{type:wJ}),b={name:"MirrorShader",uniforms:K9.merge([D0.fog,D0.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new y0},sunColor:{value:new e(8355711)},sunDirection:{value:new A(0.70707,0.70707,0)},eye:{value:new A},waterColor:{value:new e(5592405)}}]),vertexShader:`
4331
4374
  uniform mat4 textureMatrix;
4332
4375
  uniform float time;
4333
4376
 
@@ -4423,7 +4466,7 @@ void main() {
4423
4466
  #include <tonemapping_fragment>
4424
4467
  #include <colorspace_fragment>
4425
4468
  #include <fog_fragment>
4426
- }`},A=new OJ({name:y.name,uniforms:rJ.clone(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,lights:!0,side:R,fog:C});A.uniforms.mirrorSampler.value=v.texture,A.uniforms.textureMatrix.value=j,A.uniforms.alpha.value=X,A.uniforms.time.value=K,A.uniforms.normalSampler.value=H,A.uniforms.sunColor.value=G,A.uniforms.waterColor.value=F,A.uniforms.sunDirection.value=U,A.uniforms.distortionScale.value=O,A.uniforms.eye.value=E,$.material=A,$.onBeforeRender=function(x,b,p){if(L.setFromMatrixPosition($.matrixWorld),k.setFromMatrixPosition(p.matrixWorld),M.extractRotation($.matrixWorld),N.set(0,0,1),N.applyMatrix4(M),B.subVectors(L,k),B.dot(N)>0)return;B.reflect(N).negate(),B.add(L),M.extractRotation(p.matrixWorld),P.set(0,0,-1),P.applyMatrix4(M),P.add(k),D.subVectors(L,P),D.reflect(N).negate(),D.add(L),z.position.copy(B),z.up.set(0,1,0),z.up.applyMatrix4(M),z.up.reflect(N),z.lookAt(D),z.far=p.far,z.updateMatrixWorld(),z.projectionMatrix.copy(p.projectionMatrix),j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1),j.multiply(z.projectionMatrix),j.multiply(z.matrixWorldInverse),q.setFromNormalAndCoplanarPoint(N,L),q.applyMatrix4(z.matrixWorldInverse),w.set(q.normal.x,q.normal.y,q.normal.z,q.constant);let c=z.projectionMatrix;V.x=(Math.sign(w.x)+c.elements[8])/c.elements[0],V.y=(Math.sign(w.y)+c.elements[9])/c.elements[5],V.z=-1,V.w=(1+c.elements[10])/c.elements[14],w.multiplyScalar(2/w.dot(V)),c.elements[2]=w.x,c.elements[6]=w.y,c.elements[10]=w.z+1-Y,c.elements[14]=w.w,E.setFromMatrixPosition(p.matrixWorld);let o=x.getRenderTarget(),Q0=x.xr.enabled,Y0=x.shadowMap.autoUpdate;if($.visible=!1,x.xr.enabled=!1,x.shadowMap.autoUpdate=!1,x.setRenderTarget(v),x.state.buffers.depth.setMask(!0),x.autoClear===!1)x.clear();x.render(b,z),$.visible=!0,x.xr.enabled=Q0,x.shadowMap.autoUpdate=Y0,x.setRenderTarget(o);let J0=p.viewport;if(J0!==void 0)x.state.viewport(J0)}}}function JH(J){let Q=q0(J.getAttribute("size"),2000),$=q0(J.getAttribute("speed"),1),Z=J.getAttribute("normals")??"assets/waternormals.jpg",W=new z6,Y,X=new Promise((G)=>{Y=G}),K=new VW(new C9(Q,Q),{textureWidth:512,textureHeight:512,waterNormals:W.load(Z,(G)=>{G.wrapS=G.wrapT=U8,Y(G)}),sunDirection:new S(...RJ(J.getAttribute("sun-direction"),[0.7,0.6,0.3])),sunColor:new X0(G9(J.getAttribute("sun-color"),"#ffffff")),waterColor:new X0(G9(J.getAttribute("color"),"#001e0f")),distortionScale:q0(J.getAttribute("distortion-scale"),3.7),alpha:q0(J.getAttribute("alpha"),1),clipBias:0});K.rotation.x=-Math.PI/2,K.position.set(...RJ(J.getAttribute("position"),[0,0,0]));let H=K.material.uniforms;return{water:K,timeProxy:{get value(){return H.time.value/($||1)},set value(G){H.time.value=G*$}},pending:X,setSunDirection:(G)=>{H.sunDirection.value.copy(G).normalize()}}}class I7 extends a0{constructor(){let J=I7.SkyShader,Q=new OJ({name:J.name,uniforms:rJ.clone(J.uniforms),vertexShader:J.vertexShader,fragmentShader:J.fragmentShader,side:yJ,depthWrite:!1});super(new aJ(1,1,1),Q);this.isSky=!0}}I7.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:0.005},mieDirectionalG:{value:0.8},sunPosition:{value:new S},up:{value:new S(0,1,0)},cloudScale:{value:0.0002},cloudSpeed:{value:0.0001},cloudCoverage:{value:0.4},cloudDensity:{value:0.4},cloudElevation:{value:0.5},showSunDisc:{value:1},time:{value:0}},vertexShader:`
4469
+ }`},S=new LJ({name:b.name,uniforms:K9.clone(b.uniforms),vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,lights:!0,side:R,fog:M});S.uniforms.mirrorSampler.value=v.texture,S.uniforms.textureMatrix.value=j,S.uniforms.alpha.value=X,S.uniforms.time.value=K,S.uniforms.normalSampler.value=H,S.uniforms.sunColor.value=G,S.uniforms.waterColor.value=F,S.uniforms.sunDirection.value=U,S.uniforms.distortionScale.value=O,S.uniforms.eye.value=E,$.material=S,$.onBeforeRender=function(h,x,p){if(L.setFromMatrixPosition($.matrixWorld),D.setFromMatrixPosition(p.matrixWorld),V.extractRotation($.matrixWorld),N.set(0,0,1),N.applyMatrix4(V),B.subVectors(L,D),B.dot(N)>0)return;B.reflect(N).negate(),B.add(L),V.extractRotation(p.matrixWorld),z.set(0,0,-1),z.applyMatrix4(V),z.add(D),k.subVectors(L,z),k.reflect(N).negate(),k.add(L),w.position.copy(B),w.up.set(0,1,0),w.up.applyMatrix4(V),w.up.reflect(N),w.lookAt(k),w.far=p.far,w.updateMatrixWorld(),w.projectionMatrix.copy(p.projectionMatrix),j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1),j.multiply(w.projectionMatrix),j.multiply(w.matrixWorldInverse),q.setFromNormalAndCoplanarPoint(N,L),q.applyMatrix4(w.matrixWorldInverse),I.set(q.normal.x,q.normal.y,q.normal.z,q.constant);let c=w.projectionMatrix;C.x=(Math.sign(I.x)+c.elements[8])/c.elements[0],C.y=(Math.sign(I.y)+c.elements[9])/c.elements[5],C.z=-1,C.w=(1+c.elements[10])/c.elements[14],I.multiplyScalar(2/I.dot(C)),c.elements[2]=I.x,c.elements[6]=I.y,c.elements[10]=I.z+1-Y,c.elements[14]=I.w,E.setFromMatrixPosition(p.matrixWorld);let o=h.getRenderTarget(),W0=h.xr.enabled,H0=h.shadowMap.autoUpdate;if($.visible=!1,h.xr.enabled=!1,h.shadowMap.autoUpdate=!1,h.setRenderTarget(v),h.state.buffers.depth.setMask(!0),h.autoClear===!1)h.clear();h.render(x,w),$.visible=!0,h.xr.enabled=W0,h.shadowMap.autoUpdate=H0,h.setRenderTarget(o);let J0=p.viewport;if(J0!==void 0)h.state.viewport(J0)}}}function X1(J){let Q=L0(J.getAttribute("size"),2000),$=L0(J.getAttribute("speed"),1),Z=J.getAttribute("normals")??"assets/waternormals.jpg",W=new d6,Y,X=new Promise((G)=>{Y=G}),K=new jH(new z9(Q,Q),{textureWidth:512,textureHeight:512,waterNormals:W.load(Z,(G)=>{G.wrapS=G.wrapT=_8,Y(G)}),sunDirection:new A(...CJ(J.getAttribute("sun-direction"),[0.7,0.6,0.3])),sunColor:new e(x9(J.getAttribute("sun-color"),"#ffffff")),waterColor:new e(x9(J.getAttribute("color"),"#001e0f")),distortionScale:L0(J.getAttribute("distortion-scale"),3.7),alpha:L0(J.getAttribute("alpha"),1),clipBias:0});K.rotation.x=-Math.PI/2,K.position.set(...CJ(J.getAttribute("position"),[0,0,0]));let H=K.material.uniforms;return{water:K,timeProxy:{get value(){return H.time.value/($||1)},set value(G){H.time.value=G*$}},pending:X,setSunDirection:(G)=>{H.sunDirection.value.copy(G).normalize()}}}class w$ extends a0{constructor(){let J=w$.SkyShader,Q=new LJ({name:J.name,uniforms:K9.clone(J.uniforms),vertexShader:J.vertexShader,fragmentShader:J.fragmentShader,side:uJ,depthWrite:!1});super(new Q9(1,1,1),Q);this.isSky=!0}}w$.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:0.005},mieDirectionalG:{value:0.8},sunPosition:{value:new A},up:{value:new A(0,1,0)},cloudScale:{value:0.0002},cloudSpeed:{value:0.0001},cloudCoverage:{value:0.4},cloudDensity:{value:0.4},cloudElevation:{value:0.5},showSunDisc:{value:1},time:{value:0}},vertexShader:`
4427
4470
  uniform vec3 sunPosition;
4428
4471
  uniform float rayleigh;
4429
4472
  uniform float turbidity;
@@ -4643,7 +4686,7 @@ void main() {
4643
4686
  #include <tonemapping_fragment>
4644
4687
  #include <colorspace_fragment>
4645
4688
 
4646
- }`};function QH(J){let Q=new I7;Q.scale.setScalar(q0(J.getAttribute("scale"),2000));let $=Q.material.uniforms;$.turbidity.value=q0(J.getAttribute("turbidity"),10),$.rayleigh.value=q0(J.getAttribute("rayleigh"),2),$.mieCoefficient.value=q0(J.getAttribute("mie-coefficient"),0.005),$.mieDirectionalG.value=q0(J.getAttribute("mie-directional-g"),0.8);let Z=q0(J.getAttribute("elevation"),15),W=q0(J.getAttribute("azimuth"),180),Y=D6.degToRad(90-Z),X=D6.degToRad(W),K=new S().setFromSphericalCoords(1,Y,X);return $.sunPosition.value.copy(K),{sky:Q,sunDirection:K}}function pF(J,Q,$,Z){let W=J.split("|").map((q)=>q.trim()),Y=document.createElement("canvas"),X=Y.getContext("2d",{willReadFrequently:!0});X.font=Q;let K=W.map((q)=>X.measureText(q)),H=(K[0].fontBoundingBoxAscent??90)+(K[0].fontBoundingBoxDescent??30),U=Math.max(...K.map((q)=>q.width)),G=H*0.25;Y.width=Math.min(2048,Math.ceil(U+G*2)),Y.height=Math.ceil(H*W.length+G*2),X.font=Q,X.fillStyle="#fff",X.textAlign="center",X.textBaseline="middle";for(let q=0;q<W.length;q++)X.fillText(W[q],Y.width/2,G+H*(q+0.5),Y.width-G);let F=X.getImageData(0,0,Y.width,Y.height).data,E=0.18,O=Math.max(1,Math.floor(Math.sqrt(Y.width*Y.height*E/($*2)))),R=[];for(let q=0;q<Y.height;q+=O)for(let N=0;N<Y.width;N+=O)if(F[(q*Y.width+N)*4+3]>128)R.push({x:N/Y.width,y:q/Y.height});let C=[];if(R.length===0)return{points:C,aspect:1};for(let q=0;q<$;q++){let N=R[Math.floor(Z()*R.length)],L=O/Y.width;C.push({x:N.x+(Z()-0.5)*L,y:N.y+(Z()-0.5)*L})}return{points:C,aspect:Y.height/Y.width}}var $H=new S,ZH=new AJ,WH=new S,YH=new j0;function XH(J){let Q=Math.max(1,Math.floor(q0(J.getAttribute("count"),1500))),$=Math.floor(q0(J.getAttribute("seed"),1)),Z=q0(J.getAttribute("size"),0.12),W=q0(J.getAttribute("width"),12),Y=I9(J.getAttribute("start"),0.5),X=I9(J.getAttribute("duration"),3.5),K=Math.min(0.95,Math.max(0,q0(J.getAttribute("stagger"),0.5))),H=cQ(J.getAttribute("ease"),"power3.inOut"),U=(J.getAttribute("mode")??"gather").toLowerCase()==="disperse",G=RJ(J.getAttribute("position"),[0,0,0]),F=RJ(J.getAttribute("scatter"),[W*1.6,W*0.8,W]),E=(J.getAttribute("palette")??"#fafafa,#e4e4e7,#ef4444,#18181b").split(",").map((j)=>new X0(j.trim())),O=y6($),{points:R,aspect:C}=pF(J.getAttribute("text")??"STEREOFRAME",J.getAttribute("font")??"900 140px sans-serif",Q,O),q=new C9(1,0.72),N=new cJ({roughness:0.92,metalness:0,side:sJ}),L=new F8(q,N,Q);L.position.set(G[0],G[1],G[2]),L.frustumCulled=!1;let k=new Float32Array(Q*3),M=new Float32Array(Q*3),P=[],w=[],B=new Float32Array(Q*2),D=new Float32Array(Q);for(let j=0;j<Q;j++){let z=R[j%Math.max(1,R.length)]??{x:0.5,y:0.5};k[j*3]=(O()-0.5)*F[0],k[j*3+1]=(O()-0.5)*F[1],k[j*3+2]=(O()-0.5)*F[2],M[j*3]=(z.x-0.5)*W,M[j*3+1]=(0.5-z.y)*W*C,M[j*3+2]=(O()-0.5)*0.05,P.push(new AJ().setFromAxisAngle(new S(O()-0.5,O()-0.5,O()-0.5).normalize(),O()*Math.PI*2)),w.push(new AJ().setFromAxisAngle(new S(0,0,1),(O()-0.5)*0.35)),B[j*2]=Z*(0.7+O()*0.7),B[j*2+1]=Z*(0.7+O()*0.7),D[j]=O()*K,L.setColorAt(j,E[Math.floor(O()*E.length)])}if(L.instanceColor)L.instanceColor.needsUpdate=!0;let V=(j)=>{let z=X>0?(j-Y)/X:j<Y?0:1;if(z=Math.min(1,Math.max(0,z)),U)z=1-z;for(let v=0;v<Q;v++){let y=H(KK(z,D[v],K));$H.set(k[v*3]+(M[v*3]-k[v*3])*y,k[v*3+1]+(M[v*3+1]-k[v*3+1])*y,k[v*3+2]+(M[v*3+2]-k[v*3+2])*y),ZH.slerpQuaternions(P[v],w[v],y),WH.set(B[v*2],B[v*2+1],1),YH.compose($H,ZH,WH),L.setMatrixAt(v,YH)}L.instanceMatrix.needsUpdate=!0};return V(0),{mesh:L,writer:V}}var uF=`
4689
+ }`};function K1(J){let Q=new w$;Q.scale.setScalar(L0(J.getAttribute("scale"),2000));let $=Q.material.uniforms;$.turbidity.value=L0(J.getAttribute("turbidity"),10),$.rayleigh.value=L0(J.getAttribute("rayleigh"),2),$.mieCoefficient.value=L0(J.getAttribute("mie-coefficient"),0.005),$.mieDirectionalG.value=L0(J.getAttribute("mie-directional-g"),0.8);let Z=L0(J.getAttribute("elevation"),15),W=L0(J.getAttribute("azimuth"),180),Y=v6.degToRad(90-Z),X=v6.degToRad(W),K=new A().setFromSphericalCoords(1,Y,X);return $.sunPosition.value.copy(K),{sky:Q,sunDirection:K}}function gD(J,Q,$,Z){let W=J.split("|").map((q)=>q.trim()),Y=document.createElement("canvas"),X=Y.getContext("2d",{willReadFrequently:!0});X.font=Q;let K=W.map((q)=>X.measureText(q)),H=(K[0].fontBoundingBoxAscent??90)+(K[0].fontBoundingBoxDescent??30),U=Math.max(...K.map((q)=>q.width)),G=H*0.25;Y.width=Math.min(2048,Math.ceil(U+G*2)),Y.height=Math.ceil(H*W.length+G*2),X.font=Q,X.fillStyle="#fff",X.textAlign="center",X.textBaseline="middle";for(let q=0;q<W.length;q++)X.fillText(W[q],Y.width/2,G+H*(q+0.5),Y.width-G);let F=X.getImageData(0,0,Y.width,Y.height).data,E=0.18,O=Math.max(1,Math.floor(Math.sqrt(Y.width*Y.height*E/($*2)))),R=[];for(let q=0;q<Y.height;q+=O)for(let N=0;N<Y.width;N+=O)if(F[(q*Y.width+N)*4+3]>128)R.push({x:N/Y.width,y:q/Y.height});let M=[];if(R.length===0)return{points:M,aspect:1};for(let q=0;q<$;q++){let N=R[Math.floor(Z()*R.length)],L=O/Y.width;M.push({x:N.x+(Z()-0.5)*L,y:N.y+(Z()-0.5)*L})}return{points:M,aspect:Y.height/Y.width}}var H1=new A,U1=new zJ,G1=new A,E1=new y0;function F1(J){let Q=Math.max(1,Math.floor(L0(J.getAttribute("count"),1500))),$=Math.floor(L0(J.getAttribute("seed"),1)),Z=L0(J.getAttribute("size"),0.12),W=L0(J.getAttribute("width"),12),Y=J8(J.getAttribute("start"),0.5),X=J8(J.getAttribute("duration"),3.5),K=Math.min(0.95,Math.max(0,L0(J.getAttribute("stagger"),0.5))),H=XY(J.getAttribute("ease"),"power3.inOut"),U=(J.getAttribute("mode")??"gather").toLowerCase()==="disperse",G=CJ(J.getAttribute("position"),[0,0,0]),F=CJ(J.getAttribute("scatter"),[W*1.6,W*0.8,W]),E=(J.getAttribute("palette")??"#fafafa,#e4e4e7,#ef4444,#18181b").split(",").map((j)=>new e(j.trim())),O=ZQ($),{points:R,aspect:M}=gD(J.getAttribute("text")??"STEREOFRAME",J.getAttribute("font")??"900 140px sans-serif",Q,O),q=new z9(1,0.72),N=new iJ({roughness:0.92,metalness:0,side:X9}),L=new U8(q,N,Q);L.position.set(G[0],G[1],G[2]),L.frustumCulled=!1;let D=new Float32Array(Q*3),V=new Float32Array(Q*3),z=[],I=[],B=new Float32Array(Q*2),k=new Float32Array(Q);for(let j=0;j<Q;j++){let w=R[j%Math.max(1,R.length)]??{x:0.5,y:0.5};D[j*3]=(O()-0.5)*F[0],D[j*3+1]=(O()-0.5)*F[1],D[j*3+2]=(O()-0.5)*F[2],V[j*3]=(w.x-0.5)*W,V[j*3+1]=(0.5-w.y)*W*M,V[j*3+2]=(O()-0.5)*0.05,z.push(new zJ().setFromAxisAngle(new A(O()-0.5,O()-0.5,O()-0.5).normalize(),O()*Math.PI*2)),I.push(new zJ().setFromAxisAngle(new A(0,0,1),(O()-0.5)*0.35)),B[j*2]=Z*(0.7+O()*0.7),B[j*2+1]=Z*(0.7+O()*0.7),k[j]=O()*K,L.setColorAt(j,E[Math.floor(O()*E.length)])}if(L.instanceColor)L.instanceColor.needsUpdate=!0;let C=(j)=>{let w=X>0?(j-Y)/X:j<Y?0:1;if(w=Math.min(1,Math.max(0,w)),U)w=1-w;for(let v=0;v<Q;v++){let b=H(EE(w,k[v],K));H1.set(D[v*3]+(V[v*3]-D[v*3])*b,D[v*3+1]+(V[v*3+1]-D[v*3+1])*b,D[v*3+2]+(V[v*3+2]-D[v*3+2])*b),U1.slerpQuaternions(z[v],I[v],b),G1.set(B[v*2],B[v*2+1],1),E1.compose(H1,U1,G1),L.setMatrixAt(v,E1)}L.instanceMatrix.needsUpdate=!0};return C(0),{mesh:L,writer:C}}var pD=`
4647
4690
  uniform vec3 uColor;
4648
4691
  uniform float uOpacity;
4649
4692
  varying float vFade;
@@ -4653,7 +4696,7 @@ void main() {
4653
4696
  if (alpha < 0.003) discard;
4654
4697
  gl_FragColor = vec4(uColor, alpha);
4655
4698
  }
4656
- `,dF=`
4699
+ `,uD=`
4657
4700
  attribute vec3 aVel;
4658
4701
  attribute float aBirth;
4659
4702
  attribute float aLife;
@@ -4670,7 +4713,7 @@ void main() {
4670
4713
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4671
4714
  gl_Position = projectionMatrix * mv;
4672
4715
  }
4673
- `,mF=`
4716
+ `,dD=`
4674
4717
  attribute vec3 aWobble; // x: phase, y: fall speed, z: sway amplitude
4675
4718
  uniform float uTime;
4676
4719
  uniform float uSize;
@@ -4686,7 +4729,7 @@ void main() {
4686
4729
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4687
4730
  gl_Position = projectionMatrix * mv;
4688
4731
  }
4689
- `,lF=`
4732
+ `,mD=`
4690
4733
  attribute vec3 aFreq;
4691
4734
  attribute vec3 aPhase;
4692
4735
  uniform float uTime;
@@ -4704,8 +4747,8 @@ void main() {
4704
4747
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4705
4748
  gl_Position = projectionMatrix * mv;
4706
4749
  }
4707
- `;function KH(J){let Q=(J.getAttribute("preset")??"fountain").toLowerCase(),$=Math.max(1,Math.floor(q0(J.getAttribute("count"),500))),Z=Math.floor(q0(J.getAttribute("seed"),1)),W=q0(J.getAttribute("size"),0.08),Y=q0(J.getAttribute("opacity"),0.9),X=new X0(G9(J.getAttribute("color"),"#ffffff")),K=RJ(J.getAttribute("area"),[6,4,6]),H=y6(Z),U=new qJ,G=new Float32Array($*3),F={value:0},E={uTime:F,uSize:{value:W},uColor:{value:X},uOpacity:{value:Y}},O,R=P8;if(Q==="snow"){let N=new Float32Array($*3);for(let L=0;L<$;L++)G[L*3]=(H()-0.5)*K[0],G[L*3+1]=H()*K[1],G[L*3+2]=(H()-0.5)*K[2],N[L*3]=H()*Math.PI*2,N[L*3+1]=0.4+H()*0.8,N[L*3+2]=0.05+H()*0.25;U.setAttribute("aWobble",new QJ(N,3)),E.uArea={value:{x:K[0],y:K[1],z:K[2]}},O=mF,R=w8}else if(Q==="dust"){let N=new Float32Array($*3),L=new Float32Array($*3);for(let k=0;k<$;k++){G[k*3]=(H()-0.5)*K[0],G[k*3+1]=(H()-0.5)*K[1],G[k*3+2]=(H()-0.5)*K[2];for(let M=0;M<3;M++)N[k*3+M]=0.1+H()*0.5,L[k*3+M]=H()*Math.PI*2}U.setAttribute("aFreq",new QJ(N,3)),U.setAttribute("aPhase",new QJ(L,3)),E.uAmp={value:q0(J.getAttribute("amplitude"),0.4)},O=lF}else{let N=q0(J.getAttribute("speed"),3),L=q0(J.getAttribute("spread"),25),k=q0(J.getAttribute("life"),2.5),M=new Float32Array($*3),P=new Float32Array($),w=new Float32Array($),B=L*Math.PI/180;for(let D=0;D<$;D++){G[D*3]=(H()-0.5)*0.05,G[D*3+1]=0,G[D*3+2]=(H()-0.5)*0.05;let V=H()*Math.PI*2,j=H()*B,z=N*(0.7+H()*0.6);M[D*3]=Math.sin(j)*Math.sin(V)*z,M[D*3+1]=Math.cos(j)*z,M[D*3+2]=Math.sin(j)*Math.cos(V)*z,w[D]=k*(0.6+H()*0.8),P[D]=H()*w[D]}U.setAttribute("aVel",new QJ(M,3)),U.setAttribute("aBirth",new QJ(P,1)),U.setAttribute("aLife",new QJ(w,1)),E.uGravity={value:q0(J.getAttribute("gravity"),4)},O=dF}U.setAttribute("position",new QJ(G,3));let C=new OJ({uniforms:E,vertexShader:O,fragmentShader:uF,transparent:!0,depthWrite:!1,blending:R}),q=new o9(U,C);return q.frustumCulled=!1,q.position.set(...RJ(J.getAttribute("position"),[0,0,0])),{points:q,timeUniform:F}}function cF(J){let Q=J.closest("[data-composition-id]"),$=q0(J.getAttribute("width")??Q?.dataset.width??null,1920),Z=q0(J.getAttribute("height")??Q?.dataset.height??null,1080);return{width:$,height:Z}}function HH(J,Q){J.position.set(...RJ(Q.getAttribute("position"),[0,0,0])),J.rotation.set(...XK(Q.getAttribute("rotation"))),J.scale.set(...YK(Q.getAttribute("scale")))}function nF(J){let Q=(J.getAttribute("geometry")??"box").toLowerCase(),$=(J.getAttribute("args")??"").trim().split(/\s+/).filter(Boolean).map(Number),Z=(W,Y)=>Number.isFinite($[W])?$[W]:Y;switch(Q){case"sphere":return new E7(Z(0,1),48,24);case"plane":return new C9(Z(0,1),Z(1,1));case"cylinder":return new U7(Z(0,1),Z(1,1),Z(2,1),48);case"torus":return new F7(Z(0,1),Z(1,0.4),24,96);case"icosahedron":return new G7(Z(0,1),Math.max(0,Math.floor(Z(1,2))));case"rounded-box":return new sQ(Z(0,1),Z(1,1),Z(2,1),4,Z(3,0.08));case"box":default:return new aJ(Z(0,1),Z(1,1),Z(2,1))}}function UH(J){let Q=(J.getAttribute("material")??"standard").toLowerCase(),$=new X0(G9(J.getAttribute("color"),"#ffffff")),Z=q0(J.getAttribute("metalness"),0),W=new X0(G9(J.getAttribute("emissive"),"#000000")),Y=q0(J.getAttribute("emissive-intensity"),1),X=q0(J.getAttribute("env-map-intensity"),1);if(Q==="glass"||Q==="physical"){let K=Q==="glass";return new nJ({color:$,metalness:Z,roughness:q0(J.getAttribute("roughness"),K?0.08:0.5),transmission:q0(J.getAttribute("transmission"),K?1:0),thickness:q0(J.getAttribute("thickness"),K?0.4:0),ior:q0(J.getAttribute("ior"),1.5),clearcoat:q0(J.getAttribute("clearcoat"),K?1:0),clearcoatRoughness:q0(J.getAttribute("clearcoat-roughness"),0.1),dispersion:q0(J.getAttribute("dispersion"),0),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}return new cJ({color:$,metalness:Z,roughness:q0(J.getAttribute("roughness"),0.5),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}function sF(J){let Q=new a0(nF(J),UH(J));return HH(Q,J),Q}function iF(J,Q){let $=(J.getAttribute("preset")??"").toLowerCase();if($==="studio"){Q.add(new O7(16777215,0.35));let K=new x9(16777215,2.6);K.position.set(3,5,4),Q.add(K);let H=new x9(12571903,1.1);H.position.set(-4,2.5,-3),Q.add(H);return}if($==="soft"){Q.add(new _6(16777215,3358799,1.6));let K=new x9(16777215,1);K.position.set(2,3,4),Q.add(K);return}if($==="sunset"){Q.add(new _6(16767411,2761272,1));let K=new x9(16756848,2.4);K.position.set(-5,1.5,3),Q.add(K);return}let Z=(J.getAttribute("type")??"directional").toLowerCase(),W=new X0(G9(J.getAttribute("color"),"#ffffff")),Y=q0(J.getAttribute("intensity"),1),X;if(Z==="ambient")X=new O7(W,Y);else if(Z==="hemisphere")X=new _6(W,2236979,Y);else if(Z==="point")X=new R8(W,Y);else X=new x9(W,Y);if("position"in X&&J.getAttribute("position"))X.position.set(...RJ(J.getAttribute("position"),[0,1,0]));Q.add(X)}function BW(J){let Q=q0(J.getAttribute("duration"),0);if(Q>0)return Q;let $=J.closest("[data-composition-id]"),Z=q0($?.dataset.duration??null,0);return Z>0?Z:5}function GH(J){let{width:Q,height:$}=cF(J),Z={start:q0(J.getAttribute("start"),0),duration:BW(J),transition:(J.getAttribute("transition")??"cut").toLowerCase()==="crossfade"?"crossfade":"cut",transitionDuration:q0(J.getAttribute("transition-duration"),0.6)},W=Math.max(1,Math.min(4,Math.round(q0(J.getAttribute("samples"),2)))),Y=Q*W,X=$*W,K=document.createElement("canvas");K.width=Y,K.height=X,K.style.width=`${Q}px`,K.style.height=`${$}px`,J.prepend(K);let H=J.getAttribute("background")??"",U=H==="transparent"||H==="",G=new JW({canvas:K,antialias:!1,alpha:!0});G.setSize(Y,X,!1),G.setPixelRatio(1);let F=(J.getAttribute("tone-mapping")??"aces").toLowerCase();G.toneMapping=F==="none"?Q9:T8,G.toneMappingExposure=q0(J.getAttribute("exposure"),1);let E=new k6;if(!U&&H!=="environment")E.background=new X0(G9(H,"#000000"));let O=new BJ(A6(null,35),Q/$,0.05,200);O.position.set(0,1,5);let R=[],C=new Map,q=new Map,N=[],L=[],k=null,M=null,P=[0,0,0],w=null,B=[],D=[],V=new FW,j=new OW,z=J.getAttribute("environment");if(z==="room"||z==="studio"){let A=new P6(G);E.environment=A.fromScene(new qW,0.04).texture,A.dispose()}else if(z){let A=new P6(G);L.push(j.loadAsync(z).then((x)=>{let b=A.fromEquirectangular(x).texture;if(E.environment=b,H==="environment")E.background=b;x.dispose(),A.dispose()}))}for(let A of Array.from(J.children)){let x=A.tagName.toLowerCase();if(x==="sf-camera"){O.fov=A6(A.getAttribute("fov"),35),O.far=q0(A.getAttribute("far"),200),O.position.set(...RJ(A.getAttribute("position"),[0,1,5])),O.updateProjectionMatrix();let b=A.getAttribute("look-at");if(P=RJ(A.getAttribute("look-at-offset"),[0,0,0]),b&&b.startsWith("#"))M=b.slice(1);else if(b)k={point:RJ(b,[0,0,0])}}else if(x==="sf-mesh"){let b=sF(A);if(E.add(b),A.id)C.set(A.id,b)}else if(x==="sf-model"){let b=new K9;if(HH(b,A),E.add(b),A.id)C.set(A.id,b);let p=A.getAttribute("src"),c=A.getAttribute("clip");if(p)L.push(V.loadAsync(p).then((o)=>{if(b.add(o.scene),o.animations.length>0){let Q0=new bQ(o.scene),Y0=new Map,J0=c??o.animations[0].name;for(let x0 of o.animations){let v0=Q0.clipAction(x0);v0.setEffectiveTimeScale(1),v0.setEffectiveWeight(x0.name===J0?1:0),v0.play(),Y0.set(x0.name,v0)}q.set(b,Y0),R.push(Q0)}}))}else if(x==="sf-light")iF(A,E);else if(x==="sf-particles"){let{points:b,timeUniform:p}=KH(A);if(E.add(b),A.id)C.set(A.id,b);N.push(p)}else if(x==="sf-sky"){let{sky:b,sunDirection:p}=QH(A);if(E.add(b),A.id)C.set(A.id,b);w=p}else if(x==="sf-ocean"){let b=JH(A);if(E.add(b.water),A.id)C.set(A.id,b.water);N.push(b.timeProxy),L.push(b.pending),B.push(b)}else if(x==="sf-swarm"){let b=XH(A);if(E.add(b.mesh),A.id)C.set(A.id,b.mesh);D.push(b.writer)}else if(x==="sf-metaball"){let b=eK(A,UH(A));if(E.add(b.mesh),A.id)C.set(A.id,b.mesh);D.push(b.writer)}}if(w)for(let A of B)A.setSunDirection(w);let v=Promise.all(L).then(async()=>{if(M){let A=C.get(M);if(A)k={object:A,offset:P}}try{await G.compileAsync(E,O)}catch{G.compile(E,O)}}),y=tK(G,E,O,{width:Y,height:X,bloom:q0(J.getAttribute("bloom"),0),bloomThreshold:q0(J.getAttribute("bloom-threshold"),0.85),bloomRadius:q0(J.getAttribute("bloom-radius"),0.6),vignette:q0(J.getAttribute("vignette"),0)});return{host:J,width:Q,height:$,canvas:K,post:y,shot:Z,renderer:G,scene:E,camera:O,mixers:R,get lookAt(){return k},objectsById:C,actionsByObject:q,seekFns:D,lateSeekFns:[],timeUniforms:N,ready:v}}function aQ(J,Q){let $=Q.start+Q.duration,Z=J>=Q.start&&J<$,W=Math.min(Math.max(J-Q.start,0),Q.duration),Y=1;if(Z&&Q.transition==="crossfade"&&Q.transitionDuration>0)Y=Math.min(1,(J-Q.start)/Q.transitionDuration);return{visible:Z,localT:W,opacity:Y}}var rQ=new iJ,EH=new h8,FH=new j0,oF=new S,CW=null;function aF(J){if(!CW){let Y=document.createElement("canvas");Y.width=64,Y.height=36,CW={canvas:Y,ctx:Y.getContext("2d",{willReadFrequently:!0})}}let{canvas:Q,ctx:$}=CW;$.fillStyle="#000",$.fillRect(0,0,Q.width,Q.height),$.drawImage(J,0,0,Q.width,Q.height);let Z=$.getImageData(0,0,Q.width,Q.height).data,W=0;for(let Y=0;Y<Z.length;Y+=4)W+=(Z[Y]+Z[Y+1]+Z[Y+2])/3;return W/(Z.length/4)/255}function IW(J){return Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.z)}function NH(J,Q){return J.map(($)=>{let Z=aQ(Q,$.shot),W=0,Y=0,X=0,K=!IW($.camera.position);$.scene.traverse((G)=>{if(!IW(G.position)||!IW(G.scale))K=!0;if(G instanceof t9)X++;if(G instanceof a0||G instanceof o9){W++;let F=G.material,E=Array.isArray(F)?F[0]?.type:F?.type;if(E==="MeshStandardMaterial"||E==="MeshPhysicalMaterial")Y++}}),$.camera.updateMatrixWorld(),FH.multiplyMatrices($.camera.projectionMatrix,$.camera.matrixWorldInverse),EH.setFromProjectionMatrix(FH);let H=0,U=0;for(let G of $.scene.children){let F=!1;if(G.traverse((E)=>{if(E instanceof a0||E instanceof o9)F=!0}),!F)continue;if(H++,rQ.setFromObject(G),rQ.isEmpty())continue;if(EH.intersectsBox(rQ))U++;else if(rQ.getCenter(oF).length()>1e7)U++}return{shot:$.shot,visible:Z.visible,meshCount:W,litMeshCount:Y,lightCount:X,hasEnvironment:$.scene.environment!==null,hasNaN:K,frustumCoverage:H>0?U/H:null,meanLuminance:Z.visible?aF($.canvas):null}})}function OH(J){let Q=5381;for(let $ of J){if($.canvas.style.display==="none")continue;let Z=$.canvas.toDataURL("image/png");for(let W=0;W<Z.length;W++)Q=(Q<<5)+Q+Z.charCodeAt(W)|0}return String(Q>>>0)}var z7=new S;function qH(){return document.querySelector("[data-composition-id]")===null}function RH(){let J=!1,$=window.__hf;try{Object.defineProperty(window,"__hf",{configurable:!0,enumerable:!0,get:()=>J?$:void 0,set:(Z)=>{$=Z}})}catch{J=!0}return{open:()=>{J=!0}}}function rF(J,Q){let $=Math.max(0,Number(Q)||0);for(let W of J.seekFns)W($);for(let W of J.lateSeekFns)W($);for(let W of J.mixers)W.setTime($);for(let W of J.timeUniforms)W.value=$;let Z=J.lookAt;if(Z)if("object"in Z)Z.object.getWorldPosition(z7),z7.x+=Z.offset[0],z7.y+=Z.offset[1],z7.z+=Z.offset[2],J.camera.lookAt(z7);else J.camera.lookAt(Z.point[0],Z.point[1],Z.point[2]);if(J.post)J.post.render();else J.renderer.render(J.scene,J.camera)}function tF(){let J=Array.from(document.querySelectorAll(".clip[data-start]")).map((Q)=>({el:Q,start:I9(Q.dataset.start??null,0),duration:I9(Q.dataset.duration??null,Number.POSITIVE_INFINITY)}));return(Q)=>{for(let $ of J){let Z=Q>=$.start&&Q<$.start+$.duration;$.el.style.visibility=Z?"visible":"hidden"}}}function LH(J,Q){let $=!1,Z=typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0,W=Q.standalone?tF():null,Y=(H)=>{if(Z=H,!$)return;W?.(H);for(let U of J){let G=aQ(H,U.shot);if(U.canvas.style.display=G.visible?"":"none",U.canvas.style.opacity=G.opacity>=1?"":String(G.opacity),G.visible)rF(U,G.localT)}};if(!Q.standalone)window.addEventListener("hf-seek",(H)=>{let U=H.detail,G=U&&typeof U.time==="number"?U.time:typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0;Y(G)});let X=J[0],K={version:"0.2.0",ready:!1,duration:Q.duration,width:X?.width??1920,height:X?.height??1080,scenes:J,seek:Y,diagnostics:(H)=>{return Y(H),NH(J,H)},fingerprint:(H)=>{return Y(H),OH(J)}};return window.__stereoframe=K,{markReady:()=>{$=!0,K.ready=!0,Y(typeof window.__hfThreeTime==="number"?window.__hfThreeTime:Z)}}}function DH(J){let Q=performance.now(),$=()=>{let Z=(performance.now()-Q)/1000%Math.max(0.001,J);window.__stereoframe?.seek(Z),requestAnimationFrame($)};requestAnimationFrame($)}var eF=`
4750
+ `;function N1(J){let Q=(J.getAttribute("preset")??"fountain").toLowerCase(),$=Math.max(1,Math.floor(L0(J.getAttribute("count"),500))),Z=Math.floor(L0(J.getAttribute("seed"),1)),W=L0(J.getAttribute("size"),0.08),Y=L0(J.getAttribute("opacity"),0.9),X=new e(x9(J.getAttribute("color"),"#ffffff")),K=CJ(J.getAttribute("area"),[6,4,6]),H=ZQ(Z),U=new u0,G=new Float32Array($*3),F={value:0},E={uTime:F,uSize:{value:W},uColor:{value:X},uOpacity:{value:Y}},O,R=c8;if(Q==="snow"){let N=new Float32Array($*3);for(let L=0;L<$;L++)G[L*3]=(H()-0.5)*K[0],G[L*3+1]=H()*K[1],G[L*3+2]=(H()-0.5)*K[2],N[L*3]=H()*Math.PI*2,N[L*3+1]=0.4+H()*0.8,N[L*3+2]=0.05+H()*0.25;U.setAttribute("aWobble",new i0(N,3)),E.uArea={value:{x:K[0],y:K[1],z:K[2]}},O=dD,R=l8}else if(Q==="dust"){let N=new Float32Array($*3),L=new Float32Array($*3);for(let D=0;D<$;D++){G[D*3]=(H()-0.5)*K[0],G[D*3+1]=(H()-0.5)*K[1],G[D*3+2]=(H()-0.5)*K[2];for(let V=0;V<3;V++)N[D*3+V]=0.1+H()*0.5,L[D*3+V]=H()*Math.PI*2}U.setAttribute("aFreq",new i0(N,3)),U.setAttribute("aPhase",new i0(L,3)),E.uAmp={value:L0(J.getAttribute("amplitude"),0.4)},O=mD}else{let N=L0(J.getAttribute("speed"),3),L=L0(J.getAttribute("spread"),25),D=L0(J.getAttribute("life"),2.5),V=new Float32Array($*3),z=new Float32Array($),I=new Float32Array($),B=L*Math.PI/180;for(let k=0;k<$;k++){G[k*3]=(H()-0.5)*0.05,G[k*3+1]=0,G[k*3+2]=(H()-0.5)*0.05;let C=H()*Math.PI*2,j=H()*B,w=N*(0.7+H()*0.6);V[k*3]=Math.sin(j)*Math.sin(C)*w,V[k*3+1]=Math.cos(j)*w,V[k*3+2]=Math.sin(j)*Math.cos(C)*w,I[k]=D*(0.6+H()*0.8),z[k]=H()*I[k]}U.setAttribute("aVel",new i0(V,3)),U.setAttribute("aBirth",new i0(z,1)),U.setAttribute("aLife",new i0(I,1)),E.uGravity={value:L0(J.getAttribute("gravity"),4)},O=uD}U.setAttribute("position",new i0(G,3));let M=new LJ({uniforms:E,vertexShader:O,fragmentShader:pD,transparent:!0,depthWrite:!1,blending:R}),q=new r9(U,M);return q.frustumCulled=!1,q.position.set(...CJ(J.getAttribute("position"),[0,0,0])),{points:q,timeUniform:F}}function lD(J){let Q=J.closest("[data-composition-id]"),$=L0(J.getAttribute("width")??Q?.dataset.width??null,1920),Z=L0(J.getAttribute("height")??Q?.dataset.height??null,1080);return{width:$,height:Z}}function O1(J,Q){J.position.set(...CJ(Q.getAttribute("position"),[0,0,0])),J.rotation.set(...GE(Q.getAttribute("rotation"))),J.scale.set(...UE(Q.getAttribute("scale")))}function cD(J){let Q=(J.getAttribute("geometry")??"box").toLowerCase(),$=(J.getAttribute("args")??"").trim().split(/\s+/).filter(Boolean).map(Number),Z=(W,Y)=>Number.isFinite($[W])?$[W]:Y;switch(Q){case"sphere":return new Z6(Z(0,1),48,24);case"plane":return new z9(Z(0,1),Z(1,1));case"cylinder":return new $6(Z(0,1),Z(1,1),Z(2,1),48);case"torus":return new g6(Z(0,1),Z(1,0.4),24,96);case"icosahedron":return new f6(Z(0,1),Math.max(0,Math.floor(Z(1,2))));case"rounded-box":return new HY(Z(0,1),Z(1,1),Z(2,1),4,Z(3,0.08));case"box":default:return new Q9(Z(0,1),Z(1,1),Z(2,1))}}function q1(J){let Q=(J.getAttribute("material")??"standard").toLowerCase(),$=new e(x9(J.getAttribute("color"),"#ffffff")),Z=L0(J.getAttribute("metalness"),0),W=new e(x9(J.getAttribute("emissive"),"#000000")),Y=L0(J.getAttribute("emissive-intensity"),1),X=L0(J.getAttribute("env-map-intensity"),1);if(Q==="matcap")return new s7({matcap:W1(J.getAttribute("matcap")),color:J.getAttribute("color")?$:new e("#ffffff")});if(Q==="glass"||Q==="physical"){let K=Q==="glass";return new oJ({color:$,metalness:Z,roughness:L0(J.getAttribute("roughness"),K?0.08:0.5),transmission:L0(J.getAttribute("transmission"),K?1:0),thickness:L0(J.getAttribute("thickness"),K?0.4:0),ior:L0(J.getAttribute("ior"),1.5),clearcoat:L0(J.getAttribute("clearcoat"),K?1:0),clearcoatRoughness:L0(J.getAttribute("clearcoat-roughness"),0.1),dispersion:L0(J.getAttribute("dispersion"),0),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}return new iJ({color:$,metalness:Z,roughness:L0(J.getAttribute("roughness"),0.5),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}function nD(J){let Q=new a0(cD(J),q1(J));return O1(Q,J),Q}function sD(J,Q){let $=(J.getAttribute("preset")??"").toLowerCase();if($==="studio"){Q.add(new m6(16777215,0.35));let K=new y9(16777215,2.6);K.position.set(3,5,4),Q.add(K);let H=new y9(12571903,1.1);H.position.set(-4,2.5,-3),Q.add(H);return}if($==="soft"){Q.add(new W6(16777215,3358799,1.6));let K=new y9(16777215,1);K.position.set(2,3,4),Q.add(K);return}if($==="sunset"){Q.add(new W6(16767411,2761272,1));let K=new y9(16756848,2.4);K.position.set(-5,1.5,3),Q.add(K);return}let Z=(J.getAttribute("type")??"directional").toLowerCase(),W=new e(x9(J.getAttribute("color"),"#ffffff")),Y=L0(J.getAttribute("intensity"),1),X;if(Z==="ambient")X=new m6(W,Y);else if(Z==="hemisphere")X=new W6(W,2236979,Y);else if(Z==="point")X=new N8(W,Y);else X=new y9(W,Y);if("position"in X&&J.getAttribute("position"))X.position.set(...CJ(J.getAttribute("position"),[0,1,0]));Q.add(X)}function vH(J){let Q=L0(J.getAttribute("duration"),0);if(Q>0)return Q;let $=J.closest("[data-composition-id]"),Z=L0($?.dataset.duration??null,0);return Z>0?Z:5}function R1(J){let{width:Q,height:$}=lD(J),Z={start:L0(J.getAttribute("start"),0),duration:vH(J),transition:(J.getAttribute("transition")??"cut").toLowerCase()==="crossfade"?"crossfade":"cut",transitionDuration:L0(J.getAttribute("transition-duration"),0.6)},W=Math.max(1,Math.min(4,Math.round(L0(J.getAttribute("samples"),2)))),Y=Q*W,X=$*W,K=document.createElement("canvas");K.width=Y,K.height=X,K.style.width=`${Q}px`,K.style.height=`${$}px`,J.prepend(K);let H=J.getAttribute("background")??"",U=H==="transparent"||H==="",G=new JY({canvas:K,antialias:!1,alpha:!0});G.setSize(Y,X,!1),G.setPixelRatio(1);let F=(J.getAttribute("tone-mapping")??"aces").toLowerCase();G.toneMapping=F==="none"?F9:n8,G.toneMappingExposure=L0(J.getAttribute("exposure"),1);let E=new e8;if(!U&&H!=="environment")E.background=new e(x9(H,"#000000"));let O=new BJ(e7(null,35),Q/$,0.05,200);O.position.set(0,1,5);let R=[],M=new Map,q=new Map,N=[],L=[],D=null,V=null,z=[0,0,0],I=null,B=[],k=[],C=new BH,j=new zH,w=J.getAttribute("environment");if(w==="room"||w==="studio"){let S=new c6(G);E.environment=S.fromScene(new IH,0.04).texture,S.dispose()}else if(w){let S=new c6(G);L.push(j.loadAsync(w).then((h)=>{let x=S.fromEquirectangular(h).texture;if(E.environment=x,H==="environment")E.background=x;h.dispose(),S.dispose()}))}for(let S of Array.from(J.children)){let h=S.tagName.toLowerCase();if(h==="sf-camera"){O.fov=e7(S.getAttribute("fov"),35),O.far=L0(S.getAttribute("far"),200),O.position.set(...CJ(S.getAttribute("position"),[0,1,5])),O.updateProjectionMatrix();let x=S.getAttribute("look-at");if(z=CJ(S.getAttribute("look-at-offset"),[0,0,0]),x&&x.startsWith("#"))V=x.slice(1);else if(x)D={point:CJ(x,[0,0,0])}}else if(h==="sf-mesh"){let x=nD(S);if(E.add(x),S.id)M.set(S.id,x)}else if(h==="sf-model"){let x=new G9;if(O1(x,S),E.add(x),S.id)M.set(S.id,x);let p=S.getAttribute("src"),c=S.getAttribute("clip");if(p)L.push(C.loadAsync(p).then((o)=>{if(x.add(o.scene),o.animations.length>0){let W0=new D$(o.scene),H0=new Map,J0=c??o.animations[0].name;for(let c0 of o.animations){let d0=W0.clipAction(c0);d0.setEffectiveTimeScale(1),d0.setEffectiveWeight(c0.name===J0?1:0),d0.play(),H0.set(c0.name,d0)}q.set(x,H0),R.push(W0)}}))}else if(h==="sf-light")sD(S,E);else if(h==="sf-particles"){let{points:x,timeUniform:p}=N1(S);if(E.add(x),S.id)M.set(S.id,x);N.push(p)}else if(h==="sf-sky"){let{sky:x,sunDirection:p}=K1(S);if(E.add(x),S.id)M.set(S.id,x);I=p}else if(h==="sf-ocean"){let x=X1(S);if(E.add(x.water),S.id)M.set(S.id,x.water);N.push(x.timeProxy),L.push(x.pending),B.push(x)}else if(h==="sf-swarm"){let x=F1(S);if(E.add(x.mesh),S.id)M.set(S.id,x.mesh);k.push(x.writer)}else if(h==="sf-metaball"){let x=Y1(S,q1(S));if(E.add(x.mesh),S.id)M.set(S.id,x.mesh);k.push(x.writer)}}if(I)for(let S of B)S.setSunDirection(I);let v=Promise.all(L).then(async()=>{if(V){let S=M.get(V);if(S)D={object:S,offset:z}}try{await G.compileAsync(E,O)}catch{G.compile(E,O)}}),b=$1(G,E,O,{width:Y,height:X,bloom:L0(J.getAttribute("bloom"),0),bloomThreshold:L0(J.getAttribute("bloom-threshold"),0.85),bloomRadius:L0(J.getAttribute("bloom-radius"),0.6),vignette:L0(J.getAttribute("vignette"),0),contrast:L0(J.getAttribute("contrast"),1),saturation:L0(J.getAttribute("saturation"),1),chromaticAberration:L0(J.getAttribute("chromatic-aberration"),0),grain:L0(J.getAttribute("grain"),0)});return{host:J,width:Q,height:$,canvas:K,post:b,shot:Z,renderer:G,scene:E,camera:O,mixers:R,get lookAt(){return D},objectsById:M,actionsByObject:q,seekFns:k,lateSeekFns:[],timeUniforms:N,ready:v}}function FY(J,Q){let $=Q.start+Q.duration,Z=J>=Q.start&&J<$,W=Math.min(Math.max(J-Q.start,0),Q.duration),Y=1;if(Z&&Q.transition==="crossfade"&&Q.transitionDuration>0)Y=Math.min(1,(J-Q.start)/Q.transitionDuration);return{visible:Z,localT:W,opacity:Y}}var NY=new SJ,L1=new G8,D1=new y0,iD=new A,yH=null;function oD(J){if(!yH){let Y=document.createElement("canvas");Y.width=64,Y.height=36,yH={canvas:Y,ctx:Y.getContext("2d",{willReadFrequently:!0})}}let{canvas:Q,ctx:$}=yH;$.fillStyle="#000",$.fillRect(0,0,Q.width,Q.height),$.drawImage(J,0,0,Q.width,Q.height);let Z=$.getImageData(0,0,Q.width,Q.height).data,W=0;for(let Y=0;Y<Z.length;Y+=4)W+=(Z[Y]+Z[Y+1]+Z[Y+2])/3;return W/(Z.length/4)/255}function xH(J){return Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.z)}function M1(J,Q){return J.map(($)=>{let Z=FY(Q,$.shot),W=0,Y=0,X=0,K=!xH($.camera.position);$.scene.traverse((G)=>{if(!xH(G.position)||!xH(G.scale))K=!0;if(G instanceof v9)X++;if(G instanceof a0||G instanceof r9){W++;let F=G.material,E=Array.isArray(F)?F[0]?.type:F?.type;if(E==="MeshStandardMaterial"||E==="MeshPhysicalMaterial")Y++}}),$.camera.updateMatrixWorld(),D1.multiplyMatrices($.camera.projectionMatrix,$.camera.matrixWorldInverse),L1.setFromProjectionMatrix(D1);let H=0,U=0;for(let G of $.scene.children){let F=!1;if(G.traverse((E)=>{if(E instanceof a0||E instanceof r9)F=!0}),!F)continue;if(H++,NY.setFromObject(G),NY.isEmpty())continue;if(L1.intersectsBox(NY))U++;else if(NY.getCenter(iD).length()>1e7)U++}return{shot:$.shot,visible:Z.visible,meshCount:W,litMeshCount:Y,lightCount:X,hasEnvironment:$.scene.environment!==null,hasNaN:K,frustumCoverage:H>0?U/H:null,meanLuminance:Z.visible?oD($.canvas):null}})}function k1(J){let Q=5381;for(let $ of J){if($.canvas.style.display==="none")continue;let Z=$.canvas.toDataURL("image/png");for(let W=0;W<Z.length;W++)Q=(Q<<5)+Q+Z.charCodeAt(W)|0}return String(Q>>>0)}var P$=new A;function V1(){return document.querySelector("[data-composition-id]")===null}function B1(){let J=!1,$=window.__hf;try{Object.defineProperty(window,"__hf",{configurable:!0,enumerable:!0,get:()=>J?$:void 0,set:(Z)=>{$=Z}})}catch{J=!0}return{open:()=>{J=!0}}}function aD(J,Q){let $=Math.max(0,Number(Q)||0);for(let W of J.seekFns)W($);for(let W of J.lateSeekFns)W($);for(let W of J.mixers)W.setTime($);for(let W of J.timeUniforms)W.value=$;let Z=J.lookAt;if(Z)if("object"in Z)Z.object.getWorldPosition(P$),P$.x+=Z.offset[0],P$.y+=Z.offset[1],P$.z+=Z.offset[2],J.camera.lookAt(P$);else J.camera.lookAt(Z.point[0],Z.point[1],Z.point[2]);if(J.post)J.post.render($);else J.renderer.render(J.scene,J.camera)}function rD(){let J=Array.from(document.querySelectorAll(".clip[data-start]")).map((Q)=>({el:Q,start:J8(Q.dataset.start??null,0),duration:J8(Q.dataset.duration??null,Number.POSITIVE_INFINITY)}));return(Q)=>{for(let $ of J){let Z=Q>=$.start&&Q<$.start+$.duration;$.el.style.visibility=Z?"visible":"hidden"}}}function C1(J,Q){let $=!1,Z=typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0,W=Q.standalone?rD():null,Y=(H)=>{if(Z=H,!$)return;W?.(H);for(let U of J){let G=FY(H,U.shot);if(U.canvas.style.display=G.visible?"":"none",U.canvas.style.opacity=G.opacity>=1?"":String(G.opacity),G.visible)aD(U,G.localT)}};if(!Q.standalone)window.addEventListener("hf-seek",(H)=>{let U=H.detail,G=U&&typeof U.time==="number"?U.time:typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0;Y(G)});let X=J[0],K={version:"0.2.0",ready:!1,duration:Q.duration,width:X?.width??1920,height:X?.height??1080,scenes:J,seek:Y,diagnostics:(H)=>{return Y(H),M1(J,H)},fingerprint:(H)=>{return Y(H),k1(J)}};return window.__stereoframe=K,{markReady:()=>{$=!0,K.ready=!0,Y(typeof window.__hfThreeTime==="number"?window.__hfThreeTime:Z)}}}function z1(J){let Q=performance.now(),$=()=>{let Z=(performance.now()-Q)/1000%Math.max(0.001,J);window.__stereoframe?.seek(Z),requestAnimationFrame($)};requestAnimationFrame($)}var tD=`
4708
4751
  sf-scene { display: block; line-height: 0; }
4709
4752
  sf-scene > canvas { display: block; }
4710
4753
  sf-camera, sf-model, sf-mesh, sf-light, sf-env, sf-animate, sf-particles, sf-sky, sf-ocean, sf-swarm, sf-metaball { display: none; }
4711
- `;function JN(){if(document.getElementById("__stereoframe-styles"))return;let J=document.createElement("style");J.id="__stereoframe-styles",J.textContent=eF,document.head.appendChild(J)}function QN(J){let Q=0;for(let $ of J){let Z=I9($.getAttribute("start"),0);Q=Math.max(Q,Z+BW($))}if(Q<=0)return console.warn('[stereoframe] no duration found; add duration="<seconds>" to <sf-scene>. Using 5s.'),5;return Q}async function kH(){JN();let J=Array.from(document.querySelectorAll("sf-scene"));if(J.length===0)return;let Q=qH(),$=Q?null:RH(),Z=QN(J),W=J.map(GH),Y=LH(W,{duration:Z,standalone:Q});await Promise.all(W.map((X)=>X.ready));for(let X of W)kK(X);if($N(W),Y.markReady(),$?.open(),Q&&new URLSearchParams(location.search).has("sf-preview"))DH(Z)}function $N(J){let Q=J[0];if(!Q)return;let $={scene:Q.scene,camera:Q.camera,renderer:Q.renderer,objects:Q.objectsById,scenes:J,onSeek:(Z)=>{Q.seekFns.push(Z)}};for(let Z of Array.from(document.querySelectorAll('script[type="stereoframe"]')))try{Function("sf",Z.textContent??"")($)}catch(W){console.error("[stereoframe] escape-hatch script failed:",W)}}await kH();export{kH as boot};
4754
+ `;function eD(){if(document.getElementById("__stereoframe-styles"))return;let J=document.createElement("style");J.id="__stereoframe-styles",J.textContent=tD,document.head.appendChild(J)}function JM(J){let Q=0;for(let $ of J){let Z=J8($.getAttribute("start"),0);Q=Math.max(Q,Z+vH($))}if(Q<=0)return console.warn('[stereoframe] no duration found; add duration="<seconds>" to <sf-scene>. Using 5s.'),5;return Q}async function I1(){eD();let J=Array.from(document.querySelectorAll("sf-scene"));if(J.length===0)return;let Q=V1(),$=Q?null:B1(),Z=JM(J),W=J.map(R1),Y=C1(W,{duration:Z,standalone:Q});await Promise.all(W.map((X)=>X.ready));for(let X of W)CE(X);if(QM(W),Y.markReady(),$?.open(),Q&&new URLSearchParams(location.search).has("sf-preview"))z1(Z)}function QM(J){let Q=J[0];if(!Q)return;let $={THREE:QY,scene:Q.scene,camera:Q.camera,renderer:Q.renderer,width:Q.width,height:Q.height,objects:Q.objectsById,scenes:J,onSeek:(Z)=>{Q.seekFns.push(Z)}};for(let Z of Array.from(document.querySelectorAll('script[type="stereoframe"]')))try{Function("sf",Z.textContent??"")($)}catch(W){console.error("[stereoframe] escape-hatch script failed:",W)}}await I1();export{I1 as boot};