stereoframe-runtime 0.1.0 → 0.2.1

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 tW="184";var eW=0,G$=1,JY=2;var f6=1,QY=2,Z6=3,z9=0,hJ=1,lJ=2,C9=0,V8=1,x6=2,E$=3,q$=4,$Y=5;var W6=100,ZY=101,WY=102,YY=103,XY=104,KY=200,HY=201,UY=202,GY=203,EY=204,qY=205,FY=206,NY=207,OY=208,RY=209,LY=210,DY=211,MY=212,kY=213,BY=214,VY=0,zY=1,CY=2,F$=3,IY=4,_Y=5,wY=6,PY=7,TY=0,AY=1,SY=2,aJ=0,N$=1,O$=2,R$=3,h6=4,L$=5,D$=6,M$=7;var Y6=301,z8=302,p7=303,d7=304,b6=306,X8=1000,X6=1001,u7=1002,O9=1003,m7=1004;var C8=1005;var kJ=1006,K6=1007;var I9=1008;var R9=1009,jY=1010,vY=1011,g6=1012,k$=1013,K8=1014,rJ=1015,bJ=1016,B$=1017,V$=1018,H6=1020,yY=35902,fY=35899,xY=1021,hY=1022,_9=1023,I8=1026,_8=1027,bY=1028,z$=1029,w8=1030,C$=1031;var I$=1033,l7=33776,c7=33777,n7=33778,s7=33779,_$=35840,w$=35841,P$=35842,T$=35843,A$=36196,S$=37492,j$=37496,v$=37488,y$=37489,i7=37490,f$=37491,x$=37808,h$=37809,b$=37810,g$=37811,p$=37812,d$=37813,u$=37814,m$=37815,l$=37816,c$=37817,n$=37818,s$=37819,i$=37820,o$=37821,a$=36492,r$=36494,t$=36495,e$=36283,JZ=36284,o7=36285,QZ=36286;var $Z=2300,a7=2301;var ZZ=0,p6=1,U6=2;var WZ=0,gY=1,P8="",H8="srgb",uJ="srgb-linear",YZ="linear",UJ="srgb";var pY=512,dY=513,uY=514,r7=515,mY=516,lY=517,t7=518,cY=519;var XZ="300 es",KZ=2000;function WH(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function YH(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function J6(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function nY(){let J=J6("canvas");return J.style.display="block",J}var NW={},Q6=null;function y6(...J){let Q="THREE."+J.shift();if(Q6)Q6("log",Q,...J);else console.log(Q,...J)}function sY(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 B0(...J){J=sY(J);let Q="THREE."+J.shift();if(Q6)Q6("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function A0(...J){J=sY(J);let Q="THREE."+J.shift();if(Q6)Q6("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function h7(...J){let Q=J.join(" ");if(Q in NW)return;NW[Q]=!0,B0(...J)}function iY(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 oY={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class w9{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"],OW=1234567,j6=Math.PI/180,k8=180/Math.PI;function N9(){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 g0(J,Q,$){return Math.max(Q,Math.min($,J))}function HZ(J,Q){return(J%Q+Q)%Q}function XH(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function KH(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function v6(J,Q,$){return(1-$)*J+$*Q}function HH(J,Q,$,Z){return v6(J,Q,1-Math.exp(-$*Z))}function UH(J,Q=1){return Q-Math.abs(HZ(J,Q*2)-Q)}function GH(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function EH(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 qH(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function FH(J,Q){return J+Math.random()*(Q-J)}function NH(J){return J*(0.5-Math.random())}function OH(J){if(J!==void 0)OW=J;let Q=OW+=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 RH(J){return J*j6}function LH(J){return J*k8}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 kH(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function BH(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),q=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*q,H*E,K*U);break;case"YZY":J.set(H*E,K*G,H*q,K*U);break;case"ZXZ":J.set(H*q,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:B0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function F9(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 G6={DEG2RAD:j6,RAD2DEG:k8,generateUUID:N9,clamp:g0,euclideanModulo:HZ,mapLinear:XH,inverseLerp:KH,lerp:v6,damp:HH,pingpong:UH,smoothstep:GH,smootherstep:EH,randInt:qH,randFloat:FH,randFloatSpread:NH,seededRandom:OH,degToRad:RH,radToDeg:LH,isPowerOfTwo:DH,ceilPowerOfTwo:MH,floorPowerOfTwo:kH,setQuaternionFromProperEuler:BH,normalize:QJ,denormalize:F9};class h0{static{h0.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=g0(this.x,J.x,Q.x),this.y=g0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=g0(this.x,J,Q),this.y=g0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(g0($,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(g0($,-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 wJ{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],q=W[Y+0],E=W[Y+1],O=W[Y+2],R=W[Y+3];if(G!==R||K!==q||H!==E||U!==O){let k=K*q+H*E+U*O+G*R;if(k<0)q=-q,E=-E,O=-O,R=-R,k=-k;let F=1-X;if(k<0.9995){let N=Math.acos(k),D=Math.sin(N);F=Math.sin(F*N)/D,X=Math.sin(X*N)/D,K=K*F+q*X,H=H*F+E*X,U=U*F+O*X,G=G*F+R*X}else{K=K*F+q*X,H=H*F+E*X,U=U*F+O*X,G=G*F+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],q=W[Y+1],E=W[Y+2],O=W[Y+3];return J[Q]=X*O+U*G+K*E-H*q,J[Q+1]=K*O+U*q+H*G-X*E,J[Q+2]=H*O+U*E+X*q-K*G,J[Q+3]=U*O-X*G-K*q-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),q=K($/2),E=K(Z/2),O=K(W/2);switch(Y){case"XYZ":this._x=q*U*G+H*E*O,this._y=H*E*G-q*U*O,this._z=H*U*O+q*E*G,this._w=H*U*G-q*E*O;break;case"YXZ":this._x=q*U*G+H*E*O,this._y=H*E*G-q*U*O,this._z=H*U*O-q*E*G,this._w=H*U*G+q*E*O;break;case"ZXY":this._x=q*U*G-H*E*O,this._y=H*E*G+q*U*O,this._z=H*U*O+q*E*G,this._w=H*U*G-q*E*O;break;case"ZYX":this._x=q*U*G-H*E*O,this._y=H*E*G+q*U*O,this._z=H*U*O-q*E*G,this._w=H*U*G+q*E*O;break;case"YZX":this._x=q*U*G+H*E*O,this._y=H*E*G+q*U*O,this._z=H*U*O-q*E*G,this._w=H*U*G-q*E*O;break;case"XZY":this._x=q*U*G-H*E*O,this._y=H*E*G-q*U*O,this._z=H*U*O+q*E*G,this._w=H*U*G+q*E*O;break;default:B0("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],q=$+X+G;if(q>0){let E=0.5/Math.sqrt(q+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(g0(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(RW.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(RW.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=g0(this.x,J.x,Q.x),this.y=g0(this.y,J.y,Q.y),this.z=g0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=g0(this.x,J,Q),this.y=g0(this.y,J,Q),this.z=g0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(g0($,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 yQ.copy(this).projectOnVector(J),this.sub(yQ)}reflect(J){return this.sub(yQ.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(g0($,-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 yQ=new A,RW=new wJ;class v0{static{v0.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],q=$[2],E=$[5],O=$[8],R=Z[0],k=Z[3],F=Z[6],N=Z[1],D=Z[4],B=Z[7],C=Z[2],T=Z[5],P=Z[8];return W[0]=Y*R+X*N+K*C,W[3]=Y*k+X*D+K*T,W[6]=Y*F+X*B+K*P,W[1]=H*R+U*N+G*C,W[4]=H*k+U*D+G*T,W[7]=H*F+U*B+G*P,W[2]=q*R+E*N+O*C,W[5]=q*k+E*D+O*T,W[8]=q*F+E*B+O*P,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,q=X*K-U*W,E=H*W-Y*K,O=Q*G+$*q+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]=q*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(fQ.makeScale(J,Q)),this}rotate(J){return this.premultiply(fQ.makeRotation(-J)),this}translate(J,Q){return this.premultiply(fQ.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 fQ=new v0,LW=new v0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),DW=new v0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function VH(){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=m9(W.r),W.g=m9(W.g),W.b=m9(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=e8(W.r),W.g=e8(W.g),W.b=e8(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 h7("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,Y)},toWorkingColorSpace:function(W,Y){return h7("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:LW,fromXYZ:DW,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:LW,fromXYZ:DW,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var l0=VH();function m9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function e8(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var g8;class UZ{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(g8===void 0)g8=J6("canvas");g8.width=J.width,g8.height=J.height;let Z=g8.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=g8}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=J6("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]=m9(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(m9(Q[$]/255)*255);else Q[$]=m9(Q[$]);return{data:Q,width:J.width,height:J.height}}else return B0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}var zH=0;class d6{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zH++}),this.uuid=N9(),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(xQ(Z[Y].image));else W.push(xQ(Z[Y]))}else W=xQ(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function xQ(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return UZ.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 B0("Texture: Unable to serialize Texture."),{}}var CH=0,hQ=new A;class _J extends w9{constructor(J=_J.DEFAULT_IMAGE,Q=_J.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,Y=1008,X=1023,K=1009,H=_J.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:CH++}),this.uuid=N9(),this.name="",this.source=new d6(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 h0(0,0),this.repeat=new h0(1,1),this.center=new h0(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new v0,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(hQ).x}get height(){return this.source.getSize(hQ).y}get depth(){return this.source.getSize(hQ).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){B0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){B0(`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++}}_J.DEFAULT_IMAGE=null;_J.DEFAULT_MAPPING=300;_J.DEFAULT_ANISOTROPY=1;class JJ{static{JJ.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],q=K[1],E=K[5],O=K[9],R=K[2],k=K[6],F=K[10];if(Math.abs(U-q)<0.01&&Math.abs(G-R)<0.01&&Math.abs(O-k)<0.01){if(Math.abs(U+q)<0.1&&Math.abs(G+R)<0.1&&Math.abs(O+k)<0.1&&Math.abs(H+E+F-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let D=(H+1)/2,B=(E+1)/2,C=(F+1)/2,T=(U+q)/4,P=(G+R)/4,_=(O+k)/4;if(D>B&&D>C)if(D<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(D),Z=T/$,W=P/$;else if(B>C)if(B<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(B),$=T/Z,W=_/Z;else if(C<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(C),$=P/W,Z=_/W;return this.set($,Z,W,Q),this}let N=Math.sqrt((k-O)*(k-O)+(G-R)*(G-R)+(q-U)*(q-U));if(Math.abs(N)<0.001)N=1;return this.x=(k-O)/N,this.y=(G-R)/N,this.z=(q-U)/N,this.w=Math.acos((H+E+F-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=g0(this.x,J.x,Q.x),this.y=g0(this.y,J.y,Q.y),this.z=g0(this.z,J.z,Q.z),this.w=g0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=g0(this.x,J,Q),this.y=g0(this.y,J,Q),this.z=g0(this.z,J,Q),this.w=g0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(g0($,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 GZ extends w9{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 JJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new JJ(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new _J(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 d6(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 cJ extends GZ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class e7 extends _J{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 EZ extends _J{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 S0{static{S0.prototype.isMatrix4=!0}constructor(J,Q,$,Z,W,Y,X,K,H,U,G,q,E,O,R,k){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,q,E,O,R,k)}set(J,Q,$,Z,W,Y,X,K,H,U,G,q,E,O,R,k){let F=this.elements;return F[0]=J,F[4]=Q,F[8]=$,F[12]=Z,F[1]=W,F[5]=Y,F[9]=X,F[13]=K,F[2]=H,F[6]=U,F[10]=G,F[14]=q,F[3]=E,F[7]=O,F[11]=R,F[15]=k,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 S0().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/p8.setFromMatrixColumn(J,0).length(),W=1/p8.setFromMatrixColumn(J,1).length(),Y=1/p8.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 q=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]=q-R*H,Q[9]=-X*K,Q[2]=R-q*H,Q[6]=O+E*H,Q[10]=Y*K}else if(J.order==="YXZ"){let q=K*U,E=K*G,O=H*U,R=H*G;Q[0]=q+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+q*X,Q[10]=Y*K}else if(J.order==="ZXY"){let q=K*U,E=K*G,O=H*U,R=H*G;Q[0]=q-R*X,Q[4]=-Y*G,Q[8]=O+E*X,Q[1]=E+O*X,Q[5]=Y*U,Q[9]=R-q*X,Q[2]=-Y*H,Q[6]=X,Q[10]=Y*K}else if(J.order==="ZYX"){let q=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=O*H-E,Q[8]=q*H+R,Q[1]=K*G,Q[5]=R*H+q,Q[9]=E*H-O,Q[2]=-H,Q[6]=X*K,Q[10]=Y*K}else if(J.order==="YZX"){let q=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=R-q*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]=q-R*G}else if(J.order==="XZY"){let q=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=-G,Q[8]=H*U,Q[1]=q*G+R,Q[5]=Y*U,Q[9]=E*G-O,Q[2]=O*G-E,Q[6]=X*U,Q[10]=R*G+q}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(IH,J,_H)}lookAt(J,Q,$){let Z=this.elements;if(iJ.subVectors(J,Q),iJ.lengthSq()===0)iJ.z=1;if(iJ.normalize(),J8.crossVectors($,iJ),J8.lengthSq()===0){if(Math.abs($.z)===1)iJ.x+=0.0001;else iJ.z+=0.0001;iJ.normalize(),J8.crossVectors($,iJ)}return J8.normalize(),E7.crossVectors(iJ,J8),Z[0]=J8.x,Z[4]=E7.x,Z[8]=iJ.x,Z[1]=J8.y,Z[5]=E7.y,Z[9]=iJ.y,Z[2]=J8.z,Z[6]=E7.z,Z[10]=iJ.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],q=$[9],E=$[13],O=$[2],R=$[6],k=$[10],F=$[14],N=$[3],D=$[7],B=$[11],C=$[15],T=Z[0],P=Z[4],_=Z[8],L=Z[12],z=Z[1],S=Z[5],I=Z[9],j=Z[13],b=Z[2],v=Z[6],x=Z[10],p=Z[14],d=Z[3],n=Z[7],r=Z[11],Y0=Z[15];return W[0]=Y*T+X*z+K*b+H*d,W[4]=Y*P+X*S+K*v+H*n,W[8]=Y*_+X*I+K*x+H*r,W[12]=Y*L+X*j+K*p+H*Y0,W[1]=U*T+G*z+q*b+E*d,W[5]=U*P+G*S+q*v+E*n,W[9]=U*_+G*I+q*x+E*r,W[13]=U*L+G*j+q*p+E*Y0,W[2]=O*T+R*z+k*b+F*d,W[6]=O*P+R*S+k*v+F*n,W[10]=O*_+R*I+k*x+F*r,W[14]=O*L+R*j+k*p+F*Y0,W[3]=N*T+D*z+B*b+C*d,W[7]=N*P+D*S+B*v+C*n,W[11]=N*_+D*I+B*x+C*r,W[15]=N*L+D*j+B*p+C*Y0,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],q=J[10],E=J[14],O=J[3],R=J[7],k=J[11],F=J[15],N=K*E-H*q,D=X*E-H*G,B=X*q-K*G,C=Y*E-H*U,T=Y*q-K*U,P=Y*G-X*U;return Q*(R*N-k*D+F*B)-$*(O*N-k*C+F*T)+Z*(O*D-R*C+F*P)-W*(O*B-R*T+k*P)}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],q=J[10],E=J[11],O=J[12],R=J[13],k=J[14],F=J[15],N=Q*X-$*Y,D=Q*K-Z*Y,B=Q*H-W*Y,C=$*K-Z*X,T=$*H-W*X,P=Z*H-W*K,_=U*R-G*O,L=U*k-q*O,z=U*F-E*O,S=G*k-q*R,I=G*F-E*R,j=q*F-E*k,b=N*j-D*I+B*S+C*z-T*L+P*_;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let v=1/b;return J[0]=(X*j-K*I+H*S)*v,J[1]=(Z*I-$*j-W*S)*v,J[2]=(R*P-k*T+F*C)*v,J[3]=(q*T-G*P-E*C)*v,J[4]=(K*z-Y*j-H*L)*v,J[5]=(Q*j-Z*z+W*L)*v,J[6]=(k*B-O*P-F*D)*v,J[7]=(U*P-q*B+E*D)*v,J[8]=(Y*I-X*z+H*_)*v,J[9]=($*z-Q*I-W*_)*v,J[10]=(O*T-R*B+F*N)*v,J[11]=(G*B-U*T-E*N)*v,J[12]=(X*L-Y*S-K*_)*v,J[13]=(Q*S-$*L+Z*_)*v,J[14]=(R*D-O*C-k*N)*v,J[15]=(U*C-G*D+q*N)*v,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,q=W*H,E=W*U,O=W*G,R=Y*U,k=Y*G,F=X*G,N=K*H,D=K*U,B=K*G,C=$.x,T=$.y,P=$.z;return Z[0]=(1-(R+F))*C,Z[1]=(E+B)*C,Z[2]=(O-D)*C,Z[3]=0,Z[4]=(E-B)*T,Z[5]=(1-(q+F))*T,Z[6]=(k+N)*T,Z[7]=0,Z[8]=(O+D)*P,Z[9]=(k-N)*P,Z[10]=(1-(q+R))*P,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=p8.set(Z[0],Z[1],Z[2]).length(),X=p8.set(Z[4],Z[5],Z[6]).length(),K=p8.set(Z[8],Z[9],Z[10]).length();if(W<0)Y=-Y;U9.copy(this);let H=1/Y,U=1/X,G=1/K;return U9.elements[0]*=H,U9.elements[1]*=H,U9.elements[2]*=H,U9.elements[4]*=U,U9.elements[5]*=U,U9.elements[6]*=U,U9.elements[8]*=G,U9.elements[9]*=G,U9.elements[10]*=G,Q.setFromRotationMatrix(U9),$.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),q=(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]=q,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),q=-(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]=q,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 p8=new A,U9=new S0,IH=new A(0,0,0),_H=new A(1,1,1),J8=new A,E7=new A,iJ=new A,MW=new S0,kW=new wJ;class l9{constructor(J=0,Q=0,$=0,Z=l9.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],q=Z[6],E=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(g0(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(q,H),this._z=0;break;case"YXZ":if(this._x=Math.asin(-g0(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(g0(q,-1,1)),Math.abs(q)<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(-g0(G,-1,1)),Math.abs(G)<0.9999999)this._x=Math.atan2(q,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(g0(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(-g0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(q,H),this._y=Math.atan2(X,W);else this._x=Math.atan2(-U,E),this._y=0;break;default:B0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return MW.makeRotationFromQuaternion(J),this.setFromRotationMatrix(MW,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return kW.setFromEuler(this),this.setFromQuaternion(kW,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}}l9.DEFAULT_ORDER="XYZ";class JQ{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 wH=0,BW=new A,d8=new wJ,x9=new S0,q7=new A,C6=new A,PH=new A,TH=new wJ,VW=new A(1,0,0),zW=new A(0,1,0),CW=new A(0,0,1),IW={type:"added"},AH={type:"removed"},u8={type:"childadded",child:null},bQ={type:"childremoved",child:null};class EJ extends w9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:wH++}),this.uuid=N9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=EJ.DEFAULT_UP.clone();let J=new A,Q=new l9,$=new wJ,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 S0},normalMatrix:{value:new v0}}),this.matrix=new S0,this.matrixWorld=new S0,this.matrixAutoUpdate=EJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=EJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new JQ,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 d8.setFromAxisAngle(J,Q),this.quaternion.multiply(d8),this}rotateOnWorldAxis(J,Q){return d8.setFromAxisAngle(J,Q),this.quaternion.premultiply(d8),this}rotateX(J){return this.rotateOnAxis(VW,J)}rotateY(J){return this.rotateOnAxis(zW,J)}rotateZ(J){return this.rotateOnAxis(CW,J)}translateOnAxis(J,Q){return BW.copy(J).applyQuaternion(this.quaternion),this.position.add(BW.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(VW,J)}translateY(J){return this.translateOnAxis(zW,J)}translateZ(J){return this.translateOnAxis(CW,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(x9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)q7.copy(J);else q7.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),C6.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)x9.lookAt(C6,q7,this.up);else x9.lookAt(q7,C6,this.up);if(this.quaternion.setFromRotationMatrix(x9),Z)x9.extractRotation(Z.matrixWorld),d8.setFromRotationMatrix(x9),this.quaternion.premultiply(d8.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 A0("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(IW),u8.child=J,this.dispatchEvent(u8),u8.child=null;else A0("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(AH),bQ.child=J,this.dispatchEvent(bQ),bQ.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),x9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),x9.multiply(J.parent.matrixWorld);return J.applyMatrix4(x9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(IW),u8.child=J,this.dispatchEvent(u8),u8.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(C6,J,PH),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(C6,TH,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),q=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(q.length>0)$.skeletons=q;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}}EJ.DEFAULT_UP=new A(0,1,0);EJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;EJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class W9 extends EJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var SH={type:"move"};class u6{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new W9,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 W9,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 W9,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 k=Q.getJointPose(R,$),F=this._getHandJoint(H,R);if(k!==null)F.matrix.fromArray(k.transform.matrix),F.matrix.decompose(F.position,F.rotation,F.scale),F.matrixWorldNeedsUpdate=!0,F.jointRadius=k.radius;F.visible=k!==null}let U=H.joints["index-finger-tip"],G=H.joints["thumb-tip"],q=U.position.distanceTo(G.position),E=0.02,O=0.005;if(H.inputState.pinching&&q>E+O)H.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!H.inputState.pinching&&q<=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(SH)}}}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 W9;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var aY={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},Q8={h:0,s:0,l:0},F7={h:0,s:0,l:0};function gQ(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 k0{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,l0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=l0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,l0.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=l0.workingColorSpace){if(J=HZ(J,1),Q=g0(Q,0,1),$=g0($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,Y=2*$-W;this.r=gQ(Y,W,J+0.3333333333333333),this.g=gQ(Y,W,J),this.b=gQ(Y,W,J-0.3333333333333333)}return l0.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)B0("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:B0("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 B0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=aY[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else B0("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=m9(J.r),this.g=m9(J.g),this.b=m9(J.b),this}copyLinearToSRGB(J){return this.r=e8(J.r),this.g=e8(J.g),this.b=e8(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return l0.workingToColorSpace(xJ.copy(this),J),Math.round(g0(xJ.r*255,0,255))*65536+Math.round(g0(xJ.g*255,0,255))*256+Math.round(g0(xJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=l0.workingColorSpace){l0.workingToColorSpace(xJ.copy(this),Q);let{r:$,g:Z,b:W}=xJ,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=l0.workingColorSpace){return l0.workingToColorSpace(xJ.copy(this),Q),J.r=xJ.r,J.g=xJ.g,J.b=xJ.b,J}getStyle(J="srgb"){l0.workingToColorSpace(xJ.copy(this),J);let{r:Q,g:$,b:Z}=xJ;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(Q8),this.setHSL(Q8.h+J,Q8.s+Q,Q8.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(Q8),J.getHSL(F7);let $=v6(Q8.h,F7.h,Q),Z=v6(Q8.s,F7.s,Q),W=v6(Q8.l,F7.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 xJ=new k0;k0.NAMES=aY;class QQ extends EJ{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 l9,this.environmentIntensity=1,this.environmentRotation=new l9,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 G9=new A,h9=new A,pQ=new A,b9=new A,m8=new A,l8=new A,_W=new A,dQ=new A,uQ=new A,mQ=new A,lQ=new JJ,cQ=new JJ,nQ=new JJ;class Z9{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),G9.subVectors(J,Q),Z.cross(G9);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){G9.subVectors(Z,Q),h9.subVectors($,Q),pQ.subVectors(J,Q);let Y=G9.dot(G9),X=G9.dot(h9),K=G9.dot(pQ),H=h9.dot(h9),U=h9.dot(pQ),G=Y*H-X*X;if(G===0)return W.set(0,0,0),null;let q=1/G,E=(H*K-X*U)*q,O=(Y*U-X*K)*q;return W.set(1-E-O,O,E)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,b9)===null)return!1;return b9.x>=0&&b9.y>=0&&b9.x+b9.y<=1}static getInterpolation(J,Q,$,Z,W,Y,X,K){if(this.getBarycoord(J,Q,$,Z,b9)===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,b9.x),K.addScaledVector(Y,b9.y),K.addScaledVector(X,b9.z),K}static getInterpolatedAttribute(J,Q,$,Z,W,Y){return lQ.setScalar(0),cQ.setScalar(0),nQ.setScalar(0),lQ.fromBufferAttribute(J,Q),cQ.fromBufferAttribute(J,$),nQ.fromBufferAttribute(J,Z),Y.setScalar(0),Y.addScaledVector(lQ,W.x),Y.addScaledVector(cQ,W.y),Y.addScaledVector(nQ,W.z),Y}static isFrontFacing(J,Q,$,Z){return G9.subVectors($,Q),h9.subVectors(J,Q),G9.cross(h9).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 G9.subVectors(this.c,this.b),h9.subVectors(this.a,this.b),G9.cross(h9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return Z9.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return Z9.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return Z9.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return Z9.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return Z9.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;m8.subVectors(Z,$),l8.subVectors(W,$),dQ.subVectors(J,$);let K=m8.dot(dQ),H=l8.dot(dQ);if(K<=0&&H<=0)return Q.copy($);uQ.subVectors(J,Z);let U=m8.dot(uQ),G=l8.dot(uQ);if(U>=0&&G<=U)return Q.copy(Z);let q=K*G-U*H;if(q<=0&&K>=0&&U<=0)return Y=K/(K-U),Q.copy($).addScaledVector(m8,Y);mQ.subVectors(J,W);let E=m8.dot(mQ),O=l8.dot(mQ);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(l8,X);let k=U*O-E*G;if(k<=0&&G-U>=0&&E-O>=0)return _W.subVectors(W,Z),X=(G-U)/(G-U+(E-O)),Q.copy(Z).addScaledVector(_W,X);let F=1/(k+R+q);return Y=R*F,X=q*F,Q.copy($).addScaledVector(m8,Y).addScaledVector(l8,X)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class nJ{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(E9.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(E9.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 $=E9.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,E9);else E9.fromBufferAttribute(W,Y);E9.applyMatrix4(J.matrixWorld),this.expandByPoint(E9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();N7.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();N7.copy($.boundingBox)}N7.applyMatrix4(J.matrixWorld),this.union(N7)}}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,E9),E9.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(I6),O7.subVectors(this.max,I6),c8.subVectors(J.a,I6),n8.subVectors(J.b,I6),s8.subVectors(J.c,I6),$8.subVectors(n8,c8),Z8.subVectors(s8,n8),R8.subVectors(c8,s8);let Q=[0,-$8.z,$8.y,0,-Z8.z,Z8.y,0,-R8.z,R8.y,$8.z,0,-$8.x,Z8.z,0,-Z8.x,R8.z,0,-R8.x,-$8.y,$8.x,0,-Z8.y,Z8.x,0,-R8.y,R8.x,0];if(!sQ(Q,c8,n8,s8,O7))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!sQ(Q,c8,n8,s8,O7))return!1;return R7.crossVectors($8,Z8),Q=[R7.x,R7.y,R7.z],sQ(Q,c8,n8,s8,O7)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,E9).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(E9).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 g9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),g9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),g9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),g9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),g9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),g9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),g9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),g9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(g9),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 g9=[new A,new A,new A,new A,new A,new A,new A,new A],E9=new A,N7=new nJ,c8=new A,n8=new A,s8=new A,$8=new A,Z8=new A,R8=new A,I6=new A,O7=new A,R7=new A,L8=new A;function sQ(J,Q,$,Z,W){for(let Y=0,X=J.length-3;Y<=X;Y+=3){L8.fromArray(J,Y);let K=W.x*Math.abs(L8.x)+W.y*Math.abs(L8.y)+W.z*Math.abs(L8.z),H=Q.dot(L8),U=$.dot(L8),G=Z.dot(L8);if(Math.max(-Math.max(H,U,G),Math.min(H,U,G))>K)return!1}return!0}var u9=jH();function jH(){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 vH(J){if(Math.abs(J)>65504)B0("DataUtils.toHalfFloat(): Value out of range.");J=g0(J,-65504,65504),u9.floatView[0]=J;let Q=u9.uint32View[0],$=Q>>23&511;return u9.baseTable[$]+((Q&8388607)>>u9.shiftTable[$])}function yH(J){let Q=J>>10;return u9.uint32View[0]=u9.mantissaTable[u9.offsetTable[Q]+(J&1023)]+u9.exponentTable[Q],u9.floatView[0]}class T8{static toHalfFloat(J){return vH(J)}static fromHalfFloat(J){return yH(J)}}var IJ=new A,L7=new h0,fH=0;class HJ extends w9{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:fH++}),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++)L7.fromBufferAttribute(this,Q),L7.applyMatrix3(J),this.setXY(Q,L7.x,L7.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)IJ.fromBufferAttribute(this,Q),IJ.applyMatrix3(J),this.setXYZ(Q,IJ.x,IJ.y,IJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)IJ.fromBufferAttribute(this,Q),IJ.applyMatrix4(J),this.setXYZ(Q,IJ.x,IJ.y,IJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)IJ.fromBufferAttribute(this,Q),IJ.applyNormalMatrix(J),this.setXYZ(Q,IJ.x,IJ.y,IJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)IJ.fromBufferAttribute(this,Q),IJ.transformDirection(J),this.setXYZ(Q,IJ.x,IJ.y,IJ.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)$=F9($,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=F9(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=F9(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=F9(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=F9(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 $Q extends HJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class ZQ extends HJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class qJ extends HJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var xH=new nJ,_6=new A,iQ=new A;class tJ{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 xH.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;_6.subVectors(J,this.center);let Q=_6.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(_6,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 iQ.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(_6.copy(J.center).add(iQ)),this.expandByPoint(_6.copy(J.center).sub(iQ));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 hH=0,$9=new S0,oQ=new EJ,i8=new A,oJ=new nJ,w6=new nJ,AJ=new A;class BJ extends w9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hH++}),this.uuid=N9(),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((WH(J))?ZQ:$Q)(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 v0().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 oQ.lookAt(J),oQ.updateMatrix(),this.applyMatrix4(oQ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(i8).negate(),this.translate(i8.x,i8.y,i8.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 qJ($,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)B0("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 nJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){A0("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(oJ.setFromBufferAttribute(W),this.morphTargetsRelative)AJ.addVectors(this.boundingBox.min,oJ.min),this.boundingBox.expandByPoint(AJ),AJ.addVectors(this.boundingBox.max,oJ.max),this.boundingBox.expandByPoint(AJ);else this.boundingBox.expandByPoint(oJ.min),this.boundingBox.expandByPoint(oJ.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))A0('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 tJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){A0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new A,1/0);return}if(J){let $=this.boundingSphere.center;if(oJ.setFromBufferAttribute(J),Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W];if(w6.setFromBufferAttribute(X),this.morphTargetsRelative)AJ.addVectors(oJ.min,w6.min),oJ.expandByPoint(AJ),AJ.addVectors(oJ.max,w6.max),oJ.expandByPoint(AJ);else oJ.expandByPoint(w6.min),oJ.expandByPoint(w6.max)}oJ.getCenter($);let Z=0;for(let W=0,Y=J.count;W<Y;W++)AJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(AJ));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(AJ.fromBufferAttribute(X,H),K)i8.fromBufferAttribute(J,H),AJ.add(i8);Z=Math.max(Z,$.distanceToSquared(AJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))A0('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){A0("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 HJ(new Float32Array(4*$.count),4));let Y=this.getAttribute("tangent"),X=[],K=[];for(let _=0;_<$.count;_++)X[_]=new A,K[_]=new A;let H=new A,U=new A,G=new A,q=new h0,E=new h0,O=new h0,R=new A,k=new A;function F(_,L,z){H.fromBufferAttribute($,_),U.fromBufferAttribute($,L),G.fromBufferAttribute($,z),q.fromBufferAttribute(W,_),E.fromBufferAttribute(W,L),O.fromBufferAttribute(W,z),U.sub(H),G.sub(H),E.sub(q),O.sub(q);let S=1/(E.x*O.y-O.x*E.y);if(!isFinite(S))return;R.copy(U).multiplyScalar(O.y).addScaledVector(G,-E.y).multiplyScalar(S),k.copy(G).multiplyScalar(E.x).addScaledVector(U,-O.x).multiplyScalar(S),X[_].add(R),X[L].add(R),X[z].add(R),K[_].add(k),K[L].add(k),K[z].add(k)}let N=this.groups;if(N.length===0)N=[{start:0,count:J.count}];for(let _=0,L=N.length;_<L;++_){let z=N[_],S=z.start,I=z.count;for(let j=S,b=S+I;j<b;j+=3)F(J.getX(j+0),J.getX(j+1),J.getX(j+2))}let D=new A,B=new A,C=new A,T=new A;function P(_){C.fromBufferAttribute(Z,_),T.copy(C);let L=X[_];D.copy(L),D.sub(C.multiplyScalar(C.dot(L))).normalize(),B.crossVectors(T,L);let S=B.dot(K[_])<0?-1:1;Y.setXYZW(_,D.x,D.y,D.z,S)}for(let _=0,L=N.length;_<L;++_){let z=N[_],S=z.start,I=z.count;for(let j=S,b=S+I;j<b;j+=3)P(J.getX(j+0)),P(J.getX(j+1)),P(J.getX(j+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new HJ(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let q=0,E=$.count;q<E;q++)$.setXYZ(q,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 q=0,E=J.count;q<E;q+=3){let O=J.getX(q+0),R=J.getX(q+1),k=J.getX(q+2);Z.fromBufferAttribute(Q,O),W.fromBufferAttribute(Q,R),Y.fromBufferAttribute(Q,k),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),X.fromBufferAttribute($,O),K.fromBufferAttribute($,R),H.fromBufferAttribute($,k),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(k,H.x,H.y,H.z)}else for(let q=0,E=Q.count;q<E;q+=3)Z.fromBufferAttribute(Q,q+0),W.fromBufferAttribute(Q,q+1),Y.fromBufferAttribute(Q,q+2),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),$.setXYZ(q+0,U.x,U.y,U.z),$.setXYZ(q+1,U.x,U.y,U.z),$.setXYZ(q+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++)AJ.fromBufferAttribute(J,Q),AJ.normalize(),J.setXYZ(Q,AJ.x,AJ.y,AJ.z)}toNonIndexed(){function J(X,K){let{array:H,itemSize:U,normalized:G}=X,q=new H.constructor(K.length*U),E=0,O=0;for(let R=0,k=K.length;R<k;R++){if(X.isInterleavedBufferAttribute)E=K[R]*X.data.stride+X.offset;else E=K[R]*U;for(let F=0;F<U;F++)q[O++]=H[E++]}return new HJ(q,U,G)}if(this.index===null)return B0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new BJ,$=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 q=H[U],E=J(q,$);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,q=H.length;G<q;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 q=0,E=G.length;q<E;q++)U.push(G[q].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 m6{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=N9()}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=N9();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=N9();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 A;class E6{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)$=F9($,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=F9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=F9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=F9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=F9(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){y6("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 HJ(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 E6(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){y6("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 bH=0;class eJ extends w9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:bH++}),this.uuid=N9(),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 k0(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){B0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){B0(`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 p9=new A,aQ=new A,D7=new A,W8=new A,rQ=new A,M7=new A,tQ=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,p9)),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=p9.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return p9.copy(this.origin).addScaledVector(this.direction,Q),p9.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){aQ.copy(J).add(Q).multiplyScalar(0.5),D7.copy(Q).sub(J).normalize(),W8.copy(this.origin).sub(aQ);let W=J.distanceTo(Q)*0.5,Y=-this.direction.dot(D7),X=W8.dot(this.direction),K=-W8.dot(D7),H=W8.lengthSq(),U=Math.abs(1-Y*Y),G,q,E,O;if(U>0)if(G=Y*K-X,q=Y*X-K,O=W*U,G>=0)if(q>=-O)if(q<=O){let R=1/U;G*=R,q*=R,E=G*(G+Y*q+2*X)+q*(Y*G+q+2*K)+H}else q=W,G=Math.max(0,-(Y*q+X)),E=-G*G+q*(q+2*K)+H;else q=-W,G=Math.max(0,-(Y*q+X)),E=-G*G+q*(q+2*K)+H;else if(q<=-O)G=Math.max(0,-(-Y*W+X)),q=G>0?-W:Math.min(Math.max(-W,-K),W),E=-G*G+q*(q+2*K)+H;else if(q<=O)G=0,q=Math.min(Math.max(-W,-K),W),E=q*(q+2*K)+H;else G=Math.max(0,-(Y*W+X)),q=G>0?W:Math.min(Math.max(-W,-K),W),E=-G*G+q*(q+2*K)+H;else q=Y>0?-W:W,G=Math.max(0,-(Y*q+X)),E=-G*G+q*(q+2*K)+H;if($)$.copy(this.origin).addScaledVector(this.direction,G);if(Z)Z.copy(aQ).addScaledVector(D7,q);return E}intersectSphere(J,Q){p9.subVectors(J.center,this.origin);let $=p9.dot(this.direction),Z=p9.dot(p9)-$*$,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,q=this.origin;if(H>=0)$=(J.min.x-q.x)*H,Z=(J.max.x-q.x)*H;else $=(J.max.x-q.x)*H,Z=(J.min.x-q.x)*H;if(U>=0)W=(J.min.y-q.y)*U,Y=(J.max.y-q.y)*U;else W=(J.max.y-q.y)*U,Y=(J.min.y-q.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-q.z)*G,K=(J.max.z-q.z)*G;else X=(J.max.z-q.z)*G,K=(J.min.z-q.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,p9)!==null}intersectTriangle(J,Q,$,Z,W){rQ.subVectors(Q,J),M7.subVectors($,J),tQ.crossVectors(rQ,M7);let Y=this.direction.dot(tQ),X;if(Y>0){if(Z)return null;X=1}else if(Y<0)X=-1,Y=-Y;else return null;W8.subVectors(this.origin,J);let K=X*this.direction.dot(M7.crossVectors(W8,M7));if(K<0)return null;let H=X*this.direction.dot(rQ.cross(W8));if(H<0)return null;if(K+H>Y)return null;let U=-X*W8.dot(tQ);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 P9 extends eJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new k0(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 l9,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 wW=new S0,D8=new q6,k7=new tJ,PW=new A,B7=new A,V7=new A,z7=new A,eQ=new A,C7=new A,TW=new A,I7=new A;class FJ extends EJ{constructor(J=new BJ,Q=new P9){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){C7.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(eQ.fromBufferAttribute(G,J),Y)C7.addScaledVector(eQ,U);else C7.addScaledVector(eQ.sub(Q),U)}Q.add(C7)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(k7.copy($.boundingSphere),k7.applyMatrix4(W),D8.copy(J.ray).recast(J.near),k7.containsPoint(D8.origin)===!1){if(D8.intersectSphere(k7,PW)===null)return;if(D8.origin.distanceToSquared(PW)>(J.far-J.near)**2)return}if(wW.copy(W).invert(),D8.copy(J.ray).applyMatrix4(wW),$.boundingBox!==null){if(D8.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,D8)}_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,q=W.groups,E=W.drawRange;if(X!==null)if(Array.isArray(Y))for(let O=0,R=q.length;O<R;O++){let k=q[O],F=Y[k.materialIndex],N=Math.max(k.start,E.start),D=Math.min(X.count,Math.min(k.start+k.count,E.start+E.count));for(let B=N,C=D;B<C;B+=3){let T=X.getX(B),P=X.getX(B+1),_=X.getX(B+2);if(Z=_7(this,F,J,$,H,U,G,T,P,_),Z)Z.faceIndex=Math.floor(B/3),Z.face.materialIndex=k.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(X.count,E.start+E.count);for(let k=O,F=R;k<F;k+=3){let N=X.getX(k),D=X.getX(k+1),B=X.getX(k+2);if(Z=_7(this,Y,J,$,H,U,G,N,D,B),Z)Z.faceIndex=Math.floor(k/3),Q.push(Z)}}else if(K!==void 0)if(Array.isArray(Y))for(let O=0,R=q.length;O<R;O++){let k=q[O],F=Y[k.materialIndex],N=Math.max(k.start,E.start),D=Math.min(K.count,Math.min(k.start+k.count,E.start+E.count));for(let B=N,C=D;B<C;B+=3){let T=B,P=B+1,_=B+2;if(Z=_7(this,F,J,$,H,U,G,T,P,_),Z)Z.faceIndex=Math.floor(B/3),Z.face.materialIndex=k.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(K.count,E.start+E.count);for(let k=O,F=R;k<F;k+=3){let N=k,D=k+1,B=k+2;if(Z=_7(this,Y,J,$,H,U,G,N,D,B),Z)Z.faceIndex=Math.floor(k/3),Q.push(Z)}}}}function gH(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;I7.copy(K),I7.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(I7);if(U<$.near||U>$.far)return null;return{distance:U,point:I7.clone(),object:J}}function _7(J,Q,$,Z,W,Y,X,K,H,U){J.getVertexPosition(K,B7),J.getVertexPosition(H,V7),J.getVertexPosition(U,z7);let G=gH(J,Q,$,Z,B7,V7,z7,TW);if(G){let q=new A;if(Z9.getBarycoord(TW,B7,V7,z7,q),W)G.uv=Z9.getInterpolatedAttribute(W,K,H,U,q,new h0);if(Y)G.uv1=Z9.getInterpolatedAttribute(Y,K,H,U,q,new h0);if(X){if(G.normal=Z9.getInterpolatedAttribute(X,K,H,U,q,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};Z9.getNormal(B7,V7,z7,E.normal),G.face=E,G.barycoord=q}return G}var P6=new JJ,AW=new JJ,SW=new JJ,pH=new JJ,jW=new S0,w7=new A,J$=new tJ,vW=new S0,Q$=new q6;class WQ extends FJ{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new S0,this.bindMatrixInverse=new S0,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let J=this.geometry;if(this.boundingBox===null)this.boundingBox=new nJ;this.boundingBox.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,w7),this.boundingBox.expandByPoint(w7)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new tJ;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,w7),this.boundingSphere.expandByPoint(w7)}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(J$.copy(this.boundingSphere),J$.applyMatrix4(Z),J.ray.intersectsSphere(J$)===!1)return;if(vW.copy(Z).invert(),Q$.copy(J.ray).applyMatrix4(vW),this.boundingBox!==null){if(Q$.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,Q$)}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 JJ,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 B0("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(J,Q){let $=this.skeleton,Z=this.geometry;if(AW.fromBufferAttribute(Z.attributes.skinIndex,J),SW.fromBufferAttribute(Z.attributes.skinWeight,J),Q.isVector4)P6.copy(Q),Q.set(0,0,0,0);else P6.set(...Q,1),Q.set(0,0,0);P6.applyMatrix4(this.bindMatrix);for(let W=0;W<4;W++){let Y=SW.getComponent(W);if(Y!==0){let X=AW.getComponent(W);jW.multiplyMatrices($.bones[X].matrixWorld,$.boneInverses[X]),Q.addScaledVector(pH.copy(P6).applyMatrix4(jW),Y)}}if(Q.isVector4)Q.w=P6.w;return Q.applyMatrix4(this.bindMatrixInverse)}}class l6 extends EJ{constructor(){super();this.isBone=!0,this.type="Bone"}}class F6 extends _J{constructor(J=null,Q=1,$=1,Z,W,Y,X,K,H=1003,U=1003,G,q){super(null,Y,X,K,H,U,Z,W,G,q);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var yW=new S0,dH=new S0;class c6{constructor(J=[],Q=[]){this.uuid=N9(),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){B0("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 S0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new S0;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:dH;yW.multiplyMatrices(X,Q[W]),yW.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new c6(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 F6(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)B0("Skeleton: No bone found with UUID:",W),Y=new l6;this.bones.push(Y),this.boneInverses.push(new S0().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 B8 extends HJ{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 o8=new S0,fW=new S0,P7=[],xW=new nJ,uH=new S0,T6=new FJ,A6=new tJ;class N6 extends FJ{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new B8(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,uH)}computeBoundingBox(){let J=this.geometry,Q=this.count;if(this.boundingBox===null)this.boundingBox=new nJ;if(J.boundingBox===null)J.computeBoundingBox();this.boundingBox.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,o8),xW.copy(J.boundingBox).applyMatrix4(o8),this.boundingBox.union(xW)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new tJ;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,o8),A6.copy(J.boundingSphere).applyMatrix4(o8),this.boundingSphere.union(A6)}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(T6.geometry=this.geometry,T6.material=this.material,T6.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(A6.copy(this.boundingSphere),A6.applyMatrix4($),J.ray.intersectsSphere(A6)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,o8),fW.multiplyMatrices($,o8),T6.matrixWorld=fW,T6.raycast(J,P7);for(let Y=0,X=P7.length;Y<X;Y++){let K=P7[Y];K.instanceId=W,K.object=this,Q.push(K)}P7.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new B8(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 F6(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 $$=new A,mH=new A,lH=new v0;class q9{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=$$.subVectors($,Q).cross(mH.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($$),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||lH.getNormalMatrix(J),Z=this.coplanarPoint($$).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 M8=new tJ,cH=new h0(0.5,0.5),T7=new A;class A8{constructor(J=new q9,Q=new q9,$=new q9,Z=new q9,W=new q9,Y=new q9){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],q=W[6],E=W[7],O=W[8],R=W[9],k=W[10],F=W[11],N=W[12],D=W[13],B=W[14],C=W[15];if(Z[0].setComponents(H-Y,E-U,F-O,C-N).normalize(),Z[1].setComponents(H+Y,E+U,F+O,C+N).normalize(),Z[2].setComponents(H+X,E+G,F+R,C+D).normalize(),Z[3].setComponents(H-X,E-G,F-R,C-D).normalize(),$)Z[4].setComponents(K,q,k,B).normalize(),Z[5].setComponents(H-K,E-q,F-k,C-B).normalize();else if(Z[4].setComponents(H-K,E-q,F-k,C-B).normalize(),Q===2000)Z[5].setComponents(H+K,E+q,F+k,C+B).normalize();else if(Q===2001)Z[5].setComponents(K,q,k,B).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();M8.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();M8.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(M8)}intersectsSprite(J){M8.center.set(0,0,0);let Q=cH.distanceTo(J.center);return M8.radius=0.7071067811865476+Q,M8.applyMatrix4(J.matrixWorld),this.intersectsSphere(M8)}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(T7.x=Z.normal.x>0?J.max.x:J.min.x,T7.y=Z.normal.y>0?J.max.y:J.min.y,T7.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(T7)<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 n6 extends eJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new k0(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 b7=new A,g7=new A,hW=new S0,S6=new q6,A7=new tJ,Z$=new A,bW=new A;class O6 extends EJ{constructor(J=new BJ,Q=new n6){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++)b7.fromBufferAttribute(Q,Z-1),g7.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=b7.distanceTo(g7);J.setAttribute("lineDistance",new qJ($,1))}else B0("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(A7.copy($.boundingSphere),A7.applyMatrix4(Z),A7.radius+=W,J.ray.intersectsSphere(A7)===!1)return;hW.copy(Z).invert(),S6.copy(J.ray).applyMatrix4(hW);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=this.isLineSegments?2:1,U=$.index,q=$.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,k=O-1;R<k;R+=H){let F=U.getX(R),N=U.getX(R+1),D=S7(this,J,S6,K,F,N,R);if(D)Q.push(D)}if(this.isLineLoop){let R=U.getX(O-1),k=U.getX(E),F=S7(this,J,S6,K,R,k,O-1);if(F)Q.push(F)}}else{let E=Math.max(0,Y.start),O=Math.min(q.count,Y.start+Y.count);for(let R=E,k=O-1;R<k;R+=H){let F=S7(this,J,S6,K,R,R+1,R);if(F)Q.push(F)}if(this.isLineLoop){let R=S7(this,J,S6,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 S7(J,Q,$,Z,W,Y,X){let K=J.geometry.attributes.position;if(b7.fromBufferAttribute(K,W),g7.fromBufferAttribute(K,Y),$.distanceSqToSegment(b7,g7,Z$,bW)>Z)return;Z$.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(Z$);if(U<Q.near||U>Q.far)return;return{distance:U,point:bW.clone().applyMatrix4(J.matrixWorld),index:X,face:null,faceIndex:null,barycoord:null,object:J}}var gW=new A,pW=new A;class YQ extends O6{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)gW.fromBufferAttribute(Q,Z),pW.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+gW.distanceTo(pW);J.setAttribute("lineDistance",new qJ($,1))}else B0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class XQ extends O6{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}}class s6 extends eJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new k0(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 dW=new S0,U$=new q6,j7=new tJ,v7=new A;class s9 extends EJ{constructor(J=new BJ,Q=new s6){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(j7.copy($.boundingSphere),j7.applyMatrix4(Z),j7.radius+=W,J.ray.intersectsSphere(j7)===!1)return;dW.copy(Z).invert(),U$.copy(J.ray).applyMatrix4(dW);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 q=Math.max(0,Y.start),E=Math.min(H.count,Y.start+Y.count);for(let O=q,R=E;O<R;O++){let k=H.getX(O);v7.fromBufferAttribute(G,k),uW(v7,k,K,Z,J,Q,this)}}else{let q=Math.max(0,Y.start),E=Math.min(G.count,Y.start+Y.count);for(let O=q,R=E;O<R;O++)v7.fromBufferAttribute(G,O),uW(v7,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 uW(J,Q,$,Z,W,Y,X){let K=U$.distanceSqToPoint(J);if(K<$){let H=new A;U$.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 KQ extends _J{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 U8 extends _J{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 q={width:J,height:Q,depth:G};super(q,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 d6(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 qZ extends U8{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 HQ extends _J{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class Y9 extends BJ{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=[],q=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 qJ(H,3)),this.setAttribute("normal",new qJ(U,3)),this.setAttribute("uv",new qJ(G,2));function O(R,k,F,N,D,B,C,T,P,_,L){let z=B/P,S=C/_,I=B/2,j=C/2,b=T/2,v=P+1,x=_+1,p=0,d=0,n=new A;for(let r=0;r<x;r++){let Y0=r*S-j;for(let R0=0;R0<v;R0++){let G0=R0*z-I;n[R]=G0*N,n[k]=Y0*D,n[F]=b,H.push(n.x,n.y,n.z),n[R]=0,n[k]=0,n[F]=T>0?1:-1,U.push(n.x,n.y,n.z),G.push(R0/P),G.push(1-r/_),p+=1}}for(let r=0;r<_;r++)for(let Y0=0;Y0<P;Y0++){let R0=q+Y0+v*r,G0=q+Y0+v*(r+1),a0=q+(Y0+1)+v*(r+1),n0=q+(Y0+1)+v*r;K.push(R0,G0,n0),K.push(G0,a0,n0),d+=6}X.addGroup(E,d,L),E+=d,q+=p}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new Y9(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class i6 extends BJ{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=[],q=[],E=[],O=0,R=[],k=$/2,F=0;if(N(),Y===!1){if(J>0)D(!0);if(Q>0)D(!1)}this.setIndex(U),this.setAttribute("position",new qJ(G,3)),this.setAttribute("normal",new qJ(q,3)),this.setAttribute("uv",new qJ(E,2));function N(){let B=new A,C=new A,T=0,P=(Q-J)/$;for(let _=0;_<=W;_++){let L=[],z=_/W,S=z*(Q-J)+J;for(let I=0;I<=Z;I++){let j=I/Z,b=j*K+X,v=Math.sin(b),x=Math.cos(b);C.x=S*v,C.y=-z*$+k,C.z=S*x,G.push(C.x,C.y,C.z),B.set(v,P,x).normalize(),q.push(B.x,B.y,B.z),E.push(j,1-z),L.push(O++)}R.push(L)}for(let _=0;_<Z;_++)for(let L=0;L<W;L++){let z=R[L][_],S=R[L+1][_],I=R[L+1][_+1],j=R[L][_+1];if(J>0||L!==0)U.push(z,S,j),T+=3;if(Q>0||L!==W-1)U.push(S,I,j),T+=3}H.addGroup(F,T,0),F+=T}function D(B){let C=O,T=new h0,P=new A,_=0,L=B===!0?J:Q,z=B===!0?1:-1;for(let I=1;I<=Z;I++)G.push(0,k*z,0),q.push(0,z,0),E.push(0.5,0.5),O++;let S=O;for(let I=0;I<=Z;I++){let b=I/Z*K+X,v=Math.cos(b),x=Math.sin(b);P.x=L*x,P.y=k*z,P.z=L*v,G.push(P.x,P.y,P.z),q.push(0,z,0),T.x=v*0.5+0.5,T.y=x*0.5*z+0.5,E.push(T.x,T.y),O++}for(let I=0;I<Z;I++){let j=C+I,b=S+I;if(B===!0)U.push(b,b+1,j);else U.push(b+1,b,j);_+=3}H.addGroup(F,_,B===!0?1:2),F+=_}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new i6(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class UQ extends BJ{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 qJ(W,3)),this.setAttribute("normal",new qJ(W.slice(),3)),this.setAttribute("uv",new qJ(Y,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function X(N){let D=new A,B=new A,C=new A;for(let T=0;T<Q.length;T+=3)E(Q[T+0],D),E(Q[T+1],B),E(Q[T+2],C),K(D,B,C,N)}function K(N,D,B,C){let T=C+1,P=[];for(let _=0;_<=T;_++){P[_]=[];let L=N.clone().lerp(B,_/T),z=D.clone().lerp(B,_/T),S=T-_;for(let I=0;I<=S;I++)if(I===0&&_===T)P[_][I]=L;else P[_][I]=L.clone().lerp(z,I/S)}for(let _=0;_<T;_++)for(let L=0;L<2*(T-_)-1;L++){let z=Math.floor(L/2);if(L%2===0)q(P[_][z+1]),q(P[_+1][z]),q(P[_][z]);else q(P[_][z+1]),q(P[_+1][z+1]),q(P[_+1][z])}}function H(N){let D=new A;for(let B=0;B<W.length;B+=3)D.x=W[B+0],D.y=W[B+1],D.z=W[B+2],D.normalize().multiplyScalar(N),W[B+0]=D.x,W[B+1]=D.y,W[B+2]=D.z}function U(){let N=new A;for(let D=0;D<W.length;D+=3){N.x=W[D+0],N.y=W[D+1],N.z=W[D+2];let B=k(N)/2/Math.PI+0.5,C=F(N)/Math.PI+0.5;Y.push(B,1-C)}O(),G()}function G(){for(let N=0;N<Y.length;N+=6){let D=Y[N+0],B=Y[N+2],C=Y[N+4],T=Math.max(D,B,C),P=Math.min(D,B,C);if(T>0.9&&P<0.1){if(D<0.2)Y[N+0]+=1;if(B<0.2)Y[N+2]+=1;if(C<0.2)Y[N+4]+=1}}}function q(N){W.push(N.x,N.y,N.z)}function E(N,D){let B=N*3;D.x=J[B+0],D.y=J[B+1],D.z=J[B+2]}function O(){let N=new A,D=new A,B=new A,C=new A,T=new h0,P=new h0,_=new h0;for(let L=0,z=0;L<W.length;L+=9,z+=6){N.set(W[L+0],W[L+1],W[L+2]),D.set(W[L+3],W[L+4],W[L+5]),B.set(W[L+6],W[L+7],W[L+8]),T.set(Y[z+0],Y[z+1]),P.set(Y[z+2],Y[z+3]),_.set(Y[z+4],Y[z+5]),C.copy(N).add(D).add(B).divideScalar(3);let S=k(C);R(T,z+0,N,S),R(P,z+2,D,S),R(_,z+4,B,S)}}function R(N,D,B,C){if(C<0&&N.x===1)Y[D]=N.x-1;if(B.x===0&&B.z===0)Y[D]=C/2/Math.PI+0.5}function k(N){return Math.atan2(N.z,-N.x)}function F(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 UQ(J.vertices,J.indices,J.radius,J.detail)}}class FZ{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){B0("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],q=$[Z+1]-U,E=(Y-U)/q;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 h0: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 S0;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),q=Math.abs(Z[0].z);if(U<=H)H=U,$.set(1,0,0);if(G<=H)H=G,$.set(0,1,0);if(q<=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(g0(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(g0(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 NZ(){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,q){let E=(X-Y)/U-(K-Y)/(U+G)+(K-X)/G,O=(K-X)/G-(H-X)/(G+q)+(H-K)/q;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 mW=new A,lW=new A,W$=new NZ,Y$=new NZ,X$=new NZ;class GQ extends FZ{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 lW.subVectors(Z[0],Z[1]).add(Z[0]),H=lW;let G=Z[X%W],q=Z[(X+1)%W];if(this.closed||X+2<W)U=Z[(X+2)%W];else mW.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=mW;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(q),E),k=Math.pow(q.distanceToSquared(U),E);if(R<0.0001)R=1;if(O<0.0001)O=R;if(k<0.0001)k=R;W$.initNonuniformCatmullRom(H.x,G.x,q.x,U.x,O,R,k),Y$.initNonuniformCatmullRom(H.y,G.y,q.y,U.y,O,R,k),X$.initNonuniformCatmullRom(H.z,G.z,q.z,U.z,O,R,k)}else if(this.curveType==="catmullrom")W$.initCatmullRom(H.x,G.x,q.x,U.x,this.tension),Y$.initCatmullRom(H.y,G.y,q.y,U.y,this.tension),X$.initCatmullRom(H.z,G.z,q.z,U.z,this.tension);return $.set(W$.calc(K),Y$.calc(K),X$.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}}class o6 extends UQ{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 o6(J.radius,J.detail)}}class L9 extends BJ{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,q=Q/K,E=[],O=[],R=[],k=[];for(let F=0;F<U;F++){let N=F*q-Y;for(let D=0;D<H;D++){let B=D*G-W;O.push(B,-N,0),R.push(0,0,1),k.push(D/X),k.push(1-F/K)}}for(let F=0;F<K;F++)for(let N=0;N<X;N++){let D=N+H*F,B=N+H*(F+1),C=N+1+H*(F+1),T=N+1+H*F;E.push(D,B,T),E.push(B,C,T)}this.setIndex(E),this.setAttribute("position",new qJ(O,3)),this.setAttribute("normal",new qJ(R,3)),this.setAttribute("uv",new qJ(k,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new L9(J.width,J.height,J.widthSegments,J.heightSegments)}}class a6 extends BJ{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,q=new A,E=[],O=[],R=[],k=[];for(let F=0;F<=$;F++){let N=[],D=F/$,B=0;if(F===0&&Y===0)B=0.5/Q;else if(F===$&&K===Math.PI)B=-0.5/Q;for(let C=0;C<=Q;C++){let T=C/Q;G.x=-J*Math.cos(Z+T*W)*Math.sin(Y+D*X),G.y=J*Math.cos(Y+D*X),G.z=J*Math.sin(Z+T*W)*Math.sin(Y+D*X),O.push(G.x,G.y,G.z),q.copy(G).normalize(),R.push(q.x,q.y,q.z),k.push(T+B,1-D),N.push(H++)}U.push(N)}for(let F=0;F<$;F++)for(let N=0;N<Q;N++){let D=U[F][N+1],B=U[F][N],C=U[F+1][N],T=U[F+1][N+1];if(F!==0||Y>0)E.push(D,B,T);if(F!==$-1||K<Math.PI)E.push(B,C,T)}this.setIndex(E),this.setAttribute("position",new qJ(O,3)),this.setAttribute("normal",new qJ(R,3)),this.setAttribute("uv",new qJ(k,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new a6(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class r6 extends BJ{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=[],q=new A,E=new A,O=new A;for(let R=0;R<=$;R++){let k=Y+R/$*X;for(let F=0;F<=Z;F++){let N=F/Z*W;E.x=(J+Q*Math.cos(k))*Math.cos(N),E.y=(J+Q*Math.cos(k))*Math.sin(N),E.z=Q*Math.sin(k),H.push(E.x,E.y,E.z),q.x=J*Math.cos(N),q.y=J*Math.sin(N),O.subVectors(E,q).normalize(),U.push(O.x,O.y,O.z),G.push(F/Z),G.push(R/$)}}for(let R=1;R<=$;R++)for(let k=1;k<=Z;k++){let F=(Z+1)*R+k-1,N=(Z+1)*(R-1)+k-1,D=(Z+1)*(R-1)+k,B=(Z+1)*R+k;K.push(F,N,B),K.push(N,D,B)}this.setIndex(K),this.setAttribute("position",new qJ(H,3)),this.setAttribute("normal",new qJ(U,3)),this.setAttribute("uv",new qJ(G,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new r6(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}function S8(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(cW(W))if(W.isRenderTargetTexture)B0("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(cW(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 gJ(J){let Q={};for(let $=0;$<J.length;$++){let Z=S8(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function cW(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function nH(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function OZ(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return l0.workingColorSpace}var j8={clone:S8,merge:gJ},sH=`void main() {
1
+ var $Y="184";var ZY=0,F$=1,WY=2;var b6=1,YY=2,Z6=3,z9=0,bJ=1,cJ=2,w9=0,V8=1,f6=2,N$=3,O$=4,XY=5;var W6=100,KY=101,HY=102,UY=103,GY=104,EY=200,FY=201,NY=202,OY=203,qY=204,RY=205,LY=206,DY=207,MY=208,kY=209,BY=210,VY=211,CY=212,IY=213,zY=214,wY=0,PY=1,_Y=2,q$=3,TY=4,AY=5,SY=6,jY=7,vY=0,yY=1,hY=2,rJ=0,R$=1,L$=2,D$=3,g6=4,M$=5,k$=6,B$=7;var Y6=301,C8=302,u7=303,m7=304,p6=306,X8=1000,X6=1001,l7=1002,L9=1003,c7=1004;var I8=1005;var BJ=1006,K6=1007;var P9=1008;var D9=1009,xY=1010,bY=1011,d6=1012,V$=1013,K8=1014,tJ=1015,fJ=1016,C$=1017,I$=1018,H6=1020,fY=35902,gY=35899,pY=1021,dY=1022,_9=1023,z8=1026,w8=1027,uY=1028,z$=1029,P8=1030,w$=1031;var P$=1033,n7=33776,s7=33777,i7=33778,o7=33779,_$=35840,T$=35841,A$=35842,S$=35843,j$=36196,v$=37492,y$=37496,h$=37488,x$=37489,a7=37490,b$=37491,f$=37808,g$=37809,p$=37810,d$=37811,u$=37812,m$=37813,l$=37814,c$=37815,n$=37816,s$=37817,i$=37818,o$=37819,a$=37820,r$=37821,t$=36492,e$=36494,JZ=36495,QZ=36283,$Z=36284,r7=36285,ZZ=36286;var WZ=2300,t7=2301;var YZ=0,u6=1,U6=2;var XZ=0,mY=1,_8="",H8="srgb",uJ="srgb-linear",KZ="linear",UJ="srgb";var lY=512,cY=513,nY=514,e7=515,sY=516,iY=517,JQ=518,oY=519;var G6=35048;var HZ="300 es",UZ=2000;function GH(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function EH(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function J6(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function aY(){let J=J6("canvas");return J.style.display="block",J}var DW={},Q6=null;function x6(...J){let Q="THREE."+J.shift();if(Q6)Q6("log",Q,...J);else console.log(Q,...J)}function rY(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=rY(J);let Q="THREE."+J.shift();if(Q6)Q6("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function A0(...J){J=rY(J);let Q="THREE."+J.shift();if(Q6)Q6("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function g7(...J){let Q=J.join(" ");if(Q in DW)return;DW[Q]=!0,C0(...J)}function tY(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 eY={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class T9{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 hJ=["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"],MW=1234567,y6=Math.PI/180,k8=180/Math.PI;function R9(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,Z=Math.random()*4294967295|0;return(hJ[J&255]+hJ[J>>8&255]+hJ[J>>16&255]+hJ[J>>24&255]+"-"+hJ[Q&255]+hJ[Q>>8&255]+"-"+hJ[Q>>16&15|64]+hJ[Q>>24&255]+"-"+hJ[$&63|128]+hJ[$>>8&255]+"-"+hJ[$>>16&255]+hJ[$>>24&255]+hJ[Z&255]+hJ[Z>>8&255]+hJ[Z>>16&255]+hJ[Z>>24&255]).toLowerCase()}function m0(J,Q,$){return Math.max(Q,Math.min($,J))}function GZ(J,Q){return(J%Q+Q)%Q}function FH(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function NH(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function h6(J,Q,$){return(1-$)*J+$*Q}function OH(J,Q,$,Z){return h6(J,Q,1-Math.exp(-$*Z))}function qH(J,Q=1){return Q-Math.abs(GZ(J,Q*2)-Q)}function RH(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function LH(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 DH(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function MH(J,Q){return J+Math.random()*(Q-J)}function kH(J){return J*(0.5-Math.random())}function BH(J){if(J!==void 0)MW=J;let Q=MW+=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 VH(J){return J*y6}function CH(J){return J*k8}function IH(J){return(J&J-1)===0&&J!==0}function zH(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function wH(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function PH(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 q9(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 $J(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 E6={DEG2RAD:y6,RAD2DEG:k8,generateUUID:R9,clamp:m0,euclideanModulo:GZ,mapLinear:FH,inverseLerp:NH,lerp:h6,damp:OH,pingpong:qH,smoothstep:RH,smootherstep:LH,randInt:DH,randFloat:MH,randFloatSpread:kH,seededRandom:BH,degToRad:VH,radToDeg:CH,isPowerOfTwo:IH,ceilPowerOfTwo:zH,floorPowerOfTwo:wH,setQuaternionFromProperEuler:PH,normalize:$J,denormalize:q9};class p0{static{p0.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=m0(this.x,J.x,Q.x),this.y=m0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=m0(this.x,J,Q),this.y=m0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(m0($,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(m0($,-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 PJ{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(m0(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 j{static{j.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(kW.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(kW.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=m0(this.x,J.x,Q.x),this.y=m0(this.y,J.y,Q.y),this.z=m0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=m0(this.x,J,Q),this.y=m0(this.y,J,Q),this.z=m0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(m0($,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 xQ.copy(this).projectOnVector(J),this.sub(xQ)}reflect(J){return this.sub(xQ.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(m0($,-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 xQ=new j,kW=new PJ;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],M=Z[7],k=Z[2],_=Z[5],P=Z[8];return W[0]=Y*R+X*N+K*k,W[3]=Y*C+X*L+K*_,W[6]=Y*q+X*M+K*P,W[1]=H*R+U*N+G*k,W[4]=H*C+U*L+G*_,W[7]=H*q+U*M+G*P,W[2]=F*R+E*N+O*k,W[5]=F*C+E*L+O*_,W[8]=F*q+E*M+O*P,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(bQ.makeScale(J,Q)),this}rotate(J){return this.premultiply(bQ.makeRotation(-J)),this}translate(J,Q){return this.premultiply(bQ.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 bQ=new h0,BW=new h0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),VW=new h0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function _H(){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=m9(W.r),W.g=m9(W.g),W.b=m9(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=e8(W.r),W.g=e8(W.g),W.b=e8(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 g7("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,Y)},toWorkingColorSpace:function(W,Y){return g7("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:VW,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:BW,fromXYZ:VW,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var s0=_H();function m9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function e8(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var g8;class EZ{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(g8===void 0)g8=J6("canvas");g8.width=J.width,g8.height=J.height;let Z=g8.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=g8}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=J6("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]=m9(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(m9(Q[$]/255)*255);else Q[$]=m9(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 TH=0;class m6{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:TH++}),this.uuid=R9(),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(fQ(Z[Y].image));else W.push(fQ(Z[Y]))}else W=fQ(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function fQ(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return EZ.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 AH=0,gQ=new j;class wJ extends T9{constructor(J=wJ.DEFAULT_IMAGE,Q=wJ.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,Y=1008,X=1023,K=1009,H=wJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:AH++}),this.uuid=R9(),this.name="",this.source=new m6(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 p0(0,0),this.repeat=new p0(1,1),this.center=new p0(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(gQ).x}get height(){return this.source.getSize(gQ).y}get depth(){return this.source.getSize(gQ).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++}}wJ.DEFAULT_IMAGE=null;wJ.DEFAULT_MAPPING=300;wJ.DEFAULT_ANISOTROPY=1;class QJ{static{QJ.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,M=(E+1)/2,k=(q+1)/2,_=(U+F)/4,P=(G+R)/4,V=(O+C)/4;if(L>M&&L>k)if(L<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(L),Z=_/$,W=P/$;else if(M>k)if(M<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(M),$=_/Z,W=V/Z;else if(k<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(k),$=P/W,Z=V/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=m0(this.x,J.x,Q.x),this.y=m0(this.y,J.y,Q.y),this.z=m0(this.z,J.z,Q.z),this.w=m0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=m0(this.x,J,Q),this.y=m0(this.y,J,Q),this.z=m0(this.z,J,Q),this.w=m0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(m0($,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 FZ extends T9{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 QJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new QJ(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new wJ(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 m6(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 nJ extends FZ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class QQ extends wJ{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 NZ extends wJ{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 S0{static{S0.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 S0().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/p8.setFromMatrixColumn(J,0).length(),W=1/p8.setFromMatrixColumn(J,1).length(),Y=1/p8.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(SH,J,jH)}lookAt(J,Q,$){let Z=this.elements;if(oJ.subVectors(J,Q),oJ.lengthSq()===0)oJ.z=1;if(oJ.normalize(),J8.crossVectors($,oJ),J8.lengthSq()===0){if(Math.abs($.z)===1)oJ.x+=0.0001;else oJ.z+=0.0001;oJ.normalize(),J8.crossVectors($,oJ)}return J8.normalize(),N7.crossVectors(oJ,J8),Z[0]=J8.x,Z[4]=N7.x,Z[8]=oJ.x,Z[1]=J8.y,Z[5]=N7.y,Z[9]=oJ.y,Z[2]=J8.z,Z[6]=N7.z,Z[10]=oJ.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],M=$[11],k=$[15],_=Z[0],P=Z[4],V=Z[8],D=Z[12],B=Z[1],A=Z[5],z=Z[9],S=Z[13],y=Z[2],v=Z[6],h=Z[10],g=Z[14],p=Z[3],c=Z[7],a=Z[11],Q0=Z[15];return W[0]=Y*_+X*B+K*y+H*p,W[4]=Y*P+X*A+K*v+H*c,W[8]=Y*V+X*z+K*h+H*a,W[12]=Y*D+X*S+K*g+H*Q0,W[1]=U*_+G*B+F*y+E*p,W[5]=U*P+G*A+F*v+E*c,W[9]=U*V+G*z+F*h+E*a,W[13]=U*D+G*S+F*g+E*Q0,W[2]=O*_+R*B+C*y+q*p,W[6]=O*P+R*A+C*v+q*c,W[10]=O*V+R*z+C*h+q*a,W[14]=O*D+R*S+C*g+q*Q0,W[3]=N*_+L*B+M*y+k*p,W[7]=N*P+L*A+M*v+k*c,W[11]=N*V+L*z+M*h+k*a,W[15]=N*D+L*S+M*g+k*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,M=X*F-K*G,k=Y*E-H*U,_=Y*F-K*U,P=Y*G-X*U;return Q*(R*N-C*L+q*M)-$*(O*N-C*k+q*_)+Z*(O*L-R*k+q*P)-W*(O*M-R*_+C*P)}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,M=Q*H-W*Y,k=$*K-Z*X,_=$*H-W*X,P=Z*H-W*K,V=U*R-G*O,D=U*C-F*O,B=U*q-E*O,A=G*C-F*R,z=G*q-E*R,S=F*q-E*C,y=N*S-L*z+M*A+k*B-_*D+P*V;if(y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let v=1/y;return J[0]=(X*S-K*z+H*A)*v,J[1]=(Z*z-$*S-W*A)*v,J[2]=(R*P-C*_+q*k)*v,J[3]=(F*_-G*P-E*k)*v,J[4]=(K*B-Y*S-H*D)*v,J[5]=(Q*S-Z*B+W*D)*v,J[6]=(C*M-O*P-q*L)*v,J[7]=(U*P-F*M+E*L)*v,J[8]=(Y*z-X*B+H*V)*v,J[9]=($*B-Q*z-W*V)*v,J[10]=(O*_-R*M+q*N)*v,J[11]=(G*M-U*_-E*N)*v,J[12]=(X*D-Y*A-K*V)*v,J[13]=(Q*A-$*D+Z*V)*v,J[14]=(R*L-O*k-C*N)*v,J[15]=(U*k-G*L+F*N)*v,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,M=K*G,k=$.x,_=$.y,P=$.z;return Z[0]=(1-(R+q))*k,Z[1]=(E+M)*k,Z[2]=(O-L)*k,Z[3]=0,Z[4]=(E-M)*_,Z[5]=(1-(F+q))*_,Z[6]=(C+N)*_,Z[7]=0,Z[8]=(O+L)*P,Z[9]=(C-N)*P,Z[10]=(1-(F+R))*P,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=p8.set(Z[0],Z[1],Z[2]).length(),X=p8.set(Z[4],Z[5],Z[6]).length(),K=p8.set(Z[8],Z[9],Z[10]).length();if(W<0)Y=-Y;E9.copy(this);let H=1/Y,U=1/X,G=1/K;return E9.elements[0]*=H,E9.elements[1]*=H,E9.elements[2]*=H,E9.elements[4]*=U,E9.elements[5]*=U,E9.elements[6]*=U,E9.elements[8]*=G,E9.elements[9]*=G,E9.elements[10]*=G,Q.setFromRotationMatrix(E9),$.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 p8=new j,E9=new S0,SH=new j(0,0,0),jH=new j(1,1,1),J8=new j,N7=new j,oJ=new j,CW=new S0,IW=new PJ;class l9{constructor(J=0,Q=0,$=0,Z=l9.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(m0(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(-m0(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(m0(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(-m0(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(m0(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(-m0(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 CW.makeRotationFromQuaternion(J),this.setFromRotationMatrix(CW,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return IW.setFromEuler(this),this.setFromQuaternion(IW,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}}l9.DEFAULT_ORDER="XYZ";class $Q{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 vH=0,zW=new j,d8=new PJ,x9=new S0,O7=new j,w6=new j,yH=new j,hH=new PJ,wW=new j(1,0,0),PW=new j(0,1,0),_W=new j(0,0,1),TW={type:"added"},xH={type:"removed"},u8={type:"childadded",child:null},pQ={type:"childremoved",child:null};class FJ extends T9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:vH++}),this.uuid=R9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=FJ.DEFAULT_UP.clone();let J=new j,Q=new l9,$=new PJ,Z=new j(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 S0},normalMatrix:{value:new h0}}),this.matrix=new S0,this.matrixWorld=new S0,this.matrixAutoUpdate=FJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=FJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new $Q,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 d8.setFromAxisAngle(J,Q),this.quaternion.multiply(d8),this}rotateOnWorldAxis(J,Q){return d8.setFromAxisAngle(J,Q),this.quaternion.premultiply(d8),this}rotateX(J){return this.rotateOnAxis(wW,J)}rotateY(J){return this.rotateOnAxis(PW,J)}rotateZ(J){return this.rotateOnAxis(_W,J)}translateOnAxis(J,Q){return zW.copy(J).applyQuaternion(this.quaternion),this.position.add(zW.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(wW,J)}translateY(J){return this.translateOnAxis(PW,J)}translateZ(J){return this.translateOnAxis(_W,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(x9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)O7.copy(J);else O7.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),w6.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)x9.lookAt(w6,O7,this.up);else x9.lookAt(O7,w6,this.up);if(this.quaternion.setFromRotationMatrix(x9),Z)x9.extractRotation(Z.matrixWorld),d8.setFromRotationMatrix(x9),this.quaternion.premultiply(d8.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 A0("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(TW),u8.child=J,this.dispatchEvent(u8),u8.child=null;else A0("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(xH),pQ.child=J,this.dispatchEvent(pQ),pQ.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),x9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),x9.multiply(J.parent.matrixWorld);return J.applyMatrix4(x9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(TW),u8.child=J,this.dispatchEvent(u8),u8.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(w6,J,yH),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(w6,hH,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}}FJ.DEFAULT_UP=new j(0,1,0);FJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;FJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class W9 extends FJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var bH={type:"move"};class l6{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new W9,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 W9,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new W9,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j,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(bH)}}}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 W9;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var JX={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},Q8={h:0,s:0,l:0},q7={h:0,s:0,l:0};function dQ(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 R0{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,s0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=s0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,s0.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=s0.workingColorSpace){if(J=GZ(J,1),Q=m0(Q,0,1),$=m0($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,Y=2*$-W;this.r=dQ(Y,W,J+0.3333333333333333),this.g=dQ(Y,W,J),this.b=dQ(Y,W,J-0.3333333333333333)}return s0.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 $=JX[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=m9(J.r),this.g=m9(J.g),this.b=m9(J.b),this}copyLinearToSRGB(J){return this.r=e8(J.r),this.g=e8(J.g),this.b=e8(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return s0.workingToColorSpace(xJ.copy(this),J),Math.round(m0(xJ.r*255,0,255))*65536+Math.round(m0(xJ.g*255,0,255))*256+Math.round(m0(xJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=s0.workingColorSpace){s0.workingToColorSpace(xJ.copy(this),Q);let{r:$,g:Z,b:W}=xJ,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=s0.workingColorSpace){return s0.workingToColorSpace(xJ.copy(this),Q),J.r=xJ.r,J.g=xJ.g,J.b=xJ.b,J}getStyle(J="srgb"){s0.workingToColorSpace(xJ.copy(this),J);let{r:Q,g:$,b:Z}=xJ;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(Q8),this.setHSL(Q8.h+J,Q8.s+Q,Q8.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(Q8),J.getHSL(q7);let $=h6(Q8.h,q7.h,Q),Z=h6(Q8.s,q7.s,Q),W=h6(Q8.l,q7.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 xJ=new R0;R0.NAMES=JX;class ZQ extends FJ{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 l9,this.environmentIntensity=1,this.environmentRotation=new l9,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 F9=new j,b9=new j,uQ=new j,f9=new j,m8=new j,l8=new j,AW=new j,mQ=new j,lQ=new j,cQ=new j,nQ=new QJ,sQ=new QJ,iQ=new QJ;class Z9{constructor(J=new j,Q=new j,$=new j){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,Z){Z.subVectors($,Q),F9.subVectors(J,Q),Z.cross(F9);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){F9.subVectors(Z,Q),b9.subVectors($,Q),uQ.subVectors(J,Q);let Y=F9.dot(F9),X=F9.dot(b9),K=F9.dot(uQ),H=b9.dot(b9),U=b9.dot(uQ),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,f9)===null)return!1;return f9.x>=0&&f9.y>=0&&f9.x+f9.y<=1}static getInterpolation(J,Q,$,Z,W,Y,X,K){if(this.getBarycoord(J,Q,$,Z,f9)===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,f9.x),K.addScaledVector(Y,f9.y),K.addScaledVector(X,f9.z),K}static getInterpolatedAttribute(J,Q,$,Z,W,Y){return nQ.setScalar(0),sQ.setScalar(0),iQ.setScalar(0),nQ.fromBufferAttribute(J,Q),sQ.fromBufferAttribute(J,$),iQ.fromBufferAttribute(J,Z),Y.setScalar(0),Y.addScaledVector(nQ,W.x),Y.addScaledVector(sQ,W.y),Y.addScaledVector(iQ,W.z),Y}static isFrontFacing(J,Q,$,Z){return F9.subVectors($,Q),b9.subVectors(J,Q),F9.cross(b9).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 F9.subVectors(this.c,this.b),b9.subVectors(this.a,this.b),F9.cross(b9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return Z9.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return Z9.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return Z9.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return Z9.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return Z9.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;m8.subVectors(Z,$),l8.subVectors(W,$),mQ.subVectors(J,$);let K=m8.dot(mQ),H=l8.dot(mQ);if(K<=0&&H<=0)return Q.copy($);lQ.subVectors(J,Z);let U=m8.dot(lQ),G=l8.dot(lQ);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(m8,Y);cQ.subVectors(J,W);let E=m8.dot(cQ),O=l8.dot(cQ);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(l8,X);let C=U*O-E*G;if(C<=0&&G-U>=0&&E-O>=0)return AW.subVectors(W,Z),X=(G-U)/(G-U+(E-O)),Q.copy(Z).addScaledVector(AW,X);let q=1/(C+R+F);return Y=R*q,X=F*q,Q.copy($).addScaledVector(m8,Y).addScaledVector(l8,X)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class sJ{constructor(J=new j(1/0,1/0,1/0),Q=new j(-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(N9.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(N9.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 $=N9.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,N9);else N9.fromBufferAttribute(W,Y);N9.applyMatrix4(J.matrixWorld),this.expandByPoint(N9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();R7.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();R7.copy($.boundingBox)}R7.applyMatrix4(J.matrixWorld),this.union(R7)}}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,N9),N9.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(P6),L7.subVectors(this.max,P6),c8.subVectors(J.a,P6),n8.subVectors(J.b,P6),s8.subVectors(J.c,P6),$8.subVectors(n8,c8),Z8.subVectors(s8,n8),R8.subVectors(c8,s8);let Q=[0,-$8.z,$8.y,0,-Z8.z,Z8.y,0,-R8.z,R8.y,$8.z,0,-$8.x,Z8.z,0,-Z8.x,R8.z,0,-R8.x,-$8.y,$8.x,0,-Z8.y,Z8.x,0,-R8.y,R8.x,0];if(!oQ(Q,c8,n8,s8,L7))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!oQ(Q,c8,n8,s8,L7))return!1;return D7.crossVectors($8,Z8),Q=[D7.x,D7.y,D7.z],oQ(Q,c8,n8,s8,L7)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,N9).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(N9).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 g9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),g9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),g9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),g9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),g9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),g9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),g9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),g9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(g9),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 g9=[new j,new j,new j,new j,new j,new j,new j,new j],N9=new j,R7=new sJ,c8=new j,n8=new j,s8=new j,$8=new j,Z8=new j,R8=new j,P6=new j,L7=new j,D7=new j,L8=new j;function oQ(J,Q,$,Z,W){for(let Y=0,X=J.length-3;Y<=X;Y+=3){L8.fromArray(J,Y);let K=W.x*Math.abs(L8.x)+W.y*Math.abs(L8.y)+W.z*Math.abs(L8.z),H=Q.dot(L8),U=$.dot(L8),G=Z.dot(L8);if(Math.max(-Math.max(H,U,G),Math.min(H,U,G))>K)return!1}return!0}var u9=fH();function fH(){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 gH(J){if(Math.abs(J)>65504)C0("DataUtils.toHalfFloat(): Value out of range.");J=m0(J,-65504,65504),u9.floatView[0]=J;let Q=u9.uint32View[0],$=Q>>23&511;return u9.baseTable[$]+((Q&8388607)>>u9.shiftTable[$])}function pH(J){let Q=J>>10;return u9.uint32View[0]=u9.mantissaTable[u9.offsetTable[Q]+(J&1023)]+u9.exponentTable[Q],u9.floatView[0]}class T8{static toHalfFloat(J){return gH(J)}static fromHalfFloat(J){return pH(J)}}var zJ=new j,M7=new p0,dH=0;class JJ extends T9{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:dH++}),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++)M7.fromBufferAttribute(this,Q),M7.applyMatrix3(J),this.setXY(Q,M7.x,M7.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.applyMatrix3(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.applyMatrix4(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.applyNormalMatrix(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.transformDirection(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.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)$=q9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=$J($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=q9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=$J(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=q9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=$J(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=q9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=$J(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=q9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=$J(Q,this.array),$=$J($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=$J(Q,this.array),$=$J($,this.array),Z=$J(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=$J(Q,this.array),$=$J($,this.array),Z=$J(Z,this.array),W=$J(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 WQ extends JJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class YQ extends JJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class NJ extends JJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var uH=new sJ,_6=new j,aQ=new j;class mJ{constructor(J=new j,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 uH.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;_6.subVectors(J,this.center);let Q=_6.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(_6,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 aQ.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(_6.copy(J.center).add(aQ)),this.expandByPoint(_6.copy(J.center).sub(aQ));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 mH=0,$9=new S0,rQ=new FJ,i8=new j,aJ=new sJ,T6=new sJ,AJ=new j;class RJ extends T9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mH++}),this.uuid=R9(),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((GH(J))?YQ:WQ)(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 $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 rQ.lookAt(J),rQ.updateMatrix(),this.applyMatrix4(rQ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(i8).negate(),this.translate(i8.x,i8.y,i8.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 NJ($,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 sJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){A0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new j(-1/0,-1/0,-1/0),new j(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(aJ.setFromBufferAttribute(W),this.morphTargetsRelative)AJ.addVectors(this.boundingBox.min,aJ.min),this.boundingBox.expandByPoint(AJ),AJ.addVectors(this.boundingBox.max,aJ.max),this.boundingBox.expandByPoint(AJ);else this.boundingBox.expandByPoint(aJ.min),this.boundingBox.expandByPoint(aJ.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))A0('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 mJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){A0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new j,1/0);return}if(J){let $=this.boundingSphere.center;if(aJ.setFromBufferAttribute(J),Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W];if(T6.setFromBufferAttribute(X),this.morphTargetsRelative)AJ.addVectors(aJ.min,T6.min),aJ.expandByPoint(AJ),AJ.addVectors(aJ.max,T6.max),aJ.expandByPoint(AJ);else aJ.expandByPoint(T6.min),aJ.expandByPoint(T6.max)}aJ.getCenter($);let Z=0;for(let W=0,Y=J.count;W<Y;W++)AJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(AJ));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(AJ.fromBufferAttribute(X,H),K)i8.fromBufferAttribute(J,H),AJ.add(i8);Z=Math.max(Z,$.distanceToSquared(AJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))A0('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){A0("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 JJ(new Float32Array(4*$.count),4));let Y=this.getAttribute("tangent"),X=[],K=[];for(let V=0;V<$.count;V++)X[V]=new j,K[V]=new j;let H=new j,U=new j,G=new j,F=new p0,E=new p0,O=new p0,R=new j,C=new j;function q(V,D,B){H.fromBufferAttribute($,V),U.fromBufferAttribute($,D),G.fromBufferAttribute($,B),F.fromBufferAttribute(W,V),E.fromBufferAttribute(W,D),O.fromBufferAttribute(W,B),U.sub(H),G.sub(H),E.sub(F),O.sub(F);let A=1/(E.x*O.y-O.x*E.y);if(!isFinite(A))return;R.copy(U).multiplyScalar(O.y).addScaledVector(G,-E.y).multiplyScalar(A),C.copy(G).multiplyScalar(E.x).addScaledVector(U,-O.x).multiplyScalar(A),X[V].add(R),X[D].add(R),X[B].add(R),K[V].add(C),K[D].add(C),K[B].add(C)}let N=this.groups;if(N.length===0)N=[{start:0,count:J.count}];for(let V=0,D=N.length;V<D;++V){let B=N[V],A=B.start,z=B.count;for(let S=A,y=A+z;S<y;S+=3)q(J.getX(S+0),J.getX(S+1),J.getX(S+2))}let L=new j,M=new j,k=new j,_=new j;function P(V){k.fromBufferAttribute(Z,V),_.copy(k);let D=X[V];L.copy(D),L.sub(k.multiplyScalar(k.dot(D))).normalize(),M.crossVectors(_,D);let A=M.dot(K[V])<0?-1:1;Y.setXYZW(V,L.x,L.y,L.z,A)}for(let V=0,D=N.length;V<D;++V){let B=N[V],A=B.start,z=B.count;for(let S=A,y=A+z;S<y;S+=3)P(J.getX(S+0)),P(J.getX(S+1)),P(J.getX(S+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new JJ(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 j,W=new j,Y=new j,X=new j,K=new j,H=new j,U=new j,G=new j;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++)AJ.fromBufferAttribute(J,Q),AJ.normalize(),J.setXYZ(Q,AJ.x,AJ.y,AJ.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 JJ(F,U,G)}if(this.index===null)return C0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new RJ,$=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 c6{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=R9()}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=R9();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=R9();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 j;class F6{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)$=q9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=$J($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=$J(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=q9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=q9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=q9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=q9(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=$J(Q,this.array),$=$J($,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=$J(Q,this.array),$=$J($,this.array),Z=$J(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=$J(Q,this.array),$=$J($,this.array),Z=$J(Z,this.array),W=$J(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){x6("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 JJ(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 F6(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){x6("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 lH=0;class eJ extends T9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:lH++}),this.uuid=R9(),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 R0(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 p9=new j,tQ=new j,k7=new j,W8=new j,eQ=new j,B7=new j,J$=new j;class N6{constructor(J=new j,Q=new j(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,p9)),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=p9.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return p9.copy(this.origin).addScaledVector(this.direction,Q),p9.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){tQ.copy(J).add(Q).multiplyScalar(0.5),k7.copy(Q).sub(J).normalize(),W8.copy(this.origin).sub(tQ);let W=J.distanceTo(Q)*0.5,Y=-this.direction.dot(k7),X=W8.dot(this.direction),K=-W8.dot(k7),H=W8.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(tQ).addScaledVector(k7,F);return E}intersectSphere(J,Q){p9.subVectors(J.center,this.origin);let $=p9.dot(this.direction),Z=p9.dot(p9)-$*$,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,p9)!==null}intersectTriangle(J,Q,$,Z,W){eQ.subVectors(Q,J),B7.subVectors($,J),J$.crossVectors(eQ,B7);let Y=this.direction.dot(J$),X;if(Y>0){if(Z)return null;X=1}else if(Y<0)X=-1,Y=-Y;else return null;W8.subVectors(this.origin,J);let K=X*this.direction.dot(B7.crossVectors(W8,B7));if(K<0)return null;let H=X*this.direction.dot(eQ.cross(W8));if(H<0)return null;if(K+H>Y)return null;let U=-X*W8.dot(J$);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 A9 extends eJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new R0(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 l9,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 SW=new S0,D8=new N6,V7=new mJ,jW=new j,C7=new j,I7=new j,z7=new j,Q$=new j,w7=new j,vW=new j,P7=new j;class GJ extends FJ{constructor(J=new RJ,Q=new A9){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){w7.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(Q$.fromBufferAttribute(G,J),Y)w7.addScaledVector(Q$,U);else w7.addScaledVector(Q$.sub(Q),U)}Q.add(w7)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(V7.copy($.boundingSphere),V7.applyMatrix4(W),D8.copy(J.ray).recast(J.near),V7.containsPoint(D8.origin)===!1){if(D8.intersectSphere(V7,jW)===null)return;if(D8.origin.distanceToSquared(jW)>(J.far-J.near)**2)return}if(SW.copy(W).invert(),D8.copy(J.ray).applyMatrix4(SW),$.boundingBox!==null){if(D8.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,D8)}_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 M=N,k=L;M<k;M+=3){let _=X.getX(M),P=X.getX(M+1),V=X.getX(M+2);if(Z=_7(this,q,J,$,H,U,G,_,P,V),Z)Z.faceIndex=Math.floor(M/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),M=X.getX(C+2);if(Z=_7(this,Y,J,$,H,U,G,N,L,M),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 M=N,k=L;M<k;M+=3){let _=M,P=M+1,V=M+2;if(Z=_7(this,q,J,$,H,U,G,_,P,V),Z)Z.faceIndex=Math.floor(M/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,M=C+2;if(Z=_7(this,Y,J,$,H,U,G,N,L,M),Z)Z.faceIndex=Math.floor(C/3),Q.push(Z)}}}}function cH(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;P7.copy(K),P7.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(P7);if(U<$.near||U>$.far)return null;return{distance:U,point:P7.clone(),object:J}}function _7(J,Q,$,Z,W,Y,X,K,H,U){J.getVertexPosition(K,C7),J.getVertexPosition(H,I7),J.getVertexPosition(U,z7);let G=cH(J,Q,$,Z,C7,I7,z7,vW);if(G){let F=new j;if(Z9.getBarycoord(vW,C7,I7,z7,F),W)G.uv=Z9.getInterpolatedAttribute(W,K,H,U,F,new p0);if(Y)G.uv1=Z9.getInterpolatedAttribute(Y,K,H,U,F,new p0);if(X){if(G.normal=Z9.getInterpolatedAttribute(X,K,H,U,F,new j),G.normal.dot(Z.direction)>0)G.normal.multiplyScalar(-1)}let E={a:K,b:H,c:U,normal:new j,materialIndex:0};Z9.getNormal(C7,I7,z7,E.normal),G.face=E,G.barycoord=F}return G}var A6=new QJ,yW=new QJ,hW=new QJ,nH=new QJ,xW=new S0,T7=new j,$$=new mJ,bW=new S0,Z$=new N6;class XQ extends GJ{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new S0,this.bindMatrixInverse=new S0,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($,T7),this.boundingBox.expandByPoint(T7)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new mJ;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,T7),this.boundingSphere.expandByPoint(T7)}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($$.copy(this.boundingSphere),$$.applyMatrix4(Z),J.ray.intersectsSphere($$)===!1)return;if(bW.copy(Z).invert(),Z$.copy(J.ray).applyMatrix4(bW),this.boundingBox!==null){if(Z$.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,Z$)}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 QJ,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(yW.fromBufferAttribute(Z.attributes.skinIndex,J),hW.fromBufferAttribute(Z.attributes.skinWeight,J),Q.isVector4)A6.copy(Q),Q.set(0,0,0,0);else A6.set(...Q,1),Q.set(0,0,0);A6.applyMatrix4(this.bindMatrix);for(let W=0;W<4;W++){let Y=hW.getComponent(W);if(Y!==0){let X=yW.getComponent(W);xW.multiplyMatrices($.bones[X].matrixWorld,$.boneInverses[X]),Q.addScaledVector(nH.copy(A6).applyMatrix4(xW),Y)}}if(Q.isVector4)Q.w=A6.w;return Q.applyMatrix4(this.bindMatrixInverse)}}class n6 extends FJ{constructor(){super();this.isBone=!0,this.type="Bone"}}class O6 extends wJ{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 fW=new S0,sH=new S0;class s6{constructor(J=[],Q=[]){this.uuid=R9(),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 S0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new S0;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:sH;fW.multiplyMatrices(X,Q[W]),fW.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new s6(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 O6(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 n6;this.bones.push(Y),this.boneInverses.push(new S0().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 B8 extends JJ{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 o8=new S0,gW=new S0,A7=[],pW=new sJ,iH=new S0,S6=new GJ,j6=new mJ;class q6 extends GJ{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new B8(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,iH)}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($,o8),pW.copy(J.boundingBox).applyMatrix4(o8),this.boundingBox.union(pW)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new mJ;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,o8),j6.copy(J.boundingSphere).applyMatrix4(o8),this.boundingSphere.union(j6)}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(S6.geometry=this.geometry,S6.material=this.material,S6.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(j6.copy(this.boundingSphere),j6.applyMatrix4($),J.ray.intersectsSphere(j6)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,o8),gW.multiplyMatrices($,o8),S6.matrixWorld=gW,S6.raycast(J,A7);for(let Y=0,X=A7.length;Y<X;Y++){let K=A7[Y];K.instanceId=W,K.object=this,Q.push(K)}A7.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new B8(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 O6(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 W$=new j,oH=new j,aH=new h0;class O9{constructor(J=new j(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=W$.subVectors($,Q).cross(oH.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(W$),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||aH.getNormalMatrix(J),Z=this.coplanarPoint(W$).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 M8=new mJ,rH=new p0(0.5,0.5),S7=new j;class A8{constructor(J=new O9,Q=new O9,$=new O9,Z=new O9,W=new O9,Y=new O9){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],M=W[14],k=W[15];if(Z[0].setComponents(H-Y,E-U,q-O,k-N).normalize(),Z[1].setComponents(H+Y,E+U,q+O,k+N).normalize(),Z[2].setComponents(H+X,E+G,q+R,k+L).normalize(),Z[3].setComponents(H-X,E-G,q-R,k-L).normalize(),$)Z[4].setComponents(K,F,C,M).normalize(),Z[5].setComponents(H-K,E-F,q-C,k-M).normalize();else if(Z[4].setComponents(H-K,E-F,q-C,k-M).normalize(),Q===2000)Z[5].setComponents(H+K,E+F,q+C,k+M).normalize();else if(Q===2001)Z[5].setComponents(K,F,C,M).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();M8.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();M8.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(M8)}intersectsSprite(J){M8.center.set(0,0,0);let Q=rH.distanceTo(J.center);return M8.radius=0.7071067811865476+Q,M8.applyMatrix4(J.matrixWorld),this.intersectsSphere(M8)}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(S7.x=Z.normal.x>0?J.max.x:J.min.x,S7.y=Z.normal.y>0?J.max.y:J.min.y,S7.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(S7)<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 i6 extends eJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new R0(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 p7=new j,d7=new j,dW=new S0,v6=new N6,j7=new mJ,Y$=new j,uW=new j;class R6 extends FJ{constructor(J=new RJ,Q=new i6){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++)p7.fromBufferAttribute(Q,Z-1),d7.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=p7.distanceTo(d7);J.setAttribute("lineDistance",new NJ($,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(j7.copy($.boundingSphere),j7.applyMatrix4(Z),j7.radius+=W,J.ray.intersectsSphere(j7)===!1)return;dW.copy(Z).invert(),v6.copy(J.ray).applyMatrix4(dW);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=v7(this,J,v6,K,q,N,R);if(L)Q.push(L)}if(this.isLineLoop){let R=U.getX(O-1),C=U.getX(E),q=v7(this,J,v6,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=v7(this,J,v6,K,R,R+1,R);if(q)Q.push(q)}if(this.isLineLoop){let R=v7(this,J,v6,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 v7(J,Q,$,Z,W,Y,X){let K=J.geometry.attributes.position;if(p7.fromBufferAttribute(K,W),d7.fromBufferAttribute(K,Y),$.distanceSqToSegment(p7,d7,Y$,uW)>Z)return;Y$.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(Y$);if(U<Q.near||U>Q.far)return;return{distance:U,point:uW.clone().applyMatrix4(J.matrixWorld),index:X,face:null,faceIndex:null,barycoord:null,object:J}}var mW=new j,lW=new j;class KQ extends R6{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)mW.fromBufferAttribute(Q,Z),lW.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+mW.distanceTo(lW);J.setAttribute("lineDistance",new NJ($,1))}else C0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class HQ extends R6{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}}class o6 extends eJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new R0(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 cW=new S0,E$=new N6,y7=new mJ,h7=new j;class s9 extends FJ{constructor(J=new RJ,Q=new o6){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(y7.copy($.boundingSphere),y7.applyMatrix4(Z),y7.radius+=W,J.ray.intersectsSphere(y7)===!1)return;cW.copy(Z).invert(),E$.copy(J.ray).applyMatrix4(cW);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);h7.fromBufferAttribute(G,C),nW(h7,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++)h7.fromBufferAttribute(G,O),nW(h7,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 nW(J,Q,$,Z,W,Y,X){let K=E$.distanceSqToPoint(J);if(K<$){let H=new j;E$.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 UQ extends wJ{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 U8 extends wJ{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 m6(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 OZ extends U8{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 GQ extends wJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class Y9 extends RJ{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 NJ(H,3)),this.setAttribute("normal",new NJ(U,3)),this.setAttribute("uv",new NJ(G,2));function O(R,C,q,N,L,M,k,_,P,V,D){let B=M/P,A=k/V,z=M/2,S=k/2,y=_/2,v=P+1,h=V+1,g=0,p=0,c=new j;for(let a=0;a<h;a++){let Q0=a*A-S;for(let H0=0;H0<v;H0++){let J0=H0*B-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]=_>0?1:-1,U.push(c.x,c.y,c.z),G.push(H0/P),G.push(1-a/V),g+=1}}for(let a=0;a<V;a++)for(let Q0=0;Q0<P;Q0++){let H0=F+Q0+v*a,J0=F+Q0+v*(a+1),x0=F+(Q0+1)+v*(a+1),v0=F+(Q0+1)+v*a;K.push(H0,J0,v0),K.push(J0,x0,v0),p+=6}X.addGroup(E,p,D),E+=p,F+=g}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new Y9(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class a6 extends RJ{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 NJ(G,3)),this.setAttribute("normal",new NJ(F,3)),this.setAttribute("uv",new NJ(E,2));function N(){let M=new j,k=new j,_=0,P=(Q-J)/$;for(let V=0;V<=W;V++){let D=[],B=V/W,A=B*(Q-J)+J;for(let z=0;z<=Z;z++){let S=z/Z,y=S*K+X,v=Math.sin(y),h=Math.cos(y);k.x=A*v,k.y=-B*$+C,k.z=A*h,G.push(k.x,k.y,k.z),M.set(v,P,h).normalize(),F.push(M.x,M.y,M.z),E.push(S,1-B),D.push(O++)}R.push(D)}for(let V=0;V<Z;V++)for(let D=0;D<W;D++){let B=R[D][V],A=R[D+1][V],z=R[D+1][V+1],S=R[D][V+1];if(J>0||D!==0)U.push(B,A,S),_+=3;if(Q>0||D!==W-1)U.push(A,z,S),_+=3}H.addGroup(q,_,0),q+=_}function L(M){let k=O,_=new p0,P=new j,V=0,D=M===!0?J:Q,B=M===!0?1:-1;for(let z=1;z<=Z;z++)G.push(0,C*B,0),F.push(0,B,0),E.push(0.5,0.5),O++;let A=O;for(let z=0;z<=Z;z++){let y=z/Z*K+X,v=Math.cos(y),h=Math.sin(y);P.x=D*h,P.y=C*B,P.z=D*v,G.push(P.x,P.y,P.z),F.push(0,B,0),_.x=v*0.5+0.5,_.y=h*0.5*B+0.5,E.push(_.x,_.y),O++}for(let z=0;z<Z;z++){let S=k+z,y=A+z;if(M===!0)U.push(y,y+1,S);else U.push(y+1,y,S);V+=3}H.addGroup(q,V,M===!0?1:2),q+=V}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new a6(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class EQ extends RJ{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 NJ(W,3)),this.setAttribute("normal",new NJ(W.slice(),3)),this.setAttribute("uv",new NJ(Y,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function X(N){let L=new j,M=new j,k=new j;for(let _=0;_<Q.length;_+=3)E(Q[_+0],L),E(Q[_+1],M),E(Q[_+2],k),K(L,M,k,N)}function K(N,L,M,k){let _=k+1,P=[];for(let V=0;V<=_;V++){P[V]=[];let D=N.clone().lerp(M,V/_),B=L.clone().lerp(M,V/_),A=_-V;for(let z=0;z<=A;z++)if(z===0&&V===_)P[V][z]=D;else P[V][z]=D.clone().lerp(B,z/A)}for(let V=0;V<_;V++)for(let D=0;D<2*(_-V)-1;D++){let B=Math.floor(D/2);if(D%2===0)F(P[V][B+1]),F(P[V+1][B]),F(P[V][B]);else F(P[V][B+1]),F(P[V+1][B+1]),F(P[V+1][B])}}function H(N){let L=new j;for(let M=0;M<W.length;M+=3)L.x=W[M+0],L.y=W[M+1],L.z=W[M+2],L.normalize().multiplyScalar(N),W[M+0]=L.x,W[M+1]=L.y,W[M+2]=L.z}function U(){let N=new j;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 M=C(N)/2/Math.PI+0.5,k=q(N)/Math.PI+0.5;Y.push(M,1-k)}O(),G()}function G(){for(let N=0;N<Y.length;N+=6){let L=Y[N+0],M=Y[N+2],k=Y[N+4],_=Math.max(L,M,k),P=Math.min(L,M,k);if(_>0.9&&P<0.1){if(L<0.2)Y[N+0]+=1;if(M<0.2)Y[N+2]+=1;if(k<0.2)Y[N+4]+=1}}}function F(N){W.push(N.x,N.y,N.z)}function E(N,L){let M=N*3;L.x=J[M+0],L.y=J[M+1],L.z=J[M+2]}function O(){let N=new j,L=new j,M=new j,k=new j,_=new p0,P=new p0,V=new p0;for(let D=0,B=0;D<W.length;D+=9,B+=6){N.set(W[D+0],W[D+1],W[D+2]),L.set(W[D+3],W[D+4],W[D+5]),M.set(W[D+6],W[D+7],W[D+8]),_.set(Y[B+0],Y[B+1]),P.set(Y[B+2],Y[B+3]),V.set(Y[B+4],Y[B+5]),k.copy(N).add(L).add(M).divideScalar(3);let A=C(k);R(_,B+0,N,A),R(P,B+2,L,A),R(V,B+4,M,A)}}function R(N,L,M,k){if(k<0&&N.x===1)Y[L]=N.x-1;if(M.x===0&&M.z===0)Y[L]=k/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 EQ(J.vertices,J.indices,J.radius,J.detail)}}class qZ{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 p0:new j);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 j,Z=[],W=[],Y=[],X=new j,K=new S0;for(let E=0;E<=J;E++){let O=E/J;Z[E]=this.getTangentAt(O,new j)}W[0]=new j,Y[0]=new j;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(m0(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(m0(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 RZ(){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 sW=new j,iW=new j,X$=new RZ,K$=new RZ,H$=new RZ;class FQ extends qZ{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 j){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 iW.subVectors(Z[0],Z[1]).add(Z[0]),H=iW;let G=Z[X%W],F=Z[(X+1)%W];if(this.closed||X+2<W)U=Z[(X+2)%W];else sW.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=sW;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;X$.initNonuniformCatmullRom(H.x,G.x,F.x,U.x,O,R,C),K$.initNonuniformCatmullRom(H.y,G.y,F.y,U.y,O,R,C),H$.initNonuniformCatmullRom(H.z,G.z,F.z,U.z,O,R,C)}else if(this.curveType==="catmullrom")X$.initCatmullRom(H.x,G.x,F.x,U.x,this.tension),K$.initCatmullRom(H.y,G.y,F.y,U.y,this.tension),H$.initCatmullRom(H.z,G.z,F.z,U.z,this.tension);return $.set(X$.calc(K),K$.calc(K),H$.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 j().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}}class r6 extends EQ{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 r6(J.radius,J.detail)}}class M9 extends RJ{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 M=L*G-W;O.push(M,-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,M=N+H*(q+1),k=N+1+H*(q+1),_=N+1+H*q;E.push(L,M,_),E.push(M,k,_)}this.setIndex(E),this.setAttribute("position",new NJ(O,3)),this.setAttribute("normal",new NJ(R,3)),this.setAttribute("uv",new NJ(C,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new M9(J.width,J.height,J.widthSegments,J.heightSegments)}}class t6 extends RJ{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 j,F=new j,E=[],O=[],R=[],C=[];for(let q=0;q<=$;q++){let N=[],L=q/$,M=0;if(q===0&&Y===0)M=0.5/Q;else if(q===$&&K===Math.PI)M=-0.5/Q;for(let k=0;k<=Q;k++){let _=k/Q;G.x=-J*Math.cos(Z+_*W)*Math.sin(Y+L*X),G.y=J*Math.cos(Y+L*X),G.z=J*Math.sin(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),C.push(_+M,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],M=U[q][N],k=U[q+1][N],_=U[q+1][N+1];if(q!==0||Y>0)E.push(L,M,_);if(q!==$-1||K<Math.PI)E.push(M,k,_)}this.setIndex(E),this.setAttribute("position",new NJ(O,3)),this.setAttribute("normal",new NJ(R,3)),this.setAttribute("uv",new NJ(C,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new t6(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class e6 extends RJ{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 j,E=new j,O=new j;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,M=(Z+1)*R+C;K.push(q,N,M),K.push(N,L,M)}this.setIndex(K),this.setAttribute("position",new NJ(H,3)),this.setAttribute("normal",new NJ(U,3)),this.setAttribute("uv",new NJ(G,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new e6(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}function S8(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(oW(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(oW(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 gJ(J){let Q={};for(let $=0;$<J.length;$++){let Z=S8(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function oW(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function tH(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function LZ(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return s0.workingColorSpace}var j8={clone:S8,merge:gJ},eH=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
- }`,iH=`void main() {
3
+ }`,JU=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5
- }`;class SJ extends eJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=sH,this.fragmentShader=iH,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=S8(J.uniforms),this.uniformsGroups=nH(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 RZ extends SJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class T9 extends eJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new k0(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 k0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new h0(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 l9,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 mJ extends T9{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 h0(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return g0(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 k0(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 k0(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new k0(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 LZ extends eJ{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 DZ extends eJ{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 y7(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 oH(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 nW(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 rY(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 i9{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 MZ extends i9{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,q=this._weightPrev,E=this._weightNext,O=($-Q)/(Z-Q),R=O*O,k=R*O,F=-q*k+2*q*R-q*O,N=(1+q)*k+(-1.5-2*q)*R+(-0.5+q)*O+1,D=(-1-E)*k+(1.5+E)*R+0.5*O,B=E*k-E*R;for(let C=0;C!==X;++C)W[C]=F*Y[U+C]+N*Y[H+C]+D*Y[K+C]+B*Y[G+C];return W}}class EQ extends i9{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 q=0;q!==X;++q)W[q]=Y[H+q]*G+Y[K+q]*U;return W}}class kZ extends i9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}}class BZ extends i9{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,q=U.outTangents;if(!G||!q){let R=($-Q)/(Z-Q),k=1-R;for(let F=0;F!==X;++F)W[F]=Y[H+F]*k+Y[K+F]*R;return W}let E=X*2,O=J-1;for(let R=0;R!==X;++R){let k=Y[H+R],F=Y[K+R],N=O*E+R*2,D=q[N],B=q[N+1],C=J*E+R*2,T=G[C],P=G[C+1],_=($-Q)/(Z-Q),L,z,S,I,j;for(let b=0;b<8;b++){L=_*_,z=L*_,S=1-_,I=S*S,j=I*S;let x=j*Q+3*I*_*D+3*S*L*T+z*Z-$;if(Math.abs(x)<0.0000000001)break;let p=3*I*(D-Q)+6*S*_*(T-D)+3*L*(Z-T);if(Math.abs(p)<0.0000000001)break;_=_-x/p,_=Math.max(0,Math.min(1,_))}W[R]=j*k+3*I*_*B+3*S*L*P+z*F}return W}}class J9{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=y7(Q,this.TimeBufferType),this.values=y7($,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:y7(J.times,Array),values:y7(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new kZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new EQ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new MZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new BZ(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 B0("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)A0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)A0("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)){A0("KeyframeTrack: Time is not a valid number.",this,X,K),J=!1;break}if(Y!==null&&Y>K){A0("KeyframeTrack: Out of order keys.",this,X,K,Y),J=!1;break}Y=K}if(Z!==void 0){if(YH(Z))for(let X=0,K=Z.length;X!==K;++X){let H=Z[X];if(isNaN(H)){A0("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*$,q=G-$,E=G+$;for(let O=0;O!==$;++O){let R=Q[G+O];if(R!==Q[q+O]||R!==Q[E+O]){K=!0;break}}}else K=!0;if(K){if(X!==Y){J[Y]=J[X];let G=X*$,q=Y*$;for(let E=0;E!==$;++E)Q[q+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}}J9.prototype.ValueTypeName="";J9.prototype.TimeBufferType=Float32Array;J9.prototype.ValueBufferType=Float32Array;J9.prototype.DefaultInterpolation=2301;class G8 extends J9{constructor(J,Q,$){super(J,Q,$)}}G8.prototype.ValueTypeName="bool";G8.prototype.ValueBufferType=Array;G8.prototype.DefaultInterpolation=2300;G8.prototype.InterpolantFactoryMethodLinear=void 0;G8.prototype.InterpolantFactoryMethodSmooth=void 0;class qQ extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}qQ.prototype.ValueTypeName="color";class c9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}c9.prototype.ValueTypeName="number";class VZ extends i9{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)wJ.slerpFlat(W,0,Y,H-X,Y,H,K);return W}}class o9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new VZ(this.times,this.values,this.getValueSize(),J)}}o9.prototype.ValueTypeName="quaternion";o9.prototype.InterpolantFactoryMethodSmooth=void 0;class E8 extends J9{constructor(J,Q,$){super(J,Q,$)}}E8.prototype.ValueTypeName="string";E8.prototype.ValueBufferType=Array;E8.prototype.DefaultInterpolation=2300;E8.prototype.InterpolantFactoryMethodLinear=void 0;E8.prototype.InterpolantFactoryMethodSmooth=void 0;class n9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}n9.prototype.ValueTypeName="vector";class $6{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=N9(),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(rH($[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(J9.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=oH(K);if(K=nW(K,1,U),H=nW(H,1,U),!Z&&K[0]===0)K.push(W),H.push(H[0]);Y.push(new c9(".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],q=Z[G];if(!q)Z[G]=q=[];q.push(H)}}let Y=[];for(let X in Z)Y.push(this.CreateFromMorphTargetSequence(X,Z[X],Q,$));return Y}static parseAnimation(J,Q){if(B0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return A0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,q,E,O,R){if(E.length!==0){let k=[],F=[];if(rY(E,k,F,O),k.length!==0)R.push(new G(q,k,F))}},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 q=H[G].keys;if(!q||q.length===0)continue;if(q[0].morphTargets){let E={},O;for(O=0;O<q.length;O++)if(q[O].morphTargets)for(let R=0;R<q[O].morphTargets.length;R++)E[q[O].morphTargets[R]]=-1;for(let R in E){let k=[],F=[];for(let N=0;N!==q[O].morphTargets.length;++N){let D=q[O];k.push(D.time),F.push(D.morphTarget===R?1:0)}Z.push(new c9(".morphTargetInfluence["+R+"]",k,F))}K=E.length*Y}else{let E=".bones["+Q[G].name+"]";$(n9,E+".position",q,"pos",Z),$(o9,E+".quaternion",q,"rot",Z),$(n9,E+".scale",q,"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 aH(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return c9;case"vector":case"vector2":case"vector3":case"vector4":return n9;case"color":return qQ;case"quaternion":return o9;case"bool":case"boolean":return G8;case"string":return E8}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function rH(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=aH(J.type);if(J.times===void 0){let $=[],Z=[];rY(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 V9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(sW(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(sW(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};function sW(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class zZ{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,q=H.length;G<q;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 tY=new zZ;class A9{constructor(J){if(this.manager=J!==void 0?J:tY,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}}A9.DEFAULT_MATERIAL_NAME="__DEFAULT";var d9={};class eY extends Error{constructor(J,Q){super(J);this.response=Q}}class R6 extends A9{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=V9.get(`file:${J}`);if(W!==void 0){this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0);return}if(d9[J]!==void 0){d9[J].push({onLoad:Q,onProgress:$,onError:Z});return}d9[J]=[],d9[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)B0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||H.body===void 0||H.body.getReader===void 0)return H;let U=d9[J],G=H.body.getReader(),q=H.headers.get("X-File-Size")||H.headers.get("Content-Length"),E=q?parseInt(q):0,O=E!==0,R=0,k=new ReadableStream({start(F){N();function N(){G.read().then(({done:D,value:B})=>{if(D)F.close();else{R+=B.byteLength;let C=new ProgressEvent("progress",{lengthComputable:O,loaded:R,total:E});for(let T=0,P=U.length;T<P;T++){let _=U[T];if(_.onProgress)_.onProgress(C)}F.enqueue(B),N()}},(D)=>{F.error(D)})}}});return new Response(k)}else throw new eY(`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),q=G&&G[1]?G[1].toLowerCase():void 0,E=new TextDecoder(q);return H.arrayBuffer().then((O)=>E.decode(O))}}}).then((H)=>{V9.add(`file:${J}`,H);let U=d9[J];delete d9[J];for(let G=0,q=U.length;G<q;G++){let E=U[G];if(E.onLoad)E.onLoad(H)}}).catch((H)=>{let U=d9[J];if(U===void 0)throw this.manager.itemError(J),H;delete d9[J];for(let G=0,q=U.length;G<q;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 a8=new WeakMap;class CZ extends A9{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=V9.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=a8.get(Y);if(G===void 0)G=[],a8.set(Y,G);G.push({onLoad:Q,onError:Z})}return Y}let X=J6("img");function K(){if(U(),Q)Q(this);let G=a8.get(this)||[];for(let q=0;q<G.length;q++){let E=G[q];if(E.onLoad)E.onLoad(this)}a8.delete(this),W.manager.itemEnd(J)}function H(G){if(U(),Z)Z(G);V9.remove(`image:${J}`);let q=a8.get(this)||[];for(let E=0;E<q.length;E++){let O=q[E];if(O.onError)O.onError(G)}a8.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 V9.add(`image:${J}`,X),W.manager.itemStart(J),X.src=J,X}}class FQ extends A9{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new F6,X=new R6(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 A0(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 L6 extends A9{constructor(J){super(J)}load(J,Q,$,Z){let W=new _J,Y=new CZ(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 a9 extends EJ{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new k0(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 D6 extends a9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(EJ.DEFAULT_UP),this.updateMatrix(),this.groundColor=new k0(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 K$=new S0,iW=new A,oW=new A;class NQ{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 h0(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new S0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new A8,this._frameExtents=new h0(1,1),this._viewportCount=1,this._viewports=[new JJ(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(iW.setFromMatrixPosition(J.matrixWorld),Q.position.copy(iW),oW.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(oW),Q.updateMatrixWorld(),K$.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(K$,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(K$)}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 f7=new A,x7=new wJ,B9=new A;class OQ extends EJ{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new S0,this.projectionMatrix=new S0,this.projectionMatrixInverse=new S0,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(f7,x7,B9),B9.x===1&&B9.y===1&&B9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(f7,x7,B9.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(f7,x7,B9),B9.x===1&&B9.y===1&&B9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(f7,x7,B9.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var Y8=new A,aW=new h0,rW=new h0;class MJ extends OQ{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=k8*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(j6*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return k8*2*Math.atan(Math.tan(j6*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,$){Y8.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(Y8.x,Y8.y).multiplyScalar(-J/Y8.z),Y8.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(Y8.x,Y8.y).multiplyScalar(-J/Y8.z)}getViewSize(J,Q){return this.getViewBounds(J,aW,rW),Q.subVectors(rW,aW)}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(j6*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 JX extends NQ{constructor(){super(new MJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=k8*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 RQ extends a9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,Y=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(EJ.DEFAULT_UP),this.updateMatrix(),this.target=new EJ,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=Y,this.map=null,this.shadow=new JX}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 QX extends NQ{constructor(){super(new MJ(90,1,0.5,500));this.isPointLightShadow=!0}}class M6 extends a9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new QX}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 v8 extends OQ{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 $X extends NQ{constructor(){super(new v8(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class S9 extends a9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(EJ.DEFAULT_UP),this.updateMatrix(),this.target=new EJ,this.shadow=new $X}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 t6 extends a9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}}class q8{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 H$=new WeakMap;class LQ extends A9{constructor(J){super(J);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")B0("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")B0("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=V9.get(`image-bitmap:${J}`);if(Y!==void 0){if(W.manager.itemStart(J),Y.then){Y.then((H)=>{if(H$.has(Y)===!0){if(Z)Z(H$.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(V9.add(`image-bitmap:${J}`,H),Q)Q(H);W.manager.itemEnd(J)}).catch(function(H){if(Z)Z(H);H$.set(K,H),V9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});V9.add(`image-bitmap:${J}`,K),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var r8=-90,t8=1;class IZ extends EJ{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new MJ(r8,t8,J,Q);Z.layers=this.layers,this.add(Z);let W=new MJ(r8,t8,J,Q);W.layers=this.layers,this.add(W);let Y=new MJ(r8,t8,J,Q);Y.layers=this.layers,this.add(Y);let X=new MJ(r8,t8,J,Q);X.layers=this.layers,this.add(X);let K=new MJ(r8,t8,J,Q);K.layers=this.layers,this.add(K);let H=new MJ(r8,t8,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(),q=J.getActiveCubeFace(),E=J.getActiveMipmapLevel(),O=J.xr.enabled;J.xr.enabled=!1;let R=$.texture.generateMipmaps;$.texture.generateMipmaps=!1;let k=!1;if(J.isWebGLRenderer===!0)k=J.state.buffers.depth.getReversed();else k=J.reversedDepthBuffer;if(J.setRenderTarget($,0,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,W),J.setRenderTarget($,1,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,Y),J.setRenderTarget($,2,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,X),J.setRenderTarget($,3,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,K),J.setRenderTarget($,4,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,H),$.texture.generateMipmaps=R,J.setRenderTarget($,5,Z),k&&J.autoClear===!1)J.clearDepth();J.render(Q,U),J.setRenderTarget(G,q,E),J.xr.enabled=O,$.texture.needsPMREMUpdate=!0}}class _Z extends MJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class wZ{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){wJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let Y=this._workIndex*W;wJ.multiplyQuaternionsFlat(J,Y,J,Q,J,$),wJ.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="\\[\\]\\.:\\/",tH=new RegExp("["+PZ+"]","g"),TZ="[^"+PZ+"]",eH="[^"+PZ.replace("\\.","")+"]",JU=/((?:WC+[\/:])*)/.source.replace("WC",TZ),QU=/(WCOD+)?/.source.replace("WCOD",eH),$U=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",TZ),ZU=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",TZ),WU=new RegExp("^"+JU+QU+$U+ZU+"$"),YU=["material","materials","bones","map"];class ZX{constructor(J,Q,$){let Z=$||t0.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 t0{constructor(J,Q,$){this.path=Q,this.parsedPath=$||t0.parseTrackName(Q),this.node=t0.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 t0(J,Q,$);else return new t0.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(tH,"")}static parseTrackName(J){let Q=WU.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(YU.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=t0.findNode(this.rootNode,Q.nodeName),this.node=J;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!J){B0("PropertyBinding: No target node found for track: "+this.path+".");return}if($){let H=Q.objectIndex;switch($){case"materials":if(!J.material){A0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){A0("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){A0("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){A0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){A0("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){A0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(H!==void 0){if(J[H]===void 0){A0("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;A0("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){A0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){A0("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}}t0.Composite=ZX;t0.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};t0.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};t0.prototype.GetterByBindingType=[t0.prototype._getValue_direct,t0.prototype._getValue_array,t0.prototype._getValue_arrayElement,t0.prototype._getValue_toArray];t0.prototype.SetterByBindingTypeAndVersioning=[[t0.prototype._setValue_direct,t0.prototype._setValue_direct_setNeedsUpdate,t0.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[t0.prototype._setValue_array,t0.prototype._setValue_array_setNeedsUpdate,t0.prototype._setValue_array_setMatrixWorldNeedsUpdate],[t0.prototype._setValue_arrayElement,t0.prototype._setValue_arrayElement_setNeedsUpdate,t0.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[t0.prototype._setValue_fromArray,t0.prototype._setValue_fromArray_setNeedsUpdate,t0.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AZ{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 XU=new Float32Array(1);class DQ extends w9{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 q=Z[G],E=q.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 wZ(t0.create($,E,R),q.ValueTypeName,q.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,q=(J._localRoot||this._root).uuid;if(delete G[q],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 EQ(new Float32Array(2),new Float32Array(2),1,XU),$.__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"?$6.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 AZ(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"?$6.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 SZ{static{SZ.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 jZ(J,Q,$,Z){let W=KU(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 KU(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__)B0("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="184";function _X(){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 HU(J){let Q=new WeakMap;function $(K,H){let{array:U,usage:G}=K,q=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:q}}function Z(K,H,U){let{array:G,updateRanges:q}=H;if(J.bindBuffer(U,K),q.length===0)J.bufferSubData(U,0,G);else{q.sort((O,R)=>O.start-R.start);let E=0;for(let O=1;O<q.length;O++){let R=q[E],k=q[O];if(k.start<=R.start+R.count+1)R.count=Math.max(R.count,k.start+k.count-R.start);else++E,q[E]=k}q.length=E+1;for(let O=0,R=q.length;O<R;O++){let k=q[O];J.bufferSubData(U,k.start*G.BYTES_PER_ELEMENT,G,k.start,k.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 UU=`#ifdef USE_ALPHAHASH
5
+ }`;class SJ extends eJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=eH,this.fragmentShader=JU,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=S8(J.uniforms),this.uniformsGroups=tH(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 DZ extends SJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class X9 extends eJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new R0(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 R0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p0(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 l9,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 lJ extends X9{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 p0(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return m0(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 R0(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 R0(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new R0(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 MZ extends eJ{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 kZ extends eJ{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 x7(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 QU(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 aW(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 QX(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 i9{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 BZ extends i9{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,M=E*C-E*R;for(let k=0;k!==X;++k)W[k]=q*Y[U+k]+N*Y[H+k]+L*Y[K+k]+M*Y[G+k];return W}}class NQ extends i9{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 VZ extends i9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}}class CZ extends i9{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],M=F[N+1],k=J*E+R*2,_=G[k],P=G[k+1],V=($-Q)/(Z-Q),D,B,A,z,S;for(let y=0;y<8;y++){D=V*V,B=D*V,A=1-V,z=A*A,S=z*A;let h=S*Q+3*z*V*L+3*A*D*_+B*Z-$;if(Math.abs(h)<0.0000000001)break;let g=3*z*(L-Q)+6*A*V*(_-L)+3*D*(Z-_);if(Math.abs(g)<0.0000000001)break;V=V-h/g,V=Math.max(0,Math.min(1,V))}W[R]=S*C+3*z*V*M+3*A*D*P+B*q}return W}}class J9{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=x7(Q,this.TimeBufferType),this.values=x7($,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:x7(J.times,Array),values:x7(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new VZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new NQ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new BZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new CZ(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)A0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)A0("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)){A0("KeyframeTrack: Time is not a valid number.",this,X,K),J=!1;break}if(Y!==null&&Y>K){A0("KeyframeTrack: Out of order keys.",this,X,K,Y),J=!1;break}Y=K}if(Z!==void 0){if(EH(Z))for(let X=0,K=Z.length;X!==K;++X){let H=Z[X];if(isNaN(H)){A0("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}}J9.prototype.ValueTypeName="";J9.prototype.TimeBufferType=Float32Array;J9.prototype.ValueBufferType=Float32Array;J9.prototype.DefaultInterpolation=2301;class G8 extends J9{constructor(J,Q,$){super(J,Q,$)}}G8.prototype.ValueTypeName="bool";G8.prototype.ValueBufferType=Array;G8.prototype.DefaultInterpolation=2300;G8.prototype.InterpolantFactoryMethodLinear=void 0;G8.prototype.InterpolantFactoryMethodSmooth=void 0;class OQ extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}OQ.prototype.ValueTypeName="color";class c9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}c9.prototype.ValueTypeName="number";class IZ extends i9{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)PJ.slerpFlat(W,0,Y,H-X,Y,H,K);return W}}class o9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new IZ(this.times,this.values,this.getValueSize(),J)}}o9.prototype.ValueTypeName="quaternion";o9.prototype.InterpolantFactoryMethodSmooth=void 0;class E8 extends J9{constructor(J,Q,$){super(J,Q,$)}}E8.prototype.ValueTypeName="string";E8.prototype.ValueBufferType=Array;E8.prototype.DefaultInterpolation=2300;E8.prototype.InterpolantFactoryMethodLinear=void 0;E8.prototype.InterpolantFactoryMethodSmooth=void 0;class n9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}n9.prototype.ValueTypeName="vector";class $6{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=R9(),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(ZU($[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(J9.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=QU(K);if(K=aW(K,1,U),H=aW(H,1,U),!Z&&K[0]===0)K.push(W),H.push(H[0]);Y.push(new c9(".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 A0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,F,E,O,R){if(E.length!==0){let C=[],q=[];if(QX(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 c9(".morphTargetInfluence["+R+"]",C,q))}K=E.length*Y}else{let E=".bones["+Q[G].name+"]";$(n9,E+".position",F,"pos",Z),$(o9,E+".quaternion",F,"rot",Z),$(n9,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 $U(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return c9;case"vector":case"vector2":case"vector3":case"vector4":return n9;case"color":return OQ;case"quaternion":return o9;case"bool":case"boolean":return G8;case"string":return E8}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function ZU(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=$U(J.type);if(J.times===void 0){let $=[],Z=[];QX(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 I9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(rW(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(rW(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};function rW(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class zZ{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 $X=new zZ;class S9{constructor(J){if(this.manager=J!==void 0?J:$X,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}}S9.DEFAULT_MATERIAL_NAME="__DEFAULT";var d9={};class ZX extends Error{constructor(J,Q){super(J);this.response=Q}}class L6 extends S9{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=I9.get(`file:${J}`);if(W!==void 0){this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0);return}if(d9[J]!==void 0){d9[J].push({onLoad:Q,onProgress:$,onError:Z});return}d9[J]=[],d9[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=d9[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:M})=>{if(L)q.close();else{R+=M.byteLength;let k=new ProgressEvent("progress",{lengthComputable:O,loaded:R,total:E});for(let _=0,P=U.length;_<P;_++){let V=U[_];if(V.onProgress)V.onProgress(k)}q.enqueue(M),N()}},(L)=>{q.error(L)})}}});return new Response(C)}else throw new ZX(`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)=>{I9.add(`file:${J}`,H);let U=d9[J];delete d9[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=d9[J];if(U===void 0)throw this.manager.itemError(J),H;delete d9[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 a8=new WeakMap;class wZ extends S9{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=I9.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=a8.get(Y);if(G===void 0)G=[],a8.set(Y,G);G.push({onLoad:Q,onError:Z})}return Y}let X=J6("img");function K(){if(U(),Q)Q(this);let G=a8.get(this)||[];for(let F=0;F<G.length;F++){let E=G[F];if(E.onLoad)E.onLoad(this)}a8.delete(this),W.manager.itemEnd(J)}function H(G){if(U(),Z)Z(G);I9.remove(`image:${J}`);let F=a8.get(this)||[];for(let E=0;E<F.length;E++){let O=F[E];if(O.onError)O.onError(G)}a8.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 I9.add(`image:${J}`,X),W.manager.itemStart(J),X.src=J,X}}class qQ extends S9{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new O6,X=new L6(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 A0(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 S9{constructor(J){super(J)}load(J,Q,$,Z){let W=new wJ,Y=new wZ(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 a9 extends FJ{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new R0(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 M6 extends a9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(FJ.DEFAULT_UP),this.updateMatrix(),this.groundColor=new R0(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 U$=new S0,tW=new j,eW=new j;class RQ{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 p0(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new S0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new A8,this._frameExtents=new p0(1,1),this._viewportCount=1,this._viewports=[new QJ(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(tW.setFromMatrixPosition(J.matrixWorld),Q.position.copy(tW),eW.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(eW),Q.updateMatrixWorld(),U$.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(U$,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(U$)}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 b7=new j,f7=new PJ,C9=new j;class LQ extends FJ{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new S0,this.projectionMatrix=new S0,this.projectionMatrixInverse=new S0,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(b7,f7,C9),C9.x===1&&C9.y===1&&C9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(b7,f7,C9.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(b7,f7,C9),C9.x===1&&C9.y===1&&C9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(b7,f7,C9.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var Y8=new j,JY=new p0,QY=new p0;class kJ extends LQ{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=k8*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(y6*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return k8*2*Math.atan(Math.tan(y6*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,$){Y8.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(Y8.x,Y8.y).multiplyScalar(-J/Y8.z),Y8.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(Y8.x,Y8.y).multiplyScalar(-J/Y8.z)}getViewSize(J,Q){return this.getViewBounds(J,JY,QY),Q.subVectors(QY,JY)}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(y6*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 WX extends RQ{constructor(){super(new kJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=k8*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 DQ extends a9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,Y=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(FJ.DEFAULT_UP),this.updateMatrix(),this.target=new FJ,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=Y,this.map=null,this.shadow=new WX}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 YX extends RQ{constructor(){super(new kJ(90,1,0.5,500));this.isPointLightShadow=!0}}class k6 extends a9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new YX}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 v8 extends LQ{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 XX extends RQ{constructor(){super(new v8(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class j9 extends a9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(FJ.DEFAULT_UP),this.updateMatrix(),this.target=new FJ,this.shadow=new XX}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 J7 extends a9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}}class F8{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 G$=new WeakMap;class MQ extends S9{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=I9.get(`image-bitmap:${J}`);if(Y!==void 0){if(W.manager.itemStart(J),Y.then){Y.then((H)=>{if(G$.has(Y)===!0){if(Z)Z(G$.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(I9.add(`image-bitmap:${J}`,H),Q)Q(H);W.manager.itemEnd(J)}).catch(function(H){if(Z)Z(H);G$.set(K,H),I9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});I9.add(`image-bitmap:${J}`,K),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var r8=-90,t8=1;class PZ extends FJ{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new kJ(r8,t8,J,Q);Z.layers=this.layers,this.add(Z);let W=new kJ(r8,t8,J,Q);W.layers=this.layers,this.add(W);let Y=new kJ(r8,t8,J,Q);Y.layers=this.layers,this.add(Y);let X=new kJ(r8,t8,J,Q);X.layers=this.layers,this.add(X);let K=new kJ(r8,t8,J,Q);K.layers=this.layers,this.add(K);let H=new kJ(r8,t8,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 _Z extends kJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class TZ{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){PJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let Y=this._workIndex*W;PJ.multiplyQuaternionsFlat(J,Y,J,Q,J,$),PJ.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 AZ="\\[\\]\\.:\\/",WU=new RegExp("["+AZ+"]","g"),SZ="[^"+AZ+"]",YU="[^"+AZ.replace("\\.","")+"]",XU=/((?:WC+[\/:])*)/.source.replace("WC",SZ),KU=/(WCOD+)?/.source.replace("WCOD",YU),HU=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",SZ),UU=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",SZ),GU=new RegExp("^"+XU+KU+HU+UU+"$"),EU=["material","materials","bones","map"];class KX{constructor(J,Q,$){let Z=$||e0.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 e0{constructor(J,Q,$){this.path=Q,this.parsedPath=$||e0.parseTrackName(Q),this.node=e0.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 e0(J,Q,$);else return new e0.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(WU,"")}static parseTrackName(J){let Q=GU.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(EU.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=e0.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){A0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){A0("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){A0("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){A0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){A0("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){A0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(H!==void 0){if(J[H]===void 0){A0("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;A0("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){A0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){A0("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}}e0.Composite=KX;e0.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};e0.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};e0.prototype.GetterByBindingType=[e0.prototype._getValue_direct,e0.prototype._getValue_array,e0.prototype._getValue_arrayElement,e0.prototype._getValue_toArray];e0.prototype.SetterByBindingTypeAndVersioning=[[e0.prototype._setValue_direct,e0.prototype._setValue_direct_setNeedsUpdate,e0.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[e0.prototype._setValue_array,e0.prototype._setValue_array_setNeedsUpdate,e0.prototype._setValue_array_setMatrixWorldNeedsUpdate],[e0.prototype._setValue_arrayElement,e0.prototype._setValue_arrayElement_setNeedsUpdate,e0.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[e0.prototype._setValue_fromArray,e0.prototype._setValue_fromArray_setNeedsUpdate,e0.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class jZ{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 FU=new Float32Array(1);class kQ extends T9{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 TZ(e0.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 NQ(new Float32Array(2),new Float32Array(2),1,FU),$.__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"?$6.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 jZ(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"?$6.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 vZ{static{vZ.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 yZ(J,Q,$,Z){let W=NU(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 NU(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 AX(){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 OU(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 qU=`#ifdef USE_ALPHAHASH
6
6
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
- #endif`,GU=`#ifdef USE_ALPHAHASH
7
+ #endif`,RU=`#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 tW="184";var eW=0,G$=1,JY=2;var f6=1,QY=2,Z6=3,z9=0,hJ=1,lJ=2,C9=0,V8=1,x6=2
39
39
  : cases.z;
40
40
  return clamp( threshold , 1.0e-6, 1.0 );
41
41
  }
42
- #endif`,EU=`#ifdef USE_ALPHAMAP
42
+ #endif`,LU=`#ifdef USE_ALPHAMAP
43
43
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44
- #endif`,qU=`#ifdef USE_ALPHAMAP
44
+ #endif`,DU=`#ifdef USE_ALPHAMAP
45
45
  uniform sampler2D alphaMap;
46
- #endif`,FU=`#ifdef USE_ALPHATEST
46
+ #endif`,MU=`#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`,NU=`#ifdef USE_ALPHATEST
53
+ #endif`,kU=`#ifdef USE_ALPHATEST
54
54
  uniform float alphaTest;
55
- #endif`,OU=`#ifdef USE_AOMAP
55
+ #endif`,BU=`#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 tW="184";var eW=0,G$=1,JY=2;var f6=1,QY=2,Z6=3,z9=0,hJ=1,lJ=2,C9=0,V8=1,x6=2
65
65
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66
66
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67
67
  #endif
68
- #endif`,RU=`#ifdef USE_AOMAP
68
+ #endif`,VU=`#ifdef USE_AOMAP
69
69
  uniform sampler2D aoMap;
70
70
  uniform float aoMapIntensity;
71
- #endif`,LU=`#ifdef USE_BATCHING
71
+ #endif`,CU=`#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 tW="184";var eW=0,G$=1,JY=2;var f6=1,QY=2,Z6=3,z9=0,hJ=1,lJ=2,C9=0,V8=1,x6=2
102
102
  int y = j / size;
103
103
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104
104
  }
105
- #endif`,DU=`#ifdef USE_BATCHING
105
+ #endif`,IU=`#ifdef USE_BATCHING
106
106
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107
- #endif`,MU=`vec3 transformed = vec3( position );
107
+ #endif`,zU=`vec3 transformed = vec3( position );
108
108
  #ifdef USE_ALPHAHASH
109
109
  vPosition = vec3( position );
110
- #endif`,kU=`vec3 objectNormal = vec3( normal );
110
+ #endif`,wU=`vec3 objectNormal = vec3( normal );
111
111
  #ifdef USE_TANGENT
112
112
  vec3 objectTangent = vec3( tangent.xyz );
113
- #endif`,BU=`float G_BlinnPhong_Implicit( ) {
113
+ #endif`,PU=`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`,VU=`#ifdef USE_IRIDESCENCE
127
+ } // validated`,_U=`#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`,zU=`#ifdef USE_BUMPMAP
190
+ #endif`,TU=`#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`,CU=`#if NUM_CLIPPING_PLANES > 0
211
+ #endif`,AU=`#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`,IU=`#if NUM_CLIPPING_PLANES > 0
257
+ #endif`,SU=`#if NUM_CLIPPING_PLANES > 0
258
258
  varying vec3 vClipPosition;
259
259
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260
- #endif`,_U=`#if NUM_CLIPPING_PLANES > 0
260
+ #endif`,jU=`#if NUM_CLIPPING_PLANES > 0
261
261
  varying vec3 vClipPosition;
262
- #endif`,wU=`#if NUM_CLIPPING_PLANES > 0
262
+ #endif`,vU=`#if NUM_CLIPPING_PLANES > 0
263
263
  vClipPosition = - mvPosition.xyz;
264
- #endif`,PU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
264
+ #endif`,yU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265
265
  diffuseColor *= vColor;
266
- #endif`,TU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
266
+ #endif`,hU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267
267
  varying vec4 vColor;
268
- #endif`,AU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
268
+ #endif`,xU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269
269
  varying vec4 vColor;
270
- #endif`,SU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
270
+ #endif`,bU=`#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`,jU=`#define PI 3.141592653589793
283
+ #endif`,fU=`#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`,vU=`#ifdef ENVMAP_TYPE_CUBE_UV
350
+ } // validated`,gU=`#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`,yU=`vec3 transformedNormal = objectNormal;
443
+ #endif`,pU=`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`,fU=`#ifdef USE_DISPLACEMENTMAP
472
+ #endif`,dU=`#ifdef USE_DISPLACEMENTMAP
473
473
  uniform sampler2D displacementMap;
474
474
  uniform float displacementScale;
475
475
  uniform float displacementBias;
476
- #endif`,xU=`#ifdef USE_DISPLACEMENTMAP
476
+ #endif`,uU=`#ifdef USE_DISPLACEMENTMAP
477
477
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
478
- #endif`,hU=`#ifdef USE_EMISSIVEMAP
478
+ #endif`,mU=`#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`,bU=`#ifdef USE_EMISSIVEMAP
484
+ #endif`,lU=`#ifdef USE_EMISSIVEMAP
485
485
  uniform sampler2D emissiveMap;
486
- #endif`,gU="gl_FragColor = linearToOutputTexel( gl_FragColor );",pU=`vec4 LinearTransferOETF( in vec4 value ) {
486
+ #endif`,cU="gl_FragColor = linearToOutputTexel( gl_FragColor );",nU=`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
- }`,dU=`#ifdef USE_ENVMAP
494
+ }`,sU=`#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`,uU=`#ifdef USE_ENVMAP
521
+ #endif`,iU=`#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`,mU=`#ifdef USE_ENVMAP
529
+ #endif`,oU=`#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`,lU=`#ifdef USE_ENVMAP
540
+ #endif`,aU=`#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`,cU=`#ifdef USE_ENVMAP
551
+ #endif`,rU=`#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`,nU=`#ifdef USE_FOG
568
+ #endif`,tU=`#ifdef USE_FOG
569
569
  vFogDepth = - mvPosition.z;
570
- #endif`,sU=`#ifdef USE_FOG
570
+ #endif`,eU=`#ifdef USE_FOG
571
571
  varying float vFogDepth;
572
- #endif`,iU=`#ifdef USE_FOG
572
+ #endif`,JG=`#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`,oU=`#ifdef USE_FOG
579
+ #endif`,QG=`#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`,aU=`#ifdef USE_GRADIENTMAP
588
+ #endif`,$G=`#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
- }`,rU=`#ifdef USE_LIGHTMAP
600
+ }`,ZG=`#ifdef USE_LIGHTMAP
601
601
  uniform sampler2D lightMap;
602
602
  uniform float lightMapIntensity;
603
- #endif`,tU=`LambertMaterial material;
603
+ #endif`,WG=`LambertMaterial material;
604
604
  material.diffuseColor = diffuseColor.rgb;
605
- material.specularStrength = specularStrength;`,eU=`varying vec3 vViewPosition;
605
+ material.specularStrength = specularStrength;`,YG=`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`,JG=`uniform bool receiveShadow;
619
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,XG=`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>`,QG=`#ifdef USE_ENVMAP
736
+ #include <lightprobes_pars_fragment>`,KG=`#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`,$G=`ToonMaterial material;
770
- material.diffuseColor = diffuseColor.rgb;`,ZG=`varying vec3 vViewPosition;
769
+ #endif`,HG=`ToonMaterial material;
770
+ material.diffuseColor = diffuseColor.rgb;`,UG=`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`,WG=`BlinnPhongMaterial material;
782
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,GG=`BlinnPhongMaterial material;
783
783
  material.diffuseColor = diffuseColor.rgb;
784
784
  material.specularColor = specular;
785
785
  material.specularShininess = shininess;
786
- material.specularStrength = specularStrength;`,YG=`varying vec3 vViewPosition;
786
+ material.specularStrength = specularStrength;`,EG=`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`,XG=`PhysicalMaterial material;
803
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,FG=`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`,KG=`uniform sampler2D dfgLUT;
893
+ #endif`,NG=`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
- }`,HG=`
1253
+ }`,OG=`
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`,UG=`#if defined( RE_IndirectDiffuse )
1375
+ #endif`,qG=`#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`,GG=`#if defined( RE_IndirectDiffuse )
1396
+ #endif`,RG=`#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`,EG=`#ifdef USE_LIGHT_PROBES_GRID
1404
+ #endif`,LG=`#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`,qG=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1449
+ #endif`,DG=`#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`,MG=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1452
1452
  uniform float logDepthBufFC;
1453
1453
  varying float vFragDepth;
1454
1454
  varying float vIsPerspective;
1455
- #endif`,NG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1455
+ #endif`,kG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1456
1456
  varying float vFragDepth;
1457
1457
  varying float vIsPerspective;
1458
- #endif`,OG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1458
+ #endif`,BG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1459
1459
  vFragDepth = 1.0 + gl_Position.w;
1460
1460
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1461
- #endif`,RG=`#ifdef USE_MAP
1461
+ #endif`,VG=`#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`,LG=`#ifdef USE_MAP
1467
+ #endif`,CG=`#ifdef USE_MAP
1468
1468
  uniform sampler2D map;
1469
- #endif`,DG=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1469
+ #endif`,IG=`#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`,MG=`#if defined( USE_POINTS_UV )
1481
+ #endif`,zG=`#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`,kG=`float metalnessFactor = metalness;
1493
+ #endif`,wG=`float metalnessFactor = metalness;
1494
1494
  #ifdef USE_METALNESSMAP
1495
1495
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1496
1496
  metalnessFactor *= texelMetalness.b;
1497
- #endif`,BG=`#ifdef USE_METALNESSMAP
1497
+ #endif`,PG=`#ifdef USE_METALNESSMAP
1498
1498
  uniform sampler2D metalnessMap;
1499
- #endif`,VG=`#ifdef USE_INSTANCING_MORPH
1499
+ #endif`,_G=`#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`,zG=`#if defined( USE_MORPHCOLORS )
1505
+ #endif`,TG=`#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`,CG=`#ifdef USE_MORPHNORMALS
1514
+ #endif`,AG=`#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`,IG=`#ifdef USE_MORPHTARGETS
1519
+ #endif`,SG=`#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`,_G=`#ifdef USE_MORPHTARGETS
1533
+ #endif`,jG=`#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`,wG=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1538
+ #endif`,vG=`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;`,PG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1579
+ vec3 nonPerturbedNormal = normal;`,yG=`#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;`,PG=`#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`,TG=`#ifndef FLAT_SHADED
1597
+ #endif`,hG=`#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`,AG=`#ifndef FLAT_SHADED
1603
+ #endif`,xG=`#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`,SG=`#ifndef FLAT_SHADED
1609
+ #endif`,bG=`#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`,jG=`#ifdef USE_NORMALMAP
1615
+ #endif`,fG=`#ifdef USE_NORMALMAP
1616
1616
  uniform sampler2D normalMap;
1617
1617
  uniform vec2 normalScale;
1618
1618
  #endif
@@ -1634,13 +1634,13 @@ vec3 nonPerturbedNormal = normal;`,PG=`#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`,vG=`#ifdef USE_CLEARCOAT
1637
+ #endif`,gG=`#ifdef USE_CLEARCOAT
1638
1638
  vec3 clearcoatNormal = nonPerturbedNormal;
1639
- #endif`,yG=`#ifdef USE_CLEARCOAT_NORMALMAP
1639
+ #endif`,pG=`#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`,fG=`#ifdef USE_CLEARCOATMAP
1643
+ #endif`,dG=`#ifdef USE_CLEARCOATMAP
1644
1644
  uniform sampler2D clearcoatMap;
1645
1645
  #endif
1646
1646
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1649,18 +1649,18 @@ vec3 nonPerturbedNormal = normal;`,PG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1649
1649
  #endif
1650
1650
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1651
1651
  uniform sampler2D clearcoatRoughnessMap;
1652
- #endif`,xG=`#ifdef USE_IRIDESCENCEMAP
1652
+ #endif`,uG=`#ifdef USE_IRIDESCENCEMAP
1653
1653
  uniform sampler2D iridescenceMap;
1654
1654
  #endif
1655
1655
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1656
1656
  uniform sampler2D iridescenceThicknessMap;
1657
- #endif`,hG=`#ifdef OPAQUE
1657
+ #endif`,mG=`#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 );`,bG=`vec3 packNormalToRGB( const in vec3 normal ) {
1663
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,lG=`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
- }`,gG=`#ifdef PREMULTIPLIED_ALPHA
1742
+ }`,cG=`#ifdef PREMULTIPLIED_ALPHA
1743
1743
  gl_FragColor.rgb *= gl_FragColor.a;
1744
- #endif`,pG=`vec4 mvPosition = vec4( transformed, 1.0 );
1744
+ #endif`,nG=`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;`,dG=`#ifdef DITHERING
1752
+ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
1753
1753
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1754
- #endif`,uG=`#ifdef DITHERING
1754
+ #endif`,iG=`#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`,mG=`float roughnessFactor = roughness;
1761
+ #endif`,oG=`float roughnessFactor = roughness;
1762
1762
  #ifdef USE_ROUGHNESSMAP
1763
1763
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1764
1764
  roughnessFactor *= texelRoughness.g;
1765
- #endif`,lG=`#ifdef USE_ROUGHNESSMAP
1765
+ #endif`,aG=`#ifdef USE_ROUGHNESSMAP
1766
1766
  uniform sampler2D roughnessMap;
1767
- #endif`,cG=`#if NUM_SPOT_LIGHT_COORDS > 0
1767
+ #endif`,rG=`#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;`,dG=`#ifdef DITHERING
1964
1964
  }
1965
1965
  #endif
1966
1966
  #endif
1967
- #endif`,nG=`#if NUM_SPOT_LIGHT_COORDS > 0
1967
+ #endif`,tG=`#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;`,dG=`#ifdef DITHERING
2005
2005
  };
2006
2006
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2007
2007
  #endif
2008
- #endif`,sG=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2008
+ #endif`,eG=`#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;`,dG=`#ifdef DITHERING
2041
2041
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2042
2042
  }
2043
2043
  #pragma unroll_loop_end
2044
- #endif`,iG=`float getShadowMask() {
2044
+ #endif`,J5=`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;`,dG=`#ifdef DITHERING
2073
2073
  #endif
2074
2074
  #endif
2075
2075
  return shadow;
2076
- }`,oG=`#ifdef USE_SKINNING
2076
+ }`,Q5=`#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`,aG=`#ifdef USE_SKINNING
2081
+ #endif`,$5=`#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;`,dG=`#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`,rG=`#ifdef USE_SKINNING
2096
+ #endif`,Z5=`#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;`,dG=`#ifdef DITHERING
2101
2101
  skinned += boneMatZ * skinVertex * skinWeight.z;
2102
2102
  skinned += boneMatW * skinVertex * skinWeight.w;
2103
2103
  transformed = ( bindMatrixInverse * skinned ).xyz;
2104
- #endif`,tG=`#ifdef USE_SKINNING
2104
+ #endif`,W5=`#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;`,dG=`#ifdef DITHERING
2112
2112
  #ifdef USE_TANGENT
2113
2113
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2114
2114
  #endif
2115
- #endif`,eG=`float specularStrength;
2115
+ #endif`,Y5=`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`,J5=`#ifdef USE_SPECULARMAP
2121
+ #endif`,X5=`#ifdef USE_SPECULARMAP
2122
2122
  uniform sampler2D specularMap;
2123
- #endif`,Q5=`#if defined( TONE_MAPPING )
2123
+ #endif`,K5=`#if defined( TONE_MAPPING )
2124
2124
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2125
- #endif`,$5=`#ifndef saturate
2125
+ #endif`,H5=`#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; }`,Z5=`#ifdef USE_TRANSMISSION
2222
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#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; }`,Z5=`#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`,W5=`#ifdef USE_TRANSMISSION
2243
+ #endif`,G5=`#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; }`,Z5=`#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`,Y5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2369
+ #endif`,E5=`#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; }`,Z5=`#ifdef USE_TRANSMISS
2436
2436
  #ifdef USE_THICKNESSMAP
2437
2437
  uniform mat3 thicknessMapTransform;
2438
2438
  varying vec2 vThicknessMapUv;
2439
- #endif`,X5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2439
+ #endif`,F5=`#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; }`,Z5=`#ifdef USE_TRANSMISS
2530
2530
  #ifdef USE_THICKNESSMAP
2531
2531
  uniform mat3 thicknessMapTransform;
2532
2532
  varying vec2 vThicknessMapUv;
2533
- #endif`,K5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2533
+ #endif`,N5=`#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; }`,Z5=`#ifdef USE_TRANSMISS
2601
2601
  #endif
2602
2602
  #ifdef USE_THICKNESSMAP
2603
2603
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2604
- #endif`,H5=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2604
+ #endif`,O5=`#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; }`,Z5=`#ifdef USE_TRANSMISS
2610
2610
  worldPosition = instanceMatrix * worldPosition;
2611
2611
  #endif
2612
2612
  worldPosition = modelMatrix * worldPosition;
2613
- #endif`,U5=`varying vec2 vUv;
2613
+ #endif`,q5=`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
- }`,G5=`uniform sampler2D t2D;
2618
+ }`,R5=`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
- }`,E5=`varying vec3 vWorldDirection;
2630
+ }`,L5=`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
- }`,q5=`#ifdef ENVMAP_TYPE_CUBE
2637
+ }`,D5=`#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
+ }`,M5=`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
- }`,N5=`uniform samplerCube tCube;
2666
+ }`,k5=`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
- }`,O5=`#include <common>
2676
+ }`,B5=`#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
- }`,R5=`#if DEPTH_PACKING == 3200
2703
+ }`,V5=`#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
- }`,L5=`#define DISTANCE
2741
+ }`,C5=`#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
- }`,D5=`#define DISTANCE
2768
+ }`,I5=`#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
- }`,M5=`varying vec3 vWorldDirection;
2791
+ }`,z5=`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
- }`,k5=`uniform sampler2D tEquirect;
2797
+ }`,w5=`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
- }`,B5=`uniform float scale;
2806
+ }`,P5=`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
- }`,V5=`uniform vec3 diffuse;
2828
+ }`,_5=`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
- }`,z5=`#include <common>
2856
+ }`,T5=`#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
- }`,C5=`uniform vec3 diffuse;
2888
+ }`,A5=`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
- }`,I5=`#define LAMBERT
2936
+ }`,S5=`#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
- }`,_5=`#define LAMBERT
2975
+ }`,j5=`#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
- }`,w5=`#define MATCAP
3033
+ }`,v5=`#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
- }`,P5=`#define MATCAP
3067
+ }`,y5=`#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
- }`,T5=`#define NORMAL
3113
+ }`,h5=`#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
- }`,A5=`#define NORMAL
3146
+ }`,x5=`#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
- }`,S5=`#define PHONG
3167
+ }`,b5=`#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
- }`,j5=`#define PHONG
3206
+ }`,f5=`#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
- }`,v5=`#define STANDARD
3266
+ }`,g5=`#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
- }`,y5=`#define STANDARD
3309
+ }`,p5=`#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
- }`,f5=`#define TOON
3434
+ }`,d5=`#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
- }`,x5=`#define TOON
3471
+ }`,u5=`#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
- }`,h5=`uniform float size;
3523
+ }`,m5=`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
- }`,b5=`uniform vec3 diffuse;
3554
+ }`,l5=`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
- }`,g5=`#include <common>
3579
+ }`,c5=`#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
- }`,p5=`uniform vec3 color;
3602
+ }`,n5=`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
- }`,d5=`uniform float rotation;
3618
+ }`,s5=`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
- }`,u5=`uniform vec3 diffuse;
3642
+ }`,i5=`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
- }`,p0={alphahash_fragment:UU,alphahash_pars_fragment:GU,alphamap_fragment:EU,alphamap_pars_fragment:qU,alphatest_fragment:FU,alphatest_pars_fragment:NU,aomap_fragment:OU,aomap_pars_fragment:RU,batching_pars_vertex:LU,batching_vertex:DU,begin_vertex:MU,beginnormal_vertex:kU,bsdfs:BU,iridescence_fragment:VU,bumpmap_pars_fragment:zU,clipping_planes_fragment:CU,clipping_planes_pars_fragment:IU,clipping_planes_pars_vertex:_U,clipping_planes_vertex:wU,color_fragment:PU,color_pars_fragment:TU,color_pars_vertex:AU,color_vertex:SU,common:jU,cube_uv_reflection_fragment:vU,defaultnormal_vertex:yU,displacementmap_pars_vertex:fU,displacementmap_vertex:xU,emissivemap_fragment:hU,emissivemap_pars_fragment:bU,colorspace_fragment:gU,colorspace_pars_fragment:pU,envmap_fragment:dU,envmap_common_pars_fragment:uU,envmap_pars_fragment:mU,envmap_pars_vertex:lU,envmap_physical_pars_fragment:QG,envmap_vertex:cU,fog_vertex:nU,fog_pars_vertex:sU,fog_fragment:iU,fog_pars_fragment:oU,gradientmap_pars_fragment:aU,lightmap_pars_fragment:rU,lights_lambert_fragment:tU,lights_lambert_pars_fragment:eU,lights_pars_begin:JG,lights_toon_fragment:$G,lights_toon_pars_fragment:ZG,lights_phong_fragment:WG,lights_phong_pars_fragment:YG,lights_physical_fragment:XG,lights_physical_pars_fragment:KG,lights_fragment_begin:HG,lights_fragment_maps:UG,lights_fragment_end:GG,lightprobes_pars_fragment:EG,logdepthbuf_fragment:qG,logdepthbuf_pars_fragment:FG,logdepthbuf_pars_vertex:NG,logdepthbuf_vertex:OG,map_fragment:RG,map_pars_fragment:LG,map_particle_fragment:DG,map_particle_pars_fragment:MG,metalnessmap_fragment:kG,metalnessmap_pars_fragment:BG,morphinstance_vertex:VG,morphcolor_vertex:zG,morphnormal_vertex:CG,morphtarget_pars_vertex:IG,morphtarget_vertex:_G,normal_fragment_begin:wG,normal_fragment_maps:PG,normal_pars_fragment:TG,normal_pars_vertex:AG,normal_vertex:SG,normalmap_pars_fragment:jG,clearcoat_normal_fragment_begin:vG,clearcoat_normal_fragment_maps:yG,clearcoat_pars_fragment:fG,iridescence_pars_fragment:xG,opaque_fragment:hG,packing:bG,premultiplied_alpha_fragment:gG,project_vertex:pG,dithering_fragment:dG,dithering_pars_fragment:uG,roughnessmap_fragment:mG,roughnessmap_pars_fragment:lG,shadowmap_pars_fragment:cG,shadowmap_pars_vertex:nG,shadowmap_vertex:sG,shadowmask_pars_fragment:iG,skinbase_vertex:oG,skinning_pars_vertex:aG,skinning_vertex:rG,skinnormal_vertex:tG,specularmap_fragment:eG,specularmap_pars_fragment:J5,tonemapping_fragment:Q5,tonemapping_pars_fragment:$5,transmission_fragment:Z5,transmission_pars_fragment:W5,uv_pars_fragment:Y5,uv_pars_vertex:X5,uv_vertex:K5,worldpos_vertex:H5,background_vert:U5,background_frag:G5,backgroundCube_vert:E5,backgroundCube_frag:q5,cube_vert:F5,cube_frag:N5,depth_vert:O5,depth_frag:R5,distance_vert:L5,distance_frag:D5,equirect_vert:M5,equirect_frag:k5,linedashed_vert:B5,linedashed_frag:V5,meshbasic_vert:z5,meshbasic_frag:C5,meshlambert_vert:I5,meshlambert_frag:_5,meshmatcap_vert:w5,meshmatcap_frag:P5,meshnormal_vert:T5,meshnormal_frag:A5,meshphong_vert:S5,meshphong_frag:j5,meshphysical_vert:v5,meshphysical_frag:y5,meshtoon_vert:f5,meshtoon_frag:x5,points_vert:h5,points_frag:b5,shadow_vert:g5,shadow_frag:p5,sprite_vert:d5,sprite_frag:u5},X0={common:{diffuse:{value:new k0(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new v0},alphaMap:{value:null},alphaMapTransform:{value:new v0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new v0}},envmap:{envMap:{value:null},envMapRotation:{value:new v0},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new v0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new v0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new v0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new v0},normalScale:{value:new h0(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new v0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new v0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new v0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new v0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new k0(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 k0(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new v0},alphaTest:{value:0},uvTransform:{value:new v0}},sprite:{diffuse:{value:new k0(16777215)},opacity:{value:1},center:{value:new h0(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new v0},alphaMap:{value:null},alphaMapTransform:{value:new v0},alphaTest:{value:0}}},v9={basic:{uniforms:gJ([X0.common,X0.specularmap,X0.envmap,X0.aomap,X0.lightmap,X0.fog]),vertexShader:p0.meshbasic_vert,fragmentShader:p0.meshbasic_frag},lambert:{uniforms:gJ([X0.common,X0.specularmap,X0.envmap,X0.aomap,X0.lightmap,X0.emissivemap,X0.bumpmap,X0.normalmap,X0.displacementmap,X0.fog,X0.lights,{emissive:{value:new k0(0)},envMapIntensity:{value:1}}]),vertexShader:p0.meshlambert_vert,fragmentShader:p0.meshlambert_frag},phong:{uniforms:gJ([X0.common,X0.specularmap,X0.envmap,X0.aomap,X0.lightmap,X0.emissivemap,X0.bumpmap,X0.normalmap,X0.displacementmap,X0.fog,X0.lights,{emissive:{value:new k0(0)},specular:{value:new k0(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:p0.meshphong_vert,fragmentShader:p0.meshphong_frag},standard:{uniforms:gJ([X0.common,X0.envmap,X0.aomap,X0.lightmap,X0.emissivemap,X0.bumpmap,X0.normalmap,X0.displacementmap,X0.roughnessmap,X0.metalnessmap,X0.fog,X0.lights,{emissive:{value:new k0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:p0.meshphysical_vert,fragmentShader:p0.meshphysical_frag},toon:{uniforms:gJ([X0.common,X0.aomap,X0.lightmap,X0.emissivemap,X0.bumpmap,X0.normalmap,X0.displacementmap,X0.gradientmap,X0.fog,X0.lights,{emissive:{value:new k0(0)}}]),vertexShader:p0.meshtoon_vert,fragmentShader:p0.meshtoon_frag},matcap:{uniforms:gJ([X0.common,X0.bumpmap,X0.normalmap,X0.displacementmap,X0.fog,{matcap:{value:null}}]),vertexShader:p0.meshmatcap_vert,fragmentShader:p0.meshmatcap_frag},points:{uniforms:gJ([X0.points,X0.fog]),vertexShader:p0.points_vert,fragmentShader:p0.points_frag},dashed:{uniforms:gJ([X0.common,X0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:p0.linedashed_vert,fragmentShader:p0.linedashed_frag},depth:{uniforms:gJ([X0.common,X0.displacementmap]),vertexShader:p0.depth_vert,fragmentShader:p0.depth_frag},normal:{uniforms:gJ([X0.common,X0.bumpmap,X0.normalmap,X0.displacementmap,{opacity:{value:1}}]),vertexShader:p0.meshnormal_vert,fragmentShader:p0.meshnormal_frag},sprite:{uniforms:gJ([X0.sprite,X0.fog]),vertexShader:p0.sprite_vert,fragmentShader:p0.sprite_frag},background:{uniforms:{uvTransform:{value:new v0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:p0.background_vert,fragmentShader:p0.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new v0}},vertexShader:p0.backgroundCube_vert,fragmentShader:p0.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:p0.cube_vert,fragmentShader:p0.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:p0.equirect_vert,fragmentShader:p0.equirect_frag},distance:{uniforms:gJ([X0.common,X0.displacementmap,{referencePosition:{value:new A},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:p0.distance_vert,fragmentShader:p0.distance_frag},shadow:{uniforms:gJ([X0.lights,X0.fog,{color:{value:new k0(0)},opacity:{value:1}}]),vertexShader:p0.shadow_vert,fragmentShader:p0.shadow_frag}};v9.physical={uniforms:gJ([v9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new v0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new v0},clearcoatNormalScale:{value:new h0(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new v0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new v0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new v0},sheen:{value:0},sheenColor:{value:new k0(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new v0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new v0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new v0},transmissionSamplerSize:{value:new h0},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new v0},attenuationDistance:{value:0},attenuationColor:{value:new k0(0)},specularColor:{value:new k0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new v0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new v0},anisotropyVector:{value:new h0},anisotropyMap:{value:null},anisotropyMapTransform:{value:new v0}}]),vertexShader:p0.meshphysical_vert,fragmentShader:p0.meshphysical_frag};var MQ={r:0,b:0,g:0},m5=new S0,wX=new v0;wX.set(-1,0,0,0,1,0,0,0,1);function l5(J,Q,$,Z,W,Y){let X=new k0(0),K=W===!0?0:1,H,U,G=null,q=0,E=null;function O(D){let B=D.isScene===!0?D.background:null;if(B&&B.isTexture){let C=D.backgroundBlurriness>0;B=Q.get(B,C)}return B}function R(D){let B=!1,C=O(D);if(C===null)F(X,K);else if(C&&C.isColor)F(C,1),B=!0;let T=J.xr.getEnvironmentBlendMode();if(T==="additive")$.buffers.color.setClear(0,0,0,1,Y);else if(T==="alpha-blend")$.buffers.color.setClear(0,0,0,0,Y);if(J.autoClear||B)$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function k(D,B){let C=O(B);if(C&&(C.isCubeTexture||C.mapping===b6)){if(U===void 0)U=new FJ(new Y9(1,1,1),new SJ({name:"BackgroundCubeMaterial",uniforms:S8(v9.backgroundCube.uniforms),vertexShader:v9.backgroundCube.vertexShader,fragmentShader:v9.backgroundCube.fragmentShader,side:hJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(T,P,_){this.matrixWorld.copyPosition(_.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(U.material.uniforms.envMap.value=C,U.material.uniforms.backgroundBlurriness.value=B.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=B.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(m5.makeRotationFromEuler(B.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1)U.material.uniforms.backgroundRotation.value.premultiply(wX);if(U.material.toneMapped=l0.getTransfer(C.colorSpace)!==UJ,G!==C||q!==C.version||E!==J.toneMapping)U.material.needsUpdate=!0,G=C,q=C.version,E=J.toneMapping;U.layers.enableAll(),D.unshift(U,U.geometry,U.material,0,0,null)}else if(C&&C.isTexture){if(H===void 0)H=new FJ(new L9(2,2),new SJ({name:"BackgroundMaterial",uniforms:S8(v9.background.uniforms),vertexShader:v9.background.vertexShader,fragmentShader:v9.background.fragmentShader,side:z9,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=C,H.material.uniforms.backgroundIntensity.value=B.backgroundIntensity,H.material.toneMapped=l0.getTransfer(C.colorSpace)!==UJ,C.matrixAutoUpdate===!0)C.updateMatrix();if(H.material.uniforms.uvTransform.value.copy(C.matrix),G!==C||q!==C.version||E!==J.toneMapping)H.material.needsUpdate=!0,G=C,q=C.version,E=J.toneMapping;H.layers.enableAll(),D.unshift(H,H.geometry,H.material,0,0,null)}}function F(D,B){D.getRGB(MQ,OZ(J)),$.buffers.color.setClear(MQ.r,MQ.g,MQ.b,B,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(D,B=1){X.set(D),K=B,F(X,K)},getClearAlpha:function(){return K},setClearAlpha:function(D){K=D,F(X,K)},render:R,addToRenderList:k,dispose:N}}function c5(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=E(null),Y=W,X=!1;function K(I,j,b,v,x){let p=!1,d=q(I,v,b,j);if(Y!==d)Y=d,U(Y.object);if(p=O(I,v,b,x),p)R(I,v,b,x);if(x!==null)Q.update(x,J.ELEMENT_ARRAY_BUFFER);if(p||X){if(X=!1,C(I,j,b,v),x!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(x).buffer)}}function H(){return J.createVertexArray()}function U(I){return J.bindVertexArray(I)}function G(I){return J.deleteVertexArray(I)}function q(I,j,b,v){let x=v.wireframe===!0,p=Z[j.id];if(p===void 0)p={},Z[j.id]=p;let d=I.isInstancedMesh===!0?I.id:0,n=p[d];if(n===void 0)n={},p[d]=n;let r=n[b.id];if(r===void 0)r={},n[b.id]=r;let Y0=r[x];if(Y0===void 0)Y0=E(H()),r[x]=Y0;return Y0}function E(I){let j=[],b=[],v=[];for(let x=0;x<$;x++)j[x]=0,b[x]=0,v[x]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:j,enabledAttributes:b,attributeDivisors:v,object:I,attributes:{},index:null}}function O(I,j,b,v){let x=Y.attributes,p=j.attributes,d=0,n=b.getAttributes();for(let r in n)if(n[r].location>=0){let R0=x[r],G0=p[r];if(G0===void 0){if(r==="instanceMatrix"&&I.instanceMatrix)G0=I.instanceMatrix;if(r==="instanceColor"&&I.instanceColor)G0=I.instanceColor}if(R0===void 0)return!0;if(R0.attribute!==G0)return!0;if(G0&&R0.data!==G0.data)return!0;d++}if(Y.attributesNum!==d)return!0;if(Y.index!==v)return!0;return!1}function R(I,j,b,v){let x={},p=j.attributes,d=0,n=b.getAttributes();for(let r in n)if(n[r].location>=0){let R0=p[r];if(R0===void 0){if(r==="instanceMatrix"&&I.instanceMatrix)R0=I.instanceMatrix;if(r==="instanceColor"&&I.instanceColor)R0=I.instanceColor}let G0={};if(G0.attribute=R0,R0&&R0.data)G0.data=R0.data;x[r]=G0,d++}Y.attributes=x,Y.attributesNum=d,Y.index=v}function k(){let I=Y.newAttributes;for(let j=0,b=I.length;j<b;j++)I[j]=0}function F(I){N(I,0)}function N(I,j){let{newAttributes:b,enabledAttributes:v,attributeDivisors:x}=Y;if(b[I]=1,v[I]===0)J.enableVertexAttribArray(I),v[I]=1;if(x[I]!==j)J.vertexAttribDivisor(I,j),x[I]=j}function D(){let{newAttributes:I,enabledAttributes:j}=Y;for(let b=0,v=j.length;b<v;b++)if(j[b]!==I[b])J.disableVertexAttribArray(b),j[b]=0}function B(I,j,b,v,x,p,d){if(d===!0)J.vertexAttribIPointer(I,j,b,x,p);else J.vertexAttribPointer(I,j,b,v,x,p)}function C(I,j,b,v){k();let x=v.attributes,p=b.getAttributes(),d=j.defaultAttributeValues;for(let n in p){let r=p[n];if(r.location>=0){let Y0=x[n];if(Y0===void 0){if(n==="instanceMatrix"&&I.instanceMatrix)Y0=I.instanceMatrix;if(n==="instanceColor"&&I.instanceColor)Y0=I.instanceColor}if(Y0!==void 0){let{normalized:R0,itemSize:G0}=Y0,a0=Q.get(Y0);if(a0===void 0)continue;let{buffer:n0,type:i,bytesPerElement:F0}=a0,z0=i===J.INT||i===J.UNSIGNED_INT||Y0.gpuType===k$;if(Y0.isInterleavedBufferAttribute){let N0=Y0.data,P0=N0.stride,e0=Y0.offset;if(N0.isInstancedInterleavedBuffer){for(let d0=0;d0<r.locationSize;d0++)N(r.location+d0,N0.meshPerAttribute);if(I.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=N0.meshPerAttribute*N0.count}else for(let d0=0;d0<r.locationSize;d0++)F(r.location+d0);J.bindBuffer(J.ARRAY_BUFFER,n0);for(let d0=0;d0<r.locationSize;d0++)B(r.location+d0,G0/r.locationSize,i,R0,P0*F0,(e0+G0/r.locationSize*d0)*F0,z0)}else{if(Y0.isInstancedBufferAttribute){for(let N0=0;N0<r.locationSize;N0++)N(r.location+N0,Y0.meshPerAttribute);if(I.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=Y0.meshPerAttribute*Y0.count}else for(let N0=0;N0<r.locationSize;N0++)F(r.location+N0);J.bindBuffer(J.ARRAY_BUFFER,n0);for(let N0=0;N0<r.locationSize;N0++)B(r.location+N0,G0/r.locationSize,i,R0,G0*F0,G0/r.locationSize*N0*F0,z0)}}else if(d!==void 0){let R0=d[n];if(R0!==void 0)switch(R0.length){case 2:J.vertexAttrib2fv(r.location,R0);break;case 3:J.vertexAttrib3fv(r.location,R0);break;case 4:J.vertexAttrib4fv(r.location,R0);break;default:J.vertexAttrib1fv(r.location,R0)}}}}D()}function T(){z();for(let I in Z){let j=Z[I];for(let b in j){let v=j[b];for(let x in v){let p=v[x];for(let d in p)G(p[d].object),delete p[d];delete v[x]}}delete Z[I]}}function P(I){if(Z[I.id]===void 0)return;let j=Z[I.id];for(let b in j){let v=j[b];for(let x in v){let p=v[x];for(let d in p)G(p[d].object),delete p[d];delete v[x]}}delete Z[I.id]}function _(I){for(let j in Z){let b=Z[j];for(let v in b){let x=b[v];if(x[I.id]===void 0)continue;let p=x[I.id];for(let d in p)G(p[d].object),delete p[d];delete x[I.id]}}}function L(I){for(let j in Z){let b=Z[j],v=I.isInstancedMesh===!0?I.id:0,x=b[v];if(x===void 0)continue;for(let p in x){let d=x[p];for(let n in d)G(d[n].object),delete d[n];delete x[p]}if(delete b[v],Object.keys(b).length===0)delete Z[j]}}function z(){if(S(),X=!0,Y===W)return;Y=W,U(Y.object)}function S(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:K,reset:z,resetDefaultState:S,dispose:T,releaseStatesOfGeometry:P,releaseStatesOfObject:L,releaseStatesOfProgram:_,initAttributes:k,enableAttribute:F,disableUnusedAttributes:D}}function n5(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 s5(J,Q,$,Z){let W;function Y(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let _=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function X(_){if(_!==_9&&Z.convert(_)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function K(_){let L=_===bJ&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(_!==R9&&Z.convert(_)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&_!==rJ&&!L)return!1;return!0}function H(_){if(_==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";_="mediump"}if(_==="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)B0("WebGLRenderer:",U,"not supported, using",G,"instead."),U=G;let q=$.logarithmicDepthBuffer===!0,E=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control");if($.reversedDepthBuffer===!0&&E===!1)B0("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),k=J.getParameter(J.MAX_TEXTURE_SIZE),F=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),N=J.getParameter(J.MAX_VERTEX_ATTRIBS),D=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),B=J.getParameter(J.MAX_VARYING_VECTORS),C=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),T=J.getParameter(J.MAX_SAMPLES),P=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:Y,getMaxPrecision:H,textureFormatReadable:X,textureTypeReadable:K,precision:U,logarithmicDepthBuffer:q,reversedDepthBuffer:E,maxTextures:O,maxVertexTextures:R,maxTextureSize:k,maxCubemapSize:F,maxAttributes:N,maxVertexUniforms:D,maxVaryings:B,maxFragmentUniforms:C,maxSamples:T,samples:P}}function i5(J){let Q=this,$=null,Z=0,W=!1,Y=!1,X=new q9,K=new v0,H={value:null,needsUpdate:!1};this.uniform=H,this.numPlanes=0,this.numIntersection=0,this.init=function(q,E){let O=q.length!==0||E||Z!==0||W;return W=E,Z=q.length,O},this.beginShadows=function(){Y=!0,G(null)},this.endShadows=function(){Y=!1},this.setGlobalState=function(q,E){$=G(q,E,0)},this.setState=function(q,E,O){let{clippingPlanes:R,clipIntersection:k,clipShadows:F}=q,N=J.get(q);if(!W||R===null||R.length===0||Y&&!F)if(Y)G(null);else U();else{let D=Y?0:Z,B=D*4,C=N.clippingState||null;H.value=C,C=G(R,E,B,O);for(let T=0;T!==B;++T)C[T]=$[T];N.clippingState=C,this.numIntersection=k?this.numPlanes:0,this.numPlanes+=D}};function U(){if(H.value!==$)H.value=$,H.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function G(q,E,O,R){let k=q!==null?q.length:0,F=null;if(k!==0){if(F=H.value,R!==!0||F===null){let N=O+k*4,D=E.matrixWorldInverse;if(K.getNormalMatrix(D),F===null||F.length<N)F=new Float32Array(N);for(let B=0,C=O;B!==k;++B,C+=4)X.copy(q[B]).applyMatrix4(D,K),X.normal.toArray(F,C),F[C+3]=X.constant}H.value=F,H.needsUpdate=!0}return Q.numPlanes=k,Q.numIntersection=0,F}}var F8=4,WX=[0.125,0.215,0.35,0.446,0.526,0.582],y8=20,o5=256,e6=new v8,YX=new k0,vZ=null,yZ=0,fZ=0,xZ=!1,a5=new A;class Z7{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=a5}=W;vZ=this._renderer.getRenderTarget(),yZ=this._renderer.getActiveCubeFace(),fZ=this._renderer.getActiveMipmapLevel(),xZ=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=HX(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=KX(),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(vZ,yZ,fZ),this._renderer.xr.enabled=xZ,J.scissorTest=!1,k6(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===Y6||J.mapping===z8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);vZ=this._renderer.getRenderTarget(),yZ=this._renderer.getActiveCubeFace(),fZ=this._renderer.getActiveMipmapLevel(),xZ=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:kJ,minFilter:kJ,generateMipmaps:!1,type:bJ,format:_9,colorSpace:uJ,depthBuffer:!1},Z=XX(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=XX(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=r5(W)),this._blurMaterial=e5(W,J,Q),this._ggxMaterial=t5(W,J,Q)}return Z}_compileMaterial(J){let Q=new FJ(new BJ,J);this._renderer.compile(Q,e6)}_sceneToCubeUV(J,Q,$,Z,W){let K=new MJ(90,1,Q,$),H=[1,-1,1,1,1,1],U=[1,1,1,-1,-1,-1],G=this._renderer,q=G.autoClear,E=G.toneMapping;if(G.getClearColor(YX),G.toneMapping=aJ,G.autoClear=!1,G.state.buffers.depth.getReversed())G.setRenderTarget(Z),G.clearDepth(),G.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new FJ(new Y9,new P9({name:"PMREM.Background",side:hJ,depthWrite:!1,depthTest:!1}));let R=this._backgroundBox,k=R.material,F=!1,N=J.background;if(N){if(N.isColor)k.color.copy(N),J.background=null,F=!0}else k.color.copy(YX),F=!0;for(let D=0;D<6;D++){let B=D%3;if(B===0)K.up.set(0,H[D],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x+U[D],W.y,W.z);else if(B===1)K.up.set(0,0,H[D]),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y+U[D],W.z);else K.up.set(0,H[D],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y,W.z+U[D]);let C=this._cubeSize;if(k6(Z,B*C,D>2?C:0,C,C),G.setRenderTarget(Z),F)G.render(R,K);G.render(J,K)}G.toneMapping=E,G.autoClear=q,J.background=N}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===Y6||J.mapping===z8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=HX();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=KX();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;k6(Q,0,0,3*K,2*K),$.setRenderTarget(Q),$.render(Y,e6)}_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),q=0+H*1.25,E=G*q,{_lodMax:O}=this,R=this._sizeLods[$],k=3*R*($>O-F8?$-O+F8:0),F=4*(this._cubeSize-R);K.envMap.value=J.texture,K.roughness.value=E,K.mipInt.value=O-Q,k6(W,k,F,3*R,2*R),Z.setRenderTarget(W),Z.render(X,e6),K.envMap.value=W.texture,K.roughness.value=0,K.mipInt.value=O-$,k6(J,k,F,3*R,2*R),Z.setRenderTarget(J),Z.render(X,e6)}_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")A0("blur direction must be either latitudinal or longitudinal!");let U=3,G=this._lodMeshes[Z];G.material=H;let q=H.uniforms,E=this._sizeLods[$]-1,O=isFinite(W)?Math.PI/(2*E):2*Math.PI/(2*y8-1),R=W/O,k=isFinite(W)?1+Math.floor(U*R):y8;if(k>y8)B0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${k} samples when the maximum is set to ${y8}`);let F=[],N=0;for(let P=0;P<y8;++P){let _=P/R,L=Math.exp(-_*_/2);if(F.push(L),P===0)N+=L;else if(P<k)N+=2*L}for(let P=0;P<F.length;P++)F[P]=F[P]/N;if(q.envMap.value=J.texture,q.samples.value=k,q.weights.value=F,q.latitudinal.value=Y==="latitudinal",X)q.poleAxis.value=X;let{_lodMax:D}=this;q.dTheta.value=O,q.mipInt.value=D-$;let B=this._sizeLods[Z],C=3*B*(Z>D-F8?Z-D+F8:0),T=4*(this._cubeSize-B);k6(Q,C,T,3*B,2*B),K.setRenderTarget(Q),K.render(G,e6)}}function r5(J){let Q=[],$=[],Z=[],W=J,Y=J-F8+1+WX.length;for(let X=0;X<Y;X++){let K=Math.pow(2,W);Q.push(K);let H=1/K;if(X>J-F8)H=WX[X-J+F8-1];else if(X===0)H=0;$.push(H);let U=1/(K-2),G=-U,q=1+U,E=[G,G,q,G,q,q,G,G,q,q,G,q],O=6,R=6,k=3,F=2,N=1,D=new Float32Array(k*R*O),B=new Float32Array(F*R*O),C=new Float32Array(N*R*O);for(let P=0;P<O;P++){let _=P%3*2/3-1,L=P>2?0:-1,z=[_,L,0,_+0.6666666666666666,L,0,_+0.6666666666666666,L+1,0,_,L,0,_+0.6666666666666666,L+1,0,_,L+1,0];D.set(z,k*R*P),B.set(E,F*R*P);let S=[P,P,P,P,P,P];C.set(S,N*R*P)}let T=new BJ;if(T.setAttribute("position",new HJ(D,k)),T.setAttribute("uv",new HJ(B,F)),T.setAttribute("faceIndex",new HJ(C,N)),Z.push(new FJ(T,null)),W>F8)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function XX(J,Q,$){let Z=new cJ(J,Q,$);return Z.texture.mapping=b6,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function k6(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function t5(J,Q,$){return new SJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:o5,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:BQ(),fragmentShader:`
3667
+ }`,l0={alphahash_fragment:qU,alphahash_pars_fragment:RU,alphamap_fragment:LU,alphamap_pars_fragment:DU,alphatest_fragment:MU,alphatest_pars_fragment:kU,aomap_fragment:BU,aomap_pars_fragment:VU,batching_pars_vertex:CU,batching_vertex:IU,begin_vertex:zU,beginnormal_vertex:wU,bsdfs:PU,iridescence_fragment:_U,bumpmap_pars_fragment:TU,clipping_planes_fragment:AU,clipping_planes_pars_fragment:SU,clipping_planes_pars_vertex:jU,clipping_planes_vertex:vU,color_fragment:yU,color_pars_fragment:hU,color_pars_vertex:xU,color_vertex:bU,common:fU,cube_uv_reflection_fragment:gU,defaultnormal_vertex:pU,displacementmap_pars_vertex:dU,displacementmap_vertex:uU,emissivemap_fragment:mU,emissivemap_pars_fragment:lU,colorspace_fragment:cU,colorspace_pars_fragment:nU,envmap_fragment:sU,envmap_common_pars_fragment:iU,envmap_pars_fragment:oU,envmap_pars_vertex:aU,envmap_physical_pars_fragment:KG,envmap_vertex:rU,fog_vertex:tU,fog_pars_vertex:eU,fog_fragment:JG,fog_pars_fragment:QG,gradientmap_pars_fragment:$G,lightmap_pars_fragment:ZG,lights_lambert_fragment:WG,lights_lambert_pars_fragment:YG,lights_pars_begin:XG,lights_toon_fragment:HG,lights_toon_pars_fragment:UG,lights_phong_fragment:GG,lights_phong_pars_fragment:EG,lights_physical_fragment:FG,lights_physical_pars_fragment:NG,lights_fragment_begin:OG,lights_fragment_maps:qG,lights_fragment_end:RG,lightprobes_pars_fragment:LG,logdepthbuf_fragment:DG,logdepthbuf_pars_fragment:MG,logdepthbuf_pars_vertex:kG,logdepthbuf_vertex:BG,map_fragment:VG,map_pars_fragment:CG,map_particle_fragment:IG,map_particle_pars_fragment:zG,metalnessmap_fragment:wG,metalnessmap_pars_fragment:PG,morphinstance_vertex:_G,morphcolor_vertex:TG,morphnormal_vertex:AG,morphtarget_pars_vertex:SG,morphtarget_vertex:jG,normal_fragment_begin:vG,normal_fragment_maps:yG,normal_pars_fragment:hG,normal_pars_vertex:xG,normal_vertex:bG,normalmap_pars_fragment:fG,clearcoat_normal_fragment_begin:gG,clearcoat_normal_fragment_maps:pG,clearcoat_pars_fragment:dG,iridescence_pars_fragment:uG,opaque_fragment:mG,packing:lG,premultiplied_alpha_fragment:cG,project_vertex:nG,dithering_fragment:sG,dithering_pars_fragment:iG,roughnessmap_fragment:oG,roughnessmap_pars_fragment:aG,shadowmap_pars_fragment:rG,shadowmap_pars_vertex:tG,shadowmap_vertex:eG,shadowmask_pars_fragment:J5,skinbase_vertex:Q5,skinning_pars_vertex:$5,skinning_vertex:Z5,skinnormal_vertex:W5,specularmap_fragment:Y5,specularmap_pars_fragment:X5,tonemapping_fragment:K5,tonemapping_pars_fragment:H5,transmission_fragment:U5,transmission_pars_fragment:G5,uv_pars_fragment:E5,uv_pars_vertex:F5,uv_vertex:N5,worldpos_vertex:O5,background_vert:q5,background_frag:R5,backgroundCube_vert:L5,backgroundCube_frag:D5,cube_vert:M5,cube_frag:k5,depth_vert:B5,depth_frag:V5,distance_vert:C5,distance_frag:I5,equirect_vert:z5,equirect_frag:w5,linedashed_vert:P5,linedashed_frag:_5,meshbasic_vert:T5,meshbasic_frag:A5,meshlambert_vert:S5,meshlambert_frag:j5,meshmatcap_vert:v5,meshmatcap_frag:y5,meshnormal_vert:h5,meshnormal_frag:x5,meshphong_vert:b5,meshphong_frag:f5,meshphysical_vert:g5,meshphysical_frag:p5,meshtoon_vert:d5,meshtoon_frag:u5,points_vert:m5,points_frag:l5,shadow_vert:c5,shadow_frag:n5,sprite_vert:s5,sprite_frag:i5},U0={common:{diffuse:{value:new R0(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 p0(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 R0(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 j},probesMax:{value:new j},probesResolution:{value:new j}},points:{diffuse:{value:new R0(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 R0(16777215)},opacity:{value:1},center:{value:new p0(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new h0},alphaMap:{value:null},alphaMapTransform:{value:new h0},alphaTest:{value:0}}},y9={basic:{uniforms:gJ([U0.common,U0.specularmap,U0.envmap,U0.aomap,U0.lightmap,U0.fog]),vertexShader:l0.meshbasic_vert,fragmentShader:l0.meshbasic_frag},lambert:{uniforms:gJ([U0.common,U0.specularmap,U0.envmap,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.fog,U0.lights,{emissive:{value:new R0(0)},envMapIntensity:{value:1}}]),vertexShader:l0.meshlambert_vert,fragmentShader:l0.meshlambert_frag},phong:{uniforms:gJ([U0.common,U0.specularmap,U0.envmap,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.fog,U0.lights,{emissive:{value:new R0(0)},specular:{value:new R0(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:l0.meshphong_vert,fragmentShader:l0.meshphong_frag},standard:{uniforms:gJ([U0.common,U0.envmap,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.roughnessmap,U0.metalnessmap,U0.fog,U0.lights,{emissive:{value:new R0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:l0.meshphysical_vert,fragmentShader:l0.meshphysical_frag},toon:{uniforms:gJ([U0.common,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.gradientmap,U0.fog,U0.lights,{emissive:{value:new R0(0)}}]),vertexShader:l0.meshtoon_vert,fragmentShader:l0.meshtoon_frag},matcap:{uniforms:gJ([U0.common,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.fog,{matcap:{value:null}}]),vertexShader:l0.meshmatcap_vert,fragmentShader:l0.meshmatcap_frag},points:{uniforms:gJ([U0.points,U0.fog]),vertexShader:l0.points_vert,fragmentShader:l0.points_frag},dashed:{uniforms:gJ([U0.common,U0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:l0.linedashed_vert,fragmentShader:l0.linedashed_frag},depth:{uniforms:gJ([U0.common,U0.displacementmap]),vertexShader:l0.depth_vert,fragmentShader:l0.depth_frag},normal:{uniforms:gJ([U0.common,U0.bumpmap,U0.normalmap,U0.displacementmap,{opacity:{value:1}}]),vertexShader:l0.meshnormal_vert,fragmentShader:l0.meshnormal_frag},sprite:{uniforms:gJ([U0.sprite,U0.fog]),vertexShader:l0.sprite_vert,fragmentShader:l0.sprite_frag},background:{uniforms:{uvTransform:{value:new h0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:l0.background_vert,fragmentShader:l0.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new h0}},vertexShader:l0.backgroundCube_vert,fragmentShader:l0.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:l0.cube_vert,fragmentShader:l0.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:l0.equirect_vert,fragmentShader:l0.equirect_frag},distance:{uniforms:gJ([U0.common,U0.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:l0.distance_vert,fragmentShader:l0.distance_frag},shadow:{uniforms:gJ([U0.lights,U0.fog,{color:{value:new R0(0)},opacity:{value:1}}]),vertexShader:l0.shadow_vert,fragmentShader:l0.shadow_frag}};y9.physical={uniforms:gJ([y9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new h0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new h0},clearcoatNormalScale:{value:new p0(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 R0(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 p0},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new h0},attenuationDistance:{value:0},attenuationColor:{value:new R0(0)},specularColor:{value:new R0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new h0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new h0},anisotropyVector:{value:new p0},anisotropyMap:{value:null},anisotropyMapTransform:{value:new h0}}]),vertexShader:l0.meshphysical_vert,fragmentShader:l0.meshphysical_frag};var BQ={r:0,b:0,g:0},o5=new S0,SX=new h0;SX.set(-1,0,0,0,1,0,0,0,1);function a5(J,Q,$,Z,W,Y){let X=new R0(0),K=W===!0?0:1,H,U,G=null,F=0,E=null;function O(L){let M=L.isScene===!0?L.background:null;if(M&&M.isTexture){let k=L.backgroundBlurriness>0;M=Q.get(M,k)}return M}function R(L){let M=!1,k=O(L);if(k===null)q(X,K);else if(k&&k.isColor)q(k,1),M=!0;let _=J.xr.getEnvironmentBlendMode();if(_==="additive")$.buffers.color.setClear(0,0,0,1,Y);else if(_==="alpha-blend")$.buffers.color.setClear(0,0,0,0,Y);if(J.autoClear||M)$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function C(L,M){let k=O(M);if(k&&(k.isCubeTexture||k.mapping===p6)){if(U===void 0)U=new GJ(new Y9(1,1,1),new SJ({name:"BackgroundCubeMaterial",uniforms:S8(y9.backgroundCube.uniforms),vertexShader:y9.backgroundCube.vertexShader,fragmentShader:y9.backgroundCube.fragmentShader,side:bJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(_,P,V){this.matrixWorld.copyPosition(V.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(U.material.uniforms.envMap.value=k,U.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(o5.makeRotationFromEuler(M.backgroundRotation)).transpose(),k.isCubeTexture&&k.isRenderTargetTexture===!1)U.material.uniforms.backgroundRotation.value.premultiply(SX);if(U.material.toneMapped=s0.getTransfer(k.colorSpace)!==UJ,G!==k||F!==k.version||E!==J.toneMapping)U.material.needsUpdate=!0,G=k,F=k.version,E=J.toneMapping;U.layers.enableAll(),L.unshift(U,U.geometry,U.material,0,0,null)}else if(k&&k.isTexture){if(H===void 0)H=new GJ(new M9(2,2),new SJ({name:"BackgroundMaterial",uniforms:S8(y9.background.uniforms),vertexShader:y9.background.vertexShader,fragmentShader:y9.background.fragmentShader,side:z9,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=k,H.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,H.material.toneMapped=s0.getTransfer(k.colorSpace)!==UJ,k.matrixAutoUpdate===!0)k.updateMatrix();if(H.material.uniforms.uvTransform.value.copy(k.matrix),G!==k||F!==k.version||E!==J.toneMapping)H.material.needsUpdate=!0,G=k,F=k.version,E=J.toneMapping;H.layers.enableAll(),L.unshift(H,H.geometry,H.material,0,0,null)}}function q(L,M){L.getRGB(BQ,LZ(J)),$.buffers.color.setClear(BQ.r,BQ.g,BQ.b,M,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,M=1){X.set(L),K=M,q(X,K)},getClearAlpha:function(){return K},setClearAlpha:function(L){K=L,q(X,K)},render:R,addToRenderList:C,dispose:N}}function r5(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=E(null),Y=W,X=!1;function K(z,S,y,v,h){let g=!1,p=F(z,v,y,S);if(Y!==p)Y=p,U(Y.object);if(g=O(z,v,y,h),g)R(z,v,y,h);if(h!==null)Q.update(h,J.ELEMENT_ARRAY_BUFFER);if(g||X){if(X=!1,k(z,S,y,v),h!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(h).buffer)}}function H(){return J.createVertexArray()}function U(z){return J.bindVertexArray(z)}function G(z){return J.deleteVertexArray(z)}function F(z,S,y,v){let h=v.wireframe===!0,g=Z[S.id];if(g===void 0)g={},Z[S.id]=g;let p=z.isInstancedMesh===!0?z.id:0,c=g[p];if(c===void 0)c={},g[p]=c;let a=c[y.id];if(a===void 0)a={},c[y.id]=a;let Q0=a[h];if(Q0===void 0)Q0=E(H()),a[h]=Q0;return Q0}function E(z){let S=[],y=[],v=[];for(let h=0;h<$;h++)S[h]=0,y[h]=0,v[h]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:S,enabledAttributes:y,attributeDivisors:v,object:z,attributes:{},index:null}}function O(z,S,y,v){let h=Y.attributes,g=S.attributes,p=0,c=y.getAttributes();for(let a in c)if(c[a].location>=0){let H0=h[a],J0=g[a];if(J0===void 0){if(a==="instanceMatrix"&&z.instanceMatrix)J0=z.instanceMatrix;if(a==="instanceColor"&&z.instanceColor)J0=z.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!==v)return!0;return!1}function R(z,S,y,v){let h={},g=S.attributes,p=0,c=y.getAttributes();for(let a in c)if(c[a].location>=0){let H0=g[a];if(H0===void 0){if(a==="instanceMatrix"&&z.instanceMatrix)H0=z.instanceMatrix;if(a==="instanceColor"&&z.instanceColor)H0=z.instanceColor}let J0={};if(J0.attribute=H0,H0&&H0.data)J0.data=H0.data;h[a]=J0,p++}Y.attributes=h,Y.attributesNum=p,Y.index=v}function C(){let z=Y.newAttributes;for(let S=0,y=z.length;S<y;S++)z[S]=0}function q(z){N(z,0)}function N(z,S){let{newAttributes:y,enabledAttributes:v,attributeDivisors:h}=Y;if(y[z]=1,v[z]===0)J.enableVertexAttribArray(z),v[z]=1;if(h[z]!==S)J.vertexAttribDivisor(z,S),h[z]=S}function L(){let{newAttributes:z,enabledAttributes:S}=Y;for(let y=0,v=S.length;y<v;y++)if(S[y]!==z[y])J.disableVertexAttribArray(y),S[y]=0}function M(z,S,y,v,h,g,p){if(p===!0)J.vertexAttribIPointer(z,S,y,h,g);else J.vertexAttribPointer(z,S,y,v,h,g)}function k(z,S,y,v){C();let h=v.attributes,g=y.getAttributes(),p=S.defaultAttributeValues;for(let c in g){let a=g[c];if(a.location>=0){let Q0=h[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:H0,itemSize:J0}=Q0,x0=Q.get(Q0);if(x0===void 0)continue;let{buffer:v0,type:s,bytesPerElement:Y0}=x0,D0=s===J.INT||s===J.UNSIGNED_INT||Q0.gpuType===V$;if(Q0.isInterleavedBufferAttribute){let G0=Q0.data,w0=G0.stride,i0=Q0.offset;if(G0.isInstancedInterleavedBuffer){for(let j0=0;j0<a.locationSize;j0++)N(a.location+j0,G0.meshPerAttribute);if(z.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=G0.meshPerAttribute*G0.count}else for(let j0=0;j0<a.locationSize;j0++)q(a.location+j0);J.bindBuffer(J.ARRAY_BUFFER,v0);for(let j0=0;j0<a.locationSize;j0++)M(a.location+j0,J0/a.locationSize,s,H0,w0*Y0,(i0+J0/a.locationSize*j0)*Y0,D0)}else{if(Q0.isInstancedBufferAttribute){for(let G0=0;G0<a.locationSize;G0++)N(a.location+G0,Q0.meshPerAttribute);if(z.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=Q0.meshPerAttribute*Q0.count}else for(let G0=0;G0<a.locationSize;G0++)q(a.location+G0);J.bindBuffer(J.ARRAY_BUFFER,v0);for(let G0=0;G0<a.locationSize;G0++)M(a.location+G0,J0/a.locationSize,s,H0,J0*Y0,J0/a.locationSize*G0*Y0,D0)}}else if(p!==void 0){let H0=p[c];if(H0!==void 0)switch(H0.length){case 2:J.vertexAttrib2fv(a.location,H0);break;case 3:J.vertexAttrib3fv(a.location,H0);break;case 4:J.vertexAttrib4fv(a.location,H0);break;default:J.vertexAttrib1fv(a.location,H0)}}}}L()}function _(){B();for(let z in Z){let S=Z[z];for(let y in S){let v=S[y];for(let h in v){let g=v[h];for(let p in g)G(g[p].object),delete g[p];delete v[h]}}delete Z[z]}}function P(z){if(Z[z.id]===void 0)return;let S=Z[z.id];for(let y in S){let v=S[y];for(let h in v){let g=v[h];for(let p in g)G(g[p].object),delete g[p];delete v[h]}}delete Z[z.id]}function V(z){for(let S in Z){let y=Z[S];for(let v in y){let h=y[v];if(h[z.id]===void 0)continue;let g=h[z.id];for(let p in g)G(g[p].object),delete g[p];delete h[z.id]}}}function D(z){for(let S in Z){let y=Z[S],v=z.isInstancedMesh===!0?z.id:0,h=y[v];if(h===void 0)continue;for(let g in h){let p=h[g];for(let c in p)G(p[c].object),delete p[c];delete h[g]}if(delete y[v],Object.keys(y).length===0)delete Z[S]}}function B(){if(A(),X=!0,Y===W)return;Y=W,U(Y.object)}function A(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:K,reset:B,resetDefaultState:A,dispose:_,releaseStatesOfGeometry:P,releaseStatesOfObject:D,releaseStatesOfProgram:V,initAttributes:C,enableAttribute:q,disableUnusedAttributes:L}}function t5(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 e5(J,Q,$,Z){let W;function Y(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let V=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(V.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function X(V){if(V!==_9&&Z.convert(V)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function K(V){let D=V===fJ&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(V!==D9&&Z.convert(V)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&V!==tJ&&!D)return!1;return!0}function H(V){if(V==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";V="mediump"}if(V==="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),M=J.getParameter(J.MAX_VARYING_VECTORS),k=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),_=J.getParameter(J.MAX_SAMPLES),P=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:M,maxFragmentUniforms:k,maxSamples:_,samples:P}}function JE(J){let Q=this,$=null,Z=0,W=!1,Y=!1,X=new O9,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,M=L*4,k=N.clippingState||null;H.value=k,k=G(R,E,M,O);for(let _=0;_!==M;++_)k[_]=$[_];N.clippingState=k,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 M=0,k=O;M!==C;++M,k+=4)X.copy(F[M]).applyMatrix4(L,K),X.normal.toArray(q,k),q[k+3]=X.constant}H.value=q,H.needsUpdate=!0}return Q.numPlanes=C,Q.numIntersection=0,q}}var N8=4,HX=[0.125,0.215,0.35,0.446,0.526,0.582],y8=20,QE=256,Q7=new v8,UX=new R0,hZ=null,xZ=0,bZ=0,fZ=!1,$E=new j;class Y7{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=$E}=W;hZ=this._renderer.getRenderTarget(),xZ=this._renderer.getActiveCubeFace(),bZ=this._renderer.getActiveMipmapLevel(),fZ=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=FX(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=EX(),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(hZ,xZ,bZ),this._renderer.xr.enabled=fZ,J.scissorTest=!1,B6(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===Y6||J.mapping===C8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);hZ=this._renderer.getRenderTarget(),xZ=this._renderer.getActiveCubeFace(),bZ=this._renderer.getActiveMipmapLevel(),fZ=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:BJ,minFilter:BJ,generateMipmaps:!1,type:fJ,format:_9,colorSpace:uJ,depthBuffer:!1},Z=GX(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=GX(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=ZE(W)),this._blurMaterial=YE(W,J,Q),this._ggxMaterial=WE(W,J,Q)}return Z}_compileMaterial(J){let Q=new GJ(new RJ,J);this._renderer.compile(Q,Q7)}_sceneToCubeUV(J,Q,$,Z,W){let K=new kJ(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(UX),G.toneMapping=rJ,G.autoClear=!1,G.state.buffers.depth.getReversed())G.setRenderTarget(Z),G.clearDepth(),G.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new GJ(new Y9,new A9({name:"PMREM.Background",side:bJ,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(UX),q=!0;for(let L=0;L<6;L++){let M=L%3;if(M===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(M===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 k=this._cubeSize;if(B6(Z,M*k,L>2?k:0,k,k),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===Y6||J.mapping===C8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=FX();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=EX();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;B6(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-N8?$-O+N8:0),q=4*(this._cubeSize-R);K.envMap.value=J.texture,K.roughness.value=E,K.mipInt.value=O-Q,B6(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-$,B6(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")A0("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*y8-1),R=W/O,C=isFinite(W)?1+Math.floor(U*R):y8;if(C>y8)C0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${y8}`);let q=[],N=0;for(let P=0;P<y8;++P){let V=P/R,D=Math.exp(-V*V/2);if(q.push(D),P===0)N+=D;else if(P<C)N+=2*D}for(let P=0;P<q.length;P++)q[P]=q[P]/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 M=this._sizeLods[Z],k=3*M*(Z>L-N8?Z-L+N8:0),_=4*(this._cubeSize-M);B6(Q,k,_,3*M,2*M),K.setRenderTarget(Q),K.render(G,Q7)}}function ZE(J){let Q=[],$=[],Z=[],W=J,Y=J-N8+1+HX.length;for(let X=0;X<Y;X++){let K=Math.pow(2,W);Q.push(K);let H=1/K;if(X>J-N8)H=HX[X-J+N8-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),M=new Float32Array(q*R*O),k=new Float32Array(N*R*O);for(let P=0;P<O;P++){let V=P%3*2/3-1,D=P>2?0:-1,B=[V,D,0,V+0.6666666666666666,D,0,V+0.6666666666666666,D+1,0,V,D,0,V+0.6666666666666666,D+1,0,V,D+1,0];L.set(B,C*R*P),M.set(E,q*R*P);let A=[P,P,P,P,P,P];k.set(A,N*R*P)}let _=new RJ;if(_.setAttribute("position",new JJ(L,C)),_.setAttribute("uv",new JJ(M,q)),_.setAttribute("faceIndex",new JJ(k,N)),Z.push(new GJ(_,null)),W>N8)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function GX(J,Q,$){let Z=new nJ(J,Q,$);return Z.texture.mapping=p6,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function B6(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function WE(J,Q,$){return new SJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:QE,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:CQ(),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:C9,depthTest:!1,depthWrite:!1})}function e5(J,Q,$){let Z=new Float32Array(y8),W=new A(0,1,0);return new SJ({name:"SphericalGaussianBlur",defines:{n:y8,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:BQ(),fragmentShader:`
3771
+ `,blending:w9,depthTest:!1,depthWrite:!1})}function YE(J,Q,$){let Z=new Float32Array(y8),W=new j(0,1,0);return new SJ({name:"SphericalGaussianBlur",defines:{n:y8,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:CQ(),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:C9,depthTest:!1,depthWrite:!1})}function KX(){return new SJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:BQ(),fragmentShader:`
3831
+ `,blending:w9,depthTest:!1,depthWrite:!1})}function EX(){return new SJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:CQ(),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:C9,depthTest:!1,depthWrite:!1})}function HX(){return new SJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:BQ(),fragmentShader:`
3850
+ `,blending:w9,depthTest:!1,depthWrite:!1})}function FX(){return new SJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:CQ(),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:C9,depthTest:!1,depthWrite:!1})}function BQ(){return`
3866
+ `,blending:w9,depthTest:!1,depthWrite:!1})}function CQ(){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 dZ extends cJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new KQ(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 mZ extends nJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new UQ(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 Y9(5,5,5),W=new SJ({name:"CubemapFromEquirect",uniforms:S8($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:hJ,blending:C9});W.uniforms.tEquirect.value=Q;let Y=new FJ(Z,W),X=Q.minFilter;if(Q.minFilter===I9)Q.minFilter=kJ;return new IZ(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 JE(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===p7||O===d7)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 k=new dZ(R.height);return k.fromEquirectangularTexture(J,E),Q.set(E,k),E.addEventListener("dispose",U),K(k.texture,E.mapping)}else return null}}return E}function X(E){if(E&&E.isTexture){let O=E.mapping,R=O===p7||O===d7,k=O===Y6||O===z8;if(R||k){let F=$.get(E),N=F!==void 0?F.texture.pmremVersion:0;if(E.isRenderTargetTexture&&E.pmremVersion!==N){if(Z===null)Z=new Z7(J);return F=R?Z.fromEquirectangular(E,F):Z.fromCubemap(E,F),F.texture.pmremVersion=E.pmremVersion,$.set(E,F),F.texture}else if(F!==void 0)return F.texture;else{let D=E.image;if(R&&D&&D.height>0||k&&D&&H(D)){if(Z===null)Z=new Z7(J);return F=R?Z.fromEquirectangular(E):Z.fromCubemap(E),F.texture.pmremVersion=E.pmremVersion,$.set(E,F),E.addEventListener("dispose",G),F.texture}else return null}}}return E}function K(E,O){if(O===p7)E.mapping=Y6;else if(O===d7)E.mapping=z8;return E}function H(E){let O=0,R=6;for(let k=0;k<R;k++)if(E[k]!==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 q(){if(Q=new WeakMap,$=new WeakMap,Z!==null)Z.dispose(),Z=null}return{get:W,dispose:q}}function QE(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)h7("WebGLRenderer: "+Z+" extension not supported.");return W}}}function $E(J,Q,$,Z){let W={},Y=new WeakMap;function X(q){let E=q.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(q,E){if(W[E.id]===!0)return E;return E.addEventListener("dispose",X),W[E.id]=!0,$.memory.geometries++,E}function H(q){let E=q.attributes;for(let O in E)Q.update(E[O],J.ARRAY_BUFFER)}function U(q){let E=[],O=q.index,R=q.attributes.position,k=0;if(R===void 0)return;if(O!==null){let D=O.array;k=O.version;for(let B=0,C=D.length;B<C;B+=3){let T=D[B+0],P=D[B+1],_=D[B+2];E.push(T,P,P,_,_,T)}}else{let D=R.array;k=R.version;for(let B=0,C=D.length/3-1;B<C;B+=3){let T=B+0,P=B+1,_=B+2;E.push(T,P,P,_,_,T)}}let F=new(R.count>=65535?ZQ:$Q)(E,1);F.version=k;let N=Y.get(q);if(N)Q.remove(N);Y.set(q,F)}function G(q){let E=Y.get(q);if(E){let O=q.index;if(O!==null){if(E.version<O.version)U(q)}}else U(q);return Y.get(q)}return{get:K,update:H,getWireframeAttribute:G}}function ZE(J,Q,$){let Z;function W(q){Z=q}let Y,X;function K(q){Y=q.type,X=q.bytesPerElement}function H(q,E){J.drawElements(Z,E,Y,q*X),$.update(E,Z,1)}function U(q,E,O){if(O===0)return;J.drawElementsInstanced(Z,E,Y,q*X,O),$.update(E,Z,O)}function G(q,E,O){if(O===0)return;Q.get("WEBGL_multi_draw").multiDrawElementsWEBGL(Z,E,0,Y,q,0,O);let k=0;for(let F=0;F<O;F++)k+=E[F];$.update(k,Z,1)}this.setMode=W,this.setIndex=K,this.render=H,this.renderInstances=U,this.renderMultiDraw=G}function WE(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:A0("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 YE(J,Q,$){let Z=new WeakMap,W=new JJ;function Y(X,K,H){let U=X.morphTargetInfluences,G=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,q=G!==void 0?G.length:0,E=Z.get(K);if(E===void 0||E.count!==q){let z=function(){_.dispose(),Z.delete(K),K.removeEventListener("dispose",z)};if(E!==void 0)E.texture.dispose();let O=K.morphAttributes.position!==void 0,R=K.morphAttributes.normal!==void 0,k=K.morphAttributes.color!==void 0,F=K.morphAttributes.position||[],N=K.morphAttributes.normal||[],D=K.morphAttributes.color||[],B=0;if(O===!0)B=1;if(R===!0)B=2;if(k===!0)B=3;let C=K.attributes.position.count*B,T=1;if(C>Q.maxTextureSize)T=Math.ceil(C/Q.maxTextureSize),C=Q.maxTextureSize;let P=new Float32Array(C*T*4*q),_=new e7(P,C,T,q);_.type=rJ,_.needsUpdate=!0;let L=B*4;for(let S=0;S<q;S++){let I=F[S],j=N[S],b=D[S],v=C*T*4*S;for(let x=0;x<I.count;x++){let p=x*L;if(O===!0)W.fromBufferAttribute(I,x),P[v+p+0]=W.x,P[v+p+1]=W.y,P[v+p+2]=W.z,P[v+p+3]=0;if(R===!0)W.fromBufferAttribute(j,x),P[v+p+4]=W.x,P[v+p+5]=W.y,P[v+p+6]=W.z,P[v+p+7]=0;if(k===!0)W.fromBufferAttribute(b,x),P[v+p+8]=W.x,P[v+p+9]=W.y,P[v+p+10]=W.z,P[v+p+11]=b.itemSize===4?W.w:1}}E={count:q,texture:_,size:new h0(C,T)},Z.set(K,E),K.addEventListener("dispose",z)}if(X.isInstancedMesh===!0&&X.morphTexture!==null)H.getUniforms().setValue(J,"morphTexture",X.morphTexture,$);else{let O=0;for(let k=0;k<U.length;k++)O+=U[k];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 XE(J,Q,$,Z,W){let Y=new WeakMap;function X(U){let G=W.render.frame,q=U.geometry,E=Q.get(U,q);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 KE={[N$]:"LINEAR_TONE_MAPPING",[O$]:"REINHARD_TONE_MAPPING",[R$]:"CINEON_TONE_MAPPING",[h6]:"ACES_FILMIC_TONE_MAPPING",[D$]:"AGX_TONE_MAPPING",[M$]:"NEUTRAL_TONE_MAPPING",[L$]:"CUSTOM_TONE_MAPPING"};function HE(J,Q,$,Z,W){let Y=new cJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W,depthTexture:Z?new U8(Q,$):void 0}),X=new cJ(Q,$,{type:bJ,depthBuffer:!1,stencilBuffer:!1}),K=new BJ;K.setAttribute("position",new qJ([-1,3,0,-1,-1,0,3,-1,0],3)),K.setAttribute("uv",new qJ([0,2,0,0,2,0],2));let H=new RZ({uniforms:{tDiffuse:{value:null}},vertexShader:`
3956
+ `},Z=new Y9(5,5,5),W=new SJ({name:"CubemapFromEquirect",uniforms:S8($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:bJ,blending:w9});W.uniforms.tEquirect.value=Q;let Y=new GJ(Z,W),X=Q.minFilter;if(Q.minFilter===P9)Q.minFilter=BJ;return new PZ(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 XE(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===u7||O===m7)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 mZ(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===u7||O===m7,C=O===Y6||O===C8;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 Y7(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 Y7(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===u7)E.mapping=Y6;else if(O===m7)E.mapping=C8;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 KE(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)g7("WebGLRenderer: "+Z+" extension not supported.");return W}}}function HE(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 M=0,k=L.length;M<k;M+=3){let _=L[M+0],P=L[M+1],V=L[M+2];E.push(_,P,P,V,V,_)}}else{let L=R.array;C=R.version;for(let M=0,k=L.length/3-1;M<k;M+=3){let _=M+0,P=M+1,V=M+2;E.push(_,P,P,V,V,_)}}let q=new(R.count>=65535?YQ:WQ)(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 UE(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 GE(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:A0("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 EE(J,Q,$){let Z=new WeakMap,W=new QJ;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 B=function(){V.dispose(),Z.delete(K),K.removeEventListener("dispose",B)};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||[],M=0;if(O===!0)M=1;if(R===!0)M=2;if(C===!0)M=3;let k=K.attributes.position.count*M,_=1;if(k>Q.maxTextureSize)_=Math.ceil(k/Q.maxTextureSize),k=Q.maxTextureSize;let P=new Float32Array(k*_*4*F),V=new QQ(P,k,_,F);V.type=tJ,V.needsUpdate=!0;let D=M*4;for(let A=0;A<F;A++){let z=q[A],S=N[A],y=L[A],v=k*_*4*A;for(let h=0;h<z.count;h++){let g=h*D;if(O===!0)W.fromBufferAttribute(z,h),P[v+g+0]=W.x,P[v+g+1]=W.y,P[v+g+2]=W.z,P[v+g+3]=0;if(R===!0)W.fromBufferAttribute(S,h),P[v+g+4]=W.x,P[v+g+5]=W.y,P[v+g+6]=W.z,P[v+g+7]=0;if(C===!0)W.fromBufferAttribute(y,h),P[v+g+8]=W.x,P[v+g+9]=W.y,P[v+g+10]=W.z,P[v+g+11]=y.itemSize===4?W.w:1}}E={count:F,texture:V,size:new p0(k,_)},Z.set(K,E),K.addEventListener("dispose",B)}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 FE(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 NE={[R$]:"LINEAR_TONE_MAPPING",[L$]:"REINHARD_TONE_MAPPING",[D$]:"CINEON_TONE_MAPPING",[g6]:"ACES_FILMIC_TONE_MAPPING",[k$]:"AGX_TONE_MAPPING",[B$]:"NEUTRAL_TONE_MAPPING",[M$]:"CUSTOM_TONE_MAPPING"};function OE(J,Q,$,Z,W){let Y=new nJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W,depthTexture:Z?new U8(Q,$):void 0}),X=new nJ(Q,$,{type:fJ,depthBuffer:!1,stencilBuffer:!1}),K=new RJ;K.setAttribute("position",new NJ([-1,3,0,-1,-1,0,3,-1,0],3)),K.setAttribute("uv",new NJ([0,2,0,0,2,0],2));let H=new DZ({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 FJ(K,H),G=new v8(-1,1,1,-1,0,1),q=null,E=null,O=!1,R,k=null,F=[],N=!1;this.setSize=function(D,B){Y.setSize(D,B),X.setSize(D,B);for(let C=0;C<F.length;C++){let T=F[C];if(T.setSize)T.setSize(D,B)}},this.setEffects=function(D){F=D,N=F.length>0&&F[0].isRenderPass===!0;let{width:B,height:C}=Y;for(let T=0;T<F.length;T++){let P=F[T];if(P.setSize)P.setSize(B,C)}},this.begin=function(D,B){if(O)return!1;if(D.toneMapping===aJ&&F.length===0)return!1;if(k=B,B!==null){let{width:C,height:T}=B;if(Y.width!==C||Y.height!==T)this.setSize(C,T)}if(N===!1)D.setRenderTarget(Y);return R=D.toneMapping,D.toneMapping=aJ,!0},this.hasRenderPass=function(){return N},this.end=function(D,B){D.toneMapping=R,O=!0;let C=Y,T=X;for(let P=0;P<F.length;P++){let _=F[P];if(_.enabled===!1)continue;if(_.render(D,T,C,B),_.needsSwap!==!1){let L=C;C=T,T=L}}if(q!==D.outputColorSpace||E!==D.toneMapping){if(q=D.outputColorSpace,E=D.toneMapping,H.defines={},l0.getTransfer(q)===UJ)H.defines.SRGB_TRANSFER="";let P=KE[E];if(P)H.defines[P]="";H.needsUpdate=!0}H.uniforms.tDiffuse.value=C.texture,D.setRenderTarget(k),D.render(U,G),k=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 PX=new _J,gZ=new U8(1,1),TX=new e7,AX=new EZ,SX=new KQ,UX=[],GX=[],EX=new Float32Array(16),qX=new Float32Array(9),FX=new Float32Array(4);function B6(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,Y=UX[W];if(Y===void 0)Y=new Float32Array(W),UX[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 PJ(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$<Z;$++)if(J[$]!==Q[$])return!1;return!0}function TJ(J,Q){for(let $=0,Z=Q.length;$<Z;$++)J[$]=Q[$]}function VQ(J,Q){let $=GX[Q];if($===void 0)$=new Int32Array(Q),GX[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function UE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function GE(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(PJ($,Q))return;J.uniform2fv(this.addr,Q),TJ($,Q)}}function EE(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(PJ($,Q))return;J.uniform3fv(this.addr,Q),TJ($,Q)}}function qE(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(PJ($,Q))return;J.uniform4fv(this.addr,Q),TJ($,Q)}}function FE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(PJ($,Q))return;J.uniformMatrix2fv(this.addr,!1,Q),TJ($,Q)}else{if(PJ($,Z))return;FX.set(Z),J.uniformMatrix2fv(this.addr,!1,FX),TJ($,Z)}}function NE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(PJ($,Q))return;J.uniformMatrix3fv(this.addr,!1,Q),TJ($,Q)}else{if(PJ($,Z))return;qX.set(Z),J.uniformMatrix3fv(this.addr,!1,qX),TJ($,Z)}}function OE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(PJ($,Q))return;J.uniformMatrix4fv(this.addr,!1,Q),TJ($,Q)}else{if(PJ($,Z))return;EX.set(Z),J.uniformMatrix4fv(this.addr,!1,EX),TJ($,Z)}}function RE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function LE(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(PJ($,Q))return;J.uniform2iv(this.addr,Q),TJ($,Q)}}function DE(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(PJ($,Q))return;J.uniform3iv(this.addr,Q),TJ($,Q)}}function ME(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(PJ($,Q))return;J.uniform4iv(this.addr,Q),TJ($,Q)}}function kE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function BE(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(PJ($,Q))return;J.uniform2uiv(this.addr,Q),TJ($,Q)}}function VE(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(PJ($,Q))return;J.uniform3uiv(this.addr,Q),TJ($,Q)}}function zE(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(PJ($,Q))return;J.uniform4uiv(this.addr,Q),TJ($,Q)}}function CE(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)gZ.compareFunction=$.isReversedDepthBuffer()?t7:r7,Y=gZ;else Y=PX;$.setTexture2D(Q||Y,W)}function IE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||AX,W)}function _E(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||SX,W)}function wE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||TX,W)}function PE(J){switch(J){case 5126:return UE;case 35664:return GE;case 35665:return EE;case 35666:return qE;case 35674:return FE;case 35675:return NE;case 35676:return OE;case 5124:case 35670:return RE;case 35667:case 35671:return LE;case 35668:case 35672:return DE;case 35669:case 35673:return ME;case 5125:return kE;case 36294:return BE;case 36295:return VE;case 36296:return zE;case 35678:case 36198:case 36298:case 36306:case 35682:return CE;case 35679:case 36299:case 36307:return IE;case 35680:case 36300:case 36308:case 36293:return _E;case 36289:case 36303:case 36311:case 36292:return wE}}function TE(J,Q){J.uniform1fv(this.addr,Q)}function AE(J,Q){let $=B6(Q,this.size,2);J.uniform2fv(this.addr,$)}function SE(J,Q){let $=B6(Q,this.size,3);J.uniform3fv(this.addr,$)}function jE(J,Q){let $=B6(Q,this.size,4);J.uniform4fv(this.addr,$)}function vE(J,Q){let $=B6(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function yE(J,Q){let $=B6(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function fE(J,Q){let $=B6(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function xE(J,Q){J.uniform1iv(this.addr,Q)}function hE(J,Q){J.uniform2iv(this.addr,Q)}function bE(J,Q){J.uniform3iv(this.addr,Q)}function gE(J,Q){J.uniform4iv(this.addr,Q)}function pE(J,Q){J.uniform1uiv(this.addr,Q)}function dE(J,Q){J.uniform2uiv(this.addr,Q)}function uE(J,Q){J.uniform3uiv(this.addr,Q)}function mE(J,Q){J.uniform4uiv(this.addr,Q)}function lE(J,Q,$){let Z=this.cache,W=Q.length,Y=VQ($,W);if(!PJ(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);let X;if(this.type===J.SAMPLER_2D_SHADOW)X=gZ;else X=PX;for(let K=0;K!==W;++K)$.setTexture2D(Q[K]||X,Y[K])}function cE(J,Q,$){let Z=this.cache,W=Q.length,Y=VQ($,W);if(!PJ(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture3D(Q[X]||AX,Y[X])}function nE(J,Q,$){let Z=this.cache,W=Q.length,Y=VQ($,W);if(!PJ(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTextureCube(Q[X]||SX,Y[X])}function sE(J,Q,$){let Z=this.cache,W=Q.length,Y=VQ($,W);if(!PJ(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture2DArray(Q[X]||TX,Y[X])}function iE(J){switch(J){case 5126:return TE;case 35664:return AE;case 35665:return SE;case 35666:return jE;case 35674:return vE;case 35675:return yE;case 35676:return fE;case 5124:case 35670:return xE;case 35667:case 35671:return hE;case 35668:case 35672:return bE;case 35669:case 35673:return gE;case 5125:return pE;case 36294:return dE;case 36295:return uE;case 36296:return mE;case 35678:case 36198:case 36298:case 36306:case 35682:return lE;case 35679:case 36299:case 36307:return cE;case 35680:case 36300:case 36308:case 36293:return nE;case 36289:case 36303:case 36311:case 36292:return sE}}class jX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=PE(Q.type)}}class vX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=iE(Q.type)}}class yX{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 hZ=/(\w+)(\])?(\[|\.)?/g;function NX(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function oE(J,Q,$){let Z=J.name,W=Z.length;hZ.lastIndex=0;while(!0){let Y=hZ.exec(Z),X=hZ.lastIndex,K=Y[1],H=Y[2]==="]",U=Y[3];if(H)K=K|0;if(U===void 0||U==="["&&X+2===W){NX($,U===void 0?new jX(K,J,Q):new vX(K,J,Q));break}else{let q=$.map[K];if(q===void 0)q=new yX(K),NX($,q);$=q}}}class $7{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);oE(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 OX(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var aE=37297,rE=0;function tE(J,Q){let $=J.split(`
4002
+ }`,depthTest:!1,depthWrite:!1}),U=new GJ(K,H),G=new v8(-1,1,1,-1,0,1),F=null,E=null,O=!1,R,C=null,q=[],N=!1;this.setSize=function(L,M){Y.setSize(L,M),X.setSize(L,M);for(let k=0;k<q.length;k++){let _=q[k];if(_.setSize)_.setSize(L,M)}},this.setEffects=function(L){q=L,N=q.length>0&&q[0].isRenderPass===!0;let{width:M,height:k}=Y;for(let _=0;_<q.length;_++){let P=q[_];if(P.setSize)P.setSize(M,k)}},this.begin=function(L,M){if(O)return!1;if(L.toneMapping===rJ&&q.length===0)return!1;if(C=M,M!==null){let{width:k,height:_}=M;if(Y.width!==k||Y.height!==_)this.setSize(k,_)}if(N===!1)L.setRenderTarget(Y);return R=L.toneMapping,L.toneMapping=rJ,!0},this.hasRenderPass=function(){return N},this.end=function(L,M){L.toneMapping=R,O=!0;let k=Y,_=X;for(let P=0;P<q.length;P++){let V=q[P];if(V.enabled===!1)continue;if(V.render(L,_,k,M),V.needsSwap!==!1){let D=k;k=_,_=D}}if(F!==L.outputColorSpace||E!==L.toneMapping){if(F=L.outputColorSpace,E=L.toneMapping,H.defines={},s0.getTransfer(F)===UJ)H.defines.SRGB_TRANSFER="";let P=NE[E];if(P)H.defines[P]="";H.needsUpdate=!0}H.uniforms.tDiffuse.value=k.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 jX=new wJ,dZ=new U8(1,1),vX=new QQ,yX=new NZ,hX=new UQ,NX=[],OX=[],qX=new Float32Array(16),RX=new Float32Array(9),LX=new Float32Array(4);function V6(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,Y=NX[W];if(Y===void 0)Y=new Float32Array(W),NX[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 _J(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$<Z;$++)if(J[$]!==Q[$])return!1;return!0}function TJ(J,Q){for(let $=0,Z=Q.length;$<Z;$++)J[$]=Q[$]}function IQ(J,Q){let $=OX[Q];if($===void 0)$=new Int32Array(Q),OX[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function qE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function RE(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(_J($,Q))return;J.uniform2fv(this.addr,Q),TJ($,Q)}}function LE(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(_J($,Q))return;J.uniform3fv(this.addr,Q),TJ($,Q)}}function DE(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(_J($,Q))return;J.uniform4fv(this.addr,Q),TJ($,Q)}}function ME(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(_J($,Q))return;J.uniformMatrix2fv(this.addr,!1,Q),TJ($,Q)}else{if(_J($,Z))return;LX.set(Z),J.uniformMatrix2fv(this.addr,!1,LX),TJ($,Z)}}function kE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(_J($,Q))return;J.uniformMatrix3fv(this.addr,!1,Q),TJ($,Q)}else{if(_J($,Z))return;RX.set(Z),J.uniformMatrix3fv(this.addr,!1,RX),TJ($,Z)}}function BE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(_J($,Q))return;J.uniformMatrix4fv(this.addr,!1,Q),TJ($,Q)}else{if(_J($,Z))return;qX.set(Z),J.uniformMatrix4fv(this.addr,!1,qX),TJ($,Z)}}function VE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function CE(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(_J($,Q))return;J.uniform2iv(this.addr,Q),TJ($,Q)}}function IE(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(_J($,Q))return;J.uniform3iv(this.addr,Q),TJ($,Q)}}function zE(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(_J($,Q))return;J.uniform4iv(this.addr,Q),TJ($,Q)}}function wE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function PE(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(_J($,Q))return;J.uniform2uiv(this.addr,Q),TJ($,Q)}}function _E(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(_J($,Q))return;J.uniform3uiv(this.addr,Q),TJ($,Q)}}function TE(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(_J($,Q))return;J.uniform4uiv(this.addr,Q),TJ($,Q)}}function AE(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)dZ.compareFunction=$.isReversedDepthBuffer()?JQ:e7,Y=dZ;else Y=jX;$.setTexture2D(Q||Y,W)}function SE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||yX,W)}function jE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||hX,W)}function vE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||vX,W)}function yE(J){switch(J){case 5126:return qE;case 35664:return RE;case 35665:return LE;case 35666:return DE;case 35674:return ME;case 35675:return kE;case 35676:return BE;case 5124:case 35670:return VE;case 35667:case 35671:return CE;case 35668:case 35672:return IE;case 35669:case 35673:return zE;case 5125:return wE;case 36294:return PE;case 36295:return _E;case 36296:return TE;case 35678:case 36198:case 36298:case 36306:case 35682:return AE;case 35679:case 36299:case 36307:return SE;case 35680:case 36300:case 36308:case 36293:return jE;case 36289:case 36303:case 36311:case 36292:return vE}}function hE(J,Q){J.uniform1fv(this.addr,Q)}function xE(J,Q){let $=V6(Q,this.size,2);J.uniform2fv(this.addr,$)}function bE(J,Q){let $=V6(Q,this.size,3);J.uniform3fv(this.addr,$)}function fE(J,Q){let $=V6(Q,this.size,4);J.uniform4fv(this.addr,$)}function gE(J,Q){let $=V6(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function pE(J,Q){let $=V6(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function dE(J,Q){let $=V6(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function uE(J,Q){J.uniform1iv(this.addr,Q)}function mE(J,Q){J.uniform2iv(this.addr,Q)}function lE(J,Q){J.uniform3iv(this.addr,Q)}function cE(J,Q){J.uniform4iv(this.addr,Q)}function nE(J,Q){J.uniform1uiv(this.addr,Q)}function sE(J,Q){J.uniform2uiv(this.addr,Q)}function iE(J,Q){J.uniform3uiv(this.addr,Q)}function oE(J,Q){J.uniform4uiv(this.addr,Q)}function aE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);let X;if(this.type===J.SAMPLER_2D_SHADOW)X=dZ;else X=jX;for(let K=0;K!==W;++K)$.setTexture2D(Q[K]||X,Y[K])}function rE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture3D(Q[X]||yX,Y[X])}function tE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTextureCube(Q[X]||hX,Y[X])}function eE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture2DArray(Q[X]||vX,Y[X])}function J1(J){switch(J){case 5126:return hE;case 35664:return xE;case 35665:return bE;case 35666:return fE;case 35674:return gE;case 35675:return pE;case 35676:return dE;case 5124:case 35670:return uE;case 35667:case 35671:return mE;case 35668:case 35672:return lE;case 35669:case 35673:return cE;case 5125:return nE;case 36294:return sE;case 36295:return iE;case 36296:return oE;case 35678:case 36198:case 36298:case 36306:case 35682:return aE;case 35679:case 36299:case 36307:return rE;case 35680:case 36300:case 36308:case 36293:return tE;case 36289:case 36303:case 36311:case 36292:return eE}}class xX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=yE(Q.type)}}class bX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=J1(Q.type)}}class fX{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 gZ=/(\w+)(\])?(\[|\.)?/g;function DX(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function Q1(J,Q,$){let Z=J.name,W=Z.length;gZ.lastIndex=0;while(!0){let Y=gZ.exec(Z),X=gZ.lastIndex,K=Y[1],H=Y[2]==="]",U=Y[3];if(H)K=K|0;if(U===void 0||U==="["&&X+2===W){DX($,U===void 0?new xX(K,J,Q):new bX(K,J,Q));break}else{let F=$.map[K];if(F===void 0)F=new fX(K),DX($,F);$=F}}}class W7{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);Q1(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 MX(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var $1=37297,Z1=0;function W1(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 RX=new v0;function eE(J){l0._getMatrix(RX,l0.workingColorSpace,J);let Q=`mat3( ${RX.elements.map(($)=>$.toFixed(4))} )`;switch(l0.getTransfer(J)){case YZ:return[Q,"LinearTransferOETF"];case UJ:return[Q,"sRGBTransferOETF"];default:return B0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function LX(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 kX=new h0;function Y1(J){s0._getMatrix(kX,s0.workingColorSpace,J);let Q=`mat3( ${kX.elements.map(($)=>$.toFixed(4))} )`;switch(s0.getTransfer(J)){case KZ:return[Q,"LinearTransferOETF"];case UJ: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()+`
4005
4005
 
4006
4006
  `+Y+`
4007
4007
 
4008
- `+tE(J.getShaderSource(Q),K)}else return Y}function Jq(J,Q){let $=eE(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
4009
- `)}var Qq={[N$]:"Linear",[O$]:"Reinhard",[R$]:"Cineon",[h6]:"ACESFilmic",[D$]:"AgX",[M$]:"Neutral",[L$]:"Custom"};function $q(J,Q){let $=Qq[Q];if($===void 0)return B0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}var kQ=new A;function Zq(){l0.getLuminanceCoefficients(kQ);let J=kQ.x.toFixed(4),Q=kQ.y.toFixed(4),$=kQ.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
4010
- `)}function Wq(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Q7).join(`
4011
- `)}function Yq(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
4012
- `)}function Xq(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 Q7(J){return J!==""}function DX(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 MX(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}var Kq=/^[ \t]*#include +<([\w\d./]+)>/gm;function pZ(J){return J.replace(Kq,Uq)}var Hq=new Map;function Uq(J,Q){let $=p0[Q];if($===void 0){let Z=Hq.get(Q);if(Z!==void 0)$=p0[Z],B0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return pZ($)}var Gq=/#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 kX(J){return J.replace(Gq,Eq)}function Eq(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 BX(J){let Q=`precision ${J.precision} float;
4008
+ `+W1(J.getShaderSource(Q),K)}else return Y}function X1(J,Q){let $=Y1(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
4009
+ `)}var K1={[R$]:"Linear",[L$]:"Reinhard",[D$]:"Cineon",[g6]:"ACESFilmic",[k$]:"AgX",[B$]:"Neutral",[M$]:"Custom"};function H1(J,Q){let $=K1[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 VQ=new j;function U1(){s0.getLuminanceCoefficients(VQ);let J=VQ.x.toFixed(4),Q=VQ.y.toFixed(4),$=VQ.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
4010
+ `)}function G1(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Z7).join(`
4011
+ `)}function E1(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
4012
+ `)}function F1(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 Z7(J){return J!==""}function VX(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 CX(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}var N1=/^[ \t]*#include +<([\w\d./]+)>/gm;function uZ(J){return J.replace(N1,q1)}var O1=new Map;function q1(J,Q){let $=l0[Q];if($===void 0){let Z=O1.get(Q);if(Z!==void 0)$=l0[Z],C0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return uZ($)}var R1=/#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 IX(J){return J.replace(R1,L1)}function L1(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 zX(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 qq={[f6]:"SHADOWMAP_TYPE_PCF",[Z6]:"SHADOWMAP_TYPE_VSM"};function Fq(J){return qq[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Nq={[Y6]:"ENVMAP_TYPE_CUBE",[z8]:"ENVMAP_TYPE_CUBE",[b6]:"ENVMAP_TYPE_CUBE_UV"};function Oq(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return Nq[J.envMapMode]||"ENVMAP_TYPE_CUBE"}var Rq={[z8]:"ENVMAP_MODE_REFRACTION"};function Lq(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return Rq[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}var Dq={[TY]:"ENVMAP_BLENDING_MULTIPLY",[AY]:"ENVMAP_BLENDING_MIX",[SY]:"ENVMAP_BLENDING_ADD"};function Mq(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return Dq[J.combine]||"ENVMAP_BLENDING_NONE"}function kq(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 Bq(J,Q,$,Z){let W=J.getContext(),Y=$.defines,X=$.vertexShader,K=$.fragmentShader,H=Fq($),U=Oq($),G=Lq($),q=Mq($),E=kq($),O=Wq($),R=Yq(Y),k=W.createProgram(),F,N,D=$.glslVersion?"#version "+$.glslVersion+`
4033
- `:"";if($.isRawShaderMaterial){if(F=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(Q7).join(`
4034
- `),F.length>0)F+=`
4035
- `;if(N=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(Q7).join(`
4032
+ #define LOW_PRECISION`;return Q}var D1={[b6]:"SHADOWMAP_TYPE_PCF",[Z6]:"SHADOWMAP_TYPE_VSM"};function M1(J){return D1[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var k1={[Y6]:"ENVMAP_TYPE_CUBE",[C8]:"ENVMAP_TYPE_CUBE",[p6]:"ENVMAP_TYPE_CUBE_UV"};function B1(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return k1[J.envMapMode]||"ENVMAP_TYPE_CUBE"}var V1={[C8]:"ENVMAP_MODE_REFRACTION"};function C1(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return V1[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}var I1={[vY]:"ENVMAP_BLENDING_MULTIPLY",[yY]:"ENVMAP_BLENDING_MIX",[hY]:"ENVMAP_BLENDING_ADD"};function z1(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return I1[J.combine]||"ENVMAP_BLENDING_NONE"}function w1(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 P1(J,Q,$,Z){let W=J.getContext(),Y=$.defines,X=$.vertexShader,K=$.fragmentShader,H=M1($),U=B1($),G=C1($),F=z1($),E=w1($),O=G1($),R=E1(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(Z7).join(`
4034
+ `),q.length>0)q+=`
4035
+ `;if(N=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(Z7).join(`
4036
4036
  `),N.length>0)N+=`
4037
- `}else F=[BX($),"#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(Q7).join(`
4039
- `),N=[BX($),"#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 "+q:"",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!==aJ?"#define TONE_MAPPING":"",$.toneMapping!==aJ?p0.tonemapping_pars_fragment:"",$.toneMapping!==aJ?$q("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",p0.colorspace_pars_fragment,Jq("linearToOutputTexel",$.outputColorSpace),Zq(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
4040
- `].filter(Q7).join(`
4041
- `);if(X=pZ(X),X=DX(X,$),X=MX(X,$),K=pZ(K),K=DX(K,$),K=MX(K,$),X=kX(X),K=kX(K),$.isRawShaderMaterial!==!0)D=`#version 300 es
4042
- `,F=[O,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4037
+ `}else q=[zX($),"#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(Z7).join(`
4039
+ `),N=[zX($),"#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!==rJ?"#define TONE_MAPPING":"",$.toneMapping!==rJ?l0.tonemapping_pars_fragment:"",$.toneMapping!==rJ?H1("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",l0.colorspace_pars_fragment,X1("linearToOutputTexel",$.outputColorSpace),U1(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
4040
+ `].filter(Z7).join(`
4041
+ `);if(X=uZ(X),X=VX(X,$),X=CX(X,$),K=uZ(K),K=VX(K,$),K=CX(K,$),X=IX(X),K=IX(K),$.isRawShaderMaterial!==!0)L=`#version 300 es
4042
+ `,q=[O,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4043
4043
  `)+`
4044
- `+F,N=["#define varying in",$.glslVersion===XZ?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===XZ?"":"#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===HZ?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===HZ?"":"#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 B=D+F+X,C=D+N+K,T=OX(W,W.VERTEX_SHADER,B),P=OX(W,W.FRAGMENT_SHADER,C);if(W.attachShader(k,T),W.attachShader(k,P),$.index0AttributeName!==void 0)W.bindAttribLocation(k,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(k,0,"position");W.linkProgram(k);function _(I){if(J.debug.checkShaderErrors){let j=W.getProgramInfoLog(k)||"",b=W.getShaderInfoLog(T)||"",v=W.getShaderInfoLog(P)||"",x=j.trim(),p=b.trim(),d=v.trim(),n=!0,r=!0;if(W.getProgramParameter(k,W.LINK_STATUS)===!1)if(n=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,k,T,P);else{let Y0=LX(W,T,"vertex"),R0=LX(W,P,"fragment");A0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(k,W.VALIDATE_STATUS)+`
4046
+ `+N;let M=L+q+X,k=L+N+K,_=MX(W,W.VERTEX_SHADER,M),P=MX(W,W.FRAGMENT_SHADER,k);if(W.attachShader(C,_),W.attachShader(C,P),$.index0AttributeName!==void 0)W.bindAttribLocation(C,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(C,0,"position");W.linkProgram(C);function V(z){if(J.debug.checkShaderErrors){let S=W.getProgramInfoLog(C)||"",y=W.getShaderInfoLog(_)||"",v=W.getShaderInfoLog(P)||"",h=S.trim(),g=y.trim(),p=v.trim(),c=!0,a=!0;if(W.getProgramParameter(C,W.LINK_STATUS)===!1)if(c=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,C,_,P);else{let Q0=BX(W,_,"vertex"),H0=BX(W,P,"fragment");A0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(C,W.VALIDATE_STATUS)+`
4047
4047
 
4048
- Material Name: `+I.name+`
4049
- Material Type: `+I.type+`
4048
+ Material Name: `+z.name+`
4049
+ Material Type: `+z.type+`
4050
4050
 
4051
- Program Info Log: `+x+`
4052
- `+Y0+`
4053
- `+R0)}else if(x!=="")B0("WebGLProgram: Program Info Log:",x);else if(p===""||d==="")r=!1;if(r)I.diagnostics={runnable:n,programLog:x,vertexShader:{log:p,prefix:F},fragmentShader:{log:d,prefix:N}}}W.deleteShader(T),W.deleteShader(P),L=new $7(W,k),z=Xq(W,k)}let L;this.getUniforms=function(){if(L===void 0)_(this);return L};let z;this.getAttributes=function(){if(z===void 0)_(this);return z};let S=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(S===!1)S=W.getProgramParameter(k,aE);return S},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(k),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=rE++,this.cacheKey=Q,this.usedTimes=1,this.program=k,this.vertexShader=T,this.fragmentShader=P,this}var Vq=0;class fX{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 xX(J),Q.set(J,$);return $}}class xX{constructor(J){this.id=Vq++,this.code=J,this.usedTimes=0}}function zq(J){return J===w8||J===i7||J===o7}function Cq(J,Q,$,Z,W,Y){let X=new JQ,K=new fX,H=new Set,U=[],G=new Map,q=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(L){if(H.add(L),L===0)return"uv";return`uv${L}`}function k(L,z,S,I,j,b){let v=I.fog,x=j.geometry,p=L.isMeshStandardMaterial||L.isMeshLambertMaterial||L.isMeshPhongMaterial?I.environment:null,d=L.isMeshStandardMaterial||L.isMeshLambertMaterial&&!L.envMap||L.isMeshPhongMaterial&&!L.envMap,n=Q.get(L.envMap||p,d),r=!!n&&n.mapping===b6?n.image.height:null,Y0=O[L.type];if(L.precision!==null){if(E=Z.getMaxPrecision(L.precision),E!==L.precision)B0("WebGLProgram.getParameters:",L.precision,"not supported, using",E,"instead.")}let R0=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,G0=R0!==void 0?R0.length:0,a0=0;if(x.morphAttributes.position!==void 0)a0=1;if(x.morphAttributes.normal!==void 0)a0=2;if(x.morphAttributes.color!==void 0)a0=3;let n0,i,F0,z0;if(Y0){let y0=v9[Y0];n0=y0.vertexShader,i=y0.fragmentShader}else n0=L.vertexShader,i=L.fragmentShader,K.update(L),F0=K.getVertexShaderID(L),z0=K.getFragmentShaderID(L);let N0=J.getRenderTarget(),P0=J.state.buffers.depth.getReversed(),e0=j.isInstancedMesh===!0,d0=j.isBatchedMesh===!0,s0=!!L.map,WJ=!!L.matcap,YJ=!!n,b0=!!L.aoMap,jJ=!!L.lightMap,vJ=!!L.bumpMap,zJ=!!L.normalMap,f=!!L.displacementMap,pJ=!!L.emissiveMap,i0=!!L.metalnessMap,r0=!!L.roughnessMap,E0=L.anisotropy>0,NJ=L.clearcoat>0,T0=L.dispersion>0,w=L.iridescence>0,M=L.sheen>0,g=L.transmission>0,a=E0&&!!L.anisotropyMap,t=NJ&&!!L.clearcoatMap,J0=NJ&&!!L.clearcoatNormalMap,K0=NJ&&!!L.clearcoatRoughnessMap,c=w&&!!L.iridescenceMap,o=w&&!!L.iridescenceThicknessMap,W0=M&&!!L.sheenColorMap,D0=M&&!!L.sheenRoughnessMap,$0=!!L.specularMap,H0=!!L.specularColorMap,j0=!!L.specularIntensityMap,x0=g&&!!L.transmissionMap,u0=g&&!!L.thicknessMap,y=!!L.gradientMap,Z0=!!L.alphaMap,s=L.alphaTest>0,Q0=!!L.alphaHash,M0=!!L.extensions,e=aJ;if(L.toneMapped){if(N0===null||N0.isXRRenderTarget===!0)e=J.toneMapping}let I0={shaderID:Y0,shaderType:L.type,shaderName:L.name,vertexShader:n0,fragmentShader:i,defines:L.defines,customVertexShaderID:F0,customFragmentShaderID:z0,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:E,batching:d0,batchingColor:d0&&j._colorsTexture!==null,instancing:e0,instancingColor:e0&&j.instanceColor!==null,instancingMorph:e0&&j.morphTexture!==null,outputColorSpace:N0===null?J.outputColorSpace:N0.isXRRenderTarget===!0?N0.texture.colorSpace:l0.workingColorSpace,alphaToCoverage:!!L.alphaToCoverage,map:s0,matcap:WJ,envMap:YJ,envMapMode:YJ&&n.mapping,envMapCubeUVHeight:r,aoMap:b0,lightMap:jJ,bumpMap:vJ,normalMap:zJ,displacementMap:f,emissiveMap:pJ,normalMapObjectSpace:zJ&&L.normalMapType===gY,normalMapTangentSpace:zJ&&L.normalMapType===WZ,packedNormalMap:zJ&&L.normalMapType===WZ&&zq(L.normalMap.format),metalnessMap:i0,roughnessMap:r0,anisotropy:E0,anisotropyMap:a,clearcoat:NJ,clearcoatMap:t,clearcoatNormalMap:J0,clearcoatRoughnessMap:K0,dispersion:T0,iridescence:w,iridescenceMap:c,iridescenceThicknessMap:o,sheen:M,sheenColorMap:W0,sheenRoughnessMap:D0,specularMap:$0,specularColorMap:H0,specularIntensityMap:j0,transmission:g,transmissionMap:x0,thicknessMap:u0,gradientMap:y,opaque:L.transparent===!1&&L.blending===V8&&L.alphaToCoverage===!1,alphaMap:Z0,alphaTest:s,alphaHash:Q0,combine:L.combine,mapUv:s0&&R(L.map.channel),aoMapUv:b0&&R(L.aoMap.channel),lightMapUv:jJ&&R(L.lightMap.channel),bumpMapUv:vJ&&R(L.bumpMap.channel),normalMapUv:zJ&&R(L.normalMap.channel),displacementMapUv:f&&R(L.displacementMap.channel),emissiveMapUv:pJ&&R(L.emissiveMap.channel),metalnessMapUv:i0&&R(L.metalnessMap.channel),roughnessMapUv:r0&&R(L.roughnessMap.channel),anisotropyMapUv:a&&R(L.anisotropyMap.channel),clearcoatMapUv:t&&R(L.clearcoatMap.channel),clearcoatNormalMapUv:J0&&R(L.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:K0&&R(L.clearcoatRoughnessMap.channel),iridescenceMapUv:c&&R(L.iridescenceMap.channel),iridescenceThicknessMapUv:o&&R(L.iridescenceThicknessMap.channel),sheenColorMapUv:W0&&R(L.sheenColorMap.channel),sheenRoughnessMapUv:D0&&R(L.sheenRoughnessMap.channel),specularMapUv:$0&&R(L.specularMap.channel),specularColorMapUv:H0&&R(L.specularColorMap.channel),specularIntensityMapUv:j0&&R(L.specularIntensityMap.channel),transmissionMapUv:x0&&R(L.transmissionMap.channel),thicknessMapUv:u0&&R(L.thicknessMap.channel),alphaMapUv:Z0&&R(L.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(zJ||E0),vertexNormals:!!x.attributes.normal,vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!x.attributes.color&&x.attributes.color.itemSize===4,pointsUvs:j.isPoints===!0&&!!x.attributes.uv&&(s0||Z0),fog:!!v,useFog:L.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:L.wireframe===!1&&(L.flatShading===!0||x.attributes.normal===void 0&&zJ===!1&&(L.isMeshLambertMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isMeshPhysicalMaterial)),sizeAttenuation:L.sizeAttenuation===!0,logarithmicDepthBuffer:q,reversedDepthBuffer:P0,skinning:j.isSkinnedMesh===!0,morphTargets:x.morphAttributes.position!==void 0,morphNormals:x.morphAttributes.normal!==void 0,morphColors:x.morphAttributes.color!==void 0,morphTargetsCount:G0,morphTextureStride:a0,numDirLights:z.directional.length,numPointLights:z.point.length,numSpotLights:z.spot.length,numSpotLightMaps:z.spotLightMap.length,numRectAreaLights:z.rectArea.length,numHemiLights:z.hemi.length,numDirLightShadows:z.directionalShadowMap.length,numPointLightShadows:z.pointShadowMap.length,numSpotLightShadows:z.spotShadowMap.length,numSpotLightShadowsWithMaps:z.numSpotLightShadowsWithMaps,numLightProbes:z.numLightProbes,numLightProbeGrids:b.length,numClippingPlanes:Y.numPlanes,numClipIntersection:Y.numIntersection,dithering:L.dithering,shadowMapEnabled:J.shadowMap.enabled&&S.length>0,shadowMapType:J.shadowMap.type,toneMapping:e,decodeVideoTexture:s0&&L.map.isVideoTexture===!0&&l0.getTransfer(L.map.colorSpace)===UJ,decodeVideoTextureEmissive:pJ&&L.emissiveMap.isVideoTexture===!0&&l0.getTransfer(L.emissiveMap.colorSpace)===UJ,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===lJ,flipSided:L.side===hJ,useDepthPacking:L.depthPacking>=0,depthPacking:L.depthPacking||0,index0AttributeName:L.index0AttributeName,extensionClipCullDistance:M0&&L.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(M0&&L.extensions.multiDraw===!0||d0)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:L.customProgramCacheKey()};return I0.vertexUv1s=H.has(1),I0.vertexUv2s=H.has(2),I0.vertexUv3s=H.has(3),H.clear(),I0}function F(L){let z=[];if(L.shaderID)z.push(L.shaderID);else z.push(L.customVertexShaderID),z.push(L.customFragmentShaderID);if(L.defines!==void 0)for(let S in L.defines)z.push(S),z.push(L.defines[S]);if(L.isRawShaderMaterial===!1)N(z,L),D(z,L),z.push(J.outputColorSpace);return z.push(L.customProgramCacheKey),z.join()}function N(L,z){L.push(z.precision),L.push(z.outputColorSpace),L.push(z.envMapMode),L.push(z.envMapCubeUVHeight),L.push(z.mapUv),L.push(z.alphaMapUv),L.push(z.lightMapUv),L.push(z.aoMapUv),L.push(z.bumpMapUv),L.push(z.normalMapUv),L.push(z.displacementMapUv),L.push(z.emissiveMapUv),L.push(z.metalnessMapUv),L.push(z.roughnessMapUv),L.push(z.anisotropyMapUv),L.push(z.clearcoatMapUv),L.push(z.clearcoatNormalMapUv),L.push(z.clearcoatRoughnessMapUv),L.push(z.iridescenceMapUv),L.push(z.iridescenceThicknessMapUv),L.push(z.sheenColorMapUv),L.push(z.sheenRoughnessMapUv),L.push(z.specularMapUv),L.push(z.specularColorMapUv),L.push(z.specularIntensityMapUv),L.push(z.transmissionMapUv),L.push(z.thicknessMapUv),L.push(z.combine),L.push(z.fogExp2),L.push(z.sizeAttenuation),L.push(z.morphTargetsCount),L.push(z.morphAttributeCount),L.push(z.numDirLights),L.push(z.numPointLights),L.push(z.numSpotLights),L.push(z.numSpotLightMaps),L.push(z.numHemiLights),L.push(z.numRectAreaLights),L.push(z.numDirLightShadows),L.push(z.numPointLightShadows),L.push(z.numSpotLightShadows),L.push(z.numSpotLightShadowsWithMaps),L.push(z.numLightProbes),L.push(z.shadowMapType),L.push(z.toneMapping),L.push(z.numClippingPlanes),L.push(z.numClipIntersection),L.push(z.depthPacking)}function D(L,z){if(X.disableAll(),z.instancing)X.enable(0);if(z.instancingColor)X.enable(1);if(z.instancingMorph)X.enable(2);if(z.matcap)X.enable(3);if(z.envMap)X.enable(4);if(z.normalMapObjectSpace)X.enable(5);if(z.normalMapTangentSpace)X.enable(6);if(z.clearcoat)X.enable(7);if(z.iridescence)X.enable(8);if(z.alphaTest)X.enable(9);if(z.vertexColors)X.enable(10);if(z.vertexAlphas)X.enable(11);if(z.vertexUv1s)X.enable(12);if(z.vertexUv2s)X.enable(13);if(z.vertexUv3s)X.enable(14);if(z.vertexTangents)X.enable(15);if(z.anisotropy)X.enable(16);if(z.alphaHash)X.enable(17);if(z.batching)X.enable(18);if(z.dispersion)X.enable(19);if(z.batchingColor)X.enable(20);if(z.gradientMap)X.enable(21);if(z.packedNormalMap)X.enable(22);if(z.vertexNormals)X.enable(23);if(L.push(X.mask),X.disableAll(),z.fog)X.enable(0);if(z.useFog)X.enable(1);if(z.flatShading)X.enable(2);if(z.logarithmicDepthBuffer)X.enable(3);if(z.reversedDepthBuffer)X.enable(4);if(z.skinning)X.enable(5);if(z.morphTargets)X.enable(6);if(z.morphNormals)X.enable(7);if(z.morphColors)X.enable(8);if(z.premultipliedAlpha)X.enable(9);if(z.shadowMapEnabled)X.enable(10);if(z.doubleSided)X.enable(11);if(z.flipSided)X.enable(12);if(z.useDepthPacking)X.enable(13);if(z.dithering)X.enable(14);if(z.transmission)X.enable(15);if(z.sheen)X.enable(16);if(z.opaque)X.enable(17);if(z.pointsUvs)X.enable(18);if(z.decodeVideoTexture)X.enable(19);if(z.decodeVideoTextureEmissive)X.enable(20);if(z.alphaToCoverage)X.enable(21);if(z.numLightProbeGrids>0)X.enable(22);L.push(X.mask)}function B(L){let z=O[L.type],S;if(z){let I=v9[z];S=j8.clone(I.uniforms)}else S=L.uniforms;return S}function C(L,z){let S=G.get(z);if(S!==void 0)++S.usedTimes;else S=new Bq(J,z,L,W),U.push(S),G.set(z,S);return S}function T(L){if(--L.usedTimes===0){let z=U.indexOf(L);U[z]=U[U.length-1],U.pop(),G.delete(L.cacheKey),L.destroy()}}function P(L){K.remove(L)}function _(){K.dispose()}return{getParameters:k,getProgramCacheKey:F,getUniforms:B,acquireProgram:C,releaseProgram:T,releaseShaderCache:P,programs:U,dispose:_}}function Iq(){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 _q(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 VX(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 zX(){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,k,F,N){let D=J[Q];if(D===void 0)D={id:E.id,object:E,geometry:O,material:R,materialVariant:X(E),groupOrder:k,renderOrder:E.renderOrder,z:F,group:N},J[Q]=D;else D.id=E.id,D.object=E,D.geometry=O,D.material=R,D.materialVariant=X(E),D.groupOrder=k,D.renderOrder=E.renderOrder,D.z=F,D.group=N;return Q++,D}function H(E,O,R,k,F,N){let D=K(E,O,R,k,F,N);if(R.transmission>0)Z.push(D);else if(R.transparent===!0)W.push(D);else $.push(D)}function U(E,O,R,k,F,N){let D=K(E,O,R,k,F,N);if(R.transmission>0)Z.unshift(D);else if(R.transparent===!0)W.unshift(D);else $.unshift(D)}function G(E,O){if($.length>1)$.sort(E||_q);if(Z.length>1)Z.sort(O||VX);if(W.length>1)W.sort(O||VX)}function q(){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:q,sort:G}}function wq(){let J=new WeakMap;function Q(Z,W){let Y=J.get(Z),X;if(Y===void 0)X=new zX,J.set(Z,[X]);else if(W>=Y.length)X=new zX,Y.push(X);else X=Y[W];return X}function $(){J=new WeakMap}return{get:Q,dispose:$}}function Pq(){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 k0};break;case"SpotLight":$={position:new A,direction:new A,color:new k0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new A,color:new k0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new A,skyColor:new k0,groundColor:new k0};break;case"RectAreaLight":$={color:new k0,position:new A,halfWidth:new A,halfHeight:new A};break}return J[Q.id]=$,$}}}function Tq(){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 h0};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new h0};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new h0,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}var Aq=0;function Sq(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function jq(J){let Q=new Pq,$=Tq(),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 S0,X=new S0;function K(U){let G=0,q=0,E=0;for(let z=0;z<9;z++)Z.probe[z].set(0,0,0);let O=0,R=0,k=0,F=0,N=0,D=0,B=0,C=0,T=0,P=0,_=0;U.sort(Sq);for(let z=0,S=U.length;z<S;z++){let I=U[z],j=I.color,b=I.intensity,v=I.distance,x=null;if(I.shadow&&I.shadow.map)if(I.shadow.map.texture.format===w8)x=I.shadow.map.texture;else x=I.shadow.map.depthTexture||I.shadow.map.texture;if(I.isAmbientLight)G+=j.r*b,q+=j.g*b,E+=j.b*b;else if(I.isLightProbe){for(let p=0;p<9;p++)Z.probe[p].addScaledVector(I.sh.coefficients[p],b);_++}else if(I.isDirectionalLight){let p=Q.get(I);if(p.color.copy(I.color).multiplyScalar(I.intensity),I.castShadow){let d=I.shadow,n=$.get(I);n.shadowIntensity=d.intensity,n.shadowBias=d.bias,n.shadowNormalBias=d.normalBias,n.shadowRadius=d.radius,n.shadowMapSize=d.mapSize,Z.directionalShadow[O]=n,Z.directionalShadowMap[O]=x,Z.directionalShadowMatrix[O]=I.shadow.matrix,D++}Z.directional[O]=p,O++}else if(I.isSpotLight){let p=Q.get(I);p.position.setFromMatrixPosition(I.matrixWorld),p.color.copy(j).multiplyScalar(b),p.distance=v,p.coneCos=Math.cos(I.angle),p.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),p.decay=I.decay,Z.spot[k]=p;let d=I.shadow;if(I.map){if(Z.spotLightMap[T]=I.map,T++,d.updateMatrices(I),I.castShadow)P++}if(Z.spotLightMatrix[k]=d.matrix,I.castShadow){let n=$.get(I);n.shadowIntensity=d.intensity,n.shadowBias=d.bias,n.shadowNormalBias=d.normalBias,n.shadowRadius=d.radius,n.shadowMapSize=d.mapSize,Z.spotShadow[k]=n,Z.spotShadowMap[k]=x,C++}k++}else if(I.isRectAreaLight){let p=Q.get(I);p.color.copy(j).multiplyScalar(b),p.halfWidth.set(I.width*0.5,0,0),p.halfHeight.set(0,I.height*0.5,0),Z.rectArea[F]=p,F++}else if(I.isPointLight){let p=Q.get(I);if(p.color.copy(I.color).multiplyScalar(I.intensity),p.distance=I.distance,p.decay=I.decay,I.castShadow){let d=I.shadow,n=$.get(I);n.shadowIntensity=d.intensity,n.shadowBias=d.bias,n.shadowNormalBias=d.normalBias,n.shadowRadius=d.radius,n.shadowMapSize=d.mapSize,n.shadowCameraNear=d.camera.near,n.shadowCameraFar=d.camera.far,Z.pointShadow[R]=n,Z.pointShadowMap[R]=x,Z.pointShadowMatrix[R]=I.shadow.matrix,B++}Z.point[R]=p,R++}else if(I.isHemisphereLight){let p=Q.get(I);p.skyColor.copy(I.color).multiplyScalar(b),p.groundColor.copy(I.groundColor).multiplyScalar(b),Z.hemi[N]=p,N++}}if(F>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=X0.LTC_FLOAT_1,Z.rectAreaLTC2=X0.LTC_FLOAT_2;else Z.rectAreaLTC1=X0.LTC_HALF_1,Z.rectAreaLTC2=X0.LTC_HALF_2;Z.ambient[0]=G,Z.ambient[1]=q,Z.ambient[2]=E;let L=Z.hash;if(L.directionalLength!==O||L.pointLength!==R||L.spotLength!==k||L.rectAreaLength!==F||L.hemiLength!==N||L.numDirectionalShadows!==D||L.numPointShadows!==B||L.numSpotShadows!==C||L.numSpotMaps!==T||L.numLightProbes!==_)Z.directional.length=O,Z.spot.length=k,Z.rectArea.length=F,Z.point.length=R,Z.hemi.length=N,Z.directionalShadow.length=D,Z.directionalShadowMap.length=D,Z.pointShadow.length=B,Z.pointShadowMap.length=B,Z.spotShadow.length=C,Z.spotShadowMap.length=C,Z.directionalShadowMatrix.length=D,Z.pointShadowMatrix.length=B,Z.spotLightMatrix.length=C+T-P,Z.spotLightMap.length=T,Z.numSpotLightShadowsWithMaps=P,Z.numLightProbes=_,L.directionalLength=O,L.pointLength=R,L.spotLength=k,L.rectAreaLength=F,L.hemiLength=N,L.numDirectionalShadows=D,L.numPointShadows=B,L.numSpotShadows=C,L.numSpotMaps=T,L.numLightProbes=_,Z.version=Aq++}function H(U,G){let q=0,E=0,O=0,R=0,k=0,F=G.matrixWorldInverse;for(let N=0,D=U.length;N<D;N++){let B=U[N];if(B.isDirectionalLight){let C=Z.directional[q];C.direction.setFromMatrixPosition(B.matrixWorld),W.setFromMatrixPosition(B.target.matrixWorld),C.direction.sub(W),C.direction.transformDirection(F),q++}else if(B.isSpotLight){let C=Z.spot[O];C.position.setFromMatrixPosition(B.matrixWorld),C.position.applyMatrix4(F),C.direction.setFromMatrixPosition(B.matrixWorld),W.setFromMatrixPosition(B.target.matrixWorld),C.direction.sub(W),C.direction.transformDirection(F),O++}else if(B.isRectAreaLight){let C=Z.rectArea[R];C.position.setFromMatrixPosition(B.matrixWorld),C.position.applyMatrix4(F),X.identity(),Y.copy(B.matrixWorld),Y.premultiply(F),X.extractRotation(Y),C.halfWidth.set(B.width*0.5,0,0),C.halfHeight.set(0,B.height*0.5,0),C.halfWidth.applyMatrix4(X),C.halfHeight.applyMatrix4(X),R++}else if(B.isPointLight){let C=Z.point[E];C.position.setFromMatrixPosition(B.matrixWorld),C.position.applyMatrix4(F),E++}else if(B.isHemisphereLight){let C=Z.hemi[k];C.direction.setFromMatrixPosition(B.matrixWorld),C.direction.transformDirection(F),k++}}}return{setup:K,setupView:H,state:Z}}function CX(J){let Q=new jq(J),$=[],Z=[],W=[];function Y(E){q.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 q={lightsArray:$,shadowsArray:Z,lightProbeGridArray:W,camera:null,lights:Q,transmissionRenderTarget:{},textureUnits:0};return{init:Y,state:q,setupLights:U,setupLightsView:G,pushLight:X,pushShadow:K,pushLightProbeGrid:H}}function vq(J){let Q=new WeakMap;function $(W,Y=0){let X=Q.get(W),K;if(X===void 0)K=new CX(J),Q.set(W,[K]);else if(Y>=X.length)K=new CX(J),X.push(K);else K=X[Y];return K}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var yq=`void main() {
4051
+ Program Info Log: `+h+`
4052
+ `+Q0+`
4053
+ `+H0)}else if(h!=="")C0("WebGLProgram: Program Info Log:",h);else if(g===""||p==="")a=!1;if(a)z.diagnostics={runnable:c,programLog:h,vertexShader:{log:g,prefix:q},fragmentShader:{log:p,prefix:N}}}W.deleteShader(_),W.deleteShader(P),D=new W7(W,C),B=F1(W,C)}let D;this.getUniforms=function(){if(D===void 0)V(this);return D};let B;this.getAttributes=function(){if(B===void 0)V(this);return B};let A=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(A===!1)A=W.getProgramParameter(C,$1);return A},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(C),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=Z1++,this.cacheKey=Q,this.usedTimes=1,this.program=C,this.vertexShader=_,this.fragmentShader=P,this}var _1=0;class gX{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 pX(J),Q.set(J,$);return $}}class pX{constructor(J){this.id=_1++,this.code=J,this.usedTimes=0}}function T1(J){return J===P8||J===a7||J===r7}function A1(J,Q,$,Z,W,Y){let X=new $Q,K=new gX,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,B,A,z,S,y){let v=z.fog,h=S.geometry,g=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||g,p),a=!!c&&c.mapping===p6?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 H0=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,J0=H0!==void 0?H0.length:0,x0=0;if(h.morphAttributes.position!==void 0)x0=1;if(h.morphAttributes.normal!==void 0)x0=2;if(h.morphAttributes.color!==void 0)x0=3;let v0,s,Y0,D0;if(Q0){let b0=y9[Q0];v0=b0.vertexShader,s=b0.fragmentShader}else v0=D.vertexShader,s=D.fragmentShader,K.update(D),Y0=K.getVertexShaderID(D),D0=K.getFragmentShaderID(D);let G0=J.getRenderTarget(),w0=J.state.buffers.depth.getReversed(),i0=S.isInstancedMesh===!0,j0=S.isBatchedMesh===!0,d0=!!D.map,YJ=!!D.matcap,XJ=!!c,u0=!!D.aoMap,jJ=!!D.lightMap,vJ=!!D.bumpMap,CJ=!!D.normalMap,b=!!D.displacementMap,pJ=!!D.emissiveMap,a0=!!D.metalnessMap,t0=!!D.roughnessMap,O0=D.anisotropy>0,qJ=D.clearcoat>0,T0=D.dispersion>0,T=D.iridescence>0,I=D.sheen>0,d=D.transmission>0,r=O0&&!!D.anisotropyMap,t=qJ&&!!D.clearcoatMap,$0=qJ&&!!D.clearcoatNormalMap,E0=qJ&&!!D.clearcoatRoughnessMap,n=T&&!!D.iridescenceMap,o=T&&!!D.iridescenceThicknessMap,K0=I&&!!D.sheenColorMap,B0=I&&!!D.sheenRoughnessMap,W0=!!D.specularMap,F0=!!D.specularColorMap,y0=!!D.specularIntensityMap,g0=d&&!!D.transmissionMap,c0=d&&!!D.thicknessMap,x=!!D.gradientMap,X0=!!D.alphaMap,i=D.alphaTest>0,Z0=!!D.alphaHash,V0=!!D.extensions,e=rJ;if(D.toneMapped){if(G0===null||G0.isXRRenderTarget===!0)e=J.toneMapping}let z0={shaderID:Q0,shaderType:D.type,shaderName:D.name,vertexShader:v0,fragmentShader:s,defines:D.defines,customVertexShaderID:Y0,customFragmentShaderID:D0,isRawShaderMaterial:D.isRawShaderMaterial===!0,glslVersion:D.glslVersion,precision:E,batching:j0,batchingColor:j0&&S._colorsTexture!==null,instancing:i0,instancingColor:i0&&S.instanceColor!==null,instancingMorph:i0&&S.morphTexture!==null,outputColorSpace:G0===null?J.outputColorSpace:G0.isXRRenderTarget===!0?G0.texture.colorSpace:s0.workingColorSpace,alphaToCoverage:!!D.alphaToCoverage,map:d0,matcap:YJ,envMap:XJ,envMapMode:XJ&&c.mapping,envMapCubeUVHeight:a,aoMap:u0,lightMap:jJ,bumpMap:vJ,normalMap:CJ,displacementMap:b,emissiveMap:pJ,normalMapObjectSpace:CJ&&D.normalMapType===mY,normalMapTangentSpace:CJ&&D.normalMapType===XZ,packedNormalMap:CJ&&D.normalMapType===XZ&&T1(D.normalMap.format),metalnessMap:a0,roughnessMap:t0,anisotropy:O0,anisotropyMap:r,clearcoat:qJ,clearcoatMap:t,clearcoatNormalMap:$0,clearcoatRoughnessMap:E0,dispersion:T0,iridescence:T,iridescenceMap:n,iridescenceThicknessMap:o,sheen:I,sheenColorMap:K0,sheenRoughnessMap:B0,specularMap:W0,specularColorMap:F0,specularIntensityMap:y0,transmission:d,transmissionMap:g0,thicknessMap:c0,gradientMap:x,opaque:D.transparent===!1&&D.blending===V8&&D.alphaToCoverage===!1,alphaMap:X0,alphaTest:i,alphaHash:Z0,combine:D.combine,mapUv:d0&&R(D.map.channel),aoMapUv:u0&&R(D.aoMap.channel),lightMapUv:jJ&&R(D.lightMap.channel),bumpMapUv:vJ&&R(D.bumpMap.channel),normalMapUv:CJ&&R(D.normalMap.channel),displacementMapUv:b&&R(D.displacementMap.channel),emissiveMapUv:pJ&&R(D.emissiveMap.channel),metalnessMapUv:a0&&R(D.metalnessMap.channel),roughnessMapUv:t0&&R(D.roughnessMap.channel),anisotropyMapUv:r&&R(D.anisotropyMap.channel),clearcoatMapUv:t&&R(D.clearcoatMap.channel),clearcoatNormalMapUv:$0&&R(D.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:E0&&R(D.clearcoatRoughnessMap.channel),iridescenceMapUv:n&&R(D.iridescenceMap.channel),iridescenceThicknessMapUv:o&&R(D.iridescenceThicknessMap.channel),sheenColorMapUv:K0&&R(D.sheenColorMap.channel),sheenRoughnessMapUv:B0&&R(D.sheenRoughnessMap.channel),specularMapUv:W0&&R(D.specularMap.channel),specularColorMapUv:F0&&R(D.specularColorMap.channel),specularIntensityMapUv:y0&&R(D.specularIntensityMap.channel),transmissionMapUv:g0&&R(D.transmissionMap.channel),thicknessMapUv:c0&&R(D.thicknessMap.channel),alphaMapUv:X0&&R(D.alphaMap.channel),vertexTangents:!!h.attributes.tangent&&(CJ||O0),vertexNormals:!!h.attributes.normal,vertexColors:D.vertexColors,vertexAlphas:D.vertexColors===!0&&!!h.attributes.color&&h.attributes.color.itemSize===4,pointsUvs:S.isPoints===!0&&!!h.attributes.uv&&(d0||X0),fog:!!v,useFog:D.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:D.wireframe===!1&&(D.flatShading===!0||h.attributes.normal===void 0&&CJ===!1&&(D.isMeshLambertMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isMeshPhysicalMaterial)),sizeAttenuation:D.sizeAttenuation===!0,logarithmicDepthBuffer:F,reversedDepthBuffer:w0,skinning:S.isSkinnedMesh===!0,morphTargets:h.morphAttributes.position!==void 0,morphNormals:h.morphAttributes.normal!==void 0,morphColors:h.morphAttributes.color!==void 0,morphTargetsCount:J0,morphTextureStride:x0,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:y.length,numClippingPlanes:Y.numPlanes,numClipIntersection:Y.numIntersection,dithering:D.dithering,shadowMapEnabled:J.shadowMap.enabled&&A.length>0,shadowMapType:J.shadowMap.type,toneMapping:e,decodeVideoTexture:d0&&D.map.isVideoTexture===!0&&s0.getTransfer(D.map.colorSpace)===UJ,decodeVideoTextureEmissive:pJ&&D.emissiveMap.isVideoTexture===!0&&s0.getTransfer(D.emissiveMap.colorSpace)===UJ,premultipliedAlpha:D.premultipliedAlpha,doubleSided:D.side===cJ,flipSided:D.side===bJ,useDepthPacking:D.depthPacking>=0,depthPacking:D.depthPacking||0,index0AttributeName:D.index0AttributeName,extensionClipCullDistance:V0&&D.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(V0&&D.extensions.multiDraw===!0||j0)&&$.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 B=[];if(D.shaderID)B.push(D.shaderID);else B.push(D.customVertexShaderID),B.push(D.customFragmentShaderID);if(D.defines!==void 0)for(let A in D.defines)B.push(A),B.push(D.defines[A]);if(D.isRawShaderMaterial===!1)N(B,D),L(B,D),B.push(J.outputColorSpace);return B.push(D.customProgramCacheKey),B.join()}function N(D,B){D.push(B.precision),D.push(B.outputColorSpace),D.push(B.envMapMode),D.push(B.envMapCubeUVHeight),D.push(B.mapUv),D.push(B.alphaMapUv),D.push(B.lightMapUv),D.push(B.aoMapUv),D.push(B.bumpMapUv),D.push(B.normalMapUv),D.push(B.displacementMapUv),D.push(B.emissiveMapUv),D.push(B.metalnessMapUv),D.push(B.roughnessMapUv),D.push(B.anisotropyMapUv),D.push(B.clearcoatMapUv),D.push(B.clearcoatNormalMapUv),D.push(B.clearcoatRoughnessMapUv),D.push(B.iridescenceMapUv),D.push(B.iridescenceThicknessMapUv),D.push(B.sheenColorMapUv),D.push(B.sheenRoughnessMapUv),D.push(B.specularMapUv),D.push(B.specularColorMapUv),D.push(B.specularIntensityMapUv),D.push(B.transmissionMapUv),D.push(B.thicknessMapUv),D.push(B.combine),D.push(B.fogExp2),D.push(B.sizeAttenuation),D.push(B.morphTargetsCount),D.push(B.morphAttributeCount),D.push(B.numDirLights),D.push(B.numPointLights),D.push(B.numSpotLights),D.push(B.numSpotLightMaps),D.push(B.numHemiLights),D.push(B.numRectAreaLights),D.push(B.numDirLightShadows),D.push(B.numPointLightShadows),D.push(B.numSpotLightShadows),D.push(B.numSpotLightShadowsWithMaps),D.push(B.numLightProbes),D.push(B.shadowMapType),D.push(B.toneMapping),D.push(B.numClippingPlanes),D.push(B.numClipIntersection),D.push(B.depthPacking)}function L(D,B){if(X.disableAll(),B.instancing)X.enable(0);if(B.instancingColor)X.enable(1);if(B.instancingMorph)X.enable(2);if(B.matcap)X.enable(3);if(B.envMap)X.enable(4);if(B.normalMapObjectSpace)X.enable(5);if(B.normalMapTangentSpace)X.enable(6);if(B.clearcoat)X.enable(7);if(B.iridescence)X.enable(8);if(B.alphaTest)X.enable(9);if(B.vertexColors)X.enable(10);if(B.vertexAlphas)X.enable(11);if(B.vertexUv1s)X.enable(12);if(B.vertexUv2s)X.enable(13);if(B.vertexUv3s)X.enable(14);if(B.vertexTangents)X.enable(15);if(B.anisotropy)X.enable(16);if(B.alphaHash)X.enable(17);if(B.batching)X.enable(18);if(B.dispersion)X.enable(19);if(B.batchingColor)X.enable(20);if(B.gradientMap)X.enable(21);if(B.packedNormalMap)X.enable(22);if(B.vertexNormals)X.enable(23);if(D.push(X.mask),X.disableAll(),B.fog)X.enable(0);if(B.useFog)X.enable(1);if(B.flatShading)X.enable(2);if(B.logarithmicDepthBuffer)X.enable(3);if(B.reversedDepthBuffer)X.enable(4);if(B.skinning)X.enable(5);if(B.morphTargets)X.enable(6);if(B.morphNormals)X.enable(7);if(B.morphColors)X.enable(8);if(B.premultipliedAlpha)X.enable(9);if(B.shadowMapEnabled)X.enable(10);if(B.doubleSided)X.enable(11);if(B.flipSided)X.enable(12);if(B.useDepthPacking)X.enable(13);if(B.dithering)X.enable(14);if(B.transmission)X.enable(15);if(B.sheen)X.enable(16);if(B.opaque)X.enable(17);if(B.pointsUvs)X.enable(18);if(B.decodeVideoTexture)X.enable(19);if(B.decodeVideoTextureEmissive)X.enable(20);if(B.alphaToCoverage)X.enable(21);if(B.numLightProbeGrids>0)X.enable(22);D.push(X.mask)}function M(D){let B=O[D.type],A;if(B){let z=y9[B];A=j8.clone(z.uniforms)}else A=D.uniforms;return A}function k(D,B){let A=G.get(B);if(A!==void 0)++A.usedTimes;else A=new P1(J,B,D,W),U.push(A),G.set(B,A);return A}function _(D){if(--D.usedTimes===0){let B=U.indexOf(D);U[B]=U[U.length-1],U.pop(),G.delete(D.cacheKey),D.destroy()}}function P(D){K.remove(D)}function V(){K.dispose()}return{getParameters:C,getProgramCacheKey:q,getUniforms:M,acquireProgram:k,releaseProgram:_,releaseShaderCache:P,programs:U,dispose:V}}function S1(){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 j1(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 wX(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 PX(){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||j1);if(Z.length>1)Z.sort(O||wX);if(W.length>1)W.sort(O||wX)}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 v1(){let J=new WeakMap;function Q(Z,W){let Y=J.get(Z),X;if(Y===void 0)X=new PX,J.set(Z,[X]);else if(W>=Y.length)X=new PX,Y.push(X);else X=Y[W];return X}function $(){J=new WeakMap}return{get:Q,dispose:$}}function y1(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new j,color:new R0};break;case"SpotLight":$={position:new j,direction:new j,color:new R0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new j,color:new R0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new j,skyColor:new R0,groundColor:new R0};break;case"RectAreaLight":$={color:new R0,position:new j,halfWidth:new j,halfHeight:new j};break}return J[Q.id]=$,$}}}function h1(){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 p0};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p0};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p0,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}var x1=0;function b1(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function f1(J){let Q=new y1,$=h1(),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 j);let W=new j,Y=new S0,X=new S0;function K(U){let G=0,F=0,E=0;for(let B=0;B<9;B++)Z.probe[B].set(0,0,0);let O=0,R=0,C=0,q=0,N=0,L=0,M=0,k=0,_=0,P=0,V=0;U.sort(b1);for(let B=0,A=U.length;B<A;B++){let z=U[B],S=z.color,y=z.intensity,v=z.distance,h=null;if(z.shadow&&z.shadow.map)if(z.shadow.map.texture.format===P8)h=z.shadow.map.texture;else h=z.shadow.map.depthTexture||z.shadow.map.texture;if(z.isAmbientLight)G+=S.r*y,F+=S.g*y,E+=S.b*y;else if(z.isLightProbe){for(let g=0;g<9;g++)Z.probe[g].addScaledVector(z.sh.coefficients[g],y);V++}else if(z.isDirectionalLight){let g=Q.get(z);if(g.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]=h,Z.directionalShadowMatrix[O]=z.shadow.matrix,L++}Z.directional[O]=g,O++}else if(z.isSpotLight){let g=Q.get(z);g.position.setFromMatrixPosition(z.matrixWorld),g.color.copy(S).multiplyScalar(y),g.distance=v,g.coneCos=Math.cos(z.angle),g.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),g.decay=z.decay,Z.spot[C]=g;let p=z.shadow;if(z.map){if(Z.spotLightMap[_]=z.map,_++,p.updateMatrices(z),z.castShadow)P++}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]=h,k++}C++}else if(z.isRectAreaLight){let g=Q.get(z);g.color.copy(S).multiplyScalar(y),g.halfWidth.set(z.width*0.5,0,0),g.halfHeight.set(0,z.height*0.5,0),Z.rectArea[q]=g,q++}else if(z.isPointLight){let g=Q.get(z);if(g.color.copy(z.color).multiplyScalar(z.intensity),g.distance=z.distance,g.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]=h,Z.pointShadowMatrix[R]=z.shadow.matrix,M++}Z.point[R]=g,R++}else if(z.isHemisphereLight){let g=Q.get(z);g.skyColor.copy(z.color).multiplyScalar(y),g.groundColor.copy(z.groundColor).multiplyScalar(y),Z.hemi[N]=g,N++}}if(q>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=U0.LTC_FLOAT_1,Z.rectAreaLTC2=U0.LTC_FLOAT_2;else Z.rectAreaLTC1=U0.LTC_HALF_1,Z.rectAreaLTC2=U0.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!==M||D.numSpotShadows!==k||D.numSpotMaps!==_||D.numLightProbes!==V)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=M,Z.pointShadowMap.length=M,Z.spotShadow.length=k,Z.spotShadowMap.length=k,Z.directionalShadowMatrix.length=L,Z.pointShadowMatrix.length=M,Z.spotLightMatrix.length=k+_-P,Z.spotLightMap.length=_,Z.numSpotLightShadowsWithMaps=P,Z.numLightProbes=V,D.directionalLength=O,D.pointLength=R,D.spotLength=C,D.rectAreaLength=q,D.hemiLength=N,D.numDirectionalShadows=L,D.numPointShadows=M,D.numSpotShadows=k,D.numSpotMaps=_,D.numLightProbes=V,Z.version=x1++}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 M=U[N];if(M.isDirectionalLight){let k=Z.directional[F];k.direction.setFromMatrixPosition(M.matrixWorld),W.setFromMatrixPosition(M.target.matrixWorld),k.direction.sub(W),k.direction.transformDirection(q),F++}else if(M.isSpotLight){let k=Z.spot[O];k.position.setFromMatrixPosition(M.matrixWorld),k.position.applyMatrix4(q),k.direction.setFromMatrixPosition(M.matrixWorld),W.setFromMatrixPosition(M.target.matrixWorld),k.direction.sub(W),k.direction.transformDirection(q),O++}else if(M.isRectAreaLight){let k=Z.rectArea[R];k.position.setFromMatrixPosition(M.matrixWorld),k.position.applyMatrix4(q),X.identity(),Y.copy(M.matrixWorld),Y.premultiply(q),X.extractRotation(Y),k.halfWidth.set(M.width*0.5,0,0),k.halfHeight.set(0,M.height*0.5,0),k.halfWidth.applyMatrix4(X),k.halfHeight.applyMatrix4(X),R++}else if(M.isPointLight){let k=Z.point[E];k.position.setFromMatrixPosition(M.matrixWorld),k.position.applyMatrix4(q),E++}else if(M.isHemisphereLight){let k=Z.hemi[C];k.direction.setFromMatrixPosition(M.matrixWorld),k.direction.transformDirection(q),C++}}}return{setup:K,setupView:H,state:Z}}function _X(J){let Q=new f1(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 g1(J){let Q=new WeakMap;function $(W,Y=0){let X=Q.get(W),K;if(X===void 0)K=new _X(J),Q.set(W,[K]);else if(Y>=X.length)K=new _X(J),X.push(K);else K=X[Y];return K}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var p1=`void main() {
4054
4054
  gl_Position = vec4( position, 1.0 );
4055
- }`,fq=`uniform sampler2D shadow_pass;
4055
+ }`,d1=`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
- }`,xq=[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)],hq=[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)],IX=new S0,J7=new A,bZ=new A;function bq(J,Q,$){let Z=new A8,W=new h0,Y=new h0,X=new JJ,K=new LZ,H=new DZ,U={},G=$.maxTextureSize,q={[z9]:hJ,[hJ]:z9,[lJ]:lJ},E=new SJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new h0},radius:{value:4}},vertexShader:yq,fragmentShader:fq}),O=E.clone();O.defines.HORIZONTAL_PASS=1;let R=new BJ;R.setAttribute("position",new HJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let k=new FJ(R,E),F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=f6;let N=this.type;this.render=function(P,_,L){if(F.enabled===!1)return;if(F.autoUpdate===!1&&F.needsUpdate===!1)return;if(P.length===0)return;if(this.type===QY)B0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=f6;let z=J.getRenderTarget(),S=J.getActiveCubeFace(),I=J.getActiveMipmapLevel(),j=J.state;if(j.setBlending(C9),j.buffers.depth.getReversed()===!0)j.buffers.color.setClear(0,0,0,0);else j.buffers.color.setClear(1,1,1,1);j.buffers.depth.setTest(!0),j.setScissorTest(!1);let b=N!==this.type;if(b)_.traverse(function(v){if(v.material)if(Array.isArray(v.material))v.material.forEach((x)=>x.needsUpdate=!0);else v.material.needsUpdate=!0});for(let v=0,x=P.length;v<x;v++){let p=P[v],d=p.shadow;if(d===void 0){B0("WebGLShadowMap:",p,"has no shadow.");continue}if(d.autoUpdate===!1&&d.needsUpdate===!1)continue;W.copy(d.mapSize);let n=d.getFrameExtents();if(W.multiply(n),Y.copy(d.mapSize),W.x>G||W.y>G){if(W.x>G)Y.x=Math.floor(G/n.x),W.x=Y.x*n.x,d.mapSize.x=Y.x;if(W.y>G)Y.y=Math.floor(G/n.y),W.y=Y.y*n.y,d.mapSize.y=Y.y}let r=J.state.buffers.depth.getReversed();if(d.camera._reversedDepth=r,d.map===null||b===!0){if(d.map!==null){if(d.map.depthTexture!==null)d.map.depthTexture.dispose(),d.map.depthTexture=null;d.map.dispose()}if(this.type===Z6){if(p.isPointLight){B0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}d.map=new cJ(W.x,W.y,{format:w8,type:bJ,minFilter:kJ,magFilter:kJ,generateMipmaps:!1}),d.map.texture.name=p.name+".shadowMap",d.map.depthTexture=new U8(W.x,W.y,rJ),d.map.depthTexture.name=p.name+".shadowMapDepth",d.map.depthTexture.format=I8,d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=O9,d.map.depthTexture.magFilter=O9}else{if(p.isPointLight)d.map=new dZ(W.x),d.map.depthTexture=new qZ(W.x,K8);else d.map=new cJ(W.x,W.y),d.map.depthTexture=new U8(W.x,W.y,K8);if(d.map.depthTexture.name=p.name+".shadowMap",d.map.depthTexture.format=I8,this.type===f6)d.map.depthTexture.compareFunction=r?t7:r7,d.map.depthTexture.minFilter=kJ,d.map.depthTexture.magFilter=kJ;else d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=O9,d.map.depthTexture.magFilter=O9}d.camera.updateProjectionMatrix()}let Y0=d.map.isWebGLCubeRenderTarget?6:1;for(let R0=0;R0<Y0;R0++){if(d.map.isWebGLCubeRenderTarget)J.setRenderTarget(d.map,R0),J.clear();else{if(R0===0)J.setRenderTarget(d.map),J.clear();let G0=d.getViewport(R0);X.set(Y.x*G0.x,Y.y*G0.y,Y.x*G0.z,Y.y*G0.w),j.viewport(X)}if(p.isPointLight){let{camera:G0,matrix:a0}=d,n0=p.distance||G0.far;if(n0!==G0.far)G0.far=n0,G0.updateProjectionMatrix();J7.setFromMatrixPosition(p.matrixWorld),G0.position.copy(J7),bZ.copy(G0.position),bZ.add(xq[R0]),G0.up.copy(hq[R0]),G0.lookAt(bZ),G0.updateMatrixWorld(),a0.makeTranslation(-J7.x,-J7.y,-J7.z),IX.multiplyMatrices(G0.projectionMatrix,G0.matrixWorldInverse),d._frustum.setFromProjectionMatrix(IX,G0.coordinateSystem,G0.reversedDepth)}else d.updateMatrices(p);Z=d.getFrustum(),C(_,L,d.camera,p,this.type)}if(d.isPointLightShadow!==!0&&this.type===Z6)D(d,L);d.needsUpdate=!1}N=this.type,F.needsUpdate=!1,J.setRenderTarget(z,S,I)};function D(P,_){let L=Q.update(k);if(E.defines.VSM_SAMPLES!==P.blurSamples)E.defines.VSM_SAMPLES=P.blurSamples,O.defines.VSM_SAMPLES=P.blurSamples,E.needsUpdate=!0,O.needsUpdate=!0;if(P.mapPass===null)P.mapPass=new cJ(W.x,W.y,{format:w8,type:bJ});E.uniforms.shadow_pass.value=P.map.depthTexture,E.uniforms.resolution.value=P.mapSize,E.uniforms.radius.value=P.radius,J.setRenderTarget(P.mapPass),J.clear(),J.renderBufferDirect(_,null,L,E,k,null),O.uniforms.shadow_pass.value=P.mapPass.texture,O.uniforms.resolution.value=P.mapSize,O.uniforms.radius.value=P.radius,J.setRenderTarget(P.map),J.clear(),J.renderBufferDirect(_,null,L,O,k,null)}function B(P,_,L,z){let S=null,I=L.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(I!==void 0)S=I;else if(S=L.isPointLight===!0?H:K,J.localClippingEnabled&&_.clipShadows===!0&&Array.isArray(_.clippingPlanes)&&_.clippingPlanes.length!==0||_.displacementMap&&_.displacementScale!==0||_.alphaMap&&_.alphaTest>0||_.map&&_.alphaTest>0||_.alphaToCoverage===!0){let j=S.uuid,b=_.uuid,v=U[j];if(v===void 0)v={},U[j]=v;let x=v[b];if(x===void 0)x=S.clone(),v[b]=x,_.addEventListener("dispose",T);S=x}if(S.visible=_.visible,S.wireframe=_.wireframe,z===Z6)S.side=_.shadowSide!==null?_.shadowSide:_.side;else S.side=_.shadowSide!==null?_.shadowSide:q[_.side];if(S.alphaMap=_.alphaMap,S.alphaTest=_.alphaToCoverage===!0?0.5:_.alphaTest,S.map=_.map,S.clipShadows=_.clipShadows,S.clippingPlanes=_.clippingPlanes,S.clipIntersection=_.clipIntersection,S.displacementMap=_.displacementMap,S.displacementScale=_.displacementScale,S.displacementBias=_.displacementBias,S.wireframeLinewidth=_.wireframeLinewidth,S.linewidth=_.linewidth,L.isPointLight===!0&&S.isMeshDistanceMaterial===!0){let j=J.properties.get(S);j.light=L}return S}function C(P,_,L,z,S){if(P.visible===!1)return;if(P.layers.test(_.layers)&&(P.isMesh||P.isLine||P.isPoints)){if((P.castShadow||P.receiveShadow&&S===Z6)&&(!P.frustumCulled||Z.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,P.matrixWorld);let b=Q.update(P),v=P.material;if(Array.isArray(v)){let x=b.groups;for(let p=0,d=x.length;p<d;p++){let n=x[p],r=v[n.materialIndex];if(r&&r.visible){let Y0=B(P,r,z,S);P.onBeforeShadow(J,P,_,L,b,Y0,n),J.renderBufferDirect(L,null,b,Y0,P,n),P.onAfterShadow(J,P,_,L,b,Y0,n)}}}else if(v.visible){let x=B(P,v,z,S);P.onBeforeShadow(J,P,_,L,b,x,null),J.renderBufferDirect(L,null,b,x,P,null),P.onAfterShadow(J,P,_,L,b,x,null)}}}let j=P.children;for(let b=0,v=j.length;b<v;b++)C(j[b],_,L,z,S)}function T(P){P.target.removeEventListener("dispose",T);for(let L in U){let z=U[L],S=P.target.uuid;if(S in z)z[S].dispose(),delete z[S]}}}function gq(J,Q){function $(){let y=!1,Z0=new JJ,s=null,Q0=new JJ(0,0,0,0);return{setMask:function(M0){if(s!==M0&&!y)J.colorMask(M0,M0,M0,M0),s=M0},setLocked:function(M0){y=M0},setClear:function(M0,e,I0,y0,CJ){if(CJ===!0)M0*=y0,e*=y0,I0*=y0;if(Z0.set(M0,e,I0,y0),Q0.equals(Z0)===!1)J.clearColor(M0,e,I0,y0),Q0.copy(Z0)},reset:function(){y=!1,s=null,Q0.set(-1,0,0,0)}}}function Z(){let y=!1,Z0=!1,s=null,Q0=null,M0=null;return{setReversed:function(e){if(Z0!==e){let I0=Q.get("EXT_clip_control");if(e)I0.clipControlEXT(I0.LOWER_LEFT_EXT,I0.ZERO_TO_ONE_EXT);else I0.clipControlEXT(I0.LOWER_LEFT_EXT,I0.NEGATIVE_ONE_TO_ONE_EXT);Z0=e;let y0=M0;M0=null,this.setClear(y0)}},getReversed:function(){return Z0},setTest:function(e){if(e)N0(J.DEPTH_TEST);else P0(J.DEPTH_TEST)},setMask:function(e){if(s!==e&&!y)J.depthMask(e),s=e},setFunc:function(e){if(Z0)e=oY[e];if(Q0!==e){switch(e){case VY:J.depthFunc(J.NEVER);break;case zY:J.depthFunc(J.ALWAYS);break;case CY:J.depthFunc(J.LESS);break;case F$:J.depthFunc(J.LEQUAL);break;case IY:J.depthFunc(J.EQUAL);break;case _Y:J.depthFunc(J.GEQUAL);break;case wY:J.depthFunc(J.GREATER);break;case PY:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}Q0=e}},setLocked:function(e){y=e},setClear:function(e){if(M0!==e){if(M0=e,Z0)e=1-e;J.clearDepth(e)}},reset:function(){y=!1,s=null,Q0=null,M0=null,Z0=!1}}}function W(){let y=!1,Z0=null,s=null,Q0=null,M0=null,e=null,I0=null,y0=null,CJ=null;return{setTest:function($J){if(!y)if($J)N0(J.STENCIL_TEST);else P0(J.STENCIL_TEST)},setMask:function($J){if(Z0!==$J&&!y)J.stencilMask($J),Z0=$J},setFunc:function($J,M9,H9){if(s!==$J||Q0!==M9||M0!==H9)J.stencilFunc($J,M9,H9),s=$J,Q0=M9,M0=H9},setOp:function($J,M9,H9){if(e!==$J||I0!==M9||y0!==H9)J.stencilOp($J,M9,H9),e=$J,I0=M9,y0=H9},setLocked:function($J){y=$J},setClear:function($J){if(CJ!==$J)J.clearStencil($J),CJ=$J},reset:function(){y=!1,Z0=null,s=null,Q0=null,M0=null,e=null,I0=null,y0=null,CJ=null}}}let Y=new $,X=new Z,K=new W,H=new WeakMap,U=new WeakMap,G={},q={},E={},O=new WeakMap,R=[],k=null,F=!1,N=null,D=null,B=null,C=null,T=null,P=null,_=null,L=new k0(0,0,0),z=0,S=!1,I=null,j=null,b=null,v=null,x=null,p=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),d=!1,n=0,r=J.getParameter(J.VERSION);if(r.indexOf("WebGL")!==-1)n=parseFloat(/^WebGL (\d)/.exec(r)[1]),d=n>=1;else if(r.indexOf("OpenGL ES")!==-1)n=parseFloat(/^OpenGL ES (\d)/.exec(r)[1]),d=n>=2;let Y0=null,R0={},G0=J.getParameter(J.SCISSOR_BOX),a0=J.getParameter(J.VIEWPORT),n0=new JJ().fromArray(G0),i=new JJ().fromArray(a0);function F0(y,Z0,s,Q0){let M0=new Uint8Array(4),e=J.createTexture();J.bindTexture(y,e),J.texParameteri(y,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(y,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let I0=0;I0<s;I0++)if(y===J.TEXTURE_3D||y===J.TEXTURE_2D_ARRAY)J.texImage3D(Z0,0,J.RGBA,1,1,Q0,0,J.RGBA,J.UNSIGNED_BYTE,M0);else J.texImage2D(Z0+I0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,M0);return e}let z0={};z0[J.TEXTURE_2D]=F0(J.TEXTURE_2D,J.TEXTURE_2D,1),z0[J.TEXTURE_CUBE_MAP]=F0(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),z0[J.TEXTURE_2D_ARRAY]=F0(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),z0[J.TEXTURE_3D]=F0(J.TEXTURE_3D,J.TEXTURE_3D,1,1),Y.setClear(0,0,0,1),X.setClear(1),K.setClear(0),N0(J.DEPTH_TEST),X.setFunc(F$),vJ(!1),zJ(G$),N0(J.CULL_FACE),b0(C9);function N0(y){if(G[y]!==!0)J.enable(y),G[y]=!0}function P0(y){if(G[y]!==!1)J.disable(y),G[y]=!1}function e0(y,Z0){if(E[y]!==Z0){if(J.bindFramebuffer(y,Z0),E[y]=Z0,y===J.DRAW_FRAMEBUFFER)E[J.FRAMEBUFFER]=Z0;if(y===J.FRAMEBUFFER)E[J.DRAW_FRAMEBUFFER]=Z0;return!0}return!1}function d0(y,Z0){let s=R,Q0=!1;if(y){if(s=O.get(Z0),s===void 0)s=[],O.set(Z0,s);let M0=y.textures;if(s.length!==M0.length||s[0]!==J.COLOR_ATTACHMENT0){for(let e=0,I0=M0.length;e<I0;e++)s[e]=J.COLOR_ATTACHMENT0+e;s.length=M0.length,Q0=!0}}else if(s[0]!==J.BACK)s[0]=J.BACK,Q0=!0;if(Q0)J.drawBuffers(s)}function s0(y){if(k!==y)return J.useProgram(y),k=y,!0;return!1}let WJ={[W6]:J.FUNC_ADD,[ZY]:J.FUNC_SUBTRACT,[WY]:J.FUNC_REVERSE_SUBTRACT};WJ[YY]=J.MIN,WJ[XY]=J.MAX;let YJ={[KY]:J.ZERO,[HY]:J.ONE,[UY]:J.SRC_COLOR,[EY]:J.SRC_ALPHA,[LY]:J.SRC_ALPHA_SATURATE,[OY]:J.DST_COLOR,[FY]:J.DST_ALPHA,[GY]:J.ONE_MINUS_SRC_COLOR,[qY]:J.ONE_MINUS_SRC_ALPHA,[RY]:J.ONE_MINUS_DST_COLOR,[NY]:J.ONE_MINUS_DST_ALPHA,[DY]:J.CONSTANT_COLOR,[MY]:J.ONE_MINUS_CONSTANT_COLOR,[kY]:J.CONSTANT_ALPHA,[BY]:J.ONE_MINUS_CONSTANT_ALPHA};function b0(y,Z0,s,Q0,M0,e,I0,y0,CJ,$J){if(y===C9){if(F===!0)P0(J.BLEND),F=!1;return}if(F===!1)N0(J.BLEND),F=!0;if(y!==$Y){if(y!==N||$J!==S){if(D!==W6||T!==W6)J.blendEquation(J.FUNC_ADD),D=W6,T=W6;if($J)switch(y){case V8:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case x6:J.blendFunc(J.ONE,J.ONE);break;case E$:J.blendFuncSeparate(J.ZERO,J.ONE_MINUS_SRC_COLOR,J.ZERO,J.ONE);break;case q$:J.blendFuncSeparate(J.DST_COLOR,J.ONE_MINUS_SRC_ALPHA,J.ZERO,J.ONE);break;default:A0("WebGLState: Invalid blending: ",y);break}else switch(y){case V8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case x6:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case E$:A0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case q$:A0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:A0("WebGLState: Invalid blending: ",y);break}B=null,C=null,P=null,_=null,L.set(0,0,0),z=0,N=y,S=$J}return}if(M0=M0||Z0,e=e||s,I0=I0||Q0,Z0!==D||M0!==T)J.blendEquationSeparate(WJ[Z0],WJ[M0]),D=Z0,T=M0;if(s!==B||Q0!==C||e!==P||I0!==_)J.blendFuncSeparate(YJ[s],YJ[Q0],YJ[e],YJ[I0]),B=s,C=Q0,P=e,_=I0;if(y0.equals(L)===!1||CJ!==z)J.blendColor(y0.r,y0.g,y0.b,CJ),L.copy(y0),z=CJ;N=y,S=!1}function jJ(y,Z0){y.side===lJ?P0(J.CULL_FACE):N0(J.CULL_FACE);let s=y.side===hJ;if(Z0)s=!s;vJ(s),y.blending===V8&&y.transparent===!1?b0(C9):b0(y.blending,y.blendEquation,y.blendSrc,y.blendDst,y.blendEquationAlpha,y.blendSrcAlpha,y.blendDstAlpha,y.blendColor,y.blendAlpha,y.premultipliedAlpha),X.setFunc(y.depthFunc),X.setTest(y.depthTest),X.setMask(y.depthWrite),Y.setMask(y.colorWrite);let Q0=y.stencilWrite;if(K.setTest(Q0),Q0)K.setMask(y.stencilWriteMask),K.setFunc(y.stencilFunc,y.stencilRef,y.stencilFuncMask),K.setOp(y.stencilFail,y.stencilZFail,y.stencilZPass);pJ(y.polygonOffset,y.polygonOffsetFactor,y.polygonOffsetUnits),y.alphaToCoverage===!0?N0(J.SAMPLE_ALPHA_TO_COVERAGE):P0(J.SAMPLE_ALPHA_TO_COVERAGE)}function vJ(y){if(I!==y){if(y)J.frontFace(J.CW);else J.frontFace(J.CCW);I=y}}function zJ(y){if(y!==eW){if(N0(J.CULL_FACE),y!==j)if(y===G$)J.cullFace(J.BACK);else if(y===JY)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else P0(J.CULL_FACE);j=y}function f(y){if(y!==b){if(d)J.lineWidth(y);b=y}}function pJ(y,Z0,s){if(y){if(N0(J.POLYGON_OFFSET_FILL),v!==Z0||x!==s){if(v=Z0,x=s,X.getReversed())Z0=-Z0;J.polygonOffset(Z0,s)}}else P0(J.POLYGON_OFFSET_FILL)}function i0(y){if(y)N0(J.SCISSOR_TEST);else P0(J.SCISSOR_TEST)}function r0(y){if(y===void 0)y=J.TEXTURE0+p-1;if(Y0!==y)J.activeTexture(y),Y0=y}function E0(y,Z0,s){if(s===void 0)if(Y0===null)s=J.TEXTURE0+p-1;else s=Y0;let Q0=R0[s];if(Q0===void 0)Q0={type:void 0,texture:void 0},R0[s]=Q0;if(Q0.type!==y||Q0.texture!==Z0){if(Y0!==s)J.activeTexture(s),Y0=s;J.bindTexture(y,Z0||z0[y]),Q0.type=y,Q0.texture=Z0}}function NJ(){let y=R0[Y0];if(y!==void 0&&y.type!==void 0)J.bindTexture(y.type,null),y.type=void 0,y.texture=void 0}function T0(){try{J.compressedTexImage2D(...arguments)}catch(y){A0("WebGLState:",y)}}function w(){try{J.compressedTexImage3D(...arguments)}catch(y){A0("WebGLState:",y)}}function M(){try{J.texSubImage2D(...arguments)}catch(y){A0("WebGLState:",y)}}function g(){try{J.texSubImage3D(...arguments)}catch(y){A0("WebGLState:",y)}}function a(){try{J.compressedTexSubImage2D(...arguments)}catch(y){A0("WebGLState:",y)}}function t(){try{J.compressedTexSubImage3D(...arguments)}catch(y){A0("WebGLState:",y)}}function J0(){try{J.texStorage2D(...arguments)}catch(y){A0("WebGLState:",y)}}function K0(){try{J.texStorage3D(...arguments)}catch(y){A0("WebGLState:",y)}}function c(){try{J.texImage2D(...arguments)}catch(y){A0("WebGLState:",y)}}function o(){try{J.texImage3D(...arguments)}catch(y){A0("WebGLState:",y)}}function W0(y){if(q[y]!==void 0)return q[y];else return J.getParameter(y)}function D0(y,Z0){if(q[y]!==Z0)J.pixelStorei(y,Z0),q[y]=Z0}function $0(y){if(n0.equals(y)===!1)J.scissor(y.x,y.y,y.z,y.w),n0.copy(y)}function H0(y){if(i.equals(y)===!1)J.viewport(y.x,y.y,y.z,y.w),i.copy(y)}function j0(y,Z0){let s=U.get(Z0);if(s===void 0)s=new WeakMap,U.set(Z0,s);let Q0=s.get(y);if(Q0===void 0)Q0=J.getUniformBlockIndex(Z0,y.name),s.set(y,Q0)}function x0(y,Z0){let Q0=U.get(Z0).get(y);if(H.get(Z0)!==Q0)J.uniformBlockBinding(Z0,Q0,y.__bindingPointIndex),H.set(Z0,Q0)}function u0(){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={},q={},Y0=null,R0={},E={},O=new WeakMap,R=[],k=null,F=!1,N=null,D=null,B=null,C=null,T=null,P=null,_=null,L=new k0(0,0,0),z=0,S=!1,I=null,j=null,b=null,v=null,x=null,n0.set(0,0,J.canvas.width,J.canvas.height),i.set(0,0,J.canvas.width,J.canvas.height),Y.reset(),X.reset(),K.reset()}return{buffers:{color:Y,depth:X,stencil:K},enable:N0,disable:P0,bindFramebuffer:e0,drawBuffers:d0,useProgram:s0,setBlending:b0,setMaterial:jJ,setFlipSided:vJ,setCullFace:zJ,setLineWidth:f,setPolygonOffset:pJ,setScissorTest:i0,activeTexture:r0,bindTexture:E0,unbindTexture:NJ,compressedTexImage2D:T0,compressedTexImage3D:w,texImage2D:c,texImage3D:o,pixelStorei:D0,getParameter:W0,updateUBOMapping:j0,uniformBlockBinding:x0,texStorage2D:J0,texStorage3D:K0,texSubImage2D:M,texSubImage3D:g,compressedTexSubImage2D:a,compressedTexSubImage3D:t,scissor:$0,viewport:H0,reset:u0}}function pq(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 h0,G=new WeakMap,q=new Set,E,O=new WeakMap,R=!1;try{R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(w){}function k(w,M){return R?new OffscreenCanvas(w,M):J6("canvas")}function F(w,M,g){let a=1,t=T0(w);if(t.width>g||t.height>g)a=g/Math.max(t.width,t.height);if(a<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){let J0=Math.floor(a*t.width),K0=Math.floor(a*t.height);if(E===void 0)E=k(J0,K0);let c=M?k(J0,K0):E;return c.width=J0,c.height=K0,c.getContext("2d").drawImage(w,0,0,J0,K0),B0("WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+J0+"x"+K0+")."),c}else{if("data"in w)B0("WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+").");return w}return w}function N(w){return w.generateMipmaps}function D(w){J.generateMipmap(w)}function B(w){if(w.isWebGLCubeRenderTarget)return J.TEXTURE_CUBE_MAP;if(w.isWebGL3DRenderTarget)return J.TEXTURE_3D;if(w.isWebGLArrayRenderTarget||w.isCompressedArrayTexture)return J.TEXTURE_2D_ARRAY;return J.TEXTURE_2D}function C(w,M,g,a,t,J0=!1){if(w!==null){if(J[w]!==void 0)return J[w];B0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let K0;if(a){if(K0=Q.get("EXT_texture_norm16"),!K0)B0("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let c=M;if(M===J.RED){if(g===J.FLOAT)c=J.R32F;if(g===J.HALF_FLOAT)c=J.R16F;if(g===J.UNSIGNED_BYTE)c=J.R8;if(g===J.UNSIGNED_SHORT&&K0)c=K0.R16_EXT;if(g===J.SHORT&&K0)c=K0.R16_SNORM_EXT}if(M===J.RED_INTEGER){if(g===J.UNSIGNED_BYTE)c=J.R8UI;if(g===J.UNSIGNED_SHORT)c=J.R16UI;if(g===J.UNSIGNED_INT)c=J.R32UI;if(g===J.BYTE)c=J.R8I;if(g===J.SHORT)c=J.R16I;if(g===J.INT)c=J.R32I}if(M===J.RG){if(g===J.FLOAT)c=J.RG32F;if(g===J.HALF_FLOAT)c=J.RG16F;if(g===J.UNSIGNED_BYTE)c=J.RG8;if(g===J.UNSIGNED_SHORT&&K0)c=K0.RG16_EXT;if(g===J.SHORT&&K0)c=K0.RG16_SNORM_EXT}if(M===J.RG_INTEGER){if(g===J.UNSIGNED_BYTE)c=J.RG8UI;if(g===J.UNSIGNED_SHORT)c=J.RG16UI;if(g===J.UNSIGNED_INT)c=J.RG32UI;if(g===J.BYTE)c=J.RG8I;if(g===J.SHORT)c=J.RG16I;if(g===J.INT)c=J.RG32I}if(M===J.RGB_INTEGER){if(g===J.UNSIGNED_BYTE)c=J.RGB8UI;if(g===J.UNSIGNED_SHORT)c=J.RGB16UI;if(g===J.UNSIGNED_INT)c=J.RGB32UI;if(g===J.BYTE)c=J.RGB8I;if(g===J.SHORT)c=J.RGB16I;if(g===J.INT)c=J.RGB32I}if(M===J.RGBA_INTEGER){if(g===J.UNSIGNED_BYTE)c=J.RGBA8UI;if(g===J.UNSIGNED_SHORT)c=J.RGBA16UI;if(g===J.UNSIGNED_INT)c=J.RGBA32UI;if(g===J.BYTE)c=J.RGBA8I;if(g===J.SHORT)c=J.RGBA16I;if(g===J.INT)c=J.RGBA32I}if(M===J.RGB){if(g===J.UNSIGNED_SHORT&&K0)c=K0.RGB16_EXT;if(g===J.SHORT&&K0)c=K0.RGB16_SNORM_EXT;if(g===J.UNSIGNED_INT_5_9_9_9_REV)c=J.RGB9_E5;if(g===J.UNSIGNED_INT_10F_11F_11F_REV)c=J.R11F_G11F_B10F}if(M===J.RGBA){let o=J0?YZ:l0.getTransfer(t);if(g===J.FLOAT)c=J.RGBA32F;if(g===J.HALF_FLOAT)c=J.RGBA16F;if(g===J.UNSIGNED_BYTE)c=o===UJ?J.SRGB8_ALPHA8:J.RGBA8;if(g===J.UNSIGNED_SHORT&&K0)c=K0.RGBA16_EXT;if(g===J.SHORT&&K0)c=K0.RGBA16_SNORM_EXT;if(g===J.UNSIGNED_SHORT_4_4_4_4)c=J.RGBA4;if(g===J.UNSIGNED_SHORT_5_5_5_1)c=J.RGB5_A1}if(c===J.R16F||c===J.R32F||c===J.RG16F||c===J.RG32F||c===J.RGBA16F||c===J.RGBA32F)Q.get("EXT_color_buffer_float");return c}function T(w,M){let g;if(w){if(M===null||M===K8||M===H6)g=J.DEPTH24_STENCIL8;else if(M===rJ)g=J.DEPTH32F_STENCIL8;else if(M===g6)g=J.DEPTH24_STENCIL8,B0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(M===null||M===K8||M===H6)g=J.DEPTH_COMPONENT24;else if(M===rJ)g=J.DEPTH_COMPONENT32F;else if(M===g6)g=J.DEPTH_COMPONENT16;return g}function P(w,M){if(N(w)===!0||w.isFramebufferTexture&&w.minFilter!==O9&&w.minFilter!==kJ)return Math.log2(Math.max(M.width,M.height))+1;else if(w.mipmaps!==void 0&&w.mipmaps.length>0)return w.mipmaps.length;else if(w.isCompressedTexture&&Array.isArray(w.image))return M.mipmaps.length;else return 1}function _(w){let M=w.target;if(M.removeEventListener("dispose",_),z(M),M.isVideoTexture)G.delete(M);if(M.isHTMLTexture)q.delete(M)}function L(w){let M=w.target;M.removeEventListener("dispose",L),I(M)}function z(w){let M=Z.get(w);if(M.__webglInit===void 0)return;let g=w.source,a=O.get(g);if(a){let t=a[M.__cacheKey];if(t.usedTimes--,t.usedTimes===0)S(w);if(Object.keys(a).length===0)O.delete(g)}Z.remove(w)}function S(w){let M=Z.get(w);J.deleteTexture(M.__webglTexture);let g=w.source,a=O.get(g);delete a[M.__cacheKey],X.memory.textures--}function I(w){let M=Z.get(w);if(w.depthTexture)w.depthTexture.dispose(),Z.remove(w.depthTexture);if(w.isWebGLCubeRenderTarget)for(let a=0;a<6;a++){if(Array.isArray(M.__webglFramebuffer[a]))for(let t=0;t<M.__webglFramebuffer[a].length;t++)J.deleteFramebuffer(M.__webglFramebuffer[a][t]);else J.deleteFramebuffer(M.__webglFramebuffer[a]);if(M.__webglDepthbuffer)J.deleteRenderbuffer(M.__webglDepthbuffer[a])}else{if(Array.isArray(M.__webglFramebuffer))for(let a=0;a<M.__webglFramebuffer.length;a++)J.deleteFramebuffer(M.__webglFramebuffer[a]);else J.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer)J.deleteRenderbuffer(M.__webglDepthbuffer);if(M.__webglMultisampledFramebuffer)J.deleteFramebuffer(M.__webglMultisampledFramebuffer);if(M.__webglColorRenderbuffer){for(let a=0;a<M.__webglColorRenderbuffer.length;a++)if(M.__webglColorRenderbuffer[a])J.deleteRenderbuffer(M.__webglColorRenderbuffer[a])}if(M.__webglDepthRenderbuffer)J.deleteRenderbuffer(M.__webglDepthRenderbuffer)}let g=w.textures;for(let a=0,t=g.length;a<t;a++){let J0=Z.get(g[a]);if(J0.__webglTexture)J.deleteTexture(J0.__webglTexture),X.memory.textures--;Z.remove(g[a])}Z.remove(w)}let j=0;function b(){j=0}function v(){return j}function x(w){j=w}function p(){let w=j;if(w>=W.maxTextures)B0("WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+W.maxTextures);return j+=1,w}function d(w){let M=[];return M.push(w.wrapS),M.push(w.wrapT),M.push(w.wrapR||0),M.push(w.magFilter),M.push(w.minFilter),M.push(w.anisotropy),M.push(w.internalFormat),M.push(w.format),M.push(w.type),M.push(w.generateMipmaps),M.push(w.premultiplyAlpha),M.push(w.flipY),M.push(w.unpackAlignment),M.push(w.colorSpace),M.join()}function n(w,M){let g=Z.get(w);if(w.isVideoTexture)E0(w);if(w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&g.__version!==w.version){let a=w.image;if(a===null)B0("WebGLRenderer: Texture marked for update but no image data found.");else if(a.complete===!1)B0("WebGLRenderer: Texture marked for update but image is incomplete");else{P0(g,w,M);return}}else if(w.isExternalTexture)g.__webglTexture=w.sourceTexture?w.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,g.__webglTexture,J.TEXTURE0+M)}function r(w,M){let g=Z.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&g.__version!==w.version){P0(g,w,M);return}else if(w.isExternalTexture)g.__webglTexture=w.sourceTexture?w.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,g.__webglTexture,J.TEXTURE0+M)}function Y0(w,M){let g=Z.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&g.__version!==w.version){P0(g,w,M);return}$.bindTexture(J.TEXTURE_3D,g.__webglTexture,J.TEXTURE0+M)}function R0(w,M){let g=Z.get(w);if(w.isCubeDepthTexture!==!0&&w.version>0&&g.__version!==w.version){e0(g,w,M);return}$.bindTexture(J.TEXTURE_CUBE_MAP,g.__webglTexture,J.TEXTURE0+M)}let G0={[X8]:J.REPEAT,[X6]:J.CLAMP_TO_EDGE,[u7]:J.MIRRORED_REPEAT},a0={[O9]:J.NEAREST,[m7]:J.NEAREST_MIPMAP_NEAREST,[C8]:J.NEAREST_MIPMAP_LINEAR,[kJ]:J.LINEAR,[K6]:J.LINEAR_MIPMAP_NEAREST,[I9]:J.LINEAR_MIPMAP_LINEAR},n0={[pY]:J.NEVER,[cY]:J.ALWAYS,[dY]:J.LESS,[r7]:J.LEQUAL,[uY]:J.EQUAL,[t7]:J.GEQUAL,[mY]:J.GREATER,[lY]:J.NOTEQUAL};function i(w,M){if(M.type===rJ&&Q.has("OES_texture_float_linear")===!1&&(M.magFilter===kJ||M.magFilter===K6||M.magFilter===C8||M.magFilter===I9||M.minFilter===kJ||M.minFilter===K6||M.minFilter===C8||M.minFilter===I9))B0("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(J.texParameteri(w,J.TEXTURE_WRAP_S,G0[M.wrapS]),J.texParameteri(w,J.TEXTURE_WRAP_T,G0[M.wrapT]),w===J.TEXTURE_3D||w===J.TEXTURE_2D_ARRAY)J.texParameteri(w,J.TEXTURE_WRAP_R,G0[M.wrapR]);if(J.texParameteri(w,J.TEXTURE_MAG_FILTER,a0[M.magFilter]),J.texParameteri(w,J.TEXTURE_MIN_FILTER,a0[M.minFilter]),M.compareFunction)J.texParameteri(w,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(w,J.TEXTURE_COMPARE_FUNC,n0[M.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===O9)return;if(M.minFilter!==C8&&M.minFilter!==I9)return;if(M.type===rJ&&Q.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||Z.get(M).__currentAnisotropy){let g=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(w,g.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,W.getMaxAnisotropy())),Z.get(M).__currentAnisotropy=M.anisotropy}}}function F0(w,M){let g=!1;if(w.__webglInit===void 0)w.__webglInit=!0,M.addEventListener("dispose",_);let a=M.source,t=O.get(a);if(t===void 0)t={},O.set(a,t);let J0=d(M);if(J0!==w.__cacheKey){if(t[J0]===void 0)t[J0]={texture:J.createTexture(),usedTimes:0},X.memory.textures++,g=!0;t[J0].usedTimes++;let K0=t[w.__cacheKey];if(K0!==void 0){if(t[w.__cacheKey].usedTimes--,K0.usedTimes===0)S(M)}w.__cacheKey=J0,w.__webglTexture=t[J0].texture}return g}function z0(w,M,g){return Math.floor(Math.floor(w/g)/M)}function N0(w,M,g,a){let J0=w.updateRanges;if(J0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,M.width,M.height,g,a,M.data);else{J0.sort((D0,$0)=>D0.start-$0.start);let K0=0;for(let D0=1;D0<J0.length;D0++){let $0=J0[K0],H0=J0[D0],j0=$0.start+$0.count,x0=z0(H0.start,M.width,4),u0=z0($0.start,M.width,4);if(H0.start<=j0+1&&x0===u0&&z0(H0.start+H0.count-1,M.width,4)===x0)$0.count=Math.max($0.count,H0.start+H0.count-$0.start);else++K0,J0[K0]=H0}J0.length=K0+1;let c=$.getParameter(J.UNPACK_ROW_LENGTH),o=$.getParameter(J.UNPACK_SKIP_PIXELS),W0=$.getParameter(J.UNPACK_SKIP_ROWS);$.pixelStorei(J.UNPACK_ROW_LENGTH,M.width);for(let D0=0,$0=J0.length;D0<$0;D0++){let H0=J0[D0],j0=Math.floor(H0.start/4),x0=Math.ceil(H0.count/4),u0=j0%M.width,y=Math.floor(j0/M.width),Z0=x0,s=1;$.pixelStorei(J.UNPACK_SKIP_PIXELS,u0),$.pixelStorei(J.UNPACK_SKIP_ROWS,y),$.texSubImage2D(J.TEXTURE_2D,0,u0,y,Z0,1,g,a,M.data)}w.clearUpdateRanges(),$.pixelStorei(J.UNPACK_ROW_LENGTH,c),$.pixelStorei(J.UNPACK_SKIP_PIXELS,o),$.pixelStorei(J.UNPACK_SKIP_ROWS,W0)}}function P0(w,M,g){let a=J.TEXTURE_2D;if(M.isDataArrayTexture||M.isCompressedArrayTexture)a=J.TEXTURE_2D_ARRAY;if(M.isData3DTexture)a=J.TEXTURE_3D;let t=F0(w,M),J0=M.source;$.bindTexture(a,w.__webglTexture,J.TEXTURE0+g);let K0=Z.get(J0);if(J0.version!==K0.__version||t===!0){if($.activeTexture(J.TEXTURE0+g),(typeof ImageBitmap<"u"&&M.image instanceof ImageBitmap)===!1){let s=l0.getPrimaries(l0.workingColorSpace),Q0=M.colorSpace===P8?null:l0.getPrimaries(M.colorSpace),M0=M.colorSpace===P8||s===Q0?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,M.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,M0)}$.pixelStorei(J.UNPACK_ALIGNMENT,M.unpackAlignment);let o=F(M.image,!1,W.maxTextureSize);o=NJ(M,o);let W0=Y.convert(M.format,M.colorSpace),D0=Y.convert(M.type),$0=C(M.internalFormat,W0,D0,M.normalized,M.colorSpace,M.isVideoTexture);i(a,M);let H0,j0=M.mipmaps,x0=M.isVideoTexture!==!0,u0=K0.__version===void 0||t===!0,y=J0.dataReady,Z0=P(M,o);if(M.isDepthTexture){if($0=T(M.format===_8,M.type),u0)if(x0)$.texStorage2D(J.TEXTURE_2D,1,$0,o.width,o.height);else $.texImage2D(J.TEXTURE_2D,0,$0,o.width,o.height,0,W0,D0,null)}else if(M.isDataTexture)if(j0.length>0){if(x0&&u0)$.texStorage2D(J.TEXTURE_2D,Z0,$0,j0[0].width,j0[0].height);for(let s=0,Q0=j0.length;s<Q0;s++)if(H0=j0[s],x0){if(y)$.texSubImage2D(J.TEXTURE_2D,s,0,0,H0.width,H0.height,W0,D0,H0.data)}else $.texImage2D(J.TEXTURE_2D,s,$0,H0.width,H0.height,0,W0,D0,H0.data);M.generateMipmaps=!1}else if(x0){if(u0)$.texStorage2D(J.TEXTURE_2D,Z0,$0,o.width,o.height);if(y)N0(M,o,W0,D0)}else $.texImage2D(J.TEXTURE_2D,0,$0,o.width,o.height,0,W0,D0,o.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){if(x0&&u0)$.texStorage3D(J.TEXTURE_2D_ARRAY,Z0,$0,j0[0].width,j0[0].height,o.depth);for(let s=0,Q0=j0.length;s<Q0;s++)if(H0=j0[s],M.format!==_9)if(W0!==null)if(x0){if(y)if(M.layerUpdates.size>0){let M0=jZ(H0.width,H0.height,M.format,M.type);for(let e of M.layerUpdates){let I0=H0.data.subarray(e*M0/H0.data.BYTES_PER_ELEMENT,(e+1)*M0/H0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,s,0,0,e,H0.width,H0.height,1,W0,I0)}M.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,s,0,0,0,H0.width,H0.height,o.depth,W0,H0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,s,$0,H0.width,H0.height,o.depth,0,H0.data,0,0);else B0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(x0){if(y)$.texSubImage3D(J.TEXTURE_2D_ARRAY,s,0,0,0,H0.width,H0.height,o.depth,W0,D0,H0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,s,$0,H0.width,H0.height,o.depth,0,W0,D0,H0.data)}else{if(x0&&u0)$.texStorage2D(J.TEXTURE_2D,Z0,$0,j0[0].width,j0[0].height);for(let s=0,Q0=j0.length;s<Q0;s++)if(H0=j0[s],M.format!==_9)if(W0!==null)if(x0){if(y)$.compressedTexSubImage2D(J.TEXTURE_2D,s,0,0,H0.width,H0.height,W0,H0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,s,$0,H0.width,H0.height,0,H0.data);else B0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(x0){if(y)$.texSubImage2D(J.TEXTURE_2D,s,0,0,H0.width,H0.height,W0,D0,H0.data)}else $.texImage2D(J.TEXTURE_2D,s,$0,H0.width,H0.height,0,W0,D0,H0.data)}else if(M.isDataArrayTexture)if(x0){if(u0)$.texStorage3D(J.TEXTURE_2D_ARRAY,Z0,$0,o.width,o.height,o.depth);if(y)if(M.layerUpdates.size>0){let s=jZ(o.width,o.height,M.format,M.type);for(let Q0 of M.layerUpdates){let M0=o.data.subarray(Q0*s/o.data.BYTES_PER_ELEMENT,(Q0+1)*s/o.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,Q0,o.width,o.height,1,W0,D0,M0)}M.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,o.width,o.height,o.depth,W0,D0,o.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,$0,o.width,o.height,o.depth,0,W0,D0,o.data);else if(M.isData3DTexture)if(x0){if(u0)$.texStorage3D(J.TEXTURE_3D,Z0,$0,o.width,o.height,o.depth);if(y)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,o.width,o.height,o.depth,W0,D0,o.data)}else $.texImage3D(J.TEXTURE_3D,0,$0,o.width,o.height,o.depth,0,W0,D0,o.data);else if(M.isFramebufferTexture){if(u0)if(x0)$.texStorage2D(J.TEXTURE_2D,Z0,$0,o.width,o.height);else{let{width:s,height:Q0}=o;for(let M0=0;M0<Z0;M0++)$.texImage2D(J.TEXTURE_2D,M0,$0,s,Q0,0,W0,D0,null),s>>=1,Q0>>=1}}else if(M.isHTMLTexture){if("texElementImage2D"in J){let s=J.canvas;if(!s.hasAttribute("layoutsubtree"))s.setAttribute("layoutsubtree","true");if(o.parentNode!==s){s.appendChild(o),q.add(M),s.onpaint=(y0)=>{let CJ=y0.changedElements;for(let $J of q)if(CJ.includes($J.image))$J.needsUpdate=!0},s.requestPaint();return}let Q0=0,M0=J.RGBA,e=J.RGBA,I0=J.UNSIGNED_BYTE;J.texElementImage2D(J.TEXTURE_2D,Q0,M0,e,I0,o),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(j0.length>0){if(x0&&u0){let s=T0(j0[0]);$.texStorage2D(J.TEXTURE_2D,Z0,$0,s.width,s.height)}for(let s=0,Q0=j0.length;s<Q0;s++)if(H0=j0[s],x0){if(y)$.texSubImage2D(J.TEXTURE_2D,s,0,0,W0,D0,H0)}else $.texImage2D(J.TEXTURE_2D,s,$0,W0,D0,H0);M.generateMipmaps=!1}else if(x0){if(u0){let s=T0(o);$.texStorage2D(J.TEXTURE_2D,Z0,$0,s.width,s.height)}if(y)$.texSubImage2D(J.TEXTURE_2D,0,0,0,W0,D0,o)}else $.texImage2D(J.TEXTURE_2D,0,$0,W0,D0,o);if(N(M))D(a);if(K0.__version=J0.version,M.onUpdate)M.onUpdate(M)}w.__version=M.version}function e0(w,M,g){if(M.image.length!==6)return;let a=F0(w,M),t=M.source;$.bindTexture(J.TEXTURE_CUBE_MAP,w.__webglTexture,J.TEXTURE0+g);let J0=Z.get(t);if(t.version!==J0.__version||a===!0){$.activeTexture(J.TEXTURE0+g);let K0=l0.getPrimaries(l0.workingColorSpace),c=M.colorSpace===P8?null:l0.getPrimaries(M.colorSpace),o=M.colorSpace===P8||K0===c?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,M.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),$.pixelStorei(J.UNPACK_ALIGNMENT,M.unpackAlignment),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,o);let W0=M.isCompressedTexture||M.image[0].isCompressedTexture,D0=M.image[0]&&M.image[0].isDataTexture,$0=[];for(let e=0;e<6;e++){if(!W0&&!D0)$0[e]=F(M.image[e],!0,W.maxCubemapSize);else $0[e]=D0?M.image[e].image:M.image[e];$0[e]=NJ(M,$0[e])}let H0=$0[0],j0=Y.convert(M.format,M.colorSpace),x0=Y.convert(M.type),u0=C(M.internalFormat,j0,x0,M.normalized,M.colorSpace),y=M.isVideoTexture!==!0,Z0=J0.__version===void 0||a===!0,s=t.dataReady,Q0=P(M,H0);i(J.TEXTURE_CUBE_MAP,M);let M0;if(W0){if(y&&Z0)$.texStorage2D(J.TEXTURE_CUBE_MAP,Q0,u0,H0.width,H0.height);for(let e=0;e<6;e++){M0=$0[e].mipmaps;for(let I0=0;I0<M0.length;I0++){let y0=M0[I0];if(M.format!==_9)if(j0!==null)if(y){if(s)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0,0,0,y0.width,y0.height,j0,y0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0,u0,y0.width,y0.height,0,y0.data);else B0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(y){if(s)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0,0,0,y0.width,y0.height,j0,x0,y0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0,u0,y0.width,y0.height,0,j0,x0,y0.data)}}}else{if(M0=M.mipmaps,y&&Z0){if(M0.length>0)Q0++;let e=T0($0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,Q0,u0,e.width,e.height)}for(let e=0;e<6;e++)if(D0){if(y){if(s)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,$0[e].width,$0[e].height,j0,x0,$0[e].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,u0,$0[e].width,$0[e].height,0,j0,x0,$0[e].data);for(let I0=0;I0<M0.length;I0++){let CJ=M0[I0].image[e].image;if(y){if(s)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0+1,0,0,CJ.width,CJ.height,j0,x0,CJ.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0+1,u0,CJ.width,CJ.height,0,j0,x0,CJ.data)}}else{if(y){if(s)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,j0,x0,$0[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,u0,j0,x0,$0[e]);for(let I0=0;I0<M0.length;I0++){let y0=M0[I0];if(y){if(s)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0+1,0,0,j0,x0,y0.image[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,I0+1,u0,j0,x0,y0.image[e])}}}if(N(M))D(J.TEXTURE_CUBE_MAP);if(J0.__version=t.version,M.onUpdate)M.onUpdate(M)}w.__version=M.version}function d0(w,M,g,a,t,J0){let K0=Y.convert(g.format,g.colorSpace),c=Y.convert(g.type),o=C(g.internalFormat,K0,c,g.normalized,g.colorSpace),W0=Z.get(M),D0=Z.get(g);if(D0.__renderTarget=M,!W0.__hasExternalTextures){let $0=Math.max(1,M.width>>J0),H0=Math.max(1,M.height>>J0);if(t===J.TEXTURE_3D||t===J.TEXTURE_2D_ARRAY)$.texImage3D(t,J0,o,$0,H0,M.depth,0,K0,c,null);else $.texImage2D(t,J0,o,$0,H0,0,K0,c,null)}if($.bindFramebuffer(J.FRAMEBUFFER,w),r0(M))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,a,t,D0.__webglTexture,0,i0(M));else if(t===J.TEXTURE_2D||t>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&t<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,a,t,D0.__webglTexture,J0);$.bindFramebuffer(J.FRAMEBUFFER,null)}function s0(w,M,g){if(J.bindRenderbuffer(J.RENDERBUFFER,w),M.depthBuffer){let a=M.depthTexture,t=a&&a.isDepthTexture?a.type:null,J0=T(M.stencilBuffer,t),K0=M.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(r0(M))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,i0(M),J0,M.width,M.height);else if(g)J.renderbufferStorageMultisample(J.RENDERBUFFER,i0(M),J0,M.width,M.height);else J.renderbufferStorage(J.RENDERBUFFER,J0,M.width,M.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,K0,J.RENDERBUFFER,w)}else{let a=M.textures;for(let t=0;t<a.length;t++){let J0=a[t],K0=Y.convert(J0.format,J0.colorSpace),c=Y.convert(J0.type),o=C(J0.internalFormat,K0,c,J0.normalized,J0.colorSpace);if(r0(M))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,i0(M),o,M.width,M.height);else if(g)J.renderbufferStorageMultisample(J.RENDERBUFFER,i0(M),o,M.width,M.height);else J.renderbufferStorage(J.RENDERBUFFER,o,M.width,M.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function WJ(w,M,g){let a=M.isWebGLCubeRenderTarget===!0;if($.bindFramebuffer(J.FRAMEBUFFER,w),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let t=Z.get(M.depthTexture);if(t.__renderTarget=M,!t.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0;if(a){if(t.__webglInit===void 0)t.__webglInit=!0,M.depthTexture.addEventListener("dispose",_);if(t.__webglTexture===void 0){t.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,t.__webglTexture),i(J.TEXTURE_CUBE_MAP,M.depthTexture);let W0=Y.convert(M.depthTexture.format),D0=Y.convert(M.depthTexture.type),$0;if(M.depthTexture.format===I8)$0=J.DEPTH_COMPONENT24;else if(M.depthTexture.format===_8)$0=J.DEPTH24_STENCIL8;for(let H0=0;H0<6;H0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+H0,0,$0,M.width,M.height,0,W0,D0,null)}}else n(M.depthTexture,0);let J0=t.__webglTexture,K0=i0(M),c=a?J.TEXTURE_CUBE_MAP_POSITIVE_X+g:J.TEXTURE_2D,o=M.depthTexture.format===_8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(M.depthTexture.format===I8)if(r0(M))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,c,J0,0,K0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,c,J0,0);else if(M.depthTexture.format===_8)if(r0(M))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,c,J0,0,K0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,c,J0,0);else throw Error("Unknown depthTexture format")}function YJ(w){let M=Z.get(w),g=w.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==w.depthTexture){let a=w.depthTexture;if(M.__depthDisposeCallback)M.__depthDisposeCallback();if(a){let t=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,a.removeEventListener("dispose",t)};a.addEventListener("dispose",t),M.__depthDisposeCallback=t}M.__boundDepthTexture=a}if(w.depthTexture&&!M.__autoAllocateDepthBuffer)if(g)for(let a=0;a<6;a++)WJ(M.__webglFramebuffer[a],w,a);else{let a=w.texture.mipmaps;if(a&&a.length>0)WJ(M.__webglFramebuffer[0],w,0);else WJ(M.__webglFramebuffer,w,0)}else if(g){M.__webglDepthbuffer=[];for(let a=0;a<6;a++)if($.bindFramebuffer(J.FRAMEBUFFER,M.__webglFramebuffer[a]),M.__webglDepthbuffer[a]===void 0)M.__webglDepthbuffer[a]=J.createRenderbuffer(),s0(M.__webglDepthbuffer[a],w,!1);else{let t=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,J0=M.__webglDepthbuffer[a];J.bindRenderbuffer(J.RENDERBUFFER,J0),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,J0)}}else{let a=w.texture.mipmaps;if(a&&a.length>0)$.bindFramebuffer(J.FRAMEBUFFER,M.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,M.__webglFramebuffer);if(M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=J.createRenderbuffer(),s0(M.__webglDepthbuffer,w,!1);else{let t=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,J0=M.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,J0),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,J0)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function b0(w,M,g){let a=Z.get(w);if(M!==void 0)d0(a.__webglFramebuffer,w,w.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(g!==void 0)YJ(w)}function jJ(w){let M=w.texture,g=Z.get(w),a=Z.get(M);w.addEventListener("dispose",L);let t=w.textures,J0=w.isWebGLCubeRenderTarget===!0,K0=t.length>1;if(!K0){if(a.__webglTexture===void 0)a.__webglTexture=J.createTexture();a.__version=M.version,X.memory.textures++}if(J0){g.__webglFramebuffer=[];for(let c=0;c<6;c++)if(M.mipmaps&&M.mipmaps.length>0){g.__webglFramebuffer[c]=[];for(let o=0;o<M.mipmaps.length;o++)g.__webglFramebuffer[c][o]=J.createFramebuffer()}else g.__webglFramebuffer[c]=J.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){g.__webglFramebuffer=[];for(let c=0;c<M.mipmaps.length;c++)g.__webglFramebuffer[c]=J.createFramebuffer()}else g.__webglFramebuffer=J.createFramebuffer();if(K0)for(let c=0,o=t.length;c<o;c++){let W0=Z.get(t[c]);if(W0.__webglTexture===void 0)W0.__webglTexture=J.createTexture(),X.memory.textures++}if(w.samples>0&&r0(w)===!1){g.__webglMultisampledFramebuffer=J.createFramebuffer(),g.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,g.__webglMultisampledFramebuffer);for(let c=0;c<t.length;c++){let o=t[c];g.__webglColorRenderbuffer[c]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,g.__webglColorRenderbuffer[c]);let W0=Y.convert(o.format,o.colorSpace),D0=Y.convert(o.type),$0=C(o.internalFormat,W0,D0,o.normalized,o.colorSpace,w.isXRRenderTarget===!0),H0=i0(w);J.renderbufferStorageMultisample(J.RENDERBUFFER,H0,$0,w.width,w.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+c,J.RENDERBUFFER,g.__webglColorRenderbuffer[c])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),w.depthBuffer)g.__webglDepthRenderbuffer=J.createRenderbuffer(),s0(g.__webglDepthRenderbuffer,w,!0);$.bindFramebuffer(J.FRAMEBUFFER,null)}}if(J0){$.bindTexture(J.TEXTURE_CUBE_MAP,a.__webglTexture),i(J.TEXTURE_CUBE_MAP,M);for(let c=0;c<6;c++)if(M.mipmaps&&M.mipmaps.length>0)for(let o=0;o<M.mipmaps.length;o++)d0(g.__webglFramebuffer[c][o],w,M,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+c,o);else d0(g.__webglFramebuffer[c],w,M,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+c,0);if(N(M))D(J.TEXTURE_CUBE_MAP);$.unbindTexture()}else if(K0){for(let c=0,o=t.length;c<o;c++){let W0=t[c],D0=Z.get(W0),$0=J.TEXTURE_2D;if(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)$0=w.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture($0,D0.__webglTexture),i($0,W0),d0(g.__webglFramebuffer,w,W0,J.COLOR_ATTACHMENT0+c,$0,0),N(W0))D($0)}$.unbindTexture()}else{let c=J.TEXTURE_2D;if(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)c=w.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(c,a.__webglTexture),i(c,M),M.mipmaps&&M.mipmaps.length>0)for(let o=0;o<M.mipmaps.length;o++)d0(g.__webglFramebuffer[o],w,M,J.COLOR_ATTACHMENT0,c,o);else d0(g.__webglFramebuffer,w,M,J.COLOR_ATTACHMENT0,c,0);if(N(M))D(c);$.unbindTexture()}if(w.depthBuffer)YJ(w)}function vJ(w){let M=w.textures;for(let g=0,a=M.length;g<a;g++){let t=M[g];if(N(t)){let J0=B(w),K0=Z.get(t).__webglTexture;$.bindTexture(J0,K0),D(J0),$.unbindTexture()}}}let zJ=[],f=[];function pJ(w){if(w.samples>0){if(r0(w)===!1){let{textures:M,width:g,height:a}=w,t=J.COLOR_BUFFER_BIT,J0=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,K0=Z.get(w),c=M.length>1;if(c)for(let W0=0;W0<M.length;W0++)$.bindFramebuffer(J.FRAMEBUFFER,K0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+W0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,K0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+W0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,K0.__webglMultisampledFramebuffer);let o=w.texture.mipmaps;if(o&&o.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,K0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,K0.__webglFramebuffer);for(let W0=0;W0<M.length;W0++){if(w.resolveDepthBuffer){if(w.depthBuffer)t|=J.DEPTH_BUFFER_BIT;if(w.stencilBuffer&&w.resolveStencilBuffer)t|=J.STENCIL_BUFFER_BIT}if(c){J.framebufferRenderbuffer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.RENDERBUFFER,K0.__webglColorRenderbuffer[W0]);let D0=Z.get(M[W0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,D0,0)}if(J.blitFramebuffer(0,0,g,a,0,0,g,a,t,J.NEAREST),H===!0){if(zJ.length=0,f.length=0,zJ.push(J.COLOR_ATTACHMENT0+W0),w.depthBuffer&&w.resolveDepthBuffer===!1)zJ.push(J0),f.push(J0),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,f);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,zJ)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),c)for(let W0=0;W0<M.length;W0++){$.bindFramebuffer(J.FRAMEBUFFER,K0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+W0,J.RENDERBUFFER,K0.__webglColorRenderbuffer[W0]);let D0=Z.get(M[W0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,K0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+W0,J.TEXTURE_2D,D0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,K0.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.resolveDepthBuffer===!1&&H){let M=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,[M])}}}function i0(w){return Math.min(W.maxSamples,w.samples)}function r0(w){let M=Z.get(w);return w.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function E0(w){let M=X.render.frame;if(G.get(w)!==M)G.set(w,M),w.update()}function NJ(w,M){let{colorSpace:g,format:a,type:t}=w;if(w.isCompressedTexture===!0||w.isVideoTexture===!0)return M;if(g!==uJ&&g!==P8)if(l0.getTransfer(g)===UJ){if(a!==_9||t!==R9)B0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else A0("WebGLTextures: Unsupported texture color space:",g);return M}function T0(w){if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement)U.width=w.naturalWidth||w.width,U.height=w.naturalHeight||w.height;else if(typeof VideoFrame<"u"&&w instanceof VideoFrame)U.width=w.displayWidth,U.height=w.displayHeight;else U.width=w.width,U.height=w.height;return U}this.allocateTextureUnit=p,this.resetTextureUnits=b,this.getTextureUnits=v,this.setTextureUnits=x,this.setTexture2D=n,this.setTexture2DArray=r,this.setTexture3D=Y0,this.setTextureCube=R0,this.rebindTextures=b0,this.setupRenderTarget=jJ,this.updateRenderTargetMipmap=vJ,this.updateMultisampleRenderTarget=pJ,this.setupDepthRenderbuffer=YJ,this.setupFrameBufferTexture=d0,this.useMultisampledRTT=r0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function dq(J,Q){function $(Z,W=P8){let Y,X=l0.getTransfer(W);if(Z===R9)return J.UNSIGNED_BYTE;if(Z===B$)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===V$)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===yY)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===fY)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===jY)return J.BYTE;if(Z===vY)return J.SHORT;if(Z===g6)return J.UNSIGNED_SHORT;if(Z===k$)return J.INT;if(Z===K8)return J.UNSIGNED_INT;if(Z===rJ)return J.FLOAT;if(Z===bJ)return J.HALF_FLOAT;if(Z===xY)return J.ALPHA;if(Z===hY)return J.RGB;if(Z===_9)return J.RGBA;if(Z===I8)return J.DEPTH_COMPONENT;if(Z===_8)return J.DEPTH_STENCIL;if(Z===bY)return J.RED;if(Z===z$)return J.RED_INTEGER;if(Z===w8)return J.RG;if(Z===C$)return J.RG_INTEGER;if(Z===I$)return J.RGBA_INTEGER;if(Z===l7||Z===c7||Z===n7||Z===s7)if(X===UJ)if(Y=Q.get("WEBGL_compressed_texture_s3tc_srgb"),Y!==null){if(Z===l7)return Y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===c7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===n7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===s7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(Y=Q.get("WEBGL_compressed_texture_s3tc"),Y!==null){if(Z===l7)return Y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===c7)return Y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===n7)return Y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===s7)return Y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===_$||Z===w$||Z===P$||Z===T$)if(Y=Q.get("WEBGL_compressed_texture_pvrtc"),Y!==null){if(Z===_$)return Y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===w$)return Y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===P$)return Y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===T$)return Y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===A$||Z===S$||Z===j$||Z===v$||Z===y$||Z===i7||Z===f$)if(Y=Q.get("WEBGL_compressed_texture_etc"),Y!==null){if(Z===A$||Z===S$)return X===UJ?Y.COMPRESSED_SRGB8_ETC2:Y.COMPRESSED_RGB8_ETC2;if(Z===j$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:Y.COMPRESSED_RGBA8_ETC2_EAC;if(Z===v$)return Y.COMPRESSED_R11_EAC;if(Z===y$)return Y.COMPRESSED_SIGNED_R11_EAC;if(Z===i7)return Y.COMPRESSED_RG11_EAC;if(Z===f$)return Y.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===x$||Z===h$||Z===b$||Z===g$||Z===p$||Z===d$||Z===u$||Z===m$||Z===l$||Z===c$||Z===n$||Z===s$||Z===i$||Z===o$)if(Y=Q.get("WEBGL_compressed_texture_astc"),Y!==null){if(Z===x$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:Y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===h$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:Y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===b$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:Y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===g$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:Y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===p$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:Y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===d$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:Y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===u$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:Y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===m$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:Y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===l$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:Y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===c$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:Y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===n$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:Y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===s$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:Y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===i$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:Y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===o$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:Y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===a$||Z===r$||Z===t$)if(Y=Q.get("EXT_texture_compression_bptc"),Y!==null){if(Z===a$)return X===UJ?Y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:Y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===r$)return Y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===t$)return Y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===e$||Z===JZ||Z===o7||Z===QZ)if(Y=Q.get("EXT_texture_compression_rgtc"),Y!==null){if(Z===e$)return Y.COMPRESSED_RED_RGTC1_EXT;if(Z===JZ)return Y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===o7)return Y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===QZ)return Y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===H6)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}var uq=`
4080
+ }`,u1=[new j(1,0,0),new j(-1,0,0),new j(0,1,0),new j(0,-1,0),new j(0,0,1),new j(0,0,-1)],m1=[new j(0,-1,0),new j(0,-1,0),new j(0,0,1),new j(0,0,-1),new j(0,-1,0),new j(0,-1,0)],TX=new S0,$7=new j,pZ=new j;function l1(J,Q,$){let Z=new A8,W=new p0,Y=new p0,X=new QJ,K=new MZ,H=new kZ,U={},G=$.maxTextureSize,F={[z9]:bJ,[bJ]:z9,[cJ]:cJ},E=new SJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new p0},radius:{value:4}},vertexShader:p1,fragmentShader:d1}),O=E.clone();O.defines.HORIZONTAL_PASS=1;let R=new RJ;R.setAttribute("position",new JJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let C=new GJ(R,E),q=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b6;let N=this.type;this.render=function(P,V,D){if(q.enabled===!1)return;if(q.autoUpdate===!1&&q.needsUpdate===!1)return;if(P.length===0)return;if(this.type===YY)C0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=b6;let B=J.getRenderTarget(),A=J.getActiveCubeFace(),z=J.getActiveMipmapLevel(),S=J.state;if(S.setBlending(w9),S.buffers.depth.getReversed()===!0)S.buffers.color.setClear(0,0,0,0);else S.buffers.color.setClear(1,1,1,1);S.buffers.depth.setTest(!0),S.setScissorTest(!1);let y=N!==this.type;if(y)V.traverse(function(v){if(v.material)if(Array.isArray(v.material))v.material.forEach((h)=>h.needsUpdate=!0);else v.material.needsUpdate=!0});for(let v=0,h=P.length;v<h;v++){let g=P[v],p=g.shadow;if(p===void 0){C0("WebGLShadowMap:",g,"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 a=J.state.buffers.depth.getReversed();if(p.camera._reversedDepth=a,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===Z6){if(g.isPointLight){C0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}p.map=new nJ(W.x,W.y,{format:P8,type:fJ,minFilter:BJ,magFilter:BJ,generateMipmaps:!1}),p.map.texture.name=g.name+".shadowMap",p.map.depthTexture=new U8(W.x,W.y,tJ),p.map.depthTexture.name=g.name+".shadowMapDepth",p.map.depthTexture.format=z8,p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=L9,p.map.depthTexture.magFilter=L9}else{if(g.isPointLight)p.map=new mZ(W.x),p.map.depthTexture=new OZ(W.x,K8);else p.map=new nJ(W.x,W.y),p.map.depthTexture=new U8(W.x,W.y,K8);if(p.map.depthTexture.name=g.name+".shadowMap",p.map.depthTexture.format=z8,this.type===b6)p.map.depthTexture.compareFunction=a?JQ:e7,p.map.depthTexture.minFilter=BJ,p.map.depthTexture.magFilter=BJ;else p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=L9,p.map.depthTexture.magFilter=L9}p.camera.updateProjectionMatrix()}let Q0=p.map.isWebGLCubeRenderTarget?6:1;for(let H0=0;H0<Q0;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),S.viewport(X)}if(g.isPointLight){let{camera:J0,matrix:x0}=p,v0=g.distance||J0.far;if(v0!==J0.far)J0.far=v0,J0.updateProjectionMatrix();$7.setFromMatrixPosition(g.matrixWorld),J0.position.copy($7),pZ.copy(J0.position),pZ.add(u1[H0]),J0.up.copy(m1[H0]),J0.lookAt(pZ),J0.updateMatrixWorld(),x0.makeTranslation(-$7.x,-$7.y,-$7.z),TX.multiplyMatrices(J0.projectionMatrix,J0.matrixWorldInverse),p._frustum.setFromProjectionMatrix(TX,J0.coordinateSystem,J0.reversedDepth)}else p.updateMatrices(g);Z=p.getFrustum(),k(V,D,p.camera,g,this.type)}if(p.isPointLightShadow!==!0&&this.type===Z6)L(p,D);p.needsUpdate=!1}N=this.type,q.needsUpdate=!1,J.setRenderTarget(B,A,z)};function L(P,V){let D=Q.update(C);if(E.defines.VSM_SAMPLES!==P.blurSamples)E.defines.VSM_SAMPLES=P.blurSamples,O.defines.VSM_SAMPLES=P.blurSamples,E.needsUpdate=!0,O.needsUpdate=!0;if(P.mapPass===null)P.mapPass=new nJ(W.x,W.y,{format:P8,type:fJ});E.uniforms.shadow_pass.value=P.map.depthTexture,E.uniforms.resolution.value=P.mapSize,E.uniforms.radius.value=P.radius,J.setRenderTarget(P.mapPass),J.clear(),J.renderBufferDirect(V,null,D,E,C,null),O.uniforms.shadow_pass.value=P.mapPass.texture,O.uniforms.resolution.value=P.mapSize,O.uniforms.radius.value=P.radius,J.setRenderTarget(P.map),J.clear(),J.renderBufferDirect(V,null,D,O,C,null)}function M(P,V,D,B){let A=null,z=D.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(z!==void 0)A=z;else if(A=D.isPointLight===!0?H:K,J.localClippingEnabled&&V.clipShadows===!0&&Array.isArray(V.clippingPlanes)&&V.clippingPlanes.length!==0||V.displacementMap&&V.displacementScale!==0||V.alphaMap&&V.alphaTest>0||V.map&&V.alphaTest>0||V.alphaToCoverage===!0){let S=A.uuid,y=V.uuid,v=U[S];if(v===void 0)v={},U[S]=v;let h=v[y];if(h===void 0)h=A.clone(),v[y]=h,V.addEventListener("dispose",_);A=h}if(A.visible=V.visible,A.wireframe=V.wireframe,B===Z6)A.side=V.shadowSide!==null?V.shadowSide:V.side;else A.side=V.shadowSide!==null?V.shadowSide:F[V.side];if(A.alphaMap=V.alphaMap,A.alphaTest=V.alphaToCoverage===!0?0.5:V.alphaTest,A.map=V.map,A.clipShadows=V.clipShadows,A.clippingPlanes=V.clippingPlanes,A.clipIntersection=V.clipIntersection,A.displacementMap=V.displacementMap,A.displacementScale=V.displacementScale,A.displacementBias=V.displacementBias,A.wireframeLinewidth=V.wireframeLinewidth,A.linewidth=V.linewidth,D.isPointLight===!0&&A.isMeshDistanceMaterial===!0){let S=J.properties.get(A);S.light=D}return A}function k(P,V,D,B,A){if(P.visible===!1)return;if(P.layers.test(V.layers)&&(P.isMesh||P.isLine||P.isPoints)){if((P.castShadow||P.receiveShadow&&A===Z6)&&(!P.frustumCulled||Z.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,P.matrixWorld);let y=Q.update(P),v=P.material;if(Array.isArray(v)){let h=y.groups;for(let g=0,p=h.length;g<p;g++){let c=h[g],a=v[c.materialIndex];if(a&&a.visible){let Q0=M(P,a,B,A);P.onBeforeShadow(J,P,V,D,y,Q0,c),J.renderBufferDirect(D,null,y,Q0,P,c),P.onAfterShadow(J,P,V,D,y,Q0,c)}}}else if(v.visible){let h=M(P,v,B,A);P.onBeforeShadow(J,P,V,D,y,h,null),J.renderBufferDirect(D,null,y,h,P,null),P.onAfterShadow(J,P,V,D,y,h,null)}}}let S=P.children;for(let y=0,v=S.length;y<v;y++)k(S[y],V,D,B,A)}function _(P){P.target.removeEventListener("dispose",_);for(let D in U){let B=U[D],A=P.target.uuid;if(A in B)B[A].dispose(),delete B[A]}}}function c1(J,Q){function $(){let x=!1,X0=new QJ,i=null,Z0=new QJ(0,0,0,0);return{setMask:function(V0){if(i!==V0&&!x)J.colorMask(V0,V0,V0,V0),i=V0},setLocked:function(V0){x=V0},setClear:function(V0,e,z0,b0,IJ){if(IJ===!0)V0*=b0,e*=b0,z0*=b0;if(X0.set(V0,e,z0,b0),Z0.equals(X0)===!1)J.clearColor(V0,e,z0,b0),Z0.copy(X0)},reset:function(){x=!1,i=null,Z0.set(-1,0,0,0)}}}function Z(){let x=!1,X0=!1,i=null,Z0=null,V0=null;return{setReversed:function(e){if(X0!==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);X0=e;let b0=V0;V0=null,this.setClear(b0)}},getReversed:function(){return X0},setTest:function(e){if(e)G0(J.DEPTH_TEST);else w0(J.DEPTH_TEST)},setMask:function(e){if(i!==e&&!x)J.depthMask(e),i=e},setFunc:function(e){if(X0)e=eY[e];if(Z0!==e){switch(e){case wY:J.depthFunc(J.NEVER);break;case PY:J.depthFunc(J.ALWAYS);break;case _Y:J.depthFunc(J.LESS);break;case q$:J.depthFunc(J.LEQUAL);break;case TY:J.depthFunc(J.EQUAL);break;case AY:J.depthFunc(J.GEQUAL);break;case SY:J.depthFunc(J.GREATER);break;case jY:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}Z0=e}},setLocked:function(e){x=e},setClear:function(e){if(V0!==e){if(V0=e,X0)e=1-e;J.clearDepth(e)}},reset:function(){x=!1,i=null,Z0=null,V0=null,X0=!1}}}function W(){let x=!1,X0=null,i=null,Z0=null,V0=null,e=null,z0=null,b0=null,IJ=null;return{setTest:function(ZJ){if(!x)if(ZJ)G0(J.STENCIL_TEST);else w0(J.STENCIL_TEST)},setMask:function(ZJ){if(X0!==ZJ&&!x)J.stencilMask(ZJ),X0=ZJ},setFunc:function(ZJ,B9,G9){if(i!==ZJ||Z0!==B9||V0!==G9)J.stencilFunc(ZJ,B9,G9),i=ZJ,Z0=B9,V0=G9},setOp:function(ZJ,B9,G9){if(e!==ZJ||z0!==B9||b0!==G9)J.stencilOp(ZJ,B9,G9),e=ZJ,z0=B9,b0=G9},setLocked:function(ZJ){x=ZJ},setClear:function(ZJ){if(IJ!==ZJ)J.clearStencil(ZJ),IJ=ZJ},reset:function(){x=!1,X0=null,i=null,Z0=null,V0=null,e=null,z0=null,b0=null,IJ=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,M=null,k=null,_=null,P=null,V=null,D=new R0(0,0,0),B=0,A=!1,z=null,S=null,y=null,v=null,h=null,g=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),p=!1,c=0,a=J.getParameter(J.VERSION);if(a.indexOf("WebGL")!==-1)c=parseFloat(/^WebGL (\d)/.exec(a)[1]),p=c>=1;else if(a.indexOf("OpenGL ES")!==-1)c=parseFloat(/^OpenGL ES (\d)/.exec(a)[1]),p=c>=2;let Q0=null,H0={},J0=J.getParameter(J.SCISSOR_BOX),x0=J.getParameter(J.VIEWPORT),v0=new QJ().fromArray(J0),s=new QJ().fromArray(x0);function Y0(x,X0,i,Z0){let V0=new Uint8Array(4),e=J.createTexture();J.bindTexture(x,e),J.texParameteri(x,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(x,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let z0=0;z0<i;z0++)if(x===J.TEXTURE_3D||x===J.TEXTURE_2D_ARRAY)J.texImage3D(X0,0,J.RGBA,1,1,Z0,0,J.RGBA,J.UNSIGNED_BYTE,V0);else J.texImage2D(X0+z0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,V0);return e}let D0={};D0[J.TEXTURE_2D]=Y0(J.TEXTURE_2D,J.TEXTURE_2D,1),D0[J.TEXTURE_CUBE_MAP]=Y0(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),D0[J.TEXTURE_2D_ARRAY]=Y0(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),D0[J.TEXTURE_3D]=Y0(J.TEXTURE_3D,J.TEXTURE_3D,1,1),Y.setClear(0,0,0,1),X.setClear(1),K.setClear(0),G0(J.DEPTH_TEST),X.setFunc(q$),vJ(!1),CJ(F$),G0(J.CULL_FACE),u0(w9);function G0(x){if(G[x]!==!0)J.enable(x),G[x]=!0}function w0(x){if(G[x]!==!1)J.disable(x),G[x]=!1}function i0(x,X0){if(E[x]!==X0){if(J.bindFramebuffer(x,X0),E[x]=X0,x===J.DRAW_FRAMEBUFFER)E[J.FRAMEBUFFER]=X0;if(x===J.FRAMEBUFFER)E[J.DRAW_FRAMEBUFFER]=X0;return!0}return!1}function j0(x,X0){let i=R,Z0=!1;if(x){if(i=O.get(X0),i===void 0)i=[],O.set(X0,i);let V0=x.textures;if(i.length!==V0.length||i[0]!==J.COLOR_ATTACHMENT0){for(let e=0,z0=V0.length;e<z0;e++)i[e]=J.COLOR_ATTACHMENT0+e;i.length=V0.length,Z0=!0}}else if(i[0]!==J.BACK)i[0]=J.BACK,Z0=!0;if(Z0)J.drawBuffers(i)}function d0(x){if(C!==x)return J.useProgram(x),C=x,!0;return!1}let YJ={[W6]:J.FUNC_ADD,[KY]:J.FUNC_SUBTRACT,[HY]:J.FUNC_REVERSE_SUBTRACT};YJ[UY]=J.MIN,YJ[GY]=J.MAX;let XJ={[EY]:J.ZERO,[FY]:J.ONE,[NY]:J.SRC_COLOR,[qY]:J.SRC_ALPHA,[BY]:J.SRC_ALPHA_SATURATE,[MY]:J.DST_COLOR,[LY]:J.DST_ALPHA,[OY]:J.ONE_MINUS_SRC_COLOR,[RY]:J.ONE_MINUS_SRC_ALPHA,[kY]:J.ONE_MINUS_DST_COLOR,[DY]:J.ONE_MINUS_DST_ALPHA,[VY]:J.CONSTANT_COLOR,[CY]:J.ONE_MINUS_CONSTANT_COLOR,[IY]:J.CONSTANT_ALPHA,[zY]:J.ONE_MINUS_CONSTANT_ALPHA};function u0(x,X0,i,Z0,V0,e,z0,b0,IJ,ZJ){if(x===w9){if(q===!0)w0(J.BLEND),q=!1;return}if(q===!1)G0(J.BLEND),q=!0;if(x!==XY){if(x!==N||ZJ!==A){if(L!==W6||_!==W6)J.blendEquation(J.FUNC_ADD),L=W6,_=W6;if(ZJ)switch(x){case V8:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case f6:J.blendFunc(J.ONE,J.ONE);break;case N$:J.blendFuncSeparate(J.ZERO,J.ONE_MINUS_SRC_COLOR,J.ZERO,J.ONE);break;case O$:J.blendFuncSeparate(J.DST_COLOR,J.ONE_MINUS_SRC_ALPHA,J.ZERO,J.ONE);break;default:A0("WebGLState: Invalid blending: ",x);break}else switch(x){case V8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case f6:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case N$:A0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case O$:A0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:A0("WebGLState: Invalid blending: ",x);break}M=null,k=null,P=null,V=null,D.set(0,0,0),B=0,N=x,A=ZJ}return}if(V0=V0||X0,e=e||i,z0=z0||Z0,X0!==L||V0!==_)J.blendEquationSeparate(YJ[X0],YJ[V0]),L=X0,_=V0;if(i!==M||Z0!==k||e!==P||z0!==V)J.blendFuncSeparate(XJ[i],XJ[Z0],XJ[e],XJ[z0]),M=i,k=Z0,P=e,V=z0;if(b0.equals(D)===!1||IJ!==B)J.blendColor(b0.r,b0.g,b0.b,IJ),D.copy(b0),B=IJ;N=x,A=!1}function jJ(x,X0){x.side===cJ?w0(J.CULL_FACE):G0(J.CULL_FACE);let i=x.side===bJ;if(X0)i=!i;vJ(i),x.blending===V8&&x.transparent===!1?u0(w9):u0(x.blending,x.blendEquation,x.blendSrc,x.blendDst,x.blendEquationAlpha,x.blendSrcAlpha,x.blendDstAlpha,x.blendColor,x.blendAlpha,x.premultipliedAlpha),X.setFunc(x.depthFunc),X.setTest(x.depthTest),X.setMask(x.depthWrite),Y.setMask(x.colorWrite);let Z0=x.stencilWrite;if(K.setTest(Z0),Z0)K.setMask(x.stencilWriteMask),K.setFunc(x.stencilFunc,x.stencilRef,x.stencilFuncMask),K.setOp(x.stencilFail,x.stencilZFail,x.stencilZPass);pJ(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),x.alphaToCoverage===!0?G0(J.SAMPLE_ALPHA_TO_COVERAGE):w0(J.SAMPLE_ALPHA_TO_COVERAGE)}function vJ(x){if(z!==x){if(x)J.frontFace(J.CW);else J.frontFace(J.CCW);z=x}}function CJ(x){if(x!==ZY){if(G0(J.CULL_FACE),x!==S)if(x===F$)J.cullFace(J.BACK);else if(x===WY)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else w0(J.CULL_FACE);S=x}function b(x){if(x!==y){if(p)J.lineWidth(x);y=x}}function pJ(x,X0,i){if(x){if(G0(J.POLYGON_OFFSET_FILL),v!==X0||h!==i){if(v=X0,h=i,X.getReversed())X0=-X0;J.polygonOffset(X0,i)}}else w0(J.POLYGON_OFFSET_FILL)}function a0(x){if(x)G0(J.SCISSOR_TEST);else w0(J.SCISSOR_TEST)}function t0(x){if(x===void 0)x=J.TEXTURE0+g-1;if(Q0!==x)J.activeTexture(x),Q0=x}function O0(x,X0,i){if(i===void 0)if(Q0===null)i=J.TEXTURE0+g-1;else i=Q0;let Z0=H0[i];if(Z0===void 0)Z0={type:void 0,texture:void 0},H0[i]=Z0;if(Z0.type!==x||Z0.texture!==X0){if(Q0!==i)J.activeTexture(i),Q0=i;J.bindTexture(x,X0||D0[x]),Z0.type=x,Z0.texture=X0}}function qJ(){let x=H0[Q0];if(x!==void 0&&x.type!==void 0)J.bindTexture(x.type,null),x.type=void 0,x.texture=void 0}function T0(){try{J.compressedTexImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function T(){try{J.compressedTexImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function I(){try{J.texSubImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function d(){try{J.texSubImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function r(){try{J.compressedTexSubImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function t(){try{J.compressedTexSubImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function $0(){try{J.texStorage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function E0(){try{J.texStorage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function n(){try{J.texImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function o(){try{J.texImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function K0(x){if(F[x]!==void 0)return F[x];else return J.getParameter(x)}function B0(x,X0){if(F[x]!==X0)J.pixelStorei(x,X0),F[x]=X0}function W0(x){if(v0.equals(x)===!1)J.scissor(x.x,x.y,x.z,x.w),v0.copy(x)}function F0(x){if(s.equals(x)===!1)J.viewport(x.x,x.y,x.z,x.w),s.copy(x)}function y0(x,X0){let i=U.get(X0);if(i===void 0)i=new WeakMap,U.set(X0,i);let Z0=i.get(x);if(Z0===void 0)Z0=J.getUniformBlockIndex(X0,x.name),i.set(x,Z0)}function g0(x,X0){let Z0=U.get(X0).get(x);if(H.get(X0)!==Z0)J.uniformBlockBinding(X0,Z0,x.__bindingPointIndex),H.set(X0,Z0)}function c0(){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,H0={},E={},O=new WeakMap,R=[],C=null,q=!1,N=null,L=null,M=null,k=null,_=null,P=null,V=null,D=new R0(0,0,0),B=0,A=!1,z=null,S=null,y=null,v=null,h=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:G0,disable:w0,bindFramebuffer:i0,drawBuffers:j0,useProgram:d0,setBlending:u0,setMaterial:jJ,setFlipSided:vJ,setCullFace:CJ,setLineWidth:b,setPolygonOffset:pJ,setScissorTest:a0,activeTexture:t0,bindTexture:O0,unbindTexture:qJ,compressedTexImage2D:T0,compressedTexImage3D:T,texImage2D:n,texImage3D:o,pixelStorei:B0,getParameter:K0,updateUBOMapping:y0,uniformBlockBinding:g0,texStorage2D:$0,texStorage3D:E0,texSubImage2D:I,texSubImage3D:d,compressedTexSubImage2D:r,compressedTexSubImage3D:t,scissor:W0,viewport:F0,reset:c0}}function n1(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 p0,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):J6("canvas")}function q(T,I,d){let r=1,t=T0(T);if(t.width>d||t.height>d)r=d/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),E0=Math.floor(r*t.height);if(E===void 0)E=C($0,E0);let n=I?C($0,E0):E;return n.width=$0,n.height=E0,n.getContext("2d").drawImage(T,0,0,$0,E0),C0("WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+$0+"x"+E0+")."),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 M(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 k(T,I,d,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 E0;if(r){if(E0=Q.get("EXT_texture_norm16"),!E0)C0("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let n=I;if(I===J.RED){if(d===J.FLOAT)n=J.R32F;if(d===J.HALF_FLOAT)n=J.R16F;if(d===J.UNSIGNED_BYTE)n=J.R8;if(d===J.UNSIGNED_SHORT&&E0)n=E0.R16_EXT;if(d===J.SHORT&&E0)n=E0.R16_SNORM_EXT}if(I===J.RED_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.R8UI;if(d===J.UNSIGNED_SHORT)n=J.R16UI;if(d===J.UNSIGNED_INT)n=J.R32UI;if(d===J.BYTE)n=J.R8I;if(d===J.SHORT)n=J.R16I;if(d===J.INT)n=J.R32I}if(I===J.RG){if(d===J.FLOAT)n=J.RG32F;if(d===J.HALF_FLOAT)n=J.RG16F;if(d===J.UNSIGNED_BYTE)n=J.RG8;if(d===J.UNSIGNED_SHORT&&E0)n=E0.RG16_EXT;if(d===J.SHORT&&E0)n=E0.RG16_SNORM_EXT}if(I===J.RG_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.RG8UI;if(d===J.UNSIGNED_SHORT)n=J.RG16UI;if(d===J.UNSIGNED_INT)n=J.RG32UI;if(d===J.BYTE)n=J.RG8I;if(d===J.SHORT)n=J.RG16I;if(d===J.INT)n=J.RG32I}if(I===J.RGB_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.RGB8UI;if(d===J.UNSIGNED_SHORT)n=J.RGB16UI;if(d===J.UNSIGNED_INT)n=J.RGB32UI;if(d===J.BYTE)n=J.RGB8I;if(d===J.SHORT)n=J.RGB16I;if(d===J.INT)n=J.RGB32I}if(I===J.RGBA_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.RGBA8UI;if(d===J.UNSIGNED_SHORT)n=J.RGBA16UI;if(d===J.UNSIGNED_INT)n=J.RGBA32UI;if(d===J.BYTE)n=J.RGBA8I;if(d===J.SHORT)n=J.RGBA16I;if(d===J.INT)n=J.RGBA32I}if(I===J.RGB){if(d===J.UNSIGNED_SHORT&&E0)n=E0.RGB16_EXT;if(d===J.SHORT&&E0)n=E0.RGB16_SNORM_EXT;if(d===J.UNSIGNED_INT_5_9_9_9_REV)n=J.RGB9_E5;if(d===J.UNSIGNED_INT_10F_11F_11F_REV)n=J.R11F_G11F_B10F}if(I===J.RGBA){let o=$0?KZ:s0.getTransfer(t);if(d===J.FLOAT)n=J.RGBA32F;if(d===J.HALF_FLOAT)n=J.RGBA16F;if(d===J.UNSIGNED_BYTE)n=o===UJ?J.SRGB8_ALPHA8:J.RGBA8;if(d===J.UNSIGNED_SHORT&&E0)n=E0.RGBA16_EXT;if(d===J.SHORT&&E0)n=E0.RGBA16_SNORM_EXT;if(d===J.UNSIGNED_SHORT_4_4_4_4)n=J.RGBA4;if(d===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 _(T,I){let d;if(T){if(I===null||I===K8||I===H6)d=J.DEPTH24_STENCIL8;else if(I===tJ)d=J.DEPTH32F_STENCIL8;else if(I===d6)d=J.DEPTH24_STENCIL8,C0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(I===null||I===K8||I===H6)d=J.DEPTH_COMPONENT24;else if(I===tJ)d=J.DEPTH_COMPONENT32F;else if(I===d6)d=J.DEPTH_COMPONENT16;return d}function P(T,I){if(N(T)===!0||T.isFramebufferTexture&&T.minFilter!==L9&&T.minFilter!==BJ)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 V(T){let I=T.target;if(I.removeEventListener("dispose",V),B(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 B(T){let I=Z.get(T);if(I.__webglInit===void 0)return;let d=T.source,r=O.get(d);if(r){let t=r[I.__cacheKey];if(t.usedTimes--,t.usedTimes===0)A(T);if(Object.keys(r).length===0)O.delete(d)}Z.remove(T)}function A(T){let I=Z.get(T);J.deleteTexture(I.__webglTexture);let d=T.source,r=O.get(d);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 d=T.textures;for(let r=0,t=d.length;r<t;r++){let $0=Z.get(d[r]);if($0.__webglTexture)J.deleteTexture($0.__webglTexture),X.memory.textures--;Z.remove(d[r])}Z.remove(T)}let S=0;function y(){S=0}function v(){return S}function h(T){S=T}function g(){let T=S;if(T>=W.maxTextures)C0("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+W.maxTextures);return S+=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 d=Z.get(T);if(T.isVideoTexture)O0(T);if(T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&d.__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{w0(d,T,I);return}}else if(T.isExternalTexture)d.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,d.__webglTexture,J.TEXTURE0+I)}function a(T,I){let d=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&d.__version!==T.version){w0(d,T,I);return}else if(T.isExternalTexture)d.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,d.__webglTexture,J.TEXTURE0+I)}function Q0(T,I){let d=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&d.__version!==T.version){w0(d,T,I);return}$.bindTexture(J.TEXTURE_3D,d.__webglTexture,J.TEXTURE0+I)}function H0(T,I){let d=Z.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&d.__version!==T.version){i0(d,T,I);return}$.bindTexture(J.TEXTURE_CUBE_MAP,d.__webglTexture,J.TEXTURE0+I)}let J0={[X8]:J.REPEAT,[X6]:J.CLAMP_TO_EDGE,[l7]:J.MIRRORED_REPEAT},x0={[L9]:J.NEAREST,[c7]:J.NEAREST_MIPMAP_NEAREST,[I8]:J.NEAREST_MIPMAP_LINEAR,[BJ]:J.LINEAR,[K6]:J.LINEAR_MIPMAP_NEAREST,[P9]:J.LINEAR_MIPMAP_LINEAR},v0={[lY]:J.NEVER,[oY]:J.ALWAYS,[cY]:J.LESS,[e7]:J.LEQUAL,[nY]:J.EQUAL,[JQ]:J.GEQUAL,[sY]:J.GREATER,[iY]:J.NOTEQUAL};function s(T,I){if(I.type===tJ&&Q.has("OES_texture_float_linear")===!1&&(I.magFilter===BJ||I.magFilter===K6||I.magFilter===I8||I.magFilter===P9||I.minFilter===BJ||I.minFilter===K6||I.minFilter===I8||I.minFilter===P9))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===L9)return;if(I.minFilter!==I8&&I.minFilter!==P9)return;if(I.type===tJ&&Q.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||Z.get(I).__currentAnisotropy){let d=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(T,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,W.getMaxAnisotropy())),Z.get(I).__currentAnisotropy=I.anisotropy}}}function Y0(T,I){let d=!1;if(T.__webglInit===void 0)T.__webglInit=!0,I.addEventListener("dispose",V);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++,d=!0;t[$0].usedTimes++;let E0=t[T.__cacheKey];if(E0!==void 0){if(t[T.__cacheKey].usedTimes--,E0.usedTimes===0)A(I)}T.__cacheKey=$0,T.__webglTexture=t[$0].texture}return d}function D0(T,I,d){return Math.floor(Math.floor(T/d)/I)}function G0(T,I,d,r){let $0=T.updateRanges;if($0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,I.width,I.height,d,r,I.data);else{$0.sort((B0,W0)=>B0.start-W0.start);let E0=0;for(let B0=1;B0<$0.length;B0++){let W0=$0[E0],F0=$0[B0],y0=W0.start+W0.count,g0=D0(F0.start,I.width,4),c0=D0(W0.start,I.width,4);if(F0.start<=y0+1&&g0===c0&&D0(F0.start+F0.count-1,I.width,4)===g0)W0.count=Math.max(W0.count,F0.start+F0.count-W0.start);else++E0,$0[E0]=F0}$0.length=E0+1;let n=$.getParameter(J.UNPACK_ROW_LENGTH),o=$.getParameter(J.UNPACK_SKIP_PIXELS),K0=$.getParameter(J.UNPACK_SKIP_ROWS);$.pixelStorei(J.UNPACK_ROW_LENGTH,I.width);for(let B0=0,W0=$0.length;B0<W0;B0++){let F0=$0[B0],y0=Math.floor(F0.start/4),g0=Math.ceil(F0.count/4),c0=y0%I.width,x=Math.floor(y0/I.width),X0=g0,i=1;$.pixelStorei(J.UNPACK_SKIP_PIXELS,c0),$.pixelStorei(J.UNPACK_SKIP_ROWS,x),$.texSubImage2D(J.TEXTURE_2D,0,c0,x,X0,1,d,r,I.data)}T.clearUpdateRanges(),$.pixelStorei(J.UNPACK_ROW_LENGTH,n),$.pixelStorei(J.UNPACK_SKIP_PIXELS,o),$.pixelStorei(J.UNPACK_SKIP_ROWS,K0)}}function w0(T,I,d){let r=J.TEXTURE_2D;if(I.isDataArrayTexture||I.isCompressedArrayTexture)r=J.TEXTURE_2D_ARRAY;if(I.isData3DTexture)r=J.TEXTURE_3D;let t=Y0(T,I),$0=I.source;$.bindTexture(r,T.__webglTexture,J.TEXTURE0+d);let E0=Z.get($0);if($0.version!==E0.__version||t===!0){if($.activeTexture(J.TEXTURE0+d),(typeof ImageBitmap<"u"&&I.image instanceof ImageBitmap)===!1){let i=s0.getPrimaries(s0.workingColorSpace),Z0=I.colorSpace===_8?null:s0.getPrimaries(I.colorSpace),V0=I.colorSpace===_8||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,V0)}$.pixelStorei(J.UNPACK_ALIGNMENT,I.unpackAlignment);let o=q(I.image,!1,W.maxTextureSize);o=qJ(I,o);let K0=Y.convert(I.format,I.colorSpace),B0=Y.convert(I.type),W0=k(I.internalFormat,K0,B0,I.normalized,I.colorSpace,I.isVideoTexture);s(r,I);let F0,y0=I.mipmaps,g0=I.isVideoTexture!==!0,c0=E0.__version===void 0||t===!0,x=$0.dataReady,X0=P(I,o);if(I.isDepthTexture){if(W0=_(I.format===w8,I.type),c0)if(g0)$.texStorage2D(J.TEXTURE_2D,1,W0,o.width,o.height);else $.texImage2D(J.TEXTURE_2D,0,W0,o.width,o.height,0,K0,B0,null)}else if(I.isDataTexture)if(y0.length>0){if(g0&&c0)$.texStorage2D(J.TEXTURE_2D,X0,W0,y0[0].width,y0[0].height);for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],g0){if(x)$.texSubImage2D(J.TEXTURE_2D,i,0,0,F0.width,F0.height,K0,B0,F0.data)}else $.texImage2D(J.TEXTURE_2D,i,W0,F0.width,F0.height,0,K0,B0,F0.data);I.generateMipmaps=!1}else if(g0){if(c0)$.texStorage2D(J.TEXTURE_2D,X0,W0,o.width,o.height);if(x)G0(I,o,K0,B0)}else $.texImage2D(J.TEXTURE_2D,0,W0,o.width,o.height,0,K0,B0,o.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){if(g0&&c0)$.texStorage3D(J.TEXTURE_2D_ARRAY,X0,W0,y0[0].width,y0[0].height,o.depth);for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],I.format!==_9)if(K0!==null)if(g0){if(x)if(I.layerUpdates.size>0){let V0=yZ(F0.width,F0.height,I.format,I.type);for(let e of I.layerUpdates){let z0=F0.data.subarray(e*V0/F0.data.BYTES_PER_ELEMENT,(e+1)*V0/F0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,e,F0.width,F0.height,1,K0,z0)}I.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,F0.width,F0.height,o.depth,K0,F0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,i,W0,F0.width,F0.height,o.depth,0,F0.data,0,0);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(g0){if(x)$.texSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,F0.width,F0.height,o.depth,K0,B0,F0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,i,W0,F0.width,F0.height,o.depth,0,K0,B0,F0.data)}else{if(g0&&c0)$.texStorage2D(J.TEXTURE_2D,X0,W0,y0[0].width,y0[0].height);for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],I.format!==_9)if(K0!==null)if(g0){if(x)$.compressedTexSubImage2D(J.TEXTURE_2D,i,0,0,F0.width,F0.height,K0,F0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,i,W0,F0.width,F0.height,0,F0.data);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(g0){if(x)$.texSubImage2D(J.TEXTURE_2D,i,0,0,F0.width,F0.height,K0,B0,F0.data)}else $.texImage2D(J.TEXTURE_2D,i,W0,F0.width,F0.height,0,K0,B0,F0.data)}else if(I.isDataArrayTexture)if(g0){if(c0)$.texStorage3D(J.TEXTURE_2D_ARRAY,X0,W0,o.width,o.height,o.depth);if(x)if(I.layerUpdates.size>0){let i=yZ(o.width,o.height,I.format,I.type);for(let Z0 of I.layerUpdates){let V0=o.data.subarray(Z0*i/o.data.BYTES_PER_ELEMENT,(Z0+1)*i/o.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,Z0,o.width,o.height,1,K0,B0,V0)}I.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,o.width,o.height,o.depth,K0,B0,o.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,W0,o.width,o.height,o.depth,0,K0,B0,o.data);else if(I.isData3DTexture)if(g0){if(c0)$.texStorage3D(J.TEXTURE_3D,X0,W0,o.width,o.height,o.depth);if(x)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,o.width,o.height,o.depth,K0,B0,o.data)}else $.texImage3D(J.TEXTURE_3D,0,W0,o.width,o.height,o.depth,0,K0,B0,o.data);else if(I.isFramebufferTexture){if(c0)if(g0)$.texStorage2D(J.TEXTURE_2D,X0,W0,o.width,o.height);else{let{width:i,height:Z0}=o;for(let V0=0;V0<X0;V0++)$.texImage2D(J.TEXTURE_2D,V0,W0,i,Z0,0,K0,B0,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(o.parentNode!==i){i.appendChild(o),F.add(I),i.onpaint=(b0)=>{let IJ=b0.changedElements;for(let ZJ of F)if(IJ.includes(ZJ.image))ZJ.needsUpdate=!0},i.requestPaint();return}let Z0=0,V0=J.RGBA,e=J.RGBA,z0=J.UNSIGNED_BYTE;J.texElementImage2D(J.TEXTURE_2D,Z0,V0,e,z0,o),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(y0.length>0){if(g0&&c0){let i=T0(y0[0]);$.texStorage2D(J.TEXTURE_2D,X0,W0,i.width,i.height)}for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],g0){if(x)$.texSubImage2D(J.TEXTURE_2D,i,0,0,K0,B0,F0)}else $.texImage2D(J.TEXTURE_2D,i,W0,K0,B0,F0);I.generateMipmaps=!1}else if(g0){if(c0){let i=T0(o);$.texStorage2D(J.TEXTURE_2D,X0,W0,i.width,i.height)}if(x)$.texSubImage2D(J.TEXTURE_2D,0,0,0,K0,B0,o)}else $.texImage2D(J.TEXTURE_2D,0,W0,K0,B0,o);if(N(I))L(r);if(E0.__version=$0.version,I.onUpdate)I.onUpdate(I)}T.__version=I.version}function i0(T,I,d){if(I.image.length!==6)return;let r=Y0(T,I),t=I.source;$.bindTexture(J.TEXTURE_CUBE_MAP,T.__webglTexture,J.TEXTURE0+d);let $0=Z.get(t);if(t.version!==$0.__version||r===!0){$.activeTexture(J.TEXTURE0+d);let E0=s0.getPrimaries(s0.workingColorSpace),n=I.colorSpace===_8?null:s0.getPrimaries(I.colorSpace),o=I.colorSpace===_8||E0===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,o);let K0=I.isCompressedTexture||I.image[0].isCompressedTexture,B0=I.image[0]&&I.image[0].isDataTexture,W0=[];for(let e=0;e<6;e++){if(!K0&&!B0)W0[e]=q(I.image[e],!0,W.maxCubemapSize);else W0[e]=B0?I.image[e].image:I.image[e];W0[e]=qJ(I,W0[e])}let F0=W0[0],y0=Y.convert(I.format,I.colorSpace),g0=Y.convert(I.type),c0=k(I.internalFormat,y0,g0,I.normalized,I.colorSpace),x=I.isVideoTexture!==!0,X0=$0.__version===void 0||r===!0,i=t.dataReady,Z0=P(I,F0);s(J.TEXTURE_CUBE_MAP,I);let V0;if(K0){if(x&&X0)$.texStorage2D(J.TEXTURE_CUBE_MAP,Z0,c0,F0.width,F0.height);for(let e=0;e<6;e++){V0=W0[e].mipmaps;for(let z0=0;z0<V0.length;z0++){let b0=V0[z0];if(I.format!==_9)if(y0!==null)if(x){if(i)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,0,0,b0.width,b0.height,y0,b0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,c0,b0.width,b0.height,0,b0.data);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,0,0,b0.width,b0.height,y0,g0,b0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,c0,b0.width,b0.height,0,y0,g0,b0.data)}}}else{if(V0=I.mipmaps,x&&X0){if(V0.length>0)Z0++;let e=T0(W0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,Z0,c0,e.width,e.height)}for(let e=0;e<6;e++)if(B0){if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,W0[e].width,W0[e].height,y0,g0,W0[e].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,c0,W0[e].width,W0[e].height,0,y0,g0,W0[e].data);for(let z0=0;z0<V0.length;z0++){let IJ=V0[z0].image[e].image;if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,0,0,IJ.width,IJ.height,y0,g0,IJ.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,c0,IJ.width,IJ.height,0,y0,g0,IJ.data)}}else{if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,y0,g0,W0[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,c0,y0,g0,W0[e]);for(let z0=0;z0<V0.length;z0++){let b0=V0[z0];if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,0,0,y0,g0,b0.image[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,c0,y0,g0,b0.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 j0(T,I,d,r,t,$0){let E0=Y.convert(d.format,d.colorSpace),n=Y.convert(d.type),o=k(d.internalFormat,E0,n,d.normalized,d.colorSpace),K0=Z.get(I),B0=Z.get(d);if(B0.__renderTarget=I,!K0.__hasExternalTextures){let W0=Math.max(1,I.width>>$0),F0=Math.max(1,I.height>>$0);if(t===J.TEXTURE_3D||t===J.TEXTURE_2D_ARRAY)$.texImage3D(t,$0,o,W0,F0,I.depth,0,E0,n,null);else $.texImage2D(t,$0,o,W0,F0,0,E0,n,null)}if($.bindFramebuffer(J.FRAMEBUFFER,T),t0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,r,t,B0.__webglTexture,0,a0(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,B0.__webglTexture,$0);$.bindFramebuffer(J.FRAMEBUFFER,null)}function d0(T,I,d){if(J.bindRenderbuffer(J.RENDERBUFFER,T),I.depthBuffer){let r=I.depthTexture,t=r&&r.isDepthTexture?r.type:null,$0=_(I.stencilBuffer,t),E0=I.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(t0(I))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,a0(I),$0,I.width,I.height);else if(d)J.renderbufferStorageMultisample(J.RENDERBUFFER,a0(I),$0,I.width,I.height);else J.renderbufferStorage(J.RENDERBUFFER,$0,I.width,I.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,E0,J.RENDERBUFFER,T)}else{let r=I.textures;for(let t=0;t<r.length;t++){let $0=r[t],E0=Y.convert($0.format,$0.colorSpace),n=Y.convert($0.type),o=k($0.internalFormat,E0,n,$0.normalized,$0.colorSpace);if(t0(I))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,a0(I),o,I.width,I.height);else if(d)J.renderbufferStorageMultisample(J.RENDERBUFFER,a0(I),o,I.width,I.height);else J.renderbufferStorage(J.RENDERBUFFER,o,I.width,I.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function YJ(T,I,d){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",V);if(t.__webglTexture===void 0){t.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,t.__webglTexture),s(J.TEXTURE_CUBE_MAP,I.depthTexture);let K0=Y.convert(I.depthTexture.format),B0=Y.convert(I.depthTexture.type),W0;if(I.depthTexture.format===z8)W0=J.DEPTH_COMPONENT24;else if(I.depthTexture.format===w8)W0=J.DEPTH24_STENCIL8;for(let F0=0;F0<6;F0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+F0,0,W0,I.width,I.height,0,K0,B0,null)}}else c(I.depthTexture,0);let $0=t.__webglTexture,E0=a0(I),n=r?J.TEXTURE_CUBE_MAP_POSITIVE_X+d:J.TEXTURE_2D,o=I.depthTexture.format===w8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(I.depthTexture.format===z8)if(t0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,n,$0,0,E0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,n,$0,0);else if(I.depthTexture.format===w8)if(t0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,n,$0,0,E0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,n,$0,0);else throw Error("Unknown depthTexture format")}function XJ(T){let I=Z.get(T),d=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(d)for(let r=0;r<6;r++)YJ(I.__webglFramebuffer[r],T,r);else{let r=T.texture.mipmaps;if(r&&r.length>0)YJ(I.__webglFramebuffer[0],T,0);else YJ(I.__webglFramebuffer,T,0)}else if(d){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 u0(T,I,d){let r=Z.get(T);if(I!==void 0)j0(r.__webglFramebuffer,T,T.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(d!==void 0)XJ(T)}function jJ(T){let I=T.texture,d=Z.get(T),r=Z.get(I);T.addEventListener("dispose",D);let t=T.textures,$0=T.isWebGLCubeRenderTarget===!0,E0=t.length>1;if(!E0){if(r.__webglTexture===void 0)r.__webglTexture=J.createTexture();r.__version=I.version,X.memory.textures++}if($0){d.__webglFramebuffer=[];for(let n=0;n<6;n++)if(I.mipmaps&&I.mipmaps.length>0){d.__webglFramebuffer[n]=[];for(let o=0;o<I.mipmaps.length;o++)d.__webglFramebuffer[n][o]=J.createFramebuffer()}else d.__webglFramebuffer[n]=J.createFramebuffer()}else{if(I.mipmaps&&I.mipmaps.length>0){d.__webglFramebuffer=[];for(let n=0;n<I.mipmaps.length;n++)d.__webglFramebuffer[n]=J.createFramebuffer()}else d.__webglFramebuffer=J.createFramebuffer();if(E0)for(let n=0,o=t.length;n<o;n++){let K0=Z.get(t[n]);if(K0.__webglTexture===void 0)K0.__webglTexture=J.createTexture(),X.memory.textures++}if(T.samples>0&&t0(T)===!1){d.__webglMultisampledFramebuffer=J.createFramebuffer(),d.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,d.__webglMultisampledFramebuffer);for(let n=0;n<t.length;n++){let o=t[n];d.__webglColorRenderbuffer[n]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,d.__webglColorRenderbuffer[n]);let K0=Y.convert(o.format,o.colorSpace),B0=Y.convert(o.type),W0=k(o.internalFormat,K0,B0,o.normalized,o.colorSpace,T.isXRRenderTarget===!0),F0=a0(T);J.renderbufferStorageMultisample(J.RENDERBUFFER,F0,W0,T.width,T.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+n,J.RENDERBUFFER,d.__webglColorRenderbuffer[n])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),T.depthBuffer)d.__webglDepthRenderbuffer=J.createRenderbuffer(),d0(d.__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 o=0;o<I.mipmaps.length;o++)j0(d.__webglFramebuffer[n][o],T,I,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,o);else j0(d.__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(E0){for(let n=0,o=t.length;n<o;n++){let K0=t[n],B0=Z.get(K0),W0=J.TEXTURE_2D;if(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)W0=T.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(W0,B0.__webglTexture),s(W0,K0),j0(d.__webglFramebuffer,T,K0,J.COLOR_ATTACHMENT0+n,W0,0),N(K0))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 o=0;o<I.mipmaps.length;o++)j0(d.__webglFramebuffer[o],T,I,J.COLOR_ATTACHMENT0,n,o);else j0(d.__webglFramebuffer,T,I,J.COLOR_ATTACHMENT0,n,0);if(N(I))L(n);$.unbindTexture()}if(T.depthBuffer)XJ(T)}function vJ(T){let I=T.textures;for(let d=0,r=I.length;d<r;d++){let t=I[d];if(N(t)){let $0=M(T),E0=Z.get(t).__webglTexture;$.bindTexture($0,E0),L($0),$.unbindTexture()}}}let CJ=[],b=[];function pJ(T){if(T.samples>0){if(t0(T)===!1){let{textures:I,width:d,height:r}=T,t=J.COLOR_BUFFER_BIT,$0=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,E0=Z.get(T),n=I.length>1;if(n)for(let K0=0;K0<I.length;K0++)$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,E0.__webglMultisampledFramebuffer);let o=T.texture.mipmaps;if(o&&o.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,E0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,E0.__webglFramebuffer);for(let K0=0;K0<I.length;K0++){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,E0.__webglColorRenderbuffer[K0]);let B0=Z.get(I[K0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,B0,0)}if(J.blitFramebuffer(0,0,d,r,0,0,d,r,t,J.NEAREST),H===!0){if(CJ.length=0,b.length=0,CJ.push(J.COLOR_ATTACHMENT0+K0),T.depthBuffer&&T.resolveDepthBuffer===!1)CJ.push($0),b.push($0),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,b);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,CJ)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),n)for(let K0=0;K0<I.length;K0++){$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.RENDERBUFFER,E0.__webglColorRenderbuffer[K0]);let B0=Z.get(I[K0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.TEXTURE_2D,B0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,E0.__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 a0(T){return Math.min(W.maxSamples,T.samples)}function t0(T){let I=Z.get(T);return T.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function O0(T){let I=X.render.frame;if(G.get(T)!==I)G.set(T,I),T.update()}function qJ(T,I){let{colorSpace:d,format:r,type:t}=T;if(T.isCompressedTexture===!0||T.isVideoTexture===!0)return I;if(d!==uJ&&d!==_8)if(s0.getTransfer(d)===UJ){if(r!==_9||t!==D9)C0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else A0("WebGLTextures: Unsupported texture color space:",d);return I}function T0(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=g,this.resetTextureUnits=y,this.getTextureUnits=v,this.setTextureUnits=h,this.setTexture2D=c,this.setTexture2DArray=a,this.setTexture3D=Q0,this.setTextureCube=H0,this.rebindTextures=u0,this.setupRenderTarget=jJ,this.updateRenderTargetMipmap=vJ,this.updateMultisampleRenderTarget=pJ,this.setupDepthRenderbuffer=XJ,this.setupFrameBufferTexture=j0,this.useMultisampledRTT=t0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function s1(J,Q){function $(Z,W=_8){let Y,X=s0.getTransfer(W);if(Z===D9)return J.UNSIGNED_BYTE;if(Z===C$)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===I$)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===fY)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===gY)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===xY)return J.BYTE;if(Z===bY)return J.SHORT;if(Z===d6)return J.UNSIGNED_SHORT;if(Z===V$)return J.INT;if(Z===K8)return J.UNSIGNED_INT;if(Z===tJ)return J.FLOAT;if(Z===fJ)return J.HALF_FLOAT;if(Z===pY)return J.ALPHA;if(Z===dY)return J.RGB;if(Z===_9)return J.RGBA;if(Z===z8)return J.DEPTH_COMPONENT;if(Z===w8)return J.DEPTH_STENCIL;if(Z===uY)return J.RED;if(Z===z$)return J.RED_INTEGER;if(Z===P8)return J.RG;if(Z===w$)return J.RG_INTEGER;if(Z===P$)return J.RGBA_INTEGER;if(Z===n7||Z===s7||Z===i7||Z===o7)if(X===UJ)if(Y=Q.get("WEBGL_compressed_texture_s3tc_srgb"),Y!==null){if(Z===n7)return Y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===s7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===i7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===o7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(Y=Q.get("WEBGL_compressed_texture_s3tc"),Y!==null){if(Z===n7)return Y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===s7)return Y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===i7)return Y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===o7)return Y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===_$||Z===T$||Z===A$||Z===S$)if(Y=Q.get("WEBGL_compressed_texture_pvrtc"),Y!==null){if(Z===_$)return Y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===T$)return Y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===A$)return Y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===S$)return Y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===j$||Z===v$||Z===y$||Z===h$||Z===x$||Z===a7||Z===b$)if(Y=Q.get("WEBGL_compressed_texture_etc"),Y!==null){if(Z===j$||Z===v$)return X===UJ?Y.COMPRESSED_SRGB8_ETC2:Y.COMPRESSED_RGB8_ETC2;if(Z===y$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:Y.COMPRESSED_RGBA8_ETC2_EAC;if(Z===h$)return Y.COMPRESSED_R11_EAC;if(Z===x$)return Y.COMPRESSED_SIGNED_R11_EAC;if(Z===a7)return Y.COMPRESSED_RG11_EAC;if(Z===b$)return Y.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===f$||Z===g$||Z===p$||Z===d$||Z===u$||Z===m$||Z===l$||Z===c$||Z===n$||Z===s$||Z===i$||Z===o$||Z===a$||Z===r$)if(Y=Q.get("WEBGL_compressed_texture_astc"),Y!==null){if(Z===f$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:Y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===g$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:Y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===p$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:Y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===d$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:Y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===u$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:Y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===m$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:Y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===l$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:Y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===c$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:Y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===n$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:Y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===s$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:Y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===i$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:Y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===o$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:Y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===a$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:Y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===r$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:Y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===t$||Z===e$||Z===JZ)if(Y=Q.get("EXT_texture_compression_bptc"),Y!==null){if(Z===t$)return X===UJ?Y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:Y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===e$)return Y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===JZ)return Y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===QZ||Z===$Z||Z===r7||Z===ZZ)if(Y=Q.get("EXT_texture_compression_rgtc"),Y!==null){if(Z===QZ)return Y.COMPRESSED_RED_RGTC1_EXT;if(Z===$Z)return Y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===r7)return Y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===ZZ)return Y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===H6)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}var i1=`
4081
4081
  void main() {
4082
4082
 
4083
4083
  gl_Position = vec4( position, 1.0 );
4084
4084
 
4085
- }`,mq=`
4085
+ }`,o1=`
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 hX{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new HQ(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 SJ({vertexShader:uq,fragmentShader:mq,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new FJ(new L9(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class bX extends w9{constructor(J,Q){super();let $=this,Z=null,W=1,Y=null,X="local-floor",K=1,H=null,U=null,G=null,q=null,E=null,O=null,R=typeof XRWebGLBinding<"u",k=new hX,F={},N=Q.getContextAttributes(),D=null,B=null,C=[],T=[],P=new h0,_=null,L=new MJ;L.viewport=new JJ;let z=new MJ;z.viewport=new JJ;let S=[L,z],I=new _Z,j=null,b=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(i){let F0=C[i];if(F0===void 0)F0=new u6,C[i]=F0;return F0.getTargetRaySpace()},this.getControllerGrip=function(i){let F0=C[i];if(F0===void 0)F0=new u6,C[i]=F0;return F0.getGripSpace()},this.getHand=function(i){let F0=C[i];if(F0===void 0)F0=new u6,C[i]=F0;return F0.getHandSpace()};function v(i){let F0=T.indexOf(i.inputSource);if(F0===-1)return;let z0=C[F0];if(z0!==void 0)z0.update(i.inputSource,i.frame,H||Y),z0.dispatchEvent({type:i.type,data:i.inputSource})}function x(){Z.removeEventListener("select",v),Z.removeEventListener("selectstart",v),Z.removeEventListener("selectend",v),Z.removeEventListener("squeeze",v),Z.removeEventListener("squeezestart",v),Z.removeEventListener("squeezeend",v),Z.removeEventListener("end",x),Z.removeEventListener("inputsourceschange",p);for(let i=0;i<C.length;i++){let F0=T[i];if(F0===null)continue;T[i]=null,C[i].disconnect(F0)}j=null,b=null,k.reset();for(let i in F)delete F[i];J.setRenderTarget(D),E=null,q=null,G=null,Z=null,B=null,n0.stop(),$.isPresenting=!1,J.setPixelRatio(_),J.setSize(P.width,P.height,!1),$.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(i){if(W=i,$.isPresenting===!0)B0("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(i){if(X=i,$.isPresenting===!0)B0("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return H||Y},this.setReferenceSpace=function(i){H=i},this.getBaseLayer=function(){return q!==null?q: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(i){if(Z=i,Z!==null){if(D=J.getRenderTarget(),Z.addEventListener("select",v),Z.addEventListener("selectstart",v),Z.addEventListener("selectend",v),Z.addEventListener("squeeze",v),Z.addEventListener("squeezestart",v),Z.addEventListener("squeezeend",v),Z.addEventListener("end",x),Z.addEventListener("inputsourceschange",p),N.xrCompatible!==!0)await Q.makeXRCompatible();if(_=J.getPixelRatio(),J.getSize(P),!(R&&("createProjectionLayer"in XRWebGLBinding.prototype))){let z0={antialias:N.antialias,alpha:!0,depth:N.depth,stencil:N.stencil,framebufferScaleFactor:W};E=new XRWebGLLayer(Z,Q,z0),Z.updateRenderState({baseLayer:E}),J.setPixelRatio(1),J.setSize(E.framebufferWidth,E.framebufferHeight,!1),B=new cJ(E.framebufferWidth,E.framebufferHeight,{format:_9,type:R9,colorSpace:J.outputColorSpace,stencilBuffer:N.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}else{let z0=null,N0=null,P0=null;if(N.depth)P0=N.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,z0=N.stencil?_8:I8,N0=N.stencil?H6:K8;let e0={colorFormat:Q.RGBA8,depthFormat:P0,scaleFactor:W};G=this.getBinding(),q=G.createProjectionLayer(e0),Z.updateRenderState({layers:[q]}),J.setPixelRatio(1),J.setSize(q.textureWidth,q.textureHeight,!1),B=new cJ(q.textureWidth,q.textureHeight,{format:_9,type:R9,depthTexture:new U8(q.textureWidth,q.textureHeight,N0,void 0,void 0,void 0,void 0,void 0,void 0,z0),stencilBuffer:N.stencil,colorSpace:J.outputColorSpace,samples:N.antialias?4:0,resolveDepthBuffer:q.ignoreDepthValues===!1,resolveStencilBuffer:q.ignoreDepthValues===!1})}B.isXRRenderTarget=!0,this.setFoveation(K),H=null,Y=await Z.requestReferenceSpace(X),n0.setContext(Z),n0.start(),$.isPresenting=!0,$.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Z!==null)return Z.environmentBlendMode},this.getDepthTexture=function(){return k.getDepthTexture()};function p(i){for(let F0=0;F0<i.removed.length;F0++){let z0=i.removed[F0],N0=T.indexOf(z0);if(N0>=0)T[N0]=null,C[N0].disconnect(z0)}for(let F0=0;F0<i.added.length;F0++){let z0=i.added[F0],N0=T.indexOf(z0);if(N0===-1){for(let e0=0;e0<C.length;e0++)if(e0>=T.length){T.push(z0),N0=e0;break}else if(T[e0]===null){T[e0]=z0,N0=e0;break}if(N0===-1)break}let P0=C[N0];if(P0)P0.connect(z0)}}let d=new A,n=new A;function r(i,F0,z0){d.setFromMatrixPosition(F0.matrixWorld),n.setFromMatrixPosition(z0.matrixWorld);let N0=d.distanceTo(n),P0=F0.projectionMatrix.elements,e0=z0.projectionMatrix.elements,d0=P0[14]/(P0[10]-1),s0=P0[14]/(P0[10]+1),WJ=(P0[9]+1)/P0[5],YJ=(P0[9]-1)/P0[5],b0=(P0[8]-1)/P0[0],jJ=(e0[8]+1)/e0[0],vJ=d0*b0,zJ=d0*jJ,f=N0/(-b0+jJ),pJ=f*-b0;if(F0.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(pJ),i.translateZ(f),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),P0[10]===-1)i.projectionMatrix.copy(F0.projectionMatrix),i.projectionMatrixInverse.copy(F0.projectionMatrixInverse);else{let i0=d0+f,r0=s0+f,E0=vJ-pJ,NJ=zJ+(N0-pJ),T0=WJ*s0/r0*i0,w=YJ*s0/r0*i0;i.projectionMatrix.makePerspective(E0,NJ,T0,w,i0,r0),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function Y0(i,F0){if(F0===null)i.matrixWorld.copy(i.matrix);else i.matrixWorld.multiplyMatrices(F0.matrixWorld,i.matrix);i.matrixWorldInverse.copy(i.matrixWorld).invert()}this.updateCamera=function(i){if(Z===null)return;let{near:F0,far:z0}=i;if(k.texture!==null){if(k.depthNear>0)F0=k.depthNear;if(k.depthFar>0)z0=k.depthFar}if(I.near=z.near=L.near=F0,I.far=z.far=L.far=z0,j!==I.near||b!==I.far)Z.updateRenderState({depthNear:I.near,depthFar:I.far}),j=I.near,b=I.far;I.layers.mask=i.layers.mask|6,L.layers.mask=I.layers.mask&-5,z.layers.mask=I.layers.mask&-3;let N0=i.parent,P0=I.cameras;Y0(I,N0);for(let e0=0;e0<P0.length;e0++)Y0(P0[e0],N0);if(P0.length===2)r(I,L,z);else I.projectionMatrix.copy(L.projectionMatrix);R0(i,I,N0)};function R0(i,F0,z0){if(z0===null)i.matrix.copy(F0.matrixWorld);else i.matrix.copy(z0.matrixWorld),i.matrix.invert(),i.matrix.multiply(F0.matrixWorld);if(i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(F0.projectionMatrix),i.projectionMatrixInverse.copy(F0.projectionMatrixInverse),i.isPerspectiveCamera)i.fov=k8*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1}this.getCamera=function(){return I},this.getFoveation=function(){if(q===null&&E===null)return;return K},this.setFoveation=function(i){if(K=i,q!==null)q.fixedFoveation=i;if(E!==null&&E.fixedFoveation!==void 0)E.fixedFoveation=i},this.hasDepthSensing=function(){return k.texture!==null},this.getDepthSensingMesh=function(){return k.getMesh(I)},this.getCameraTexture=function(i){return F[i]};let G0=null;function a0(i,F0){if(U=F0.getViewerPose(H||Y),O=F0,U!==null){let z0=U.views;if(E!==null)J.setRenderTargetFramebuffer(B,E.framebuffer),J.setRenderTarget(B);let N0=!1;if(z0.length!==I.cameras.length)I.cameras.length=0,N0=!0;for(let s0=0;s0<z0.length;s0++){let WJ=z0[s0],YJ=null;if(E!==null)YJ=E.getViewport(WJ);else{let jJ=G.getViewSubImage(q,WJ);if(YJ=jJ.viewport,s0===0)J.setRenderTargetTextures(B,jJ.colorTexture,jJ.depthStencilTexture),J.setRenderTarget(B)}let b0=S[s0];if(b0===void 0)b0=new MJ,b0.layers.enable(s0),b0.viewport=new JJ,S[s0]=b0;if(b0.matrix.fromArray(WJ.transform.matrix),b0.matrix.decompose(b0.position,b0.quaternion,b0.scale),b0.projectionMatrix.fromArray(WJ.projectionMatrix),b0.projectionMatrixInverse.copy(b0.projectionMatrix).invert(),b0.viewport.set(YJ.x,YJ.y,YJ.width,YJ.height),s0===0)I.matrix.copy(b0.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale);if(N0===!0)I.cameras.push(b0)}let P0=Z.enabledFeatures;if(P0&&P0.includes("depth-sensing")&&Z.depthUsage=="gpu-optimized"&&R){G=$.getBinding();let s0=G.getDepthInformation(z0[0]);if(s0&&s0.isValid&&s0.texture)k.init(s0,Z.renderState)}if(P0&&P0.includes("camera-access")&&R){J.state.unbindTexture(),G=$.getBinding();for(let s0=0;s0<z0.length;s0++){let WJ=z0[s0].camera;if(WJ){let YJ=F[WJ];if(!YJ)YJ=new HQ,F[WJ]=YJ;let b0=G.getCameraImage(WJ);YJ.sourceTexture=b0}}}}for(let z0=0;z0<C.length;z0++){let N0=T[z0],P0=C[z0];if(N0!==null&&P0!==void 0)P0.update(N0,F0,H||Y)}if(G0)G0(i,F0);if(F0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:F0});O=null}let n0=new _X;n0.setAnimationLoop(a0),this.setAnimationLoop=function(i){G0=i},this.dispose=function(){}}}var lq=new S0,gX=new v0;gX.set(-1,0,0,0,1,0,0,0,1);function cq(J,Q){function $(F,N){if(F.matrixAutoUpdate===!0)F.updateMatrix();N.value.copy(F.matrix)}function Z(F,N){if(N.color.getRGB(F.fogColor.value,OZ(J)),N.isFog)F.fogNear.value=N.near,F.fogFar.value=N.far;else if(N.isFogExp2)F.fogDensity.value=N.density}function W(F,N,D,B,C){if(N.isNodeMaterial)N.uniformsNeedUpdate=!1;else if(N.isMeshBasicMaterial)Y(F,N);else if(N.isMeshLambertMaterial){if(Y(F,N),N.envMap)F.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshToonMaterial)Y(F,N),q(F,N);else if(N.isMeshPhongMaterial){if(Y(F,N),G(F,N),N.envMap)F.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshStandardMaterial){if(Y(F,N),E(F,N),N.isMeshPhysicalMaterial)O(F,N,C)}else if(N.isMeshMatcapMaterial)Y(F,N),R(F,N);else if(N.isMeshDepthMaterial)Y(F,N);else if(N.isMeshDistanceMaterial)Y(F,N),k(F,N);else if(N.isMeshNormalMaterial)Y(F,N);else if(N.isLineBasicMaterial){if(X(F,N),N.isLineDashedMaterial)K(F,N)}else if(N.isPointsMaterial)H(F,N,D,B);else if(N.isSpriteMaterial)U(F,N);else if(N.isShadowMaterial)F.color.value.copy(N.color),F.opacity.value=N.opacity;else if(N.isShaderMaterial)N.uniformsNeedUpdate=!1}function Y(F,N){if(F.opacity.value=N.opacity,N.color)F.diffuse.value.copy(N.color);if(N.emissive)F.emissive.value.copy(N.emissive).multiplyScalar(N.emissiveIntensity);if(N.map)F.map.value=N.map,$(N.map,F.mapTransform);if(N.alphaMap)F.alphaMap.value=N.alphaMap,$(N.alphaMap,F.alphaMapTransform);if(N.bumpMap){if(F.bumpMap.value=N.bumpMap,$(N.bumpMap,F.bumpMapTransform),F.bumpScale.value=N.bumpScale,N.side===hJ)F.bumpScale.value*=-1}if(N.normalMap){if(F.normalMap.value=N.normalMap,$(N.normalMap,F.normalMapTransform),F.normalScale.value.copy(N.normalScale),N.side===hJ)F.normalScale.value.negate()}if(N.displacementMap)F.displacementMap.value=N.displacementMap,$(N.displacementMap,F.displacementMapTransform),F.displacementScale.value=N.displacementScale,F.displacementBias.value=N.displacementBias;if(N.emissiveMap)F.emissiveMap.value=N.emissiveMap,$(N.emissiveMap,F.emissiveMapTransform);if(N.specularMap)F.specularMap.value=N.specularMap,$(N.specularMap,F.specularMapTransform);if(N.alphaTest>0)F.alphaTest.value=N.alphaTest;let D=Q.get(N),B=D.envMap,C=D.envMapRotation;if(B){if(F.envMap.value=B,F.envMapRotation.value.setFromMatrix4(lq.makeRotationFromEuler(C)).transpose(),B.isCubeTexture&&B.isRenderTargetTexture===!1)F.envMapRotation.value.premultiply(gX);F.reflectivity.value=N.reflectivity,F.ior.value=N.ior,F.refractionRatio.value=N.refractionRatio}if(N.lightMap)F.lightMap.value=N.lightMap,F.lightMapIntensity.value=N.lightMapIntensity,$(N.lightMap,F.lightMapTransform);if(N.aoMap)F.aoMap.value=N.aoMap,F.aoMapIntensity.value=N.aoMapIntensity,$(N.aoMap,F.aoMapTransform)}function X(F,N){if(F.diffuse.value.copy(N.color),F.opacity.value=N.opacity,N.map)F.map.value=N.map,$(N.map,F.mapTransform)}function K(F,N){F.dashSize.value=N.dashSize,F.totalSize.value=N.dashSize+N.gapSize,F.scale.value=N.scale}function H(F,N,D,B){if(F.diffuse.value.copy(N.color),F.opacity.value=N.opacity,F.size.value=N.size*D,F.scale.value=B*0.5,N.map)F.map.value=N.map,$(N.map,F.uvTransform);if(N.alphaMap)F.alphaMap.value=N.alphaMap,$(N.alphaMap,F.alphaMapTransform);if(N.alphaTest>0)F.alphaTest.value=N.alphaTest}function U(F,N){if(F.diffuse.value.copy(N.color),F.opacity.value=N.opacity,F.rotation.value=N.rotation,N.map)F.map.value=N.map,$(N.map,F.mapTransform);if(N.alphaMap)F.alphaMap.value=N.alphaMap,$(N.alphaMap,F.alphaMapTransform);if(N.alphaTest>0)F.alphaTest.value=N.alphaTest}function G(F,N){F.specular.value.copy(N.specular),F.shininess.value=Math.max(N.shininess,0.0001)}function q(F,N){if(N.gradientMap)F.gradientMap.value=N.gradientMap}function E(F,N){if(F.metalness.value=N.metalness,N.metalnessMap)F.metalnessMap.value=N.metalnessMap,$(N.metalnessMap,F.metalnessMapTransform);if(F.roughness.value=N.roughness,N.roughnessMap)F.roughnessMap.value=N.roughnessMap,$(N.roughnessMap,F.roughnessMapTransform);if(N.envMap)F.envMapIntensity.value=N.envMapIntensity}function O(F,N,D){if(F.ior.value=N.ior,N.sheen>0){if(F.sheenColor.value.copy(N.sheenColor).multiplyScalar(N.sheen),F.sheenRoughness.value=N.sheenRoughness,N.sheenColorMap)F.sheenColorMap.value=N.sheenColorMap,$(N.sheenColorMap,F.sheenColorMapTransform);if(N.sheenRoughnessMap)F.sheenRoughnessMap.value=N.sheenRoughnessMap,$(N.sheenRoughnessMap,F.sheenRoughnessMapTransform)}if(N.clearcoat>0){if(F.clearcoat.value=N.clearcoat,F.clearcoatRoughness.value=N.clearcoatRoughness,N.clearcoatMap)F.clearcoatMap.value=N.clearcoatMap,$(N.clearcoatMap,F.clearcoatMapTransform);if(N.clearcoatRoughnessMap)F.clearcoatRoughnessMap.value=N.clearcoatRoughnessMap,$(N.clearcoatRoughnessMap,F.clearcoatRoughnessMapTransform);if(N.clearcoatNormalMap){if(F.clearcoatNormalMap.value=N.clearcoatNormalMap,$(N.clearcoatNormalMap,F.clearcoatNormalMapTransform),F.clearcoatNormalScale.value.copy(N.clearcoatNormalScale),N.side===hJ)F.clearcoatNormalScale.value.negate()}}if(N.dispersion>0)F.dispersion.value=N.dispersion;if(N.iridescence>0){if(F.iridescence.value=N.iridescence,F.iridescenceIOR.value=N.iridescenceIOR,F.iridescenceThicknessMinimum.value=N.iridescenceThicknessRange[0],F.iridescenceThicknessMaximum.value=N.iridescenceThicknessRange[1],N.iridescenceMap)F.iridescenceMap.value=N.iridescenceMap,$(N.iridescenceMap,F.iridescenceMapTransform);if(N.iridescenceThicknessMap)F.iridescenceThicknessMap.value=N.iridescenceThicknessMap,$(N.iridescenceThicknessMap,F.iridescenceThicknessMapTransform)}if(N.transmission>0){if(F.transmission.value=N.transmission,F.transmissionSamplerMap.value=D.texture,F.transmissionSamplerSize.value.set(D.width,D.height),N.transmissionMap)F.transmissionMap.value=N.transmissionMap,$(N.transmissionMap,F.transmissionMapTransform);if(F.thickness.value=N.thickness,N.thicknessMap)F.thicknessMap.value=N.thicknessMap,$(N.thicknessMap,F.thicknessMapTransform);F.attenuationDistance.value=N.attenuationDistance,F.attenuationColor.value.copy(N.attenuationColor)}if(N.anisotropy>0){if(F.anisotropyVector.value.set(N.anisotropy*Math.cos(N.anisotropyRotation),N.anisotropy*Math.sin(N.anisotropyRotation)),N.anisotropyMap)F.anisotropyMap.value=N.anisotropyMap,$(N.anisotropyMap,F.anisotropyMapTransform)}if(F.specularIntensity.value=N.specularIntensity,F.specularColor.value.copy(N.specularColor),N.specularColorMap)F.specularColorMap.value=N.specularColorMap,$(N.specularColorMap,F.specularColorMapTransform);if(N.specularIntensityMap)F.specularIntensityMap.value=N.specularIntensityMap,$(N.specularIntensityMap,F.specularIntensityMapTransform)}function R(F,N){if(N.matcap)F.matcap.value=N.matcap}function k(F,N){let D=Q.get(N).light;F.referencePosition.value.setFromMatrixPosition(D.matrixWorld),F.nearDistance.value=D.shadow.camera.near,F.farDistance.value=D.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function nq(J,Q,$,Z){let W={},Y={},X=[],K=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function H(D,B){let C=B.program;Z.uniformBlockBinding(D,C)}function U(D,B){let C=W[D.id];if(C===void 0)R(D),C=G(D),W[D.id]=C,D.addEventListener("dispose",F);let T=B.program;Z.updateUBOMapping(D,T);let P=Q.render.frame;if(Y[D.id]!==P)E(D),Y[D.id]=P}function G(D){let B=q();D.__bindingPointIndex=B;let C=J.createBuffer(),T=D.__size,P=D.usage;return J.bindBuffer(J.UNIFORM_BUFFER,C),J.bufferData(J.UNIFORM_BUFFER,T,P),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,B,C),C}function q(){for(let D=0;D<K;D++)if(X.indexOf(D)===-1)return X.push(D),D;return A0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(D){let B=W[D.id],C=D.uniforms,T=D.__cache;J.bindBuffer(J.UNIFORM_BUFFER,B);for(let P=0,_=C.length;P<_;P++){let L=Array.isArray(C[P])?C[P]:[C[P]];for(let z=0,S=L.length;z<S;z++){let I=L[z];if(O(I,P,z,T)===!0){let j=I.__offset,b=Array.isArray(I.value)?I.value:[I.value],v=0;for(let x=0;x<b.length;x++){let p=b[x],d=k(p);if(typeof p==="number"||typeof p==="boolean")I.__data[0]=p,J.bufferSubData(J.UNIFORM_BUFFER,j+v,I.__data);else if(p.isMatrix3)I.__data[0]=p.elements[0],I.__data[1]=p.elements[1],I.__data[2]=p.elements[2],I.__data[3]=0,I.__data[4]=p.elements[3],I.__data[5]=p.elements[4],I.__data[6]=p.elements[5],I.__data[7]=0,I.__data[8]=p.elements[6],I.__data[9]=p.elements[7],I.__data[10]=p.elements[8],I.__data[11]=0;else if(ArrayBuffer.isView(p))I.__data.set(new p.constructor(p.buffer,p.byteOffset,I.__data.length));else p.toArray(I.__data,v),v+=d.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,j,I.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function O(D,B,C,T){let P=D.value,_=B+"_"+C;if(T[_]===void 0){if(typeof P==="number"||typeof P==="boolean")T[_]=P;else if(ArrayBuffer.isView(P))T[_]=P.slice();else T[_]=P.clone();return!0}else{let L=T[_];if(typeof P==="number"||typeof P==="boolean"){if(L!==P)return T[_]=P,!0}else if(ArrayBuffer.isView(P))return!0;else if(L.equals(P)===!1)return L.copy(P),!0}return!1}function R(D){let B=D.uniforms,C=0,T=16;for(let _=0,L=B.length;_<L;_++){let z=Array.isArray(B[_])?B[_]:[B[_]];for(let S=0,I=z.length;S<I;S++){let j=z[S],b=Array.isArray(j.value)?j.value:[j.value];for(let v=0,x=b.length;v<x;v++){let p=b[v],d=k(p),n=C%T,r=n%d.boundary,Y0=n+r;if(C+=r,Y0!==0&&T-Y0<d.storage)C+=T-Y0;j.__data=new Float32Array(d.storage/Float32Array.BYTES_PER_ELEMENT),j.__offset=C,C+=d.storage}}}let P=C%T;if(P>0)C+=T-P;return D.__size=C,D.__cache={},this}function k(D){let B={boundary:0,storage:0};if(typeof D==="number"||typeof D==="boolean")B.boundary=4,B.storage=4;else if(D.isVector2)B.boundary=8,B.storage=8;else if(D.isVector3||D.isColor)B.boundary=16,B.storage=12;else if(D.isVector4)B.boundary=16,B.storage=16;else if(D.isMatrix3)B.boundary=48,B.storage=48;else if(D.isMatrix4)B.boundary=64,B.storage=64;else if(D.isTexture)B0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(D))B.boundary=16,B.storage=D.byteLength;else B0("WebGLRenderer: Unsupported uniform value type.",D);return B}function F(D){let B=D.target;B.removeEventListener("dispose",F);let C=X.indexOf(B.__bindingPointIndex);X.splice(C,1),J.deleteBuffer(W[B.id]),delete W[B.id],delete Y[B.id]}function N(){for(let D in W)J.deleteBuffer(W[D]);X=[],W={},Y={}}return{bind:H,update:U,dispose:N}}var sq=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]),j9=null;function iq(){if(j9===null)j9=new F6(sq,16,16,w8,bJ),j9.name="DFG_LUT",j9.minFilter=kJ,j9.magFilter=kJ,j9.wrapS=X6,j9.wrapT=X6,j9.generateMipmaps=!1,j9.needsUpdate=!0;return j9}class uZ{constructor(J={}){let{canvas:Q=nY(),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:q=!1,outputBufferType:E=R9}=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,k=new Set([I$,C$,z$]),F=new Set([R9,K8,g6,H6,B$,V$]),N=new Uint32Array(4),D=new Int32Array(4),B=new A,C=null,T=null,P=[],_=[],L=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=aJ,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,S=!1,I=null;this._outputColorSpace=H8;let j=0,b=0,v=null,x=-1,p=null,d=new JJ,n=new JJ,r=null,Y0=new k0(0),R0=0,G0=Q.width,a0=Q.height,n0=1,i=null,F0=null,z0=new JJ(0,0,G0,a0),N0=new JJ(0,0,G0,a0),P0=!1,e0=new A8,d0=!1,s0=!1,WJ=new S0,YJ=new A,b0=new JJ,jJ={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},vJ=!1;function zJ(){return v===null?n0:1}let f=$;function pJ(V,h){return Q.getContext(V,h)}try{let V={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${tW}`);if(Q.addEventListener("webglcontextlost",M0,!1),Q.addEventListener("webglcontextrestored",e,!1),Q.addEventListener("webglcontextcreationerror",I0,!1),f===null){if(f=pJ("webgl2",V),f===null)if(pJ("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(V){throw A0("WebGLRenderer: "+V.message),V}let i0,r0,E0,NJ,T0,w,M,g,a,t,J0,K0,c,o,W0,D0,$0,H0,j0,x0,u0,y,Z0;function s(){if(i0=new QE(f),i0.init(),u0=new dq(f,i0),r0=new s5(f,i0,J,u0),E0=new gq(f,i0),r0.reversedDepthBuffer&&q)E0.buffers.depth.setReversed(!0);NJ=new WE(f),T0=new Iq,w=new pq(f,i0,E0,T0,r0,u0,NJ),M=new JE(z),g=new HU(f),y=new c5(f,g),a=new $E(f,g,NJ,y),t=new XE(f,a,g,y,NJ),H0=new YE(f,r0,w),W0=new i5(T0),J0=new Cq(z,M,i0,r0,y,W0),K0=new cq(z,T0),c=new wq,o=new vq(i0),$0=new l5(z,M,E0,t,O,K),D0=new bq(z,t,r0),Z0=new nq(f,NJ,r0,E0),j0=new n5(f,i0,NJ),x0=new ZE(f,i0,NJ),NJ.programs=J0.programs,z.capabilities=r0,z.extensions=i0,z.properties=T0,z.renderLists=c,z.shadowMap=D0,z.state=E0,z.info=NJ}if(s(),R!==R9)L=new HE(R,Q.width,Q.height,Z,W);let Q0=new bX(z,f);this.xr=Q0,this.getContext=function(){return f},this.getContextAttributes=function(){return f.getContextAttributes()},this.forceContextLoss=function(){let V=i0.get("WEBGL_lose_context");if(V)V.loseContext()},this.forceContextRestore=function(){let V=i0.get("WEBGL_lose_context");if(V)V.restoreContext()},this.getPixelRatio=function(){return n0},this.setPixelRatio=function(V){if(V===void 0)return;n0=V,this.setSize(G0,a0,!1)},this.getSize=function(V){return V.set(G0,a0)},this.setSize=function(V,h,l=!0){if(Q0.isPresenting){B0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(G0=V,a0=h,Q.width=Math.floor(V*n0),Q.height=Math.floor(h*n0),l===!0)Q.style.width=V+"px",Q.style.height=h+"px";if(L!==null)L.setSize(Q.width,Q.height);this.setViewport(0,0,V,h)},this.getDrawingBufferSize=function(V){return V.set(G0*n0,a0*n0).floor()},this.setDrawingBufferSize=function(V,h,l){G0=V,a0=h,n0=l,Q.width=Math.floor(V*l),Q.height=Math.floor(h*l),this.setViewport(0,0,V,h)},this.setEffects=function(V){if(R===R9){A0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(V){for(let h=0;h<V.length;h++)if(V[h].isOutputPass===!0){B0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}L.setEffects(V||[])},this.getCurrentViewport=function(V){return V.copy(d)},this.getViewport=function(V){return V.copy(z0)},this.setViewport=function(V,h,l,u){if(V.isVector4)z0.set(V.x,V.y,V.z,V.w);else z0.set(V,h,l,u);E0.viewport(d.copy(z0).multiplyScalar(n0).round())},this.getScissor=function(V){return V.copy(N0)},this.setScissor=function(V,h,l,u){if(V.isVector4)N0.set(V.x,V.y,V.z,V.w);else N0.set(V,h,l,u);E0.scissor(n.copy(N0).multiplyScalar(n0).round())},this.getScissorTest=function(){return P0},this.setScissorTest=function(V){E0.setScissorTest(P0=V)},this.setOpaqueSort=function(V){i=V},this.setTransparentSort=function(V){F0=V},this.getClearColor=function(V){return V.copy($0.getClearColor())},this.setClearColor=function(){$0.setClearColor(...arguments)},this.getClearAlpha=function(){return $0.getClearAlpha()},this.setClearAlpha=function(){$0.setClearAlpha(...arguments)},this.clear=function(V=!0,h=!0,l=!0){let u=0;if(V){let m=!1;if(v!==null){let q0=v.texture.format;m=k.has(q0)}if(m){let q0=v.texture.type,L0=F.has(q0),U0=$0.getClearColor(),V0=$0.getClearAlpha(),_0=U0.r,f0=U0.g,m0=U0.b;if(L0)N[0]=_0,N[1]=f0,N[2]=m0,N[3]=V0,f.clearBufferuiv(f.COLOR,0,N);else D[0]=_0,D[1]=f0,D[2]=m0,D[3]=V0,f.clearBufferiv(f.COLOR,0,D)}else u|=f.COLOR_BUFFER_BIT}if(h)u|=f.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(l)u|=f.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(u!==0)f.clear(u)},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(V){V.setRenderer(this),I=V},this.dispose=function(){Q.removeEventListener("webglcontextlost",M0,!1),Q.removeEventListener("webglcontextrestored",e,!1),Q.removeEventListener("webglcontextcreationerror",I0,!1),$0.dispose(),c.dispose(),o.dispose(),T0.dispose(),M.dispose(),t.dispose(),y.dispose(),Z0.dispose(),J0.dispose(),Q0.dispose(),Q0.removeEventListener("sessionstart",XW),Q0.removeEventListener("sessionend",KW),O8.stop()};function M0(V){V.preventDefault(),y6("WebGLRenderer: Context Lost."),S=!0}function e(){y6("WebGLRenderer: Context Restored."),S=!1;let V=NJ.autoReset,h=D0.enabled,l=D0.autoUpdate,u=D0.needsUpdate,m=D0.type;s(),NJ.autoReset=V,D0.enabled=h,D0.autoUpdate=l,D0.needsUpdate=u,D0.type=m}function I0(V){A0("WebGLRenderer: A WebGL context could not be created. Reason: ",V.statusMessage)}function y0(V){let h=V.target;h.removeEventListener("dispose",y0),CJ(h)}function CJ(V){$J(V),T0.remove(V)}function $J(V){let h=T0.get(V).programs;if(h!==void 0){if(h.forEach(function(l){J0.releaseProgram(l)}),V.isShaderMaterial)J0.releaseShaderCache(V)}}this.renderBufferDirect=function(V,h,l,u,m,q0){if(h===null)h=jJ;let L0=m.isMesh&&m.matrixWorld.determinant()<0,U0=tK(V,h,l,u,m);E0.setMaterial(u,L0);let V0=l.index,_0=1;if(u.wireframe===!0){if(V0=a.getWireframeAttribute(l),V0===void 0)return;_0=2}let f0=l.drawRange,m0=l.attributes.position,w0=f0.start*_0,ZJ=(f0.start+f0.count)*_0;if(q0!==null)w0=Math.max(w0,q0.start*_0),ZJ=Math.min(ZJ,(q0.start+q0.count)*_0);if(V0!==null)w0=Math.max(w0,0),ZJ=Math.min(ZJ,V0.count);else if(m0!==void 0&&m0!==null)w0=Math.max(w0,0),ZJ=Math.min(ZJ,m0.count);let LJ=ZJ-w0;if(LJ<0||LJ===1/0)return;y.setup(m,u,U0,l,V0);let RJ,XJ=j0;if(V0!==null)RJ=g.get(V0),XJ=x0,XJ.setIndex(RJ);if(m.isMesh)if(u.wireframe===!0)E0.setLineWidth(u.wireframeLinewidth*zJ()),XJ.setMode(f.LINES);else XJ.setMode(f.TRIANGLES);else if(m.isLine){let yJ=u.linewidth;if(yJ===void 0)yJ=1;if(E0.setLineWidth(yJ*zJ()),m.isLineSegments)XJ.setMode(f.LINES);else if(m.isLineLoop)XJ.setMode(f.LINE_LOOP);else XJ.setMode(f.LINE_STRIP)}else if(m.isPoints)XJ.setMode(f.POINTS);else if(m.isSprite)XJ.setMode(f.TRIANGLES);if(m.isBatchedMesh)if(!i0.get("WEBGL_multi_draw")){let{_multiDrawStarts:yJ,_multiDrawCounts:O0,_multiDrawCount:sJ}=m,o0=V0?g.get(V0).bytesPerElement:1,Q9=T0.get(u).currentProgram.getUniforms();for(let k9=0;k9<sJ;k9++)Q9.setValue(f,"_gl_DrawID",k9),XJ.render(yJ[k9]/o0,O0[k9])}else XJ.renderMultiDraw(m._multiDrawStarts,m._multiDrawCounts,m._multiDrawCount);else if(m.isInstancedMesh)XJ.renderInstances(w0,LJ,m.count);else if(l.isInstancedBufferGeometry){let yJ=l._maxInstanceCount!==void 0?l._maxInstanceCount:1/0,O0=Math.min(l.instanceCount,yJ);XJ.renderInstances(w0,LJ,O0)}else XJ.render(w0,LJ)};function M9(V,h,l){if(V.transparent===!0&&V.side===lJ&&V.forceSinglePass===!1)V.side=hJ,V.needsUpdate=!0,G7(V,h,l),V.side=z9,V.needsUpdate=!0,G7(V,h,l),V.side=lJ;else G7(V,h,l)}this.compile=function(V,h,l=null){if(l===null)l=V;if(T=o.get(l),T.init(h),_.push(T),l.traverseVisible(function(m){if(m.isLight&&m.layers.test(h.layers)){if(T.pushLight(m),m.castShadow)T.pushShadow(m)}}),V!==l)V.traverseVisible(function(m){if(m.isLight&&m.layers.test(h.layers)){if(T.pushLight(m),m.castShadow)T.pushShadow(m)}});T.setupLights();let u=new Set;return V.traverse(function(m){if(!(m.isMesh||m.isPoints||m.isLine||m.isSprite))return;let q0=m.material;if(q0)if(Array.isArray(q0))for(let L0=0;L0<q0.length;L0++){let U0=q0[L0];M9(U0,l,m),u.add(U0)}else M9(q0,l,m),u.add(q0)}),T=_.pop(),u},this.compileAsync=function(V,h,l=null){let u=this.compile(V,h,l);return new Promise((m)=>{function q0(){if(u.forEach(function(L0){if(T0.get(L0).currentProgram.isReady())u.delete(L0)}),u.size===0){m(V);return}setTimeout(q0,10)}if(i0.get("KHR_parallel_shader_compile")!==null)q0();else setTimeout(q0,10)})};let H9=null;function aK(V){if(H9)H9(V)}function XW(){O8.stop()}function KW(){O8.start()}let O8=new _X;if(O8.setAnimationLoop(aK),typeof self<"u")O8.setContext(self);this.setAnimationLoop=function(V){H9=V,Q0.setAnimationLoop(V),V===null?O8.stop():O8.start()},Q0.addEventListener("sessionstart",XW),Q0.addEventListener("sessionend",KW),this.render=function(V,h){if(h!==void 0&&h.isCamera!==!0){A0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;if(I!==null)I.renderStart(V,h);let l=Q0.enabled===!0&&Q0.isPresenting===!0,u=L!==null&&(v===null||l)&&L.begin(z,v);if(V.matrixWorldAutoUpdate===!0)V.updateMatrixWorld();if(h.parent===null&&h.matrixWorldAutoUpdate===!0)h.updateMatrixWorld();if(Q0.enabled===!0&&Q0.isPresenting===!0&&(L===null||L.isCompositing()===!1)){if(Q0.cameraAutoUpdate===!0)Q0.updateCamera(h);h=Q0.getCamera()}if(V.isScene===!0)V.onBeforeRender(z,V,h,v);if(T=o.get(V,_.length),T.init(h),T.state.textureUnits=w.getTextureUnits(),_.push(T),WJ.multiplyMatrices(h.projectionMatrix,h.matrixWorldInverse),e0.setFromProjectionMatrix(WJ,KZ,h.reversedDepth),s0=this.localClippingEnabled,d0=W0.init(this.clippingPlanes,s0),C=c.get(V,P.length),C.init(),P.push(C),Q0.enabled===!0&&Q0.isPresenting===!0){let L0=z.xr.getDepthSensingMesh();if(L0!==null)vQ(L0,h,-1/0,z.sortObjects)}if(vQ(V,h,0,z.sortObjects),C.finish(),z.sortObjects===!0)C.sort(i,F0);if(vJ=Q0.enabled===!1||Q0.isPresenting===!1||Q0.hasDepthSensing()===!1,vJ)$0.addToRenderList(C,V);if(this.info.render.frame++,d0===!0)W0.beginShadows();let m=T.state.shadowsArray;if(D0.render(m,V,h),d0===!0)W0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((u&&L.hasRenderPass())===!1){let{opaque:L0,transmissive:U0}=C;if(T.setupLights(),h.isArrayCamera){let V0=h.cameras;if(U0.length>0)for(let _0=0,f0=V0.length;_0<f0;_0++){let m0=V0[_0];UW(L0,U0,V,m0)}if(vJ)$0.render(V);for(let _0=0,f0=V0.length;_0<f0;_0++){let m0=V0[_0];HW(C,V,m0,m0.viewport)}}else{if(U0.length>0)UW(L0,U0,V,h);if(vJ)$0.render(V);HW(C,V,h)}}if(v!==null&&b===0)w.updateMultisampleRenderTarget(v),w.updateRenderTargetMipmap(v);if(u)L.end(z);if(V.isScene===!0)V.onAfterRender(z,V,h);if(y.resetDefaultState(),x=-1,p=null,_.pop(),_.length>0){if(T=_[_.length-1],w.setTextureUnits(T.state.textureUnits),d0===!0)W0.setGlobalState(z.clippingPlanes,T.state.camera)}else T=null;if(P.pop(),P.length>0)C=P[P.length-1];else C=null;if(I!==null)I.renderEnd()};function vQ(V,h,l,u){if(V.visible===!1)return;if(V.layers.test(h.layers)){if(V.isGroup)l=V.renderOrder;else if(V.isLOD){if(V.autoUpdate===!0)V.update(h)}else if(V.isLightProbeGrid)T.pushLightProbeGrid(V);else if(V.isLight){if(T.pushLight(V),V.castShadow)T.pushShadow(V)}else if(V.isSprite){if(!V.frustumCulled||e0.intersectsSprite(V)){if(u)b0.setFromMatrixPosition(V.matrixWorld).applyMatrix4(WJ);let L0=t.update(V),U0=V.material;if(U0.visible)C.push(V,L0,U0,l,b0.z,null)}}else if(V.isMesh||V.isLine||V.isPoints){if(!V.frustumCulled||e0.intersectsObject(V)){let L0=t.update(V),U0=V.material;if(u){if(V.boundingSphere!==void 0){if(V.boundingSphere===null)V.computeBoundingSphere();b0.copy(V.boundingSphere.center)}else{if(L0.boundingSphere===null)L0.computeBoundingSphere();b0.copy(L0.boundingSphere.center)}b0.applyMatrix4(V.matrixWorld).applyMatrix4(WJ)}if(Array.isArray(U0)){let V0=L0.groups;for(let _0=0,f0=V0.length;_0<f0;_0++){let m0=V0[_0],w0=U0[m0.materialIndex];if(w0&&w0.visible)C.push(V,L0,w0,l,b0.z,m0)}}else if(U0.visible)C.push(V,L0,U0,l,b0.z,null)}}}let q0=V.children;for(let L0=0,U0=q0.length;L0<U0;L0++)vQ(q0[L0],h,l,u)}function HW(V,h,l,u){let{opaque:m,transmissive:q0,transparent:L0}=V;if(T.setupLightsView(l),d0===!0)W0.setGlobalState(z.clippingPlanes,l);if(u)E0.viewport(d.copy(u));if(m.length>0)U7(m,h,l);if(q0.length>0)U7(q0,h,l);if(L0.length>0)U7(L0,h,l);E0.buffers.depth.setTest(!0),E0.buffers.depth.setMask(!0),E0.buffers.color.setMask(!0),E0.setPolygonOffset(!1)}function UW(V,h,l,u){if((l.isScene===!0?l.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[u.id]===void 0){let w0=i0.has("EXT_color_buffer_half_float")||i0.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[u.id]=new cJ(1,1,{generateMipmaps:!0,type:w0?bJ:R9,minFilter:I9,samples:Math.max(4,r0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:l0.workingColorSpace})}let q0=T.state.transmissionRenderTarget[u.id],L0=u.viewport||d;q0.setSize(L0.z*z.transmissionResolutionScale,L0.w*z.transmissionResolutionScale);let U0=z.getRenderTarget(),V0=z.getActiveCubeFace(),_0=z.getActiveMipmapLevel();if(z.setRenderTarget(q0),z.getClearColor(Y0),R0=z.getClearAlpha(),R0<1)z.setClearColor(16777215,0.5);if(z.clear(),vJ)$0.render(l);let f0=z.toneMapping;z.toneMapping=aJ;let m0=u.viewport;if(u.viewport!==void 0)u.viewport=void 0;if(T.setupLightsView(u),d0===!0)W0.setGlobalState(z.clippingPlanes,u);if(U7(V,l,u),w.updateMultisampleRenderTarget(q0),w.updateRenderTargetMipmap(q0),i0.has("WEBGL_multisampled_render_to_texture")===!1){let w0=!1;for(let ZJ=0,LJ=h.length;ZJ<LJ;ZJ++){let RJ=h[ZJ],{object:XJ,geometry:yJ,material:O0,group:sJ}=RJ;if(O0.side===lJ&&XJ.layers.test(u.layers)){let o0=O0.side;O0.side=hJ,O0.needsUpdate=!0,GW(XJ,l,u,yJ,O0,sJ),O0.side=o0,O0.needsUpdate=!0,w0=!0}}if(w0===!0)w.updateMultisampleRenderTarget(q0),w.updateRenderTargetMipmap(q0)}if(z.setRenderTarget(U0,V0,_0),z.setClearColor(Y0,R0),m0!==void 0)u.viewport=m0;z.toneMapping=f0}function U7(V,h,l){let u=h.isScene===!0?h.overrideMaterial:null;for(let m=0,q0=V.length;m<q0;m++){let L0=V[m],{object:U0,geometry:V0,group:_0}=L0,f0=L0.material;if(f0.allowOverride===!0&&u!==null)f0=u;if(U0.layers.test(l.layers))GW(U0,h,l,V0,f0,_0)}}function GW(V,h,l,u,m,q0){if(V.onBeforeRender(z,h,l,u,m,q0),V.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,V.matrixWorld),V.normalMatrix.getNormalMatrix(V.modelViewMatrix),m.onBeforeRender(z,h,l,u,V,q0),m.transparent===!0&&m.side===lJ&&m.forceSinglePass===!1)m.side=hJ,m.needsUpdate=!0,z.renderBufferDirect(l,h,u,m,V,q0),m.side=z9,m.needsUpdate=!0,z.renderBufferDirect(l,h,u,m,V,q0),m.side=lJ;else z.renderBufferDirect(l,h,u,m,V,q0);V.onAfterRender(z,h,l,u,m,q0)}function G7(V,h,l){if(h.isScene!==!0)h=jJ;let u=T0.get(V),m=T.state.lights,q0=T.state.shadowsArray,L0=m.state.version,U0=J0.getParameters(V,m.state,q0,h,l,T.state.lightProbeGridArray),V0=J0.getProgramCacheKey(U0),_0=u.programs;u.environment=V.isMeshStandardMaterial||V.isMeshLambertMaterial||V.isMeshPhongMaterial?h.environment:null,u.fog=h.fog;let f0=V.isMeshStandardMaterial||V.isMeshLambertMaterial&&!V.envMap||V.isMeshPhongMaterial&&!V.envMap;if(u.envMap=M.get(V.envMap||u.environment,f0),u.envMapRotation=u.environment!==null&&V.envMap===null?h.environmentRotation:V.envMapRotation,_0===void 0)V.addEventListener("dispose",y0),_0=new Map,u.programs=_0;let m0=_0.get(V0);if(m0!==void 0){if(u.currentProgram===m0&&u.lightsStateVersion===L0)return qW(V,U0),m0}else{if(U0.uniforms=J0.getUniforms(V),I!==null&&V.isNodeMaterial)I.build(V,l,U0);V.onBeforeCompile(U0,z),m0=J0.acquireProgram(U0,V0),_0.set(V0,m0),u.uniforms=U0.uniforms}let w0=u.uniforms;if(!V.isShaderMaterial&&!V.isRawShaderMaterial||V.clipping===!0)w0.clippingPlanes=W0.uniform;if(qW(V,U0),u.needsLights=JH(V),u.lightsStateVersion=L0,u.needsLights)w0.ambientLightColor.value=m.state.ambient,w0.lightProbe.value=m.state.probe,w0.directionalLights.value=m.state.directional,w0.directionalLightShadows.value=m.state.directionalShadow,w0.spotLights.value=m.state.spot,w0.spotLightShadows.value=m.state.spotShadow,w0.rectAreaLights.value=m.state.rectArea,w0.ltc_1.value=m.state.rectAreaLTC1,w0.ltc_2.value=m.state.rectAreaLTC2,w0.pointLights.value=m.state.point,w0.pointLightShadows.value=m.state.pointShadow,w0.hemisphereLights.value=m.state.hemi,w0.directionalShadowMatrix.value=m.state.directionalShadowMatrix,w0.spotLightMatrix.value=m.state.spotLightMatrix,w0.spotLightMap.value=m.state.spotLightMap,w0.pointShadowMatrix.value=m.state.pointShadowMatrix;return u.lightProbeGrid=T.state.lightProbeGridArray.length>0,u.currentProgram=m0,u.uniformsList=null,m0}function EW(V){if(V.uniformsList===null){let h=V.currentProgram.getUniforms();V.uniformsList=$7.seqWithValue(h.seq,V.uniforms)}return V.uniformsList}function qW(V,h){let l=T0.get(V);l.outputColorSpace=h.outputColorSpace,l.batching=h.batching,l.batchingColor=h.batchingColor,l.instancing=h.instancing,l.instancingColor=h.instancingColor,l.instancingMorph=h.instancingMorph,l.skinning=h.skinning,l.morphTargets=h.morphTargets,l.morphNormals=h.morphNormals,l.morphColors=h.morphColors,l.morphTargetsCount=h.morphTargetsCount,l.numClippingPlanes=h.numClippingPlanes,l.numIntersection=h.numClipIntersection,l.vertexAlphas=h.vertexAlphas,l.vertexTangents=h.vertexTangents,l.toneMapping=h.toneMapping}function rK(V,h){if(V.length===0)return null;if(V.length===1)return V[0].texture!==null?V[0]:null;B.setFromMatrixPosition(h.matrixWorld);for(let l=0,u=V.length;l<u;l++){let m=V[l];if(m.texture!==null&&m.boundingBox.containsPoint(B))return m}return null}function tK(V,h,l,u,m){if(h.isScene!==!0)h=jJ;w.resetTextureUnits();let q0=h.fog,L0=u.isMeshStandardMaterial||u.isMeshLambertMaterial||u.isMeshPhongMaterial?h.environment:null,U0=v===null?z.outputColorSpace:v.isXRRenderTarget===!0?v.texture.colorSpace:l0.workingColorSpace,V0=u.isMeshStandardMaterial||u.isMeshLambertMaterial&&!u.envMap||u.isMeshPhongMaterial&&!u.envMap,_0=M.get(u.envMap||L0,V0),f0=u.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,m0=!!l.attributes.tangent&&(!!u.normalMap||u.anisotropy>0),w0=!!l.morphAttributes.position,ZJ=!!l.morphAttributes.normal,LJ=!!l.morphAttributes.color,RJ=aJ;if(u.toneMapped){if(v===null||v.isXRRenderTarget===!0)RJ=z.toneMapping}let XJ=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,yJ=XJ!==void 0?XJ.length:0,O0=T0.get(u),sJ=T.state.lights;if(d0===!0){if(s0===!0||V!==p){let GJ=V===p&&u.id===x;W0.setState(u,V,GJ)}}let o0=!1;if(u.version===O0.__version){if(O0.needsLights&&O0.lightsStateVersion!==sJ.state.version)o0=!0;else if(O0.outputColorSpace!==U0)o0=!0;else if(m.isBatchedMesh&&O0.batching===!1)o0=!0;else if(!m.isBatchedMesh&&O0.batching===!0)o0=!0;else if(m.isBatchedMesh&&O0.batchingColor===!0&&m.colorTexture===null)o0=!0;else if(m.isBatchedMesh&&O0.batchingColor===!1&&m.colorTexture!==null)o0=!0;else if(m.isInstancedMesh&&O0.instancing===!1)o0=!0;else if(!m.isInstancedMesh&&O0.instancing===!0)o0=!0;else if(m.isSkinnedMesh&&O0.skinning===!1)o0=!0;else if(!m.isSkinnedMesh&&O0.skinning===!0)o0=!0;else if(m.isInstancedMesh&&O0.instancingColor===!0&&m.instanceColor===null)o0=!0;else if(m.isInstancedMesh&&O0.instancingColor===!1&&m.instanceColor!==null)o0=!0;else if(m.isInstancedMesh&&O0.instancingMorph===!0&&m.morphTexture===null)o0=!0;else if(m.isInstancedMesh&&O0.instancingMorph===!1&&m.morphTexture!==null)o0=!0;else if(O0.envMap!==_0)o0=!0;else if(u.fog===!0&&O0.fog!==q0)o0=!0;else if(O0.numClippingPlanes!==void 0&&(O0.numClippingPlanes!==W0.numPlanes||O0.numIntersection!==W0.numIntersection))o0=!0;else if(O0.vertexAlphas!==f0)o0=!0;else if(O0.vertexTangents!==m0)o0=!0;else if(O0.morphTargets!==w0)o0=!0;else if(O0.morphNormals!==ZJ)o0=!0;else if(O0.morphColors!==LJ)o0=!0;else if(O0.toneMapping!==RJ)o0=!0;else if(O0.morphTargetsCount!==yJ)o0=!0;else if(!!O0.lightProbeGrid!==T.state.lightProbeGridArray.length>0)o0=!0}else o0=!0,O0.__version=u.version;let Q9=O0.currentProgram;if(o0===!0){if(Q9=G7(u,h,m),I&&u.isNodeMaterial)I.onUpdateProgram(u,Q9,O0)}let k9=!1,r9=!1,h8=!1,KJ=Q9.getUniforms(),DJ=O0.uniforms;if(E0.useProgram(Q9.program))k9=!0,r9=!0,h8=!0;if(u.id!==x)x=u.id,r9=!0;if(O0.needsLights){let GJ=rK(T.state.lightProbeGridArray,m);if(O0.lightProbeGrid!==GJ)O0.lightProbeGrid=GJ,r9=!0}if(k9||p!==V){if(E0.buffers.depth.getReversed()&&V.reversedDepth!==!0)V._reversedDepth=!0,V.updateProjectionMatrix();KJ.setValue(f,"projectionMatrix",V.projectionMatrix),KJ.setValue(f,"viewMatrix",V.matrixWorldInverse);let e9=KJ.map.cameraPosition;if(e9!==void 0)e9.setValue(f,YJ.setFromMatrixPosition(V.matrixWorld));if(r0.logarithmicDepthBuffer)KJ.setValue(f,"logDepthBufFC",2/(Math.log(V.far+1)/Math.LN2));if(u.isMeshPhongMaterial||u.isMeshToonMaterial||u.isMeshLambertMaterial||u.isMeshBasicMaterial||u.isMeshStandardMaterial||u.isShaderMaterial)KJ.setValue(f,"isOrthographic",V.isOrthographicCamera===!0);if(p!==V)p=V,r9=!0,h8=!0}if(O0.needsLights){if(sJ.state.directionalShadowMap.length>0)KJ.setValue(f,"directionalShadowMap",sJ.state.directionalShadowMap,w);if(sJ.state.spotShadowMap.length>0)KJ.setValue(f,"spotShadowMap",sJ.state.spotShadowMap,w);if(sJ.state.pointShadowMap.length>0)KJ.setValue(f,"pointShadowMap",sJ.state.pointShadowMap,w)}if(m.isSkinnedMesh){KJ.setOptional(f,m,"bindMatrix"),KJ.setOptional(f,m,"bindMatrixInverse");let GJ=m.skeleton;if(GJ){if(GJ.boneTexture===null)GJ.computeBoneTexture();KJ.setValue(f,"boneTexture",GJ.boneTexture,w)}}if(m.isBatchedMesh){if(KJ.setOptional(f,m,"batchingTexture"),KJ.setValue(f,"batchingTexture",m._matricesTexture,w),KJ.setOptional(f,m,"batchingIdTexture"),KJ.setValue(f,"batchingIdTexture",m._indirectTexture,w),KJ.setOptional(f,m,"batchingColorTexture"),m._colorsTexture!==null)KJ.setValue(f,"batchingColorTexture",m._colorsTexture,w)}let t9=l.morphAttributes;if(t9.position!==void 0||t9.normal!==void 0||t9.color!==void 0)H0.update(m,l,Q9);if(r9||O0.receiveShadow!==m.receiveShadow)O0.receiveShadow=m.receiveShadow,KJ.setValue(f,"receiveShadow",m.receiveShadow);if((u.isMeshStandardMaterial||u.isMeshLambertMaterial||u.isMeshPhongMaterial)&&u.envMap===null&&h.environment!==null)DJ.envMapIntensity.value=h.environmentIntensity;if(DJ.dfgLUT!==void 0)DJ.dfgLUT.value=iq();if(r9){if(KJ.setValue(f,"toneMappingExposure",z.toneMappingExposure),O0.needsLights)eK(DJ,h8);if(q0&&u.fog===!0)K0.refreshFogUniforms(DJ,q0);if(K0.refreshMaterialUniforms(DJ,u,n0,a0,T.state.transmissionRenderTarget[V.id]),O0.needsLights&&O0.lightProbeGrid){let GJ=O0.lightProbeGrid;DJ.probesSH.value=GJ.texture,DJ.probesMin.value.copy(GJ.boundingBox.min),DJ.probesMax.value.copy(GJ.boundingBox.max),DJ.probesResolution.value.copy(GJ.resolution)}$7.upload(f,EW(O0),DJ,w)}if(u.isShaderMaterial&&u.uniformsNeedUpdate===!0)$7.upload(f,EW(O0),DJ,w),u.uniformsNeedUpdate=!1;if(u.isSpriteMaterial)KJ.setValue(f,"center",m.center);if(KJ.setValue(f,"modelViewMatrix",m.modelViewMatrix),KJ.setValue(f,"normalMatrix",m.normalMatrix),KJ.setValue(f,"modelMatrix",m.matrixWorld),u.uniformsGroups!==void 0){let GJ=u.uniformsGroups;for(let e9=0,b8=GJ.length;e9<b8;e9++){let FW=GJ[e9];Z0.update(FW,Q9),Z0.bind(FW,Q9)}}return Q9}function eK(V,h){V.ambientLightColor.needsUpdate=h,V.lightProbe.needsUpdate=h,V.directionalLights.needsUpdate=h,V.directionalLightShadows.needsUpdate=h,V.pointLights.needsUpdate=h,V.pointLightShadows.needsUpdate=h,V.spotLights.needsUpdate=h,V.spotLightShadows.needsUpdate=h,V.rectAreaLights.needsUpdate=h,V.hemisphereLights.needsUpdate=h}function JH(V){return V.isMeshLambertMaterial||V.isMeshToonMaterial||V.isMeshPhongMaterial||V.isMeshStandardMaterial||V.isShadowMaterial||V.isShaderMaterial&&V.lights===!0}this.getActiveCubeFace=function(){return j},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return v},this.setRenderTargetTextures=function(V,h,l){let u=T0.get(V);if(u.__autoAllocateDepthBuffer=V.resolveDepthBuffer===!1,u.__autoAllocateDepthBuffer===!1)u.__useRenderToTexture=!1;T0.get(V.texture).__webglTexture=h,T0.get(V.depthTexture).__webglTexture=u.__autoAllocateDepthBuffer?void 0:l,u.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(V,h){let l=T0.get(V);l.__webglFramebuffer=h,l.__useDefaultFramebuffer=h===void 0};let QH=f.createFramebuffer();this.setRenderTarget=function(V,h=0,l=0){v=V,j=h,b=l;let u=null,m=!1,q0=!1;if(V){let U0=T0.get(V);if(U0.__useDefaultFramebuffer!==void 0){E0.bindFramebuffer(f.FRAMEBUFFER,U0.__webglFramebuffer),d.copy(V.viewport),n.copy(V.scissor),r=V.scissorTest,E0.viewport(d),E0.scissor(n),E0.setScissorTest(r),x=-1;return}else if(U0.__webglFramebuffer===void 0)w.setupRenderTarget(V);else if(U0.__hasExternalTextures)w.rebindTextures(V,T0.get(V.texture).__webglTexture,T0.get(V.depthTexture).__webglTexture);else if(V.depthBuffer){let f0=V.depthTexture;if(U0.__boundDepthTexture!==f0){if(f0!==null&&T0.has(f0)&&(V.width!==f0.image.width||V.height!==f0.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");w.setupDepthRenderbuffer(V)}}let V0=V.texture;if(V0.isData3DTexture||V0.isDataArrayTexture||V0.isCompressedArrayTexture)q0=!0;let _0=T0.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget){if(Array.isArray(_0[h]))u=_0[h][l];else u=_0[h];m=!0}else if(V.samples>0&&w.useMultisampledRTT(V)===!1)u=T0.get(V).__webglMultisampledFramebuffer;else if(Array.isArray(_0))u=_0[l];else u=_0;d.copy(V.viewport),n.copy(V.scissor),r=V.scissorTest}else d.copy(z0).multiplyScalar(n0).floor(),n.copy(N0).multiplyScalar(n0).floor(),r=P0;if(l!==0)u=QH;if(E0.bindFramebuffer(f.FRAMEBUFFER,u))E0.drawBuffers(V,u);if(E0.viewport(d),E0.scissor(n),E0.setScissorTest(r),m){let U0=T0.get(V.texture);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+h,U0.__webglTexture,l)}else if(q0){let U0=h;for(let V0=0;V0<V.textures.length;V0++){let _0=T0.get(V.textures[V0]);f.framebufferTextureLayer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0+V0,_0.__webglTexture,l,U0)}}else if(V!==null&&l!==0){let U0=T0.get(V.texture);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,U0.__webglTexture,l)}x=-1},this.readRenderTargetPixels=function(V,h,l,u,m,q0,L0,U0=0){if(!(V&&V.isWebGLRenderTarget)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let V0=T0.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&L0!==void 0)V0=V0[L0];if(V0){E0.bindFramebuffer(f.FRAMEBUFFER,V0);try{let _0=V.textures[U0],f0=_0.format,m0=_0.type;if(V.textures.length>1)f.readBuffer(f.COLOR_ATTACHMENT0+U0);if(!r0.textureFormatReadable(f0)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!r0.textureTypeReadable(m0)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(h>=0&&h<=V.width-u&&(l>=0&&l<=V.height-m))f.readPixels(h,l,u,m,u0.convert(f0),u0.convert(m0),q0)}finally{let _0=v!==null?T0.get(v).__webglFramebuffer:null;E0.bindFramebuffer(f.FRAMEBUFFER,_0)}}},this.readRenderTargetPixelsAsync=async function(V,h,l,u,m,q0,L0,U0=0){if(!(V&&V.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let V0=T0.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&L0!==void 0)V0=V0[L0];if(V0)if(h>=0&&h<=V.width-u&&(l>=0&&l<=V.height-m)){E0.bindFramebuffer(f.FRAMEBUFFER,V0);let _0=V.textures[U0],f0=_0.format,m0=_0.type;if(V.textures.length>1)f.readBuffer(f.COLOR_ATTACHMENT0+U0);if(!r0.textureFormatReadable(f0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r0.textureTypeReadable(m0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let w0=f.createBuffer();f.bindBuffer(f.PIXEL_PACK_BUFFER,w0),f.bufferData(f.PIXEL_PACK_BUFFER,q0.byteLength,f.STREAM_READ),f.readPixels(h,l,u,m,u0.convert(f0),u0.convert(m0),0);let ZJ=v!==null?T0.get(v).__webglFramebuffer:null;E0.bindFramebuffer(f.FRAMEBUFFER,ZJ);let LJ=f.fenceSync(f.SYNC_GPU_COMMANDS_COMPLETE,0);return f.flush(),await iY(f,LJ,4),f.bindBuffer(f.PIXEL_PACK_BUFFER,w0),f.getBufferSubData(f.PIXEL_PACK_BUFFER,0,q0),f.deleteBuffer(w0),f.deleteSync(LJ),q0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(V,h=null,l=0){let u=Math.pow(2,-l),m=Math.floor(V.image.width*u),q0=Math.floor(V.image.height*u),L0=h!==null?h.x:0,U0=h!==null?h.y:0;w.setTexture2D(V,0),f.copyTexSubImage2D(f.TEXTURE_2D,l,0,0,L0,U0,m,q0),E0.unbindTexture()};let $H=f.createFramebuffer(),ZH=f.createFramebuffer();if(this.copyTextureToTexture=function(V,h,l=null,u=null,m=0,q0=0){let L0,U0,V0,_0,f0,m0,w0,ZJ,LJ,RJ=V.isCompressedTexture?V.mipmaps[q0]:V.image;if(l!==null)L0=l.max.x-l.min.x,U0=l.max.y-l.min.y,V0=l.isBox3?l.max.z-l.min.z:1,_0=l.min.x,f0=l.min.y,m0=l.isBox3?l.min.z:0;else{let DJ=Math.pow(2,-m);if(L0=Math.floor(RJ.width*DJ),U0=Math.floor(RJ.height*DJ),V.isDataArrayTexture)V0=RJ.depth;else if(V.isData3DTexture)V0=Math.floor(RJ.depth*DJ);else V0=1;_0=0,f0=0,m0=0}if(u!==null)w0=u.x,ZJ=u.y,LJ=u.z;else w0=0,ZJ=0,LJ=0;let XJ=u0.convert(h.format),yJ=u0.convert(h.type),O0;if(h.isData3DTexture)w.setTexture3D(h,0),O0=f.TEXTURE_3D;else if(h.isDataArrayTexture||h.isCompressedArrayTexture)w.setTexture2DArray(h,0),O0=f.TEXTURE_2D_ARRAY;else w.setTexture2D(h,0),O0=f.TEXTURE_2D;E0.activeTexture(f.TEXTURE0),E0.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,h.flipY),E0.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),E0.pixelStorei(f.UNPACK_ALIGNMENT,h.unpackAlignment);let sJ=E0.getParameter(f.UNPACK_ROW_LENGTH),o0=E0.getParameter(f.UNPACK_IMAGE_HEIGHT),Q9=E0.getParameter(f.UNPACK_SKIP_PIXELS),k9=E0.getParameter(f.UNPACK_SKIP_ROWS),r9=E0.getParameter(f.UNPACK_SKIP_IMAGES);E0.pixelStorei(f.UNPACK_ROW_LENGTH,RJ.width),E0.pixelStorei(f.UNPACK_IMAGE_HEIGHT,RJ.height),E0.pixelStorei(f.UNPACK_SKIP_PIXELS,_0),E0.pixelStorei(f.UNPACK_SKIP_ROWS,f0),E0.pixelStorei(f.UNPACK_SKIP_IMAGES,m0);let h8=V.isDataArrayTexture||V.isData3DTexture,KJ=h.isDataArrayTexture||h.isData3DTexture;if(V.isDepthTexture){let DJ=T0.get(V),t9=T0.get(h),GJ=T0.get(DJ.__renderTarget),e9=T0.get(t9.__renderTarget);E0.bindFramebuffer(f.READ_FRAMEBUFFER,GJ.__webglFramebuffer),E0.bindFramebuffer(f.DRAW_FRAMEBUFFER,e9.__webglFramebuffer);for(let b8=0;b8<V0;b8++){if(h8)f.framebufferTextureLayer(f.READ_FRAMEBUFFER,f.COLOR_ATTACHMENT0,T0.get(V).__webglTexture,m,m0+b8),f.framebufferTextureLayer(f.DRAW_FRAMEBUFFER,f.COLOR_ATTACHMENT0,T0.get(h).__webglTexture,q0,LJ+b8);f.blitFramebuffer(_0,f0,L0,U0,w0,ZJ,L0,U0,f.DEPTH_BUFFER_BIT,f.NEAREST)}E0.bindFramebuffer(f.READ_FRAMEBUFFER,null),E0.bindFramebuffer(f.DRAW_FRAMEBUFFER,null)}else if(m!==0||V.isRenderTargetTexture||T0.has(V)){let DJ=T0.get(V),t9=T0.get(h);E0.bindFramebuffer(f.READ_FRAMEBUFFER,$H),E0.bindFramebuffer(f.DRAW_FRAMEBUFFER,ZH);for(let GJ=0;GJ<V0;GJ++){if(h8)f.framebufferTextureLayer(f.READ_FRAMEBUFFER,f.COLOR_ATTACHMENT0,DJ.__webglTexture,m,m0+GJ);else f.framebufferTexture2D(f.READ_FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,DJ.__webglTexture,m);if(KJ)f.framebufferTextureLayer(f.DRAW_FRAMEBUFFER,f.COLOR_ATTACHMENT0,t9.__webglTexture,q0,LJ+GJ);else f.framebufferTexture2D(f.DRAW_FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,t9.__webglTexture,q0);if(m!==0)f.blitFramebuffer(_0,f0,L0,U0,w0,ZJ,L0,U0,f.COLOR_BUFFER_BIT,f.NEAREST);else if(KJ)f.copyTexSubImage3D(O0,q0,w0,ZJ,LJ+GJ,_0,f0,L0,U0);else f.copyTexSubImage2D(O0,q0,w0,ZJ,_0,f0,L0,U0)}E0.bindFramebuffer(f.READ_FRAMEBUFFER,null),E0.bindFramebuffer(f.DRAW_FRAMEBUFFER,null)}else if(KJ)if(V.isDataTexture||V.isData3DTexture)f.texSubImage3D(O0,q0,w0,ZJ,LJ,L0,U0,V0,XJ,yJ,RJ.data);else if(h.isCompressedArrayTexture)f.compressedTexSubImage3D(O0,q0,w0,ZJ,LJ,L0,U0,V0,XJ,RJ.data);else f.texSubImage3D(O0,q0,w0,ZJ,LJ,L0,U0,V0,XJ,yJ,RJ);else if(V.isDataTexture)f.texSubImage2D(f.TEXTURE_2D,q0,w0,ZJ,L0,U0,XJ,yJ,RJ.data);else if(V.isCompressedTexture)f.compressedTexSubImage2D(f.TEXTURE_2D,q0,w0,ZJ,RJ.width,RJ.height,XJ,RJ.data);else f.texSubImage2D(f.TEXTURE_2D,q0,w0,ZJ,L0,U0,XJ,yJ,RJ);if(E0.pixelStorei(f.UNPACK_ROW_LENGTH,sJ),E0.pixelStorei(f.UNPACK_IMAGE_HEIGHT,o0),E0.pixelStorei(f.UNPACK_SKIP_PIXELS,Q9),E0.pixelStorei(f.UNPACK_SKIP_ROWS,k9),E0.pixelStorei(f.UNPACK_SKIP_IMAGES,r9),q0===0&&h.generateMipmaps)f.generateMipmap(O0);E0.unbindTexture()},this.initRenderTarget=function(V){if(T0.get(V).__webglFramebuffer===void 0)w.setupRenderTarget(V)},this.initTexture=function(V){if(V.isCubeTexture)w.setTextureCube(V,0);else if(V.isData3DTexture)w.setTexture3D(V,0);else if(V.isDataArrayTexture||V.isCompressedArrayTexture)w.setTexture2DArray(V,0);else w.setTexture2D(V,0);E0.unbindTexture()},this.resetState=function(){j=0,b=0,v=null,E0.reset(),y.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return KZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=l0._getDrawingBufferColorSpace(J),Q.unpackColorSpace=l0._getUnpackColorSpace()}}function C0(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J);return Number.isFinite($)?$:Q}function OJ(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 pX(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 OJ(J,[1,1,1])}function V6(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J.trim().replace(/deg$/i,""));return Number.isFinite($)?$:Q}function mZ(J){return J*Math.PI/180}function dX(J){let Q=OJ(J,[0,0,0]);return[mZ(Q[0]),mZ(Q[1]),mZ(Q[2])]}function y9(J,Q){if(J==null||J.trim()==="")return Q;return J.trim()}function D9(J,Q){return C0(J,Q)}function zQ(J){return(Q)=>Math.pow(Q,J)}function CQ(J){return(Q)=>1-Math.pow(1-Q,J)}function IQ(J){return(Q)=>Q<0.5?Math.pow(2*Q,J)/2:1-Math.pow(2*(1-Q),J)/2}var W7=1.70158,_Q={linear:(J)=>J,none:(J)=>J,"power1.in":zQ(2),"power1.out":CQ(2),"power1.inOut":IQ(2),"power2.in":zQ(3),"power2.out":CQ(3),"power2.inOut":IQ(3),"power3.in":zQ(4),"power3.out":CQ(4),"power3.inOut":IQ(4),"power4.in":zQ(5),"power4.out":CQ(5),"power4.inOut":IQ(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*((W7+1)*J-W7),"back.out":(J)=>{let Q=J-1;return Q*Q*((W7+1)*Q+W7)+1},"back.inOut":(J)=>{let Q=W7*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 wQ(J,Q="power1.out"){if(J){let $=_Q[J.trim()];if($)return $}return _Q[Q]??_Q.linear}var xO=Object.keys(_Q);function f8(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 uX(J,Q){return f8(J,Q)}function mX(J,Q,$){let Z=Math.max(0.000001,1-$);return Math.min(1,Math.max(0,(J-Q)/Z))}function lX(J,Q){return Math.max(0,J-Q.start)}function cX(J){return{start:J.start??0,duration:J.duration??void 0,ease:wQ(J.ease??null,J.defaultEase??"power1.out")}}function nX(J,Q,$){let Z=J.rotation[$.axis],W=$.rpm/60*Math.PI*2;return(Y)=>{J.rotation[$.axis]=Z+W*lX(Y,Q)}}function sX(J,Q,$){let Z=$.fromDeg*Math.PI/180,W=$.toDeg*Math.PI/180;return(Y)=>{let X=Z+(W-Z)*f8(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 iX(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*f8(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 oX(J,Q){let $={x:J.scale.x,y:J.scale.y,z:J.scale.z};return(Z)=>{let W=Z<Q.start?0:f8(Z,Q);J.scale.x=$.x*W,J.scale.y=$.y*W,J.scale.z=$.z*W}}function lZ(J,Q){return($)=>{J($<Q.start?0:f8($,Q))}}function aX(J,Q,$){let Z=$.from??{x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=f8(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 rX(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 tX(J,Q){return($)=>{let Z=$<Q.start?0:f8($,Q);J(1-Z,Z)}}function eX(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*lX(Y,Q))}}var PQ=new A;function rq(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 cZ(J,Q){if(Q&&Q.startsWith("#")){let Z=J.objectsById.get(Q.slice(1));if(Z)return()=>{return Z.getWorldPosition(PQ),{x:PQ.x,y:PQ.y,z:PQ.z}}}let $=OJ(Q,[0,0,0]);return()=>({x:$[0],y:$[1],z:$[2]})}function tq(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 JK(J){for(let Q of Array.from(J.host.querySelectorAll("sf-animate"))){let $=(Q.getAttribute("verb")??"").toLowerCase(),Z={orbit:4,dolly:1.5,"bounce-in":0.6,"fade-in":0.6,move:2,"crossfade-clip":0.5,"camera-path":8},W=Q.getAttribute("duration"),Y=cX({start:D9(Q.getAttribute("start"),0),duration:W?D9(W,0):Z[$]??null,ease:Q.getAttribute("ease"),defaultEase:$==="bounce-in"?"back.out":"power1.out"}),X=rq(J,Q.getAttribute("target"));if(!X){let K=Q.getAttribute("target")??"",H=K.startsWith("#")?document.querySelector(K):null;if(H&&($==="fade-in"||$==="bounce-in")){let U=C0(Q.getAttribute("rise"),0);J.seekFns.push(lZ((G)=>{if($==="fade-in"){if(H.style.opacity=String(G),U!==0)H.style.transform=`translateY(${(1-G)*U}px)`}else H.style.opacity=G>0?"1":"0",H.style.transform=`scale(${G})`},Y))}continue}if($==="turntable")J.seekFns.push(nX(X,Y,{rpm:C0(Q.getAttribute("rpm"),6),axis:Q.getAttribute("axis")??"y"}));else if($==="orbit"){let K=cZ(J,Q.getAttribute("around")),H=K(),U=X.position.x-H.x,G=X.position.z-H.z,q=Math.sqrt(U*U+G*G),E=Math.atan2(U,G)*180/Math.PI,O=V6(Q.getAttribute("from"),E);J.seekFns.push(sX(X,Y,{center:K,radius:C0(Q.getAttribute("radius"),q||5),fromDeg:O,toDeg:V6(Q.getAttribute("to"),O+360),height:C0(Q.getAttribute("height"),X.position.y-H.y)}))}else if($==="dolly")J.seekFns.push(iX(X,Y,{toward:cZ(J,Q.getAttribute("toward")),distance:C0(Q.getAttribute("distance"),1)}));else if($==="move"){let K=Q.getAttribute("to");if(!K)continue;let H=OJ(K,[0,0,0]),U=Q.getAttribute("from"),G=U?OJ(U,[0,0,0]):null;J.seekFns.push(aX(X,Y,{from:G?{x:G[0],y:G[1],z:G[2]}:void 0,to:{x:H[0],y:H[1],z:H[2]}}))}else if($==="follow"){let K=cZ(J,Q.getAttribute("subject")),H=Q.getAttribute("offset"),U;if(H){let G=OJ(H,[0,2,5]);U={x:G[0],y:G[1],z:G[2]}}else{let G=K();U={x:X.position.x-G.x,y:X.position.y-G.y,z:X.position.z-G.z}}J.lateSeekFns.push(rX(X,{subject:K,offset:U}))}else if($==="camera-path"){let K=(Q.getAttribute("points")??"").split(",").map((E)=>OJ(E.trim(),[Number.NaN,Number.NaN,Number.NaN])).filter((E)=>E.every(Number.isFinite)).map((E)=>new A(E[0],E[1],E[2]));if(K.length<2)continue;let H=new GQ(K,!1,"centripetal"),U=(Q.getAttribute("look")??"ahead").toLowerCase(),G=new A,q=new A;J.lateSeekFns.push((E)=>{let O=uX(E,Y);if(H.getPointAt(Math.min(1,Math.max(0,O)),G),X.position.set(G.x,G.y,G.z),U==="ahead"){if(H.getPointAt(Math.min(1,Math.max(0,O)+0.02),q),q.distanceToSquared(G)<0.000000001)H.getPointAt(Math.max(0,O-0.02),q),q.lerpVectors(q,G,2);X.lookAt(q)}})}else if($==="crossfade-clip"){let K=J.actionsByObject.get(X),H=Q.getAttribute("from"),U=Q.getAttribute("to");if(!K||!H||!U)continue;let G=K.get(H),q=K.get(U);if(!G||!q)continue;J.seekFns.push(tX((E,O)=>{G.setEffectiveWeight(E),q.setEffectiveWeight(O)},Y))}else if($==="bounce-in")J.seekFns.push(oX(X,Y));else if($==="fade-in")J.seekFns.push(lZ(tq(X),Y));else if($==="float")J.seekFns.push(eX(X,Y,{amplitude:C0(Q.getAttribute("amplitude"),0.1),period:C0(Q.getAttribute("period"),4)}))}}function nZ(J,Q){if(Q===ZZ)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===U6||Q===p6){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===U6)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 QK(J){let Q=new Map,$=new Map,Z=J.clone();return $K(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 $K(J,Q,$){$(J,Q);for(let Z=0;Z<J.children.length;Z++)$K(J.children[Z],Q.children[Z],$)}class eZ extends A9{constructor(J){super(J);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(Q){return new GK(Q)}),this.register(function(Q){return new EK(Q)}),this.register(function(Q){return new kK(Q)}),this.register(function(Q){return new BK(Q)}),this.register(function(Q){return new VK(Q)}),this.register(function(Q){return new FK(Q)}),this.register(function(Q){return new NK(Q)}),this.register(function(Q){return new OK(Q)}),this.register(function(Q){return new RK(Q)}),this.register(function(Q){return new UK(Q)}),this.register(function(Q){return new LK(Q)}),this.register(function(Q){return new qK(Q)}),this.register(function(Q){return new MK(Q)}),this.register(function(Q){return new DK(Q)}),this.register(function(Q){return new KK(Q)}),this.register(function(Q){return new aZ(Q,c0.EXT_MESHOPT_COMPRESSION)}),this.register(function(Q){return new aZ(Q,c0.KHR_MESHOPT_COMPRESSION)}),this.register(function(Q){return new zK(Q)})}load(J,Q,$,Z){let W=this,Y;if(this.resourcePath!=="")Y=this.resourcePath;else if(this.path!==""){let H=q8.extractUrlBase(J);Y=q8.resolveURL(H,this.path)}else Y=q8.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 R6(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))===CK){try{Y[c0.KHR_BINARY_GLTF]=new IK(J)}catch(G){if(Z)Z(G);return}W=JSON.parse(Y[c0.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 AK(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],q=W.extensionsRequired||[];switch(G){case c0.KHR_MATERIALS_UNLIT:Y[G]=new HK;break;case c0.KHR_DRACO_MESH_COMPRESSION:Y[G]=new _K(W,this.dracoLoader);break;case c0.KHR_TEXTURE_TRANSFORM:Y[G]=new wK;break;case c0.KHR_MESH_QUANTIZATION:Y[G]=new PK;break;default:if(q.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 eq(){let J={};return{get:function(Q){return J[Q]},add:function(Q,$){J[Q]=$},remove:function(Q){delete J[Q]},removeAll:function(){J={}}}}function VJ(J,Q,$){let Z=J.json.materials[Q];if(Z.extensions&&Z.extensions[$])return Z.extensions[$];return null}var c0={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 KK{constructor(J){this.parser=J,this.name=c0.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 k0(16777215);if(K.color!==void 0)U.setRGB(K.color[0],K.color[1],K.color[2],uJ);let G=K.range!==void 0?K.range:0;switch(K.type){case"directional":H=new S9(U),H.target.position.set(0,0,-1),H.add(H.target);break;case"point":H=new M6(U),H.distance=G;break;case"spot":H=new RQ(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 HK{constructor(){this.name=c0.KHR_MATERIALS_UNLIT}getMaterialType(){return P9}extendParams(J,Q,$){let Z=[];J.color=new k0(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],uJ),J.opacity=Y[3]}if(W.baseColorTexture!==void 0)Z.push($.assignTexture(J,"map",W.baseColorTexture,H8))}return Promise.all(Z)}}class UK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();if($.emissiveStrength!==void 0)Q.emissiveIntensity=$.emissiveStrength;return Promise.resolve()}}class GK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_CLEARCOAT}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 h0(W,W)}}return Promise.all(Z)}}class EK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_DISPERSION}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();return Q.dispersion=$.dispersion!==void 0?$.dispersion:0,Promise.resolve()}}class qK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_IRIDESCENCE}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 FK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_SHEEN}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.sheenColor=new k0(0,0,0),Q.sheenRoughness=0,Q.sheen=1,$.sheenColorFactor!==void 0){let W=$.sheenColorFactor;Q.sheenColor.setRGB(W[0],W[1],W[2],uJ)}if($.sheenRoughnessFactor!==void 0)Q.sheenRoughness=$.sheenRoughnessFactor;if($.sheenColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenColorMap",$.sheenColorTexture,H8));if($.sheenRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenRoughnessMap",$.sheenRoughnessTexture));return Promise.all(Z)}}class NK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_TRANSMISSION}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 OK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_VOLUME}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 k0().setRGB(W[0],W[1],W[2],uJ),Promise.all(Z)}}class RK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_IOR}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 LK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_SPECULAR}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 k0().setRGB(W[0],W[1],W[2],uJ),$.specularColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularColorMap",$.specularColorTexture,H8));return Promise.all(Z)}}class DK{constructor(J){this.parser=J,this.name=c0.EXT_MATERIALS_BUMP}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 MK{constructor(J){this.parser=J,this.name=c0.KHR_MATERIALS_ANISOTROPY}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?mJ:null}extendMaterialParams(J,Q){let $=VJ(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 kK{constructor(J){this.parser=J,this.name=c0.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 BK{constructor(J){this.parser=J,this.name=c0.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 VK{constructor(J){this.parser=J,this.name=c0.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 aZ{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,q=new Uint8Array(X,K,H);if(Y.decodeGltfBufferAsync)return Y.decodeGltfBufferAsync(U,G,q,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,q,Z.mode,Z.filter),E})})}else return null}}class zK{constructor(J){this.name=c0.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!==X9.TRIANGLES&&H.mode!==X9.TRIANGLE_STRIP&&H.mode!==X9.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],q=H[0].count,E=[];for(let O of G){let R=new S0,k=new A,F=new wJ,N=new A(1,1,1),D=new N6(O.geometry,O.material,q);for(let B=0;B<q;B++){if(K.TRANSLATION)k.fromBufferAttribute(K.TRANSLATION,B);if(K.ROTATION)F.fromBufferAttribute(K.ROTATION,B);if(K.SCALE)N.fromBufferAttribute(K.SCALE,B);D.setMatrixAt(B,R.compose(k,F,N))}for(let B in K)if(B==="_COLOR_0"){let C=K[B];D.instanceColor=new B8(C.array,C.itemSize,C.normalized)}else if(B!=="TRANSLATION"&&B!=="ROTATION"&&B!=="SCALE")O.geometry.setAttribute(B,K[B]);EJ.prototype.copy.call(D,O),this.parser.assignFinalMaterial(D),E.push(D)}if(U.isGroup)return U.clear(),U.add(...E),U;return E[0]})}}var CK="glTF",Y7=12,ZK={JSON:1313821514,BIN:5130562};class IK{constructor(J){this.name=c0.KHR_BINARY_GLTF,this.content=null,this.body=null;let Q=new DataView(J,0,Y7),$=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!==CK)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-Y7,W=new DataView(J,Y7),Y=0;while(Y<Z){let X=W.getUint32(Y,!0);Y+=4;let K=W.getUint32(Y,!0);if(Y+=4,K===ZK.JSON){let H=new Uint8Array(J,Y7+Y,X);this.content=$.decode(H)}else if(K===ZK.BIN){let H=Y7+Y;this.body=J.slice(H,H+X)}Y+=X}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class _K{constructor(J,Q){if(!Q)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=c0.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=rZ[U]||U.toLowerCase();X[G]=Y[U]}for(let U in J.attributes){let G=rZ[U]||U.toLowerCase();if(Y[U]!==void 0){let q=$.accessors[J.attributes[U]],E=z6[q.componentType];H[G]=E.name,K[G]=q.normalized===!0}}return Q.getDependency("bufferView",W).then(function(U){return new Promise(function(G,q){Z.decodeDracoFile(U,function(E){for(let O in E.attributes){let R=E.attributes[O],k=K[O];if(k!==void 0)R.normalized=k}G(E)},X,H,uJ,q)})})}}class wK{constructor(){this.name=c0.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 PK{constructor(){this.name=c0.KHR_MESH_QUANTIZATION}}class JW extends i9{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,q=G*G,E=q*G,O=J*H,R=O-H,k=-2*E+3*q,F=E-q,N=1-k,D=F-q+G;for(let B=0;B!==X;B++){let C=Y[R+B+X],T=Y[R+B+K]*U,P=Y[O+B+X],_=Y[O+B]*U;W[B]=N*C+D*T+k*P+F*_}return W}}var J1=new wJ;class TK extends JW{interpolate_(J,Q,$,Z){let W=super.interpolate_(J,Q,$,Z);return J1.fromArray(W).normalize().toArray(W),W}}var X9={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},z6={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WK={9728:O9,9729:kJ,9984:m7,9985:K6,9986:C8,9987:I9},YK={33071:X6,33648:u7,10497:X8},sZ={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rZ={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"},N8={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Q1={CUBICSPLINE:void 0,LINEAR:a7,STEP:$Z},iZ={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function $1(J){if(J.DefaultMaterial===void 0)J.DefaultMaterial=new T9({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:z9});return J.DefaultMaterial}function x8(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 Z1(J,Q,$){let Z=!1,W=!1,Y=!1;for(let U=0,G=Q.length;U<G;U++){let q=Q[U];if(q.POSITION!==void 0)Z=!0;if(q.NORMAL!==void 0)W=!0;if(q.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 q=Q[U];if(Z){let E=q.POSITION!==void 0?$.getDependency("accessor",q.POSITION):J.attributes.position;X.push(E)}if(W){let E=q.NORMAL!==void 0?$.getDependency("accessor",q.NORMAL):J.attributes.normal;K.push(E)}if(Y){let E=q.COLOR_0!==void 0?$.getDependency("accessor",q.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],q=U[1],E=U[2];if(Z)J.morphAttributes.position=G;if(W)J.morphAttributes.normal=q;if(Y)J.morphAttributes.color=E;return J.morphTargetsRelative=!0,J})}function W1(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 Y1(J){let Q,$=J.extensions&&J.extensions[c0.KHR_DRACO_MESH_COMPRESSION];if($)Q="draco:"+$.bufferView+":"+$.indices+":"+oZ($.attributes);else Q=J.indices+":"+oZ(J.attributes)+":"+J.mode;if(J.targets!==void 0)for(let Z=0,W=J.targets.length;Z<W;Z++)Q+=":"+oZ(J.targets[Z]);return Q}function oZ(J){let Q="",$=Object.keys(J).sort();for(let Z=0,W=$.length;Z<W;Z++)Q+=$[Z]+":"+J[$[Z]]+";";return Q}function tZ(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 X1(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 K1=new S0;class AK{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new eq,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 L6(this.options.manager);else this.textureLoader=new LQ(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new R6(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 x8(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[c0.KHR_BINARY_GLTF].body);let Z=this.options;return new Promise(function(W,Y){$.load(q8.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=sZ[Z.type],X=z6[Z.componentType],K=Z.normalized===!0,H=new X(Z.count*Y);return Promise.resolve(new HJ(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=sZ[Z.type],H=z6[Z.componentType],U=H.BYTES_PER_ELEMENT,G=U*K,q=Z.byteOffset||0,E=Z.bufferView!==void 0?$.bufferViews[Z.bufferView].byteStride:void 0,O=Z.normalized===!0,R,k;if(E&&E!==G){let F=Math.floor(q/E),N="InterleavedBuffer:"+Z.bufferView+":"+Z.componentType+":"+F+":"+Z.count,D=Q.cache.get(N);if(!D)R=new H(X,F*E,Z.count*E/U),D=new m6(R,E/U),Q.cache.add(N,D);k=new E6(D,K,q%E/U,O)}else{if(X===null)R=new H(Z.count*K);else R=new H(X,q,Z.count*K);k=new HJ(R,K,O)}if(Z.sparse!==void 0){let F=sZ.SCALAR,N=z6[Z.sparse.indices.componentType],D=Z.sparse.indices.byteOffset||0,B=Z.sparse.values.byteOffset||0,C=new N(Y[1],D,Z.sparse.count*F),T=new H(Y[2],B,Z.sparse.count*K);if(X!==null)k=new HJ(k.array.slice(),k.itemSize,k.normalized);k.normalized=!1;for(let P=0,_=C.length;P<_;P++){let L=C[P];if(k.setX(L,T[P*K]),K>=2)k.setY(L,T[P*K+1]);if(K>=3)k.setZ(L,T[P*K+2]);if(K>=4)k.setW(L,T[P*K+3]);if(K>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}k.normalized=O}return k})}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 q=(W.samplers||{})[Y.sampler]||{};return U.magFilter=WK[q.magFilter]||kJ,U.minFilter=WK[q.minFilter]||I9,U.wrapS=YK[q.wrapS]||X8,U.wrapT=YK[q.wrapT]||X8,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==O9&&U.minFilter!==kJ,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 q=new Blob([G],{type:Y.mimeType});return K=X.createObjectURL(q),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(q,E){let O=q;if(Q.isImageBitmapLoader===!0)O=function(R){let k=new _J(R);k.needsUpdate=!0,q(k)};Q.load(q8.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||X1(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[c0.KHR_TEXTURE_TRANSFORM]){let X=$.extensions!==void 0?$.extensions[c0.KHR_TEXTURE_TRANSFORM]:void 0;if(X){let K=W.associations.get(Y);Y=W.extensions[c0.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 s6,eJ.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 n6,eJ.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 T9}loadMaterial(J){let Q=this,$=this.json,Z=this.extensions,W=$.materials[J],Y,X={},K=W.extensions||{},H=[];if(K[c0.KHR_MATERIALS_UNLIT]){let G=Z[c0.KHR_MATERIALS_UNLIT];Y=G.getMaterialType(),H.push(G.extendParams(X,W,Q))}else{let G=W.pbrMetallicRoughness||{};if(X.color=new k0(1,1,1),X.opacity=1,Array.isArray(G.baseColorFactor)){let q=G.baseColorFactor;X.color.setRGB(q[0],q[1],q[2],uJ),X.opacity=q[3]}if(G.baseColorTexture!==void 0)H.push(Q.assignTexture(X,"map",G.baseColorTexture,H8));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(q){return q.getMaterialType&&q.getMaterialType(J)}),H.push(Promise.all(this._invokeAll(function(q){return q.extendMaterialParams&&q.extendMaterialParams(J,X)})))}if(W.doubleSided===!0)X.side=lJ;let U=W.alphaMode||iZ.OPAQUE;if(U===iZ.BLEND)X.transparent=!0,X.depthWrite=!1;else if(X.transparent=!1,U===iZ.MASK)X.alphaTest=W.alphaCutoff!==void 0?W.alphaCutoff:0.5;if(W.normalTexture!==void 0&&Y!==P9){if(H.push(Q.assignTexture(X,"normalMap",W.normalTexture)),X.normalScale=new h0(1,1),W.normalTexture.scale!==void 0){let G=W.normalTexture.scale;X.normalScale.set(G,G)}}if(W.occlusionTexture!==void 0&&Y!==P9){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!==P9){let G=W.emissiveFactor;X.emissive=new k0().setRGB(G[0],G[1],G[2],uJ)}if(W.emissiveTexture!==void 0&&Y!==P9)H.push(Q.assignTexture(X,"emissiveMap",W.emissiveTexture,H8));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)x8(Z,G,W);return G})}createUniqueName(J){let Q=t0.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 $[c0.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(X,Q).then(function(K){return XK(K,X,Q)})}let Y=[];for(let X=0,K=J.length;X<K;X++){let H=J[X],U=Y1(H),G=Z[U];if(G)Y.push(G.promise);else{let q;if(H.extensions&&H.extensions[c0.KHR_DRACO_MESH_COMPRESSION])q=W(H);else q=XK(new BJ,H,Q);Z[U]={primitive:H,promise:q},Y.push(q)}}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?$1(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],k=Y[E],F,N=H[E];if(k.mode===X9.TRIANGLES||k.mode===X9.TRIANGLE_STRIP||k.mode===X9.TRIANGLE_FAN||k.mode===void 0){if(F=W.isSkinnedMesh===!0?new WQ(R,N):new FJ(R,N),F.isSkinnedMesh===!0)F.normalizeSkinWeights();if(k.mode===X9.TRIANGLE_STRIP)F.geometry=nZ(F.geometry,p6);else if(k.mode===X9.TRIANGLE_FAN)F.geometry=nZ(F.geometry,U6)}else if(k.mode===X9.LINES)F=new YQ(R,N);else if(k.mode===X9.LINE_STRIP)F=new O6(R,N);else if(k.mode===X9.LINE_LOOP)F=new XQ(R,N);else if(k.mode===X9.POINTS)F=new s9(R,N);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+k.mode);if(Object.keys(F.geometry.morphAttributes).length>0)W1(F,W);if(F.name=Q.createUniqueName(W.name||"mesh_"+J),f9(F,W),k.extensions)x8(Z,F,k);Q.assignFinalMaterial(F),G.push(F)}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)x8(Z,G[0],W);return G[0]}let q=new W9;if(W.extensions)x8(Z,q,W);Q.associations.set(q,{meshes:J});for(let E=0,O=G.length;E<O;E++)q.add(G[E]);return q})}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 MJ(G6.radToDeg(Z.yfov),Z.aspectRatio||1,Z.znear||1,Z.zfar||2000000);else if($.type==="orthographic")Q=new v8(-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 q=new S0;if(W!==null)q.fromArray(W.array,H*16);K.push(q)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',Q.joints[H])}return new c6(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,q=Z.channels.length;G<q;G++){let E=Z.channels[G],O=Z.samplers[E.sampler],R=E.target,k=R.node,F=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",k)),X.push(this.getDependency("accessor",F)),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 q=G[0],E=G[1],O=G[2],R=G[3],k=G[4],F=[];for(let D=0,B=q.length;D<B;D++){let C=q[D],T=E[D],P=O[D],_=R[D],L=k[D];if(C===void 0)continue;if(C.updateMatrix)C.updateMatrix();let z=$._createAnimationTracks(C,T,P,_,L);if(z)for(let S=0;S<z.length;S++)F.push(z[S])}let N=new $6(W,void 0,F);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],q=H[2];if(q!==null)U.traverse(function(E){if(!E.isSkinnedMesh)return;E.bind(q,K1)});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 l6;else if(H.length>1)U=new W9;else if(H.length===1)U=H[0];else U=new EJ;if(U!==H[0])for(let G=0,q=H.length;G<q;G++)U.add(H[G]);if(W.name)U.userData.name=W.name,U.name=Y;if(f9(U,W),W.extensions)x8($,U,W);if(W.matrix!==void 0){let G=new S0;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 W9;if($.name)W.name=Z.createUniqueName($.name);if(f9(W,$),$.extensions)x8(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 q=K[U];if(q.parent!==null)W.add(QK(q));else W.add(q)}let H=(U)=>{let G=new Map;for(let[q,E]of Z.associations)if(q instanceof eJ||q instanceof _J)G.set(q,E);return U.traverse((q)=>{let E=Z.associations.get(q);if(E!=null)G.set(q,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(N8[W.path]===N8.weights){if(H(J),J.isGroup)J.children.forEach(H)}else K.push(X);let U;switch(N8[W.path]){case N8.weights:U=c9;break;case N8.rotation:U=o9;break;case N8.translation:case N8.scale:U=n9;break;default:switch($.itemSize){case 1:U=c9;break;case 2:case 3:default:U=n9;break}break}let G=Z.interpolation!==void 0?Q1[Z.interpolation]:a7,q=this._getArrayFromAccessor($);for(let E=0,O=K.length;E<O;E++){let R=new U(K[E]+"."+N8[W.path],Q.array,q,G);if(Z.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(R);Y.push(R)}return Y}_getArrayFromAccessor(J){let Q=J.array;if(J.normalized){let $=tZ(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 o9?TK:JW)(this.times,this.values,this.getValueSize()/3,$)},J.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function H1(J,Q,$){let Z=Q.attributes,W=new nJ;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=tZ(z6[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 q=Y[U];if(q.POSITION!==void 0){let E=$.json.accessors[q.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 k=tZ(z6[E.componentType]);H.multiplyScalar(k)}K.max(H)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}W.expandByVector(K)}J.boundingBox=W;let X=new tJ;W.getCenter(X.center),X.radius=W.min.distanceTo(W.max)/2,J.boundingSphere=X}function XK(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=rZ[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(l0.workingColorSpace!==uJ&&"COLOR_0"in Z)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${l0.workingColorSpace}" not supported.`);return f9(J,Q),H1(J,Q,$),Promise.all(W).then(function(){return Q.targets!==void 0?Z1(J,Q.targets,$):J})}class QW extends FQ{constructor(J){super(J);this.type=bJ}parse(J){let Y=function(_,L){switch(_){case 1:throw Error("THREE.HDRLoader: Read Error: "+(L||""));case 2:throw Error("THREE.HDRLoader: Write Error: "+(L||""));case 3:throw Error("THREE.HDRLoader: Bad File Format: "+(L||""));default:case 4:throw Error("THREE.HDRLoader: Memory Error: "+(L||""))}},G=function(_,L,z){L=!L?1024:L;let I=_.pos,j=-1,b=0,v="",x=String.fromCharCode.apply(null,new Uint16Array(_.subarray(I,I+128)));while(0>(j=x.indexOf(`
4105
- `))&&b<L&&I<_.byteLength)v+=x,b+=x.length,I+=128,x=String.fromCharCode.apply(null,new Uint16Array(_.subarray(I,I+128)));if(-1<j){if(z!==!1)_.pos+=b+j+1;return v+x.slice(0,j)}return!1},q=function(_){let L=/^#\?(\S+)/,z=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,S=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,I=/^\s*FORMAT=(\S+)\s*$/,j=/^\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},v,x;if(_.pos>=_.byteLength||!(v=G(_)))Y(1,"no header found");if(!(x=v.match(L)))Y(3,"bad initial token");b.valid|=1,b.programtype=x[1],b.string+=v+`
4106
- `;while(!0){if(v=G(_),v===!1)break;if(b.string+=v+`
4107
- `,v.charAt(0)==="#"){b.comments+=v+`
4108
- `;continue}if(x=v.match(z))b.gamma=parseFloat(x[1]);if(x=v.match(S))b.exposure=parseFloat(x[1]);if(x=v.match(I))b.valid|=2,b.format=x[1];if(x=v.match(j))b.valid|=4,b.height=parseInt(x[1],10),b.width=parseInt(x[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(_,L,z){let S=L;if(S<8||S>32767||(_[0]!==2||_[1]!==2||_[2]&128))return new Uint8Array(_);if(S!==(_[2]<<8|_[3]))Y(3,"wrong scanline width");let I=new Uint8Array(4*L*z);if(!I.length)Y(4,"unable to allocate buffer space");let j=0,b=0,v=4*S,x=new Uint8Array(4),p=new Uint8Array(v),d=z;while(d>0&&b<_.byteLength){if(b+4>_.byteLength)Y(1);if(x[0]=_[b++],x[1]=_[b++],x[2]=_[b++],x[3]=_[b++],x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=S)Y(3,"bad rgbe scanline format");let n=0,r;while(n<v&&b<_.byteLength){r=_[b++];let R0=r>128;if(R0)r-=128;if(r===0||n+r>v)Y(3,"bad scanline data");if(R0){let G0=_[b++];for(let a0=0;a0<r;a0++)p[n++]=G0}else p.set(_.subarray(b,b+r),n),n+=r,b+=r}let Y0=S;for(let R0=0;R0<Y0;R0++){let G0=0;I[j]=p[R0+G0],G0+=S,I[j+1]=p[R0+G0],G0+=S,I[j+2]=p[R0+G0],G0+=S,I[j+3]=p[R0+G0],j+=4}d--}return I},O=function(_,L,z,S){let I=_[L+3],j=Math.pow(2,I-128)/255;z[S+0]=_[L+0]*j,z[S+1]=_[L+1]*j,z[S+2]=_[L+2]*j,z[S+3]=1},R=function(_,L,z,S){let I=_[L+3],j=Math.pow(2,I-128)/255;z[S+0]=T8.toHalfFloat(Math.min(_[L+0]*j,65504)),z[S+1]=T8.toHalfFloat(Math.min(_[L+1]*j,65504)),z[S+2]=T8.toHalfFloat(Math.min(_[L+2]*j,65504)),z[S+3]=T8.toHalfFloat(1)},k=new Uint8Array(J);k.pos=0;let F=q(k),N=F.width,D=F.height,B=E(k.subarray(k.pos),N,D),C,T,P;switch(this.type){case rJ:P=B.length/4;let _=new Float32Array(P*4);for(let z=0;z<P;z++)O(B,z*4,_,z*4);C=_,T=rJ;break;case bJ:P=B.length/4;let L=new Uint16Array(P*4);for(let z=0;z<P;z++)R(B,z*4,L,z*4);C=L,T=bJ;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:N,height:D,data:C,header:F.string,gamma:F.gamma,exposure:F.exposure,type:T}}setDataType(J){return this.type=J,this}load(J,Q,$,Z){function W(Y,X){switch(Y.type){case rJ:case bJ:Y.colorSpace=uJ,Y.minFilter=kJ,Y.magFilter=kJ,Y.generateMipmaps=!1,Y.flipY=!0;break}if(Q)Q(Y,X)}return super.load(J,W,$,Z)}}var X7=new A;function K9(J,Q,$,Z,W,Y){let X=2*Math.PI*W/4,K=Math.max(Y-2*W,0),H=Math.PI/4;X7.copy(Q),X7[Z]=0,X7.normalize();let U=0.5*X/(X+K),G=1-X7.angleTo(J)/H;if(Math.sign(X7[$])===1)return G*U;else return K/(X+K)+U+U*(1-G)}class TQ extends Y9{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,q=this.attributes.normal.array,E=this.attributes.uv.array,O=G.length/6,R=new A,k=0.5/Y;for(let F=0,N=0;F<G.length;F+=3,N+=2)switch(K.fromArray(G,F),H.copy(K),H.x-=Math.sign(H.x)*k,H.y-=Math.sign(H.y)*k,H.z-=Math.sign(H.z)*k,H.normalize(),G[F+0]=U.x*Math.sign(K.x)+H.x*W,G[F+1]=U.y*Math.sign(K.y)+H.y*W,G[F+2]=U.z*Math.sign(K.z)+H.z*W,q[F+0]=H.x,q[F+1]=H.y,q[F+2]=H.z,Math.floor(F/O)){case 0:R.set(1,0,0),E[N+0]=K9(R,H,"z","y",W,$),E[N+1]=1-K9(R,H,"y","z",W,Q);break;case 1:R.set(-1,0,0),E[N+0]=1-K9(R,H,"z","y",W,$),E[N+1]=1-K9(R,H,"y","z",W,Q);break;case 2:R.set(0,1,0),E[N+0]=1-K9(R,H,"x","z",W,J),E[N+1]=K9(R,H,"z","x",W,$);break;case 3:R.set(0,-1,0),E[N+0]=1-K9(R,H,"x","z",W,J),E[N+1]=1-K9(R,H,"z","x",W,$);break;case 4:R.set(0,0,1),E[N+0]=1-K9(R,H,"x","y",W,J),E[N+1]=1-K9(R,H,"y","x",W,Q);break;case 5:R.set(0,0,-1),E[N+0]=K9(R,H,"x","y",W,J),E[N+1]=1-K9(R,H,"y","x",W,Q);break}}static fromJSON(J){return new TQ(J.width,J.height,J.depth,J.segments,J.radius)}}class $W extends FJ{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 k0(Q.sunColor!==void 0?Q.sunColor:16777215),q=new k0(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:z9,k=Q.fog!==void 0?Q.fog:!1,F=new q9,N=new A,D=new A,B=new A,C=new S0,T=new A(0,0,-1),P=new JJ,_=new A,L=new A,z=new JJ,S=new S0,I=new MJ,j=new cJ(Z,W,{type:bJ}),b={name:"MirrorShader",uniforms:j8.merge([X0.fog,X0.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new S0},sunColor:{value:new k0(8355711)},sunDirection:{value:new A(0.70707,0.70707,0)},eye:{value:new A},waterColor:{value:new k0(5592405)}}]),vertexShader:`
4104
+ }`;class dX{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new GQ(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 SJ({vertexShader:i1,fragmentShader:o1,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new GJ(new M9(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class uX extends T9{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 dX,q={},N=Q.getContextAttributes(),L=null,M=null,k=[],_=[],P=new p0,V=null,D=new kJ;D.viewport=new QJ;let B=new kJ;B.viewport=new QJ;let A=[D,B],z=new _Z,S=null,y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(s){let Y0=k[s];if(Y0===void 0)Y0=new l6,k[s]=Y0;return Y0.getTargetRaySpace()},this.getControllerGrip=function(s){let Y0=k[s];if(Y0===void 0)Y0=new l6,k[s]=Y0;return Y0.getGripSpace()},this.getHand=function(s){let Y0=k[s];if(Y0===void 0)Y0=new l6,k[s]=Y0;return Y0.getHandSpace()};function v(s){let Y0=_.indexOf(s.inputSource);if(Y0===-1)return;let D0=k[Y0];if(D0!==void 0)D0.update(s.inputSource,s.frame,H||Y),D0.dispatchEvent({type:s.type,data:s.inputSource})}function h(){Z.removeEventListener("select",v),Z.removeEventListener("selectstart",v),Z.removeEventListener("selectend",v),Z.removeEventListener("squeeze",v),Z.removeEventListener("squeezestart",v),Z.removeEventListener("squeezeend",v),Z.removeEventListener("end",h),Z.removeEventListener("inputsourceschange",g);for(let s=0;s<k.length;s++){let Y0=_[s];if(Y0===null)continue;_[s]=null,k[s].disconnect(Y0)}S=null,y=null,C.reset();for(let s in q)delete q[s];J.setRenderTarget(L),E=null,F=null,G=null,Z=null,M=null,v0.stop(),$.isPresenting=!1,J.setPixelRatio(V),J.setSize(P.width,P.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",v),Z.addEventListener("selectstart",v),Z.addEventListener("selectend",v),Z.addEventListener("squeeze",v),Z.addEventListener("squeezestart",v),Z.addEventListener("squeezeend",v),Z.addEventListener("end",h),Z.addEventListener("inputsourceschange",g),N.xrCompatible!==!0)await Q.makeXRCompatible();if(V=J.getPixelRatio(),J.getSize(P),!(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),M=new nJ(E.framebufferWidth,E.framebufferHeight,{format:_9,type:D9,colorSpace:J.outputColorSpace,stencilBuffer:N.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}else{let D0=null,G0=null,w0=null;if(N.depth)w0=N.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,D0=N.stencil?w8:z8,G0=N.stencil?H6:K8;let i0={colorFormat:Q.RGBA8,depthFormat:w0,scaleFactor:W};G=this.getBinding(),F=G.createProjectionLayer(i0),Z.updateRenderState({layers:[F]}),J.setPixelRatio(1),J.setSize(F.textureWidth,F.textureHeight,!1),M=new nJ(F.textureWidth,F.textureHeight,{format:_9,type:D9,depthTexture:new U8(F.textureWidth,F.textureHeight,G0,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})}M.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 g(s){for(let Y0=0;Y0<s.removed.length;Y0++){let D0=s.removed[Y0],G0=_.indexOf(D0);if(G0>=0)_[G0]=null,k[G0].disconnect(D0)}for(let Y0=0;Y0<s.added.length;Y0++){let D0=s.added[Y0],G0=_.indexOf(D0);if(G0===-1){for(let i0=0;i0<k.length;i0++)if(i0>=_.length){_.push(D0),G0=i0;break}else if(_[i0]===null){_[i0]=D0,G0=i0;break}if(G0===-1)break}let w0=k[G0];if(w0)w0.connect(D0)}}let p=new j,c=new j;function a(s,Y0,D0){p.setFromMatrixPosition(Y0.matrixWorld),c.setFromMatrixPosition(D0.matrixWorld);let G0=p.distanceTo(c),w0=Y0.projectionMatrix.elements,i0=D0.projectionMatrix.elements,j0=w0[14]/(w0[10]-1),d0=w0[14]/(w0[10]+1),YJ=(w0[9]+1)/w0[5],XJ=(w0[9]-1)/w0[5],u0=(w0[8]-1)/w0[0],jJ=(i0[8]+1)/i0[0],vJ=j0*u0,CJ=j0*jJ,b=G0/(-u0+jJ),pJ=b*-u0;if(Y0.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(pJ),s.translateZ(b),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),w0[10]===-1)s.projectionMatrix.copy(Y0.projectionMatrix),s.projectionMatrixInverse.copy(Y0.projectionMatrixInverse);else{let a0=j0+b,t0=d0+b,O0=vJ-pJ,qJ=CJ+(G0-pJ),T0=YJ*d0/t0*a0,T=XJ*d0/t0*a0;s.projectionMatrix.makePerspective(O0,qJ,T0,T,a0,t0),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function Q0(s,Y0){if(Y0===null)s.matrixWorld.copy(s.matrix);else s.matrixWorld.multiplyMatrices(Y0.matrixWorld,s.matrix);s.matrixWorldInverse.copy(s.matrixWorld).invert()}this.updateCamera=function(s){if(Z===null)return;let{near:Y0,far:D0}=s;if(C.texture!==null){if(C.depthNear>0)Y0=C.depthNear;if(C.depthFar>0)D0=C.depthFar}if(z.near=B.near=D.near=Y0,z.far=B.far=D.far=D0,S!==z.near||y!==z.far)Z.updateRenderState({depthNear:z.near,depthFar:z.far}),S=z.near,y=z.far;z.layers.mask=s.layers.mask|6,D.layers.mask=z.layers.mask&-5,B.layers.mask=z.layers.mask&-3;let G0=s.parent,w0=z.cameras;Q0(z,G0);for(let i0=0;i0<w0.length;i0++)Q0(w0[i0],G0);if(w0.length===2)a(z,D,B);else z.projectionMatrix.copy(D.projectionMatrix);H0(s,z,G0)};function H0(s,Y0,D0){if(D0===null)s.matrix.copy(Y0.matrixWorld);else s.matrix.copy(D0.matrixWorld),s.matrix.invert(),s.matrix.multiply(Y0.matrixWorld);if(s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(Y0.projectionMatrix),s.projectionMatrixInverse.copy(Y0.projectionMatrixInverse),s.isPerspectiveCamera)s.fov=k8*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,Y0){if(U=Y0.getViewerPose(H||Y),O=Y0,U!==null){let D0=U.views;if(E!==null)J.setRenderTargetFramebuffer(M,E.framebuffer),J.setRenderTarget(M);let G0=!1;if(D0.length!==z.cameras.length)z.cameras.length=0,G0=!0;for(let d0=0;d0<D0.length;d0++){let YJ=D0[d0],XJ=null;if(E!==null)XJ=E.getViewport(YJ);else{let jJ=G.getViewSubImage(F,YJ);if(XJ=jJ.viewport,d0===0)J.setRenderTargetTextures(M,jJ.colorTexture,jJ.depthStencilTexture),J.setRenderTarget(M)}let u0=A[d0];if(u0===void 0)u0=new kJ,u0.layers.enable(d0),u0.viewport=new QJ,A[d0]=u0;if(u0.matrix.fromArray(YJ.transform.matrix),u0.matrix.decompose(u0.position,u0.quaternion,u0.scale),u0.projectionMatrix.fromArray(YJ.projectionMatrix),u0.projectionMatrixInverse.copy(u0.projectionMatrix).invert(),u0.viewport.set(XJ.x,XJ.y,XJ.width,XJ.height),d0===0)z.matrix.copy(u0.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale);if(G0===!0)z.cameras.push(u0)}let w0=Z.enabledFeatures;if(w0&&w0.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(w0&&w0.includes("camera-access")&&R){J.state.unbindTexture(),G=$.getBinding();for(let d0=0;d0<D0.length;d0++){let YJ=D0[d0].camera;if(YJ){let XJ=q[YJ];if(!XJ)XJ=new GQ,q[YJ]=XJ;let u0=G.getCameraImage(YJ);XJ.sourceTexture=u0}}}}for(let D0=0;D0<k.length;D0++){let G0=_[D0],w0=k[D0];if(G0!==null&&w0!==void 0)w0.update(G0,Y0,H||Y)}if(J0)J0(s,Y0);if(Y0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:Y0});O=null}let v0=new AX;v0.setAnimationLoop(x0),this.setAnimationLoop=function(s){J0=s},this.dispose=function(){}}}var a1=new S0,mX=new h0;mX.set(-1,0,0,0,1,0,0,0,1);function r1(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,LZ(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,M,k){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,k)}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,M);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===bJ)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===bJ)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),M=L.envMap,k=L.envMapRotation;if(M){if(q.envMap.value=M,q.envMapRotation.value.setFromMatrix4(a1.makeRotationFromEuler(k)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1)q.envMapRotation.value.premultiply(mX);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,M){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.size.value=N.size*L,q.scale.value=M*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===bJ)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 t1(J,Q,$,Z){let W={},Y={},X=[],K=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function H(L,M){let k=M.program;Z.uniformBlockBinding(L,k)}function U(L,M){let k=W[L.id];if(k===void 0)R(L),k=G(L),W[L.id]=k,L.addEventListener("dispose",q);let _=M.program;Z.updateUBOMapping(L,_);let P=Q.render.frame;if(Y[L.id]!==P)E(L),Y[L.id]=P}function G(L){let M=F();L.__bindingPointIndex=M;let k=J.createBuffer(),_=L.__size,P=L.usage;return J.bindBuffer(J.UNIFORM_BUFFER,k),J.bufferData(J.UNIFORM_BUFFER,_,P),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,M,k),k}function F(){for(let L=0;L<K;L++)if(X.indexOf(L)===-1)return X.push(L),L;return A0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(L){let M=W[L.id],k=L.uniforms,_=L.__cache;J.bindBuffer(J.UNIFORM_BUFFER,M);for(let P=0,V=k.length;P<V;P++){let D=Array.isArray(k[P])?k[P]:[k[P]];for(let B=0,A=D.length;B<A;B++){let z=D[B];if(O(z,P,B,_)===!0){let S=z.__offset,y=Array.isArray(z.value)?z.value:[z.value],v=0;for(let h=0;h<y.length;h++){let g=y[h],p=C(g);if(typeof g==="number"||typeof g==="boolean")z.__data[0]=g,J.bufferSubData(J.UNIFORM_BUFFER,S+v,z.__data);else if(g.isMatrix3)z.__data[0]=g.elements[0],z.__data[1]=g.elements[1],z.__data[2]=g.elements[2],z.__data[3]=0,z.__data[4]=g.elements[3],z.__data[5]=g.elements[4],z.__data[6]=g.elements[5],z.__data[7]=0,z.__data[8]=g.elements[6],z.__data[9]=g.elements[7],z.__data[10]=g.elements[8],z.__data[11]=0;else if(ArrayBuffer.isView(g))z.__data.set(new g.constructor(g.buffer,g.byteOffset,z.__data.length));else g.toArray(z.__data,v),v+=p.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,S,z.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function O(L,M,k,_){let P=L.value,V=M+"_"+k;if(_[V]===void 0){if(typeof P==="number"||typeof P==="boolean")_[V]=P;else if(ArrayBuffer.isView(P))_[V]=P.slice();else _[V]=P.clone();return!0}else{let D=_[V];if(typeof P==="number"||typeof P==="boolean"){if(D!==P)return _[V]=P,!0}else if(ArrayBuffer.isView(P))return!0;else if(D.equals(P)===!1)return D.copy(P),!0}return!1}function R(L){let M=L.uniforms,k=0,_=16;for(let V=0,D=M.length;V<D;V++){let B=Array.isArray(M[V])?M[V]:[M[V]];for(let A=0,z=B.length;A<z;A++){let S=B[A],y=Array.isArray(S.value)?S.value:[S.value];for(let v=0,h=y.length;v<h;v++){let g=y[v],p=C(g),c=k%_,a=c%p.boundary,Q0=c+a;if(k+=a,Q0!==0&&_-Q0<p.storage)k+=_-Q0;S.__data=new Float32Array(p.storage/Float32Array.BYTES_PER_ELEMENT),S.__offset=k,k+=p.storage}}}let P=k%_;if(P>0)k+=_-P;return L.__size=k,L.__cache={},this}function C(L){let M={boundary:0,storage:0};if(typeof L==="number"||typeof L==="boolean")M.boundary=4,M.storage=4;else if(L.isVector2)M.boundary=8,M.storage=8;else if(L.isVector3||L.isColor)M.boundary=16,M.storage=12;else if(L.isVector4)M.boundary=16,M.storage=16;else if(L.isMatrix3)M.boundary=48,M.storage=48;else if(L.isMatrix4)M.boundary=64,M.storage=64;else if(L.isTexture)C0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(L))M.boundary=16,M.storage=L.byteLength;else C0("WebGLRenderer: Unsupported uniform value type.",L);return M}function q(L){let M=L.target;M.removeEventListener("dispose",q);let k=X.indexOf(M.__bindingPointIndex);X.splice(k,1),J.deleteBuffer(W[M.id]),delete W[M.id],delete Y[M.id]}function N(){for(let L in W)J.deleteBuffer(W[L]);X=[],W={},Y={}}return{bind:H,update:U,dispose:N}}var e1=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]),v9=null;function JF(){if(v9===null)v9=new O6(e1,16,16,P8,fJ),v9.name="DFG_LUT",v9.minFilter=BJ,v9.magFilter=BJ,v9.wrapS=X6,v9.wrapT=X6,v9.generateMipmaps=!1,v9.needsUpdate=!0;return v9}class lZ{constructor(J={}){let{canvas:Q=aY(),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=D9}=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([P$,w$,z$]),q=new Set([D9,K8,d6,H6,C$,I$]),N=new Uint32Array(4),L=new Int32Array(4),M=new j,k=null,_=null,P=[],V=[],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=rJ,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let B=this,A=!1,z=null;this._outputColorSpace=H8;let S=0,y=0,v=null,h=-1,g=null,p=new QJ,c=new QJ,a=null,Q0=new R0(0),H0=0,J0=Q.width,x0=Q.height,v0=1,s=null,Y0=null,D0=new QJ(0,0,J0,x0),G0=new QJ(0,0,J0,x0),w0=!1,i0=new A8,j0=!1,d0=!1,YJ=new S0,XJ=new j,u0=new QJ,jJ={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},vJ=!1;function CJ(){return v===null?v0:1}let b=$;function pJ(w,f){return Q.getContext(w,f)}try{let w={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${$Y}`);if(Q.addEventListener("webglcontextlost",V0,!1),Q.addEventListener("webglcontextrestored",e,!1),Q.addEventListener("webglcontextcreationerror",z0,!1),b===null){if(b=pJ("webgl2",w),b===null)if(pJ("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(w){throw A0("WebGLRenderer: "+w.message),w}let a0,t0,O0,qJ,T0,T,I,d,r,t,$0,E0,n,o,K0,B0,W0,F0,y0,g0,c0,x,X0;function i(){if(a0=new KE(b),a0.init(),c0=new s1(b,a0),t0=new e5(b,a0,J,c0),O0=new c1(b,a0),t0.reversedDepthBuffer&&F)O0.buffers.depth.setReversed(!0);qJ=new GE(b),T0=new S1,T=new n1(b,a0,O0,T0,t0,c0,qJ),I=new XE(B),d=new OU(b),x=new r5(b,d),r=new HE(b,d,qJ,x),t=new FE(b,r,d,x,qJ),F0=new EE(b,t0,T),K0=new JE(T0),$0=new A1(B,I,a0,t0,x,K0),E0=new r1(B,T0),n=new v1,o=new g1(a0),W0=new a5(B,I,O0,t,O,K),B0=new l1(B,t,t0),X0=new t1(b,qJ,t0,O0),y0=new t5(b,a0,qJ),g0=new UE(b,a0,qJ),qJ.programs=$0.programs,B.capabilities=t0,B.extensions=a0,B.properties=T0,B.renderLists=n,B.shadowMap=B0,B.state=O0,B.info=qJ}if(i(),R!==D9)D=new OE(R,Q.width,Q.height,Z,W);let Z0=new uX(B,b);this.xr=Z0,this.getContext=function(){return b},this.getContextAttributes=function(){return b.getContextAttributes()},this.forceContextLoss=function(){let w=a0.get("WEBGL_lose_context");if(w)w.loseContext()},this.forceContextRestore=function(){let w=a0.get("WEBGL_lose_context");if(w)w.restoreContext()},this.getPixelRatio=function(){return v0},this.setPixelRatio=function(w){if(w===void 0)return;v0=w,this.setSize(J0,x0,!1)},this.getSize=function(w){return w.set(J0,x0)},this.setSize=function(w,f,l=!0){if(Z0.isPresenting){C0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(J0=w,x0=f,Q.width=Math.floor(w*v0),Q.height=Math.floor(f*v0),l===!0)Q.style.width=w+"px",Q.style.height=f+"px";if(D!==null)D.setSize(Q.width,Q.height);this.setViewport(0,0,w,f)},this.getDrawingBufferSize=function(w){return w.set(J0*v0,x0*v0).floor()},this.setDrawingBufferSize=function(w,f,l){J0=w,x0=f,v0=l,Q.width=Math.floor(w*l),Q.height=Math.floor(f*l),this.setViewport(0,0,w,f)},this.setEffects=function(w){if(R===D9){A0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(w){for(let f=0;f<w.length;f++)if(w[f].isOutputPass===!0){C0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}D.setEffects(w||[])},this.getCurrentViewport=function(w){return w.copy(p)},this.getViewport=function(w){return w.copy(D0)},this.setViewport=function(w,f,l,u){if(w.isVector4)D0.set(w.x,w.y,w.z,w.w);else D0.set(w,f,l,u);O0.viewport(p.copy(D0).multiplyScalar(v0).round())},this.getScissor=function(w){return w.copy(G0)},this.setScissor=function(w,f,l,u){if(w.isVector4)G0.set(w.x,w.y,w.z,w.w);else G0.set(w,f,l,u);O0.scissor(c.copy(G0).multiplyScalar(v0).round())},this.getScissorTest=function(){return w0},this.setScissorTest=function(w){O0.setScissorTest(w0=w)},this.setOpaqueSort=function(w){s=w},this.setTransparentSort=function(w){Y0=w},this.getClearColor=function(w){return w.copy(W0.getClearColor())},this.setClearColor=function(){W0.setClearColor(...arguments)},this.getClearAlpha=function(){return W0.getClearAlpha()},this.setClearAlpha=function(){W0.setClearAlpha(...arguments)},this.clear=function(w=!0,f=!0,l=!0){let u=0;if(w){let m=!1;if(v!==null){let q0=v.texture.format;m=C.has(q0)}if(m){let q0=v.texture.type,k0=q.has(q0),N0=W0.getClearColor(),I0=W0.getClearAlpha(),P0=N0.r,f0=N0.g,n0=N0.b;if(k0)N[0]=P0,N[1]=f0,N[2]=n0,N[3]=I0,b.clearBufferuiv(b.COLOR,0,N);else L[0]=P0,L[1]=f0,L[2]=n0,L[3]=I0,b.clearBufferiv(b.COLOR,0,L)}else u|=b.COLOR_BUFFER_BIT}if(f)u|=b.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(l)u|=b.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(u!==0)b.clear(u)},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(w){w.setRenderer(this),z=w},this.dispose=function(){Q.removeEventListener("webglcontextlost",V0,!1),Q.removeEventListener("webglcontextrestored",e,!1),Q.removeEventListener("webglcontextcreationerror",z0,!1),W0.dispose(),n.dispose(),o.dispose(),T0.dispose(),I.dispose(),t.dispose(),x.dispose(),X0.dispose(),$0.dispose(),Z0.dispose(),Z0.removeEventListener("sessionstart",GW),Z0.removeEventListener("sessionend",EW),q8.stop()};function V0(w){w.preventDefault(),x6("WebGLRenderer: Context Lost."),A=!0}function e(){x6("WebGLRenderer: Context Restored."),A=!1;let w=qJ.autoReset,f=B0.enabled,l=B0.autoUpdate,u=B0.needsUpdate,m=B0.type;i(),qJ.autoReset=w,B0.enabled=f,B0.autoUpdate=l,B0.needsUpdate=u,B0.type=m}function z0(w){A0("WebGLRenderer: A WebGL context could not be created. Reason: ",w.statusMessage)}function b0(w){let f=w.target;f.removeEventListener("dispose",b0),IJ(f)}function IJ(w){ZJ(w),T0.remove(w)}function ZJ(w){let f=T0.get(w).programs;if(f!==void 0){if(f.forEach(function(l){$0.releaseProgram(l)}),w.isShaderMaterial)$0.releaseShaderCache(w)}}this.renderBufferDirect=function(w,f,l,u,m,q0){if(f===null)f=jJ;let k0=m.isMesh&&m.matrixWorld.determinant()<0,N0=WH(w,f,l,u,m);O0.setMaterial(u,k0);let I0=l.index,P0=1;if(u.wireframe===!0){if(I0=r.getWireframeAttribute(l),I0===void 0)return;P0=2}let f0=l.drawRange,n0=l.attributes.position,_0=f0.start*P0,WJ=(f0.start+f0.count)*P0;if(q0!==null)_0=Math.max(_0,q0.start*P0),WJ=Math.min(WJ,(q0.start+q0.count)*P0);if(I0!==null)_0=Math.max(_0,0),WJ=Math.min(WJ,I0.count);else if(n0!==void 0&&n0!==null)_0=Math.max(_0,0),WJ=Math.min(WJ,n0.count);let DJ=WJ-_0;if(DJ<0||DJ===1/0)return;x.setup(m,u,N0,l,I0);let LJ,KJ=y0;if(I0!==null)LJ=d.get(I0),KJ=g0,KJ.setIndex(LJ);if(m.isMesh)if(u.wireframe===!0)O0.setLineWidth(u.wireframeLinewidth*CJ()),KJ.setMode(b.LINES);else KJ.setMode(b.TRIANGLES);else if(m.isLine){let yJ=u.linewidth;if(yJ===void 0)yJ=1;if(O0.setLineWidth(yJ*CJ()),m.isLineSegments)KJ.setMode(b.LINES);else if(m.isLineLoop)KJ.setMode(b.LINE_LOOP);else KJ.setMode(b.LINE_STRIP)}else if(m.isPoints)KJ.setMode(b.POINTS);else if(m.isSprite)KJ.setMode(b.TRIANGLES);if(m.isBatchedMesh)if(!a0.get("WEBGL_multi_draw")){let{_multiDrawStarts:yJ,_multiDrawCounts:M0,_multiDrawCount:iJ}=m,r0=I0?d.get(I0).bytesPerElement:1,Q9=T0.get(u).currentProgram.getUniforms();for(let V9=0;V9<iJ;V9++)Q9.setValue(b,"_gl_DrawID",V9),KJ.render(yJ[V9]/r0,M0[V9])}else KJ.renderMultiDraw(m._multiDrawStarts,m._multiDrawCounts,m._multiDrawCount);else if(m.isInstancedMesh)KJ.renderInstances(_0,DJ,m.count);else if(l.isInstancedBufferGeometry){let yJ=l._maxInstanceCount!==void 0?l._maxInstanceCount:1/0,M0=Math.min(l.instanceCount,yJ);KJ.renderInstances(_0,DJ,M0)}else KJ.render(_0,DJ)};function B9(w,f,l){if(w.transparent===!0&&w.side===cJ&&w.forceSinglePass===!1)w.side=bJ,w.needsUpdate=!0,F7(w,f,l),w.side=z9,w.needsUpdate=!0,F7(w,f,l),w.side=cJ;else F7(w,f,l)}this.compile=function(w,f,l=null){if(l===null)l=w;if(_=o.get(l),_.init(f),V.push(_),l.traverseVisible(function(m){if(m.isLight&&m.layers.test(f.layers)){if(_.pushLight(m),m.castShadow)_.pushShadow(m)}}),w!==l)w.traverseVisible(function(m){if(m.isLight&&m.layers.test(f.layers)){if(_.pushLight(m),m.castShadow)_.pushShadow(m)}});_.setupLights();let u=new Set;return w.traverse(function(m){if(!(m.isMesh||m.isPoints||m.isLine||m.isSprite))return;let q0=m.material;if(q0)if(Array.isArray(q0))for(let k0=0;k0<q0.length;k0++){let N0=q0[k0];B9(N0,l,m),u.add(N0)}else B9(q0,l,m),u.add(q0)}),_=V.pop(),u},this.compileAsync=function(w,f,l=null){let u=this.compile(w,f,l);return new Promise((m)=>{function q0(){if(u.forEach(function(k0){if(T0.get(k0).currentProgram.isReady())u.delete(k0)}),u.size===0){m(w);return}setTimeout(q0,10)}if(a0.get("KHR_parallel_shader_compile")!==null)q0();else setTimeout(q0,10)})};let G9=null;function $H(w){if(G9)G9(w)}function GW(){q8.stop()}function EW(){q8.start()}let q8=new AX;if(q8.setAnimationLoop($H),typeof self<"u")q8.setContext(self);this.setAnimationLoop=function(w){G9=w,Z0.setAnimationLoop(w),w===null?q8.stop():q8.start()},Z0.addEventListener("sessionstart",GW),Z0.addEventListener("sessionend",EW),this.render=function(w,f){if(f!==void 0&&f.isCamera!==!0){A0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;if(z!==null)z.renderStart(w,f);let l=Z0.enabled===!0&&Z0.isPresenting===!0,u=D!==null&&(v===null||l)&&D.begin(B,v);if(w.matrixWorldAutoUpdate===!0)w.updateMatrixWorld();if(f.parent===null&&f.matrixWorldAutoUpdate===!0)f.updateMatrixWorld();if(Z0.enabled===!0&&Z0.isPresenting===!0&&(D===null||D.isCompositing()===!1)){if(Z0.cameraAutoUpdate===!0)Z0.updateCamera(f);f=Z0.getCamera()}if(w.isScene===!0)w.onBeforeRender(B,w,f,v);if(_=o.get(w,V.length),_.init(f),_.state.textureUnits=T.getTextureUnits(),V.push(_),YJ.multiplyMatrices(f.projectionMatrix,f.matrixWorldInverse),i0.setFromProjectionMatrix(YJ,UZ,f.reversedDepth),d0=this.localClippingEnabled,j0=K0.init(this.clippingPlanes,d0),k=n.get(w,P.length),k.init(),P.push(k),Z0.enabled===!0&&Z0.isPresenting===!0){let k0=B.xr.getDepthSensingMesh();if(k0!==null)hQ(k0,f,-1/0,B.sortObjects)}if(hQ(w,f,0,B.sortObjects),k.finish(),B.sortObjects===!0)k.sort(s,Y0);if(vJ=Z0.enabled===!1||Z0.isPresenting===!1||Z0.hasDepthSensing()===!1,vJ)W0.addToRenderList(k,w);if(this.info.render.frame++,j0===!0)K0.beginShadows();let m=_.state.shadowsArray;if(B0.render(m,w,f),j0===!0)K0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((u&&D.hasRenderPass())===!1){let{opaque:k0,transmissive:N0}=k;if(_.setupLights(),f.isArrayCamera){let I0=f.cameras;if(N0.length>0)for(let P0=0,f0=I0.length;P0<f0;P0++){let n0=I0[P0];NW(k0,N0,w,n0)}if(vJ)W0.render(w);for(let P0=0,f0=I0.length;P0<f0;P0++){let n0=I0[P0];FW(k,w,n0,n0.viewport)}}else{if(N0.length>0)NW(k0,N0,w,f);if(vJ)W0.render(w);FW(k,w,f)}}if(v!==null&&y===0)T.updateMultisampleRenderTarget(v),T.updateRenderTargetMipmap(v);if(u)D.end(B);if(w.isScene===!0)w.onAfterRender(B,w,f);if(x.resetDefaultState(),h=-1,g=null,V.pop(),V.length>0){if(_=V[V.length-1],T.setTextureUnits(_.state.textureUnits),j0===!0)K0.setGlobalState(B.clippingPlanes,_.state.camera)}else _=null;if(P.pop(),P.length>0)k=P[P.length-1];else k=null;if(z!==null)z.renderEnd()};function hQ(w,f,l,u){if(w.visible===!1)return;if(w.layers.test(f.layers)){if(w.isGroup)l=w.renderOrder;else if(w.isLOD){if(w.autoUpdate===!0)w.update(f)}else if(w.isLightProbeGrid)_.pushLightProbeGrid(w);else if(w.isLight){if(_.pushLight(w),w.castShadow)_.pushShadow(w)}else if(w.isSprite){if(!w.frustumCulled||i0.intersectsSprite(w)){if(u)u0.setFromMatrixPosition(w.matrixWorld).applyMatrix4(YJ);let k0=t.update(w),N0=w.material;if(N0.visible)k.push(w,k0,N0,l,u0.z,null)}}else if(w.isMesh||w.isLine||w.isPoints){if(!w.frustumCulled||i0.intersectsObject(w)){let k0=t.update(w),N0=w.material;if(u){if(w.boundingSphere!==void 0){if(w.boundingSphere===null)w.computeBoundingSphere();u0.copy(w.boundingSphere.center)}else{if(k0.boundingSphere===null)k0.computeBoundingSphere();u0.copy(k0.boundingSphere.center)}u0.applyMatrix4(w.matrixWorld).applyMatrix4(YJ)}if(Array.isArray(N0)){let I0=k0.groups;for(let P0=0,f0=I0.length;P0<f0;P0++){let n0=I0[P0],_0=N0[n0.materialIndex];if(_0&&_0.visible)k.push(w,k0,_0,l,u0.z,n0)}}else if(N0.visible)k.push(w,k0,N0,l,u0.z,null)}}}let q0=w.children;for(let k0=0,N0=q0.length;k0<N0;k0++)hQ(q0[k0],f,l,u)}function FW(w,f,l,u){let{opaque:m,transmissive:q0,transparent:k0}=w;if(_.setupLightsView(l),j0===!0)K0.setGlobalState(B.clippingPlanes,l);if(u)O0.viewport(p.copy(u));if(m.length>0)E7(m,f,l);if(q0.length>0)E7(q0,f,l);if(k0.length>0)E7(k0,f,l);O0.buffers.depth.setTest(!0),O0.buffers.depth.setMask(!0),O0.buffers.color.setMask(!0),O0.setPolygonOffset(!1)}function NW(w,f,l,u){if((l.isScene===!0?l.overrideMaterial:null)!==null)return;if(_.state.transmissionRenderTarget[u.id]===void 0){let _0=a0.has("EXT_color_buffer_half_float")||a0.has("EXT_color_buffer_float");_.state.transmissionRenderTarget[u.id]=new nJ(1,1,{generateMipmaps:!0,type:_0?fJ:D9,minFilter:P9,samples:Math.max(4,t0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:s0.workingColorSpace})}let q0=_.state.transmissionRenderTarget[u.id],k0=u.viewport||p;q0.setSize(k0.z*B.transmissionResolutionScale,k0.w*B.transmissionResolutionScale);let N0=B.getRenderTarget(),I0=B.getActiveCubeFace(),P0=B.getActiveMipmapLevel();if(B.setRenderTarget(q0),B.getClearColor(Q0),H0=B.getClearAlpha(),H0<1)B.setClearColor(16777215,0.5);if(B.clear(),vJ)W0.render(l);let f0=B.toneMapping;B.toneMapping=rJ;let n0=u.viewport;if(u.viewport!==void 0)u.viewport=void 0;if(_.setupLightsView(u),j0===!0)K0.setGlobalState(B.clippingPlanes,u);if(E7(w,l,u),T.updateMultisampleRenderTarget(q0),T.updateRenderTargetMipmap(q0),a0.has("WEBGL_multisampled_render_to_texture")===!1){let _0=!1;for(let WJ=0,DJ=f.length;WJ<DJ;WJ++){let LJ=f[WJ],{object:KJ,geometry:yJ,material:M0,group:iJ}=LJ;if(M0.side===cJ&&KJ.layers.test(u.layers)){let r0=M0.side;M0.side=bJ,M0.needsUpdate=!0,OW(KJ,l,u,yJ,M0,iJ),M0.side=r0,M0.needsUpdate=!0,_0=!0}}if(_0===!0)T.updateMultisampleRenderTarget(q0),T.updateRenderTargetMipmap(q0)}if(B.setRenderTarget(N0,I0,P0),B.setClearColor(Q0,H0),n0!==void 0)u.viewport=n0;B.toneMapping=f0}function E7(w,f,l){let u=f.isScene===!0?f.overrideMaterial:null;for(let m=0,q0=w.length;m<q0;m++){let k0=w[m],{object:N0,geometry:I0,group:P0}=k0,f0=k0.material;if(f0.allowOverride===!0&&u!==null)f0=u;if(N0.layers.test(l.layers))OW(N0,f,l,I0,f0,P0)}}function OW(w,f,l,u,m,q0){if(w.onBeforeRender(B,f,l,u,m,q0),w.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,w.matrixWorld),w.normalMatrix.getNormalMatrix(w.modelViewMatrix),m.onBeforeRender(B,f,l,u,w,q0),m.transparent===!0&&m.side===cJ&&m.forceSinglePass===!1)m.side=bJ,m.needsUpdate=!0,B.renderBufferDirect(l,f,u,m,w,q0),m.side=z9,m.needsUpdate=!0,B.renderBufferDirect(l,f,u,m,w,q0),m.side=cJ;else B.renderBufferDirect(l,f,u,m,w,q0);w.onAfterRender(B,f,l,u,m,q0)}function F7(w,f,l){if(f.isScene!==!0)f=jJ;let u=T0.get(w),m=_.state.lights,q0=_.state.shadowsArray,k0=m.state.version,N0=$0.getParameters(w,m.state,q0,f,l,_.state.lightProbeGridArray),I0=$0.getProgramCacheKey(N0),P0=u.programs;u.environment=w.isMeshStandardMaterial||w.isMeshLambertMaterial||w.isMeshPhongMaterial?f.environment:null,u.fog=f.fog;let f0=w.isMeshStandardMaterial||w.isMeshLambertMaterial&&!w.envMap||w.isMeshPhongMaterial&&!w.envMap;if(u.envMap=I.get(w.envMap||u.environment,f0),u.envMapRotation=u.environment!==null&&w.envMap===null?f.environmentRotation:w.envMapRotation,P0===void 0)w.addEventListener("dispose",b0),P0=new Map,u.programs=P0;let n0=P0.get(I0);if(n0!==void 0){if(u.currentProgram===n0&&u.lightsStateVersion===k0)return RW(w,N0),n0}else{if(N0.uniforms=$0.getUniforms(w),z!==null&&w.isNodeMaterial)z.build(w,l,N0);w.onBeforeCompile(N0,B),n0=$0.acquireProgram(N0,I0),P0.set(I0,n0),u.uniforms=N0.uniforms}let _0=u.uniforms;if(!w.isShaderMaterial&&!w.isRawShaderMaterial||w.clipping===!0)_0.clippingPlanes=K0.uniform;if(RW(w,N0),u.needsLights=XH(w),u.lightsStateVersion=k0,u.needsLights)_0.ambientLightColor.value=m.state.ambient,_0.lightProbe.value=m.state.probe,_0.directionalLights.value=m.state.directional,_0.directionalLightShadows.value=m.state.directionalShadow,_0.spotLights.value=m.state.spot,_0.spotLightShadows.value=m.state.spotShadow,_0.rectAreaLights.value=m.state.rectArea,_0.ltc_1.value=m.state.rectAreaLTC1,_0.ltc_2.value=m.state.rectAreaLTC2,_0.pointLights.value=m.state.point,_0.pointLightShadows.value=m.state.pointShadow,_0.hemisphereLights.value=m.state.hemi,_0.directionalShadowMatrix.value=m.state.directionalShadowMatrix,_0.spotLightMatrix.value=m.state.spotLightMatrix,_0.spotLightMap.value=m.state.spotLightMap,_0.pointShadowMatrix.value=m.state.pointShadowMatrix;return u.lightProbeGrid=_.state.lightProbeGridArray.length>0,u.currentProgram=n0,u.uniformsList=null,n0}function qW(w){if(w.uniformsList===null){let f=w.currentProgram.getUniforms();w.uniformsList=W7.seqWithValue(f.seq,w.uniforms)}return w.uniformsList}function RW(w,f){let l=T0.get(w);l.outputColorSpace=f.outputColorSpace,l.batching=f.batching,l.batchingColor=f.batchingColor,l.instancing=f.instancing,l.instancingColor=f.instancingColor,l.instancingMorph=f.instancingMorph,l.skinning=f.skinning,l.morphTargets=f.morphTargets,l.morphNormals=f.morphNormals,l.morphColors=f.morphColors,l.morphTargetsCount=f.morphTargetsCount,l.numClippingPlanes=f.numClippingPlanes,l.numIntersection=f.numClipIntersection,l.vertexAlphas=f.vertexAlphas,l.vertexTangents=f.vertexTangents,l.toneMapping=f.toneMapping}function ZH(w,f){if(w.length===0)return null;if(w.length===1)return w[0].texture!==null?w[0]:null;M.setFromMatrixPosition(f.matrixWorld);for(let l=0,u=w.length;l<u;l++){let m=w[l];if(m.texture!==null&&m.boundingBox.containsPoint(M))return m}return null}function WH(w,f,l,u,m){if(f.isScene!==!0)f=jJ;T.resetTextureUnits();let q0=f.fog,k0=u.isMeshStandardMaterial||u.isMeshLambertMaterial||u.isMeshPhongMaterial?f.environment:null,N0=v===null?B.outputColorSpace:v.isXRRenderTarget===!0?v.texture.colorSpace:s0.workingColorSpace,I0=u.isMeshStandardMaterial||u.isMeshLambertMaterial&&!u.envMap||u.isMeshPhongMaterial&&!u.envMap,P0=I.get(u.envMap||k0,I0),f0=u.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,n0=!!l.attributes.tangent&&(!!u.normalMap||u.anisotropy>0),_0=!!l.morphAttributes.position,WJ=!!l.morphAttributes.normal,DJ=!!l.morphAttributes.color,LJ=rJ;if(u.toneMapped){if(v===null||v.isXRRenderTarget===!0)LJ=B.toneMapping}let KJ=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,yJ=KJ!==void 0?KJ.length:0,M0=T0.get(u),iJ=_.state.lights;if(j0===!0){if(d0===!0||w!==g){let EJ=w===g&&u.id===h;K0.setState(u,w,EJ)}}let r0=!1;if(u.version===M0.__version){if(M0.needsLights&&M0.lightsStateVersion!==iJ.state.version)r0=!0;else if(M0.outputColorSpace!==N0)r0=!0;else if(m.isBatchedMesh&&M0.batching===!1)r0=!0;else if(!m.isBatchedMesh&&M0.batching===!0)r0=!0;else if(m.isBatchedMesh&&M0.batchingColor===!0&&m.colorTexture===null)r0=!0;else if(m.isBatchedMesh&&M0.batchingColor===!1&&m.colorTexture!==null)r0=!0;else if(m.isInstancedMesh&&M0.instancing===!1)r0=!0;else if(!m.isInstancedMesh&&M0.instancing===!0)r0=!0;else if(m.isSkinnedMesh&&M0.skinning===!1)r0=!0;else if(!m.isSkinnedMesh&&M0.skinning===!0)r0=!0;else if(m.isInstancedMesh&&M0.instancingColor===!0&&m.instanceColor===null)r0=!0;else if(m.isInstancedMesh&&M0.instancingColor===!1&&m.instanceColor!==null)r0=!0;else if(m.isInstancedMesh&&M0.instancingMorph===!0&&m.morphTexture===null)r0=!0;else if(m.isInstancedMesh&&M0.instancingMorph===!1&&m.morphTexture!==null)r0=!0;else if(M0.envMap!==P0)r0=!0;else if(u.fog===!0&&M0.fog!==q0)r0=!0;else if(M0.numClippingPlanes!==void 0&&(M0.numClippingPlanes!==K0.numPlanes||M0.numIntersection!==K0.numIntersection))r0=!0;else if(M0.vertexAlphas!==f0)r0=!0;else if(M0.vertexTangents!==n0)r0=!0;else if(M0.morphTargets!==_0)r0=!0;else if(M0.morphNormals!==WJ)r0=!0;else if(M0.morphColors!==DJ)r0=!0;else if(M0.toneMapping!==LJ)r0=!0;else if(M0.morphTargetsCount!==yJ)r0=!0;else if(!!M0.lightProbeGrid!==_.state.lightProbeGridArray.length>0)r0=!0}else r0=!0,M0.__version=u.version;let Q9=M0.currentProgram;if(r0===!0){if(Q9=F7(u,f,m),z&&u.isNodeMaterial)z.onUpdateProgram(u,Q9,M0)}let V9=!1,r9=!1,b8=!1,HJ=Q9.getUniforms(),MJ=M0.uniforms;if(O0.useProgram(Q9.program))V9=!0,r9=!0,b8=!0;if(u.id!==h)h=u.id,r9=!0;if(M0.needsLights){let EJ=ZH(_.state.lightProbeGridArray,m);if(M0.lightProbeGrid!==EJ)M0.lightProbeGrid=EJ,r9=!0}if(V9||g!==w){if(O0.buffers.depth.getReversed()&&w.reversedDepth!==!0)w._reversedDepth=!0,w.updateProjectionMatrix();HJ.setValue(b,"projectionMatrix",w.projectionMatrix),HJ.setValue(b,"viewMatrix",w.matrixWorldInverse);let e9=HJ.map.cameraPosition;if(e9!==void 0)e9.setValue(b,XJ.setFromMatrixPosition(w.matrixWorld));if(t0.logarithmicDepthBuffer)HJ.setValue(b,"logDepthBufFC",2/(Math.log(w.far+1)/Math.LN2));if(u.isMeshPhongMaterial||u.isMeshToonMaterial||u.isMeshLambertMaterial||u.isMeshBasicMaterial||u.isMeshStandardMaterial||u.isShaderMaterial)HJ.setValue(b,"isOrthographic",w.isOrthographicCamera===!0);if(g!==w)g=w,r9=!0,b8=!0}if(M0.needsLights){if(iJ.state.directionalShadowMap.length>0)HJ.setValue(b,"directionalShadowMap",iJ.state.directionalShadowMap,T);if(iJ.state.spotShadowMap.length>0)HJ.setValue(b,"spotShadowMap",iJ.state.spotShadowMap,T);if(iJ.state.pointShadowMap.length>0)HJ.setValue(b,"pointShadowMap",iJ.state.pointShadowMap,T)}if(m.isSkinnedMesh){HJ.setOptional(b,m,"bindMatrix"),HJ.setOptional(b,m,"bindMatrixInverse");let EJ=m.skeleton;if(EJ){if(EJ.boneTexture===null)EJ.computeBoneTexture();HJ.setValue(b,"boneTexture",EJ.boneTexture,T)}}if(m.isBatchedMesh){if(HJ.setOptional(b,m,"batchingTexture"),HJ.setValue(b,"batchingTexture",m._matricesTexture,T),HJ.setOptional(b,m,"batchingIdTexture"),HJ.setValue(b,"batchingIdTexture",m._indirectTexture,T),HJ.setOptional(b,m,"batchingColorTexture"),m._colorsTexture!==null)HJ.setValue(b,"batchingColorTexture",m._colorsTexture,T)}let t9=l.morphAttributes;if(t9.position!==void 0||t9.normal!==void 0||t9.color!==void 0)F0.update(m,l,Q9);if(r9||M0.receiveShadow!==m.receiveShadow)M0.receiveShadow=m.receiveShadow,HJ.setValue(b,"receiveShadow",m.receiveShadow);if((u.isMeshStandardMaterial||u.isMeshLambertMaterial||u.isMeshPhongMaterial)&&u.envMap===null&&f.environment!==null)MJ.envMapIntensity.value=f.environmentIntensity;if(MJ.dfgLUT!==void 0)MJ.dfgLUT.value=JF();if(r9){if(HJ.setValue(b,"toneMappingExposure",B.toneMappingExposure),M0.needsLights)YH(MJ,b8);if(q0&&u.fog===!0)E0.refreshFogUniforms(MJ,q0);if(E0.refreshMaterialUniforms(MJ,u,v0,x0,_.state.transmissionRenderTarget[w.id]),M0.needsLights&&M0.lightProbeGrid){let EJ=M0.lightProbeGrid;MJ.probesSH.value=EJ.texture,MJ.probesMin.value.copy(EJ.boundingBox.min),MJ.probesMax.value.copy(EJ.boundingBox.max),MJ.probesResolution.value.copy(EJ.resolution)}W7.upload(b,qW(M0),MJ,T)}if(u.isShaderMaterial&&u.uniformsNeedUpdate===!0)W7.upload(b,qW(M0),MJ,T),u.uniformsNeedUpdate=!1;if(u.isSpriteMaterial)HJ.setValue(b,"center",m.center);if(HJ.setValue(b,"modelViewMatrix",m.modelViewMatrix),HJ.setValue(b,"normalMatrix",m.normalMatrix),HJ.setValue(b,"modelMatrix",m.matrixWorld),u.uniformsGroups!==void 0){let EJ=u.uniformsGroups;for(let e9=0,f8=EJ.length;e9<f8;e9++){let LW=EJ[e9];X0.update(LW,Q9),X0.bind(LW,Q9)}}return Q9}function YH(w,f){w.ambientLightColor.needsUpdate=f,w.lightProbe.needsUpdate=f,w.directionalLights.needsUpdate=f,w.directionalLightShadows.needsUpdate=f,w.pointLights.needsUpdate=f,w.pointLightShadows.needsUpdate=f,w.spotLights.needsUpdate=f,w.spotLightShadows.needsUpdate=f,w.rectAreaLights.needsUpdate=f,w.hemisphereLights.needsUpdate=f}function XH(w){return w.isMeshLambertMaterial||w.isMeshToonMaterial||w.isMeshPhongMaterial||w.isMeshStandardMaterial||w.isShadowMaterial||w.isShaderMaterial&&w.lights===!0}this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return v},this.setRenderTargetTextures=function(w,f,l){let u=T0.get(w);if(u.__autoAllocateDepthBuffer=w.resolveDepthBuffer===!1,u.__autoAllocateDepthBuffer===!1)u.__useRenderToTexture=!1;T0.get(w.texture).__webglTexture=f,T0.get(w.depthTexture).__webglTexture=u.__autoAllocateDepthBuffer?void 0:l,u.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(w,f){let l=T0.get(w);l.__webglFramebuffer=f,l.__useDefaultFramebuffer=f===void 0};let KH=b.createFramebuffer();this.setRenderTarget=function(w,f=0,l=0){v=w,S=f,y=l;let u=null,m=!1,q0=!1;if(w){let N0=T0.get(w);if(N0.__useDefaultFramebuffer!==void 0){O0.bindFramebuffer(b.FRAMEBUFFER,N0.__webglFramebuffer),p.copy(w.viewport),c.copy(w.scissor),a=w.scissorTest,O0.viewport(p),O0.scissor(c),O0.setScissorTest(a),h=-1;return}else if(N0.__webglFramebuffer===void 0)T.setupRenderTarget(w);else if(N0.__hasExternalTextures)T.rebindTextures(w,T0.get(w.texture).__webglTexture,T0.get(w.depthTexture).__webglTexture);else if(w.depthBuffer){let f0=w.depthTexture;if(N0.__boundDepthTexture!==f0){if(f0!==null&&T0.has(f0)&&(w.width!==f0.image.width||w.height!==f0.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");T.setupDepthRenderbuffer(w)}}let I0=w.texture;if(I0.isData3DTexture||I0.isDataArrayTexture||I0.isCompressedArrayTexture)q0=!0;let P0=T0.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget){if(Array.isArray(P0[f]))u=P0[f][l];else u=P0[f];m=!0}else if(w.samples>0&&T.useMultisampledRTT(w)===!1)u=T0.get(w).__webglMultisampledFramebuffer;else if(Array.isArray(P0))u=P0[l];else u=P0;p.copy(w.viewport),c.copy(w.scissor),a=w.scissorTest}else p.copy(D0).multiplyScalar(v0).floor(),c.copy(G0).multiplyScalar(v0).floor(),a=w0;if(l!==0)u=KH;if(O0.bindFramebuffer(b.FRAMEBUFFER,u))O0.drawBuffers(w,u);if(O0.viewport(p),O0.scissor(c),O0.setScissorTest(a),m){let N0=T0.get(w.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+f,N0.__webglTexture,l)}else if(q0){let N0=f;for(let I0=0;I0<w.textures.length;I0++){let P0=T0.get(w.textures[I0]);b.framebufferTextureLayer(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0+I0,P0.__webglTexture,l,N0)}}else if(w!==null&&l!==0){let N0=T0.get(w.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,N0.__webglTexture,l)}h=-1},this.readRenderTargetPixels=function(w,f,l,u,m,q0,k0,N0=0){if(!(w&&w.isWebGLRenderTarget)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let I0=T0.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&k0!==void 0)I0=I0[k0];if(I0){O0.bindFramebuffer(b.FRAMEBUFFER,I0);try{let P0=w.textures[N0],f0=P0.format,n0=P0.type;if(w.textures.length>1)b.readBuffer(b.COLOR_ATTACHMENT0+N0);if(!t0.textureFormatReadable(f0)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!t0.textureTypeReadable(n0)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(f>=0&&f<=w.width-u&&(l>=0&&l<=w.height-m))b.readPixels(f,l,u,m,c0.convert(f0),c0.convert(n0),q0)}finally{let P0=v!==null?T0.get(v).__webglFramebuffer:null;O0.bindFramebuffer(b.FRAMEBUFFER,P0)}}},this.readRenderTargetPixelsAsync=async function(w,f,l,u,m,q0,k0,N0=0){if(!(w&&w.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let I0=T0.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&k0!==void 0)I0=I0[k0];if(I0)if(f>=0&&f<=w.width-u&&(l>=0&&l<=w.height-m)){O0.bindFramebuffer(b.FRAMEBUFFER,I0);let P0=w.textures[N0],f0=P0.format,n0=P0.type;if(w.textures.length>1)b.readBuffer(b.COLOR_ATTACHMENT0+N0);if(!t0.textureFormatReadable(f0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!t0.textureTypeReadable(n0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let _0=b.createBuffer();b.bindBuffer(b.PIXEL_PACK_BUFFER,_0),b.bufferData(b.PIXEL_PACK_BUFFER,q0.byteLength,b.STREAM_READ),b.readPixels(f,l,u,m,c0.convert(f0),c0.convert(n0),0);let WJ=v!==null?T0.get(v).__webglFramebuffer:null;O0.bindFramebuffer(b.FRAMEBUFFER,WJ);let DJ=b.fenceSync(b.SYNC_GPU_COMMANDS_COMPLETE,0);return b.flush(),await tY(b,DJ,4),b.bindBuffer(b.PIXEL_PACK_BUFFER,_0),b.getBufferSubData(b.PIXEL_PACK_BUFFER,0,q0),b.deleteBuffer(_0),b.deleteSync(DJ),q0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(w,f=null,l=0){let u=Math.pow(2,-l),m=Math.floor(w.image.width*u),q0=Math.floor(w.image.height*u),k0=f!==null?f.x:0,N0=f!==null?f.y:0;T.setTexture2D(w,0),b.copyTexSubImage2D(b.TEXTURE_2D,l,0,0,k0,N0,m,q0),O0.unbindTexture()};let HH=b.createFramebuffer(),UH=b.createFramebuffer();if(this.copyTextureToTexture=function(w,f,l=null,u=null,m=0,q0=0){let k0,N0,I0,P0,f0,n0,_0,WJ,DJ,LJ=w.isCompressedTexture?w.mipmaps[q0]:w.image;if(l!==null)k0=l.max.x-l.min.x,N0=l.max.y-l.min.y,I0=l.isBox3?l.max.z-l.min.z:1,P0=l.min.x,f0=l.min.y,n0=l.isBox3?l.min.z:0;else{let MJ=Math.pow(2,-m);if(k0=Math.floor(LJ.width*MJ),N0=Math.floor(LJ.height*MJ),w.isDataArrayTexture)I0=LJ.depth;else if(w.isData3DTexture)I0=Math.floor(LJ.depth*MJ);else I0=1;P0=0,f0=0,n0=0}if(u!==null)_0=u.x,WJ=u.y,DJ=u.z;else _0=0,WJ=0,DJ=0;let KJ=c0.convert(f.format),yJ=c0.convert(f.type),M0;if(f.isData3DTexture)T.setTexture3D(f,0),M0=b.TEXTURE_3D;else if(f.isDataArrayTexture||f.isCompressedArrayTexture)T.setTexture2DArray(f,0),M0=b.TEXTURE_2D_ARRAY;else T.setTexture2D(f,0),M0=b.TEXTURE_2D;O0.activeTexture(b.TEXTURE0),O0.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,f.flipY),O0.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),O0.pixelStorei(b.UNPACK_ALIGNMENT,f.unpackAlignment);let iJ=O0.getParameter(b.UNPACK_ROW_LENGTH),r0=O0.getParameter(b.UNPACK_IMAGE_HEIGHT),Q9=O0.getParameter(b.UNPACK_SKIP_PIXELS),V9=O0.getParameter(b.UNPACK_SKIP_ROWS),r9=O0.getParameter(b.UNPACK_SKIP_IMAGES);O0.pixelStorei(b.UNPACK_ROW_LENGTH,LJ.width),O0.pixelStorei(b.UNPACK_IMAGE_HEIGHT,LJ.height),O0.pixelStorei(b.UNPACK_SKIP_PIXELS,P0),O0.pixelStorei(b.UNPACK_SKIP_ROWS,f0),O0.pixelStorei(b.UNPACK_SKIP_IMAGES,n0);let b8=w.isDataArrayTexture||w.isData3DTexture,HJ=f.isDataArrayTexture||f.isData3DTexture;if(w.isDepthTexture){let MJ=T0.get(w),t9=T0.get(f),EJ=T0.get(MJ.__renderTarget),e9=T0.get(t9.__renderTarget);O0.bindFramebuffer(b.READ_FRAMEBUFFER,EJ.__webglFramebuffer),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,e9.__webglFramebuffer);for(let f8=0;f8<I0;f8++){if(b8)b.framebufferTextureLayer(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,T0.get(w).__webglTexture,m,n0+f8),b.framebufferTextureLayer(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,T0.get(f).__webglTexture,q0,DJ+f8);b.blitFramebuffer(P0,f0,k0,N0,_0,WJ,k0,N0,b.DEPTH_BUFFER_BIT,b.NEAREST)}O0.bindFramebuffer(b.READ_FRAMEBUFFER,null),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,null)}else if(m!==0||w.isRenderTargetTexture||T0.has(w)){let MJ=T0.get(w),t9=T0.get(f);O0.bindFramebuffer(b.READ_FRAMEBUFFER,HH),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,UH);for(let EJ=0;EJ<I0;EJ++){if(b8)b.framebufferTextureLayer(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,MJ.__webglTexture,m,n0+EJ);else b.framebufferTexture2D(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,MJ.__webglTexture,m);if(HJ)b.framebufferTextureLayer(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,t9.__webglTexture,q0,DJ+EJ);else b.framebufferTexture2D(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,t9.__webglTexture,q0);if(m!==0)b.blitFramebuffer(P0,f0,k0,N0,_0,WJ,k0,N0,b.COLOR_BUFFER_BIT,b.NEAREST);else if(HJ)b.copyTexSubImage3D(M0,q0,_0,WJ,DJ+EJ,P0,f0,k0,N0);else b.copyTexSubImage2D(M0,q0,_0,WJ,P0,f0,k0,N0)}O0.bindFramebuffer(b.READ_FRAMEBUFFER,null),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,null)}else if(HJ)if(w.isDataTexture||w.isData3DTexture)b.texSubImage3D(M0,q0,_0,WJ,DJ,k0,N0,I0,KJ,yJ,LJ.data);else if(f.isCompressedArrayTexture)b.compressedTexSubImage3D(M0,q0,_0,WJ,DJ,k0,N0,I0,KJ,LJ.data);else b.texSubImage3D(M0,q0,_0,WJ,DJ,k0,N0,I0,KJ,yJ,LJ);else if(w.isDataTexture)b.texSubImage2D(b.TEXTURE_2D,q0,_0,WJ,k0,N0,KJ,yJ,LJ.data);else if(w.isCompressedTexture)b.compressedTexSubImage2D(b.TEXTURE_2D,q0,_0,WJ,LJ.width,LJ.height,KJ,LJ.data);else b.texSubImage2D(b.TEXTURE_2D,q0,_0,WJ,k0,N0,KJ,yJ,LJ);if(O0.pixelStorei(b.UNPACK_ROW_LENGTH,iJ),O0.pixelStorei(b.UNPACK_IMAGE_HEIGHT,r0),O0.pixelStorei(b.UNPACK_SKIP_PIXELS,Q9),O0.pixelStorei(b.UNPACK_SKIP_ROWS,V9),O0.pixelStorei(b.UNPACK_SKIP_IMAGES,r9),q0===0&&f.generateMipmaps)b.generateMipmap(M0);O0.unbindTexture()},this.initRenderTarget=function(w){if(T0.get(w).__webglFramebuffer===void 0)T.setupRenderTarget(w)},this.initTexture=function(w){if(w.isCubeTexture)T.setTextureCube(w,0);else if(w.isData3DTexture)T.setTexture3D(w,0);else if(w.isDataArrayTexture||w.isCompressedArrayTexture)T.setTexture2DArray(w,0);else T.setTexture2D(w,0);O0.unbindTexture()},this.resetState=function(){S=0,y=0,v=null,O0.reset(),x.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return UZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=s0._getDrawingBufferColorSpace(J),Q.unpackColorSpace=s0._getUnpackColorSpace()}}function L0(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J);return Number.isFinite($)?$:Q}function OJ(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 lX(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 OJ(J,[1,1,1])}function C6(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J.trim().replace(/deg$/i,""));return Number.isFinite($)?$:Q}function cZ(J){return J*Math.PI/180}function cX(J){let Q=OJ(J,[0,0,0]);return[cZ(Q[0]),cZ(Q[1]),cZ(Q[2])]}function K9(J,Q){if(J==null||J.trim()==="")return Q;return J.trim()}function k9(J,Q){return L0(J,Q)}function zQ(J){return(Q)=>Math.pow(Q,J)}function wQ(J){return(Q)=>1-Math.pow(1-Q,J)}function PQ(J){return(Q)=>Q<0.5?Math.pow(2*Q,J)/2:1-Math.pow(2*(1-Q),J)/2}var X7=1.70158,_Q={linear:(J)=>J,none:(J)=>J,"power1.in":zQ(2),"power1.out":wQ(2),"power1.inOut":PQ(2),"power2.in":zQ(3),"power2.out":wQ(3),"power2.inOut":PQ(3),"power3.in":zQ(4),"power3.out":wQ(4),"power3.inOut":PQ(4),"power4.in":zQ(5),"power4.out":wQ(5),"power4.inOut":PQ(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*((X7+1)*J-X7),"back.out":(J)=>{let Q=J-1;return Q*Q*((X7+1)*Q+X7)+1},"back.inOut":(J)=>{let Q=X7*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 TQ(J,Q="power1.out"){if(J){let $=_Q[J.trim()];if($)return $}return _Q[Q]??_Q.linear}var mq=Object.keys(_Q);function h8(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 nZ(J,Q){return h8(J,Q)}function nX(J,Q,$){let Z=Math.max(0.000001,1-$);return Math.min(1,Math.max(0,(J-Q)/Z))}function sX(J,Q){return Math.max(0,J-Q.start)}function iX(J){return{start:J.start??0,duration:J.duration??void 0,ease:TQ(J.ease??null,J.defaultEase??"power1.out")}}function oX(J,Q,$){let Z=J.rotation[$.axis],W=$.rpm/60*Math.PI*2;return(Y)=>{J.rotation[$.axis]=Z+W*sX(Y,Q)}}function aX(J,Q,$){let Z=$.fromDeg*Math.PI/180,W=$.toDeg*Math.PI/180;return(Y)=>{let X=Z+(W-Z)*h8(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 rX(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*h8(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 tX(J,Q){let $={x:J.scale.x,y:J.scale.y,z:J.scale.z};return(Z)=>{let W=Z<Q.start?0:h8(Z,Q);J.scale.x=$.x*W,J.scale.y=$.y*W,J.scale.z=$.z*W}}function sZ(J,Q){return($)=>{J($<Q.start?0:h8($,Q))}}function eX(J,Q,$){let Z=$.from??{x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=h8(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 JK(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 QK(J,Q){return($)=>{let Z=$<Q.start?0:h8($,Q);J(1-Z,Z)}}function $K(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*sX(Y,Q))}}var AQ=new j;function ZK(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 iZ(J,Q){if(Q&&Q.startsWith("#")){let Z=J.objectsById.get(Q.slice(1));if(Z)return()=>{return Z.getWorldPosition(AQ),{x:AQ.x,y:AQ.y,z:AQ.z}}}let $=OJ(Q,[0,0,0]);return()=>({x:$[0],y:$[1],z:$[2]})}function ZF(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 WK(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=iX({start:k9($.getAttribute("start"),0),duration:Y?k9(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=ZK(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(sZ((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(oX(K,X,{rpm:L0($.getAttribute("rpm"),6),axis:$.getAttribute("axis")??"y"}));else if(Z==="orbit"){let H=iZ(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=C6($.getAttribute("from"),O);J.seekFns.push(aX(K,X,{center:H,radius:L0($.getAttribute("radius"),E||5),fromDeg:R,toDeg:C6($.getAttribute("to"),R+360),height:L0($.getAttribute("height"),K.position.y-U.y)}))}else if(Z==="dolly")J.seekFns.push(rX(K,X,{toward:iZ(J,$.getAttribute("toward")),distance:L0($.getAttribute("distance"),1)}));else if(Z==="move"){let H=$.getAttribute("to");if(!H)continue;let U=OJ(H,[0,0,0]),G=$.getAttribute("from"),F=G?OJ(G,[0,0,0]):null;J.seekFns.push(eX(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=iZ(J,$.getAttribute("subject")),U=$.getAttribute("offset"),G;if(U){let F=OJ(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(JK(K,{subject:H,offset:G}))}else if(Z==="camera-path"){let H=($.getAttribute("points")??"").split(",").map((O)=>OJ(O.trim(),[Number.NaN,Number.NaN,Number.NaN])).filter((O)=>O.every(Number.isFinite)).map((O)=>new j(O[0],O[1],O[2]));if(H.length<2)continue;let U=new FQ(H,!1,"centripetal"),G=($.getAttribute("look")??"ahead").toLowerCase(),F=new j,E=new j;J.lateSeekFns.push((O)=>{let R=nZ(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(QK((O,R)=>{F.setEffectiveWeight(O),E.setEffectiveWeight(R)},X))}else if(Z==="bounce-in")J.seekFns.push(tX(K,X));else if(Z==="fade-in")J.seekFns.push(sZ(ZF(K),X));else if(Z==="float")J.seekFns.push($K(K,X,{amplitude:L0($.getAttribute("amplitude"),0.1),period:L0($.getAttribute("period"),4)}))}WF(J,Q)}function WF(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 R0;for(let W of $.values()){let Y=W[0],X=ZK(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 X9))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 R0(K9(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},C=F;J.seekFns.push((q)=>{if(q<O.start)return;let N=nZ(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 oZ(J,Q){if(Q===YZ)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===U6||Q===u6){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===U6)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 YK(J){let Q=new Map,$=new Map,Z=J.clone();return XK(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 XK(J,Q,$){$(J,Q);for(let Z=0;Z<J.children.length;Z++)XK(J.children[Z],Q.children[Z],$)}class $W extends S9{constructor(J){super(J);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(Q){return new OK(Q)}),this.register(function(Q){return new qK(Q)}),this.register(function(Q){return new IK(Q)}),this.register(function(Q){return new zK(Q)}),this.register(function(Q){return new wK(Q)}),this.register(function(Q){return new LK(Q)}),this.register(function(Q){return new DK(Q)}),this.register(function(Q){return new MK(Q)}),this.register(function(Q){return new kK(Q)}),this.register(function(Q){return new NK(Q)}),this.register(function(Q){return new BK(Q)}),this.register(function(Q){return new RK(Q)}),this.register(function(Q){return new CK(Q)}),this.register(function(Q){return new VK(Q)}),this.register(function(Q){return new EK(Q)}),this.register(function(Q){return new eZ(Q,o0.EXT_MESHOPT_COMPRESSION)}),this.register(function(Q){return new eZ(Q,o0.KHR_MESHOPT_COMPRESSION)}),this.register(function(Q){return new PK(Q)})}load(J,Q,$,Z){let W=this,Y;if(this.resourcePath!=="")Y=this.resourcePath;else if(this.path!==""){let H=F8.extractUrlBase(J);Y=F8.resolveURL(H,this.path)}else Y=F8.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 L6(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))===_K){try{Y[o0.KHR_BINARY_GLTF]=new TK(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 yK(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 FK;break;case o0.KHR_DRACO_MESH_COMPRESSION:Y[G]=new AK(W,this.dracoLoader);break;case o0.KHR_TEXTURE_TRANSFORM:Y[G]=new SK;break;case o0.KHR_MESH_QUANTIZATION:Y[G]=new jK;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 YF(){let J={};return{get:function(Q){return J[Q]},add:function(Q,$){J[Q]=$},remove:function(Q){delete J[Q]},removeAll:function(){J={}}}}function VJ(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 EK{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 R0(16777215);if(K.color!==void 0)U.setRGB(K.color[0],K.color[1],K.color[2],uJ);let G=K.range!==void 0?K.range:0;switch(K.type){case"directional":H=new j9(U),H.target.position.set(0,0,-1),H.add(H.target);break;case"point":H=new k6(U),H.distance=G;break;case"spot":H=new DQ(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),h9(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 FK{constructor(){this.name=o0.KHR_MATERIALS_UNLIT}getMaterialType(){return A9}extendParams(J,Q,$){let Z=[];J.color=new R0(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],uJ),J.opacity=Y[3]}if(W.baseColorTexture!==void 0)Z.push($.assignTexture(J,"map",W.baseColorTexture,H8))}return Promise.all(Z)}}class NK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();if($.emissiveStrength!==void 0)Q.emissiveIntensity=$.emissiveStrength;return Promise.resolve()}}class OK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_CLEARCOAT}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 p0(W,W)}}return Promise.all(Z)}}class qK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_DISPERSION}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();return Q.dispersion=$.dispersion!==void 0?$.dispersion:0,Promise.resolve()}}class RK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_IRIDESCENCE}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 LK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_SHEEN}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.sheenColor=new R0(0,0,0),Q.sheenRoughness=0,Q.sheen=1,$.sheenColorFactor!==void 0){let W=$.sheenColorFactor;Q.sheenColor.setRGB(W[0],W[1],W[2],uJ)}if($.sheenRoughnessFactor!==void 0)Q.sheenRoughness=$.sheenRoughnessFactor;if($.sheenColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenColorMap",$.sheenColorTexture,H8));if($.sheenRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenRoughnessMap",$.sheenRoughnessTexture));return Promise.all(Z)}}class DK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_TRANSMISSION}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 MK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_VOLUME}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 R0().setRGB(W[0],W[1],W[2],uJ),Promise.all(Z)}}class kK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_IOR}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 R0().setRGB(W[0],W[1],W[2],uJ),$.specularColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularColorMap",$.specularColorTexture,H8));return Promise.all(Z)}}class VK{constructor(J){this.parser=J,this.name=o0.EXT_MATERIALS_BUMP}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 CK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_ANISOTROPY}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(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 IK{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 zK{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 wK{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 eZ{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 PK{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!==H9.TRIANGLES&&H.mode!==H9.TRIANGLE_STRIP&&H.mode!==H9.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 S0,C=new j,q=new PJ,N=new j(1,1,1),L=new q6(O.geometry,O.material,F);for(let M=0;M<F;M++){if(K.TRANSLATION)C.fromBufferAttribute(K.TRANSLATION,M);if(K.ROTATION)q.fromBufferAttribute(K.ROTATION,M);if(K.SCALE)N.fromBufferAttribute(K.SCALE,M);L.setMatrixAt(M,R.compose(C,q,N))}for(let M in K)if(M==="_COLOR_0"){let k=K[M];L.instanceColor=new B8(k.array,k.itemSize,k.normalized)}else if(M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE")O.geometry.setAttribute(M,K[M]);FJ.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 _K="glTF",K7=12,KK={JSON:1313821514,BIN:5130562};class TK{constructor(J){this.name=o0.KHR_BINARY_GLTF,this.content=null,this.body=null;let Q=new DataView(J,0,K7),$=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!==_K)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-K7,W=new DataView(J,K7),Y=0;while(Y<Z){let X=W.getUint32(Y,!0);Y+=4;let K=W.getUint32(Y,!0);if(Y+=4,K===KK.JSON){let H=new Uint8Array(J,K7+Y,X);this.content=$.decode(H)}else if(K===KK.BIN){let H=K7+Y;this.body=J.slice(H,H+X)}Y+=X}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class AK{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=JW[U]||U.toLowerCase();X[G]=Y[U]}for(let U in J.attributes){let G=JW[U]||U.toLowerCase();if(Y[U]!==void 0){let F=$.accessors[J.attributes[U]],E=I6[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,uJ,F)})})}}class SK{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 jK{constructor(){this.name=o0.KHR_MESH_QUANTIZATION}}class ZW extends i9{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 M=0;M!==X;M++){let k=Y[R+M+X],_=Y[R+M+K]*U,P=Y[O+M+X],V=Y[O+M]*U;W[M]=N*k+L*_+C*P+q*V}return W}}var XF=new PJ;class vK extends ZW{interpolate_(J,Q,$,Z){let W=super.interpolate_(J,Q,$,Z);return XF.fromArray(W).normalize().toArray(W),W}}var H9={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},I6={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},HK={9728:L9,9729:BJ,9984:c7,9985:K6,9986:I8,9987:P9},UK={33071:X6,33648:l7,10497:X8},aZ={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},JW={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"},O8={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},KF={CUBICSPLINE:void 0,LINEAR:t7,STEP:WZ},rZ={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function HF(J){if(J.DefaultMaterial===void 0)J.DefaultMaterial=new X9({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:z9});return J.DefaultMaterial}function x8(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 h9(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 UF(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 GF(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 EF(J){let Q,$=J.extensions&&J.extensions[o0.KHR_DRACO_MESH_COMPRESSION];if($)Q="draco:"+$.bufferView+":"+$.indices+":"+tZ($.attributes);else Q=J.indices+":"+tZ(J.attributes)+":"+J.mode;if(J.targets!==void 0)for(let Z=0,W=J.targets.length;Z<W;Z++)Q+=":"+tZ(J.targets[Z]);return Q}function tZ(J){let Q="",$=Object.keys(J).sort();for(let Z=0,W=$.length;Z<W;Z++)Q+=$[Z]+":"+J[$[Z]]+";";return Q}function QW(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 FF(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 NF=new S0;class yK{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new YF,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 MQ(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new L6(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 x8(W,X,Z),h9(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(F8.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=aZ[Z.type],X=I6[Z.componentType],K=Z.normalized===!0,H=new X(Z.count*Y);return Promise.resolve(new JJ(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=aZ[Z.type],H=I6[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 c6(R,E/U),Q.cache.add(N,L);C=new F6(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 JJ(R,K,O)}if(Z.sparse!==void 0){let q=aZ.SCALAR,N=I6[Z.sparse.indices.componentType],L=Z.sparse.indices.byteOffset||0,M=Z.sparse.values.byteOffset||0,k=new N(Y[1],L,Z.sparse.count*q),_=new H(Y[2],M,Z.sparse.count*K);if(X!==null)C=new JJ(C.array.slice(),C.itemSize,C.normalized);C.normalized=!1;for(let P=0,V=k.length;P<V;P++){let D=k[P];if(C.setX(D,_[P*K]),K>=2)C.setY(D,_[P*K+1]);if(K>=3)C.setZ(D,_[P*K+2]);if(K>=4)C.setW(D,_[P*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=HK[F.magFilter]||BJ,U.minFilter=HK[F.minFilter]||P9,U.wrapS=UK[F.wrapS]||X8,U.wrapT=UK[F.wrapT]||X8,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==L9&&U.minFilter!==BJ,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 wJ(R);C.needsUpdate=!0,F(C)};Q.load(F8.resolveURL(G,W.path),O,void 0,E)})}).then(function(G){if(H===!0)X.revokeObjectURL(K);return h9(G,Y),G.userData.mimeType=Y.mimeType||FF(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 o6,eJ.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 i6,eJ.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 X9}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 R0(1,1,1),X.opacity=1,Array.isArray(G.baseColorFactor)){let F=G.baseColorFactor;X.color.setRGB(F[0],F[1],F[2],uJ),X.opacity=F[3]}if(G.baseColorTexture!==void 0)H.push(Q.assignTexture(X,"map",G.baseColorTexture,H8));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=cJ;let U=W.alphaMode||rZ.OPAQUE;if(U===rZ.BLEND)X.transparent=!0,X.depthWrite=!1;else if(X.transparent=!1,U===rZ.MASK)X.alphaTest=W.alphaCutoff!==void 0?W.alphaCutoff:0.5;if(W.normalTexture!==void 0&&Y!==A9){if(H.push(Q.assignTexture(X,"normalMap",W.normalTexture)),X.normalScale=new p0(1,1),W.normalTexture.scale!==void 0){let G=W.normalTexture.scale;X.normalScale.set(G,G)}}if(W.occlusionTexture!==void 0&&Y!==A9){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!==A9){let G=W.emissiveFactor;X.emissive=new R0().setRGB(G[0],G[1],G[2],uJ)}if(W.emissiveTexture!==void 0&&Y!==A9)H.push(Q.assignTexture(X,"emissiveMap",W.emissiveTexture,H8));return Promise.all(H).then(function(){let G=new Y(X);if(W.name)G.name=W.name;if(h9(G,W),Q.associations.set(G,{materials:J}),W.extensions)x8(Z,G,W);return G})}createUniqueName(J){let Q=e0.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 GK(K,X,Q)})}let Y=[];for(let X=0,K=J.length;X<K;X++){let H=J[X],U=EF(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=GK(new RJ,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?HF(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===H9.TRIANGLES||C.mode===H9.TRIANGLE_STRIP||C.mode===H9.TRIANGLE_FAN||C.mode===void 0){if(q=W.isSkinnedMesh===!0?new XQ(R,N):new GJ(R,N),q.isSkinnedMesh===!0)q.normalizeSkinWeights();if(C.mode===H9.TRIANGLE_STRIP)q.geometry=oZ(q.geometry,u6);else if(C.mode===H9.TRIANGLE_FAN)q.geometry=oZ(q.geometry,U6)}else if(C.mode===H9.LINES)q=new KQ(R,N);else if(C.mode===H9.LINE_STRIP)q=new R6(R,N);else if(C.mode===H9.LINE_LOOP)q=new HQ(R,N);else if(C.mode===H9.POINTS)q=new s9(R,N);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+C.mode);if(Object.keys(q.geometry.morphAttributes).length>0)GF(q,W);if(q.name=Q.createUniqueName(W.name||"mesh_"+J),h9(q,W),C.extensions)x8(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)x8(Z,G[0],W);return G[0]}let F=new W9;if(W.extensions)x8(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 kJ(E6.radToDeg(Z.yfov),Z.aspectRatio||1,Z.znear||1,Z.zfar||2000000);else if($.type==="orthographic")Q=new v8(-Z.xmag,Z.xmag,Z.ymag,-Z.ymag,Z.znear,Z.zfar);if($.name)Q.name=this.createUniqueName($.name);return h9(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 S0;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 s6(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,M=F.length;L<M;L++){let k=F[L],_=E[L],P=O[L],V=R[L],D=C[L];if(k===void 0)continue;if(k.updateMatrix)k.updateMatrix();let B=$._createAnimationTracks(k,_,P,V,D);if(B)for(let A=0;A<B.length;A++)q.push(B[A])}let N=new $6(W,void 0,q);return h9(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,NF)});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 j().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 n6;else if(H.length>1)U=new W9;else if(H.length===1)U=H[0];else U=new FJ;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(h9(U,W),W.extensions)x8($,U,W);if(W.matrix!==void 0){let G=new S0;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 W9;if($.name)W.name=Z.createUniqueName($.name);if(h9(W,$),$.extensions)x8(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(YK(F));else W.add(F)}let H=(U)=>{let G=new Map;for(let[F,E]of Z.associations)if(F instanceof eJ||F instanceof wJ)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(O8[W.path]===O8.weights){if(H(J),J.isGroup)J.children.forEach(H)}else K.push(X);let U;switch(O8[W.path]){case O8.weights:U=c9;break;case O8.rotation:U=o9;break;case O8.translation:case O8.scale:U=n9;break;default:switch($.itemSize){case 1:U=c9;break;case 2:case 3:default:U=n9;break}break}let G=Z.interpolation!==void 0?KF[Z.interpolation]:t7,F=this._getArrayFromAccessor($);for(let E=0,O=K.length;E<O;E++){let R=new U(K[E]+"."+O8[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 $=QW(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 o9?vK:ZW)(this.times,this.values,this.getValueSize()/3,$)},J.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function OF(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 j(H[0],H[1],H[2]),new j(U[0],U[1],U[2])),K.normalized){let G=QW(I6[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 j,H=new j;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=QW(I6[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 mJ;W.getCenter(X.center),X.radius=W.min.distanceTo(W.max)/2,J.boundingSphere=X}function GK(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=JW[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(s0.workingColorSpace!==uJ&&"COLOR_0"in Z)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${s0.workingColorSpace}" not supported.`);return h9(J,Q),OF(J,Q,$),Promise.all(W).then(function(){return Q.targets!==void 0?UF(J,Q.targets,$):J})}class WW extends qQ{constructor(J){super(J);this.type=fJ}parse(J){let Y=function(V,D){switch(V){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(V,D,B){D=!D?1024:D;let z=V.pos,S=-1,y=0,v="",h=String.fromCharCode.apply(null,new Uint16Array(V.subarray(z,z+128)));while(0>(S=h.indexOf(`
4105
+ `))&&y<D&&z<V.byteLength)v+=h,y+=h.length,z+=128,h=String.fromCharCode.apply(null,new Uint16Array(V.subarray(z,z+128)));if(-1<S){if(B!==!1)V.pos+=y+S+1;return v+h.slice(0,S)}return!1},F=function(V){let D=/^#\?(\S+)/,B=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,A=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,z=/^\s*FORMAT=(\S+)\s*$/,S=/^\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},v,h;if(V.pos>=V.byteLength||!(v=G(V)))Y(1,"no header found");if(!(h=v.match(D)))Y(3,"bad initial token");y.valid|=1,y.programtype=h[1],y.string+=v+`
4106
+ `;while(!0){if(v=G(V),v===!1)break;if(y.string+=v+`
4107
+ `,v.charAt(0)==="#"){y.comments+=v+`
4108
+ `;continue}if(h=v.match(B))y.gamma=parseFloat(h[1]);if(h=v.match(A))y.exposure=parseFloat(h[1]);if(h=v.match(z))y.valid|=2,y.format=h[1];if(h=v.match(S))y.valid|=4,y.height=parseInt(h[1],10),y.width=parseInt(h[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(V,D,B){let A=D;if(A<8||A>32767||(V[0]!==2||V[1]!==2||V[2]&128))return new Uint8Array(V);if(A!==(V[2]<<8|V[3]))Y(3,"wrong scanline width");let z=new Uint8Array(4*D*B);if(!z.length)Y(4,"unable to allocate buffer space");let S=0,y=0,v=4*A,h=new Uint8Array(4),g=new Uint8Array(v),p=B;while(p>0&&y<V.byteLength){if(y+4>V.byteLength)Y(1);if(h[0]=V[y++],h[1]=V[y++],h[2]=V[y++],h[3]=V[y++],h[0]!=2||h[1]!=2||(h[2]<<8|h[3])!=A)Y(3,"bad rgbe scanline format");let c=0,a;while(c<v&&y<V.byteLength){a=V[y++];let H0=a>128;if(H0)a-=128;if(a===0||c+a>v)Y(3,"bad scanline data");if(H0){let J0=V[y++];for(let x0=0;x0<a;x0++)g[c++]=J0}else g.set(V.subarray(y,y+a),c),c+=a,y+=a}let Q0=A;for(let H0=0;H0<Q0;H0++){let J0=0;z[S]=g[H0+J0],J0+=A,z[S+1]=g[H0+J0],J0+=A,z[S+2]=g[H0+J0],J0+=A,z[S+3]=g[H0+J0],S+=4}p--}return z},O=function(V,D,B,A){let z=V[D+3],S=Math.pow(2,z-128)/255;B[A+0]=V[D+0]*S,B[A+1]=V[D+1]*S,B[A+2]=V[D+2]*S,B[A+3]=1},R=function(V,D,B,A){let z=V[D+3],S=Math.pow(2,z-128)/255;B[A+0]=T8.toHalfFloat(Math.min(V[D+0]*S,65504)),B[A+1]=T8.toHalfFloat(Math.min(V[D+1]*S,65504)),B[A+2]=T8.toHalfFloat(Math.min(V[D+2]*S,65504)),B[A+3]=T8.toHalfFloat(1)},C=new Uint8Array(J);C.pos=0;let q=F(C),N=q.width,L=q.height,M=E(C.subarray(C.pos),N,L),k,_,P;switch(this.type){case tJ:P=M.length/4;let V=new Float32Array(P*4);for(let B=0;B<P;B++)O(M,B*4,V,B*4);k=V,_=tJ;break;case fJ:P=M.length/4;let D=new Uint16Array(P*4);for(let B=0;B<P;B++)R(M,B*4,D,B*4);k=D,_=fJ;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:N,height:L,data:k,header:q.string,gamma:q.gamma,exposure:q.exposure,type:_}}setDataType(J){return this.type=J,this}load(J,Q,$,Z){function W(Y,X){switch(Y.type){case tJ:case fJ:Y.colorSpace=uJ,Y.minFilter=BJ,Y.magFilter=BJ,Y.generateMipmaps=!1,Y.flipY=!0;break}if(Q)Q(Y,X)}return super.load(J,W,$,Z)}}var H7=new j;function U9(J,Q,$,Z,W,Y){let X=2*Math.PI*W/4,K=Math.max(Y-2*W,0),H=Math.PI/4;H7.copy(Q),H7[Z]=0,H7.normalize();let U=0.5*X/(X+K),G=1-H7.angleTo(J)/H;if(Math.sign(H7[$])===1)return G*U;else return K/(X+K)+U+U*(1-G)}class SQ extends Y9{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 j,H=new j,U=new j(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 j,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]=U9(R,H,"z","y",W,$),E[N+1]=1-U9(R,H,"y","z",W,Q);break;case 1:R.set(-1,0,0),E[N+0]=1-U9(R,H,"z","y",W,$),E[N+1]=1-U9(R,H,"y","z",W,Q);break;case 2:R.set(0,1,0),E[N+0]=1-U9(R,H,"x","z",W,J),E[N+1]=U9(R,H,"z","x",W,$);break;case 3:R.set(0,-1,0),E[N+0]=1-U9(R,H,"x","z",W,J),E[N+1]=1-U9(R,H,"z","x",W,$);break;case 4:R.set(0,0,1),E[N+0]=1-U9(R,H,"x","y",W,J),E[N+1]=1-U9(R,H,"y","x",W,Q);break;case 5:R.set(0,0,-1),E[N+0]=U9(R,H,"x","y",W,J),E[N+1]=1-U9(R,H,"y","x",W,Q);break}}static fromJSON(J){return new SQ(J.width,J.height,J.depth,J.segments,J.radius)}}class YW extends GJ{constructor(J,Q,$=!1,Z=!1,W=1e4){let Y=new RJ;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 M=new JJ(this.positionArray,3);M.setUsage(G6),Y.setAttribute("position",M),this.normalArray=new Float32Array(L*3);let k=new JJ(this.normalArray,3);if(k.setUsage(G6),Y.setAttribute("normal",k),this.enableUvs){this.uvArray=new Float32Array(L*2);let _=new JJ(this.uvArray,2);_.setUsage(G6),Y.setAttribute("uv",_)}if(this.enableColors){this.colorArray=new Float32Array(L*3);let _=new JJ(this.colorArray,3);_.setUsage(G6),Y.setAttribute("color",_)}Y.boundingSphere=new mJ(new j,1)};function G(N,L,M){return N+(L-N)*M}function F(N,L,M,k,_,P,V,D,B,A){let z=(M-V)/(D-V),S=X.normal_cache;K[L+0]=k+z*X.delta,K[L+1]=_,K[L+2]=P,H[L+0]=G(S[N+0],S[N+3],z),H[L+1]=G(S[N+1],S[N+4],z),H[L+2]=G(S[N+2],S[N+5],z),U[L+0]=G(X.palette[B*3+0],X.palette[A*3+0],z),U[L+1]=G(X.palette[B*3+1],X.palette[A*3+1],z),U[L+2]=G(X.palette[B*3+2],X.palette[A*3+2],z)}function E(N,L,M,k,_,P,V,D,B,A){let z=(M-V)/(D-V),S=X.normal_cache;K[L+0]=k,K[L+1]=_+z*X.delta,K[L+2]=P;let y=N+X.yd*3;H[L+0]=G(S[N+0],S[y+0],z),H[L+1]=G(S[N+1],S[y+1],z),H[L+2]=G(S[N+2],S[y+2],z),U[L+0]=G(X.palette[B*3+0],X.palette[A*3+0],z),U[L+1]=G(X.palette[B*3+1],X.palette[A*3+1],z),U[L+2]=G(X.palette[B*3+2],X.palette[A*3+2],z)}function O(N,L,M,k,_,P,V,D,B,A){let z=(M-V)/(D-V),S=X.normal_cache;K[L+0]=k,K[L+1]=_,K[L+2]=P+z*X.delta;let y=N+X.zd*3;H[L+0]=G(S[N+0],S[y+0],z),H[L+1]=G(S[N+1],S[y+1],z),H[L+2]=G(S[N+2],S[y+2],z),U[L+0]=G(X.palette[B*3+0],X.palette[A*3+0],z),U[L+1]=G(X.palette[B*3+1],X.palette[A*3+1],z),U[L+2]=G(X.palette[B*3+2],X.palette[A*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,M,k,_){let P=k+1,V=k+X.yd,D=k+X.zd,B=P+X.yd,A=P+X.zd,z=k+X.yd+X.zd,S=P+X.yd+X.zd,y=0,v=X.field[k],h=X.field[P],g=X.field[V],p=X.field[B],c=X.field[D],a=X.field[A],Q0=X.field[z],H0=X.field[S];if(v<_)y|=1;if(h<_)y|=2;if(g<_)y|=8;if(p<_)y|=4;if(c<_)y|=16;if(a<_)y|=32;if(Q0<_)y|=128;if(H0<_)y|=64;let J0=qF[y];if(J0===0)return 0;let x0=X.delta,v0=N+x0,s=L+x0,Y0=M+x0;if(J0&1)R(k),R(P),F(k*3,0,_,N,L,M,v,h,k,P);if(J0&2)R(P),R(B),E(P*3,3,_,v0,L,M,h,p,P,B);if(J0&4)R(V),R(B),F(V*3,6,_,N,s,M,g,p,V,B);if(J0&8)R(k),R(V),E(k*3,9,_,N,L,M,v,g,k,V);if(J0&16)R(D),R(A),F(D*3,12,_,N,L,Y0,c,a,D,A);if(J0&32)R(A),R(S),E(A*3,15,_,v0,L,Y0,a,H0,A,S);if(J0&64)R(z),R(S),F(z*3,18,_,N,s,Y0,Q0,H0,z,S);if(J0&128)R(D),R(z),E(D*3,21,_,N,L,Y0,c,Q0,D,z);if(J0&256)R(k),R(D),O(k*3,24,_,N,L,M,v,c,k,D);if(J0&512)R(P),R(A),O(P*3,27,_,v0,L,M,h,a,P,A);if(J0&1024)R(B),R(S),O(B*3,30,_,v0,s,M,p,H0,B,S);if(J0&2048)R(V),R(z),O(V*3,33,_,N,s,M,g,Q0,V,z);y<<=4;let D0,G0,w0,i0=0,j0=0;while(jQ[y+j0]!=-1)D0=y+j0,G0=D0+1,w0=D0+2,q(K,H,U,3*jQ[D0],3*jQ[G0],3*jQ[w0]),j0+=3,i0++;return i0}function q(N,L,M,k,_,P){let V=X.count*3;if(X.positionArray[V+0]=N[k],X.positionArray[V+1]=N[k+1],X.positionArray[V+2]=N[k+2],X.positionArray[V+3]=N[_],X.positionArray[V+4]=N[_+1],X.positionArray[V+5]=N[_+2],X.positionArray[V+6]=N[P],X.positionArray[V+7]=N[P+1],X.positionArray[V+8]=N[P+2],X.material.flatShading===!0){let D=(L[k+0]+L[_+0]+L[P+0])/3,B=(L[k+1]+L[_+1]+L[P+1])/3,A=(L[k+2]+L[_+2]+L[P+2])/3;X.normalArray[V+0]=D,X.normalArray[V+1]=B,X.normalArray[V+2]=A,X.normalArray[V+3]=D,X.normalArray[V+4]=B,X.normalArray[V+5]=A,X.normalArray[V+6]=D,X.normalArray[V+7]=B,X.normalArray[V+8]=A}else X.normalArray[V+0]=L[k+0],X.normalArray[V+1]=L[k+1],X.normalArray[V+2]=L[k+2],X.normalArray[V+3]=L[_+0],X.normalArray[V+4]=L[_+1],X.normalArray[V+5]=L[_+2],X.normalArray[V+6]=L[P+0],X.normalArray[V+7]=L[P+1],X.normalArray[V+8]=L[P+2];if(X.enableUvs){let D=X.count*2;X.uvArray[D+0]=N[k+0],X.uvArray[D+1]=N[k+2],X.uvArray[D+2]=N[_+0],X.uvArray[D+3]=N[_+2],X.uvArray[D+4]=N[P+0],X.uvArray[D+5]=N[P+2]}if(X.enableColors)X.colorArray[V+0]=M[k+0],X.colorArray[V+1]=M[k+1],X.colorArray[V+2]=M[k+2],X.colorArray[V+3]=M[_+0],X.colorArray[V+4]=M[_+1],X.colorArray[V+5]=M[_+2],X.colorArray[V+6]=M[P+0],X.colorArray[V+7]=M[P+1],X.colorArray[V+8]=M[P+2];X.count+=3}this.addBall=function(N,L,M,k,_,P){let V=Math.sign(k);k=Math.abs(k);let D=!(P===void 0||P===null),B=new R0(N,L,M);if(D)try{B=P instanceof R0?P:Array.isArray(P)?new R0(Math.min(Math.abs(P[0]),1),Math.min(Math.abs(P[1]),1),Math.min(Math.abs(P[2]),1)):new R0(P)}catch(j0){B=new R0(N,L,M)}let A=this.size*Math.sqrt(k/_),z=M*this.size,S=L*this.size,y=N*this.size,v=Math.floor(z-A);if(v<1)v=1;let h=Math.floor(z+A);if(h>this.size-1)h=this.size-1;let g=Math.floor(S-A);if(g<1)g=1;let p=Math.floor(S+A);if(p>this.size-1)p=this.size-1;let c=Math.floor(y-A);if(c<1)c=1;let a=Math.floor(y+A);if(a>this.size-1)a=this.size-1;let Q0,H0,J0,x0,v0,s,Y0,D0,G0,w0,i0;for(J0=v;J0<h;J0++){v0=this.size2*J0,D0=J0/this.size-M,G0=D0*D0;for(H0=g;H0<p;H0++){x0=v0+this.size*H0,Y0=H0/this.size-L,w0=Y0*Y0;for(Q0=c;Q0<a;Q0++)if(s=Q0/this.size-N,i0=k/(0.000001+s*s+w0+G0)-_,i0>0){this.field[x0+Q0]+=i0*V;let j0=Math.sqrt((Q0-y)*(Q0-y)+(H0-S)*(H0-S)+(J0-z)*(J0-z))/A,d0=1-j0*j0*j0*(j0*(j0*6-15)+10);this.palette[(x0+Q0)*3+0]+=B.r*d0,this.palette[(x0+Q0)*3+1]+=B.g*d0,this.palette[(x0+Q0)*3+2]+=B.b*d0}}}},this.addPlaneX=function(N,L){let M=this.size,k=this.yd,_=this.zd,P=this.field,V,D,B,A,z,S,y,v=M*Math.sqrt(N/L);if(v>M)v=M;for(V=0;V<v;V++)if(S=V/M,A=S*S,z=N/(0.0001+A)-L,z>0)for(D=0;D<M;D++){y=V+D*k;for(B=0;B<M;B++)P[_*B+y]+=z}},this.addPlaneY=function(N,L){let M=this.size,k=this.yd,_=this.zd,P=this.field,V,D,B,A,z,S,y,v,h=M*Math.sqrt(N/L);if(h>M)h=M;for(D=0;D<h;D++)if(S=D/M,A=S*S,z=N/(0.0001+A)-L,z>0){y=D*k;for(V=0;V<M;V++){v=y+V;for(B=0;B<M;B++)P[_*B+v]+=z}}},this.addPlaneZ=function(N,L){let M=this.size,k=this.yd,_=this.zd,P=this.field,V,D,B,A,z,S,y,v,h=M*Math.sqrt(N/L);if(h>M)h=M;for(B=0;B<h;B++)if(S=B/M,A=S*S,z=N/(0.0001+A)-L,z>0){y=_*B;for(D=0;D<M;D++){v=y+D*k;for(V=0;V<M;V++)P[v+V]+=z}}},this.setCell=function(N,L,M,k){let _=this.size2*M+this.size*L+N;this.field[_]=k},this.getCell=function(N,L,M){let k=this.size2*M+this.size*L+N;return this.field[k]},this.blur=function(N=1){let L=this.field,M=L.slice(),k=this.size,_=this.size2;for(let P=0;P<k;P++)for(let V=0;V<k;V++)for(let D=0;D<k;D++){let B=_*D+k*V+P,A=M[B],z=1;for(let S=-1;S<=1;S+=2){let y=S+P;if(y<0||y>=k)continue;for(let v=-1;v<=1;v+=2){let h=v+V;if(h<0||h>=k)continue;for(let g=-1;g<=1;g+=2){let p=g+D;if(p<0||p>=k)continue;let c=_*p+k*h+y,a=M[c];z++,A+=N*(a-A)/z}}}L[B]=A}},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 M=this.size2*L,k=(L-this.halfsize)/this.halfsize;for(let _=1;_<N;_++){let P=M+this.size*_,V=(_-this.halfsize)/this.halfsize;for(let D=1;D<N;D++){let B=(D-this.halfsize)/this.halfsize,A=P+D;C(B,V,k,A,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 qF=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]),jQ=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 z6(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 RF(J,Q,$){let Z=z6(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 LF(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 hK(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 YW(W,Q,!0,!0,60000);H.isolation=L0(J.getAttribute("isolation"),60),H.position.set(...OJ(J.getAttribute("position"),[0,0,0])),H.scale.setScalar(K),H.frustumCulled=!1;let U=RF($,Z,X),G=(F)=>{let E=F*Y;H.reset();for(let O of U){let R=LF(O,E);H.addBall(R.x,R.y,R.z,O.strength,12)}H.update()};return G(0),{mesh:H,writer:G}}class XW extends GJ{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 j(0.70707,0.70707,0),G=new R0(Q.sunColor!==void 0?Q.sunColor:16777215),F=new R0(Q.waterColor!==void 0?Q.waterColor:8355711),E=Q.eye!==void 0?Q.eye:new j(0,0,0),O=Q.distortionScale!==void 0?Q.distortionScale:20,R=Q.side!==void 0?Q.side:z9,C=Q.fog!==void 0?Q.fog:!1,q=new O9,N=new j,L=new j,M=new j,k=new S0,_=new j(0,0,-1),P=new QJ,V=new j,D=new j,B=new QJ,A=new S0,z=new kJ,S=new nJ(Z,W,{type:fJ}),y={name:"MirrorShader",uniforms:j8.merge([U0.fog,U0.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new S0},sunColor:{value:new R0(8355711)},sunDirection:{value:new j(0.70707,0.70707,0)},eye:{value:new j},waterColor:{value:new R0(5592405)}}]),vertexShader:`
4109
4109
  uniform mat4 textureMatrix;
4110
4110
  uniform float time;
4111
4111
 
@@ -4201,7 +4201,7 @@ void main() {
4201
4201
  #include <tonemapping_fragment>
4202
4202
  #include <colorspace_fragment>
4203
4203
  #include <fog_fragment>
4204
- }`},v=new SJ({name:b.name,uniforms:j8.clone(b.uniforms),vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,lights:!0,side:R,fog:k});v.uniforms.mirrorSampler.value=j.texture,v.uniforms.textureMatrix.value=S,v.uniforms.alpha.value=X,v.uniforms.time.value=K,v.uniforms.normalSampler.value=H,v.uniforms.sunColor.value=G,v.uniforms.waterColor.value=q,v.uniforms.sunDirection.value=U,v.uniforms.distortionScale.value=O,v.uniforms.eye.value=E,$.material=v,$.onBeforeRender=function(x,p,d){if(D.setFromMatrixPosition($.matrixWorld),B.setFromMatrixPosition(d.matrixWorld),C.extractRotation($.matrixWorld),N.set(0,0,1),N.applyMatrix4(C),_.subVectors(D,B),_.dot(N)>0)return;_.reflect(N).negate(),_.add(D),C.extractRotation(d.matrixWorld),T.set(0,0,-1),T.applyMatrix4(C),T.add(B),L.subVectors(D,T),L.reflect(N).negate(),L.add(D),I.position.copy(_),I.up.set(0,1,0),I.up.applyMatrix4(C),I.up.reflect(N),I.lookAt(L),I.far=d.far,I.updateMatrixWorld(),I.projectionMatrix.copy(d.projectionMatrix),S.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1),S.multiply(I.projectionMatrix),S.multiply(I.matrixWorldInverse),F.setFromNormalAndCoplanarPoint(N,D),F.applyMatrix4(I.matrixWorldInverse),P.set(F.normal.x,F.normal.y,F.normal.z,F.constant);let n=I.projectionMatrix;z.x=(Math.sign(P.x)+n.elements[8])/n.elements[0],z.y=(Math.sign(P.y)+n.elements[9])/n.elements[5],z.z=-1,z.w=(1+n.elements[10])/n.elements[14],P.multiplyScalar(2/P.dot(z)),n.elements[2]=P.x,n.elements[6]=P.y,n.elements[10]=P.z+1-Y,n.elements[14]=P.w,E.setFromMatrixPosition(d.matrixWorld);let r=x.getRenderTarget(),Y0=x.xr.enabled,R0=x.shadowMap.autoUpdate;if($.visible=!1,x.xr.enabled=!1,x.shadowMap.autoUpdate=!1,x.setRenderTarget(j),x.state.buffers.depth.setMask(!0),x.autoClear===!1)x.clear();x.render(p,I),$.visible=!0,x.xr.enabled=Y0,x.shadowMap.autoUpdate=R0,x.setRenderTarget(r);let G0=d.viewport;if(G0!==void 0)x.state.viewport(G0)}}}function SK(J){let Q=C0(J.getAttribute("size"),2000),$=C0(J.getAttribute("speed"),1),Z=J.getAttribute("normals")??"assets/waternormals.jpg",W=new L6,Y,X=new Promise((G)=>{Y=G}),K=new $W(new L9(Q,Q),{textureWidth:512,textureHeight:512,waterNormals:W.load(Z,(G)=>{G.wrapS=G.wrapT=X8,Y(G)}),sunDirection:new A(...OJ(J.getAttribute("sun-direction"),[0.7,0.6,0.3])),sunColor:new k0(y9(J.getAttribute("sun-color"),"#ffffff")),waterColor:new k0(y9(J.getAttribute("color"),"#001e0f")),distortionScale:C0(J.getAttribute("distortion-scale"),3.7),alpha:C0(J.getAttribute("alpha"),1),clipBias:0});K.rotation.x=-Math.PI/2,K.position.set(...OJ(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 K7 extends FJ{constructor(){let J=K7.SkyShader,Q=new SJ({name:J.name,uniforms:j8.clone(J.uniforms),vertexShader:J.vertexShader,fragmentShader:J.fragmentShader,side:hJ,depthWrite:!1});super(new Y9(1,1,1),Q);this.isSky=!0}}K7.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:`
4204
+ }`},v=new SJ({name:y.name,uniforms:j8.clone(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,lights:!0,side:R,fog:C});v.uniforms.mirrorSampler.value=S.texture,v.uniforms.textureMatrix.value=A,v.uniforms.alpha.value=X,v.uniforms.time.value=K,v.uniforms.normalSampler.value=H,v.uniforms.sunColor.value=G,v.uniforms.waterColor.value=F,v.uniforms.sunDirection.value=U,v.uniforms.distortionScale.value=O,v.uniforms.eye.value=E,$.material=v,$.onBeforeRender=function(h,g,p){if(L.setFromMatrixPosition($.matrixWorld),M.setFromMatrixPosition(p.matrixWorld),k.extractRotation($.matrixWorld),N.set(0,0,1),N.applyMatrix4(k),V.subVectors(L,M),V.dot(N)>0)return;V.reflect(N).negate(),V.add(L),k.extractRotation(p.matrixWorld),_.set(0,0,-1),_.applyMatrix4(k),_.add(M),D.subVectors(L,_),D.reflect(N).negate(),D.add(L),z.position.copy(V),z.up.set(0,1,0),z.up.applyMatrix4(k),z.up.reflect(N),z.lookAt(D),z.far=p.far,z.updateMatrixWorld(),z.projectionMatrix.copy(p.projectionMatrix),A.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1),A.multiply(z.projectionMatrix),A.multiply(z.matrixWorldInverse),q.setFromNormalAndCoplanarPoint(N,L),q.applyMatrix4(z.matrixWorldInverse),P.set(q.normal.x,q.normal.y,q.normal.z,q.constant);let c=z.projectionMatrix;B.x=(Math.sign(P.x)+c.elements[8])/c.elements[0],B.y=(Math.sign(P.y)+c.elements[9])/c.elements[5],B.z=-1,B.w=(1+c.elements[10])/c.elements[14],P.multiplyScalar(2/P.dot(B)),c.elements[2]=P.x,c.elements[6]=P.y,c.elements[10]=P.z+1-Y,c.elements[14]=P.w,E.setFromMatrixPosition(p.matrixWorld);let a=h.getRenderTarget(),Q0=h.xr.enabled,H0=h.shadowMap.autoUpdate;if($.visible=!1,h.xr.enabled=!1,h.shadowMap.autoUpdate=!1,h.setRenderTarget(S),h.state.buffers.depth.setMask(!0),h.autoClear===!1)h.clear();h.render(g,z),$.visible=!0,h.xr.enabled=Q0,h.shadowMap.autoUpdate=H0,h.setRenderTarget(a);let J0=p.viewport;if(J0!==void 0)h.state.viewport(J0)}}}function xK(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 XW(new M9(Q,Q),{textureWidth:512,textureHeight:512,waterNormals:W.load(Z,(G)=>{G.wrapS=G.wrapT=X8,Y(G)}),sunDirection:new j(...OJ(J.getAttribute("sun-direction"),[0.7,0.6,0.3])),sunColor:new R0(K9(J.getAttribute("sun-color"),"#ffffff")),waterColor:new R0(K9(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(...OJ(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 U7 extends GJ{constructor(){let J=U7.SkyShader,Q=new SJ({name:J.name,uniforms:j8.clone(J.uniforms),vertexShader:J.vertexShader,fragmentShader:J.fragmentShader,side:bJ,depthWrite:!1});super(new Y9(1,1,1),Q);this.isSky=!0}}U7.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:0.005},mieDirectionalG:{value:0.8},sunPosition:{value:new j},up:{value:new j(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:`
4205
4205
  uniform vec3 sunPosition;
4206
4206
  uniform float rayleigh;
4207
4207
  uniform float turbidity;
@@ -4421,7 +4421,7 @@ void main() {
4421
4421
  #include <tonemapping_fragment>
4422
4422
  #include <colorspace_fragment>
4423
4423
 
4424
- }`};function jK(J){let Q=new K7;Q.scale.setScalar(C0(J.getAttribute("scale"),2000));let $=Q.material.uniforms;$.turbidity.value=C0(J.getAttribute("turbidity"),10),$.rayleigh.value=C0(J.getAttribute("rayleigh"),2),$.mieCoefficient.value=C0(J.getAttribute("mie-coefficient"),0.005),$.mieDirectionalG.value=C0(J.getAttribute("mie-directional-g"),0.8);let Z=C0(J.getAttribute("elevation"),15),W=C0(J.getAttribute("azimuth"),180),Y=G6.degToRad(90-Z),X=G6.degToRad(W),K=new A().setFromSphericalCoords(1,Y,X);return $.sunPosition.value.copy(K),{sky:Q,sunDirection:K}}function AQ(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 U1(J,Q,$,Z){let W=J.split("|").map((F)=>F.trim()),Y=document.createElement("canvas"),X=Y.getContext("2d",{willReadFrequently:!0});X.font=Q;let K=W.map((F)=>X.measureText(F)),H=(K[0].fontBoundingBoxAscent??90)+(K[0].fontBoundingBoxDescent??30),U=Math.max(...K.map((F)=>F.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 F=0;F<W.length;F++)X.fillText(W[F],Y.width/2,G+H*(F+0.5),Y.width-G);let q=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 F=0;F<Y.height;F+=O)for(let N=0;N<Y.width;N+=O)if(q[(F*Y.width+N)*4+3]>128)R.push({x:N/Y.width,y:F/Y.height});let k=[];if(R.length===0)return{points:k,aspect:1};for(let F=0;F<$;F++){let N=R[Math.floor(Z()*R.length)],D=O/Y.width;k.push({x:N.x+(Z()-0.5)*D,y:N.y+(Z()-0.5)*D})}return{points:k,aspect:Y.height/Y.width}}var vK=new A,yK=new wJ,fK=new A,xK=new S0;function hK(J){let Q=Math.max(1,Math.floor(C0(J.getAttribute("count"),1500))),$=Math.floor(C0(J.getAttribute("seed"),1)),Z=C0(J.getAttribute("size"),0.12),W=C0(J.getAttribute("width"),12),Y=D9(J.getAttribute("start"),0.5),X=D9(J.getAttribute("duration"),3.5),K=Math.min(0.95,Math.max(0,C0(J.getAttribute("stagger"),0.5))),H=wQ(J.getAttribute("ease"),"power3.inOut"),U=(J.getAttribute("mode")??"gather").toLowerCase()==="disperse",G=OJ(J.getAttribute("position"),[0,0,0]),q=OJ(J.getAttribute("scatter"),[W*1.6,W*0.8,W]),E=(J.getAttribute("palette")??"#fafafa,#e4e4e7,#ef4444,#18181b").split(",").map((S)=>new k0(S.trim())),O=AQ($),{points:R,aspect:k}=U1(J.getAttribute("text")??"STEREOFRAME",J.getAttribute("font")??"900 140px sans-serif",Q,O),F=new L9(1,0.72),N=new T9({roughness:0.92,metalness:0,side:lJ}),D=new N6(F,N,Q);D.position.set(G[0],G[1],G[2]),D.frustumCulled=!1;let B=new Float32Array(Q*3),C=new Float32Array(Q*3),T=[],P=[],_=new Float32Array(Q*2),L=new Float32Array(Q);for(let S=0;S<Q;S++){let I=R[S%Math.max(1,R.length)]??{x:0.5,y:0.5};B[S*3]=(O()-0.5)*q[0],B[S*3+1]=(O()-0.5)*q[1],B[S*3+2]=(O()-0.5)*q[2],C[S*3]=(I.x-0.5)*W,C[S*3+1]=(0.5-I.y)*W*k,C[S*3+2]=(O()-0.5)*0.05,T.push(new wJ().setFromAxisAngle(new A(O()-0.5,O()-0.5,O()-0.5).normalize(),O()*Math.PI*2)),P.push(new wJ().setFromAxisAngle(new A(0,0,1),(O()-0.5)*0.35)),_[S*2]=Z*(0.7+O()*0.7),_[S*2+1]=Z*(0.7+O()*0.7),L[S]=O()*K,D.setColorAt(S,E[Math.floor(O()*E.length)])}if(D.instanceColor)D.instanceColor.needsUpdate=!0;let z=(S)=>{let I=X>0?(S-Y)/X:S<Y?0:1;if(I=Math.min(1,Math.max(0,I)),U)I=1-I;for(let j=0;j<Q;j++){let b=H(mX(I,L[j],K));vK.set(B[j*3]+(C[j*3]-B[j*3])*b,B[j*3+1]+(C[j*3+1]-B[j*3+1])*b,B[j*3+2]+(C[j*3+2]-B[j*3+2])*b),yK.slerpQuaternions(T[j],P[j],b),fK.set(_[j*2],_[j*2+1],1),xK.compose(vK,yK,fK),D.setMatrixAt(j,xK)}D.instanceMatrix.needsUpdate=!0};return z(0),{mesh:D,writer:z}}var G1=`
4424
+ }`};function bK(J){let Q=new U7;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=E6.degToRad(90-Z),X=E6.degToRad(W),K=new j().setFromSphericalCoords(1,Y,X);return $.sunPosition.value.copy(K),{sky:Q,sunDirection:K}}function DF(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 fK=new j,gK=new PJ,pK=new j,dK=new S0;function uK(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=k9(J.getAttribute("start"),0.5),X=k9(J.getAttribute("duration"),3.5),K=Math.min(0.95,Math.max(0,L0(J.getAttribute("stagger"),0.5))),H=TQ(J.getAttribute("ease"),"power3.inOut"),U=(J.getAttribute("mode")??"gather").toLowerCase()==="disperse",G=OJ(J.getAttribute("position"),[0,0,0]),F=OJ(J.getAttribute("scatter"),[W*1.6,W*0.8,W]),E=(J.getAttribute("palette")??"#fafafa,#e4e4e7,#ef4444,#18181b").split(",").map((A)=>new R0(A.trim())),O=z6($),{points:R,aspect:C}=DF(J.getAttribute("text")??"STEREOFRAME",J.getAttribute("font")??"900 140px sans-serif",Q,O),q=new M9(1,0.72),N=new X9({roughness:0.92,metalness:0,side:cJ}),L=new q6(q,N,Q);L.position.set(G[0],G[1],G[2]),L.frustumCulled=!1;let M=new Float32Array(Q*3),k=new Float32Array(Q*3),_=[],P=[],V=new Float32Array(Q*2),D=new Float32Array(Q);for(let A=0;A<Q;A++){let z=R[A%Math.max(1,R.length)]??{x:0.5,y:0.5};M[A*3]=(O()-0.5)*F[0],M[A*3+1]=(O()-0.5)*F[1],M[A*3+2]=(O()-0.5)*F[2],k[A*3]=(z.x-0.5)*W,k[A*3+1]=(0.5-z.y)*W*C,k[A*3+2]=(O()-0.5)*0.05,_.push(new PJ().setFromAxisAngle(new j(O()-0.5,O()-0.5,O()-0.5).normalize(),O()*Math.PI*2)),P.push(new PJ().setFromAxisAngle(new j(0,0,1),(O()-0.5)*0.35)),V[A*2]=Z*(0.7+O()*0.7),V[A*2+1]=Z*(0.7+O()*0.7),D[A]=O()*K,L.setColorAt(A,E[Math.floor(O()*E.length)])}if(L.instanceColor)L.instanceColor.needsUpdate=!0;let B=(A)=>{let z=X>0?(A-Y)/X:A<Y?0:1;if(z=Math.min(1,Math.max(0,z)),U)z=1-z;for(let S=0;S<Q;S++){let y=H(nX(z,D[S],K));fK.set(M[S*3]+(k[S*3]-M[S*3])*y,M[S*3+1]+(k[S*3+1]-M[S*3+1])*y,M[S*3+2]+(k[S*3+2]-M[S*3+2])*y),gK.slerpQuaternions(_[S],P[S],y),pK.set(V[S*2],V[S*2+1],1),dK.compose(fK,gK,pK),L.setMatrixAt(S,dK)}L.instanceMatrix.needsUpdate=!0};return B(0),{mesh:L,writer:B}}var MF=`
4425
4425
  uniform vec3 uColor;
4426
4426
  uniform float uOpacity;
4427
4427
  varying float vFade;
@@ -4431,7 +4431,7 @@ void main() {
4431
4431
  if (alpha < 0.003) discard;
4432
4432
  gl_FragColor = vec4(uColor, alpha);
4433
4433
  }
4434
- `,E1=`
4434
+ `,kF=`
4435
4435
  attribute vec3 aVel;
4436
4436
  attribute float aBirth;
4437
4437
  attribute float aLife;
@@ -4448,7 +4448,7 @@ void main() {
4448
4448
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4449
4449
  gl_Position = projectionMatrix * mv;
4450
4450
  }
4451
- `,q1=`
4451
+ `,BF=`
4452
4452
  attribute vec3 aWobble; // x: phase, y: fall speed, z: sway amplitude
4453
4453
  uniform float uTime;
4454
4454
  uniform float uSize;
@@ -4464,7 +4464,7 @@ void main() {
4464
4464
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4465
4465
  gl_Position = projectionMatrix * mv;
4466
4466
  }
4467
- `,F1=`
4467
+ `,VF=`
4468
4468
  attribute vec3 aFreq;
4469
4469
  attribute vec3 aPhase;
4470
4470
  uniform float uTime;
@@ -4482,8 +4482,8 @@ void main() {
4482
4482
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4483
4483
  gl_Position = projectionMatrix * mv;
4484
4484
  }
4485
- `;function bK(J){let Q=(J.getAttribute("preset")??"fountain").toLowerCase(),$=Math.max(1,Math.floor(C0(J.getAttribute("count"),500))),Z=Math.floor(C0(J.getAttribute("seed"),1)),W=C0(J.getAttribute("size"),0.08),Y=C0(J.getAttribute("opacity"),0.9),X=new k0(y9(J.getAttribute("color"),"#ffffff")),K=OJ(J.getAttribute("area"),[6,4,6]),H=AQ(Z),U=new BJ,G=new Float32Array($*3),q={value:0},E={uTime:q,uSize:{value:W},uColor:{value:X},uOpacity:{value:Y}},O,R=x6;if(Q==="snow"){let N=new Float32Array($*3);for(let D=0;D<$;D++)G[D*3]=(H()-0.5)*K[0],G[D*3+1]=H()*K[1],G[D*3+2]=(H()-0.5)*K[2],N[D*3]=H()*Math.PI*2,N[D*3+1]=0.4+H()*0.8,N[D*3+2]=0.05+H()*0.25;U.setAttribute("aWobble",new HJ(N,3)),E.uArea={value:{x:K[0],y:K[1],z:K[2]}},O=q1,R=V8}else if(Q==="dust"){let N=new Float32Array($*3),D=new Float32Array($*3);for(let B=0;B<$;B++){G[B*3]=(H()-0.5)*K[0],G[B*3+1]=(H()-0.5)*K[1],G[B*3+2]=(H()-0.5)*K[2];for(let C=0;C<3;C++)N[B*3+C]=0.1+H()*0.5,D[B*3+C]=H()*Math.PI*2}U.setAttribute("aFreq",new HJ(N,3)),U.setAttribute("aPhase",new HJ(D,3)),E.uAmp={value:C0(J.getAttribute("amplitude"),0.4)},O=F1}else{let N=C0(J.getAttribute("speed"),3),D=C0(J.getAttribute("spread"),25),B=C0(J.getAttribute("life"),2.5),C=new Float32Array($*3),T=new Float32Array($),P=new Float32Array($),_=D*Math.PI/180;for(let L=0;L<$;L++){G[L*3]=(H()-0.5)*0.05,G[L*3+1]=0,G[L*3+2]=(H()-0.5)*0.05;let z=H()*Math.PI*2,S=H()*_,I=N*(0.7+H()*0.6);C[L*3]=Math.sin(S)*Math.sin(z)*I,C[L*3+1]=Math.cos(S)*I,C[L*3+2]=Math.sin(S)*Math.cos(z)*I,P[L]=B*(0.6+H()*0.8),T[L]=H()*P[L]}U.setAttribute("aVel",new HJ(C,3)),U.setAttribute("aBirth",new HJ(T,1)),U.setAttribute("aLife",new HJ(P,1)),E.uGravity={value:C0(J.getAttribute("gravity"),4)},O=E1}U.setAttribute("position",new HJ(G,3));let k=new SJ({uniforms:E,vertexShader:O,fragmentShader:G1,transparent:!0,depthWrite:!1,blending:R}),F=new s9(U,k);return F.frustumCulled=!1,F.position.set(...OJ(J.getAttribute("position"),[0,0,0])),{points:F,timeUniform:q}}function N1(J){let Q=J.closest("[data-composition-id]"),$=C0(J.getAttribute("width")??Q?.dataset.width??null,1920),Z=C0(J.getAttribute("height")??Q?.dataset.height??null,1080);return{width:$,height:Z}}function gK(J,Q){J.position.set(...OJ(Q.getAttribute("position"),[0,0,0])),J.rotation.set(...dX(Q.getAttribute("rotation"))),J.scale.set(...pX(Q.getAttribute("scale")))}function O1(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 a6(Z(0,1),48,24);case"plane":return new L9(Z(0,1),Z(1,1));case"cylinder":return new i6(Z(0,1),Z(1,1),Z(2,1),48);case"torus":return new r6(Z(0,1),Z(1,0.4),24,96);case"icosahedron":return new o6(Z(0,1),Math.max(0,Math.floor(Z(1,2))));case"rounded-box":return new TQ(Z(0,1),Z(1,1),Z(2,1),4,Z(3,0.08));case"box":default:return new Y9(Z(0,1),Z(1,1),Z(2,1))}}function R1(J){let Q=(J.getAttribute("material")??"standard").toLowerCase(),$=new k0(y9(J.getAttribute("color"),"#ffffff")),Z=C0(J.getAttribute("metalness"),0),W=new k0(y9(J.getAttribute("emissive"),"#000000")),Y=C0(J.getAttribute("emissive-intensity"),1),X=C0(J.getAttribute("env-map-intensity"),1);if(Q==="glass"||Q==="physical"){let K=Q==="glass";return new mJ({color:$,metalness:Z,roughness:C0(J.getAttribute("roughness"),K?0.08:0.5),transmission:C0(J.getAttribute("transmission"),K?1:0),thickness:C0(J.getAttribute("thickness"),K?0.4:0),ior:C0(J.getAttribute("ior"),1.5),clearcoat:C0(J.getAttribute("clearcoat"),K?1:0),clearcoatRoughness:C0(J.getAttribute("clearcoat-roughness"),0.1),dispersion:C0(J.getAttribute("dispersion"),0),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}return new T9({color:$,metalness:Z,roughness:C0(J.getAttribute("roughness"),0.5),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}function L1(J){let Q=new FJ(O1(J),R1(J));return gK(Q,J),Q}function D1(J,Q){let $=(J.getAttribute("preset")??"").toLowerCase();if($==="studio"){Q.add(new t6(16777215,0.35));let K=new S9(16777215,2.6);K.position.set(3,5,4),Q.add(K);let H=new S9(12571903,1.1);H.position.set(-4,2.5,-3),Q.add(H);return}if($==="soft"){Q.add(new D6(16777215,3358799,1.6));let K=new S9(16777215,1);K.position.set(2,3,4),Q.add(K);return}if($==="sunset"){Q.add(new D6(16767411,2761272,1));let K=new S9(16756848,2.4);K.position.set(-5,1.5,3),Q.add(K);return}let Z=(J.getAttribute("type")??"directional").toLowerCase(),W=new k0(y9(J.getAttribute("color"),"#ffffff")),Y=C0(J.getAttribute("intensity"),1),X;if(Z==="ambient")X=new t6(W,Y);else if(Z==="hemisphere")X=new D6(W,2236979,Y);else if(Z==="point")X=new M6(W,Y);else X=new S9(W,Y);if("position"in X&&J.getAttribute("position"))X.position.set(...OJ(J.getAttribute("position"),[0,1,0]));Q.add(X)}function ZW(J){let Q=C0(J.getAttribute("duration"),0);if(Q>0)return Q;let $=J.closest("[data-composition-id]"),Z=C0($?.dataset.duration??null,0);return Z>0?Z:5}function pK(J){let{width:Q,height:$}=N1(J),Z={start:C0(J.getAttribute("start"),0),duration:ZW(J),transition:(J.getAttribute("transition")??"cut").toLowerCase()==="crossfade"?"crossfade":"cut",transitionDuration:C0(J.getAttribute("transition-duration"),0.6)},W=document.createElement("canvas");W.width=Q,W.height=$,J.prepend(W);let Y=J.getAttribute("background")??"",X=Y==="transparent"||Y==="",K=new uZ({canvas:W,antialias:!1,alpha:!0});K.setSize(Q,$,!1),K.setPixelRatio(1);let H=(J.getAttribute("tone-mapping")??"aces").toLowerCase();K.toneMapping=H==="none"?aJ:h6,K.toneMappingExposure=C0(J.getAttribute("exposure"),1);let U=new QQ;if(!X&&Y!=="environment")U.background=new k0(y9(Y,"#000000"));let G=new MJ(V6(null,35),Q/$,0.05,200);G.position.set(0,1,5);let q=[],E=new Map,O=new Map,R=[],k=[],F=null,N=null,D=[0,0,0],B=null,C=[],T=[],P=new eZ,_=new QW,L=J.getAttribute("environment");if(L){let S=new Z7(K);k.push(_.loadAsync(L).then((I)=>{let j=S.fromEquirectangular(I).texture;if(U.environment=j,Y==="environment")U.background=j;I.dispose(),S.dispose()}))}for(let S of Array.from(J.children)){let I=S.tagName.toLowerCase();if(I==="sf-camera"){G.fov=V6(S.getAttribute("fov"),35),G.far=C0(S.getAttribute("far"),200),G.position.set(...OJ(S.getAttribute("position"),[0,1,5])),G.updateProjectionMatrix();let j=S.getAttribute("look-at");if(D=OJ(S.getAttribute("look-at-offset"),[0,0,0]),j&&j.startsWith("#"))N=j.slice(1);else if(j)F={point:OJ(j,[0,0,0])}}else if(I==="sf-mesh"){let j=L1(S);if(U.add(j),S.id)E.set(S.id,j)}else if(I==="sf-model"){let j=new W9;if(gK(j,S),U.add(j),S.id)E.set(S.id,j);let b=S.getAttribute("src"),v=S.getAttribute("clip");if(b)k.push(P.loadAsync(b).then((x)=>{if(j.add(x.scene),x.animations.length>0){let p=new DQ(x.scene),d=new Map,n=v??x.animations[0].name;for(let r of x.animations){let Y0=p.clipAction(r);Y0.setEffectiveTimeScale(1),Y0.setEffectiveWeight(r.name===n?1:0),Y0.play(),d.set(r.name,Y0)}O.set(j,d),q.push(p)}}))}else if(I==="sf-light")D1(S,U);else if(I==="sf-particles"){let{points:j,timeUniform:b}=bK(S);if(U.add(j),S.id)E.set(S.id,j);R.push(b)}else if(I==="sf-sky"){let{sky:j,sunDirection:b}=jK(S);if(U.add(j),S.id)E.set(S.id,j);B=b}else if(I==="sf-ocean"){let j=SK(S);if(U.add(j.water),S.id)E.set(S.id,j.water);R.push(j.timeProxy),k.push(j.pending),C.push(j)}else if(I==="sf-swarm"){let j=hK(S);if(U.add(j.mesh),S.id)E.set(S.id,j.mesh);T.push(j.writer)}}if(B)for(let S of C)S.setSunDirection(B);let z=Promise.all(k).then(async()=>{if(N){let S=E.get(N);if(S)F={object:S,offset:D}}try{await K.compileAsync(U,G)}catch{K.compile(U,G)}});return{host:J,width:Q,height:$,canvas:W,shot:Z,renderer:K,scene:U,camera:G,mixers:q,get lookAt(){return F},objectsById:E,actionsByObject:O,seekFns:T,lateSeekFns:[],timeUniforms:R,ready:z}}function SQ(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 jQ=new nJ,dK=new A8,uK=new S0,M1=new A,WW=null;function k1(J){if(!WW){let Y=document.createElement("canvas");Y.width=64,Y.height=36,WW={canvas:Y,ctx:Y.getContext("2d",{willReadFrequently:!0})}}let{canvas:Q,ctx:$}=WW;$.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 YW(J){return Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.z)}function mK(J,Q){return J.map(($)=>{let Z=SQ(Q,$.shot),W=0,Y=0,X=0,K=!YW($.camera.position);$.scene.traverse((G)=>{if(!YW(G.position)||!YW(G.scale))K=!0;if(G instanceof a9)X++;if(G instanceof FJ||G instanceof s9){W++;let q=G.material,E=Array.isArray(q)?q[0]?.type:q?.type;if(E==="MeshStandardMaterial"||E==="MeshPhysicalMaterial")Y++}}),$.camera.updateMatrixWorld(),uK.multiplyMatrices($.camera.projectionMatrix,$.camera.matrixWorldInverse),dK.setFromProjectionMatrix(uK);let H=0,U=0;for(let G of $.scene.children){let q=!1;if(G.traverse((E)=>{if(E instanceof FJ||E instanceof s9)q=!0}),!q)continue;if(H++,jQ.setFromObject(G),jQ.isEmpty())continue;if(dK.intersectsBox(jQ))U++;else if(jQ.getCenter(M1).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?k1($.canvas):null}})}function lK(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 H7=new A;function cK(){return document.querySelector("[data-composition-id]")===null}function nK(){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 B1(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(H7),H7.x+=Z.offset[0],H7.y+=Z.offset[1],H7.z+=Z.offset[2],J.camera.lookAt(H7);else J.camera.lookAt(Z.point[0],Z.point[1],Z.point[2]);J.renderer.render(J.scene,J.camera)}function V1(){let J=Array.from(document.querySelectorAll(".clip[data-start]")).map((Q)=>({el:Q,start:D9(Q.dataset.start??null,0),duration:D9(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 sK(J,Q){let $=!1,Z=typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0,W=Q.standalone?V1():null,Y=(H)=>{if(Z=H,!$)return;W?.(H);for(let U of J){let G=SQ(H,U.shot);if(U.canvas.style.display=G.visible?"":"none",U.canvas.style.opacity=G.opacity>=1?"":String(G.opacity),G.visible)B1(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),mK(J,H)},fingerprint:(H)=>{return Y(H),lK(J)}};return window.__stereoframe=K,{markReady:()=>{$=!0,K.ready=!0,Y(typeof window.__hfThreeTime==="number"?window.__hfThreeTime:Z)}}}function iK(J){let Q=performance.now(),$=()=>{let Z=(performance.now()-Q)/1000%Math.max(0.001,J);window.__stereoframe?.seek(Z),requestAnimationFrame($)};requestAnimationFrame($)}var z1=`
4485
+ `;function mK(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 R0(K9(J.getAttribute("color"),"#ffffff")),K=OJ(J.getAttribute("area"),[6,4,6]),H=z6(Z),U=new RJ,G=new Float32Array($*3),F={value:0},E={uTime:F,uSize:{value:W},uColor:{value:X},uOpacity:{value:Y}},O,R=f6;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 JJ(N,3)),E.uArea={value:{x:K[0],y:K[1],z:K[2]}},O=BF,R=V8}else if(Q==="dust"){let N=new Float32Array($*3),L=new Float32Array($*3);for(let M=0;M<$;M++){G[M*3]=(H()-0.5)*K[0],G[M*3+1]=(H()-0.5)*K[1],G[M*3+2]=(H()-0.5)*K[2];for(let k=0;k<3;k++)N[M*3+k]=0.1+H()*0.5,L[M*3+k]=H()*Math.PI*2}U.setAttribute("aFreq",new JJ(N,3)),U.setAttribute("aPhase",new JJ(L,3)),E.uAmp={value:L0(J.getAttribute("amplitude"),0.4)},O=VF}else{let N=L0(J.getAttribute("speed"),3),L=L0(J.getAttribute("spread"),25),M=L0(J.getAttribute("life"),2.5),k=new Float32Array($*3),_=new Float32Array($),P=new Float32Array($),V=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 B=H()*Math.PI*2,A=H()*V,z=N*(0.7+H()*0.6);k[D*3]=Math.sin(A)*Math.sin(B)*z,k[D*3+1]=Math.cos(A)*z,k[D*3+2]=Math.sin(A)*Math.cos(B)*z,P[D]=M*(0.6+H()*0.8),_[D]=H()*P[D]}U.setAttribute("aVel",new JJ(k,3)),U.setAttribute("aBirth",new JJ(_,1)),U.setAttribute("aLife",new JJ(P,1)),E.uGravity={value:L0(J.getAttribute("gravity"),4)},O=kF}U.setAttribute("position",new JJ(G,3));let C=new SJ({uniforms:E,vertexShader:O,fragmentShader:MF,transparent:!0,depthWrite:!1,blending:R}),q=new s9(U,C);return q.frustumCulled=!1,q.position.set(...OJ(J.getAttribute("position"),[0,0,0])),{points:q,timeUniform:F}}function CF(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 lK(J,Q){J.position.set(...OJ(Q.getAttribute("position"),[0,0,0])),J.rotation.set(...cX(Q.getAttribute("rotation"))),J.scale.set(...lX(Q.getAttribute("scale")))}function IF(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 t6(Z(0,1),48,24);case"plane":return new M9(Z(0,1),Z(1,1));case"cylinder":return new a6(Z(0,1),Z(1,1),Z(2,1),48);case"torus":return new e6(Z(0,1),Z(1,0.4),24,96);case"icosahedron":return new r6(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 Y9(Z(0,1),Z(1,1),Z(2,1))}}function cK(J){let Q=(J.getAttribute("material")??"standard").toLowerCase(),$=new R0(K9(J.getAttribute("color"),"#ffffff")),Z=L0(J.getAttribute("metalness"),0),W=new R0(K9(J.getAttribute("emissive"),"#000000")),Y=L0(J.getAttribute("emissive-intensity"),1),X=L0(J.getAttribute("env-map-intensity"),1);if(Q==="glass"||Q==="physical"){let K=Q==="glass";return new lJ({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 X9({color:$,metalness:Z,roughness:L0(J.getAttribute("roughness"),0.5),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}function zF(J){let Q=new GJ(IF(J),cK(J));return lK(Q,J),Q}function wF(J,Q){let $=(J.getAttribute("preset")??"").toLowerCase();if($==="studio"){Q.add(new J7(16777215,0.35));let K=new j9(16777215,2.6);K.position.set(3,5,4),Q.add(K);let H=new j9(12571903,1.1);H.position.set(-4,2.5,-3),Q.add(H);return}if($==="soft"){Q.add(new M6(16777215,3358799,1.6));let K=new j9(16777215,1);K.position.set(2,3,4),Q.add(K);return}if($==="sunset"){Q.add(new M6(16767411,2761272,1));let K=new j9(16756848,2.4);K.position.set(-5,1.5,3),Q.add(K);return}let Z=(J.getAttribute("type")??"directional").toLowerCase(),W=new R0(K9(J.getAttribute("color"),"#ffffff")),Y=L0(J.getAttribute("intensity"),1),X;if(Z==="ambient")X=new J7(W,Y);else if(Z==="hemisphere")X=new M6(W,2236979,Y);else if(Z==="point")X=new k6(W,Y);else X=new j9(W,Y);if("position"in X&&J.getAttribute("position"))X.position.set(...OJ(J.getAttribute("position"),[0,1,0]));Q.add(X)}function KW(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 nK(J){let{width:Q,height:$}=CF(J),Z={start:L0(J.getAttribute("start"),0),duration:KW(J),transition:(J.getAttribute("transition")??"cut").toLowerCase()==="crossfade"?"crossfade":"cut",transitionDuration:L0(J.getAttribute("transition-duration"),0.6)},W=document.createElement("canvas");W.width=Q,W.height=$,J.prepend(W);let Y=J.getAttribute("background")??"",X=Y==="transparent"||Y==="",K=new lZ({canvas:W,antialias:!1,alpha:!0});K.setSize(Q,$,!1),K.setPixelRatio(1);let H=(J.getAttribute("tone-mapping")??"aces").toLowerCase();K.toneMapping=H==="none"?rJ:g6,K.toneMappingExposure=L0(J.getAttribute("exposure"),1);let U=new ZQ;if(!X&&Y!=="environment")U.background=new R0(K9(Y,"#000000"));let G=new kJ(C6(null,35),Q/$,0.05,200);G.position.set(0,1,5);let F=[],E=new Map,O=new Map,R=[],C=[],q=null,N=null,L=[0,0,0],M=null,k=[],_=[],P=new $W,V=new WW,D=J.getAttribute("environment");if(D){let A=new Y7(K);C.push(V.loadAsync(D).then((z)=>{let S=A.fromEquirectangular(z).texture;if(U.environment=S,Y==="environment")U.background=S;z.dispose(),A.dispose()}))}for(let A of Array.from(J.children)){let z=A.tagName.toLowerCase();if(z==="sf-camera"){G.fov=C6(A.getAttribute("fov"),35),G.far=L0(A.getAttribute("far"),200),G.position.set(...OJ(A.getAttribute("position"),[0,1,5])),G.updateProjectionMatrix();let S=A.getAttribute("look-at");if(L=OJ(A.getAttribute("look-at-offset"),[0,0,0]),S&&S.startsWith("#"))N=S.slice(1);else if(S)q={point:OJ(S,[0,0,0])}}else if(z==="sf-mesh"){let S=zF(A);if(U.add(S),A.id)E.set(A.id,S)}else if(z==="sf-model"){let S=new W9;if(lK(S,A),U.add(S),A.id)E.set(A.id,S);let y=A.getAttribute("src"),v=A.getAttribute("clip");if(y)C.push(P.loadAsync(y).then((h)=>{if(S.add(h.scene),h.animations.length>0){let g=new kQ(h.scene),p=new Map,c=v??h.animations[0].name;for(let a of h.animations){let Q0=g.clipAction(a);Q0.setEffectiveTimeScale(1),Q0.setEffectiveWeight(a.name===c?1:0),Q0.play(),p.set(a.name,Q0)}O.set(S,p),F.push(g)}}))}else if(z==="sf-light")wF(A,U);else if(z==="sf-particles"){let{points:S,timeUniform:y}=mK(A);if(U.add(S),A.id)E.set(A.id,S);R.push(y)}else if(z==="sf-sky"){let{sky:S,sunDirection:y}=bK(A);if(U.add(S),A.id)E.set(A.id,S);M=y}else if(z==="sf-ocean"){let S=xK(A);if(U.add(S.water),A.id)E.set(A.id,S.water);R.push(S.timeProxy),C.push(S.pending),k.push(S)}else if(z==="sf-swarm"){let S=uK(A);if(U.add(S.mesh),A.id)E.set(A.id,S.mesh);_.push(S.writer)}else if(z==="sf-metaball"){let S=hK(A,cK(A));if(U.add(S.mesh),A.id)E.set(A.id,S.mesh);_.push(S.writer)}}if(M)for(let A of k)A.setSunDirection(M);let B=Promise.all(C).then(async()=>{if(N){let A=E.get(N);if(A)q={object:A,offset:L}}try{await K.compileAsync(U,G)}catch{K.compile(U,G)}});return{host:J,width:Q,height:$,canvas:W,shot:Z,renderer:K,scene:U,camera:G,mixers:F,get lookAt(){return q},objectsById:E,actionsByObject:O,seekFns:_,lateSeekFns:[],timeUniforms:R,ready:B}}function vQ(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 yQ=new sJ,sK=new A8,iK=new S0,PF=new j,HW=null;function _F(J){if(!HW){let Y=document.createElement("canvas");Y.width=64,Y.height=36,HW={canvas:Y,ctx:Y.getContext("2d",{willReadFrequently:!0})}}let{canvas:Q,ctx:$}=HW;$.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 UW(J){return Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.z)}function oK(J,Q){return J.map(($)=>{let Z=vQ(Q,$.shot),W=0,Y=0,X=0,K=!UW($.camera.position);$.scene.traverse((G)=>{if(!UW(G.position)||!UW(G.scale))K=!0;if(G instanceof a9)X++;if(G instanceof GJ||G instanceof s9){W++;let F=G.material,E=Array.isArray(F)?F[0]?.type:F?.type;if(E==="MeshStandardMaterial"||E==="MeshPhysicalMaterial")Y++}}),$.camera.updateMatrixWorld(),iK.multiplyMatrices($.camera.projectionMatrix,$.camera.matrixWorldInverse),sK.setFromProjectionMatrix(iK);let H=0,U=0;for(let G of $.scene.children){let F=!1;if(G.traverse((E)=>{if(E instanceof GJ||E instanceof s9)F=!0}),!F)continue;if(H++,yQ.setFromObject(G),yQ.isEmpty())continue;if(sK.intersectsBox(yQ))U++;else if(yQ.getCenter(PF).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?_F($.canvas):null}})}function aK(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 G7=new j;function rK(){return document.querySelector("[data-composition-id]")===null}function tK(){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 TF(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(G7),G7.x+=Z.offset[0],G7.y+=Z.offset[1],G7.z+=Z.offset[2],J.camera.lookAt(G7);else J.camera.lookAt(Z.point[0],Z.point[1],Z.point[2]);J.renderer.render(J.scene,J.camera)}function AF(){let J=Array.from(document.querySelectorAll(".clip[data-start]")).map((Q)=>({el:Q,start:k9(Q.dataset.start??null,0),duration:k9(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 eK(J,Q){let $=!1,Z=typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0,W=Q.standalone?AF():null,Y=(H)=>{if(Z=H,!$)return;W?.(H);for(let U of J){let G=vQ(H,U.shot);if(U.canvas.style.display=G.visible?"":"none",U.canvas.style.opacity=G.opacity>=1?"":String(G.opacity),G.visible)TF(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),oK(J,H)},fingerprint:(H)=>{return Y(H),aK(J)}};return window.__stereoframe=K,{markReady:()=>{$=!0,K.ready=!0,Y(typeof window.__hfThreeTime==="number"?window.__hfThreeTime:Z)}}}function JH(J){let Q=performance.now(),$=()=>{let Z=(performance.now()-Q)/1000%Math.max(0.001,J);window.__stereoframe?.seek(Z),requestAnimationFrame($)};requestAnimationFrame($)}var SF=`
4486
4486
  sf-scene { display: block; line-height: 0; }
4487
4487
  sf-scene > canvas { display: block; }
4488
- sf-camera, sf-model, sf-mesh, sf-light, sf-env, sf-animate, sf-particles, sf-sky, sf-ocean, sf-swarm { display: none; }
4489
- `;function C1(){if(document.getElementById("__stereoframe-styles"))return;let J=document.createElement("style");J.id="__stereoframe-styles",J.textContent=z1,document.head.appendChild(J)}function I1(J){let Q=0;for(let $ of J){let Z=D9($.getAttribute("start"),0);Q=Math.max(Q,Z+ZW($))}if(Q<=0)return console.warn('[stereoframe] no duration found; add duration="<seconds>" to <sf-scene>. Using 5s.'),5;return Q}async function oK(){C1();let J=Array.from(document.querySelectorAll("sf-scene"));if(J.length===0)return;let Q=cK(),$=Q?null:nK(),Z=I1(J),W=J.map(pK),Y=sK(W,{duration:Z,standalone:Q});await Promise.all(W.map((X)=>X.ready));for(let X of W)JK(X);if(_1(W),Y.markReady(),$?.open(),Q&&new URLSearchParams(location.search).has("sf-preview"))iK(Z)}function _1(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 oK();export{oK as boot};
4488
+ sf-camera, sf-model, sf-mesh, sf-light, sf-env, sf-animate, sf-particles, sf-sky, sf-ocean, sf-swarm, sf-metaball { display: none; }
4489
+ `;function jF(){if(document.getElementById("__stereoframe-styles"))return;let J=document.createElement("style");J.id="__stereoframe-styles",J.textContent=SF,document.head.appendChild(J)}function vF(J){let Q=0;for(let $ of J){let Z=k9($.getAttribute("start"),0);Q=Math.max(Q,Z+KW($))}if(Q<=0)return console.warn('[stereoframe] no duration found; add duration="<seconds>" to <sf-scene>. Using 5s.'),5;return Q}async function QH(){jF();let J=Array.from(document.querySelectorAll("sf-scene"));if(J.length===0)return;let Q=rK(),$=Q?null:tK(),Z=vF(J),W=J.map(nK),Y=eK(W,{duration:Z,standalone:Q});await Promise.all(W.map((X)=>X.ready));for(let X of W)WK(X);if(yF(W),Y.markReady(),$?.open(),Q&&new URLSearchParams(location.search).has("sf-preview"))JH(Z)}function yF(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 QH();export{QH as boot};