ecspresso 0.14.0 → 0.14.2

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,8 +1,8 @@
1
- var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null,Q)}var Y5=(J,Q)=>{for(var $ in Q)W5(J,$,{get:Q[$],enumerable:!0,configurable:!0,set:H5.bind(Q,$)})};var CY=(J,Q)=>()=>(J&&(Q=J(J=0)),Q);var d1=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:(Q,$)=>(typeof require<"u"?require:Q)[$]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});function X5(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function L7(J,Q){return new U5[J](Q)}function sU(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function B7(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function rK(){let J=B7("canvas");return J.style.display="block",J}function iU(J){$8=J}function oU(){return $8}function z7(...J){let Q="THREE."+J.shift();if($8)$8("log",Q,...J);else console.log(Q,...J)}function aU(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 U0(...J){J=aU(J);let Q="THREE."+J.shift();if($8)$8("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function S0(...J){J=aU(J);let Q="THREE."+J.shift();if($8)$8("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function I7(...J){let Q=J.join(" ");if(Q in wY)return;wY[Q]=!0,U0(...J)}function rU(J,Q,$){return new Promise(function(Z,W){function K(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:W();break;case J.TIMEOUT_EXPIRED:setTimeout(K,$);break;default:Z()}}setTimeout(K,$)})}class H9{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,K=Z.length;W<K;W++)Z[W].call(this,J);J.target=null}}}function eJ(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,Z=Math.random()*4294967295|0;return(vJ[J&255]+vJ[J>>8&255]+vJ[J>>16&255]+vJ[J>>24&255]+"-"+vJ[Q&255]+vJ[Q>>8&255]+"-"+vJ[Q>>16&15|64]+vJ[Q>>24&255]+"-"+vJ[$&63|128]+vJ[$>>8&255]+"-"+vJ[$>>16&255]+vJ[$>>24&255]+vJ[Z&255]+vJ[Z>>8&255]+vJ[Z>>16&255]+vJ[Z>>24&255]).toLowerCase()}function p0(J,Q,$){return Math.max(Q,Math.min($,J))}function tK(J,Q){return(J%Q+Q)%Q}function G5(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function E5(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function H6(J,Q,$){return(1-$)*J+$*Q}function N5(J,Q,$,Z){return H6(J,Q,1-Math.exp(-$*Z))}function q5(J,Q=1){return Q-Math.abs(tK(J,Q*2)-Q)}function D5(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function F5(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 R5(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function O5(J,Q){return J+Math.random()*(Q-J)}function k5(J){return J*(0.5-Math.random())}function M5(J){if(J!==void 0)PY=J;let Q=PY+=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 L5(J){return J*S8}function V5(J){return J*j8}function B5(J){return(J&J-1)===0&&J!==0}function z5(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function I5(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function _5(J,Q,$,Z,W){let{cos:K,sin:H}=Math,Y=K($/2),X=H($/2),U=K((Q+Z)/2),G=H((Q+Z)/2),N=K((Q-Z)/2),E=H((Q-Z)/2),q=K((Z-Q)/2),R=H((Z-Q)/2);switch(W){case"XYX":J.set(Y*G,X*N,X*E,Y*U);break;case"YZY":J.set(X*E,Y*G,X*N,Y*U);break;case"ZXZ":J.set(X*N,X*E,Y*G,Y*U);break;case"XZX":J.set(Y*G,X*R,X*q,Y*U);break;case"YXY":J.set(X*q,Y*G,X*R,Y*U);break;case"ZYZ":J.set(X*R,X*q,Y*G,Y*U);break;default:U0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function pJ(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 o0(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.")}}class c0{constructor(J,Q,$,Z,W,K,H,Y,X){if(c0.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,K,H,Y,X)}set(J,Q,$,Z,W,K,H,Y,X){let U=this.elements;return U[0]=J,U[1]=Z,U[2]=H,U[3]=Q,U[4]=W,U[5]=Y,U[6]=$,U[7]=K,U[8]=X,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,K=$[0],H=$[3],Y=$[6],X=$[1],U=$[4],G=$[7],N=$[2],E=$[5],q=$[8],R=Z[0],O=Z[3],F=Z[6],D=Z[1],k=Z[4],L=Z[7],V=Z[2],w=Z[5],_=Z[8];return W[0]=K*R+H*D+Y*V,W[3]=K*O+H*k+Y*w,W[6]=K*F+H*L+Y*_,W[1]=X*R+U*D+G*V,W[4]=X*O+U*k+G*w,W[7]=X*F+U*L+G*_,W[2]=N*R+E*D+q*V,W[5]=N*O+E*k+q*w,W[8]=N*F+E*L+q*_,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],K=J[4],H=J[5],Y=J[6],X=J[7],U=J[8];return Q*K*U-Q*H*X-$*W*U+$*H*Y+Z*W*X-Z*K*Y}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],K=J[4],H=J[5],Y=J[6],X=J[7],U=J[8],G=U*K-H*X,N=H*Y-U*W,E=X*W-K*Y,q=Q*G+$*N+Z*E;if(q===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/q;return J[0]=G*R,J[1]=(Z*X-U*$)*R,J[2]=(H*$-Z*K)*R,J[3]=N*R,J[4]=(U*Q-Z*Y)*R,J[5]=(Z*W-H*Q)*R,J[6]=E*R,J[7]=($*Y-X*Q)*R,J[8]=(K*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,K,H){let Y=Math.cos(W),X=Math.sin(W);return this.set($*Y,$*X,-$*(Y*K+X*H)+K+J,-Z*X,Z*Y,-Z*(-X*K+Y*H)+H+Q,0,0,1),this}scale(J,Q){return this.premultiply(EW.makeScale(J,Q)),this}rotate(J){return this.premultiply(EW.makeRotation(-J)),this}translate(J,Q){return this.premultiply(EW.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)}}function A5(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(W,K,H){if(this.enabled===!1||K===H||!K||!H)return W;if(this.spaces[K].transfer==="srgb")W.r=g9(W.r),W.g=g9(W.g),W.b=g9(W.b);if(this.spaces[K].primaries!==this.spaces[H].primaries)W.applyMatrix3(this.spaces[K].toXYZ),W.applyMatrix3(this.spaces[H].fromXYZ);if(this.spaces[H].transfer==="srgb")W.r=V7(W.r),W.g=V7(W.g),W.b=V7(W.b);return W},workingToColorSpace:function(W,K){return this.convert(W,this.workingColorSpace,K)},colorSpaceToWorking:function(W,K){return this.convert(W,K,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,K=this.workingColorSpace){return W.fromArray(this.spaces[K].luminanceCoefficients)},define:function(W){Object.assign(this.spaces,W)},_getMatrix:function(W,K,H){return W.copy(this.spaces[K].toXYZ).multiply(this.spaces[H].fromXYZ)},_getDrawingBufferColorSpace:function(W){return this.spaces[W].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(W=this.workingColorSpace){return this.spaces[W].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(W,K){return I7("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,K)},toWorkingColorSpace:function(W,K){return I7("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(W,K)}},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:SY,fromXYZ:jY,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:SY,fromXYZ:jY,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}function g9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function V7(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}class KZ{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(J7===void 0)J7=B7("canvas");J7.width=J.width,J7.height=J.height;let Z=J7.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=J7}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=B7("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 K=0;K<W.length;K++)W[K]=g9(W[K]/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(g9(Q[$]/255)*255);else Q[$]=g9(Q[$]);return{data:Q,width:J.width,height:J.height}}else return U0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}class I9{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:C5++}),this.uuid=eJ(),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.displayHeight,Q.displayWidth,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 K=0,H=Z.length;K<H;K++)if(Z[K].isDataTexture)W.push(NW(Z[K].image));else W.push(NW(Z[K]))}else W=NW(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function NW(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return KZ.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 U0("Texture: Unable to serialize Texture."),{}}class m0{constructor(J,Q,$,Z,W,K,H,Y,X,U,G,N,E,q,R,O){if(m0.prototype.isMatrix4=!0,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,K,H,Y,X,U,G,N,E,q,R,O)}set(J,Q,$,Z,W,K,H,Y,X,U,G,N,E,q,R,O){let F=this.elements;return F[0]=J,F[4]=Q,F[8]=$,F[12]=Z,F[1]=W,F[5]=K,F[9]=H,F[13]=Y,F[2]=X,F[6]=U,F[10]=G,F[14]=N,F[3]=E,F[7]=q,F[11]=R,F[15]=O,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 m0().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/Q7.setFromMatrixColumn(J,0).length(),W=1/Q7.setFromMatrixColumn(J,1).length(),K=1/Q7.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]*K,Q[9]=$[9]*K,Q[10]=$[10]*K,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,K=Math.cos($),H=Math.sin($),Y=Math.cos(Z),X=Math.sin(Z),U=Math.cos(W),G=Math.sin(W);if(J.order==="XYZ"){let N=K*U,E=K*G,q=H*U,R=H*G;Q[0]=Y*U,Q[4]=-Y*G,Q[8]=X,Q[1]=E+q*X,Q[5]=N-R*X,Q[9]=-H*Y,Q[2]=R-N*X,Q[6]=q+E*X,Q[10]=K*Y}else if(J.order==="YXZ"){let N=Y*U,E=Y*G,q=X*U,R=X*G;Q[0]=N+R*H,Q[4]=q*H-E,Q[8]=K*X,Q[1]=K*G,Q[5]=K*U,Q[9]=-H,Q[2]=E*H-q,Q[6]=R+N*H,Q[10]=K*Y}else if(J.order==="ZXY"){let N=Y*U,E=Y*G,q=X*U,R=X*G;Q[0]=N-R*H,Q[4]=-K*G,Q[8]=q+E*H,Q[1]=E+q*H,Q[5]=K*U,Q[9]=R-N*H,Q[2]=-K*X,Q[6]=H,Q[10]=K*Y}else if(J.order==="ZYX"){let N=K*U,E=K*G,q=H*U,R=H*G;Q[0]=Y*U,Q[4]=q*X-E,Q[8]=N*X+R,Q[1]=Y*G,Q[5]=R*X+N,Q[9]=E*X-q,Q[2]=-X,Q[6]=H*Y,Q[10]=K*Y}else if(J.order==="YZX"){let N=K*Y,E=K*X,q=H*Y,R=H*X;Q[0]=Y*U,Q[4]=R-N*G,Q[8]=q*G+E,Q[1]=G,Q[5]=K*U,Q[9]=-H*U,Q[2]=-X*U,Q[6]=E*G+q,Q[10]=N-R*G}else if(J.order==="XZY"){let N=K*Y,E=K*X,q=H*Y,R=H*X;Q[0]=Y*U,Q[4]=-G,Q[8]=X*U,Q[1]=N*G+R,Q[5]=K*U,Q[9]=E*G-q,Q[2]=q*G-E,Q[6]=H*U,Q[10]=R*G+N}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(P5,J,T5)}lookAt(J,Q,$){let Z=this.elements;if(rJ.subVectors(J,Q),rJ.lengthSq()===0)rJ.z=1;if(rJ.normalize(),i9.crossVectors($,rJ),i9.lengthSq()===0){if(Math.abs($.z)===1)rJ.x+=0.0001;else rJ.z+=0.0001;rJ.normalize(),i9.crossVectors($,rJ)}return i9.normalize(),qQ.crossVectors(rJ,i9),Z[0]=i9.x,Z[4]=qQ.x,Z[8]=rJ.x,Z[1]=i9.y,Z[5]=qQ.y,Z[9]=rJ.y,Z[2]=i9.z,Z[6]=qQ.z,Z[10]=rJ.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,K=$[0],H=$[4],Y=$[8],X=$[12],U=$[1],G=$[5],N=$[9],E=$[13],q=$[2],R=$[6],O=$[10],F=$[14],D=$[3],k=$[7],L=$[11],V=$[15],w=Z[0],_=Z[4],A=Z[8],M=Z[12],C=Z[1],h=Z[5],S=Z[9],b=Z[13],l=Z[2],v=Z[6],c=Z[10],x=Z[14],m=Z[3],Q0=Z[7],$0=Z[11],G0=Z[15];return W[0]=K*w+H*C+Y*l+X*m,W[4]=K*_+H*h+Y*v+X*Q0,W[8]=K*A+H*S+Y*c+X*$0,W[12]=K*M+H*b+Y*x+X*G0,W[1]=U*w+G*C+N*l+E*m,W[5]=U*_+G*h+N*v+E*Q0,W[9]=U*A+G*S+N*c+E*$0,W[13]=U*M+G*b+N*x+E*G0,W[2]=q*w+R*C+O*l+F*m,W[6]=q*_+R*h+O*v+F*Q0,W[10]=q*A+R*S+O*c+F*$0,W[14]=q*M+R*b+O*x+F*G0,W[3]=D*w+k*C+L*l+V*m,W[7]=D*_+k*h+L*v+V*Q0,W[11]=D*A+k*S+L*c+V*$0,W[15]=D*M+k*b+L*x+V*G0,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],K=J[1],H=J[5],Y=J[9],X=J[13],U=J[2],G=J[6],N=J[10],E=J[14],q=J[3],R=J[7],O=J[11],F=J[15],D=Y*E-X*N,k=H*E-X*G,L=H*N-Y*G,V=K*E-X*U,w=K*N-Y*U,_=K*G-H*U;return Q*(R*D-O*k+F*L)-$*(q*D-O*V+F*w)+Z*(q*k-R*V+F*_)-W*(q*L-R*w+O*_)}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],K=J[4],H=J[5],Y=J[6],X=J[7],U=J[8],G=J[9],N=J[10],E=J[11],q=J[12],R=J[13],O=J[14],F=J[15],D=Q*H-$*K,k=Q*Y-Z*K,L=Q*X-W*K,V=$*Y-Z*H,w=$*X-W*H,_=Z*X-W*Y,A=U*R-G*q,M=U*O-N*q,C=U*F-E*q,h=G*O-N*R,S=G*F-E*R,b=N*F-E*O,l=D*b-k*S+L*h+V*C-w*M+_*A;if(l===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let v=1/l;return J[0]=(H*b-Y*S+X*h)*v,J[1]=(Z*S-$*b-W*h)*v,J[2]=(R*_-O*w+F*V)*v,J[3]=(N*w-G*_-E*V)*v,J[4]=(Y*C-K*b-X*M)*v,J[5]=(Q*b-Z*C+W*M)*v,J[6]=(O*L-q*_-F*k)*v,J[7]=(U*_-N*L+E*k)*v,J[8]=(K*S-H*C+X*A)*v,J[9]=($*C-Q*S-W*A)*v,J[10]=(q*w-R*L+F*D)*v,J[11]=(G*L-U*w-E*D)*v,J[12]=(H*M-K*h-Y*A)*v,J[13]=(Q*h-$*M+Z*A)*v,J[14]=(R*k-q*V-O*D)*v,J[15]=(U*V-G*k+N*D)*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-$,K=J.x,H=J.y,Y=J.z,X=W*K,U=W*H;return this.set(X*K+$,X*H-Z*Y,X*Y+Z*H,0,X*H+Z*Y,U*H+$,U*Y-Z*K,0,X*Y-Z*H,U*Y+Z*K,W*Y*Y+$,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,K){return this.set(1,$,W,0,J,1,K,0,Q,Z,1,0,0,0,0,1),this}compose(J,Q,$){let Z=this.elements,W=Q._x,K=Q._y,H=Q._z,Y=Q._w,X=W+W,U=K+K,G=H+H,N=W*X,E=W*U,q=W*G,R=K*U,O=K*G,F=H*G,D=Y*X,k=Y*U,L=Y*G,V=$.x,w=$.y,_=$.z;return Z[0]=(1-(R+F))*V,Z[1]=(E+L)*V,Z[2]=(q-k)*V,Z[3]=0,Z[4]=(E-L)*w,Z[5]=(1-(N+F))*w,Z[6]=(O+D)*w,Z[7]=0,Z[8]=(q+k)*_,Z[9]=(O-D)*_,Z[10]=(1-(N+R))*_,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 K=Q7.set(Z[0],Z[1],Z[2]).length(),H=Q7.set(Z[4],Z[5],Z[6]).length(),Y=Q7.set(Z[8],Z[9],Z[10]).length();if(W<0)K=-K;U9.copy(this);let X=1/K,U=1/H,G=1/Y;return U9.elements[0]*=X,U9.elements[1]*=X,U9.elements[2]*=X,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=K,$.y=H,$.z=Y,this}makePerspective(J,Q,$,Z,W,K,H=2000,Y=!1){let X=this.elements,U=2*W/(Q-J),G=2*W/($-Z),N=(Q+J)/(Q-J),E=($+Z)/($-Z),q,R;if(Y)q=W/(K-W),R=K*W/(K-W);else if(H===2000)q=-(K+W)/(K-W),R=-2*K*W/(K-W);else if(H===2001)q=-K/(K-W),R=-K*W/(K-W);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+H);return X[0]=U,X[4]=0,X[8]=N,X[12]=0,X[1]=0,X[5]=G,X[9]=E,X[13]=0,X[2]=0,X[6]=0,X[10]=q,X[14]=R,X[3]=0,X[7]=0,X[11]=-1,X[15]=0,this}makeOrthographic(J,Q,$,Z,W,K,H=2000,Y=!1){let X=this.elements,U=2/(Q-J),G=2/($-Z),N=-(Q+J)/(Q-J),E=-($+Z)/($-Z),q,R;if(Y)q=1/(K-W),R=K/(K-W);else if(H===2000)q=-2/(K-W),R=-(K+W)/(K-W);else if(H===2001)q=-1/(K-W),R=-W/(K-W);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+H);return X[0]=U,X[4]=0,X[8]=0,X[12]=N,X[1]=0,X[5]=G,X[9]=0,X[13]=E,X[2]=0,X[6]=0,X[10]=q,X[14]=R,X[3]=0,X[7]=0,X[11]=0,X[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}}class f7{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}}class b7{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new Q8,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 Q8,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new Q8,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P;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,K=null,H=this._targetRay,Y=this._grip,X=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(X&&J.hand){K=!0;for(let R of J.hand.values()){let O=Q.getJointPose(R,$),F=this._getHandJoint(X,R);if(O!==null)F.matrix.fromArray(O.transform.matrix),F.matrix.decompose(F.position,F.rotation,F.scale),F.matrixWorldNeedsUpdate=!0,F.jointRadius=O.radius;F.visible=O!==null}let U=X.joints["index-finger-tip"],G=X.joints["thumb-tip"],N=U.position.distanceTo(G.position),E=0.02,q=0.005;if(X.inputState.pinching&&N>E+q)X.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!X.inputState.pinching&&N<=E-q)X.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(Y!==null&&J.gripSpace){if(W=Q.getPose(J.gripSpace,$),W!==null){if(Y.matrix.fromArray(W.transform.matrix),Y.matrix.decompose(Y.position,Y.rotation,Y.scale),Y.matrixWorldNeedsUpdate=!0,W.linearVelocity)Y.hasLinearVelocity=!0,Y.linearVelocity.copy(W.linearVelocity);else Y.hasLinearVelocity=!1;if(W.angularVelocity)Y.hasAngularVelocity=!0,Y.angularVelocity.copy(W.angularVelocity);else Y.hasAngularVelocity=!1}}if(H!==null){if(Z=Q.getPose(J.targetRaySpace,$),Z===null&&W!==null)Z=W;if(Z!==null){if(H.matrix.fromArray(Z.transform.matrix),H.matrix.decompose(H.position,H.rotation,H.scale),H.matrixWorldNeedsUpdate=!0,Z.linearVelocity)H.hasLinearVelocity=!0,H.linearVelocity.copy(Z.linearVelocity);else H.hasLinearVelocity=!1;if(Z.angularVelocity)H.hasAngularVelocity=!0,H.angularVelocity.copy(Z.angularVelocity);else H.hasAngularVelocity=!1;this.dispatchEvent(f5)}}}if(H!==null)H.visible=Z!==null;if(Y!==null)Y.visible=W!==null;if(X!==null)X.visible=K!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new Q8;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}function FW(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 I6{constructor(J,Q=0.00025){this.isFogExp2=!0,this.name="",this.color=new M0(J),this.density=Q}clone(){return new I6(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class _6{constructor(J,Q=1,$=1000){this.isFog=!0,this.name="",this.color=new M0(J),this.near=Q,this.far=$}clone(){return new _6(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class mJ{constructor(J=new P,Q=new P,$=new P){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),y9.subVectors($,Q),RW.subVectors(J,Q);let K=G9.dot(G9),H=G9.dot(y9),Y=G9.dot(RW),X=y9.dot(y9),U=y9.dot(RW),G=K*X-H*H;if(G===0)return W.set(0,0,0),null;let N=1/G,E=(X*Y-H*U)*N,q=(K*U-H*Y)*N;return W.set(1-E-q,q,E)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,v9)===null)return!1;return v9.x>=0&&v9.y>=0&&v9.x+v9.y<=1}static getInterpolation(J,Q,$,Z,W,K,H,Y){if(this.getBarycoord(J,Q,$,Z,v9)===null){if(Y.x=0,Y.y=0,"z"in Y)Y.z=0;if("w"in Y)Y.w=0;return null}return Y.setScalar(0),Y.addScaledVector(W,v9.x),Y.addScaledVector(K,v9.y),Y.addScaledVector(H,v9.z),Y}static getInterpolatedAttribute(J,Q,$,Z,W,K){return LW.setScalar(0),VW.setScalar(0),BW.setScalar(0),LW.fromBufferAttribute(J,Q),VW.fromBufferAttribute(J,$),BW.fromBufferAttribute(J,Z),K.setScalar(0),K.addScaledVector(LW,W.x),K.addScaledVector(VW,W.y),K.addScaledVector(BW,W.z),K}static isFrontFacing(J,Q,$,Z){return G9.subVectors($,Q),y9.subVectors(J,Q),G9.cross(y9).dot(Z)<0?!0:!1}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),y9.subVectors(this.a,this.b),G9.cross(y9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return mJ.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return mJ.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return mJ.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return mJ.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return mJ.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,K,H;W7.subVectors(Z,$),K7.subVectors(W,$),OW.subVectors(J,$);let Y=W7.dot(OW),X=K7.dot(OW);if(Y<=0&&X<=0)return Q.copy($);kW.subVectors(J,Z);let U=W7.dot(kW),G=K7.dot(kW);if(U>=0&&G<=U)return Q.copy(Z);let N=Y*G-U*X;if(N<=0&&Y>=0&&U<=0)return K=Y/(Y-U),Q.copy($).addScaledVector(W7,K);MW.subVectors(J,W);let E=W7.dot(MW),q=K7.dot(MW);if(q>=0&&E<=q)return Q.copy(W);let R=E*X-Y*q;if(R<=0&&X>=0&&q<=0)return H=X/(X-q),Q.copy($).addScaledVector(K7,H);let O=U*q-E*G;if(O<=0&&G-U>=0&&E-q>=0)return pY.subVectors(W,Z),H=(G-U)/(G-U+(E-q)),Q.copy(Z).addScaledVector(pY,H);let F=1/(O+R+N);return K=R*F,H=N*F,Q.copy($).addScaledVector(W7,K).addScaledVector(K7,H)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class wJ{constructor(J=new P(1/0,1/0,1/0),Q=new P(-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 K=0,H=W.count;K<H;K++){if(J.isMesh===!0)J.getVertexPosition(K,E9);else E9.fromBufferAttribute(W,K);E9.applyMatrix4(J.matrixWorld),this.expandByPoint(E9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();RQ.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();RQ.copy($.boundingBox)}RQ.applyMatrix4(J.matrixWorld),this.union(RQ)}}let Z=J.children;for(let W=0,K=Z.length;W<K;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(i7),OQ.subVectors(this.max,i7),H7.subVectors(J.a,i7),Y7.subVectors(J.b,i7),X7.subVectors(J.c,i7),a9.subVectors(Y7,H7),r9.subVectors(X7,Y7),k8.subVectors(H7,X7);let Q=[0,-a9.z,a9.y,0,-r9.z,r9.y,0,-k8.z,k8.y,a9.z,0,-a9.x,r9.z,0,-r9.x,k8.z,0,-k8.x,-a9.y,a9.x,0,-r9.y,r9.x,0,-k8.y,k8.x,0];if(!zW(Q,H7,Y7,X7,OQ))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!zW(Q,H7,Y7,X7,OQ))return!1;return kQ.crossVectors(a9,r9),Q=[kQ.x,kQ.y,kQ.z],zW(Q,H7,Y7,X7,OQ)}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 f9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),f9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),f9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),f9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),f9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),f9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),f9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),f9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(f9),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}}function zW(J,Q,$,Z,W){for(let K=0,H=J.length-3;K<=H;K+=3){M8.fromArray(J,K);let Y=W.x*Math.abs(M8.x)+W.y*Math.abs(M8.y)+W.z*Math.abs(M8.z),X=Q.dot(M8),U=$.dot(M8),G=Z.dot(M8);if(Math.max(-Math.max(X,U,G),Math.min(X,U,G))>Y)return!1}return!0}function b5(){let J=new ArrayBuffer(4),Q=new Float32Array(J),$=new Uint32Array(J),Z=new Uint32Array(512),W=new Uint32Array(512);for(let X=0;X<256;++X){let U=X-127;if(U<-27)Z[X]=0,Z[X|256]=32768,W[X]=24,W[X|256]=24;else if(U<-14)Z[X]=1024>>-U-14,Z[X|256]=1024>>-U-14|32768,W[X]=-U-1,W[X|256]=-U-1;else if(U<=15)Z[X]=U+15<<10,Z[X|256]=U+15<<10|32768,W[X]=13,W[X|256]=13;else if(U<128)Z[X]=31744,Z[X|256]=64512,W[X]=24,W[X|256]=24;else Z[X]=31744,Z[X|256]=64512,W[X]=13,W[X|256]=13}let K=new Uint32Array(2048),H=new Uint32Array(64),Y=new Uint32Array(64);for(let X=1;X<1024;++X){let U=X<<13,G=0;while((U&8388608)===0)U<<=1,G-=8388608;U&=-8388609,G+=947912704,K[X]=U|G}for(let X=1024;X<2048;++X)K[X]=939524096+(X-1024<<13);for(let X=1;X<31;++X)H[X]=X<<23;H[31]=1199570944,H[32]=2147483648;for(let X=33;X<63;++X)H[X]=2147483648+(X-32<<23);H[63]=3347054592;for(let X=1;X<64;++X)if(X!==32)Y[X]=1024;return{floatView:Q,uint32View:$,baseTable:Z,shiftTable:W,mantissaTable:K,exponentTable:H,offsetTable:Y}}function nJ(J){if(Math.abs(J)>65504)U0("DataUtils.toHalfFloat(): Value out of range.");J=p0(J,-65504,65504),x9.floatView[0]=J;let Q=x9.uint32View[0],$=Q>>23&511;return x9.baseTable[$]+((Q&8388607)>>x9.shiftTable[$])}function W6(J){let Q=J>>10;return x9.uint32View[0]=x9.mantissaTable[x9.offsetTable[Q]+(J&1023)]+x9.exponentTable[Q],x9.floatView[0]}class QH{static toHalfFloat(J){return nJ(J)}static fromHalfFloat(J){return W6(J)}}class KJ{constructor(J,Q,$=!1){if(Array.isArray(J))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:h5++}),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++)MQ.fromBufferAttribute(this,Q),MQ.applyMatrix3(J),this.setXY(Q,MQ.x,MQ.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)VJ.fromBufferAttribute(this,Q),VJ.applyMatrix3(J),this.setXYZ(Q,VJ.x,VJ.y,VJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)VJ.fromBufferAttribute(this,Q),VJ.applyMatrix4(J),this.setXYZ(Q,VJ.x,VJ.y,VJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)VJ.fromBufferAttribute(this,Q),VJ.applyNormalMatrix(J),this.setXYZ(Q,VJ.x,VJ.y,VJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)VJ.fromBufferAttribute(this,Q),VJ.transformDirection(J),this.setXYZ(Q,VJ.x,VJ.y,VJ.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)$=pJ($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=o0($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=pJ(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=o0(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=pJ(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=o0(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=pJ(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=o0(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=pJ(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array),Z=o0(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=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array),W=o0(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}}class zJ{constructor(J=new P,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 x5.setFromPoints(J).getCenter($);let Z=0;for(let W=0,K=J.length;W<K;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;o7.subVectors(J,this.center);let Q=o7.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(o7,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 IW.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(o7.copy(J.center).add(IW)),this.expandByPoint(o7.copy(J.center).sub(IW));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}}class h7{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=eJ()}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=eJ();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=eJ();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}}}class Z8{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++)gJ.fromBufferAttribute(this,Q),gJ.applyMatrix4(J),this.setXYZ(Q,gJ.x,gJ.y,gJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)gJ.fromBufferAttribute(this,Q),gJ.applyNormalMatrix(J),this.setXYZ(Q,gJ.x,gJ.y,gJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)gJ.fromBufferAttribute(this,Q),gJ.transformDirection(J),this.setXYZ(Q,gJ.x,gJ.y,gJ.z);return this}getComponent(J,Q){let $=this.array[J*this.data.stride+this.offset+Q];if(this.normalized)$=pJ($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=o0($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=o0(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=pJ(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=pJ(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=pJ(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=pJ(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=o0(Q,this.array),$=o0($,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=o0(Q,this.array),$=o0($,this.array),Z=o0(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=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array),W=o0(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){z7("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 KJ(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 Z8(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){z7("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}}}}function BQ(J,Q,$,Z,W,K){if(q7.subVectors(J,$).addScalar(0.5).multiply(Z),W!==void 0)t7.x=K*q7.x-W*q7.y,t7.y=W*q7.x+K*q7.y;else t7.copy(q7);J.copy(Q),J.x+=t7.x,J.y+=t7.y,J.applyMatrix4(QG)}class G8{constructor(J=new P,Q=new P(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,b9)),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=b9.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return b9.copy(this.origin).addScaledVector(this.direction,Q),b9.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){CW.copy(J).add(Q).multiplyScalar(0.5),IQ.copy(Q).sub(J).normalize(),t9.copy(this.origin).sub(CW);let W=J.distanceTo(Q)*0.5,K=-this.direction.dot(IQ),H=t9.dot(this.direction),Y=-t9.dot(IQ),X=t9.lengthSq(),U=Math.abs(1-K*K),G,N,E,q;if(U>0)if(G=K*Y-H,N=K*H-Y,q=W*U,G>=0)if(N>=-q)if(N<=q){let R=1/U;G*=R,N*=R,E=G*(G+K*N+2*H)+N*(K*G+N+2*Y)+X}else N=W,G=Math.max(0,-(K*N+H)),E=-G*G+N*(N+2*Y)+X;else N=-W,G=Math.max(0,-(K*N+H)),E=-G*G+N*(N+2*Y)+X;else if(N<=-q)G=Math.max(0,-(-K*W+H)),N=G>0?-W:Math.min(Math.max(-W,-Y),W),E=-G*G+N*(N+2*Y)+X;else if(N<=q)G=0,N=Math.min(Math.max(-W,-Y),W),E=N*(N+2*Y)+X;else G=Math.max(0,-(K*W+H)),N=G>0?W:Math.min(Math.max(-W,-Y),W),E=-G*G+N*(N+2*Y)+X;else N=K>0?-W:W,G=Math.max(0,-(K*N+H)),E=-G*G+N*(N+2*Y)+X;if($)$.copy(this.origin).addScaledVector(this.direction,G);if(Z)Z.copy(CW).addScaledVector(IQ,N);return E}intersectSphere(J,Q){b9.subVectors(J.center,this.origin);let $=b9.dot(this.direction),Z=b9.dot(b9)-$*$,W=J.radius*J.radius;if(Z>W)return null;let K=Math.sqrt(W-Z),H=$-K,Y=$+K;if(Y<0)return null;if(H<0)return this.at(Y,Q);return this.at(H,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,K,H,Y,X=1/this.direction.x,U=1/this.direction.y,G=1/this.direction.z,N=this.origin;if(X>=0)$=(J.min.x-N.x)*X,Z=(J.max.x-N.x)*X;else $=(J.max.x-N.x)*X,Z=(J.min.x-N.x)*X;if(U>=0)W=(J.min.y-N.y)*U,K=(J.max.y-N.y)*U;else W=(J.max.y-N.y)*U,K=(J.min.y-N.y)*U;if($>K||W>Z)return null;if(W>$||isNaN($))$=W;if(K<Z||isNaN(Z))Z=K;if(G>=0)H=(J.min.z-N.z)*G,Y=(J.max.z-N.z)*G;else H=(J.max.z-N.z)*G,Y=(J.min.z-N.z)*G;if($>Y||H>Z)return null;if(H>$||$!==$)$=H;if(Y<Z||Z!==Z)Z=Y;if(Z<0)return null;return this.at($>=0?$:Z,Q)}intersectsBox(J){return this.intersectBox(J,b9)!==null}intersectTriangle(J,Q,$,Z,W){wW.subVectors(Q,J),_Q.subVectors($,J),PW.crossVectors(wW,_Q);let K=this.direction.dot(PW),H;if(K>0){if(Z)return null;H=1}else if(K<0)H=-1,K=-K;else return null;t9.subVectors(this.origin,J);let Y=H*this.direction.dot(_Q.crossVectors(t9,_Q));if(Y<0)return null;let X=H*this.direction.dot(wW.cross(t9));if(X<0)return null;if(Y+X>K)return null;let U=-H*t9.dot(PW);if(U<0)return null;return this.at(U/K,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)}}function m5(J,Q,$,Z,W,K,H,Y){let X;if(Q.side===1)X=Z.intersectTriangle(H,K,W,!0,Y);else X=Z.intersectTriangle(W,K,H,Q.side===0,Y);if(X===null)return null;SQ.copy(Y),SQ.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(SQ);if(U<$.near||U>$.far)return null;return{distance:U,point:SQ.clone(),object:J}}function jQ(J,Q,$,Z,W,K,H,Y,X,U){J.getVertexPosition(Y,CQ),J.getVertexPosition(X,wQ),J.getVertexPosition(U,PQ);let G=m5(J,Q,$,Z,CQ,wQ,PQ,nY);if(G){let N=new P;if(mJ.getBarycoord(nY,CQ,wQ,PQ,N),W)G.uv=mJ.getInterpolatedAttribute(W,Y,X,U,N,new r);if(K)G.uv1=mJ.getInterpolatedAttribute(K,Y,X,U,N,new r);if(H){if(G.normal=mJ.getInterpolatedAttribute(H,Y,X,U,N,new P),G.normal.dot(Z.direction)>0)G.normal.multiplyScalar(-1)}let E={a:Y,b:X,c:U,normal:new P,materialIndex:0};mJ.getNormal(CQ,wQ,PQ,E.normal),G.face=E,G.barycoord=N}return G}class T6{constructor(J=[],Q=[]){this.uuid=eJ(),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){U0("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 m0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new m0;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,K=J.length;W<K;W++){let H=J[W]?J[W].matrixWorld:l5;tY.multiplyMatrices(H,Q[W]),tY.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new T6(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 J9(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[$],K=Q[W];if(K===void 0)U0("Skeleton: No bone found with UUID:",W),K=new P6;this.bones.push(K),this.boneInverses.push(new m0().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 K=Q[Z];J.bones.push(K.uuid);let H=$[Z];J.boneInverses.push(H.toArray())}return J}}class z9{constructor(J=new P(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=yW.subVectors($,Q).cross(c5.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){let $=J.delta(yW),Z=this.normal.dot($);if(Z===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let W=-(J.start.dot(this.normal)+this.constant)/Z;if(W<0||W>1)return null;return Q.copy(J.start).addScaledVector($,W)}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||n5.getNormalMatrix(J),Z=this.coplanarPoint(yW).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)}}class E8{constructor(J=new z9,Q=new z9,$=new z9,Z=new z9,W=new z9,K=new z9){this.planes=[J,Q,$,Z,W,K]}set(J,Q,$,Z,W,K){let H=this.planes;return H[0].copy(J),H[1].copy(Q),H[2].copy($),H[3].copy(Z),H[4].copy(W),H[5].copy(K),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,K=W[0],H=W[1],Y=W[2],X=W[3],U=W[4],G=W[5],N=W[6],E=W[7],q=W[8],R=W[9],O=W[10],F=W[11],D=W[12],k=W[13],L=W[14],V=W[15];if(Z[0].setComponents(X-K,E-U,F-q,V-D).normalize(),Z[1].setComponents(X+K,E+U,F+q,V+D).normalize(),Z[2].setComponents(X+H,E+G,F+R,V+k).normalize(),Z[3].setComponents(X-H,E-G,F-R,V-k).normalize(),$)Z[4].setComponents(Y,N,O,L).normalize(),Z[5].setComponents(X-Y,E-N,F-O,V-L).normalize();else if(Z[4].setComponents(X-Y,E-N,F-O,V-L).normalize(),Q===2000)Z[5].setComponents(X+Y,E+N,F+O,V+L).normalize();else if(Q===2001)Z[5].setComponents(Y,N,O,L).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();V8.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();V8.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(V8)}intersectsSprite(J){V8.center.set(0,0,0);let Q=s5.distanceTo(J.center);return V8.radius=0.7071067811865476+Q,V8.applyMatrix4(J.matrixWorld),this.intersectsSphere(V8)}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(fQ.x=Z.normal.x>0?J.max.x:J.min.x,fQ.y=Z.normal.y>0?J.max.y:J.min.y,fQ.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(fQ)<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 S6{constructor(){this.coordinateSystem=2000}intersectsObject(J,Q){if(!Q.isArrayCamera||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(L9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),V9.setFromProjectionMatrix(L9,Z.coordinateSystem,Z.reversedDepth),V9.intersectsObject(J))return!0}return!1}intersectsSprite(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(L9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),V9.setFromProjectionMatrix(L9,Z.coordinateSystem,Z.reversedDepth),V9.intersectsSprite(J))return!0}return!1}intersectsSphere(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(L9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),V9.setFromProjectionMatrix(L9,Z.coordinateSystem,Z.reversedDepth),V9.intersectsSphere(J))return!0}return!1}intersectsBox(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(L9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),V9.setFromProjectionMatrix(L9,Z.coordinateSystem,Z.reversedDepth),V9.intersectsBox(J))return!0}return!1}containsPoint(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(L9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),V9.setFromProjectionMatrix(L9,Z.coordinateSystem,Z.reversedDepth),V9.containsPoint(J))return!0}return!1}clone(){return new S6}}function vW(J,Q){return J-Q}function i5(J,Q){return J.z-Q.z}function o5(J,Q){return Q.z-J.z}class $G{constructor(){this.index=0,this.pool=[],this.list=[]}push(J,Q,$,Z){let W=this.pool,K=this.list;if(this.index>=W.length)W.push({start:-1,count:-1,z:-1,index:-1});let H=W[this.index];K.push(H),this.index++,H.start=J,H.count=Q,H.z=$,H.index=Z}reset(){this.list.length=0,this.index=0}}function e5(J,Q,$=0){let Z=Q.itemSize;if(J.isInterleavedBufferAttribute||J.array.constructor!==Q.array.constructor){let W=J.count;for(let K=0;K<W;K++)for(let H=0;H<Z;H++)Q.setComponent(K+$,H,J.getComponent(K,H))}else Q.array.set(J.array,$*Z);Q.needsUpdate=!0}function z8(J,Q){if(J.constructor!==Q.constructor){let $=Math.min(J.length,Q.length);for(let Z=0;Z<$;Z++)Q[Z]=J[Z]}else{let $=Math.min(J.length,Q.length);Q.set(new J.constructor(J.buffer,0,$))}}function gQ(J,Q,$,Z,W,K,H){let Y=J.geometry.attributes.position;if(Z$.fromBufferAttribute(Y,W),W$.fromBufferAttribute(Y,K),$.distanceSqToSegment(Z$,W$,bW,WX)>Z)return;bW.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(bW);if(U<Q.near||U>Q.far)return;return{distance:U,point:WX.clone().applyMatrix4(J.matrixWorld),index:H,face:null,faceIndex:null,barycoord:null,object:J}}function XX(J,Q,$,Z,W,K,H){let Y=sW.distanceSqToPoint(J);if(Y<$){let X=new P;sW.closestPointToPoint(J,X),X.applyMatrix4(Z);let U=W.ray.origin.distanceTo(X);if(U<W.near||U>W.far)return;K.push({distance:U,distanceToRay:Math.sqrt(Y),point:X,index:Q,face:null,faceIndex:null,barycoord:null,object:H})}}class Q9{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){U0("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 K=1;K<=J;K++)$=this.getPoint(K/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,K;if(Q)K=Q;else K=J*$[W-1];let H=0,Y=W-1,X;while(H<=Y)if(Z=Math.floor(H+(Y-H)/2),X=$[Z]-K,X<0)H=Z+1;else if(X>0)Y=Z-1;else{Y=Z;break}if(Z=Y,$[Z]===K)return Z/(W-1);let U=$[Z],N=$[Z+1]-U,E=(K-U)/N;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 K=this.getPoint(Z),H=this.getPoint(W),Y=Q||(K.isVector2?new r:new P);return Y.copy(H).sub(K).normalize(),Y}getTangentAt(J,Q){let $=this.getUtoTmapping(J);return this.getTangent($,Q)}computeFrenetFrames(J,Q=!1){let $=new P,Z=[],W=[],K=[],H=new P,Y=new m0;for(let E=0;E<=J;E++){let q=E/J;Z[E]=this.getTangentAt(q,new P)}W[0]=new P,K[0]=new P;let X=Number.MAX_VALUE,U=Math.abs(Z[0].x),G=Math.abs(Z[0].y),N=Math.abs(Z[0].z);if(U<=X)X=U,$.set(1,0,0);if(G<=X)X=G,$.set(0,1,0);if(N<=X)$.set(0,0,1);H.crossVectors(Z[0],$).normalize(),W[0].crossVectors(Z[0],H),K[0].crossVectors(Z[0],W[0]);for(let E=1;E<=J;E++){if(W[E]=W[E-1].clone(),K[E]=K[E-1].clone(),H.crossVectors(Z[E-1],Z[E]),H.length()>Number.EPSILON){H.normalize();let q=Math.acos(p0(Z[E-1].dot(Z[E]),-1,1));W[E].applyMatrix4(Y.makeRotationAxis(H,q))}K[E].crossVectors(Z[E],W[E])}if(Q===!0){let E=Math.acos(p0(W[0].dot(W[J]),-1,1));if(E/=J,Z[0].dot(H.crossVectors(W[0],W[J]))>0)E=-E;for(let q=1;q<=J;q++)W[q].applyMatrix4(Y.makeRotationAxis(Z[q],E*q)),K[q].crossVectors(Z[q],W[q])}return{tangents:Z,normals:W,binormals:K}}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 qH(){let J=0,Q=0,$=0,Z=0;function W(K,H,Y,X){J=K,Q=Y,$=-3*K+3*H-2*Y-X,Z=2*K-2*H+Y+X}return{initCatmullRom:function(K,H,Y,X,U){W(H,Y,U*(Y-K),U*(X-H))},initNonuniformCatmullRom:function(K,H,Y,X,U,G,N){let E=(H-K)/U-(Y-K)/(U+G)+(Y-H)/G,q=(Y-H)/G-(X-H)/(G+N)+(X-Y)/N;E*=G,q*=G,W(H,Y,E,q)},calc:function(K){let H=K*K,Y=H*K;return J+Q*K+$*H+Z*Y}}}function UX(J,Q,$,Z,W){let K=(Z-Q)*0.5,H=(W-$)*0.5,Y=J*J,X=J*Y;return(2*$-2*Z+K+H)*X+(-3*$+3*Z-2*K-H)*Y+K*J+$}function JE(J,Q){let $=1-J;return $*$*Q}function QE(J,Q){return 2*(1-J)*J*Q}function $E(J,Q){return J*J*Q}function Y6(J,Q,$,Z){return JE(J,Q)+QE(J,$)+$E(J,Z)}function ZE(J,Q){let $=1-J;return $*$*$*Q}function WE(J,Q){let $=1-J;return 3*$*$*J*Q}function KE(J,Q){return 3*(1-J)*J*J*Q}function HE(J,Q){return J*J*J*Q}function X6(J,Q,$,Z,W){return ZE(J,Q)+WE(J,$)+KE(J,Z)+HE(J,W)}function YE(J,Q,$=2){let Z=Q&&Q.length,W=Z?Q[0]*$:J.length,K=ZG(J,0,W,$,!0),H=[];if(!K||K.next===K.prev)return H;let Y,X,U;if(Z)K=NE(J,Q,K,$);if(J.length>80*$){Y=J[0],X=J[1];let G=Y,N=X;for(let E=$;E<W;E+=$){let q=J[E],R=J[E+1];if(q<Y)Y=q;if(R<X)X=R;if(q>G)G=q;if(R>N)N=R}U=Math.max(G-Y,N-X),U=U!==0?32767/U:0}return U6(K,H,$,Y,X,U,0),H}function ZG(J,Q,$,Z,W){let K;if(W===zE(J,Q,$,Z)>0)for(let H=Q;H<$;H+=Z)K=GX(H/Z|0,J[H],J[H+1],K);else for(let H=$-Z;H>=Q;H-=Z)K=GX(H/Z|0,J[H],J[H+1],K);if(K&&A7(K,K.next))E6(K),K=K.next;return K}function y8(J,Q){if(!J)return J;if(!Q)Q=J;let $=J,Z;do if(Z=!1,!$.steiner&&(A7($,$.next)||DJ($.prev,$,$.next)===0)){if(E6($),$=Q=$.prev,$===$.next)break;Z=!0}else $=$.next;while(Z||$!==Q);return Q}function U6(J,Q,$,Z,W,K,H){if(!J)return;if(!H&&K)OE(J,Z,W,K);let Y=J;while(J.prev!==J.next){let{prev:X,next:U}=J;if(K?UE(J,Z,W,K):XE(J)){Q.push(X.i,J.i,U.i),E6(J),J=U.next,Y=U.next;continue}if(J=U,J===Y){if(!H)U6(y8(J),Q,$,Z,W,K,1);else if(H===1)J=GE(y8(J),Q),U6(J,Q,$,Z,W,K,2);else if(H===2)EE(J,Q,$,Z,W,K);break}}}function XE(J){let Q=J.prev,$=J,Z=J.next;if(DJ(Q,$,Z)>=0)return!1;let W=Q.x,K=$.x,H=Z.x,Y=Q.y,X=$.y,U=Z.y,G=Math.min(W,K,H),N=Math.min(Y,X,U),E=Math.max(W,K,H),q=Math.max(Y,X,U),R=Z.next;while(R!==Q){if(R.x>=G&&R.x<=E&&R.y>=N&&R.y<=q&&K6(W,Y,K,X,H,U,R.x,R.y)&&DJ(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function UE(J,Q,$,Z){let W=J.prev,K=J,H=J.next;if(DJ(W,K,H)>=0)return!1;let Y=W.x,X=K.x,U=H.x,G=W.y,N=K.y,E=H.y,q=Math.min(Y,X,U),R=Math.min(G,N,E),O=Math.max(Y,X,U),F=Math.max(G,N,E),D=iW(q,R,Q,$,Z),k=iW(O,F,Q,$,Z),L=J.prevZ,V=J.nextZ;while(L&&L.z>=D&&V&&V.z<=k){if(L.x>=q&&L.x<=O&&L.y>=R&&L.y<=F&&L!==W&&L!==H&&K6(Y,G,X,N,U,E,L.x,L.y)&&DJ(L.prev,L,L.next)>=0)return!1;if(L=L.prevZ,V.x>=q&&V.x<=O&&V.y>=R&&V.y<=F&&V!==W&&V!==H&&K6(Y,G,X,N,U,E,V.x,V.y)&&DJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}while(L&&L.z>=D){if(L.x>=q&&L.x<=O&&L.y>=R&&L.y<=F&&L!==W&&L!==H&&K6(Y,G,X,N,U,E,L.x,L.y)&&DJ(L.prev,L,L.next)>=0)return!1;L=L.prevZ}while(V&&V.z<=k){if(V.x>=q&&V.x<=O&&V.y>=R&&V.y<=F&&V!==W&&V!==H&&K6(Y,G,X,N,U,E,V.x,V.y)&&DJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function GE(J,Q){let $=J;do{let Z=$.prev,W=$.next.next;if(!A7(Z,W)&&KG(Z,$,$.next,W)&&G6(Z,W)&&G6(W,Z))Q.push(Z.i,$.i,W.i),E6($),E6($.next),$=J=W;$=$.next}while($!==J);return y8($)}function EE(J,Q,$,Z,W,K){let H=J;do{let Y=H.next.next;while(Y!==H.prev){if(H.i!==Y.i&&LE(H,Y)){let X=HG(H,Y);H=y8(H,H.next),X=y8(X,X.next),U6(H,Q,$,Z,W,K,0),U6(X,Q,$,Z,W,K,0);return}Y=Y.next}H=H.next}while(H!==J)}function NE(J,Q,$,Z){let W=[];for(let K=0,H=Q.length;K<H;K++){let Y=Q[K]*Z,X=K<H-1?Q[K+1]*Z:J.length,U=ZG(J,Y,X,Z,!1);if(U===U.next)U.steiner=!0;W.push(ME(U))}W.sort(qE);for(let K=0;K<W.length;K++)$=DE(W[K],$);return $}function qE(J,Q){let $=J.x-Q.x;if($===0){if($=J.y-Q.y,$===0){let Z=(J.next.y-J.y)/(J.next.x-J.x),W=(Q.next.y-Q.y)/(Q.next.x-Q.x);$=Z-W}}return $}function DE(J,Q){let $=FE(J,Q);if(!$)return Q;let Z=HG($,J);return y8(Z,Z.next),y8($,$.next)}function FE(J,Q){let $=Q,Z=J.x,W=J.y,K=-1/0,H;if(A7(J,$))return $;do{if(A7(J,$.next))return $.next;else if(W<=$.y&&W>=$.next.y&&$.next.y!==$.y){let N=$.x+(W-$.y)*($.next.x-$.x)/($.next.y-$.y);if(N<=Z&&N>K){if(K=N,H=$.x<$.next.x?$:$.next,N===Z)return H}}$=$.next}while($!==Q);if(!H)return null;let Y=H,X=H.x,U=H.y,G=1/0;$=H;do{if(Z>=$.x&&$.x>=X&&Z!==$.x&&WG(W<U?Z:K,W,X,U,W<U?K:Z,W,$.x,$.y)){let N=Math.abs(W-$.y)/(Z-$.x);if(G6($,J)&&(N<G||N===G&&($.x>H.x||$.x===H.x&&RE(H,$))))H=$,G=N}$=$.next}while($!==Y);return H}function RE(J,Q){return DJ(J.prev,J,Q.prev)<0&&DJ(Q.next,J,J.next)<0}function OE(J,Q,$,Z){let W=J;do{if(W.z===0)W.z=iW(W.x,W.y,Q,$,Z);W.prevZ=W.prev,W.nextZ=W.next,W=W.next}while(W!==J);W.prevZ.nextZ=null,W.prevZ=null,kE(W)}function kE(J){let Q,$=1;do{let Z=J,W;J=null;let K=null;Q=0;while(Z){Q++;let H=Z,Y=0;for(let U=0;U<$;U++)if(Y++,H=H.nextZ,!H)break;let X=$;while(Y>0||X>0&&H){if(Y!==0&&(X===0||!H||Z.z<=H.z))W=Z,Z=Z.nextZ,Y--;else W=H,H=H.nextZ,X--;if(K)K.nextZ=W;else J=W;W.prevZ=K,K=W}Z=H}K.nextZ=null,$*=2}while(Q>1);return J}function iW(J,Q,$,Z,W){return J=(J-$)*W|0,Q=(Q-Z)*W|0,J=(J|J<<8)&16711935,J=(J|J<<4)&252645135,J=(J|J<<2)&858993459,J=(J|J<<1)&1431655765,Q=(Q|Q<<8)&16711935,Q=(Q|Q<<4)&252645135,Q=(Q|Q<<2)&858993459,Q=(Q|Q<<1)&1431655765,J|Q<<1}function ME(J){let Q=J,$=J;do{if(Q.x<$.x||Q.x===$.x&&Q.y<$.y)$=Q;Q=Q.next}while(Q!==J);return $}function WG(J,Q,$,Z,W,K,H,Y){return(W-H)*(Q-Y)>=(J-H)*(K-Y)&&(J-H)*(Z-Y)>=($-H)*(Q-Y)&&($-H)*(K-Y)>=(W-H)*(Z-Y)}function K6(J,Q,$,Z,W,K,H,Y){return!(J===H&&Q===Y)&&WG(J,Q,$,Z,W,K,H,Y)}function LE(J,Q){return J.next.i!==Q.i&&J.prev.i!==Q.i&&!VE(J,Q)&&(G6(J,Q)&&G6(Q,J)&&BE(J,Q)&&(DJ(J.prev,J,Q.prev)||DJ(J,Q.prev,Q))||A7(J,Q)&&DJ(J.prev,J,J.next)>0&&DJ(Q.prev,Q,Q.next)>0)}function DJ(J,Q,$){return(Q.y-J.y)*($.x-Q.x)-(Q.x-J.x)*($.y-Q.y)}function A7(J,Q){return J.x===Q.x&&J.y===Q.y}function KG(J,Q,$,Z){let W=sQ(DJ(J,Q,$)),K=sQ(DJ(J,Q,Z)),H=sQ(DJ($,Z,J)),Y=sQ(DJ($,Z,Q));if(W!==K&&H!==Y)return!0;if(W===0&&nQ(J,$,Q))return!0;if(K===0&&nQ(J,Z,Q))return!0;if(H===0&&nQ($,J,Z))return!0;if(Y===0&&nQ($,Q,Z))return!0;return!1}function nQ(J,Q,$){return Q.x<=Math.max(J.x,$.x)&&Q.x>=Math.min(J.x,$.x)&&Q.y<=Math.max(J.y,$.y)&&Q.y>=Math.min(J.y,$.y)}function sQ(J){return J>0?1:J<0?-1:0}function VE(J,Q){let $=J;do{if($.i!==J.i&&$.next.i!==J.i&&$.i!==Q.i&&$.next.i!==Q.i&&KG($,$.next,J,Q))return!0;$=$.next}while($!==J);return!1}function G6(J,Q){return DJ(J.prev,J,J.next)<0?DJ(J,Q,J.next)>=0&&DJ(J,J.prev,Q)>=0:DJ(J,Q,J.prev)<0||DJ(J,J.next,Q)<0}function BE(J,Q){let $=J,Z=!1,W=(J.x+Q.x)/2,K=(J.y+Q.y)/2;do{if($.y>K!==$.next.y>K&&$.next.y!==$.y&&W<($.next.x-$.x)*(K-$.y)/($.next.y-$.y)+$.x)Z=!Z;$=$.next}while($!==J);return Z}function HG(J,Q){let $=oW(J.i,J.x,J.y),Z=oW(Q.i,Q.x,Q.y),W=J.next,K=Q.prev;return J.next=Q,Q.prev=J,$.next=W,W.prev=$,Z.next=$,$.prev=Z,K.next=Z,Z.prev=K,Z}function GX(J,Q,$,Z){let W=oW(J,Q,$);if(!Z)W.prev=W,W.next=W;else W.next=Z.next,W.prev=Z,Z.next.prev=W,Z.next=W;return W}function E6(J){if(J.next.prev=J.prev,J.prev.next=J.next,J.prevZ)J.prevZ.nextZ=J.nextZ;if(J.nextZ)J.nextZ.prevZ=J.prevZ}function oW(J,Q,$){return{i:J,x:Q,y:$,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function zE(J,Q,$,Z){let W=0;for(let K=Q,H=$-Z;K<$;K+=Z)W+=(J[H]-J[K])*(J[K+1]+J[H+1]),H=K;return W}class YG{static triangulate(J,Q,$=2){return YE(J,Q,$)}}class Z9{static area(J){let Q=J.length,$=0;for(let Z=Q-1,W=0;W<Q;Z=W++)$+=J[Z].x*J[W].y-J[W].x*J[Z].y;return $*0.5}static isClockWise(J){return Z9.area(J)<0}static triangulateShape(J,Q){let $=[],Z=[],W=[];EX(J),NX($,J);let K=J.length;Q.forEach(EX);for(let Y=0;Y<Q.length;Y++)Z.push(K),K+=Q[Y].length,NX($,Q[Y]);let H=YG.triangulate($,Z);for(let Y=0;Y<H.length;Y+=3)W.push(H.slice(Y,Y+3));return W}}function EX(J){let Q=J.length;if(Q>2&&J[Q-1].equals(J[0]))J.pop()}function NX(J,Q){for(let $=0;$<Q.length;$++)J.push(Q[$].x),J.push(Q[$].y)}function _E(J,Q,$){if($.shapes=[],Array.isArray(J))for(let Z=0,W=J.length;Z<W;Z++){let K=J[Z];$.shapes.push(K.uuid)}else $.shapes.push(J.uuid);if($.options=Object.assign({},Q),Q.extrudePath!==void 0)$.options.extrudePath=Q.extrudePath.toJSON();return $}function AE(J,Q){if(Q.shapes=[],Array.isArray(J))for(let $=0,Z=J.length;$<Z;$++){let W=J[$];Q.shapes.push(W.uuid)}else Q.shapes.push(J.uuid);return Q}function qX(J,Q,$){let Z=`${J.x},${J.y},${J.z}-${Q.x},${Q.y},${Q.z}`,W=`${Q.x},${Q.y},${Q.z}-${J.x},${J.y},${J.z}`;if($.has(Z)===!0||$.has(W)===!0)return!1;else return $.add(Z),$.add(W),!0}function n8(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(W&&(W.isColor||W.isMatrix3||W.isMatrix4||W.isVector2||W.isVector3||W.isVector4||W.isTexture||W.isQuaternion))if(W.isRenderTargetTexture)U0("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))Q[$][Z]=W.slice();else Q[$][Z]=W}}return Q}function hJ(J){let Q={};for(let $=0;$<J.length;$++){let Z=n8(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function CE(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function DH(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return e0.workingColorSpace}function T8(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 XG(J){function Q(W,K){return J[W]-J[K]}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 K=0,H=0;H!==Z;++K){let Y=$[K]*Q;for(let X=0;X!==Q;++X)W[H++]=J[Y+X]}return W}function RH(J,Q,$,Z){let W=1,K=J[0];while(K!==void 0&&K[Z]===void 0)K=J[W++];if(K===void 0)return;let H=K[Z];if(H===void 0)return;if(Array.isArray(H))do{if(H=K[Z],H!==void 0)Q.push(K.time),$.push(...H);K=J[W++]}while(K!==void 0);else if(H.toArray!==void 0)do{if(H=K[Z],H!==void 0)Q.push(K.time),H.toArray($,$.length);K=J[W++]}while(K!==void 0);else do{if(H=K[Z],H!==void 0)Q.push(K.time),$.push(H);K=J[W++]}while(K!==void 0)}function TE(J,Q,$,Z,W=30){let K=J.clone();K.name=Q;let H=[];for(let X=0;X<K.tracks.length;++X){let U=K.tracks[X],G=U.getValueSize(),N=[],E=[];for(let q=0;q<U.times.length;++q){let R=U.times[q]*W;if(R<$||R>=Z)continue;N.push(U.times[q]);for(let O=0;O<G;++O)E.push(U.values[q*G+O])}if(N.length===0)continue;U.times=T8(N,U.times.constructor),U.values=T8(E,U.values.constructor),H.push(U)}K.tracks=H;let Y=1/0;for(let X=0;X<K.tracks.length;++X)if(Y>K.tracks[X].times[0])Y=K.tracks[X].times[0];for(let X=0;X<K.tracks.length;++X)K.tracks[X].shift(-1*Y);return K.resetDuration(),K}function SE(J,Q=0,$=J,Z=30){if(Z<=0)Z=30;let W=$.tracks.length,K=Q/Z;for(let H=0;H<W;++H){let Y=$.tracks[H],X=Y.ValueTypeName;if(X==="bool"||X==="string")continue;let U=J.tracks.find(function(D){return D.name===Y.name&&D.ValueTypeName===X});if(U===void 0)continue;let G=0,N=Y.getValueSize();if(Y.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)G=N/3;let E=0,q=U.getValueSize();if(U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)E=q/3;let R=Y.times.length-1,O;if(K<=Y.times[0]){let D=G,k=N-G;O=Y.values.slice(D,k)}else if(K>=Y.times[R]){let D=R*N+G,k=D+N-G;O=Y.values.slice(D,k)}else{let D=Y.createInterpolant(),k=G,L=N-G;D.evaluate(K),O=D.resultBuffer.slice(k,L)}if(X==="quaternion")new SJ().fromArray(O).normalize().conjugate().toArray(O);let F=U.times.length;for(let D=0;D<F;++D){let k=D*q+E;if(X==="quaternion")SJ.multiplyQuaternionsFlat(U.values,k,O,0,U.values,k);else{let L=q-E*2;for(let V=0;V<L;++V)U.values[k+V]-=O[V]}}}return J.blendMode=2501,J}class OH{static convertArray(J,Q){return T8(J,Q)}static isTypedArray(J){return sU(J)}static getKeyframeOrder(J){return XG(J)}static sortedArray(J,Q,$){return aW(J,Q,$)}static flattenJSON(J,Q,$,Z){RH(J,Q,$,Z)}static subclip(J,Q,$,Z,W=30){return TE(J,Q,$,Z,W)}static makeClipAdditive(J,Q=0,$=J,Z=30){return SE(J,Q,$,Z)}}class D8{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 K;$:{Z:if(!(J<Z)){for(let H=$+2;;){if(Z===void 0){if(J<W)break Z;return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}if($===H)break;if(W=Z,Z=Q[++$],J<Z)break Q}K=Q.length;break $}if(!(J>=W)){let H=Q[1];if(J<H)$=2,W=H;for(let Y=$-2;;){if(W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if($===Y)break;if(Z=W,W=Q[--$-1],J>=W)break Q}K=$,$=0;break $}break J}while($<K){let H=$+K>>>1;if(J<Q[H])K=H;else $=H+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 K=0;K!==Z;++K)Q[K]=$[W+K];return Q}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class oJ{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=T8(Q,this.TimeBufferType),this.values=T8($,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:T8(J.times,Array),values:T8(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new jZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new QQ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new SZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new yZ(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 U0("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,K=Z-1;while(W!==Z&&$[W]<J)++W;while(K!==-1&&$[K]>Q)--K;if(++K,W!==0||K!==Z){if(W>=K)K=Math.max(K,1),W=K-1;let H=this.getValueSize();this.times=$.slice(W,K),this.values=this.values.slice(W*H,K*H)}return this}validate(){let J=!0,Q=this.getValueSize();if(Q-Math.floor(Q)!==0)S0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)S0("KeyframeTrack: Track is empty.",this),J=!1;let K=null;for(let H=0;H!==W;H++){let Y=$[H];if(typeof Y==="number"&&isNaN(Y)){S0("KeyframeTrack: Time is not a valid number.",this,H,Y),J=!1;break}if(K!==null&&K>Y){S0("KeyframeTrack: Out of order keys.",this,H,Y,K),J=!1;break}K=Y}if(Z!==void 0){if(sU(Z))for(let H=0,Y=Z.length;H!==Y;++H){let X=Z[H];if(isNaN(X)){S0("KeyframeTrack: Value is not a valid number.",this,H,X),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,K=1;for(let H=1;H<W;++H){let Y=!1,X=J[H],U=J[H+1];if(X!==U&&(H!==1||X!==J[0]))if(!Z){let G=H*$,N=G-$,E=G+$;for(let q=0;q!==$;++q){let R=Q[G+q];if(R!==Q[N+q]||R!==Q[E+q]){Y=!0;break}}}else Y=!0;if(Y){if(H!==K){J[K]=J[H];let G=H*$,N=K*$;for(let E=0;E!==$;++E)Q[N+E]=Q[G+E]}++K}}if(W>0){J[K]=J[W];for(let H=W*$,Y=K*$,X=0;X!==$;++X)Q[Y+X]=Q[H+X];++K}if(K!==J.length)this.times=J.slice(0,K),this.values=Q.slice(0,K*$);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}}class b8{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=eJ(),this.userData={},this.duration<0)this.resetDuration()}static parse(J){let Q=[],$=J.tracks,Z=1/(J.fps||1);for(let K=0,H=$.length;K!==H;++K)Q.push(yE($[K]).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,K=$.length;W!==K;++W)Q.push(oJ.toJSON($[W]));return Z}static CreateFromMorphTargetSequence(J,Q,$,Z){let W=Q.length,K=[];for(let H=0;H<W;H++){let Y=[],X=[];Y.push((H+W-1)%W,H,(H+1)%W),X.push(0,1,0);let U=XG(Y);if(Y=aW(Y,1,U),X=aW(X,1,U),!Z&&Y[0]===0)Y.push(W),X.push(X[0]);K.push(new v8(".morphTargetInfluences["+Q[H].name+"]",Y,X).scale(1/$))}return new this(J,-1,K)}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 H=0,Y=J.length;H<Y;H++){let X=J[H],U=X.name.match(W);if(U&&U.length>1){let G=U[1],N=Z[G];if(!N)Z[G]=N=[];N.push(X)}}let K=[];for(let H in Z)K.push(this.CreateFromMorphTargetSequence(H,Z[H],Q,$));return K}static parseAnimation(J,Q){if(U0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return S0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,N,E,q,R){if(E.length!==0){let O=[],F=[];if(RH(E,O,F,q),O.length!==0)R.push(new G(N,O,F))}},Z=[],W=J.name||"default",K=J.fps||30,H=J.blendMode,Y=J.length||-1,X=J.hierarchy||[];for(let G=0;G<X.length;G++){let N=X[G].keys;if(!N||N.length===0)continue;if(N[0].morphTargets){let E={},q;for(q=0;q<N.length;q++)if(N[q].morphTargets)for(let R=0;R<N[q].morphTargets.length;R++)E[N[q].morphTargets[R]]=-1;for(let R in E){let O=[],F=[];for(let D=0;D!==N[q].morphTargets.length;++D){let k=N[q];O.push(k.time),F.push(k.morphTarget===R?1:0)}Z.push(new v8(".morphTargetInfluence["+R+"]",O,F))}Y=E.length*K}else{let E=".bones["+Q[G].name+"]";$(f8,E+".position",N,"pos",Z),$(s8,E+".quaternion",N,"rot",Z),$(f8,E+".scale",N,"scl",Z)}}if(Z.length===0)return null;return new this(W,Y,Z,H)}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 jE(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return v8;case"vector":case"vector2":case"vector3":case"vector4":return f8;case"color":return $Q;case"quaternion":return s8;case"bool":case"boolean":return u9;case"string":return c9}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function yE(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=jE(J.type);if(J.times===void 0){let $=[],Z=[];RH(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)}function FX(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class ZQ{constructor(J,Q,$){let Z=this,W=!1,K=0,H=0,Y=void 0,X=[];this.onStart=void 0,this.onLoad=J,this.onProgress=Q,this.onError=$,this._abortController=null,this.itemStart=function(U){if(H++,W===!1){if(Z.onStart!==void 0)Z.onStart(U,K,H)}W=!0},this.itemEnd=function(U){if(K++,Z.onProgress!==void 0)Z.onProgress(U,K,H);if(K===H){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(Y)return Y(U);return U},this.setURLModifier=function(U){return Y=U,this},this.addHandler=function(U,G){return X.push(U,G),this},this.removeHandler=function(U){let G=X.indexOf(U);if(G!==-1)X.splice(G,2);return this},this.getHandler=function(U){for(let G=0,N=X.length;G<N;G+=2){let E=X[G],q=X[G+1];if(E.global)E.lastIndex=0;if(E.test(U))return q}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}}class xJ{constructor(J){if(this.manager=J!==void 0?J:kH,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}}class bZ{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 r(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new m0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new E8,this._frameExtents=new r(1,1),this._viewportCount=1,this._viewports=[new GJ(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(RX.setFromMatrixPosition(J.matrixWorld),Q.position.copy(RX),OX.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(OX),Q.updateMatrixWorld(),mW.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mW,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(mW)}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}}class WQ{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let J=0;J<9;J++)this.coefficients.push(new P)}set(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].copy(J[Q]);return this}zero(){for(let J=0;J<9;J++)this.coefficients[J].set(0,0,0);return this}getAt(J,Q){let{x:$,y:Z,z:W}=J,K=this.coefficients;return Q.copy(K[0]).multiplyScalar(0.282095),Q.addScaledVector(K[1],0.488603*Z),Q.addScaledVector(K[2],0.488603*W),Q.addScaledVector(K[3],0.488603*$),Q.addScaledVector(K[4],1.092548*($*Z)),Q.addScaledVector(K[5],1.092548*(Z*W)),Q.addScaledVector(K[6],0.315392*(3*W*W-1)),Q.addScaledVector(K[7],1.092548*($*W)),Q.addScaledVector(K[8],0.546274*($*$-Z*Z)),Q}getIrradianceAt(J,Q){let{x:$,y:Z,z:W}=J,K=this.coefficients;return Q.copy(K[0]).multiplyScalar(0.886227),Q.addScaledVector(K[1],1.023328*Z),Q.addScaledVector(K[2],1.023328*W),Q.addScaledVector(K[3],1.023328*$),Q.addScaledVector(K[4],0.858086*$*Z),Q.addScaledVector(K[5],0.858086*Z*W),Q.addScaledVector(K[6],0.743125*W*W-0.247708),Q.addScaledVector(K[7],0.858086*$*W),Q.addScaledVector(K[8],0.429043*($*$-Z*Z)),Q}add(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].add(J.coefficients[Q]);return this}addScaledSH(J,Q){for(let $=0;$<9;$++)this.coefficients[$].addScaledVector(J.coefficients[$],Q);return this}scale(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].multiplyScalar(J);return this}lerp(J,Q){for(let $=0;$<9;$++)this.coefficients[$].lerp(J.coefficients[$],Q);return this}equals(J){for(let Q=0;Q<9;Q++)if(!this.coefficients[Q].equals(J.coefficients[Q]))return!1;return!0}copy(J){return this.set(J.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(J,Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].fromArray(J,Q+Z*3);return this}toArray(J=[],Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].toArray(J,Q+Z*3);return J}static getBasisAt(J,Q){let{x:$,y:Z,z:W}=J;Q[0]=0.282095,Q[1]=0.488603*Z,Q[2]=0.488603*W,Q[3]=0.488603*$,Q[4]=1.092548*$*Z,Q[5]=1.092548*Z*W,Q[6]=0.315392*(3*W*W-1),Q[7]=1.092548*$*W,Q[8]=0.546274*($*$-Z*Z)}}class N6{static extractUrlBase(J){let Q=J.lastIndexOf("/");if(Q===-1)return"./";return J.slice(0,Q+1)}static resolveURL(J,Q){if(typeof J!=="string"||J==="")return"";if(/^https?:\/\//i.test(Q)&&/^\//.test(J))Q=Q.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(J))return J;if(/^data:.*,.*$/i.test(J))return J;if(/^blob:.*$/i.test(J))return J;return Q+J}}class HQ{static getContext(){if(aQ===void 0)aQ=new(window.AudioContext||window.webkitAudioContext);return aQ}static setContext(J){aQ=J}}class CH{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=0.064,this.cameraL=new BJ,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new BJ,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(J){let Q=this._cache;if(Q.focus!==J.focus||Q.fov!==J.fov||Q.aspect!==J.aspect*this.aspect||Q.near!==J.near||Q.far!==J.far||Q.zoom!==J.zoom||Q.eyeSep!==this.eyeSep){Q.focus=J.focus,Q.fov=J.fov,Q.aspect=J.aspect*this.aspect,Q.near=J.near,Q.far=J.far,Q.zoom=J.zoom,Q.eyeSep=this.eyeSep,I8.copy(J.projectionMatrix);let Z=Q.eyeSep/2,W=Z*Q.near/Q.focus,K=Q.near*Math.tan(S8*Q.fov*0.5)/Q.zoom,H,Y;zX.elements[12]=-Z,BX.elements[12]=Z,H=-K*Q.aspect+W,Y=K*Q.aspect+W,I8.elements[0]=2*Q.near/(Y-H),I8.elements[8]=(Y+H)/(Y-H),this.cameraL.projectionMatrix.copy(I8),H=-K*Q.aspect-W,Y=K*Q.aspect-W,I8.elements[0]=2*Q.near/(Y-H),I8.elements[8]=(Y+H)/(Y-H),this.cameraR.projectionMatrix.copy(I8)}this.cameraL.matrixWorld.copy(J.matrixWorld).multiply(zX),this.cameraR.matrixWorld.copy(J.matrixWorld).multiply(BX)}}class sZ{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(J){if(this._document=J,J.hidden!==void 0)this._pageVisibilityHandler=fE.bind(this),J.addEventListener("visibilitychange",this._pageVisibilityHandler,!1)}disconnect(){if(this._pageVisibilityHandler!==null)this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null;this._document=null}getDelta(){return this._delta/1000}getElapsed(){return this._elapsed/1000}getTimescale(){return this._timescale}setTimescale(J){return this._timescale=J,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(J){if(this._pageVisibilityHandler!==null&&this._document.hidden===!0)this._delta=0;else this._previousTime=this._currentTime,this._currentTime=(J!==void 0?J:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta;return this}}function fE(){if(this._document.hidden===!1)this.reset()}class TH{constructor(J,Q=2048){this.analyser=J.context.createAnalyser(),this.analyser.fftSize=Q,this.data=new Uint8Array(this.analyser.frequencyBinCount),J.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let J=0,Q=this.getFrequencyData();for(let $=0;$<Q.length;$++)J+=Q[$];return J/Q.length}}class oZ{constructor(J,Q,$){this.binding=J,this.valueSize=$;let Z,W,K;switch(Q){case"quaternion":Z=this._slerp,W=this._slerpAdditive,K=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array($*6),this._workIndex=5;break;case"string":case"bool":Z=this._select,W=this._select,K=this._setAdditiveIdentityOther,this.buffer=Array($*5);break;default:Z=this._lerp,W=this._lerpAdditive,K=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array($*5)}this._mixBufferRegion=Z,this._mixBufferRegionAdditive=W,this._setIdentity=K,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,K=this.cumulativeWeight;if(K===0){for(let H=0;H!==Z;++H)$[W+H]=$[H];K=Q}else{K+=Q;let H=Q/K;this._mixBufferRegion($,W,0,H,Z)}this.cumulativeWeight=K}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,K=this.cumulativeWeightAdditive,H=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,W<1){let Y=Q*this._origIndex;this._mixBufferRegion($,Z,Y,1-W,Q)}if(K>0)this._mixBufferRegionAdditive($,Z,this._addIndex*Q,1,Q);for(let Y=Q,X=Q+Q;Y!==X;++Y)if($[Y]!==$[Y+Q]){H.setValue($,Z);break}}saveOriginalState(){let J=this.binding,Q=this.buffer,$=this.valueSize,Z=$*this._origIndex;J.getValue(Q,Z);for(let W=$,K=Z;W!==K;++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 K=0;K!==W;++K)J[Q+K]=J[$+K]}_slerp(J,Q,$,Z){SJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let K=this._workIndex*W;SJ.multiplyQuaternionsFlat(J,K,J,Q,J,$),SJ.slerpFlat(J,Q,J,Q,J,K,Z)}_lerp(J,Q,$,Z,W){let K=1-Z;for(let H=0;H!==W;++H){let Y=Q+H;J[Y]=J[Y]*K+J[$+H]*Z}}_lerpAdditive(J,Q,$,Z,W){for(let K=0;K!==W;++K){let H=Q+K;J[H]=J[H]+J[$+K]*Z}}}class qG{constructor(J,Q,$){let Z=$||QJ.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 QJ{constructor(J,Q,$){this.path=Q,this.parsedPath=$||QJ.parseTrackName(Q),this.node=QJ.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 QJ(J,Q,$);else return new QJ.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(xE,"")}static parseTrackName(J){let Q=uE.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(cE.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 K=0;K<W.length;K++){let H=W[K];if(H.name===Q||H.uuid===Q)return H;let Y=$(H.children);if(Y)return Y}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=QJ.findNode(this.rootNode,Q.nodeName),this.node=J;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!J){U0("PropertyBinding: No target node found for track: "+this.path+".");return}if($){let X=Q.objectIndex;switch($){case"materials":if(!J.material){S0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){S0("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}J=J.material.materials;break;case"bones":if(!J.skeleton){S0("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}J=J.skeleton.bones;for(let U=0;U<J.length;U++)if(J[U].name===X){X=U;break}break;case"map":if("map"in J){J=J.map;break}if(!J.material){S0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){S0("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}J=J.material.map;break;default:if(J[$]===void 0){S0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(X!==void 0){if(J[X]===void 0){S0("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,J);return}J=J[X]}}let K=J[Z];if(K===void 0){let X=Q.nodeName;S0("PropertyBinding: Trying to update property for track: "+X+"."+Z+" but it wasn't found.",J);return}let H=this.Versioning.None;if(this.targetObject=J,J.isMaterial===!0)H=this.Versioning.NeedsUpdate;else if(J.isObject3D===!0)H=this.Versioning.MatrixWorldNeedsUpdate;let Y=this.BindingType.Direct;if(W!==void 0){if(Z==="morphTargetInfluences"){if(!J.geometry){S0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){S0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(J.morphTargetDictionary[W]!==void 0)W=J.morphTargetDictionary[W]}Y=this.BindingType.ArrayElement,this.resolvedProperty=K,this.propertyIndex=W}else if(K.fromArray!==void 0&&K.toArray!==void 0)Y=this.BindingType.HasFromToArray,this.resolvedProperty=K;else if(Array.isArray(K))Y=this.BindingType.EntireArray,this.resolvedProperty=K;else this.propertyName=Z;this.getValue=this.GetterByBindingType[Y],this.setValue=this.SetterByBindingTypeAndVersioning[Y][H]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}class yH{constructor(){this.isAnimationObjectGroup=!0,this.uuid=eJ(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let J={};this._indicesByUUID=J;for(let $=0,Z=arguments.length;$!==Z;++$)J[arguments[$].uuid]=$;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let Q=this;this.stats={objects:{get total(){return Q._objects.length},get inUse(){return this.total-Q.nCachedObjects_}},get bindingsPerObject(){return Q._bindings.length}}}add(){let J=this._objects,Q=this._indicesByUUID,$=this._paths,Z=this._parsedPaths,W=this._bindings,K=W.length,H=void 0,Y=J.length,X=this.nCachedObjects_;for(let U=0,G=arguments.length;U!==G;++U){let N=arguments[U],E=N.uuid,q=Q[E];if(q===void 0){q=Y++,Q[E]=q,J.push(N);for(let R=0,O=K;R!==O;++R)W[R].push(new QJ(N,$[R],Z[R]))}else if(q<X){H=J[q];let R=--X,O=J[R];Q[O.uuid]=q,J[q]=O,Q[E]=R,J[R]=N;for(let F=0,D=K;F!==D;++F){let k=W[F],L=k[R],V=k[q];if(k[q]=L,V===void 0)V=new QJ(N,$[F],Z[F]);k[R]=V}}else if(J[q]!==H)S0("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=X}remove(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_;for(let K=0,H=arguments.length;K!==H;++K){let Y=arguments[K],X=Y.uuid,U=Q[X];if(U!==void 0&&U>=W){let G=W++,N=J[G];Q[N.uuid]=U,J[U]=N,Q[X]=G,J[G]=Y;for(let E=0,q=Z;E!==q;++E){let R=$[E],O=R[G],F=R[U];R[U]=O,R[G]=F}}}this.nCachedObjects_=W}uncache(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_,K=J.length;for(let H=0,Y=arguments.length;H!==Y;++H){let X=arguments[H],U=X.uuid,G=Q[U];if(G!==void 0)if(delete Q[U],G<W){let N=--W,E=J[N],q=--K,R=J[q];Q[E.uuid]=G,J[G]=E,Q[R.uuid]=N,J[N]=R,J.pop();for(let O=0,F=Z;O!==F;++O){let D=$[O],k=D[N],L=D[q];D[G]=k,D[N]=L,D.pop()}}else{let N=--K,E=J[N];if(N>0)Q[E.uuid]=G;J[G]=E,J.pop();for(let q=0,R=Z;q!==R;++q){let O=$[q];O[G]=O[N],O.pop()}}}this.nCachedObjects_=W}subscribe_(J,Q){let $=this._bindingsIndicesByPath,Z=$[J],W=this._bindings;if(Z!==void 0)return W[Z];let K=this._paths,H=this._parsedPaths,Y=this._objects,X=Y.length,U=this.nCachedObjects_,G=Array(X);Z=W.length,$[J]=Z,K.push(J),H.push(Q),W.push(G);for(let N=U,E=Y.length;N!==E;++N){let q=Y[N];G[N]=new QJ(q,J,Q)}return G}unsubscribe_(J){let Q=this._bindingsIndicesByPath,$=Q[J];if($!==void 0){let Z=this._paths,W=this._parsedPaths,K=this._bindings,H=K.length-1,Y=K[H],X=J[H];Q[X]=$,K[$]=Y,K.pop(),W[$]=W[H],W.pop(),Z[$]=Z[H],Z.pop()}}}class aZ{constructor(J,Q,$=null,Z=Q.blendMode){this._mixer=J,this._clip=Q,this._localRoot=$,this.blendMode=Z;let W=Q.tracks,K=W.length,H=Array(K),Y={endingStart:2400,endingEnd:2400};for(let X=0;X!==K;++X){let U=W[X].createInterpolant(null);H[X]=U,U.settings=Y}this._interpolantSettings=Y,this._interpolants=H,this._propertyBindings=Array(K),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,K=W/Z,H=Z/W;J.warp(1,K,Q),this.warp(H,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,K=this.timeScale,H=this._timeScaleInterpolant;if(H===null)H=Z._lendControlInterpolant(),this._timeScaleInterpolant=H;let{parameterPositions:Y,sampleValues:X}=H;return Y[0]=W,Y[1]=W+$,X[0]=J/K,X[1]=Q/K,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 Y=(J-W)*$;if(Y<0||$===0)Q=0;else this._startTime=null,Q=$*Y}Q*=this._updateTimeScale(J);let K=this._updateTime(Q),H=this._updateWeight(J);if(H>0){let Y=this._interpolants,X=this._propertyBindings;switch(this.blendMode){case 2501:for(let U=0,G=Y.length;U!==G;++U)Y[U].evaluate(K),X[U].accumulateAdditive(H);break;case 2500:default:for(let U=0,G=Y.length;U!==G;++U)Y[U].evaluate(K),X[U].accumulate(Z,H)}}}_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,K=$===2202;if(J===0){if(W===-1)return Z;return K&&(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,K);else this._setEndings(this.repetitions===0,!0,K);if(Z>=Q||Z<0){let H=Math.floor(Z/Q);Z-=Q*H,W+=Math.abs(H);let Y=this.repetitions-W;if(Y<=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(Y===1){let X=J<0;this._setEndings(X,!X,K)}else this._setEndings(!1,!1,K);this._loopCount=W,this.time=Z,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:H})}}else this.time=Z;if(K&&(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,K=this._weightInterpolant;if(K===null)K=Z._lendControlInterpolant(),this._weightInterpolant=K;let{parameterPositions:H,sampleValues:Y}=K;return H[0]=W,Y[0]=Q,H[1]=W+J,Y[1]=$,this}}class rZ{constructor(J){this.value=J}clone(){return new rZ(this.value.clone===void 0?this.value:this.value.clone())}}class xH{constructor(J,Q,$,Z,W,K=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=J,this.type=Q,this.itemSize=$,this.elementSize=Z,this.count=W,this.normalized=K,this.version=0}set needsUpdate(J){if(J===!0)this.version++}setBuffer(J){return this.buffer=J,this}setType(J,Q){return this.type=J,this.elementSize=Q,this}setItemSize(J){return this.itemSize=J,this}setCount(J){return this.count=J,this}}class gH{constructor(J,Q,$=0,Z=1/0){this.ray=new G8(J,Q),this.near=$,this.far=Z,this.camera=null,this.layers=new f7,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(J,Q){this.ray.set(J,Q)}setFromCamera(J,Q){if(Q.isPerspectiveCamera)this.ray.origin.setFromMatrixPosition(Q.matrixWorld),this.ray.direction.set(J.x,J.y,0.5).unproject(Q).sub(this.ray.origin).normalize(),this.camera=Q;else if(Q.isOrthographicCamera)this.ray.origin.set(J.x,J.y,(Q.near+Q.far)/(Q.near-Q.far)).unproject(Q),this.ray.direction.set(0,0,-1).transformDirection(Q.matrixWorld),this.camera=Q;else S0("Raycaster: Unsupported camera type: "+Q.type)}setFromXRController(J){return _X.identity().extractRotation(J.matrixWorld),this.ray.origin.setFromMatrixPosition(J.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_X),this}intersectObject(J,Q=!0,$=[]){return rW(J,this,$,Q),$.sort(AX),$}intersectObjects(J,Q=!0,$=[]){for(let Z=0,W=J.length;Z<W;Z++)rW(J[Z],this,$,Q);return $.sort(AX),$}}function AX(J,Q){return J.distance-Q.distance}function rW(J,Q,$,Z){let W=!0;if(J.layers.test(Q.layers)){if(J.raycast(Q,$)===!1)W=!1}if(W===!0&&Z===!0){let K=J.children;for(let H=0,Y=K.length;H<Y;H++)rW(K[H],Q,$,!0)}}class pH{constructor(J=!0){this.autoStart=J,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,U0("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let J=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let Q=performance.now();J=(Q-this.oldTime)/1000,this.oldTime=Q,this.elapsedTime+=J}return J}}class mH{constructor(J=1,Q=0,$=0){this.radius=J,this.phi=Q,this.theta=$}set(J,Q,$){return this.radius=J,this.phi=Q,this.theta=$,this}copy(J){return this.radius=J.radius,this.phi=J.phi,this.theta=J.theta,this}makeSafe(){return this.phi=p0(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){if(this.radius=Math.sqrt(J*J+Q*Q+$*$),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(J,$),this.phi=Math.acos(p0(Q/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class dH{constructor(J=1,Q=0,$=0){this.radius=J,this.theta=Q,this.y=$}set(J,Q,$){return this.radius=J,this.theta=Q,this.y=$,this}copy(J){return this.radius=J.radius,this.theta=J.theta,this.y=J.y,this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){return this.radius=Math.sqrt(J*J+$*$),this.theta=Math.atan2(J,$),this.y=Q,this}clone(){return new this.constructor().copy(this)}}class tZ{constructor(J,Q,$,Z){if(tZ.prototype.isMatrix2=!0,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}}class lH{constructor(J=new r(1/0,1/0),Q=new r(-1/0,-1/0)){this.isBox2=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=CX.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(J){return this.isEmpty()?J.set(0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,CX).distanceTo(J)}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}}class uH{constructor(J=new P,Q=new P){this.start=J,this.end=Q}set(J,Q){return this.start.copy(J),this.end.copy(Q),this}copy(J){return this.start.copy(J.start),this.end.copy(J.end),this}getCenter(J){return J.addVectors(this.start,this.end).multiplyScalar(0.5)}delta(J){return J.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(J,Q){return this.delta(Q).multiplyScalar(J).add(this.start)}closestPointToPointParameter(J,Q){wX.subVectors(J,this.start),rQ.subVectors(this.end,this.start);let $=rQ.dot(rQ),W=rQ.dot(wX)/$;if(Q)W=p0(W,0,1);return W}closestPointToPoint(J,Q,$){let Z=this.closestPointToPointParameter(J,Q);return this.delta($).multiplyScalar(Z).add(this.start)}distanceSqToLine3(J,Q=iE,$=oE){let W,K,H=this.start,Y=J.start,X=this.end,U=J.end;k7.subVectors(X,H),M7.subVectors(U,Y),uW.subVectors(H,Y);let G=k7.dot(k7),N=M7.dot(M7),E=M7.dot(uW);if(G<=0.00000000000000010000000000000001&&N<=0.00000000000000010000000000000001)return Q.copy(H),$.copy(Y),Q.sub($),Q.dot(Q);if(G<=0.00000000000000010000000000000001)W=0,K=E/N,K=p0(K,0,1);else{let q=k7.dot(uW);if(N<=0.00000000000000010000000000000001)K=0,W=p0(-q/G,0,1);else{let R=k7.dot(M7),O=G*N-R*R;if(O!==0)W=p0((R*E-q*N)/O,0,1);else W=0;if(K=(R*W+E)/N,K<0)K=0,W=p0(-q/G,0,1);else if(K>1)K=1,W=p0((R-q)/G,0,1)}}return Q.copy(H).addScaledVector(k7,W),$.copy(Y).addScaledVector(M7,K),Q.distanceToSquared($)}applyMatrix4(J){return this.start.applyMatrix4(J),this.end.applyMatrix4(J),this}equals(J){return J.start.equals(this.start)&&J.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}function DG(J){let Q=[];if(J.isBone===!0)Q.push(J);for(let $=0;$<J.children.length;$++)Q.push(...DG(J.children[$]));return Q}function LJ(J,Q,$,Z,W,K,H){J$.set(W,K,H).unproject(Z);let Y=Q[J];if(Y!==void 0){let X=$.getAttribute("position");for(let U=0,G=Y.length;U<G;U++)X.setXYZ(Y[U],J$.x,J$.y,J$.z)}}class WY{constructor(){this.type="ShapePath",this.color=new M0,this.subPaths=[],this.currentPath=null}moveTo(J,Q){return this.currentPath=new _7,this.subPaths.push(this.currentPath),this.currentPath.moveTo(J,Q),this}lineTo(J,Q){return this.currentPath.lineTo(J,Q),this}quadraticCurveTo(J,Q,$,Z){return this.currentPath.quadraticCurveTo(J,Q,$,Z),this}bezierCurveTo(J,Q,$,Z,W,K){return this.currentPath.bezierCurveTo(J,Q,$,Z,W,K),this}splineThru(J){return this.currentPath.splineThru(J),this}toShapes(J){function Q(F){let D=[];for(let k=0,L=F.length;k<L;k++){let V=F[k],w=new p9;w.curves=V.curves,D.push(w)}return D}function $(F,D){let k=D.length,L=!1;for(let V=k-1,w=0;w<k;V=w++){let _=D[V],A=D[w],M=A.x-_.x,C=A.y-_.y;if(Math.abs(C)>Number.EPSILON){if(C<0)_=D[w],M=-M,A=D[V],C=-C;if(F.y<_.y||F.y>A.y)continue;if(F.y===_.y){if(F.x===_.x)return!0}else{let h=C*(F.x-_.x)-M*(F.y-_.y);if(h===0)return!0;if(h<0)continue;L=!L}}else{if(F.y!==_.y)continue;if(A.x<=F.x&&F.x<=_.x||_.x<=F.x&&F.x<=A.x)return!0}}return L}let Z=Z9.isClockWise,W=this.subPaths;if(W.length===0)return[];let K,H,Y,X=[];if(W.length===1)return H=W[0],Y=new p9,Y.curves=H.curves,X.push(Y),X;let U=!Z(W[0].getPoints());U=J?!U:U;let G=[],N=[],E=[],q=0,R;N[q]=void 0,E[q]=[];for(let F=0,D=W.length;F<D;F++)if(H=W[F],R=H.getPoints(),K=Z(R),K=J?!K:K,K){if(!U&&N[q])q++;if(N[q]={s:new p9,p:R},N[q].s.curves=H.curves,U)q++;E[q]=[]}else E[q].push({h:H,p:R[0]});if(!N[0])return Q(W);if(N.length>1){let F=!1,D=0;for(let k=0,L=N.length;k<L;k++)G[k]=[];for(let k=0,L=N.length;k<L;k++){let V=E[k];for(let w=0;w<V.length;w++){let _=V[w],A=!0;for(let M=0;M<N.length;M++)if($(_.p,N[M].p)){if(k!==M)D++;if(A)A=!1,G[M].push(_);else F=!0}if(A)G[k].push(_)}}if(D>0&&F===!1)E=G}let O;for(let F=0,D=N.length;F<D;F++){Y=N[F].s,X.push(Y),O=E[F];for(let k=0,L=O.length;k<L;k++)Y.holes.push(O[k].h)}return X}}function rE(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;else J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;return J}function tE(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;else J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;return J}function eE(J){return J.repeat.x=1,J.repeat.y=1,J.offset.x=0,J.offset.y=0,J}function eZ(J,Q,$,Z){let W=JN(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 JN(J){switch(J){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${J}.`)}class HY{static contain(J,Q){return rE(J,Q)}static cover(J,Q){return tE(J,Q)}static fill(J){return eE(J)}static getByteLength(J,Q,$,Z){return eZ(J,Q,$,Z)}}var tW="183",fX,bX,eW=0,H$=1,JK=2,hX=3,xX=0,C7=1,QK=2,x8=3,g8=0,dJ=1,D9=2,F9=0,w7=1,Y$=2,X$=3,U$=4,$K=5,gX=6,p8=100,ZK=101,WK=102,KK=103,HK=104,YK=200,XK=201,UK=202,GK=203,EK=204,NK=205,qK=206,DK=207,FK=208,RK=209,OK=210,kK=211,MK=212,LK=213,VK=214,BK=0,zK=1,IK=2,G$=3,_K=4,AK=5,CK=6,wK=7,PK=0,TK=1,SK=2,W9=0,E$=1,N$=2,q$=3,D$=4,F$=5,R$=6,O$=7,pX="attached",mX="detached",dX=300,m8=301,K8=302,q6=303,D6=304,P7=306,jK=1000,F6=1001,yK=1002,m9=1003,vK=1004,lX=1004,T7=1005,uX=1005,lJ=1006,R6=1007,cX=1007,H8=1008,nX=1008,K9=1009,fK=1010,bK=1011,S7=1012,k$=1013,d9=1014,A9=1015,C9=1016,M$=1017,L$=1018,d8=1020,hK=35902,xK=35899,gK=1021,pK=1022,R9=1023,Y8=1026,X8=1027,mK=1028,V$=1029,l8=1030,B$=1031,sX=1032,z$=1033,O6=33776,k6=33777,M6=33778,L6=33779,I$=35840,_$=35841,A$=35842,C$=35843,w$=36196,P$=37492,T$=37496,S$=37488,j$=37489,y$=37490,v$=37491,f$=37808,b$=37809,h$=37810,x$=37811,g$=37812,p$=37813,m$=37814,d$=37815,l$=37816,u$=37817,c$=37818,n$=37819,s$=37820,i$=37821,o$=36492,a$=36494,r$=36495,t$=36283,e$=36284,JZ=36285,QZ=36286,iX=2200,oX=2201,aX=2202,rX=2300,tX=2301,eX=2302,JU=2303,QU=2400,$U=2401,ZU=2402,WU=2500,KU=2501,HU=0,YU=1,XU=2,UU=3200,GU=3201,EU=3202,NU=3203,dK=0,lK=1,U8="",uK="srgb",j7="srgb-linear",$Z="linear",EJ="srgb",qU="",DU="rg",FU="ga",RU=0,OU=7680,kU=7681,MU=7682,LU=7683,VU=34055,BU=34056,zU=5386,IU=512,_U=513,AU=514,CU=515,wU=516,PU=517,TU=518,SU=519,cK=512,nK=513,sK=514,V6=515,iK=516,oK=517,B6=518,aK=519,jU=35044,yU=35048,vU=35040,fU=35045,bU=35049,hU=35041,xU=35046,gU=35050,pU=35042,mU="100",ZZ="300 es",WZ=2000,dU=2001,lU,uU,cU,nU,U5,wY,$8=null,tU,vJ,PY=1234567,S8,j8,eU,r,SJ,P,GW,TY,EW,SY,jY,e0,J7,C5=0,w5=0,qW,FJ,GJ,z6,uJ,y7,eK,v7,JH,Q7,U9,P5,T5,i9,qQ,rJ,yY,vY,sJ,S5=0,fY,$7,j9,DQ,s7,j5,y5,bY,hY,xY,gY,v5,Z7,DW,$J,Q8,f5,JG,o9,FQ,M0,fJ,HZ,G9,y9,RW,v9,W7,K7,pY,OW,kW,MW,LW,VW,BW,f9,E9,RQ,H7,Y7,X7,a9,r9,k8,i7,OQ,kQ,M8,x9,VJ,MQ,h5=0,$H,ZH,WH,KH,A6,HH,C6,YH,V0,x5,o7,IW,g5=0,$9,_W,U7,tJ,a7,CJ,l0,gJ,p5=0,PJ,w6,G7,r7,E7,N7,q7,t7,QG,LQ,e7,VQ,mY,AW,dY,YZ,zQ,lY,XZ,b9,CW,IQ,t9,wW,_Q,PW,w9,uY,L8,AQ,cY,CQ,wQ,PQ,TW,TQ,nY,SQ,kJ,sY,iY,oY,d5,aY,yQ,SW,rY,jW,UZ,P6,J9,tY,l5,W8,D7,eY,vQ,JX,u5,J6,Q6,GZ,yW,c5,n5,V8,s5,fQ,L9,V9,cJ,a5,QX,r5,bQ,B8,$6,$X,t5,fW,bJ,hQ,EZ,jJ,Z$,W$,ZX,Z6,xQ,bW,WX,_9,KX,HX,Y9,NZ,j6,YX,sW,pQ,mQ,qZ,DZ,XH,UH,x7,GH,EH,u8,NH,N8,FZ,y6,q8,v6,f6,g7,p7,l9,b6,dQ,lQ,hW,uQ,RZ,m7,OZ,cQ,xW,gW,pW,kZ,h6,MZ,x6,LZ,g6,p6,m6,K$,VZ,_7,p9,d6,IE,l6,u6,d7,c8,c6,n6,l7,s6,i6,o6,a6,BZ,DX,zZ,FH,wE=`void main() {
1
+ var E5=Object.defineProperty;var N5=(J)=>J;function q5(J,Q){this[J]=N5.bind(null,Q)}var D5=(J,Q)=>{for(var $ in Q)E5(J,$,{get:Q[$],enumerable:!0,configurable:!0,set:q5.bind(Q,$)})};var PX=(J,Q)=>()=>(J&&(Q=J(J=0)),Q);var r1=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:(Q,$)=>(typeof require<"u"?require:Q)[$]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});function F5(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function V7(J,Q){return new R5[J](Q)}function rU(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function z7(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function tK(){let J=z7("canvas");return J.style.display="block",J}function tU(J){X8=J}function eU(){return X8}function I7(...J){let Q="THREE."+J.shift();if(X8)X8("log",Q,...J);else console.log(Q,...J)}function JG(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 H0(...J){J=JG(J);let Q="THREE."+J.shift();if(X8)X8("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function T0(...J){J=JG(J);let Q="THREE."+J.shift();if(X8)X8("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function U6(...J){let Q=J.join(" ");if(Q in TX)return;TX[Q]=!0,H0(...J)}function QG(J,Q,$){return new Promise(function(Z,W){function K(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:W();break;case J.TIMEOUT_EXPIRED:setTimeout(K,$);break;default:Z()}}setTimeout(K,$)})}class Z9{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,K=Z.length;W<K;W++)Z[W].call(this,J);J.target=null}}}function Q9(){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 eK(J,Q){return(J%Q+Q)%Q}function O5(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function k5(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function Y6(J,Q,$){return(1-$)*J+$*Q}function M5(J,Q,$,Z){return Y6(J,Q,1-Math.exp(-$*Z))}function L5(J,Q=1){return Q-Math.abs(eK(J,Q*2)-Q)}function V5(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function B5(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 z5(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function I5(J,Q){return J+Math.random()*(Q-J)}function _5(J){return J*(0.5-Math.random())}function A5(J){if(J!==void 0)SX=J;let Q=SX+=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 C5(J){return J*f8}function w5(J){return J*b8}function P5(J){return(J&J-1)===0&&J!==0}function T5(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function S5(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function j5(J,Q,$,Z,W){let{cos:K,sin:Y}=Math,X=K($/2),H=Y($/2),U=K((Q+Z)/2),E=Y((Q+Z)/2),N=K((Q-Z)/2),G=Y((Q-Z)/2),q=K((Z-Q)/2),R=Y((Z-Q)/2);switch(W){case"XYX":J.set(X*E,H*N,H*G,X*U);break;case"YZY":J.set(H*G,X*E,H*N,X*U);break;case"ZXZ":J.set(H*N,H*G,X*E,X*U);break;case"XZX":J.set(X*E,H*R,H*q,X*U);break;case"YXY":J.set(H*q,X*E,H*R,X*U);break;case"ZYZ":J.set(H*R,H*q,X*E,X*U);break;default:H0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function lJ(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 o0(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.")}}function y5(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(W,K,Y){if(this.enabled===!1||K===Y||!K||!Y)return W;if(this.spaces[K].transfer==="srgb")W.r=d9(W.r),W.g=d9(W.g),W.b=d9(W.b);if(this.spaces[K].primaries!==this.spaces[Y].primaries)W.applyMatrix3(this.spaces[K].toXYZ),W.applyMatrix3(this.spaces[Y].fromXYZ);if(this.spaces[Y].transfer==="srgb")W.r=B7(W.r),W.g=B7(W.g),W.b=B7(W.b);return W},workingToColorSpace:function(W,K){return this.convert(W,this.workingColorSpace,K)},colorSpaceToWorking:function(W,K){return this.convert(W,K,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,K=this.workingColorSpace){return W.fromArray(this.spaces[K].luminanceCoefficients)},define:function(W){Object.assign(this.spaces,W)},_getMatrix:function(W,K,Y){return W.copy(this.spaces[K].toXYZ).multiply(this.spaces[Y].fromXYZ)},_getDrawingBufferColorSpace:function(W){return this.spaces[W].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(W=this.workingColorSpace){return this.spaces[W].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(W,K){return U6("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,K)},toWorkingColorSpace:function(W,K){return U6("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(W,K)}},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:yX,fromXYZ:vX,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:yX,fromXYZ:vX,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}function d9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function B7(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}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(Q7===void 0)Q7=z7("canvas");Q7.width=J.width,Q7.height=J.height;let Z=Q7.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=Q7}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=z7("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 K=0;K<W.length;K++)W[K]=d9(W[K]/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(d9(Q[$]/255)*255);else Q[$]=d9(Q[$]);return{data:Q,width:J.width,height:J.height}}else return H0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}class w9{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:v5++}),this.uuid=Q9(),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 K=0,Y=Z.length;K<Y;K++)if(Z[K].isDataTexture)W.push(qW(Z[K].image));else W.push(qW(Z[K]))}else W=qW(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function qW(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 H0("Texture: Unable to serialize Texture."),{}}class v7{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}}class f7{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new Y8,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 Y8,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new Y8,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P,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,K=null,Y=this._targetRay,X=this._grip,H=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(H&&J.hand){K=!0;for(let R of J.hand.values()){let O=Q.getJointPose(R,$),F=this._getHandJoint(H,R);if(O!==null)F.matrix.fromArray(O.transform.matrix),F.matrix.decompose(F.position,F.rotation,F.scale),F.matrixWorldNeedsUpdate=!0,F.jointRadius=O.radius;F.visible=O!==null}let U=H.joints["index-finger-tip"],E=H.joints["thumb-tip"],N=U.position.distanceTo(E.position),G=0.02,q=0.005;if(H.inputState.pinching&&N>G+q)H.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!H.inputState.pinching&&N<=G-q)H.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(X!==null&&J.gripSpace){if(W=Q.getPose(J.gripSpace,$),W!==null){if(X.matrix.fromArray(W.transform.matrix),X.matrix.decompose(X.position,X.rotation,X.scale),X.matrixWorldNeedsUpdate=!0,W.linearVelocity)X.hasLinearVelocity=!0,X.linearVelocity.copy(W.linearVelocity);else X.hasLinearVelocity=!1;if(W.angularVelocity)X.hasAngularVelocity=!0,X.angularVelocity.copy(W.angularVelocity);else X.hasAngularVelocity=!1;if(X.eventsEnabled)X.dispatchEvent({type:"gripUpdated",data:J,target:this})}}if(Y!==null){if(Z=Q.getPose(J.targetRaySpace,$),Z===null&&W!==null)Z=W;if(Z!==null){if(Y.matrix.fromArray(Z.transform.matrix),Y.matrix.decompose(Y.position,Y.rotation,Y.scale),Y.matrixWorldNeedsUpdate=!0,Z.linearVelocity)Y.hasLinearVelocity=!0,Y.linearVelocity.copy(Z.linearVelocity);else Y.hasLinearVelocity=!1;if(Z.angularVelocity)Y.hasAngularVelocity=!0,Y.angularVelocity.copy(Z.angularVelocity);else Y.hasAngularVelocity=!1;this.dispatchEvent(d5)}}}if(Y!==null)Y.visible=Z!==null;if(X!==null)X.visible=W!==null;if(H!==null)H.visible=K!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new Y8;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}function RW(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 C6{constructor(J,Q=0.00025){this.isFogExp2=!0,this.name="",this.color=new V0(J),this.density=Q}clone(){return new C6(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class w6{constructor(J,Q=1,$=1000){this.isFog=!0,this.name="",this.color=new V0(J),this.near=Q,this.far=$}clone(){return new w6(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class uJ{constructor(J=new P,Q=new P,$=new P){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,Z){Z.subVectors($,Q),D9.subVectors(J,Q),Z.cross(D9);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){D9.subVectors(Z,Q),b9.subVectors($,Q),OW.subVectors(J,Q);let K=D9.dot(D9),Y=D9.dot(b9),X=D9.dot(OW),H=b9.dot(b9),U=b9.dot(OW),E=K*H-Y*Y;if(E===0)return W.set(0,0,0),null;let N=1/E,G=(H*X-Y*U)*N,q=(K*U-Y*X)*N;return W.set(1-G-q,q,G)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,h9)===null)return!1;return h9.x>=0&&h9.y>=0&&h9.x+h9.y<=1}static getInterpolation(J,Q,$,Z,W,K,Y,X){if(this.getBarycoord(J,Q,$,Z,h9)===null){if(X.x=0,X.y=0,"z"in X)X.z=0;if("w"in X)X.w=0;return null}return X.setScalar(0),X.addScaledVector(W,h9.x),X.addScaledVector(K,h9.y),X.addScaledVector(Y,h9.z),X}static getInterpolatedAttribute(J,Q,$,Z,W,K){return VW.setScalar(0),BW.setScalar(0),zW.setScalar(0),VW.fromBufferAttribute(J,Q),BW.fromBufferAttribute(J,$),zW.fromBufferAttribute(J,Z),K.setScalar(0),K.addScaledVector(VW,W.x),K.addScaledVector(BW,W.y),K.addScaledVector(zW,W.z),K}static isFrontFacing(J,Q,$,Z){return D9.subVectors($,Q),b9.subVectors(J,Q),D9.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 D9.subVectors(this.c,this.b),b9.subVectors(this.a,this.b),D9.cross(b9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return uJ.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return uJ.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return uJ.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return uJ.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return uJ.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,K,Y;K7.subVectors(Z,$),Y7.subVectors(W,$),kW.subVectors(J,$);let X=K7.dot(kW),H=Y7.dot(kW);if(X<=0&&H<=0)return Q.copy($);MW.subVectors(J,Z);let U=K7.dot(MW),E=Y7.dot(MW);if(U>=0&&E<=U)return Q.copy(Z);let N=X*E-U*H;if(N<=0&&X>=0&&U<=0)return K=X/(X-U),Q.copy($).addScaledVector(K7,K);LW.subVectors(J,W);let G=K7.dot(LW),q=Y7.dot(LW);if(q>=0&&G<=q)return Q.copy(W);let R=G*H-X*q;if(R<=0&&H>=0&&q<=0)return Y=H/(H-q),Q.copy($).addScaledVector(Y7,Y);let O=U*q-G*E;if(O<=0&&E-U>=0&&G-q>=0)return dX.subVectors(W,Z),Y=(E-U)/(E-U+(G-q)),Q.copy(Z).addScaledVector(dX,Y);let F=1/(O+R+N);return K=R*F,Y=N*F,Q.copy($).addScaledVector(K7,K).addScaledVector(Y7,Y)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class jJ{constructor(J=new P(1/0,1/0,1/0),Q=new P(-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(F9.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(F9.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 $=F9.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 K=0,Y=W.count;K<Y;K++){if(J.isMesh===!0)J.getVertexPosition(K,F9);else F9.fromBufferAttribute(W,K);F9.applyMatrix4(J.matrixWorld),this.expandByPoint(F9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();VQ.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();VQ.copy($.boundingBox)}VQ.applyMatrix4(J.matrixWorld),this.union(VQ)}}let Z=J.children;for(let W=0,K=Z.length;W<K;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,F9),F9.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(s7),BQ.subVectors(this.max,s7),X7.subVectors(J.a,s7),H7.subVectors(J.b,s7),U7.subVectors(J.c,s7),Q8.subVectors(H7,X7),$8.subVectors(U7,H7),B8.subVectors(X7,U7);let Q=[0,-Q8.z,Q8.y,0,-$8.z,$8.y,0,-B8.z,B8.y,Q8.z,0,-Q8.x,$8.z,0,-$8.x,B8.z,0,-B8.x,-Q8.y,Q8.x,0,-$8.y,$8.x,0,-B8.y,B8.x,0];if(!IW(Q,X7,H7,U7,BQ))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!IW(Q,X7,H7,U7,BQ))return!1;return zQ.crossVectors(Q8,$8),Q=[zQ.x,zQ.y,zQ.z],IW(Q,X7,H7,U7,BQ)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,F9).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(F9).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 x9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),x9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),x9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),x9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),x9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),x9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),x9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),x9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(x9),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}}function IW(J,Q,$,Z,W){for(let K=0,Y=J.length-3;K<=Y;K+=3){z8.fromArray(J,K);let X=W.x*Math.abs(z8.x)+W.y*Math.abs(z8.y)+W.z*Math.abs(z8.z),H=Q.dot(z8),U=$.dot(z8),E=Z.dot(z8);if(Math.max(-Math.max(H,U,E),Math.min(H,U,E))>X)return!1}return!0}function l5(){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 K=new Uint32Array(2048),Y=new Uint32Array(64),X=new Uint32Array(64);for(let H=1;H<1024;++H){let U=H<<13,E=0;while((U&8388608)===0)U<<=1,E-=8388608;U&=-8388609,E+=947912704,K[H]=U|E}for(let H=1024;H<2048;++H)K[H]=939524096+(H-1024<<13);for(let H=1;H<31;++H)Y[H]=H<<23;Y[31]=1199570944,Y[32]=2147483648;for(let H=33;H<63;++H)Y[H]=2147483648+(H-32<<23);Y[63]=3347054592;for(let H=1;H<64;++H)if(H!==32)X[H]=1024;return{floatView:Q,uint32View:$,baseTable:Z,shiftTable:W,mantissaTable:K,exponentTable:Y,offsetTable:X}}function oJ(J){if(Math.abs(J)>65504)H0("DataUtils.toHalfFloat(): Value out of range.");J=m0(J,-65504,65504),m9.floatView[0]=J;let Q=m9.uint32View[0],$=Q>>23&511;return m9.baseTable[$]+((Q&8388607)>>m9.shiftTable[$])}function W6(J){let Q=J>>10;return m9.uint32View[0]=m9.mantissaTable[m9.offsetTable[Q]+(J&1023)]+m9.exponentTable[Q],m9.floatView[0]}class $Y{static toHalfFloat(J){return oJ(J)}static fromHalfFloat(J){return W6(J)}}class wJ{constructor(J=new P,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 c5.setFromPoints(J).getCenter($);let Z=0;for(let W=0,K=J.length;W<K;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;i7.subVectors(J,this.center);let Q=i7.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(i7,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 _W.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(i7.copy(J.center).add(_W)),this.expandByPoint(i7.copy(J.center).sub(_W));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}}class b7{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=Q9()}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=Q9();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=Q9();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}}}class H8{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)$=lJ($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=o0($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=o0(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=lJ(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=lJ(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=lJ(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=lJ(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=o0(Q,this.array),$=o0($,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=o0(Q,this.array),$=o0($,this.array),Z=o0(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=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array),W=o0(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){I7("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 UJ(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 H8(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){I7("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}}}}function CQ(J,Q,$,Z,W,K){if(D7.subVectors(J,$).addScalar(0.5).multiply(Z),W!==void 0)r7.x=K*D7.x-W*D7.y,r7.y=W*D7.x+K*D7.y;else r7.copy(D7);J.copy(Q),J.x+=r7.x,J.y+=r7.y,J.applyMatrix4(KG)}class R8{constructor(J=new P,Q=new P(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,g9)),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=g9.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return g9.copy(this.origin).addScaledVector(this.direction,Q),g9.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){wW.copy(J).add(Q).multiplyScalar(0.5),PQ.copy(Q).sub(J).normalize(),Z8.copy(this.origin).sub(wW);let W=J.distanceTo(Q)*0.5,K=-this.direction.dot(PQ),Y=Z8.dot(this.direction),X=-Z8.dot(PQ),H=Z8.lengthSq(),U=Math.abs(1-K*K),E,N,G,q;if(U>0)if(E=K*X-Y,N=K*Y-X,q=W*U,E>=0)if(N>=-q)if(N<=q){let R=1/U;E*=R,N*=R,G=E*(E+K*N+2*Y)+N*(K*E+N+2*X)+H}else N=W,E=Math.max(0,-(K*N+Y)),G=-E*E+N*(N+2*X)+H;else N=-W,E=Math.max(0,-(K*N+Y)),G=-E*E+N*(N+2*X)+H;else if(N<=-q)E=Math.max(0,-(-K*W+Y)),N=E>0?-W:Math.min(Math.max(-W,-X),W),G=-E*E+N*(N+2*X)+H;else if(N<=q)E=0,N=Math.min(Math.max(-W,-X),W),G=N*(N+2*X)+H;else E=Math.max(0,-(K*W+Y)),N=E>0?W:Math.min(Math.max(-W,-X),W),G=-E*E+N*(N+2*X)+H;else N=K>0?-W:W,E=Math.max(0,-(K*N+Y)),G=-E*E+N*(N+2*X)+H;if($)$.copy(this.origin).addScaledVector(this.direction,E);if(Z)Z.copy(wW).addScaledVector(PQ,N);return G}intersectSphere(J,Q){g9.subVectors(J.center,this.origin);let $=g9.dot(this.direction),Z=g9.dot(g9)-$*$,W=J.radius*J.radius;if(Z>W)return null;let K=Math.sqrt(W-Z),Y=$-K,X=$+K;if(X<0)return null;if(Y<0)return this.at(X,Q);return this.at(Y,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,K,Y,X,H=1/this.direction.x,U=1/this.direction.y,E=1/this.direction.z,N=this.origin;if(H>=0)$=(J.min.x-N.x)*H,Z=(J.max.x-N.x)*H;else $=(J.max.x-N.x)*H,Z=(J.min.x-N.x)*H;if(U>=0)W=(J.min.y-N.y)*U,K=(J.max.y-N.y)*U;else W=(J.max.y-N.y)*U,K=(J.min.y-N.y)*U;if($>K||W>Z)return null;if(W>$||isNaN($))$=W;if(K<Z||isNaN(Z))Z=K;if(E>=0)Y=(J.min.z-N.z)*E,X=(J.max.z-N.z)*E;else Y=(J.max.z-N.z)*E,X=(J.min.z-N.z)*E;if($>X||Y>Z)return null;if(Y>$||$!==$)$=Y;if(X<Z||Z!==Z)Z=X;if(Z<0)return null;return this.at($>=0?$:Z,Q)}intersectsBox(J){return this.intersectBox(J,g9)!==null}intersectTriangle(J,Q,$,Z,W){PW.subVectors(Q,J),TQ.subVectors($,J),TW.crossVectors(PW,TQ);let K=this.direction.dot(TW),Y;if(K>0){if(Z)return null;Y=1}else if(K<0)Y=-1,K=-K;else return null;Z8.subVectors(this.origin,J);let X=Y*this.direction.dot(TQ.crossVectors(Z8,TQ));if(X<0)return null;let H=Y*this.direction.dot(PW.cross(Z8));if(H<0)return null;if(X+H>K)return null;let U=-Y*Z8.dot(TW);if(U<0)return null;return this.at(U/K,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)}}function i5(J,Q,$,Z,W,K,Y,X){let H;if(Q.side===1)H=Z.intersectTriangle(Y,K,W,!0,X);else H=Z.intersectTriangle(W,K,Y,Q.side===0,X);if(H===null)return null;bQ.copy(X),bQ.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(bQ);if(U<$.near||U>$.far)return null;return{distance:U,point:bQ.clone(),object:J}}function hQ(J,Q,$,Z,W,K,Y,X,H,U){J.getVertexPosition(X,jQ),J.getVertexPosition(H,yQ),J.getVertexPosition(U,vQ);let E=i5(J,Q,$,Z,jQ,yQ,vQ,iX);if(E){let N=new P;if(uJ.getBarycoord(iX,jQ,yQ,vQ,N),W)E.uv=uJ.getInterpolatedAttribute(W,X,H,U,N,new r);if(K)E.uv1=uJ.getInterpolatedAttribute(K,X,H,U,N,new r);if(Y){if(E.normal=uJ.getInterpolatedAttribute(Y,X,H,U,N,new P),E.normal.dot(Z.direction)>0)E.normal.multiplyScalar(-1)}let G={a:X,b:H,c:U,normal:new P,materialIndex:0};uJ.getNormal(jQ,yQ,vQ,G.normal),E.face=G,E.barycoord=N}return E}class y6{constructor(J=[],Q=[]){this.uuid=Q9(),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){H0("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 d0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new d0;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,K=J.length;W<K;W++){let Y=J[W]?J[W].matrixWorld:a5;eX.multiplyMatrices(Y,Q[W]),eX.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new y6(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 $9(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[$],K=Q[W];if(K===void 0)H0("Skeleton: No bone found with UUID:",W),K=new j6;this.bones.push(K),this.boneInverses.push(new d0().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 K=Q[Z];J.bones.push(K.uuid);let Y=$[Z];J.boneInverses.push(Y.toArray())}return J}}class C9{constructor(J=new P(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=vW.subVectors($,Q).cross(t5.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(vW),W=this.normal.dot(Z);if(W===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let K=-(J.start.dot(this.normal)+this.constant)/W;if($===!0&&(K<0||K>1))return null;return Q.copy(J.start).addScaledVector(Z,K)}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||e5.getNormalMatrix(J),Z=this.coplanarPoint(vW).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)}}class O8{constructor(J=new C9,Q=new C9,$=new C9,Z=new C9,W=new C9,K=new C9){this.planes=[J,Q,$,Z,W,K]}set(J,Q,$,Z,W,K){let Y=this.planes;return Y[0].copy(J),Y[1].copy(Q),Y[2].copy($),Y[3].copy(Z),Y[4].copy(W),Y[5].copy(K),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,K=W[0],Y=W[1],X=W[2],H=W[3],U=W[4],E=W[5],N=W[6],G=W[7],q=W[8],R=W[9],O=W[10],F=W[11],D=W[12],k=W[13],M=W[14],V=W[15];if(Z[0].setComponents(H-K,G-U,F-q,V-D).normalize(),Z[1].setComponents(H+K,G+U,F+q,V+D).normalize(),Z[2].setComponents(H+Y,G+E,F+R,V+k).normalize(),Z[3].setComponents(H-Y,G-E,F-R,V-k).normalize(),$)Z[4].setComponents(X,N,O,M).normalize(),Z[5].setComponents(H-X,G-N,F-O,V-M).normalize();else if(Z[4].setComponents(H-X,G-N,F-O,V-M).normalize(),Q===2000)Z[5].setComponents(H+X,G+N,F+O,V+M).normalize();else if(Q===2001)Z[5].setComponents(X,N,O,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();_8.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();_8.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(_8)}intersectsSprite(J){_8.center.set(0,0,0);let Q=JE.distanceTo(J.center);return _8.radius=0.7071067811865476+Q,_8.applyMatrix4(J.matrixWorld),this.intersectsSphere(_8)}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(pQ.x=Z.normal.x>0?J.max.x:J.min.x,pQ.y=Z.normal.y>0?J.max.y:J.min.y,pQ.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(pQ)<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 v6{constructor(){this.coordinateSystem=2000}intersectsObject(J,Q){if(!Q.isArrayCamera||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(I9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),_9.setFromProjectionMatrix(I9,Z.coordinateSystem,Z.reversedDepth),_9.intersectsObject(J))return!0}return!1}intersectsSprite(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(I9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),_9.setFromProjectionMatrix(I9,Z.coordinateSystem,Z.reversedDepth),_9.intersectsSprite(J))return!0}return!1}intersectsSphere(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(I9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),_9.setFromProjectionMatrix(I9,Z.coordinateSystem,Z.reversedDepth),_9.intersectsSphere(J))return!0}return!1}intersectsBox(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(I9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),_9.setFromProjectionMatrix(I9,Z.coordinateSystem,Z.reversedDepth),_9.intersectsBox(J))return!0}return!1}containsPoint(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(I9.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),_9.setFromProjectionMatrix(I9,Z.coordinateSystem,Z.reversedDepth),_9.containsPoint(J))return!0}return!1}clone(){return new v6}}function fW(J,Q){return J-Q}function QE(J,Q){return J.z-Q.z}function $E(J,Q){return Q.z-J.z}class YG{constructor(){this.index=0,this.pool=[],this.list=[]}push(J,Q,$,Z){let W=this.pool,K=this.list;if(this.index>=W.length)W.push({start:-1,count:-1,z:-1,index:-1});let Y=W[this.index];K.push(Y),this.index++,Y.start=J,Y.count=Q,Y.z=$,Y.index=Z}reset(){this.list.length=0,this.index=0}}function YE(J,Q,$=0){let Z=Q.itemSize;if(J.isInterleavedBufferAttribute||J.array.constructor!==Q.array.constructor){let W=J.count;for(let K=0;K<W;K++)for(let Y=0;Y<Z;Y++)Q.setComponent(K+$,Y,J.getComponent(K,Y))}else Q.array.set(J.array,$*Z);Q.needsUpdate=!0}function C8(J,Q){if(J.constructor!==Q.constructor){let $=Math.min(J.length,Q.length);for(let Z=0;Z<$;Z++)Q[Z]=J[Z]}else{let $=Math.min(J.length,Q.length);Q.set(new J.constructor(J.buffer,0,$))}}function uQ(J,Q,$,Z,W,K,Y){let X=J.geometry.attributes.position;if(X$.fromBufferAttribute(X,W),H$.fromBufferAttribute(X,K),$.distanceSqToSegment(X$,H$,hW,KH)>Z)return;hW.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(hW);if(U<Q.near||U>Q.far)return;return{distance:U,point:KH.clone().applyMatrix4(J.matrixWorld),index:Y,face:null,faceIndex:null,barycoord:null,object:J}}function UH(J,Q,$,Z,W,K,Y){let X=oW.distanceSqToPoint(J);if(X<$){let H=new P;oW.closestPointToPoint(J,H),H.applyMatrix4(Z);let U=W.ray.origin.distanceTo(H);if(U<W.near||U>W.far)return;K.push({distance:U,distanceToRay:Math.sqrt(X),point:H,index:Q,face:null,faceIndex:null,barycoord:null,object:Y})}}class W9{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){H0("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 K=1;K<=J;K++)$=this.getPoint(K/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,K;if(Q)K=Q;else K=J*$[W-1];let Y=0,X=W-1,H;while(Y<=X)if(Z=Math.floor(Y+(X-Y)/2),H=$[Z]-K,H<0)Y=Z+1;else if(H>0)X=Z-1;else{X=Z;break}if(Z=X,$[Z]===K)return Z/(W-1);let U=$[Z],N=$[Z+1]-U,G=(K-U)/N;return(Z+G)/(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 K=this.getPoint(Z),Y=this.getPoint(W),X=Q||(K.isVector2?new r:new P);return X.copy(Y).sub(K).normalize(),X}getTangentAt(J,Q){let $=this.getUtoTmapping(J);return this.getTangent($,Q)}computeFrenetFrames(J,Q=!1){let $=new P,Z=[],W=[],K=[],Y=new P,X=new d0;for(let G=0;G<=J;G++){let q=G/J;Z[G]=this.getTangentAt(q,new P)}W[0]=new P,K[0]=new P;let H=Number.MAX_VALUE,U=Math.abs(Z[0].x),E=Math.abs(Z[0].y),N=Math.abs(Z[0].z);if(U<=H)H=U,$.set(1,0,0);if(E<=H)H=E,$.set(0,1,0);if(N<=H)$.set(0,0,1);Y.crossVectors(Z[0],$).normalize(),W[0].crossVectors(Z[0],Y),K[0].crossVectors(Z[0],W[0]);for(let G=1;G<=J;G++){if(W[G]=W[G-1].clone(),K[G]=K[G-1].clone(),Y.crossVectors(Z[G-1],Z[G]),Y.length()>Number.EPSILON){Y.normalize();let q=Math.acos(m0(Z[G-1].dot(Z[G]),-1,1));W[G].applyMatrix4(X.makeRotationAxis(Y,q))}K[G].crossVectors(Z[G],W[G])}if(Q===!0){let G=Math.acos(m0(W[0].dot(W[J]),-1,1));if(G/=J,Z[0].dot(Y.crossVectors(W[0],W[J]))>0)G=-G;for(let q=1;q<=J;q++)W[q].applyMatrix4(X.makeRotationAxis(Z[q],G*q)),K[q].crossVectors(Z[q],W[q])}return{tangents:Z,normals:W,binormals:K}}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 FY(){let J=0,Q=0,$=0,Z=0;function W(K,Y,X,H){J=K,Q=X,$=-3*K+3*Y-2*X-H,Z=2*K-2*Y+X+H}return{initCatmullRom:function(K,Y,X,H,U){W(Y,X,U*(X-K),U*(H-Y))},initNonuniformCatmullRom:function(K,Y,X,H,U,E,N){let G=(Y-K)/U-(X-K)/(U+E)+(X-Y)/E,q=(X-Y)/E-(H-Y)/(E+N)+(H-X)/N;G*=E,q*=E,W(Y,X,G,q)},calc:function(K){let Y=K*K,X=Y*K;return J+Q*K+$*Y+Z*X}}}function NH(J,Q,$,Z,W){let K=(Z-Q)*0.5,Y=(W-$)*0.5,X=J*J,H=J*X;return(2*$-2*Z+K+Y)*H+(-3*$+3*Z-2*K-Y)*X+K*J+$}function XE(J,Q){let $=1-J;return $*$*Q}function HE(J,Q){return 2*(1-J)*J*Q}function UE(J,Q){return J*J*Q}function X6(J,Q,$,Z){return XE(J,Q)+HE(J,$)+UE(J,Z)}function GE(J,Q){let $=1-J;return $*$*$*Q}function EE(J,Q){let $=1-J;return 3*$*$*J*Q}function NE(J,Q){return 3*(1-J)*J*J*Q}function qE(J,Q){return J*J*J*Q}function H6(J,Q,$,Z,W){return GE(J,Q)+EE(J,$)+NE(J,Z)+qE(J,W)}function DE(J,Q,$=2){let Z=Q&&Q.length,W=Z?Q[0]*$:J.length,K=XG(J,0,W,$,!0),Y=[];if(!K||K.next===K.prev)return Y;let X,H,U;if(Z)K=ME(J,Q,K,$);if(J.length>80*$){X=J[0],H=J[1];let E=X,N=H;for(let G=$;G<W;G+=$){let q=J[G],R=J[G+1];if(q<X)X=q;if(R<H)H=R;if(q>E)E=q;if(R>N)N=R}U=Math.max(E-X,N-H),U=U!==0?32767/U:0}return G6(K,Y,$,X,H,U,0),Y}function XG(J,Q,$,Z,W){let K;if(W===TE(J,Q,$,Z)>0)for(let Y=Q;Y<$;Y+=Z)K=qH(Y/Z|0,J[Y],J[Y+1],K);else for(let Y=$-Z;Y>=Q;Y-=Z)K=qH(Y/Z|0,J[Y],J[Y+1],K);if(K&&A7(K,K.next))N6(K),K=K.next;return K}function h8(J,Q){if(!J)return J;if(!Q)Q=J;let $=J,Z;do if(Z=!1,!$.steiner&&(A7($,$.next)||kJ($.prev,$,$.next)===0)){if(N6($),$=Q=$.prev,$===$.next)break;Z=!0}else $=$.next;while(Z||$!==Q);return Q}function G6(J,Q,$,Z,W,K,Y){if(!J)return;if(!Y&&K)IE(J,Z,W,K);let X=J;while(J.prev!==J.next){let{prev:H,next:U}=J;if(K?RE(J,Z,W,K):FE(J)){Q.push(H.i,J.i,U.i),N6(J),J=U.next,X=U.next;continue}if(J=U,J===X){if(!Y)G6(h8(J),Q,$,Z,W,K,1);else if(Y===1)J=OE(h8(J),Q),G6(J,Q,$,Z,W,K,2);else if(Y===2)kE(J,Q,$,Z,W,K);break}}}function FE(J){let Q=J.prev,$=J,Z=J.next;if(kJ(Q,$,Z)>=0)return!1;let W=Q.x,K=$.x,Y=Z.x,X=Q.y,H=$.y,U=Z.y,E=Math.min(W,K,Y),N=Math.min(X,H,U),G=Math.max(W,K,Y),q=Math.max(X,H,U),R=Z.next;while(R!==Q){if(R.x>=E&&R.x<=G&&R.y>=N&&R.y<=q&&K6(W,X,K,H,Y,U,R.x,R.y)&&kJ(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function RE(J,Q,$,Z){let W=J.prev,K=J,Y=J.next;if(kJ(W,K,Y)>=0)return!1;let X=W.x,H=K.x,U=Y.x,E=W.y,N=K.y,G=Y.y,q=Math.min(X,H,U),R=Math.min(E,N,G),O=Math.max(X,H,U),F=Math.max(E,N,G),D=aW(q,R,Q,$,Z),k=aW(O,F,Q,$,Z),M=J.prevZ,V=J.nextZ;while(M&&M.z>=D&&V&&V.z<=k){if(M.x>=q&&M.x<=O&&M.y>=R&&M.y<=F&&M!==W&&M!==Y&&K6(X,E,H,N,U,G,M.x,M.y)&&kJ(M.prev,M,M.next)>=0)return!1;if(M=M.prevZ,V.x>=q&&V.x<=O&&V.y>=R&&V.y<=F&&V!==W&&V!==Y&&K6(X,E,H,N,U,G,V.x,V.y)&&kJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}while(M&&M.z>=D){if(M.x>=q&&M.x<=O&&M.y>=R&&M.y<=F&&M!==W&&M!==Y&&K6(X,E,H,N,U,G,M.x,M.y)&&kJ(M.prev,M,M.next)>=0)return!1;M=M.prevZ}while(V&&V.z<=k){if(V.x>=q&&V.x<=O&&V.y>=R&&V.y<=F&&V!==W&&V!==Y&&K6(X,E,H,N,U,G,V.x,V.y)&&kJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function OE(J,Q){let $=J;do{let Z=$.prev,W=$.next.next;if(!A7(Z,W)&&UG(Z,$,$.next,W)&&E6(Z,W)&&E6(W,Z))Q.push(Z.i,$.i,W.i),N6($),N6($.next),$=J=W;$=$.next}while($!==J);return h8($)}function kE(J,Q,$,Z,W,K){let Y=J;do{let X=Y.next.next;while(X!==Y.prev){if(Y.i!==X.i&&CE(Y,X)){let H=GG(Y,X);Y=h8(Y,Y.next),H=h8(H,H.next),G6(Y,Q,$,Z,W,K,0),G6(H,Q,$,Z,W,K,0);return}X=X.next}Y=Y.next}while(Y!==J)}function ME(J,Q,$,Z){let W=[];for(let K=0,Y=Q.length;K<Y;K++){let X=Q[K]*Z,H=K<Y-1?Q[K+1]*Z:J.length,U=XG(J,X,H,Z,!1);if(U===U.next)U.steiner=!0;W.push(AE(U))}W.sort(LE);for(let K=0;K<W.length;K++)$=VE(W[K],$);return $}function LE(J,Q){let $=J.x-Q.x;if($===0){if($=J.y-Q.y,$===0){let Z=(J.next.y-J.y)/(J.next.x-J.x),W=(Q.next.y-Q.y)/(Q.next.x-Q.x);$=Z-W}}return $}function VE(J,Q){let $=BE(J,Q);if(!$)return Q;let Z=GG($,J);return h8(Z,Z.next),h8($,$.next)}function BE(J,Q){let $=Q,Z=J.x,W=J.y,K=-1/0,Y;if(A7(J,$))return $;do{if(A7(J,$.next))return $.next;else if(W<=$.y&&W>=$.next.y&&$.next.y!==$.y){let N=$.x+(W-$.y)*($.next.x-$.x)/($.next.y-$.y);if(N<=Z&&N>K){if(K=N,Y=$.x<$.next.x?$:$.next,N===Z)return Y}}$=$.next}while($!==Q);if(!Y)return null;let X=Y,H=Y.x,U=Y.y,E=1/0;$=Y;do{if(Z>=$.x&&$.x>=H&&Z!==$.x&&HG(W<U?Z:K,W,H,U,W<U?K:Z,W,$.x,$.y)){let N=Math.abs(W-$.y)/(Z-$.x);if(E6($,J)&&(N<E||N===E&&($.x>Y.x||$.x===Y.x&&zE(Y,$))))Y=$,E=N}$=$.next}while($!==X);return Y}function zE(J,Q){return kJ(J.prev,J,Q.prev)<0&&kJ(Q.next,J,J.next)<0}function IE(J,Q,$,Z){let W=J;do{if(W.z===0)W.z=aW(W.x,W.y,Q,$,Z);W.prevZ=W.prev,W.nextZ=W.next,W=W.next}while(W!==J);W.prevZ.nextZ=null,W.prevZ=null,_E(W)}function _E(J){let Q,$=1;do{let Z=J,W;J=null;let K=null;Q=0;while(Z){Q++;let Y=Z,X=0;for(let U=0;U<$;U++)if(X++,Y=Y.nextZ,!Y)break;let H=$;while(X>0||H>0&&Y){if(X!==0&&(H===0||!Y||Z.z<=Y.z))W=Z,Z=Z.nextZ,X--;else W=Y,Y=Y.nextZ,H--;if(K)K.nextZ=W;else J=W;W.prevZ=K,K=W}Z=Y}K.nextZ=null,$*=2}while(Q>1);return J}function aW(J,Q,$,Z,W){return J=(J-$)*W|0,Q=(Q-Z)*W|0,J=(J|J<<8)&16711935,J=(J|J<<4)&252645135,J=(J|J<<2)&858993459,J=(J|J<<1)&1431655765,Q=(Q|Q<<8)&16711935,Q=(Q|Q<<4)&252645135,Q=(Q|Q<<2)&858993459,Q=(Q|Q<<1)&1431655765,J|Q<<1}function AE(J){let Q=J,$=J;do{if(Q.x<$.x||Q.x===$.x&&Q.y<$.y)$=Q;Q=Q.next}while(Q!==J);return $}function HG(J,Q,$,Z,W,K,Y,X){return(W-Y)*(Q-X)>=(J-Y)*(K-X)&&(J-Y)*(Z-X)>=($-Y)*(Q-X)&&($-Y)*(K-X)>=(W-Y)*(Z-X)}function K6(J,Q,$,Z,W,K,Y,X){return!(J===Y&&Q===X)&&HG(J,Q,$,Z,W,K,Y,X)}function CE(J,Q){return J.next.i!==Q.i&&J.prev.i!==Q.i&&!wE(J,Q)&&(E6(J,Q)&&E6(Q,J)&&PE(J,Q)&&(kJ(J.prev,J,Q.prev)||kJ(J,Q.prev,Q))||A7(J,Q)&&kJ(J.prev,J,J.next)>0&&kJ(Q.prev,Q,Q.next)>0)}function kJ(J,Q,$){return(Q.y-J.y)*($.x-Q.x)-(Q.x-J.x)*($.y-Q.y)}function A7(J,Q){return J.x===Q.x&&J.y===Q.y}function UG(J,Q,$,Z){let W=rQ(kJ(J,Q,$)),K=rQ(kJ(J,Q,Z)),Y=rQ(kJ($,Z,J)),X=rQ(kJ($,Z,Q));if(W!==K&&Y!==X)return!0;if(W===0&&aQ(J,$,Q))return!0;if(K===0&&aQ(J,Z,Q))return!0;if(Y===0&&aQ($,J,Z))return!0;if(X===0&&aQ($,Q,Z))return!0;return!1}function aQ(J,Q,$){return Q.x<=Math.max(J.x,$.x)&&Q.x>=Math.min(J.x,$.x)&&Q.y<=Math.max(J.y,$.y)&&Q.y>=Math.min(J.y,$.y)}function rQ(J){return J>0?1:J<0?-1:0}function wE(J,Q){let $=J;do{if($.i!==J.i&&$.next.i!==J.i&&$.i!==Q.i&&$.next.i!==Q.i&&UG($,$.next,J,Q))return!0;$=$.next}while($!==J);return!1}function E6(J,Q){return kJ(J.prev,J,J.next)<0?kJ(J,Q,J.next)>=0&&kJ(J,J.prev,Q)>=0:kJ(J,Q,J.prev)<0||kJ(J,J.next,Q)<0}function PE(J,Q){let $=J,Z=!1,W=(J.x+Q.x)/2,K=(J.y+Q.y)/2;do{if($.y>K!==$.next.y>K&&$.next.y!==$.y&&W<($.next.x-$.x)*(K-$.y)/($.next.y-$.y)+$.x)Z=!Z;$=$.next}while($!==J);return Z}function GG(J,Q){let $=rW(J.i,J.x,J.y),Z=rW(Q.i,Q.x,Q.y),W=J.next,K=Q.prev;return J.next=Q,Q.prev=J,$.next=W,W.prev=$,Z.next=$,$.prev=Z,K.next=Z,Z.prev=K,Z}function qH(J,Q,$,Z){let W=rW(J,Q,$);if(!Z)W.prev=W,W.next=W;else W.next=Z.next,W.prev=Z,Z.next.prev=W,Z.next=W;return W}function N6(J){if(J.next.prev=J.prev,J.prev.next=J.next,J.prevZ)J.prevZ.nextZ=J.nextZ;if(J.nextZ)J.nextZ.prevZ=J.prevZ}function rW(J,Q,$){return{i:J,x:Q,y:$,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function TE(J,Q,$,Z){let W=0;for(let K=Q,Y=$-Z;K<$;K+=Z)W+=(J[Y]-J[K])*(J[K+1]+J[Y+1]),Y=K;return W}class EG{static triangulate(J,Q,$=2){return DE(J,Q,$)}}class X9{static area(J){let Q=J.length,$=0;for(let Z=Q-1,W=0;W<Q;Z=W++)$+=J[Z].x*J[W].y-J[W].x*J[Z].y;return $*0.5}static isClockWise(J){return X9.area(J)<0}static triangulateShape(J,Q){let $=[],Z=[],W=[];DH(J),FH($,J);let K=J.length;Q.forEach(DH);for(let X=0;X<Q.length;X++)Z.push(K),K+=Q[X].length,FH($,Q[X]);let Y=EG.triangulate($,Z);for(let X=0;X<Y.length;X+=3)W.push(Y.slice(X,X+3));return W}}function DH(J){let Q=J.length;if(Q>2&&J[Q-1].equals(J[0]))J.pop()}function FH(J,Q){for(let $=0;$<Q.length;$++)J.push(Q[$].x),J.push(Q[$].y)}function jE(J,Q,$){if($.shapes=[],Array.isArray(J))for(let Z=0,W=J.length;Z<W;Z++){let K=J[Z];$.shapes.push(K.uuid)}else $.shapes.push(J.uuid);if($.options=Object.assign({},Q),Q.extrudePath!==void 0)$.options.extrudePath=Q.extrudePath.toJSON();return $}function yE(J,Q){if(Q.shapes=[],Array.isArray(J))for(let $=0,Z=J.length;$<Z;$++){let W=J[$];Q.shapes.push(W.uuid)}else Q.shapes.push(J.uuid);return Q}function RH(J,Q,$){let Z=`${J.x},${J.y},${J.z}-${Q.x},${Q.y},${Q.z}`,W=`${Q.x},${Q.y},${Q.z}-${J.x},${J.y},${J.z}`;if($.has(Z)===!0||$.has(W)===!0)return!1;else return $.add(Z),$.add(W),!0}function o8(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(kH(W))if(W.isRenderTargetTexture)H0("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(kH(W[0])){let K=[];for(let Y=0,X=W.length;Y<X;Y++)K[Y]=W[Y].clone();Q[$][Z]=K}else Q[$][Z]=W.slice();else Q[$][Z]=W}}return Q}function pJ(J){let Q={};for(let $=0;$<J.length;$++){let Z=o8(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function kH(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function vE(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function RY(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return $J.workingColorSpace}function v8(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 NG(J){function Q(W,K){return J[W]-J[K]}let $=J.length,Z=Array($);for(let W=0;W!==$;++W)Z[W]=W;return Z.sort(Q),Z}function tW(J,Q,$){let Z=J.length,W=new J.constructor(Z);for(let K=0,Y=0;Y!==Z;++K){let X=$[K]*Q;for(let H=0;H!==Q;++H)W[Y++]=J[X+H]}return W}function kY(J,Q,$,Z){let W=1,K=J[0];while(K!==void 0&&K[Z]===void 0)K=J[W++];if(K===void 0)return;let Y=K[Z];if(Y===void 0)return;if(Array.isArray(Y))do{if(Y=K[Z],Y!==void 0)Q.push(K.time),$.push(...Y);K=J[W++]}while(K!==void 0);else if(Y.toArray!==void 0)do{if(Y=K[Z],Y!==void 0)Q.push(K.time),Y.toArray($,$.length);K=J[W++]}while(K!==void 0);else do{if(Y=K[Z],Y!==void 0)Q.push(K.time),$.push(Y);K=J[W++]}while(K!==void 0)}function hE(J,Q,$,Z,W=30){let K=J.clone();K.name=Q;let Y=[];for(let H=0;H<K.tracks.length;++H){let U=K.tracks[H],E=U.getValueSize(),N=[],G=[];for(let q=0;q<U.times.length;++q){let R=U.times[q]*W;if(R<$||R>=Z)continue;N.push(U.times[q]);for(let O=0;O<E;++O)G.push(U.values[q*E+O])}if(N.length===0)continue;U.times=v8(N,U.times.constructor),U.values=v8(G,U.values.constructor),Y.push(U)}K.tracks=Y;let X=1/0;for(let H=0;H<K.tracks.length;++H)if(X>K.tracks[H].times[0])X=K.tracks[H].times[0];for(let H=0;H<K.tracks.length;++H)K.tracks[H].shift(-1*X);return K.resetDuration(),K}function xE(J,Q=0,$=J,Z=30){if(Z<=0)Z=30;let W=$.tracks.length,K=Q/Z;for(let Y=0;Y<W;++Y){let X=$.tracks[Y],H=X.ValueTypeName;if(H==="bool"||H==="string")continue;let U=J.tracks.find(function(D){return D.name===X.name&&D.ValueTypeName===H});if(U===void 0)continue;let E=0,N=X.getValueSize();if(X.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)E=N/3;let G=0,q=U.getValueSize();if(U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)G=q/3;let R=X.times.length-1,O;if(K<=X.times[0]){let D=E,k=N-E;O=X.values.slice(D,k)}else if(K>=X.times[R]){let D=R*N+E,k=D+N-E;O=X.values.slice(D,k)}else{let D=X.createInterpolant(),k=E,M=N-E;D.evaluate(K),O=D.resultBuffer.slice(k,M)}if(H==="quaternion")new vJ().fromArray(O).normalize().conjugate().toArray(O);let F=U.times.length;for(let D=0;D<F;++D){let k=D*q+G;if(H==="quaternion")vJ.multiplyQuaternionsFlat(U.values,k,O,0,U.values,k);else{let M=q-G*2;for(let V=0;V<M;++V)U.values[k+V]-=O[V]}}}return J.blendMode=2501,J}class MY{static convertArray(J,Q){return v8(J,Q)}static isTypedArray(J){return rU(J)}static getKeyframeOrder(J){return NG(J)}static sortedArray(J,Q,$){return tW(J,Q,$)}static flattenJSON(J,Q,$,Z){kY(J,Q,$,Z)}static subclip(J,Q,$,Z,W=30){return hE(J,Q,$,Z,W)}static makeClipAdditive(J,Q=0,$=J,Z=30){return xE(J,Q,$,Z)}}class M8{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 K;$:{Z:if(!(J<Z)){for(let Y=$+2;;){if(Z===void 0){if(J<W)break Z;return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}if($===Y)break;if(W=Z,Z=Q[++$],J<Z)break Q}K=Q.length;break $}if(!(J>=W)){let Y=Q[1];if(J<Y)$=2,W=Y;for(let X=$-2;;){if(W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if($===X)break;if(Z=W,W=Q[--$-1],J>=W)break Q}K=$,$=0;break $}break J}while($<K){let Y=$+K>>>1;if(J<Q[Y])K=Y;else $=Y+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 K=0;K!==Z;++K)Q[K]=$[W+K];return Q}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class rJ{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=v8(Q,this.TimeBufferType),this.values=v8($,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:v8(J.times,Array),values:v8(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new bZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new WQ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new fZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new hZ(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 H0("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,K=Z-1;while(W!==Z&&$[W]<J)++W;while(K!==-1&&$[K]>Q)--K;if(++K,W!==0||K!==Z){if(W>=K)K=Math.max(K,1),W=K-1;let Y=this.getValueSize();this.times=$.slice(W,K),this.values=this.values.slice(W*Y,K*Y)}return this}validate(){let J=!0,Q=this.getValueSize();if(Q-Math.floor(Q)!==0)T0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)T0("KeyframeTrack: Track is empty.",this),J=!1;let K=null;for(let Y=0;Y!==W;Y++){let X=$[Y];if(typeof X==="number"&&isNaN(X)){T0("KeyframeTrack: Time is not a valid number.",this,Y,X),J=!1;break}if(K!==null&&K>X){T0("KeyframeTrack: Out of order keys.",this,Y,X,K),J=!1;break}K=X}if(Z!==void 0){if(rU(Z))for(let Y=0,X=Z.length;Y!==X;++Y){let H=Z[Y];if(isNaN(H)){T0("KeyframeTrack: Value is not a valid number.",this,Y,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,K=1;for(let Y=1;Y<W;++Y){let X=!1,H=J[Y],U=J[Y+1];if(H!==U&&(Y!==1||H!==J[0]))if(!Z){let E=Y*$,N=E-$,G=E+$;for(let q=0;q!==$;++q){let R=Q[E+q];if(R!==Q[N+q]||R!==Q[G+q]){X=!0;break}}}else X=!0;if(X){if(Y!==K){J[K]=J[Y];let E=Y*$,N=K*$;for(let G=0;G!==$;++G)Q[N+G]=Q[E+G]}++K}}if(W>0){J[K]=J[W];for(let Y=W*$,X=K*$,H=0;H!==$;++H)Q[X+H]=Q[Y+H];++K}if(K!==J.length)this.times=J.slice(0,K),this.values=Q.slice(0,K*$);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}}class p8{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=Q9(),this.userData={},this.duration<0)this.resetDuration()}static parse(J){let Q=[],$=J.tracks,Z=1/(J.fps||1);for(let K=0,Y=$.length;K!==Y;++K)Q.push(pE($[K]).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,K=$.length;W!==K;++W)Q.push(rJ.toJSON($[W]));return Z}static CreateFromMorphTargetSequence(J,Q,$,Z){let W=Q.length,K=[];for(let Y=0;Y<W;Y++){let X=[],H=[];X.push((Y+W-1)%W,Y,(Y+1)%W),H.push(0,1,0);let U=NG(X);if(X=tW(X,1,U),H=tW(H,1,U),!Z&&X[0]===0)X.push(W),H.push(H[0]);K.push(new x8(".morphTargetInfluences["+Q[Y].name+"]",X,H).scale(1/$))}return new this(J,-1,K)}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 Y=0,X=J.length;Y<X;Y++){let H=J[Y],U=H.name.match(W);if(U&&U.length>1){let E=U[1],N=Z[E];if(!N)Z[E]=N=[];N.push(H)}}let K=[];for(let Y in Z)K.push(this.CreateFromMorphTargetSequence(Y,Z[Y],Q,$));return K}static parseAnimation(J,Q){if(H0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return T0("AnimationClip: No animation in JSONLoader data."),null;let $=function(E,N,G,q,R){if(G.length!==0){let O=[],F=[];if(kY(G,O,F,q),O.length!==0)R.push(new E(N,O,F))}},Z=[],W=J.name||"default",K=J.fps||30,Y=J.blendMode,X=J.length||-1,H=J.hierarchy||[];for(let E=0;E<H.length;E++){let N=H[E].keys;if(!N||N.length===0)continue;if(N[0].morphTargets){let G={},q;for(q=0;q<N.length;q++)if(N[q].morphTargets)for(let R=0;R<N[q].morphTargets.length;R++)G[N[q].morphTargets[R]]=-1;for(let R in G){let O=[],F=[];for(let D=0;D!==N[q].morphTargets.length;++D){let k=N[q];O.push(k.time),F.push(k.morphTarget===R?1:0)}Z.push(new x8(".morphTargetInfluence["+R+"]",O,F))}X=G.length*K}else{let G=".bones["+Q[E].name+"]";$(g8,G+".position",N,"pos",Z),$(a8,G+".quaternion",N,"rot",Z),$(g8,G+".scale",N,"scl",Z)}}if(Z.length===0)return null;return new this(W,X,Z,Y)}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 gE(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return x8;case"vector":case"vector2":case"vector3":case"vector4":return g8;case"color":return KQ;case"quaternion":return a8;case"bool":case"boolean":return i9;case"string":return o9}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function pE(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=gE(J.type);if(J.times===void 0){let $=[],Z=[];kY(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)}function MH(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class YQ{constructor(J,Q,$){let Z=this,W=!1,K=0,Y=0,X=void 0,H=[];this.onStart=void 0,this.onLoad=J,this.onProgress=Q,this.onError=$,this._abortController=null,this.itemStart=function(U){if(Y++,W===!1){if(Z.onStart!==void 0)Z.onStart(U,K,Y)}W=!0},this.itemEnd=function(U){if(K++,Z.onProgress!==void 0)Z.onProgress(U,K,Y);if(K===Y){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(X)return X(U);return U},this.setURLModifier=function(U){return X=U,this},this.addHandler=function(U,E){return H.push(U,E),this},this.removeHandler=function(U){let E=H.indexOf(U);if(E!==-1)H.splice(E,2);return this},this.getHandler=function(U){for(let E=0,N=H.length;E<N;E+=2){let G=H[E],q=H[E+1];if(G.global)G.lastIndex=0;if(G.test(U))return q}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}}class mJ{constructor(J){if(this.manager=J!==void 0?J:LY,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}}class pZ{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 r(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new d0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new O8,this._frameExtents=new r(1,1),this._viewportCount=1,this._viewports=[new GJ(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(LH.setFromMatrixPosition(J.matrixWorld),Q.position.copy(LH),VH.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(VH),Q.updateMatrixWorld(),dW.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(dW,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(dW)}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}}class XQ{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let J=0;J<9;J++)this.coefficients.push(new P)}set(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].copy(J[Q]);return this}zero(){for(let J=0;J<9;J++)this.coefficients[J].set(0,0,0);return this}getAt(J,Q){let{x:$,y:Z,z:W}=J,K=this.coefficients;return Q.copy(K[0]).multiplyScalar(0.282095),Q.addScaledVector(K[1],0.488603*Z),Q.addScaledVector(K[2],0.488603*W),Q.addScaledVector(K[3],0.488603*$),Q.addScaledVector(K[4],1.092548*($*Z)),Q.addScaledVector(K[5],1.092548*(Z*W)),Q.addScaledVector(K[6],0.315392*(3*W*W-1)),Q.addScaledVector(K[7],1.092548*($*W)),Q.addScaledVector(K[8],0.546274*($*$-Z*Z)),Q}getIrradianceAt(J,Q){let{x:$,y:Z,z:W}=J,K=this.coefficients;return Q.copy(K[0]).multiplyScalar(0.886227),Q.addScaledVector(K[1],1.023328*Z),Q.addScaledVector(K[2],1.023328*W),Q.addScaledVector(K[3],1.023328*$),Q.addScaledVector(K[4],0.858086*$*Z),Q.addScaledVector(K[5],0.858086*Z*W),Q.addScaledVector(K[6],0.743125*W*W-0.247708),Q.addScaledVector(K[7],0.858086*$*W),Q.addScaledVector(K[8],0.429043*($*$-Z*Z)),Q}add(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].add(J.coefficients[Q]);return this}addScaledSH(J,Q){for(let $=0;$<9;$++)this.coefficients[$].addScaledVector(J.coefficients[$],Q);return this}scale(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].multiplyScalar(J);return this}lerp(J,Q){for(let $=0;$<9;$++)this.coefficients[$].lerp(J.coefficients[$],Q);return this}equals(J){for(let Q=0;Q<9;Q++)if(!this.coefficients[Q].equals(J.coefficients[Q]))return!1;return!0}copy(J){return this.set(J.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(J,Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].fromArray(J,Q+Z*3);return this}toArray(J=[],Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].toArray(J,Q+Z*3);return J}static getBasisAt(J,Q){let{x:$,y:Z,z:W}=J;Q[0]=0.282095,Q[1]=0.488603*Z,Q[2]=0.488603*W,Q[3]=0.488603*$,Q[4]=1.092548*$*Z,Q[5]=1.092548*Z*W,Q[6]=0.315392*(3*W*W-1),Q[7]=1.092548*$*W,Q[8]=0.546274*($*$-Z*Z)}}class q6{static extractUrlBase(J){let Q=J.lastIndexOf("/");if(Q===-1)return"./";return J.slice(0,Q+1)}static resolveURL(J,Q){if(typeof J!=="string"||J==="")return"";if(/^https?:\/\//i.test(Q)&&/^\//.test(J))Q=Q.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(J))return J;if(/^data:.*,.*$/i.test(J))return J;if(/^blob:.*$/i.test(J))return J;return Q+J}}class UQ{static getContext(){if(J$===void 0)J$=new(window.AudioContext||window.webkitAudioContext);return J$}static setContext(J){J$=J}}class PY{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=0.064,this.cameraL=new CJ,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new CJ,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(J){let Q=this._cache;if(Q.focus!==J.focus||Q.fov!==J.fov||Q.aspect!==J.aspect*this.aspect||Q.near!==J.near||Q.far!==J.far||Q.zoom!==J.zoom||Q.eyeSep!==this.eyeSep){Q.focus=J.focus,Q.fov=J.fov,Q.aspect=J.aspect*this.aspect,Q.near=J.near,Q.far=J.far,Q.zoom=J.zoom,Q.eyeSep=this.eyeSep,w8.copy(J.projectionMatrix);let Z=Q.eyeSep/2,W=Z*Q.near/Q.focus,K=Q.near*Math.tan(f8*Q.fov*0.5)/Q.zoom,Y,X;CH.elements[12]=-Z,AH.elements[12]=Z,Y=-K*Q.aspect+W,X=K*Q.aspect+W,w8.elements[0]=2*Q.near/(X-Y),w8.elements[8]=(X+Y)/(X-Y),this.cameraL.projectionMatrix.copy(w8),Y=-K*Q.aspect-W,X=K*Q.aspect-W,w8.elements[0]=2*Q.near/(X-Y),w8.elements[8]=(X+Y)/(X-Y),this.cameraR.projectionMatrix.copy(w8)}this.cameraL.matrixWorld.copy(J.matrixWorld).multiply(CH),this.cameraR.matrixWorld.copy(J.matrixWorld).multiply(AH)}}class rZ{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(J){if(this._document=J,J.hidden!==void 0)this._pageVisibilityHandler=dE.bind(this),J.addEventListener("visibilitychange",this._pageVisibilityHandler,!1)}disconnect(){if(this._pageVisibilityHandler!==null)this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null;this._document=null}getDelta(){return this._delta/1000}getElapsed(){return this._elapsed/1000}getTimescale(){return this._timescale}setTimescale(J){return this._timescale=J,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(J){if(this._pageVisibilityHandler!==null&&this._document.hidden===!0)this._delta=0;else this._previousTime=this._currentTime,this._currentTime=(J!==void 0?J:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta;return this}}function dE(){if(this._document.hidden===!1)this.reset()}class jY{constructor(J,Q=2048){this.analyser=J.context.createAnalyser(),this.analyser.fftSize=Q,this.data=new Uint8Array(this.analyser.frequencyBinCount),J.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let J=0,Q=this.getFrequencyData();for(let $=0;$<Q.length;$++)J+=Q[$];return J/Q.length}}class eZ{constructor(J,Q,$){this.binding=J,this.valueSize=$;let Z,W,K;switch(Q){case"quaternion":Z=this._slerp,W=this._slerpAdditive,K=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array($*6),this._workIndex=5;break;case"string":case"bool":Z=this._select,W=this._select,K=this._setAdditiveIdentityOther,this.buffer=Array($*5);break;default:Z=this._lerp,W=this._lerpAdditive,K=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array($*5)}this._mixBufferRegion=Z,this._mixBufferRegionAdditive=W,this._setIdentity=K,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,K=this.cumulativeWeight;if(K===0){for(let Y=0;Y!==Z;++Y)$[W+Y]=$[Y];K=Q}else{K+=Q;let Y=Q/K;this._mixBufferRegion($,W,0,Y,Z)}this.cumulativeWeight=K}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,K=this.cumulativeWeightAdditive,Y=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,W<1){let X=Q*this._origIndex;this._mixBufferRegion($,Z,X,1-W,Q)}if(K>0)this._mixBufferRegionAdditive($,Z,this._addIndex*Q,1,Q);for(let X=Q,H=Q+Q;X!==H;++X)if($[X]!==$[X+Q]){Y.setValue($,Z);break}}saveOriginalState(){let J=this.binding,Q=this.buffer,$=this.valueSize,Z=$*this._origIndex;J.getValue(Q,Z);for(let W=$,K=Z;W!==K;++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 K=0;K!==W;++K)J[Q+K]=J[$+K]}_slerp(J,Q,$,Z){vJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let K=this._workIndex*W;vJ.multiplyQuaternionsFlat(J,K,J,Q,J,$),vJ.slerpFlat(J,Q,J,Q,J,K,Z)}_lerp(J,Q,$,Z,W){let K=1-Z;for(let Y=0;Y!==W;++Y){let X=Q+Y;J[X]=J[X]*K+J[$+Y]*Z}}_lerpAdditive(J,Q,$,Z,W){for(let K=0;K!==W;++K){let Y=Q+K;J[Y]=J[Y]+J[$+K]*Z}}}class OG{constructor(J,Q,$){let Z=$||WJ.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 WJ{constructor(J,Q,$){this.path=Q,this.parsedPath=$||WJ.parseTrackName(Q),this.node=WJ.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 WJ(J,Q,$);else return new WJ.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(cE,"")}static parseTrackName(J){let Q=rE.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(tE.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 K=0;K<W.length;K++){let Y=W[K];if(Y.name===Q||Y.uuid===Q)return Y;let X=$(Y.children);if(X)return X}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=WJ.findNode(this.rootNode,Q.nodeName),this.node=J;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!J){H0("PropertyBinding: No target node found for track: "+this.path+".");return}if($){let H=Q.objectIndex;switch($){case"materials":if(!J.material){T0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){T0("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){T0("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){T0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){T0("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){T0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(H!==void 0){if(J[H]===void 0){T0("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,J);return}J=J[H]}}let K=J[Z];if(K===void 0){let H=Q.nodeName;T0("PropertyBinding: Trying to update property for track: "+H+"."+Z+" but it wasn't found.",J);return}let Y=this.Versioning.None;if(this.targetObject=J,J.isMaterial===!0)Y=this.Versioning.NeedsUpdate;else if(J.isObject3D===!0)Y=this.Versioning.MatrixWorldNeedsUpdate;let X=this.BindingType.Direct;if(W!==void 0){if(Z==="morphTargetInfluences"){if(!J.geometry){T0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){T0("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]}X=this.BindingType.ArrayElement,this.resolvedProperty=K,this.propertyIndex=W}else if(K.fromArray!==void 0&&K.toArray!==void 0)X=this.BindingType.HasFromToArray,this.resolvedProperty=K;else if(Array.isArray(K))X=this.BindingType.EntireArray,this.resolvedProperty=K;else this.propertyName=Z;this.getValue=this.GetterByBindingType[X],this.setValue=this.SetterByBindingTypeAndVersioning[X][Y]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}class fY{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Q9(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let J={};this._indicesByUUID=J;for(let $=0,Z=arguments.length;$!==Z;++$)J[arguments[$].uuid]=$;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let Q=this;this.stats={objects:{get total(){return Q._objects.length},get inUse(){return this.total-Q.nCachedObjects_}},get bindingsPerObject(){return Q._bindings.length}}}add(){let J=this._objects,Q=this._indicesByUUID,$=this._paths,Z=this._parsedPaths,W=this._bindings,K=W.length,Y=void 0,X=J.length,H=this.nCachedObjects_;for(let U=0,E=arguments.length;U!==E;++U){let N=arguments[U],G=N.uuid,q=Q[G];if(q===void 0){q=X++,Q[G]=q,J.push(N);for(let R=0,O=K;R!==O;++R)W[R].push(new WJ(N,$[R],Z[R]))}else if(q<H){Y=J[q];let R=--H,O=J[R];Q[O.uuid]=q,J[q]=O,Q[G]=R,J[R]=N;for(let F=0,D=K;F!==D;++F){let k=W[F],M=k[R],V=k[q];if(k[q]=M,V===void 0)V=new WJ(N,$[F],Z[F]);k[R]=V}}else if(J[q]!==Y)T0("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=H}remove(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_;for(let K=0,Y=arguments.length;K!==Y;++K){let X=arguments[K],H=X.uuid,U=Q[H];if(U!==void 0&&U>=W){let E=W++,N=J[E];Q[N.uuid]=U,J[U]=N,Q[H]=E,J[E]=X;for(let G=0,q=Z;G!==q;++G){let R=$[G],O=R[E],F=R[U];R[U]=O,R[E]=F}}}this.nCachedObjects_=W}uncache(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_,K=J.length;for(let Y=0,X=arguments.length;Y!==X;++Y){let H=arguments[Y],U=H.uuid,E=Q[U];if(E!==void 0)if(delete Q[U],E<W){let N=--W,G=J[N],q=--K,R=J[q];Q[G.uuid]=E,J[E]=G,Q[R.uuid]=N,J[N]=R,J.pop();for(let O=0,F=Z;O!==F;++O){let D=$[O],k=D[N],M=D[q];D[E]=k,D[N]=M,D.pop()}}else{let N=--K,G=J[N];if(N>0)Q[G.uuid]=E;J[E]=G,J.pop();for(let q=0,R=Z;q!==R;++q){let O=$[q];O[E]=O[N],O.pop()}}}this.nCachedObjects_=W}subscribe_(J,Q){let $=this._bindingsIndicesByPath,Z=$[J],W=this._bindings;if(Z!==void 0)return W[Z];let K=this._paths,Y=this._parsedPaths,X=this._objects,H=X.length,U=this.nCachedObjects_,E=Array(H);Z=W.length,$[J]=Z,K.push(J),Y.push(Q),W.push(E);for(let N=U,G=X.length;N!==G;++N){let q=X[N];E[N]=new WJ(q,J,Q)}return E}unsubscribe_(J){let Q=this._bindingsIndicesByPath,$=Q[J];if($!==void 0){let Z=this._paths,W=this._parsedPaths,K=this._bindings,Y=K.length-1,X=K[Y],H=J[Y];Q[H]=$,K[$]=X,K.pop(),W[$]=W[Y],W.pop(),Z[$]=Z[Y],Z.pop()}}}class JW{constructor(J,Q,$=null,Z=Q.blendMode){this._mixer=J,this._clip=Q,this._localRoot=$,this.blendMode=Z;let W=Q.tracks,K=W.length,Y=Array(K),X={endingStart:2400,endingEnd:2400};for(let H=0;H!==K;++H){let U=W[H].createInterpolant(null);if(Y[H]=U,U.settings)Object.assign(X,U.settings);U.settings=X}this._interpolantSettings=X,this._interpolants=Y,this._propertyBindings=Array(K),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,K=W/Z,Y=Z/W;J.warp(1,K,Q),this.warp(Y,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,K=this.timeScale,Y=this._timeScaleInterpolant;if(Y===null)Y=Z._lendControlInterpolant(),this._timeScaleInterpolant=Y;let{parameterPositions:X,sampleValues:H}=Y;return X[0]=W,X[1]=W+$,H[0]=J/K,H[1]=Q/K,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 X=(J-W)*$;if(X<0||$===0)Q=0;else this._startTime=null,Q=$*X}Q*=this._updateTimeScale(J);let K=this._updateTime(Q),Y=this._updateWeight(J);if(Y>0){let X=this._interpolants,H=this._propertyBindings;switch(this.blendMode){case 2501:for(let U=0,E=X.length;U!==E;++U)X[U].evaluate(K),H[U].accumulateAdditive(Y);break;case 2500:default:for(let U=0,E=X.length;U!==E;++U)X[U].evaluate(K),H[U].accumulate(Z,Y)}}}_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,K=$===2202;if(J===0){if(W===-1)return Z;return K&&(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,K);else this._setEndings(this.repetitions===0,!0,K);if(Z>=Q||Z<0){let Y=Math.floor(Z/Q);Z-=Q*Y,W+=Math.abs(Y);let X=this.repetitions-W;if(X<=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(X===1){let H=J<0;this._setEndings(H,!H,K)}else this._setEndings(!1,!1,K);this._loopCount=W,this.time=Z,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:Y})}}else this._loopCount=W,this.time=Z;if(K&&(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,K=this._weightInterpolant;if(K===null)K=Z._lendControlInterpolant(),this._weightInterpolant=K;let{parameterPositions:Y,sampleValues:X}=K;return Y[0]=W,X[0]=Q,Y[1]=W+J,X[1]=$,this}}class QW{constructor(J){this.value=J}clone(){return new QW(this.value.clone===void 0?this.value:this.value.clone())}}class pY{constructor(J,Q,$,Z,W,K=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=J,this.type=Q,this.itemSize=$,this.elementSize=Z,this.count=W,this.normalized=K,this.version=0}set needsUpdate(J){if(J===!0)this.version++}setBuffer(J){return this.buffer=J,this}setType(J,Q){return this.type=J,this.elementSize=Q,this}setItemSize(J){return this.itemSize=J,this}setCount(J){return this.count=J,this}}class mY{constructor(J,Q,$=0,Z=1/0){this.ray=new R8(J,Q),this.near=$,this.far=Z,this.camera=null,this.layers=new v7,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(J,Q){this.ray.set(J,Q)}setFromCamera(J,Q){if(Q.isPerspectiveCamera)this.ray.origin.setFromMatrixPosition(Q.matrixWorld),this.ray.direction.set(J.x,J.y,0.5).unproject(Q).sub(this.ray.origin).normalize(),this.camera=Q;else if(Q.isOrthographicCamera)this.ray.origin.set(J.x,J.y,(Q.near+Q.far)/(Q.near-Q.far)).unproject(Q),this.ray.direction.set(0,0,-1).transformDirection(Q.matrixWorld),this.camera=Q;else T0("Raycaster: Unsupported camera type: "+Q.type)}setFromXRController(J){return PH.identity().extractRotation(J.matrixWorld),this.ray.origin.setFromMatrixPosition(J.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(PH),this}intersectObject(J,Q=!0,$=[]){return eW(J,this,$,Q),$.sort(TH),$}intersectObjects(J,Q=!0,$=[]){for(let Z=0,W=J.length;Z<W;Z++)eW(J[Z],this,$,Q);return $.sort(TH),$}}function TH(J,Q){return J.distance-Q.distance}function eW(J,Q,$,Z){let W=!0;if(J.layers.test(Q.layers)){if(J.raycast(Q,$)===!1)W=!1}if(W===!0&&Z===!0){let K=J.children;for(let Y=0,X=K.length;Y<X;Y++)eW(K[Y],Q,$,!0)}}class dY{constructor(J=!0){this.autoStart=J,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,H0("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let J=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let Q=performance.now();J=(Q-this.oldTime)/1000,this.oldTime=Q,this.elapsedTime+=J}return J}}class lY{constructor(J=1,Q=0,$=0){this.radius=J,this.phi=Q,this.theta=$}set(J,Q,$){return this.radius=J,this.phi=Q,this.theta=$,this}copy(J){return this.radius=J.radius,this.phi=J.phi,this.theta=J.theta,this}makeSafe(){return this.phi=m0(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){if(this.radius=Math.sqrt(J*J+Q*Q+$*$),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(J,$),this.phi=Math.acos(m0(Q/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class uY{constructor(J=1,Q=0,$=0){this.radius=J,this.theta=Q,this.y=$}set(J,Q,$){return this.radius=J,this.theta=Q,this.y=$,this}copy(J){return this.radius=J.radius,this.theta=J.theta,this.y=J.y,this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){return this.radius=Math.sqrt(J*J+$*$),this.theta=Math.atan2(J,$),this.y=Q,this}clone(){return new this.constructor().copy(this)}}class cY{constructor(J=new r(1/0,1/0),Q=new r(-1/0,-1/0)){this.isBox2=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=SH.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(J){return this.isEmpty()?J.set(0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,SH).distanceTo(J)}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}}class nY{constructor(J=new P,Q=new P){this.start=J,this.end=Q}set(J,Q){return this.start.copy(J),this.end.copy(Q),this}copy(J){return this.start.copy(J.start),this.end.copy(J.end),this}getCenter(J){return J.addVectors(this.start,this.end).multiplyScalar(0.5)}delta(J){return J.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(J,Q){return this.delta(Q).multiplyScalar(J).add(this.start)}closestPointToPointParameter(J,Q){jH.subVectors(J,this.start),Q$.subVectors(this.end,this.start);let $=Q$.dot(Q$);if($===0)return 0;let W=Q$.dot(jH)/$;if(Q)W=m0(W,0,1);return W}closestPointToPoint(J,Q,$){let Z=this.closestPointToPointParameter(J,Q);return this.delta($).multiplyScalar(Z).add(this.start)}distanceSqToLine3(J,Q=QN,$=$N){let W,K,Y=this.start,X=J.start,H=this.end,U=J.end;M7.subVectors(H,Y),L7.subVectors(U,X),nW.subVectors(Y,X);let E=M7.dot(M7),N=L7.dot(L7),G=L7.dot(nW);if(E<=0.00000000000000010000000000000001&&N<=0.00000000000000010000000000000001)return Q.copy(Y),$.copy(X),Q.sub($),Q.dot(Q);if(E<=0.00000000000000010000000000000001)W=0,K=G/N,K=m0(K,0,1);else{let q=M7.dot(nW);if(N<=0.00000000000000010000000000000001)K=0,W=m0(-q/E,0,1);else{let R=M7.dot(L7),O=E*N-R*R;if(O!==0)W=m0((R*G-q*N)/O,0,1);else W=0;if(K=(R*W+G)/N,K<0)K=0,W=m0(-q/E,0,1);else if(K>1)K=1,W=m0((R-q)/E,0,1)}}return Q.copy(Y).addScaledVector(M7,W),$.copy(X).addScaledVector(L7,K),Q.distanceToSquared($)}applyMatrix4(J){return this.start.applyMatrix4(J),this.end.applyMatrix4(J),this}equals(J){return J.start.equals(this.start)&&J.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}function kG(J){let Q=[];if(J.isBone===!0)Q.push(J);for(let $=0;$<J.children.length;$++)Q.push(...kG(J.children[$]));return Q}function IJ(J,Q,$,Z,W,K,Y){W$.set(W,K,Y).unproject(Z);let X=Q[J];if(X!==void 0){let H=$.getAttribute("position");for(let U=0,E=X.length;U<E;U++)H.setXYZ(X[U],W$.x,W$.y,W$.z)}}class YX{constructor(){this.type="ShapePath",this.color=new V0,this.subPaths=[],this.currentPath=null}moveTo(J,Q){return this.currentPath=new _7,this.subPaths.push(this.currentPath),this.currentPath.moveTo(J,Q),this}lineTo(J,Q){return this.currentPath.lineTo(J,Q),this}quadraticCurveTo(J,Q,$,Z){return this.currentPath.quadraticCurveTo(J,Q,$,Z),this}bezierCurveTo(J,Q,$,Z,W,K){return this.currentPath.bezierCurveTo(J,Q,$,Z,W,K),this}splineThru(J){return this.currentPath.splineThru(J),this}toShapes(J){function Q(F){let D=[];for(let k=0,M=F.length;k<M;k++){let V=F[k],_=new l9;_.curves=V.curves,D.push(_)}return D}function $(F,D){let k=D.length,M=!1;for(let V=k-1,_=0;_<k;V=_++){let A=D[V],C=D[_],L=C.x-A.x,I=C.y-A.y;if(Math.abs(I)>Number.EPSILON){if(I<0)A=D[_],L=-L,C=D[V],I=-I;if(F.y<A.y||F.y>C.y)continue;if(F.y===A.y){if(F.x===A.x)return!0}else{let b=I*(F.x-A.x)-L*(F.y-A.y);if(b===0)return!0;if(b<0)continue;M=!M}}else{if(F.y!==A.y)continue;if(C.x<=F.x&&F.x<=A.x||A.x<=F.x&&F.x<=C.x)return!0}}return M}let Z=X9.isClockWise,W=this.subPaths;if(W.length===0)return[];let K,Y,X,H=[];if(W.length===1)return Y=W[0],X=new l9,X.curves=Y.curves,H.push(X),H;let U=!Z(W[0].getPoints());U=J?!U:U;let E=[],N=[],G=[],q=0,R;N[q]=void 0,G[q]=[];for(let F=0,D=W.length;F<D;F++)if(Y=W[F],R=Y.getPoints(),K=Z(R),K=J?!K:K,K){if(!U&&N[q])q++;if(N[q]={s:new l9,p:R},N[q].s.curves=Y.curves,U)q++;G[q]=[]}else G[q].push({h:Y,p:R[0]});if(!N[0])return Q(W);if(N.length>1){let F=!1,D=0;for(let k=0,M=N.length;k<M;k++)E[k]=[];for(let k=0,M=N.length;k<M;k++){let V=G[k];for(let _=0;_<V.length;_++){let A=V[_],C=!0;for(let L=0;L<N.length;L++)if($(A.p,N[L].p)){if(k!==L)D++;if(C)C=!1,E[L].push(A);else F=!0}if(C)E[k].push(A)}}if(D>0&&F===!1)G=E}let O;for(let F=0,D=N.length;F<D;F++){X=N[F].s,H.push(X),O=G[F];for(let k=0,M=O.length;k<M;k++)X.holes.push(O[k].h)}return H}}function WN(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;else J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;return J}function KN(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;else J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;return J}function YN(J){return J.repeat.x=1,J.repeat.y=1,J.offset.x=0,J.offset.y=0,J}function ZW(J,Q,$,Z){let W=XN(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 XN(J){switch(J){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${J}.`)}class HX{static contain(J,Q){return WN(J,Q)}static cover(J,Q){return KN(J,Q)}static fill(J){return YN(J)}static getByteLength(J,Q,$,Z){return ZW(J,Q,$,Z)}}var JK="184",gH,pH,QK=0,G$=1,$K=2,mH=3,dH=0,C7=1,ZK=2,d8=3,l8=0,cJ=1,k9=2,M9=0,w7=1,E$=2,N$=3,q$=4,WK=5,lH=6,u8=100,KK=101,YK=102,XK=103,HK=104,UK=200,GK=201,EK=202,NK=203,qK=204,DK=205,FK=206,RK=207,OK=208,kK=209,MK=210,LK=211,VK=212,BK=213,zK=214,IK=0,_K=1,AK=2,D$=3,CK=4,wK=5,PK=6,TK=7,SK=0,jK=1,yK=2,U9=0,F$=1,R$=2,O$=3,k$=4,M$=5,L$=6,V$=7,uH="attached",cH="detached",nH=300,c8=301,G8=302,D6=303,F6=304,P7=306,vK=1000,R6=1001,fK=1002,u9=1003,bK=1004,sH=1004,T7=1005,iH=1005,nJ=1006,O6=1007,oH=1007,E8=1008,aH=1008,G9=1009,hK=1010,xK=1011,S7=1012,B$=1013,c9=1014,T9=1015,S9=1016,z$=1017,I$=1018,n8=1020,gK=35902,pK=35899,mK=1021,dK=1022,L9=1023,N8=1026,q8=1027,lK=1028,_$=1029,D8=1030,A$=1031,rH=1032,C$=1033,k6=33776,M6=33777,L6=33778,V6=33779,w$=35840,P$=35841,T$=35842,S$=35843,j$=36196,y$=37492,v$=37496,f$=37488,b$=37489,B6=37490,h$=37491,x$=37808,g$=37809,p$=37810,m$=37811,d$=37812,l$=37813,u$=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,z6=36285,ZZ=36286,tH=2200,eH=2201,JU=2202,QU=2300,$U=2301,ZU=2302,WU=2303,KU=2400,YU=2401,XU=2402,HU=2500,UU=2501,GU=0,EU=1,NU=2,qU=3200,DU=3201,FU=3202,RU=3203,WZ=0,uK=1,F8="",cK="srgb",KZ="srgb-linear",YZ="linear",qJ="srgb",OU="",kU="rg",MU="ga",LU=0,VU=7680,BU=7681,zU=7682,IU=7683,_U=34055,AU=34056,CU=5386,wU=512,PU=513,TU=514,SU=515,jU=516,yU=517,vU=518,fU=519,nK=512,sK=513,iK=514,I6=515,oK=516,aK=517,_6=518,rK=519,bU=35044,hU=35048,xU=35040,gU=35045,pU=35049,mU=35041,dU=35046,lU=35050,uU=35042,cU="100",XZ="300 es",HZ=2000,nU=2001,sU,iU,oU,aU,R5,TX,X8=null,$G,hJ,SX=1234567,f8,b8,ZG,r,vJ,P,EW,jX,u0,NW,yX,vX,$J,Q7,v5=0,f5=0,DW,OJ,GJ,A6,sJ,j7,JY,y7,QY,d0,$7,q9,b5,h5,e9,kQ,eJ,fX,bX,H9,x5=0,hX,Z7,f9,MQ,n7,g5,p5,xX,gX,pX,mX,m5,W7,FW,KJ,Y8,d5,WG,J8,LQ,V0,xJ,GZ,D9,b9,OW,h9,K7,Y7,dX,kW,MW,LW,VW,BW,zW,x9,F9,VQ,X7,H7,U7,Q8,$8,B8,s7,BQ,zQ,z8,m9,AJ,IQ,u5=0,UJ,ZY,WY,KY,YY,P6,XY,T6,HY,z0,c5,i7,_W,n5=0,Y9,AW,G7,J9,o7,SJ,c0,dJ,s5=0,yJ,S6,E7,a7,N7,q7,D7,r7,KG,_Q,t7,AQ,lX,CW,uX,EZ,wQ,cX,NZ,g9,wW,PQ,Z8,PW,TQ,TW,j9,nX,I8,SQ,sX,jQ,yQ,vQ,SW,fQ,iX,bQ,VJ,e7,oX,aX,o5,rX,xQ,jW,tX,yW,qZ,j6,$9,eX,a5,U8,F7,JH,gQ,QH,r5,J6,Q6,DZ,vW,t5,e5,_8,JE,pQ,I9,_9,iJ,ZE,$H,WE,mQ,A8,$6,ZH,KE,bW,gJ,dQ,FZ,fJ,X$,H$,WH,Z6,lQ,hW,KH,P9,YH,XH,E9,RZ,f6,HH,oW,cQ,nQ,OZ,kZ,UY,GY,h7,EY,NY,s8,qY,DY,n9,MZ,b6,k8,h6,x6,x7,g7,s9,g6,sQ,iQ,xW,oQ,LZ,p7,VZ,GH,EH,gW,pW,mW,BZ,p6,zZ,m6,IZ,d6,l6,u6,U$,_Z,_7,l9,c6,SE,n6,s6,m7,i8,i6,o6,d7,a6,r6,t6,e6,AZ,OH,CZ,OY,fE=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
- }`,PE=`void main() {
3
+ }`,bE=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5
- }`,iJ,r6,t6,IZ,_Z,AZ,CZ,wZ,e6,JQ,PZ,TZ,SZ,QQ,jZ,yZ,u9,$Q,v8,vZ,s8,c9,f8,N9,kH,h9,UG,q9,MH,LH,F7,h8,VH,BH,zH,P9,fZ,mW,RX,OX,iQ,oQ,B9,u7,e9,kX,MX,BJ,GG,hZ,EG,xZ,i8,NG,gZ,pZ,mZ,dZ,KQ,lZ,uZ,IH,vE,LX,VX,dW,_H,aQ,AH,BX,zX,I8,R7=-90,O7=1,cZ,nZ,_8,lW,bE,A8,C8,wH,iZ,w8,IX,hE,P8,PH,SH="\\[\\]\\.:\\/",xE,jH,gE,pE,mE,dE,lE,uE,cE,nE,vH,fH,sE=0,bH,hH,_X,CX,wX,rQ,k7,M7,uW,iE,oE,PX,cH,J8,tQ,cW,nH,sH,aE,TX,SX,iH,oH,aH,jX,eQ,yX,rH,J$,OJ,tH,Q$,eH,JY,QY,vX,$$,nW,$Y,ZY,KY;var YY=CY(()=>{fX={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},bX={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},lU={COMPUTE:"compute",RENDER:"render"},uU={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},cU={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},nU={TEXTURE_COMPARE:"depthTextureCompare"};U5={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};wY={};tU={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};vJ=["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"],S8=Math.PI/180,j8=180/Math.PI;eU={DEG2RAD:S8,RAD2DEG:j8,generateUUID:eJ,clamp:p0,euclideanModulo:tK,mapLinear:G5,inverseLerp:E5,lerp:H6,damp:N5,pingpong:q5,smoothstep:D5,smootherstep:F5,randInt:R5,randFloat:O5,randFloatSpread:k5,seededRandom:M5,degToRad:L5,radToDeg:V5,isPowerOfTwo:B5,ceilPowerOfTwo:z5,floorPowerOfTwo:I5,setQuaternionFromProperEuler:_5,normalize:o0,denormalize:pJ};r=class r{constructor(J=0,Q=0){r.prototype.isVector2=!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=p0(this.x,J.x,Q.x),this.y=p0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=p0(this.x,J,Q),this.y=p0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(p0($,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(p0($,-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,K=this.y-J.y;return this.x=W*$-K*Z+J.x,this.y=W*Z+K*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};SJ=class SJ{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,K,H){let Y=$[Z+0],X=$[Z+1],U=$[Z+2],G=$[Z+3],N=W[K+0],E=W[K+1],q=W[K+2],R=W[K+3];if(G!==R||Y!==N||X!==E||U!==q){let O=Y*N+X*E+U*q+G*R;if(O<0)N=-N,E=-E,q=-q,R=-R,O=-O;let F=1-H;if(O<0.9995){let D=Math.acos(O),k=Math.sin(D);F=Math.sin(F*D)/k,H=Math.sin(H*D)/k,Y=Y*F+N*H,X=X*F+E*H,U=U*F+q*H,G=G*F+R*H}else{Y=Y*F+N*H,X=X*F+E*H,U=U*F+q*H,G=G*F+R*H;let D=1/Math.sqrt(Y*Y+X*X+U*U+G*G);Y*=D,X*=D,U*=D,G*=D}}J[Q]=Y,J[Q+1]=X,J[Q+2]=U,J[Q+3]=G}static multiplyQuaternionsFlat(J,Q,$,Z,W,K){let H=$[Z],Y=$[Z+1],X=$[Z+2],U=$[Z+3],G=W[K],N=W[K+1],E=W[K+2],q=W[K+3];return J[Q]=H*q+U*G+Y*E-X*N,J[Q+1]=Y*q+U*N+X*G-H*E,J[Q+2]=X*q+U*E+H*N-Y*G,J[Q+3]=U*q-H*G-Y*N-X*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:K}=J,H=Math.cos,Y=Math.sin,X=H($/2),U=H(Z/2),G=H(W/2),N=Y($/2),E=Y(Z/2),q=Y(W/2);switch(K){case"XYZ":this._x=N*U*G+X*E*q,this._y=X*E*G-N*U*q,this._z=X*U*q+N*E*G,this._w=X*U*G-N*E*q;break;case"YXZ":this._x=N*U*G+X*E*q,this._y=X*E*G-N*U*q,this._z=X*U*q-N*E*G,this._w=X*U*G+N*E*q;break;case"ZXY":this._x=N*U*G-X*E*q,this._y=X*E*G+N*U*q,this._z=X*U*q+N*E*G,this._w=X*U*G-N*E*q;break;case"ZYX":this._x=N*U*G-X*E*q,this._y=X*E*G+N*U*q,this._z=X*U*q-N*E*G,this._w=X*U*G+N*E*q;break;case"YZX":this._x=N*U*G+X*E*q,this._y=X*E*G+N*U*q,this._z=X*U*q-N*E*G,this._w=X*U*G-N*E*q;break;case"XZY":this._x=N*U*G-X*E*q,this._y=X*E*G-N*U*q,this._z=X*U*q+N*E*G,this._w=X*U*G+N*E*q;break;default:U0("Quaternion: .setFromEuler() encountered an unknown order: "+K)}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],K=Q[1],H=Q[5],Y=Q[9],X=Q[2],U=Q[6],G=Q[10],N=$+H+G;if(N>0){let E=0.5/Math.sqrt(N+1);this._w=0.25/E,this._x=(U-Y)*E,this._y=(W-X)*E,this._z=(K-Z)*E}else if($>H&&$>G){let E=2*Math.sqrt(1+$-H-G);this._w=(U-Y)/E,this._x=0.25*E,this._y=(Z+K)/E,this._z=(W+X)/E}else if(H>G){let E=2*Math.sqrt(1+H-$-G);this._w=(W-X)/E,this._x=(Z+K)/E,this._y=0.25*E,this._z=(Y+U)/E}else{let E=2*Math.sqrt(1+G-$-H);this._w=(K-Z)/E,this._x=(W+X)/E,this._y=(Y+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(p0(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:K}=J,H=Q._x,Y=Q._y,X=Q._z,U=Q._w;return this._x=$*U+K*H+Z*X-W*Y,this._y=Z*U+K*Y+W*H-$*X,this._z=W*U+K*X+$*Y-Z*H,this._w=K*U-$*H-Z*Y-W*X,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:Z,_z:W,_w:K}=J,H=this.dot(J);if(H<0)$=-$,Z=-Z,W=-W,K=-K,H=-H;let Y=1-Q;if(H<0.9995){let X=Math.acos(H),U=Math.sin(X);Y=Math.sin(Y*X)/U,Q=Math.sin(Q*X)/U,this._x=this._x*Y+$*Q,this._y=this._y*Y+Z*Q,this._z=this._z*Y+W*Q,this._w=this._w*Y+K*Q,this._onChangeCallback()}else this._x=this._x*Y+$*Q,this._y=this._y*Y+Z*Q,this._z=this._z*Y+W*Q,this._w=this._w*Y+K*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}};P=class P{constructor(J=0,Q=0,$=0){P.prototype.isVector3=!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(TY.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(TY.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,K=1/(W[3]*Q+W[7]*$+W[11]*Z+W[15]);return this.x=(W[0]*Q+W[4]*$+W[8]*Z+W[12])*K,this.y=(W[1]*Q+W[5]*$+W[9]*Z+W[13])*K,this.z=(W[2]*Q+W[6]*$+W[10]*Z+W[14])*K,this}applyQuaternion(J){let Q=this.x,$=this.y,Z=this.z,W=J.x,K=J.y,H=J.z,Y=J.w,X=2*(K*Z-H*$),U=2*(H*Q-W*Z),G=2*(W*$-K*Q);return this.x=Q+Y*X+K*G-H*U,this.y=$+Y*U+H*X-W*G,this.z=Z+Y*G+W*U-K*X,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=p0(this.x,J.x,Q.x),this.y=p0(this.y,J.y,Q.y),this.z=p0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=p0(this.x,J,Q),this.y=p0(this.y,J,Q),this.z=p0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(p0($,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,K=Q.x,H=Q.y,Y=Q.z;return this.x=Z*Y-W*H,this.y=W*K-$*Y,this.z=$*H-Z*K,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 GW.copy(this).projectOnVector(J),this.sub(GW)}reflect(J){return this.sub(GW.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(p0($,-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}};GW=new P,TY=new SJ;EW=new c0,SY=new c0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),jY=new c0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);e0=A5();qW=new P;FJ=class FJ extends H9{constructor(J=FJ.DEFAULT_IMAGE,Q=FJ.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,K=1008,H=1023,Y=1009,X=FJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:w5++}),this.uuid=eJ(),this.name="",this.source=new I9(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=Z,this.magFilter=W,this.minFilter=K,this.anisotropy=X,this.format=H,this.internalFormat=null,this.type=Y,this.offset=new r(0,0),this.repeat=new r(1,1),this.center=new r(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new c0,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}get width(){return this.source.getSize(qW).x}get height(){return this.source.getSize(qW).y}get depth(){return this.source.getSize(qW).z}get image(){return this.source.data}set image(J=null){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.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){U0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){U0(`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,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++}};FJ.DEFAULT_IMAGE=null;FJ.DEFAULT_MAPPING=300;FJ.DEFAULT_ANISOTROPY=1;GJ=class GJ{constructor(J=0,Q=0,$=0,Z=1){GJ.prototype.isVector4=!0,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,K=J.elements;return this.x=K[0]*Q+K[4]*$+K[8]*Z+K[12]*W,this.y=K[1]*Q+K[5]*$+K[9]*Z+K[13]*W,this.z=K[2]*Q+K[6]*$+K[10]*Z+K[14]*W,this.w=K[3]*Q+K[7]*$+K[11]*Z+K[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,K=0.01,H=0.1,Y=J.elements,X=Y[0],U=Y[4],G=Y[8],N=Y[1],E=Y[5],q=Y[9],R=Y[2],O=Y[6],F=Y[10];if(Math.abs(U-N)<0.01&&Math.abs(G-R)<0.01&&Math.abs(q-O)<0.01){if(Math.abs(U+N)<0.1&&Math.abs(G+R)<0.1&&Math.abs(q+O)<0.1&&Math.abs(X+E+F-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let k=(X+1)/2,L=(E+1)/2,V=(F+1)/2,w=(U+N)/4,_=(G+R)/4,A=(q+O)/4;if(k>L&&k>V)if(k<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(k),Z=w/$,W=_/$;else if(L>V)if(L<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(L),$=w/Z,W=A/Z;else if(V<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(V),$=_/W,Z=A/W;return this.set($,Z,W,Q),this}let D=Math.sqrt((O-q)*(O-q)+(G-R)*(G-R)+(N-U)*(N-U));if(Math.abs(D)<0.001)D=1;return this.x=(O-q)/D,this.y=(G-R)/D,this.z=(N-U)/D,this.w=Math.acos((X+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=p0(this.x,J.x,Q.x),this.y=p0(this.y,J.y,Q.y),this.z=p0(this.z,J.z,Q.z),this.w=p0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=p0(this.x,J,Q),this.y=p0(this.y,J,Q),this.z=p0(this.z,J,Q),this.w=p0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(p0($,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}};z6=class z6 extends H9{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 GJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new GJ(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new FJ(Z),K=$.count;for(let H=0;H<K;H++)this.textures[H]=W.clone(),this.textures[H].isRenderTargetTexture=!0,this.textures[H].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 I9(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}dispose(){this.dispatchEvent({type:"dispose"})}};uJ=class uJ extends z6{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}};y7=class y7 extends FJ{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()}};eK=class eK extends uJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGLArrayRenderTarget=!0,this.depth=$,this.texture=new y7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}};v7=class v7 extends FJ{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}};JH=class JH extends uJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGL3DRenderTarget=!0,this.depth=$,this.texture=new v7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}};Q7=new P,U9=new m0,P5=new P(0,0,0),T5=new P(1,1,1),i9=new P,qQ=new P,rJ=new P,yY=new m0,vY=new SJ;sJ=class sJ{constructor(J=0,Q=0,$=0,Z=sJ.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],K=Z[4],H=Z[8],Y=Z[1],X=Z[5],U=Z[9],G=Z[2],N=Z[6],E=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(p0(H,-1,1)),Math.abs(H)<0.9999999)this._x=Math.atan2(-U,E),this._z=Math.atan2(-K,W);else this._x=Math.atan2(N,X),this._z=0;break;case"YXZ":if(this._x=Math.asin(-p0(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(H,E),this._z=Math.atan2(Y,X);else this._y=Math.atan2(-G,W),this._z=0;break;case"ZXY":if(this._x=Math.asin(p0(N,-1,1)),Math.abs(N)<0.9999999)this._y=Math.atan2(-G,E),this._z=Math.atan2(-K,X);else this._y=0,this._z=Math.atan2(Y,W);break;case"ZYX":if(this._y=Math.asin(-p0(G,-1,1)),Math.abs(G)<0.9999999)this._x=Math.atan2(N,E),this._z=Math.atan2(Y,W);else this._x=0,this._z=Math.atan2(-K,X);break;case"YZX":if(this._z=Math.asin(p0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(-U,X),this._y=Math.atan2(-G,W);else this._x=0,this._y=Math.atan2(H,E);break;case"XZY":if(this._z=Math.asin(-p0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(N,X),this._y=Math.atan2(H,W);else this._x=Math.atan2(-U,E),this._y=0;break;default:U0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return yY.makeRotationFromQuaternion(J),this.setFromRotationMatrix(yY,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return vY.setFromEuler(this),this.setFromQuaternion(vY,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}};sJ.DEFAULT_ORDER="XYZ";fY=new P,$7=new SJ,j9=new m0,DQ=new P,s7=new P,j5=new P,y5=new SJ,bY=new P(1,0,0),hY=new P(0,1,0),xY=new P(0,0,1),gY={type:"added"},v5={type:"removed"},Z7={type:"childadded",child:null},DW={type:"childremoved",child:null};$J=class $J extends H9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:S5++}),this.uuid=eJ(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=$J.DEFAULT_UP.clone();let J=new P,Q=new sJ,$=new SJ,Z=new P(1,1,1);function W(){$.setFromEuler(Q,!1)}function K(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(W),$._onChange(K),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 m0},normalMatrix:{value:new c0}}),this.matrix=new m0,this.matrixWorld=new m0,this.matrixAutoUpdate=$J.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=$J.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new f7,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 $7.setFromAxisAngle(J,Q),this.quaternion.multiply($7),this}rotateOnWorldAxis(J,Q){return $7.setFromAxisAngle(J,Q),this.quaternion.premultiply($7),this}rotateX(J){return this.rotateOnAxis(bY,J)}rotateY(J){return this.rotateOnAxis(hY,J)}rotateZ(J){return this.rotateOnAxis(xY,J)}translateOnAxis(J,Q){return fY.copy(J).applyQuaternion(this.quaternion),this.position.add(fY.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(bY,J)}translateY(J){return this.translateOnAxis(hY,J)}translateZ(J){return this.translateOnAxis(xY,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(j9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)DQ.copy(J);else DQ.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),s7.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)j9.lookAt(s7,DQ,this.up);else j9.lookAt(DQ,s7,this.up);if(this.quaternion.setFromRotationMatrix(j9),Z)j9.extractRotation(Z.matrixWorld),$7.setFromRotationMatrix(j9),this.quaternion.premultiply($7.invert())}add(J){if(arguments.length>1){for(let Q=0;Q<arguments.length;Q++)this.add(arguments[Q]);return this}if(J===this)return S0("Object3D.add: object can't be added as a child of itself.",J),this;if(J&&J.isObject3D)J.removeFromParent(),J.parent=this,this.children.push(J),J.dispatchEvent(gY),Z7.child=J,this.dispatchEvent(Z7),Z7.child=null;else S0("Object3D.add: object not an instance of THREE.Object3D.",J);return this}remove(J){if(arguments.length>1){for(let $=0;$<arguments.length;$++)this.remove(arguments[$]);return this}let Q=this.children.indexOf(J);if(Q!==-1)J.parent=null,this.children.splice(Q,1),J.dispatchEvent(v5),DW.child=J,this.dispatchEvent(DW),DW.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),j9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),j9.multiply(J.parent.matrixWorld);return J.applyMatrix4(j9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(gY),Z7.child=J,this.dispatchEvent(Z7),Z7.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 K=this.children[$].getObjectByProperty(J,Q);if(K!==void 0)return K}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let Z=this.children;for(let W=0,K=Z.length;W<K;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(s7,J,j5),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(s7,y5,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,K=Z.length;W<K;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((H)=>({...H,boundingBox:H.boundingBox?H.boundingBox.toJSON():void 0,boundingSphere:H.boundingSphere?H.boundingSphere.toJSON():void 0})),Z.instanceInfo=this._instanceInfo.map((H)=>({...H})),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(H,Y){if(H[Y.uuid]===void 0)H[Y.uuid]=Y.toJSON(J);return Y.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 H=this.geometry.parameters;if(H!==void 0&&H.shapes!==void 0){let Y=H.shapes;if(Array.isArray(Y))for(let X=0,U=Y.length;X<U;X++){let G=Y[X];W(J.shapes,G)}else W(J.shapes,Y)}}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 H=[];for(let Y=0,X=this.material.length;Y<X;Y++)H.push(W(J.materials,this.material[Y]));Z.material=H}else Z.material=W(J.materials,this.material);if(this.children.length>0){Z.children=[];for(let H=0;H<this.children.length;H++)Z.children.push(this.children[H].toJSON(J).object)}if(this.animations.length>0){Z.animations=[];for(let H=0;H<this.animations.length;H++){let Y=this.animations[H];Z.animations.push(W(J.animations,Y))}}if(Q){let H=K(J.geometries),Y=K(J.materials),X=K(J.textures),U=K(J.images),G=K(J.shapes),N=K(J.skeletons),E=K(J.animations),q=K(J.nodes);if(H.length>0)$.geometries=H;if(Y.length>0)$.materials=Y;if(X.length>0)$.textures=X;if(U.length>0)$.images=U;if(G.length>0)$.shapes=G;if(N.length>0)$.skeletons=N;if(E.length>0)$.animations=E;if(q.length>0)$.nodes=q}return $.object=Z,$;function K(H){let Y=[];for(let X in H){let U=H[X];delete U.metadata,Y.push(U)}return Y}}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),J.pivot!==null)this.pivot=J.pivot.clone();if(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}};$J.DEFAULT_UP=new P(0,1,0);$J.DEFAULT_MATRIX_AUTO_UPDATE=!0;$J.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;Q8=class Q8 extends $J{constructor(){super();this.isGroup=!0,this.type="Group"}};f5={type:"move"};JG={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},o9={h:0,s:0,l:0},FQ={h:0,s:0,l:0};M0=class M0{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,e0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=e0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,e0.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=e0.workingColorSpace){if(J=tK(J,1),Q=p0(Q,0,1),$=p0($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,K=2*$-W;this.r=FW(K,W,J+0.3333333333333333),this.g=FW(K,W,J),this.b=FW(K,W,J-0.3333333333333333)}return e0.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)U0("Color: Alpha component of "+J+" will be ignored.")}let Z;if(Z=/^(\w+)\(([^\)]*)\)/.exec(J)){let W,K=Z[1],H=Z[2];switch(K){case"rgb":case"rgba":if(W=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(H))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(H))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(H))return $(W[4]),this.setHSL(parseFloat(W[1])/360,parseFloat(W[2])/100,parseFloat(W[3])/100,Q);break;default:U0("Color: Unknown color model "+J)}}else if(Z=/^\#([A-Fa-f\d]+)$/.exec(J)){let W=Z[1],K=W.length;if(K===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(K===6)return this.setHex(parseInt(W,16),Q);else U0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=JG[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else U0("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=g9(J.r),this.g=g9(J.g),this.b=g9(J.b),this}copyLinearToSRGB(J){return this.r=V7(J.r),this.g=V7(J.g),this.b=V7(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return e0.workingToColorSpace(fJ.copy(this),J),Math.round(p0(fJ.r*255,0,255))*65536+Math.round(p0(fJ.g*255,0,255))*256+Math.round(p0(fJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=e0.workingColorSpace){e0.workingToColorSpace(fJ.copy(this),Q);let{r:$,g:Z,b:W}=fJ,K=Math.max($,Z,W),H=Math.min($,Z,W),Y,X,U=(H+K)/2;if(H===K)Y=0,X=0;else{let G=K-H;switch(X=U<=0.5?G/(K+H):G/(2-K-H),K){case $:Y=(Z-W)/G+(Z<W?6:0);break;case Z:Y=(W-$)/G+2;break;case W:Y=($-Z)/G+4;break}Y/=6}return J.h=Y,J.s=X,J.l=U,J}getRGB(J,Q=e0.workingColorSpace){return e0.workingToColorSpace(fJ.copy(this),Q),J.r=fJ.r,J.g=fJ.g,J.b=fJ.b,J}getStyle(J="srgb"){e0.workingToColorSpace(fJ.copy(this),J);let{r:Q,g:$,b:Z}=fJ;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(o9),this.setHSL(o9.h+J,o9.s+Q,o9.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(o9),J.getHSL(FQ);let $=H6(o9.h,FQ.h,Q),Z=H6(o9.s,FQ.s,Q),W=H6(o9.l,FQ.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}};fJ=new M0;M0.NAMES=JG;HZ=class HZ extends $J{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 sJ,this.environmentIntensity=1,this.environmentRotation=new sJ,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}};G9=new P,y9=new P,RW=new P,v9=new P,W7=new P,K7=new P,pY=new P,OW=new P,kW=new P,MW=new P,LW=new GJ,VW=new GJ,BW=new GJ;f9=[new P,new P,new P,new P,new P,new P,new P,new P],E9=new P,RQ=new wJ,H7=new P,Y7=new P,X7=new P,a9=new P,r9=new P,k8=new P,i7=new P,OQ=new P,kQ=new P,M8=new P;x9=b5();VJ=new P,MQ=new r;$H=class $H extends KJ{constructor(J,Q,$){super(new Int8Array(J),Q,$)}};ZH=class ZH extends KJ{constructor(J,Q,$){super(new Uint8Array(J),Q,$)}};WH=class WH extends KJ{constructor(J,Q,$){super(new Uint8ClampedArray(J),Q,$)}};KH=class KH extends KJ{constructor(J,Q,$){super(new Int16Array(J),Q,$)}};A6=class A6 extends KJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}};HH=class HH extends KJ{constructor(J,Q,$){super(new Int32Array(J),Q,$)}};C6=class C6 extends KJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}};YH=class YH extends KJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$);this.isFloat16BufferAttribute=!0}getX(J){let Q=W6(this.array[J*this.itemSize]);if(this.normalized)Q=pJ(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize]=nJ(Q),this}getY(J){let Q=W6(this.array[J*this.itemSize+1]);if(this.normalized)Q=pJ(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+1]=nJ(Q),this}getZ(J){let Q=W6(this.array[J*this.itemSize+2]);if(this.normalized)Q=pJ(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+2]=nJ(Q),this}getW(J){let Q=W6(this.array[J*this.itemSize+3]);if(this.normalized)Q=pJ(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+3]=nJ(Q),this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array);return this.array[J+0]=nJ(Q),this.array[J+1]=nJ($),this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array);return this.array[J+0]=nJ(Q),this.array[J+1]=nJ($),this.array[J+2]=nJ(Z),this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array),W=o0(W,this.array);return this.array[J+0]=nJ(Q),this.array[J+1]=nJ($),this.array[J+2]=nJ(Z),this.array[J+3]=nJ(W),this}};V0=class V0 extends KJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}};x5=new wJ,o7=new P,IW=new P;$9=new m0,_W=new $J,U7=new P,tJ=new wJ,a7=new wJ,CJ=new P;l0=class l0 extends H9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:g5++}),this.uuid=eJ(),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((X5(J))?C6:A6)(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 c0().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 _W.lookAt(J),_W.updateMatrix(),this.applyMatrix4(_W.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(U7).negate(),this.translate(U7.x,U7.y,U7.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 K=J[Z];$.push(K.x,K.y,K.z||0)}this.setAttribute("position",new V0($,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)U0("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 wJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){S0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new P(-1/0,-1/0,-1/0),new P(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(tJ.setFromBufferAttribute(W),this.morphTargetsRelative)CJ.addVectors(this.boundingBox.min,tJ.min),this.boundingBox.expandByPoint(CJ),CJ.addVectors(this.boundingBox.max,tJ.max),this.boundingBox.expandByPoint(CJ);else this.boundingBox.expandByPoint(tJ.min),this.boundingBox.expandByPoint(tJ.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))S0('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new zJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){S0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new P,1/0);return}if(J){let $=this.boundingSphere.center;if(tJ.setFromBufferAttribute(J),Q)for(let W=0,K=Q.length;W<K;W++){let H=Q[W];if(a7.setFromBufferAttribute(H),this.morphTargetsRelative)CJ.addVectors(tJ.min,a7.min),tJ.expandByPoint(CJ),CJ.addVectors(tJ.max,a7.max),tJ.expandByPoint(CJ);else tJ.expandByPoint(a7.min),tJ.expandByPoint(a7.max)}tJ.getCenter($);let Z=0;for(let W=0,K=J.count;W<K;W++)CJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(CJ));if(Q)for(let W=0,K=Q.length;W<K;W++){let H=Q[W],Y=this.morphTargetsRelative;for(let X=0,U=H.count;X<U;X++){if(CJ.fromBufferAttribute(H,X),Y)U7.fromBufferAttribute(J,X),CJ.add(U7);Z=Math.max(Z,$.distanceToSquared(CJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))S0('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let J=this.index,Q=this.attributes;if(J===null||Q.position===void 0||Q.normal===void 0||Q.uv===void 0){S0("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:$,normal:Z,uv:W}=Q;if(this.hasAttribute("tangent")===!1)this.setAttribute("tangent",new KJ(new Float32Array(4*$.count),4));let K=this.getAttribute("tangent"),H=[],Y=[];for(let A=0;A<$.count;A++)H[A]=new P,Y[A]=new P;let X=new P,U=new P,G=new P,N=new r,E=new r,q=new r,R=new P,O=new P;function F(A,M,C){X.fromBufferAttribute($,A),U.fromBufferAttribute($,M),G.fromBufferAttribute($,C),N.fromBufferAttribute(W,A),E.fromBufferAttribute(W,M),q.fromBufferAttribute(W,C),U.sub(X),G.sub(X),E.sub(N),q.sub(N);let h=1/(E.x*q.y-q.x*E.y);if(!isFinite(h))return;R.copy(U).multiplyScalar(q.y).addScaledVector(G,-E.y).multiplyScalar(h),O.copy(G).multiplyScalar(E.x).addScaledVector(U,-q.x).multiplyScalar(h),H[A].add(R),H[M].add(R),H[C].add(R),Y[A].add(O),Y[M].add(O),Y[C].add(O)}let D=this.groups;if(D.length===0)D=[{start:0,count:J.count}];for(let A=0,M=D.length;A<M;++A){let C=D[A],h=C.start,S=C.count;for(let b=h,l=h+S;b<l;b+=3)F(J.getX(b+0),J.getX(b+1),J.getX(b+2))}let k=new P,L=new P,V=new P,w=new P;function _(A){V.fromBufferAttribute(Z,A),w.copy(V);let M=H[A];k.copy(M),k.sub(V.multiplyScalar(V.dot(M))).normalize(),L.crossVectors(w,M);let h=L.dot(Y[A])<0?-1:1;K.setXYZW(A,k.x,k.y,k.z,h)}for(let A=0,M=D.length;A<M;++A){let C=D[A],h=C.start,S=C.count;for(let b=h,l=h+S;b<l;b+=3)_(J.getX(b+0)),_(J.getX(b+1)),_(J.getX(b+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new KJ(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let N=0,E=$.count;N<E;N++)$.setXYZ(N,0,0,0);let Z=new P,W=new P,K=new P,H=new P,Y=new P,X=new P,U=new P,G=new P;if(J)for(let N=0,E=J.count;N<E;N+=3){let q=J.getX(N+0),R=J.getX(N+1),O=J.getX(N+2);Z.fromBufferAttribute(Q,q),W.fromBufferAttribute(Q,R),K.fromBufferAttribute(Q,O),U.subVectors(K,W),G.subVectors(Z,W),U.cross(G),H.fromBufferAttribute($,q),Y.fromBufferAttribute($,R),X.fromBufferAttribute($,O),H.add(U),Y.add(U),X.add(U),$.setXYZ(q,H.x,H.y,H.z),$.setXYZ(R,Y.x,Y.y,Y.z),$.setXYZ(O,X.x,X.y,X.z)}else for(let N=0,E=Q.count;N<E;N+=3)Z.fromBufferAttribute(Q,N+0),W.fromBufferAttribute(Q,N+1),K.fromBufferAttribute(Q,N+2),U.subVectors(K,W),G.subVectors(Z,W),U.cross(G),$.setXYZ(N+0,U.x,U.y,U.z),$.setXYZ(N+1,U.x,U.y,U.z),$.setXYZ(N+2,U.x,U.y,U.z);this.normalizeNormals(),$.needsUpdate=!0}}normalizeNormals(){let J=this.attributes.normal;for(let Q=0,$=J.count;Q<$;Q++)CJ.fromBufferAttribute(J,Q),CJ.normalize(),J.setXYZ(Q,CJ.x,CJ.y,CJ.z)}toNonIndexed(){function J(H,Y){let{array:X,itemSize:U,normalized:G}=H,N=new X.constructor(Y.length*U),E=0,q=0;for(let R=0,O=Y.length;R<O;R++){if(H.isInterleavedBufferAttribute)E=Y[R]*H.data.stride+H.offset;else E=Y[R]*U;for(let F=0;F<U;F++)N[q++]=X[E++]}return new KJ(N,U,G)}if(this.index===null)return U0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new l0,$=this.index.array,Z=this.attributes;for(let H in Z){let Y=Z[H],X=J(Y,$);Q.setAttribute(H,X)}let W=this.morphAttributes;for(let H in W){let Y=[],X=W[H];for(let U=0,G=X.length;U<G;U++){let N=X[U],E=J(N,$);Y.push(E)}Q.morphAttributes[H]=Y}Q.morphTargetsRelative=this.morphTargetsRelative;let K=this.groups;for(let H=0,Y=K.length;H<Y;H++){let X=K[H];Q.addGroup(X.start,X.count,X.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 Y=this.parameters;for(let X in Y)if(Y[X]!==void 0)J[X]=Y[X];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 Y in $){let X=$[Y];J.data.attributes[Y]=X.toJSON(J.data)}let Z={},W=!1;for(let Y in this.morphAttributes){let X=this.morphAttributes[Y],U=[];for(let G=0,N=X.length;G<N;G++){let E=X[G];U.push(E.toJSON(J.data))}if(U.length>0)Z[Y]=U,W=!0}if(W)J.data.morphAttributes=Z,J.data.morphTargetsRelative=this.morphTargetsRelative;let K=this.groups;if(K.length>0)J.data.groups=JSON.parse(JSON.stringify(K));let H=this.boundingSphere;if(H!==null)J.data.boundingSphere=H.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 X in Z){let U=Z[X];this.setAttribute(X,U.clone(Q))}let W=J.morphAttributes;for(let X in W){let U=[],G=W[X];for(let N=0,E=G.length;N<E;N++)U.push(G[N].clone(Q));this.morphAttributes[X]=U}this.morphTargetsRelative=J.morphTargetsRelative;let K=J.groups;for(let X=0,U=K.length;X<U;X++){let G=K[X];this.addGroup(G.start,G.count,G.materialIndex)}let H=J.boundingBox;if(H!==null)this.boundingBox=H.clone();let Y=J.boundingSphere;if(Y!==null)this.boundingSphere=Y.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};gJ=new P;PJ=class PJ extends H9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:p5++}),this.uuid=eJ(),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 M0(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){U0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){U0(`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 K=[];for(let H in W){let Y=W[H];delete Y.metadata,K.push(Y)}return K}if(Q){let W=Z(J.textures),K=Z(J.images);if(W.length>0)$.textures=W;if(K.length>0)$.images=K}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++}};w6=class w6 extends PJ{constructor(J){super();this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new M0(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.rotation=J.rotation,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}};r7=new P,E7=new P,N7=new P,q7=new r,t7=new r,QG=new m0,LQ=new P,e7=new P,VQ=new P,mY=new r,AW=new r,dY=new r;YZ=class YZ extends $J{constructor(J=new w6){super();if(this.isSprite=!0,this.type="Sprite",G7===void 0){G7=new l0;let Q=new Float32Array([-0.5,-0.5,0,0,0,0.5,-0.5,0,1,0,0.5,0.5,0,1,1,-0.5,0.5,0,0,1]),$=new h7(Q,5);G7.setIndex([0,1,2,0,2,3]),G7.setAttribute("position",new Z8($,3,0,!1)),G7.setAttribute("uv",new Z8($,2,3,!1))}this.geometry=G7,this.material=J,this.center=new r(0.5,0.5),this.count=1}raycast(J,Q){if(J.camera===null)S0('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');if(E7.setFromMatrixScale(this.matrixWorld),QG.copy(J.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(J.camera.matrixWorldInverse,this.matrixWorld),N7.setFromMatrixPosition(this.modelViewMatrix),J.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1)E7.multiplyScalar(-N7.z);let $=this.material.rotation,Z,W;if($!==0)W=Math.cos($),Z=Math.sin($);let K=this.center;BQ(LQ.set(-0.5,-0.5,0),N7,K,E7,Z,W),BQ(e7.set(0.5,-0.5,0),N7,K,E7,Z,W),BQ(VQ.set(0.5,0.5,0),N7,K,E7,Z,W),mY.set(0,0),AW.set(1,0),dY.set(1,1);let H=J.ray.intersectTriangle(LQ,e7,VQ,!1,r7);if(H===null){if(BQ(e7.set(-0.5,0.5,0),N7,K,E7,Z,W),AW.set(0,1),H=J.ray.intersectTriangle(LQ,VQ,e7,!1,r7),H===null)return}let Y=J.ray.origin.distanceTo(r7);if(Y<J.near||Y>J.far)return;Q.push({distance:Y,point:r7.clone(),uv:mJ.getInterpolation(r7,LQ,e7,VQ,mY,AW,dY,new r),face:null,object:this})}copy(J,Q){if(super.copy(J,Q),J.center!==void 0)this.center.copy(J.center);return this.material=J.material,this}};zQ=new P,lY=new P;XZ=class XZ extends $J{constructor(){super();this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(J){super.copy(J,!1);let Q=J.levels;for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];this.addLevel(W.object.clone(),W.distance,W.hysteresis)}return this.autoUpdate=J.autoUpdate,this}addLevel(J,Q=0,$=0){Q=Math.abs(Q);let Z=this.levels,W;for(W=0;W<Z.length;W++)if(Q<Z[W].distance)break;return Z.splice(W,0,{distance:Q,hysteresis:$,object:J}),this.add(J),this}removeLevel(J){let Q=this.levels;for(let $=0;$<Q.length;$++)if(Q[$].distance===J){let Z=Q.splice($,1);return this.remove(Z[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(J){let Q=this.levels;if(Q.length>0){let $,Z;for($=1,Z=Q.length;$<Z;$++){let W=Q[$].distance;if(Q[$].object.visible)W-=W*Q[$].hysteresis;if(J<W)break}return Q[$-1].object}return null}raycast(J,Q){if(this.levels.length>0){zQ.setFromMatrixPosition(this.matrixWorld);let Z=J.ray.origin.distanceTo(zQ);this.getObjectForDistance(Z).raycast(J,Q)}}update(J){let Q=this.levels;if(Q.length>1){zQ.setFromMatrixPosition(J.matrixWorld),lY.setFromMatrixPosition(this.matrixWorld);let $=zQ.distanceTo(lY)/J.zoom;Q[0].object.visible=!0;let Z,W;for(Z=1,W=Q.length;Z<W;Z++){let K=Q[Z].distance;if(Q[Z].object.visible)K-=K*Q[Z].hysteresis;if($>=K)Q[Z-1].object.visible=!1,Q[Z].object.visible=!0;else break}this._currentLevel=Z-1;for(;Z<W;Z++)Q[Z].object.visible=!1}}toJSON(J){let Q=super.toJSON(J);if(this.autoUpdate===!1)Q.object.autoUpdate=!1;Q.object.levels=[];let $=this.levels;for(let Z=0,W=$.length;Z<W;Z++){let K=$[Z];Q.object.levels.push({object:K.object.uuid,distance:K.distance,hysteresis:K.hysteresis})}return Q}};b9=new P,CW=new P,IQ=new P,t9=new P,wW=new P,_Q=new P,PW=new P;w9=class w9 extends PJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new M0(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 sJ,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}};uY=new m0,L8=new G8,AQ=new zJ,cY=new P,CQ=new P,wQ=new P,PQ=new P,TW=new P,TQ=new P,nY=new P,SQ=new P;kJ=class kJ extends $J{constructor(J=new l0,Q=new w9){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,K=Z.length;W<K;W++){let H=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[H]=W}}}}getVertexPosition(J,Q){let $=this.geometry,Z=$.attributes.position,W=$.morphAttributes.position,K=$.morphTargetsRelative;Q.fromBufferAttribute(Z,J);let H=this.morphTargetInfluences;if(W&&H){TQ.set(0,0,0);for(let Y=0,X=W.length;Y<X;Y++){let U=H[Y],G=W[Y];if(U===0)continue;if(TW.fromBufferAttribute(G,J),K)TQ.addScaledVector(TW,U);else TQ.addScaledVector(TW.sub(Q),U)}Q.add(TQ)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(AQ.copy($.boundingSphere),AQ.applyMatrix4(W),L8.copy(J.ray).recast(J.near),AQ.containsPoint(L8.origin)===!1){if(L8.intersectSphere(AQ,cY)===null)return;if(L8.origin.distanceToSquared(cY)>(J.far-J.near)**2)return}if(uY.copy(W).invert(),L8.copy(J.ray).applyMatrix4(uY),$.boundingBox!==null){if(L8.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,L8)}_computeIntersections(J,Q,$){let Z,W=this.geometry,K=this.material,H=W.index,Y=W.attributes.position,X=W.attributes.uv,U=W.attributes.uv1,G=W.attributes.normal,N=W.groups,E=W.drawRange;if(H!==null)if(Array.isArray(K))for(let q=0,R=N.length;q<R;q++){let O=N[q],F=K[O.materialIndex],D=Math.max(O.start,E.start),k=Math.min(H.count,Math.min(O.start+O.count,E.start+E.count));for(let L=D,V=k;L<V;L+=3){let w=H.getX(L),_=H.getX(L+1),A=H.getX(L+2);if(Z=jQ(this,F,J,$,X,U,G,w,_,A),Z)Z.faceIndex=Math.floor(L/3),Z.face.materialIndex=O.materialIndex,Q.push(Z)}}else{let q=Math.max(0,E.start),R=Math.min(H.count,E.start+E.count);for(let O=q,F=R;O<F;O+=3){let D=H.getX(O),k=H.getX(O+1),L=H.getX(O+2);if(Z=jQ(this,K,J,$,X,U,G,D,k,L),Z)Z.faceIndex=Math.floor(O/3),Q.push(Z)}}else if(Y!==void 0)if(Array.isArray(K))for(let q=0,R=N.length;q<R;q++){let O=N[q],F=K[O.materialIndex],D=Math.max(O.start,E.start),k=Math.min(Y.count,Math.min(O.start+O.count,E.start+E.count));for(let L=D,V=k;L<V;L+=3){let w=L,_=L+1,A=L+2;if(Z=jQ(this,F,J,$,X,U,G,w,_,A),Z)Z.faceIndex=Math.floor(L/3),Z.face.materialIndex=O.materialIndex,Q.push(Z)}}else{let q=Math.max(0,E.start),R=Math.min(Y.count,E.start+E.count);for(let O=q,F=R;O<F;O+=3){let D=O,k=O+1,L=O+2;if(Z=jQ(this,K,J,$,X,U,G,D,k,L),Z)Z.faceIndex=Math.floor(O/3),Q.push(Z)}}}};sY=new P,iY=new GJ,oY=new GJ,d5=new P,aY=new m0,yQ=new P,SW=new zJ,rY=new m0,jW=new G8;UZ=class UZ extends kJ{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new m0,this.bindMatrixInverse=new m0,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let J=this.geometry;if(this.boundingBox===null)this.boundingBox=new wJ;this.boundingBox.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,yQ),this.boundingBox.expandByPoint(yQ)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new zJ;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,yQ),this.boundingSphere.expandByPoint(yQ)}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(SW.copy(this.boundingSphere),SW.applyMatrix4(Z),J.ray.intersectsSphere(SW)===!1)return;if(rY.copy(Z).invert(),jW.copy(J.ray).applyMatrix4(rY),this.boundingBox!==null){if(jW.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,jW)}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 GJ,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 U0("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(J,Q){let $=this.skeleton,Z=this.geometry;iY.fromBufferAttribute(Z.attributes.skinIndex,J),oY.fromBufferAttribute(Z.attributes.skinWeight,J),sY.copy(Q).applyMatrix4(this.bindMatrix),Q.set(0,0,0);for(let W=0;W<4;W++){let K=oY.getComponent(W);if(K!==0){let H=iY.getComponent(W);aY.multiplyMatrices($.bones[H].matrixWorld,$.boneInverses[H]),Q.addScaledVector(d5.copy(sY).applyMatrix4(aY),K)}}return Q.applyMatrix4(this.bindMatrixInverse)}};P6=class P6 extends $J{constructor(){super();this.isBone=!0,this.type="Bone"}};J9=class J9 extends FJ{constructor(J=null,Q=1,$=1,Z,W,K,H,Y,X=1003,U=1003,G,N){super(null,K,H,Y,X,U,Z,W,G,N);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};tY=new m0,l5=new m0;W8=class W8 extends KJ{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}};D7=new m0,eY=new m0,vQ=[],JX=new wJ,u5=new m0,J6=new kJ,Q6=new zJ;GZ=class GZ extends kJ{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new W8(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,u5)}computeBoundingBox(){let J=this.geometry,Q=this.count;if(this.boundingBox===null)this.boundingBox=new wJ;if(J.boundingBox===null)J.computeBoundingBox();this.boundingBox.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,D7),JX.copy(J.boundingBox).applyMatrix4(D7),this.boundingBox.union(JX)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new zJ;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,D7),Q6.copy(J.boundingSphere).applyMatrix4(D7),this.boundingSphere.union(Q6)}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){Q.fromArray(this.instanceColor.array,J*3)}getMatrixAt(J,Q){Q.fromArray(this.instanceMatrix.array,J*16)}getMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=this.morphTexture.source.data.data,W=$.length+1,K=J*W+1;for(let H=0;H<$.length;H++)$[H]=Z[K+H]}raycast(J,Q){let $=this.matrixWorld,Z=this.count;if(J6.geometry=this.geometry,J6.material=this.material,J6.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Q6.copy(this.boundingSphere),Q6.applyMatrix4($),J.ray.intersectsSphere(Q6)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,D7),eY.multiplyMatrices($,D7),J6.matrixWorld=eY,J6.raycast(J,vQ);for(let K=0,H=vQ.length;K<H;K++){let Y=vQ[K];Y.instanceId=W,Y.object=this,Q.push(Y)}vQ.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new W8(new Float32Array(this.instanceMatrix.count*3).fill(1),3);Q.toArray(this.instanceColor.array,J*3)}setMatrixAt(J,Q){Q.toArray(this.instanceMatrix.array,J*16)}setMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=$.length+1;if(this.morphTexture===null)this.morphTexture=new J9(new Float32Array(Z*this.count),Z,this.count,1028,1015);let W=this.morphTexture.source.data.data,K=0;for(let X=0;X<$.length;X++)K+=$[X];let H=this.geometry.morphTargetsRelative?1:1-K,Y=Z*J;W[Y]=H,W.set($,Y+1)}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}};yW=new P,c5=new P,n5=new c0;V8=new zJ,s5=new r(0.5,0.5),fQ=new P;L9=new m0,V9=new E8;cJ=new m0,a5=new M0(1,1,1),QX=new E8,r5=new S6,bQ=new wJ,B8=new zJ,$6=new P,$X=new P,t5=new P,fW=new $G,bJ=new kJ,hQ=[];EZ=class EZ extends kJ{constructor(J,Q,$=Q*2,Z){super(new l0,Z);this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=J,this._maxVertexCount=Q,this._maxIndexCount=$,this._multiDrawCounts=new Int32Array(J),this._multiDrawStarts=new Int32Array(J),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let J=Math.sqrt(this._maxInstanceCount*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4),$=new J9(Q,J,J,1023,1015);this._matricesTexture=$}_initIndirectTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Uint32Array(J*J),$=new J9(Q,J,J,1029,1014);this._indirectTexture=$}_initColorsTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Float32Array(J*J*4).fill(1),$=new J9(Q,J,J,1023,1015);$.colorSpace=e0.workingColorSpace,this._colorsTexture=$}_initializeGeometry(J){let Q=this.geometry,$=this._maxVertexCount,Z=this._maxIndexCount;if(this._geometryInitialized===!1){for(let W in J.attributes){let K=J.getAttribute(W),{array:H,itemSize:Y,normalized:X}=K,U=new H.constructor($*Y),G=new KJ(U,Y,X);Q.setAttribute(W,G)}if(J.getIndex()!==null){let W=$>65535?new Uint32Array(Z):new Uint16Array(Z);Q.setIndex(new KJ(W,1))}this._geometryInitialized=!0}}_validateGeometry(J){let Q=this.geometry;if(Boolean(J.getIndex())!==Boolean(Q.getIndex()))throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let $ in Q.attributes){if(!J.hasAttribute($))throw Error(`THREE.BatchedMesh: Added geometry missing "${$}". All geometries must have consistent attributes.`);let Z=J.getAttribute($),W=Q.getAttribute($);if(Z.itemSize!==W.itemSize||Z.normalized!==W.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(J){let Q=this._instanceInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${J}. Instance is either out of range or has been deleted.`)}validateGeometryId(J){let Q=this._geometryInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${J}. Geometry is either out of range or has been deleted.`)}setCustomSort(J){return this.customSort=J,this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new wJ;let J=this.boundingBox,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,cJ),this.getBoundingBoxAt(W,bQ).applyMatrix4(cJ),J.union(bQ)}}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new zJ;let J=this.boundingSphere,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,cJ),this.getBoundingSphereAt(W,B8).applyMatrix4(cJ),J.union(B8)}}addInstance(J){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error("THREE.BatchedMesh: Maximum item count reached.");let $={visible:!0,active:!0,geometryIndex:J},Z=null;if(this._availableInstanceIds.length>0)this._availableInstanceIds.sort(vW),Z=this._availableInstanceIds.shift(),this._instanceInfo[Z]=$;else Z=this._instanceInfo.length,this._instanceInfo.push($);let W=this._matricesTexture;cJ.identity().toArray(W.image.data,Z*16),W.needsUpdate=!0;let K=this._colorsTexture;if(K)a5.toArray(K.image.data,Z*4),K.needsUpdate=!0;return this._visibilityChanged=!0,Z}addGeometry(J,Q=-1,$=-1){this._initializeGeometry(J),this._validateGeometry(J);let Z={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},W=this._geometryInfo;Z.vertexStart=this._nextVertexStart,Z.reservedVertexCount=Q===-1?J.getAttribute("position").count:Q;let K=J.getIndex();if(K!==null)Z.indexStart=this._nextIndexStart,Z.reservedIndexCount=$===-1?K.count:$;if(Z.indexStart!==-1&&Z.indexStart+Z.reservedIndexCount>this._maxIndexCount||Z.vertexStart+Z.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let Y;if(this._availableGeometryIds.length>0)this._availableGeometryIds.sort(vW),Y=this._availableGeometryIds.shift(),W[Y]=Z;else Y=this._geometryCount,this._geometryCount++,W.push(Z);return this.setGeometryAt(Y,J),this._nextIndexStart=Z.indexStart+Z.reservedIndexCount,this._nextVertexStart=Z.vertexStart+Z.reservedVertexCount,Y}setGeometryAt(J,Q){if(J>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Q);let $=this.geometry,Z=$.getIndex()!==null,W=$.getIndex(),K=Q.getIndex(),H=this._geometryInfo[J];if(Z&&K.count>H.reservedIndexCount||Q.attributes.position.count>H.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let{vertexStart:Y,reservedVertexCount:X}=H;H.vertexCount=Q.getAttribute("position").count;for(let U in $.attributes){let G=Q.getAttribute(U),N=$.getAttribute(U);e5(G,N,Y);let E=G.itemSize;for(let q=G.count,R=X;q<R;q++){let O=Y+q;for(let F=0;F<E;F++)N.setComponent(O,F,0)}N.needsUpdate=!0,N.addUpdateRange(Y*E,X*E)}if(Z){let{indexStart:U,reservedIndexCount:G}=H;H.indexCount=Q.getIndex().count;for(let N=0;N<K.count;N++)W.setX(U+N,Y+K.getX(N));for(let N=K.count,E=G;N<E;N++)W.setX(U+N,Y);W.needsUpdate=!0,W.addUpdateRange(U,H.reservedIndexCount)}if(H.start=Z?H.indexStart:H.vertexStart,H.count=Z?H.indexCount:H.vertexCount,H.boundingBox=null,Q.boundingBox!==null)H.boundingBox=Q.boundingBox.clone();if(H.boundingSphere=null,Q.boundingSphere!==null)H.boundingSphere=Q.boundingSphere.clone();return this._visibilityChanged=!0,J}deleteGeometry(J){let Q=this._geometryInfo;if(J>=Q.length||Q[J].active===!1)return this;let $=this._instanceInfo;for(let Z=0,W=$.length;Z<W;Z++)if($[Z].active&&$[Z].geometryIndex===J)this.deleteInstance(Z);return Q[J].active=!1,this._availableGeometryIds.push(J),this._visibilityChanged=!0,this}deleteInstance(J){return this.validateInstanceId(J),this._instanceInfo[J].active=!1,this._availableInstanceIds.push(J),this._visibilityChanged=!0,this}optimize(){let J=0,Q=0,$=this._geometryInfo,Z=$.map((K,H)=>H).sort((K,H)=>{return $[K].vertexStart-$[H].vertexStart}),W=this.geometry;for(let K=0,H=$.length;K<H;K++){let Y=Z[K],X=$[Y];if(X.active===!1)continue;if(W.index!==null){if(X.indexStart!==Q){let{indexStart:U,vertexStart:G,reservedIndexCount:N}=X,E=W.index,q=E.array,R=J-G;for(let O=U;O<U+N;O++)q[O]=q[O]+R;E.array.copyWithin(Q,U,U+N),E.addUpdateRange(Q,N),E.needsUpdate=!0,X.indexStart=Q}Q+=X.reservedIndexCount}if(X.vertexStart!==J){let{vertexStart:U,reservedVertexCount:G}=X,N=W.attributes;for(let E in N){let q=N[E],{array:R,itemSize:O}=q;R.copyWithin(J*O,U*O,(U+G)*O),q.addUpdateRange(J*O,G*O),q.needsUpdate=!0}X.vertexStart=J}J+=X.reservedVertexCount,X.start=W.index?X.indexStart:X.vertexStart}return this._nextIndexStart=Q,this._nextVertexStart=J,this._visibilityChanged=!0,this}getBoundingBoxAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingBox===null){let W=new wJ,K=$.index,H=$.attributes.position;for(let Y=Z.start,X=Z.start+Z.count;Y<X;Y++){let U=Y;if(K)U=K.getX(U);W.expandByPoint($6.fromBufferAttribute(H,U))}Z.boundingBox=W}return Q.copy(Z.boundingBox),Q}getBoundingSphereAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingSphere===null){let W=new zJ;this.getBoundingBoxAt(J,bQ),bQ.getCenter(W.center);let K=$.index,H=$.attributes.position,Y=0;for(let X=Z.start,U=Z.start+Z.count;X<U;X++){let G=X;if(K)G=K.getX(G);$6.fromBufferAttribute(H,G),Y=Math.max(Y,W.center.distanceToSquared($6))}W.radius=Math.sqrt(Y),Z.boundingSphere=W}return Q.copy(Z.boundingSphere),Q}setMatrixAt(J,Q){this.validateInstanceId(J);let $=this._matricesTexture,Z=this._matricesTexture.image.data;return Q.toArray(Z,J*16),$.needsUpdate=!0,this}getMatrixAt(J,Q){return this.validateInstanceId(J),Q.fromArray(this._matricesTexture.image.data,J*16)}setColorAt(J,Q){if(this.validateInstanceId(J),this._colorsTexture===null)this._initColorsTexture();return Q.toArray(this._colorsTexture.image.data,J*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(J,Q){return this.validateInstanceId(J),Q.fromArray(this._colorsTexture.image.data,J*4)}setVisibleAt(J,Q){if(this.validateInstanceId(J),this._instanceInfo[J].visible===Q)return this;return this._instanceInfo[J].visible=Q,this._visibilityChanged=!0,this}getVisibleAt(J){return this.validateInstanceId(J),this._instanceInfo[J].visible}setGeometryIdAt(J,Q){return this.validateInstanceId(J),this.validateGeometryId(Q),this._instanceInfo[J].geometryIndex=Q,this}getGeometryIdAt(J){return this.validateInstanceId(J),this._instanceInfo[J].geometryIndex}getGeometryRangeAt(J,Q={}){this.validateGeometryId(J);let $=this._geometryInfo[J];return Q.vertexStart=$.vertexStart,Q.vertexCount=$.vertexCount,Q.reservedVertexCount=$.reservedVertexCount,Q.indexStart=$.indexStart,Q.indexCount=$.indexCount,Q.reservedIndexCount=$.reservedIndexCount,Q.start=$.start,Q.count=$.count,Q}setInstanceCount(J){let Q=this._availableInstanceIds,$=this._instanceInfo;Q.sort(vW);while(Q[Q.length-1]===$.length-1)$.pop(),Q.pop();if(J<$.length)throw Error(`BatchedMesh: Instance ids outside the range ${J} are being used. Cannot shrink instance count.`);let Z=new Int32Array(J),W=new Int32Array(J);z8(this._multiDrawCounts,Z),z8(this._multiDrawStarts,W),this._multiDrawCounts=Z,this._multiDrawStarts=W,this._maxInstanceCount=J;let K=this._indirectTexture,H=this._matricesTexture,Y=this._colorsTexture;if(K.dispose(),this._initIndirectTexture(),z8(K.image.data,this._indirectTexture.image.data),H.dispose(),this._initMatricesTexture(),z8(H.image.data,this._matricesTexture.image.data),Y)Y.dispose(),this._initColorsTexture(),z8(Y.image.data,this._colorsTexture.image.data)}setGeometrySize(J,Q){let $=[...this._geometryInfo].filter((H)=>H.active);if(Math.max(...$.map((H)=>H.vertexStart+H.reservedVertexCount))>J)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${Q}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...$.map((Y)=>Y.indexStart+Y.reservedIndexCount))>Q)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${Q}. Cannot shrink further.`)}let W=this.geometry;if(W.dispose(),this._maxVertexCount=J,this._maxIndexCount=Q,this._geometryInitialized)this._geometryInitialized=!1,this.geometry=new l0,this._initializeGeometry(W);let K=this.geometry;if(W.index)z8(W.index.array,K.index.array);for(let H in W.attributes)z8(W.attributes[H].array,K.attributes[H].array)}raycast(J,Q){let $=this._instanceInfo,Z=this._geometryInfo,W=this.matrixWorld,K=this.geometry;if(bJ.material=this.material,bJ.geometry.index=K.index,bJ.geometry.attributes=K.attributes,bJ.geometry.boundingBox===null)bJ.geometry.boundingBox=new wJ;if(bJ.geometry.boundingSphere===null)bJ.geometry.boundingSphere=new zJ;for(let H=0,Y=$.length;H<Y;H++){if(!$[H].visible||!$[H].active)continue;let X=$[H].geometryIndex,U=Z[X];bJ.geometry.setDrawRange(U.start,U.count),this.getMatrixAt(H,bJ.matrixWorld).premultiply(W),this.getBoundingBoxAt(X,bJ.geometry.boundingBox),this.getBoundingSphereAt(X,bJ.geometry.boundingSphere),bJ.raycast(J,hQ);for(let G=0,N=hQ.length;G<N;G++){let E=hQ[G];E.object=this,E.batchId=H,Q.push(E)}hQ.length=0}bJ.material=null,bJ.geometry.index=null,bJ.geometry.attributes={},bJ.geometry.setDrawRange(0,1/0)}copy(J){if(super.copy(J),this.geometry=J.geometry.clone(),this.perObjectFrustumCulled=J.perObjectFrustumCulled,this.sortObjects=J.sortObjects,this.boundingBox=J.boundingBox!==null?J.boundingBox.clone():null,this.boundingSphere=J.boundingSphere!==null?J.boundingSphere.clone():null,this._geometryInfo=J._geometryInfo.map((Q)=>({...Q,boundingBox:Q.boundingBox!==null?Q.boundingBox.clone():null,boundingSphere:Q.boundingSphere!==null?Q.boundingSphere.clone():null})),this._instanceInfo=J._instanceInfo.map((Q)=>({...Q})),this._availableInstanceIds=J._availableInstanceIds.slice(),this._availableGeometryIds=J._availableGeometryIds.slice(),this._nextIndexStart=J._nextIndexStart,this._nextVertexStart=J._nextVertexStart,this._geometryCount=J._geometryCount,this._maxInstanceCount=J._maxInstanceCount,this._maxVertexCount=J._maxVertexCount,this._maxIndexCount=J._maxIndexCount,this._geometryInitialized=J._geometryInitialized,this._multiDrawCounts=J._multiDrawCounts.slice(),this._multiDrawStarts=J._multiDrawStarts.slice(),this._indirectTexture=J._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=J._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null)this._colorsTexture=J._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice();return this}dispose(){if(this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null)this._colorsTexture.dispose(),this._colorsTexture=null}onBeforeRender(J,Q,$,Z,W){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let K=Z.getIndex(),H=K===null?1:K.array.BYTES_PER_ELEMENT,Y=1;if(W.wireframe)Y=2,H=Z.attributes.position.count>65535?4:2;let X=this._instanceInfo,U=this._multiDrawStarts,G=this._multiDrawCounts,N=this._geometryInfo,E=this.perObjectFrustumCulled,q=this._indirectTexture,R=q.image.data,O=$.isArrayCamera?r5:QX;if(E&&!$.isArrayCamera)cJ.multiplyMatrices($.projectionMatrix,$.matrixWorldInverse).multiply(this.matrixWorld),QX.setFromProjectionMatrix(cJ,$.coordinateSystem,$.reversedDepth);let F=0;if(this.sortObjects){cJ.copy(this.matrixWorld).invert(),$6.setFromMatrixPosition($.matrixWorld).applyMatrix4(cJ),$X.set(0,0,-1).transformDirection($.matrixWorld).transformDirection(cJ);for(let L=0,V=X.length;L<V;L++)if(X[L].visible&&X[L].active){let w=X[L].geometryIndex;this.getMatrixAt(L,cJ),this.getBoundingSphereAt(w,B8).applyMatrix4(cJ);let _=!1;if(E)_=!O.intersectsSphere(B8,$);if(!_){let A=N[w],M=t5.subVectors(B8.center,$6).dot($X);fW.push(A.start,A.count,M,L)}}let D=fW.list,k=this.customSort;if(k===null)D.sort(W.transparent?o5:i5);else k.call(this,D,$);for(let L=0,V=D.length;L<V;L++){let w=D[L];U[F]=w.start*H*Y,G[F]=w.count*Y,R[F]=w.index,F++}fW.reset()}else for(let D=0,k=X.length;D<k;D++)if(X[D].visible&&X[D].active){let L=X[D].geometryIndex,V=!1;if(E)this.getMatrixAt(D,cJ),this.getBoundingSphereAt(L,B8).applyMatrix4(cJ),V=!O.intersectsSphere(B8,$);if(!V){let w=N[L];U[F]=w.start*H*Y,G[F]=w.count*Y,R[F]=D,F++}}q.needsUpdate=!0,this._multiDrawCount=F,this._visibilityChanged=!1}onBeforeShadow(J,Q,$,Z,W,K){this.onBeforeRender(J,null,Z,W,K)}};jJ=class jJ extends PJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new M0(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}};Z$=new P,W$=new P,ZX=new m0,Z6=new G8,xQ=new zJ,bW=new P,WX=new P;_9=class _9 extends $J{constructor(J=new l0,Q=new jJ){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++)Z$.fromBufferAttribute(Q,Z-1),W$.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=Z$.distanceTo(W$);J.setAttribute("lineDistance",new V0($,1))}else U0("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,K=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(xQ.copy($.boundingSphere),xQ.applyMatrix4(Z),xQ.radius+=W,J.ray.intersectsSphere(xQ)===!1)return;ZX.copy(Z).invert(),Z6.copy(J.ray).applyMatrix4(ZX);let H=W/((this.scale.x+this.scale.y+this.scale.z)/3),Y=H*H,X=this.isLineSegments?2:1,U=$.index,N=$.attributes.position;if(U!==null){let E=Math.max(0,K.start),q=Math.min(U.count,K.start+K.count);for(let R=E,O=q-1;R<O;R+=X){let F=U.getX(R),D=U.getX(R+1),k=gQ(this,J,Z6,Y,F,D,R);if(k)Q.push(k)}if(this.isLineLoop){let R=U.getX(q-1),O=U.getX(E),F=gQ(this,J,Z6,Y,R,O,q-1);if(F)Q.push(F)}}else{let E=Math.max(0,K.start),q=Math.min(N.count,K.start+K.count);for(let R=E,O=q-1;R<O;R+=X){let F=gQ(this,J,Z6,Y,R,R+1,R);if(F)Q.push(F)}if(this.isLineLoop){let R=gQ(this,J,Z6,Y,q-1,E,q-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,K=Z.length;W<K;W++){let H=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[H]=W}}}}};KX=new P,HX=new P;Y9=class Y9 extends _9{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)KX.fromBufferAttribute(Q,Z),HX.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+KX.distanceTo(HX);J.setAttribute("lineDistance",new V0($,1))}else U0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};NZ=class NZ extends _9{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}};j6=class j6 extends PJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new M0(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}};YX=new m0,sW=new G8,pQ=new zJ,mQ=new P;qZ=class qZ extends $J{constructor(J=new l0,Q=new j6){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,K=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(pQ.copy($.boundingSphere),pQ.applyMatrix4(Z),pQ.radius+=W,J.ray.intersectsSphere(pQ)===!1)return;YX.copy(Z).invert(),sW.copy(J.ray).applyMatrix4(YX);let H=W/((this.scale.x+this.scale.y+this.scale.z)/3),Y=H*H,X=$.index,G=$.attributes.position;if(X!==null){let N=Math.max(0,K.start),E=Math.min(X.count,K.start+K.count);for(let q=N,R=E;q<R;q++){let O=X.getX(q);mQ.fromBufferAttribute(G,O),XX(mQ,O,Y,Z,J,Q,this)}}else{let N=Math.max(0,K.start),E=Math.min(G.count,K.start+K.count);for(let q=N,R=E;q<R;q++)mQ.fromBufferAttribute(G,q),XX(mQ,q,Y,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,K=Z.length;W<K;W++){let H=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[H]=W}}}}};DZ=class DZ extends FJ{constructor(J,Q,$,Z,W=1006,K=1006,H,Y,X){super(J,Q,$,Z,W,K,H,Y,X);this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let U=this;function G(){U.needsUpdate=!0,U._requestVideoFrameCallbackId=J.requestVideoFrameCallback(G)}if("requestVideoFrameCallback"in J)this._requestVideoFrameCallbackId=J.requestVideoFrameCallback(G)}clone(){return new this.constructor(this.image).copy(this)}update(){let J=this.image;if("requestVideoFrameCallback"in J===!1&&J.readyState>=J.HAVE_CURRENT_DATA)this.needsUpdate=!0}dispose(){if(this._requestVideoFrameCallbackId!==0)this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0;super.dispose()}};XH=class XH extends DZ{constructor(J,Q,$,Z,W,K,H,Y){super({},J,Q,$,Z,W,K,H,Y);this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(J){this.image=J,this.needsUpdate=!0}};UH=class UH extends FJ{constructor(J,Q){super({width:J,height:Q});this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}};x7=class x7 extends FJ{constructor(J,Q,$,Z,W,K,H,Y,X,U,G,N){super(null,K,H,Y,X,U,Z,W,G,N);this.isCompressedTexture=!0,this.image={width:Q,height:$},this.mipmaps=J,this.flipY=!1,this.generateMipmaps=!1}};GH=class GH extends x7{constructor(J,Q,$,Z,W,K){super(J,Q,$,W,K);this.isCompressedArrayTexture=!0,this.image.depth=Z,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}};EH=class EH extends x7{constructor(J,Q,$){super(void 0,J[0].width,J[0].height,Q,$,301);this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=J}};u8=class u8 extends FJ{constructor(J=[],Q=301,$,Z,W,K,H,Y,X,U){super(J,Q,$,Z,W,K,H,Y,X,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}};NH=class NH extends FJ{constructor(J,Q,$,Z,W,K,H,Y,X){super(J,Q,$,Z,W,K,H,Y,X);this.isCanvasTexture=!0,this.needsUpdate=!0}};N8=class N8 extends FJ{constructor(J,Q,$=1014,Z,W,K,H=1003,Y=1003,X,U=1026,G=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let N={width:J,height:Q,depth:G};super(N,Z,W,K,H,Y,U,$,X);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new I9(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}};FZ=class FZ extends N8{constructor(J,Q=1014,$=301,Z,W,K=1003,H=1003,Y,X=1026){let U={width:J,height:J,depth:1},G=[U,U,U,U,U,U];super(J,J,Q,$,Z,W,K,H,Y,X);this.image=G,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}};y6=class y6 extends FJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}};q8=class q8 extends l0{constructor(J=1,Q=1,$=1,Z=1,W=1,K=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:Z,heightSegments:W,depthSegments:K};let H=this;Z=Math.floor(Z),W=Math.floor(W),K=Math.floor(K);let Y=[],X=[],U=[],G=[],N=0,E=0;q("z","y","x",-1,-1,$,Q,J,K,W,0),q("z","y","x",1,-1,$,Q,-J,K,W,1),q("x","z","y",1,1,J,$,Q,Z,K,2),q("x","z","y",1,-1,J,$,-Q,Z,K,3),q("x","y","z",1,-1,J,Q,$,Z,W,4),q("x","y","z",-1,-1,J,Q,-$,Z,W,5),this.setIndex(Y),this.setAttribute("position",new V0(X,3)),this.setAttribute("normal",new V0(U,3)),this.setAttribute("uv",new V0(G,2));function q(R,O,F,D,k,L,V,w,_,A,M){let C=L/_,h=V/A,S=L/2,b=V/2,l=w/2,v=_+1,c=A+1,x=0,m=0,Q0=new P;for(let $0=0;$0<c;$0++){let G0=$0*h-b;for(let w0=0;w0<v;w0++){let K0=w0*C-S;Q0[R]=K0*D,Q0[O]=G0*k,Q0[F]=l,X.push(Q0.x,Q0.y,Q0.z),Q0[R]=0,Q0[O]=0,Q0[F]=w>0?1:-1,U.push(Q0.x,Q0.y,Q0.z),G.push(w0/_),G.push(1-$0/A),x+=1}}for(let $0=0;$0<A;$0++)for(let G0=0;G0<_;G0++){let w0=N+G0+v*$0,K0=N+G0+v*($0+1),HJ=N+(G0+1)+v*($0+1),WJ=N+(G0+1)+v*$0;Y.push(w0,K0,WJ),Y.push(K0,HJ,WJ),m+=6}H.addGroup(E,m,M),E+=m,N+=x}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new q8(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}};v6=class v6 extends l0{constructor(J=1,Q=1,$=4,Z=8,W=1){super();this.type="CapsuleGeometry",this.parameters={radius:J,height:Q,capSegments:$,radialSegments:Z,heightSegments:W},Q=Math.max(0,Q),$=Math.max(1,Math.floor($)),Z=Math.max(3,Math.floor(Z)),W=Math.max(1,Math.floor(W));let K=[],H=[],Y=[],X=[],U=Q/2,G=Math.PI/2*J,N=Q,E=2*G+N,q=$*2+W,R=Z+1,O=new P,F=new P;for(let D=0;D<=q;D++){let k=0,L=0,V=0,w=0;if(D<=$){let M=D/$,C=M*Math.PI/2;L=-U-J*Math.cos(C),V=J*Math.sin(C),w=-J*Math.cos(C),k=M*G}else if(D<=$+W){let M=(D-$)/W;L=-U+M*Q,V=J,w=0,k=G+M*N}else{let M=(D-$-W)/$,C=M*Math.PI/2;L=U+J*Math.sin(C),V=J*Math.cos(C),w=J*Math.sin(C),k=G+N+M*G}let _=Math.max(0,Math.min(1,k/E)),A=0;if(D===0)A=0.5/Z;else if(D===q)A=-0.5/Z;for(let M=0;M<=Z;M++){let C=M/Z,h=C*Math.PI*2,S=Math.sin(h),b=Math.cos(h);F.x=-V*b,F.y=L,F.z=V*S,H.push(F.x,F.y,F.z),O.set(-V*b,w,V*S),O.normalize(),Y.push(O.x,O.y,O.z),X.push(C+A,_)}if(D>0){let M=(D-1)*R;for(let C=0;C<Z;C++){let h=M+C,S=M+C+1,b=D*R+C,l=D*R+C+1;K.push(h,S,b),K.push(S,l,b)}}}this.setIndex(K),this.setAttribute("position",new V0(H,3)),this.setAttribute("normal",new V0(Y,3)),this.setAttribute("uv",new V0(X,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new v6(J.radius,J.height,J.capSegments,J.radialSegments,J.heightSegments)}};f6=class f6 extends l0{constructor(J=1,Q=32,$=0,Z=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:J,segments:Q,thetaStart:$,thetaLength:Z},Q=Math.max(3,Q);let W=[],K=[],H=[],Y=[],X=new P,U=new r;K.push(0,0,0),H.push(0,0,1),Y.push(0.5,0.5);for(let G=0,N=3;G<=Q;G++,N+=3){let E=$+G/Q*Z;X.x=J*Math.cos(E),X.y=J*Math.sin(E),K.push(X.x,X.y,X.z),H.push(0,0,1),U.x=(K[N]/J+1)/2,U.y=(K[N+1]/J+1)/2,Y.push(U.x,U.y)}for(let G=1;G<=Q;G++)W.push(G,G+1,0);this.setIndex(W),this.setAttribute("position",new V0(K,3)),this.setAttribute("normal",new V0(H,3)),this.setAttribute("uv",new V0(Y,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new f6(J.radius,J.segments,J.thetaStart,J.thetaLength)}};g7=class g7 extends l0{constructor(J=1,Q=1,$=1,Z=32,W=1,K=!1,H=0,Y=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:Z,heightSegments:W,openEnded:K,thetaStart:H,thetaLength:Y};let X=this;Z=Math.floor(Z),W=Math.floor(W);let U=[],G=[],N=[],E=[],q=0,R=[],O=$/2,F=0;if(D(),K===!1){if(J>0)k(!0);if(Q>0)k(!1)}this.setIndex(U),this.setAttribute("position",new V0(G,3)),this.setAttribute("normal",new V0(N,3)),this.setAttribute("uv",new V0(E,2));function D(){let L=new P,V=new P,w=0,_=(Q-J)/$;for(let A=0;A<=W;A++){let M=[],C=A/W,h=C*(Q-J)+J;for(let S=0;S<=Z;S++){let b=S/Z,l=b*Y+H,v=Math.sin(l),c=Math.cos(l);V.x=h*v,V.y=-C*$+O,V.z=h*c,G.push(V.x,V.y,V.z),L.set(v,_,c).normalize(),N.push(L.x,L.y,L.z),E.push(b,1-C),M.push(q++)}R.push(M)}for(let A=0;A<Z;A++)for(let M=0;M<W;M++){let C=R[M][A],h=R[M+1][A],S=R[M+1][A+1],b=R[M][A+1];if(J>0||M!==0)U.push(C,h,b),w+=3;if(Q>0||M!==W-1)U.push(h,S,b),w+=3}X.addGroup(F,w,0),F+=w}function k(L){let V=q,w=new r,_=new P,A=0,M=L===!0?J:Q,C=L===!0?1:-1;for(let S=1;S<=Z;S++)G.push(0,O*C,0),N.push(0,C,0),E.push(0.5,0.5),q++;let h=q;for(let S=0;S<=Z;S++){let l=S/Z*Y+H,v=Math.cos(l),c=Math.sin(l);_.x=M*c,_.y=O*C,_.z=M*v,G.push(_.x,_.y,_.z),N.push(0,C,0),w.x=v*0.5+0.5,w.y=c*0.5*C+0.5,E.push(w.x,w.y),q++}for(let S=0;S<Z;S++){let b=V+S,l=h+S;if(L===!0)U.push(l,l+1,b);else U.push(l+1,l,b);A+=3}X.addGroup(F,A,L===!0?1:2),F+=A}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new g7(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}};p7=class p7 extends g7{constructor(J=1,Q=1,$=32,Z=1,W=!1,K=0,H=Math.PI*2){super(0,J,Q,$,Z,W,K,H);this.type="ConeGeometry",this.parameters={radius:J,height:Q,radialSegments:$,heightSegments:Z,openEnded:W,thetaStart:K,thetaLength:H}}static fromJSON(J){return new p7(J.radius,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}};l9=class l9 extends l0{constructor(J=[],Q=[],$=1,Z=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:J,indices:Q,radius:$,detail:Z};let W=[],K=[];if(H(Z),X($),U(),this.setAttribute("position",new V0(W,3)),this.setAttribute("normal",new V0(W.slice(),3)),this.setAttribute("uv",new V0(K,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function H(D){let k=new P,L=new P,V=new P;for(let w=0;w<Q.length;w+=3)E(Q[w+0],k),E(Q[w+1],L),E(Q[w+2],V),Y(k,L,V,D)}function Y(D,k,L,V){let w=V+1,_=[];for(let A=0;A<=w;A++){_[A]=[];let M=D.clone().lerp(L,A/w),C=k.clone().lerp(L,A/w),h=w-A;for(let S=0;S<=h;S++)if(S===0&&A===w)_[A][S]=M;else _[A][S]=M.clone().lerp(C,S/h)}for(let A=0;A<w;A++)for(let M=0;M<2*(w-A)-1;M++){let C=Math.floor(M/2);if(M%2===0)N(_[A][C+1]),N(_[A+1][C]),N(_[A][C]);else N(_[A][C+1]),N(_[A+1][C+1]),N(_[A+1][C])}}function X(D){let k=new P;for(let L=0;L<W.length;L+=3)k.x=W[L+0],k.y=W[L+1],k.z=W[L+2],k.normalize().multiplyScalar(D),W[L+0]=k.x,W[L+1]=k.y,W[L+2]=k.z}function U(){let D=new P;for(let k=0;k<W.length;k+=3){D.x=W[k+0],D.y=W[k+1],D.z=W[k+2];let L=O(D)/2/Math.PI+0.5,V=F(D)/Math.PI+0.5;K.push(L,1-V)}q(),G()}function G(){for(let D=0;D<K.length;D+=6){let k=K[D+0],L=K[D+2],V=K[D+4],w=Math.max(k,L,V),_=Math.min(k,L,V);if(w>0.9&&_<0.1){if(k<0.2)K[D+0]+=1;if(L<0.2)K[D+2]+=1;if(V<0.2)K[D+4]+=1}}}function N(D){W.push(D.x,D.y,D.z)}function E(D,k){let L=D*3;k.x=J[L+0],k.y=J[L+1],k.z=J[L+2]}function q(){let D=new P,k=new P,L=new P,V=new P,w=new r,_=new r,A=new r;for(let M=0,C=0;M<W.length;M+=9,C+=6){D.set(W[M+0],W[M+1],W[M+2]),k.set(W[M+3],W[M+4],W[M+5]),L.set(W[M+6],W[M+7],W[M+8]),w.set(K[C+0],K[C+1]),_.set(K[C+2],K[C+3]),A.set(K[C+4],K[C+5]),V.copy(D).add(k).add(L).divideScalar(3);let h=O(V);R(w,C+0,D,h),R(_,C+2,k,h),R(A,C+4,L,h)}}function R(D,k,L,V){if(V<0&&D.x===1)K[k]=D.x-1;if(L.x===0&&L.z===0)K[k]=V/2/Math.PI+0.5}function O(D){return Math.atan2(D.z,-D.x)}function F(D){return Math.atan2(-D.y,Math.sqrt(D.x*D.x+D.z*D.z))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new l9(J.vertices,J.indices,J.radius,J.detail)}};b6=class b6 extends l9{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=1/$,W=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,0,-$,0,-Z,$,0,-Z,-$,0,Z,$,0,Z],K=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(W,K,J,Q);this.type="DodecahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new b6(J.radius,J.detail)}};dQ=new P,lQ=new P,hW=new P,uQ=new mJ;RZ=class RZ extends l0{constructor(J=null,Q=1){super();if(this.type="EdgesGeometry",this.parameters={geometry:J,thresholdAngle:Q},J!==null){let Z=Math.pow(10,4),W=Math.cos(S8*Q),K=J.getIndex(),H=J.getAttribute("position"),Y=K?K.count:H.count,X=[0,0,0],U=["a","b","c"],G=[,,,],N={},E=[];for(let q=0;q<Y;q+=3){if(K)X[0]=K.getX(q),X[1]=K.getX(q+1),X[2]=K.getX(q+2);else X[0]=q,X[1]=q+1,X[2]=q+2;let{a:R,b:O,c:F}=uQ;if(R.fromBufferAttribute(H,X[0]),O.fromBufferAttribute(H,X[1]),F.fromBufferAttribute(H,X[2]),uQ.getNormal(hW),G[0]=`${Math.round(R.x*Z)},${Math.round(R.y*Z)},${Math.round(R.z*Z)}`,G[1]=`${Math.round(O.x*Z)},${Math.round(O.y*Z)},${Math.round(O.z*Z)}`,G[2]=`${Math.round(F.x*Z)},${Math.round(F.y*Z)},${Math.round(F.z*Z)}`,G[0]===G[1]||G[1]===G[2]||G[2]===G[0])continue;for(let D=0;D<3;D++){let k=(D+1)%3,L=G[D],V=G[k],w=uQ[U[D]],_=uQ[U[k]],A=`${L}_${V}`,M=`${V}_${L}`;if(M in N&&N[M]){if(hW.dot(N[M].normal)<=W)E.push(w.x,w.y,w.z),E.push(_.x,_.y,_.z);N[M]=null}else if(!(A in N))N[A]={index0:X[D],index1:X[k],normal:hW.clone()}}}for(let q in N)if(N[q]){let{index0:R,index1:O}=N[q];dQ.fromBufferAttribute(H,R),lQ.fromBufferAttribute(H,O),E.push(dQ.x,dQ.y,dQ.z),E.push(lQ.x,lQ.y,lQ.z)}this.setAttribute("position",new V0(E,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}};m7=class m7 extends Q9{constructor(J=0,Q=0,$=1,Z=1,W=0,K=Math.PI*2,H=!1,Y=0){super();this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=J,this.aY=Q,this.xRadius=$,this.yRadius=Z,this.aStartAngle=W,this.aEndAngle=K,this.aClockwise=H,this.aRotation=Y}getPoint(J,Q=new r){let $=Q,Z=Math.PI*2,W=this.aEndAngle-this.aStartAngle,K=Math.abs(W)<Number.EPSILON;while(W<0)W+=Z;while(W>Z)W-=Z;if(W<Number.EPSILON)if(K)W=0;else W=Z;if(this.aClockwise===!0&&!K)if(W===Z)W=-Z;else W=W-Z;let H=this.aStartAngle+J*W,Y=this.aX+this.xRadius*Math.cos(H),X=this.aY+this.yRadius*Math.sin(H);if(this.aRotation!==0){let U=Math.cos(this.aRotation),G=Math.sin(this.aRotation),N=Y-this.aX,E=X-this.aY;Y=N*U-E*G+this.aX,X=N*G+E*U+this.aY}return $.set(Y,X)}copy(J){return super.copy(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}toJSON(){let J=super.toJSON();return J.aX=this.aX,J.aY=this.aY,J.xRadius=this.xRadius,J.yRadius=this.yRadius,J.aStartAngle=this.aStartAngle,J.aEndAngle=this.aEndAngle,J.aClockwise=this.aClockwise,J.aRotation=this.aRotation,J}fromJSON(J){return super.fromJSON(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}};OZ=class OZ extends m7{constructor(J,Q,$,Z,W,K){super(J,Q,$,$,Z,W,K);this.isArcCurve=!0,this.type="ArcCurve"}};cQ=new P,xW=new qH,gW=new qH,pW=new qH;kZ=class kZ extends Q9{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 P){let $=Q,Z=this.points,W=Z.length,K=(W-(this.closed?0:1))*J,H=Math.floor(K),Y=K-H;if(this.closed)H+=H>0?0:(Math.floor(Math.abs(H)/W)+1)*W;else if(Y===0&&H===W-1)H=W-2,Y=1;let X,U;if(this.closed||H>0)X=Z[(H-1)%W];else cQ.subVectors(Z[0],Z[1]).add(Z[0]),X=cQ;let G=Z[H%W],N=Z[(H+1)%W];if(this.closed||H+2<W)U=Z[(H+2)%W];else cQ.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=cQ;if(this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?0.5:0.25,q=Math.pow(X.distanceToSquared(G),E),R=Math.pow(G.distanceToSquared(N),E),O=Math.pow(N.distanceToSquared(U),E);if(R<0.0001)R=1;if(q<0.0001)q=R;if(O<0.0001)O=R;xW.initNonuniformCatmullRom(X.x,G.x,N.x,U.x,q,R,O),gW.initNonuniformCatmullRom(X.y,G.y,N.y,U.y,q,R,O),pW.initNonuniformCatmullRom(X.z,G.z,N.z,U.z,q,R,O)}else if(this.curveType==="catmullrom")xW.initCatmullRom(X.x,G.x,N.x,U.x,this.tension),gW.initCatmullRom(X.y,G.y,N.y,U.y,this.tension),pW.initCatmullRom(X.z,G.z,N.z,U.z,this.tension);return $.set(xW.calc(Y),gW.calc(Y),pW.calc(Y)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this.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 P().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}};h6=class h6 extends Q9{constructor(J=new r,Q=new r,$=new r,Z=new r){super();this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new r){let $=Q,Z=this.v0,W=this.v1,K=this.v2,H=this.v3;return $.set(X6(J,Z.x,W.x,K.x,H.x),X6(J,Z.y,W.y,K.y,H.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}};MZ=class MZ extends Q9{constructor(J=new P,Q=new P,$=new P,Z=new P){super();this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new P){let $=Q,Z=this.v0,W=this.v1,K=this.v2,H=this.v3;return $.set(X6(J,Z.x,W.x,K.x,H.x),X6(J,Z.y,W.y,K.y,H.y),X6(J,Z.z,W.z,K.z,H.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}};x6=class x6 extends Q9{constructor(J=new r,Q=new r){super();this.isLineCurve=!0,this.type="LineCurve",this.v1=J,this.v2=Q}getPoint(J,Q=new r){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new r){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};LZ=class LZ extends Q9{constructor(J=new P,Q=new P){super();this.isLineCurve3=!0,this.type="LineCurve3",this.v1=J,this.v2=Q}getPoint(J,Q=new P){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new P){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};g6=class g6 extends Q9{constructor(J=new r,Q=new r,$=new r){super();this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new r){let $=Q,Z=this.v0,W=this.v1,K=this.v2;return $.set(Y6(J,Z.x,W.x,K.x),Y6(J,Z.y,W.y,K.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};p6=class p6 extends Q9{constructor(J=new P,Q=new P,$=new P){super();this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new P){let $=Q,Z=this.v0,W=this.v1,K=this.v2;return $.set(Y6(J,Z.x,W.x,K.x),Y6(J,Z.y,W.y,K.y),Y6(J,Z.z,W.z,K.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};m6=class m6 extends Q9{constructor(J=[]){super();this.isSplineCurve=!0,this.type="SplineCurve",this.points=J}getPoint(J,Q=new r){let $=Q,Z=this.points,W=(Z.length-1)*J,K=Math.floor(W),H=W-K,Y=Z[K===0?K:K-1],X=Z[K],U=Z[K>Z.length-2?Z.length-1:K+1],G=Z[K>Z.length-3?Z.length-1:K+2];return $.set(UX(H,Y.x,X.x,U.x,G.x),UX(H,Y.y,X.y,U.y,G.y)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new r().fromArray(Z))}return this}};K$=Object.freeze({__proto__:null,ArcCurve:OZ,CatmullRomCurve3:kZ,CubicBezierCurve:h6,CubicBezierCurve3:MZ,EllipseCurve:m7,LineCurve:x6,LineCurve3:LZ,QuadraticBezierCurve:g6,QuadraticBezierCurve3:p6,SplineCurve:m6});VZ=class VZ extends Q9{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(J){this.curves.push(J)}closePath(){let J=this.curves[0].getPoint(0),Q=this.curves[this.curves.length-1].getPoint(1);if(!J.equals(Q)){let $=J.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new K$[$](Q,J))}return this}getPoint(J,Q){let $=J*this.getLength(),Z=this.getCurveLengths(),W=0;while(W<Z.length){if(Z[W]>=$){let K=Z[W]-$,H=this.curves[W],Y=H.getLength(),X=Y===0?0:1-K/Y;return H.getPointAt(X,Q)}W++}return null}getLength(){let J=this.getCurveLengths();return J[J.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let J=[],Q=0;for(let $=0,Z=this.curves.length;$<Z;$++)Q+=this.curves[$].getLength(),J.push(Q);return this.cacheLengths=J,J}getSpacedPoints(J=40){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));if(this.autoClose)Q.push(Q[0]);return Q}getPoints(J=12){let Q=[],$;for(let Z=0,W=this.curves;Z<W.length;Z++){let K=W[Z],H=K.isEllipseCurve?J*2:K.isLineCurve||K.isLineCurve3?1:K.isSplineCurve?J*K.points.length:J,Y=K.getPoints(H);for(let X=0;X<Y.length;X++){let U=Y[X];if($&&$.equals(U))continue;Q.push(U),$=U}}if(this.autoClose&&Q.length>1&&!Q[Q.length-1].equals(Q[0]))Q.push(Q[0]);return Q}copy(J){super.copy(J),this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(Z.clone())}return this.autoClose=J.autoClose,this}toJSON(){let J=super.toJSON();J.autoClose=this.autoClose,J.curves=[];for(let Q=0,$=this.curves.length;Q<$;Q++){let Z=this.curves[Q];J.curves.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.autoClose=J.autoClose,this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(new K$[Z.type]().fromJSON(Z))}return this}};_7=class _7 extends VZ{constructor(J){super();if(this.type="Path",this.currentPoint=new r,J)this.setFromPoints(J)}setFromPoints(J){this.moveTo(J[0].x,J[0].y);for(let Q=1,$=J.length;Q<$;Q++)this.lineTo(J[Q].x,J[Q].y);return this}moveTo(J,Q){return this.currentPoint.set(J,Q),this}lineTo(J,Q){let $=new x6(this.currentPoint.clone(),new r(J,Q));return this.curves.push($),this.currentPoint.set(J,Q),this}quadraticCurveTo(J,Q,$,Z){let W=new g6(this.currentPoint.clone(),new r(J,Q),new r($,Z));return this.curves.push(W),this.currentPoint.set($,Z),this}bezierCurveTo(J,Q,$,Z,W,K){let H=new h6(this.currentPoint.clone(),new r(J,Q),new r($,Z),new r(W,K));return this.curves.push(H),this.currentPoint.set(W,K),this}splineThru(J){let Q=[this.currentPoint.clone()].concat(J),$=new m6(Q);return this.curves.push($),this.currentPoint.copy(J[J.length-1]),this}arc(J,Q,$,Z,W,K){let H=this.currentPoint.x,Y=this.currentPoint.y;return this.absarc(J+H,Q+Y,$,Z,W,K),this}absarc(J,Q,$,Z,W,K){return this.absellipse(J,Q,$,$,Z,W,K),this}ellipse(J,Q,$,Z,W,K,H,Y){let X=this.currentPoint.x,U=this.currentPoint.y;return this.absellipse(J+X,Q+U,$,Z,W,K,H,Y),this}absellipse(J,Q,$,Z,W,K,H,Y){let X=new m7(J,Q,$,Z,W,K,H,Y);if(this.curves.length>0){let G=X.getPoint(0);if(!G.equals(this.currentPoint))this.lineTo(G.x,G.y)}this.curves.push(X);let U=X.getPoint(1);return this.currentPoint.copy(U),this}copy(J){return super.copy(J),this.currentPoint.copy(J.currentPoint),this}toJSON(){let J=super.toJSON();return J.currentPoint=this.currentPoint.toArray(),J}fromJSON(J){return super.fromJSON(J),this.currentPoint.fromArray(J.currentPoint),this}};p9=class p9 extends _7{constructor(J){super(J);this.uuid=eJ(),this.type="Shape",this.holes=[]}getPointsHoles(J){let Q=[];for(let $=0,Z=this.holes.length;$<Z;$++)Q[$]=this.holes[$].getPoints(J);return Q}extractPoints(J){return{shape:this.getPoints(J),holes:this.getPointsHoles(J)}}copy(J){super.copy(J),this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.uuid=this.uuid,J.holes=[];for(let Q=0,$=this.holes.length;Q<$;Q++){let Z=this.holes[Q];J.holes.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.uuid=J.uuid,this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(new _7().fromJSON(Z))}return this}};d6=class d6 extends l0{constructor(J=new p9([new r(0.5,0.5),new r(-0.5,0.5),new r(-0.5,-0.5),new r(0.5,-0.5)]),Q={}){super();this.type="ExtrudeGeometry",this.parameters={shapes:J,options:Q},J=Array.isArray(J)?J:[J];let $=this,Z=[],W=[];for(let H=0,Y=J.length;H<Y;H++){let X=J[H];K(X)}this.setAttribute("position",new V0(Z,3)),this.setAttribute("uv",new V0(W,2)),this.computeVertexNormals();function K(H){let Y=[],X=Q.curveSegments!==void 0?Q.curveSegments:12,U=Q.steps!==void 0?Q.steps:1,G=Q.depth!==void 0?Q.depth:1,N=Q.bevelEnabled!==void 0?Q.bevelEnabled:!0,E=Q.bevelThickness!==void 0?Q.bevelThickness:0.2,q=Q.bevelSize!==void 0?Q.bevelSize:E-0.1,R=Q.bevelOffset!==void 0?Q.bevelOffset:0,O=Q.bevelSegments!==void 0?Q.bevelSegments:3,F=Q.extrudePath,D=Q.UVGenerator!==void 0?Q.UVGenerator:IE,k,L=!1,V,w,_,A;if(F){k=F.getSpacedPoints(U),L=!0,N=!1;let a=F.isCatmullRomCurve3?F.closed:!1;V=F.computeFrenetFrames(U,a),w=new P,_=new P,A=new P}if(!N)O=0,E=0,q=0,R=0;let M=H.extractPoints(X),C=M.shape,h=M.holes;if(!Z9.isClockWise(C)){C=C.reverse();for(let a=0,Z0=h.length;a<Z0;a++){let e=h[a];if(Z9.isClockWise(e))h[a]=e.reverse()}}function b(a){let R0=a[0];for(let T=1;T<=a.length;T++){let h0=T%a.length,N0=a[h0],x0=N0.x-R0.x,H0=N0.y-R0.y,d0=x0*x0+H0*H0,I=Math.max(Math.abs(N0.x),Math.abs(N0.y),Math.abs(R0.x),Math.abs(R0.y)),B=0.000000000000000000010000000000000001*I*I;if(d0<=B){a.splice(h0,1),T--;continue}R0=N0}}b(C),h.forEach(b);let l=h.length,v=C;for(let a=0;a<l;a++){let Z0=h[a];C=C.concat(Z0)}function c(a,Z0,e){if(!Z0)S0("ExtrudeGeometry: vec does not exist");return a.clone().addScaledVector(Z0,e)}let x=C.length;function m(a,Z0,e){let R0,T,h0,N0=a.x-Z0.x,x0=a.y-Z0.y,H0=e.x-a.x,d0=e.y-a.y,I=N0*N0+x0*x0,B=N0*d0-x0*H0;if(Math.abs(B)>Number.EPSILON){let f=Math.sqrt(I),n=Math.sqrt(H0*H0+d0*d0),t=Z0.x-x0/f,u=Z0.y+N0/f,z0=e.x-d0/n,D0=e.y+H0/n,j0=((z0-t)*d0-(D0-u)*H0)/(N0*d0-x0*H0);R0=t+N0*j0-a.x,T=u+x0*j0-a.y;let b0=R0*R0+T*T;if(b0<=2)return new r(R0,T);else h0=Math.sqrt(b0/2)}else{let f=!1;if(N0>Number.EPSILON){if(H0>Number.EPSILON)f=!0}else if(N0<-Number.EPSILON){if(H0<-Number.EPSILON)f=!0}else if(Math.sign(x0)===Math.sign(d0))f=!0;if(f)R0=-x0,T=N0,h0=Math.sqrt(I);else R0=N0,T=x0,h0=Math.sqrt(I/2)}return new r(R0/h0,T/h0)}let Q0=[];for(let a=0,Z0=v.length,e=Z0-1,R0=a+1;a<Z0;a++,e++,R0++){if(e===Z0)e=0;if(R0===Z0)R0=0;Q0[a]=m(v[a],v[e],v[R0])}let $0=[],G0,w0=Q0.concat();for(let a=0,Z0=l;a<Z0;a++){let e=h[a];G0=[];for(let R0=0,T=e.length,h0=T-1,N0=R0+1;R0<T;R0++,h0++,N0++){if(h0===T)h0=0;if(N0===T)N0=0;G0[R0]=m(e[R0],e[h0],e[N0])}$0.push(G0),w0=w0.concat(G0)}let K0;if(O===0)K0=Z9.triangulateShape(v,h);else{let a=[],Z0=[];for(let e=0;e<O;e++){let R0=e/O,T=E*Math.cos(R0*Math.PI/2),h0=q*Math.sin(R0*Math.PI/2)+R;for(let N0=0,x0=v.length;N0<x0;N0++){let H0=c(v[N0],Q0[N0],h0);if(q0(H0.x,H0.y,-T),R0===0)a.push(H0)}for(let N0=0,x0=l;N0<x0;N0++){let H0=h[N0];G0=$0[N0];let d0=[];for(let I=0,B=H0.length;I<B;I++){let f=c(H0[I],G0[I],h0);if(q0(f.x,f.y,-T),R0===0)d0.push(f)}if(R0===0)Z0.push(d0)}}K0=Z9.triangulateShape(a,Z0)}let HJ=K0.length,WJ=q+R;for(let a=0;a<x;a++){let Z0=N?c(C[a],w0[a],WJ):C[a];if(!L)q0(Z0.x,Z0.y,0);else _.copy(V.normals[0]).multiplyScalar(Z0.x),w.copy(V.binormals[0]).multiplyScalar(Z0.y),A.copy(k[0]).add(_).add(w),q0(A.x,A.y,A.z)}for(let a=1;a<=U;a++)for(let Z0=0;Z0<x;Z0++){let e=N?c(C[Z0],w0[Z0],WJ):C[Z0];if(!L)q0(e.x,e.y,G/U*a);else _.copy(V.normals[a]).multiplyScalar(e.x),w.copy(V.binormals[a]).multiplyScalar(e.y),A.copy(k[a]).add(_).add(w),q0(A.x,A.y,A.z)}for(let a=O-1;a>=0;a--){let Z0=a/O,e=E*Math.cos(Z0*Math.PI/2),R0=q*Math.sin(Z0*Math.PI/2)+R;for(let T=0,h0=v.length;T<h0;T++){let N0=c(v[T],Q0[T],R0);q0(N0.x,N0.y,G+e)}for(let T=0,h0=h.length;T<h0;T++){let N0=h[T];G0=$0[T];for(let x0=0,H0=N0.length;x0<H0;x0++){let d0=c(N0[x0],G0[x0],R0);if(!L)q0(d0.x,d0.y,G+e);else q0(d0.x,d0.y+k[U-1].y,k[U-1].x+e)}}}s(),E0();function s(){let a=Z.length/3;if(N){let Z0=0,e=x*Z0;for(let R0=0;R0<HJ;R0++){let T=K0[R0];f0(T[2]+e,T[1]+e,T[0]+e)}Z0=U+O*2,e=x*Z0;for(let R0=0;R0<HJ;R0++){let T=K0[R0];f0(T[0]+e,T[1]+e,T[2]+e)}}else{for(let Z0=0;Z0<HJ;Z0++){let e=K0[Z0];f0(e[2],e[1],e[0])}for(let Z0=0;Z0<HJ;Z0++){let e=K0[Z0];f0(e[0]+x*U,e[1]+x*U,e[2]+x*U)}}$.addGroup(a,Z.length/3-a,0)}function E0(){let a=Z.length/3,Z0=0;B0(v,Z0),Z0+=v.length;for(let e=0,R0=h.length;e<R0;e++){let T=h[e];B0(T,Z0),Z0+=T.length}$.addGroup(a,Z.length/3-a,1)}function B0(a,Z0){let e=a.length;while(--e>=0){let R0=e,T=e-1;if(T<0)T=a.length-1;for(let h0=0,N0=U+O*2;h0<N0;h0++){let x0=x*h0,H0=x*(h0+1),d0=Z0+R0+x0,I=Z0+T+x0,B=Z0+T+H0,f=Z0+R0+H0;JJ(d0,I,B,f)}}}function q0(a,Z0,e){Y.push(a),Y.push(Z0),Y.push(e)}function f0(a,Z0,e){n0(a),n0(Z0),n0(e);let R0=Z.length/3,T=D.generateTopUV($,Z,R0-3,R0-2,R0-1);s0(T[0]),s0(T[1]),s0(T[2])}function JJ(a,Z0,e,R0){n0(a),n0(Z0),n0(R0),n0(Z0),n0(e),n0(R0);let T=Z.length/3,h0=D.generateSideWallUV($,Z,T-6,T-3,T-2,T-1);s0(h0[0]),s0(h0[1]),s0(h0[3]),s0(h0[1]),s0(h0[2]),s0(h0[3])}function n0(a){Z.push(Y[a*3+0]),Z.push(Y[a*3+1]),Z.push(Y[a*3+2])}function s0(a){W.push(a.x),W.push(a.y)}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes,$=this.parameters.options;return _E(Q,$,J)}static fromJSON(J,Q){let $=[];for(let W=0,K=J.shapes.length;W<K;W++){let H=Q[J.shapes[W]];$.push(H)}let Z=J.options.extrudePath;if(Z!==void 0)J.options.extrudePath=new K$[Z.type]().fromJSON(Z);return new d6($,J.options)}};IE={generateTopUV:function(J,Q,$,Z,W){let K=Q[$*3],H=Q[$*3+1],Y=Q[Z*3],X=Q[Z*3+1],U=Q[W*3],G=Q[W*3+1];return[new r(K,H),new r(Y,X),new r(U,G)]},generateSideWallUV:function(J,Q,$,Z,W,K){let H=Q[$*3],Y=Q[$*3+1],X=Q[$*3+2],U=Q[Z*3],G=Q[Z*3+1],N=Q[Z*3+2],E=Q[W*3],q=Q[W*3+1],R=Q[W*3+2],O=Q[K*3],F=Q[K*3+1],D=Q[K*3+2];if(Math.abs(Y-G)<Math.abs(H-U))return[new r(H,1-X),new r(U,1-N),new r(E,1-R),new r(O,1-D)];else return[new r(Y,1-X),new r(G,1-N),new r(q,1-R),new r(F,1-D)]}};l6=class l6 extends l9{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 l6(J.radius,J.detail)}};u6=class u6 extends l0{constructor(J=[new r(0,-0.5),new r(0.5,0),new r(0,0.5)],Q=12,$=0,Z=Math.PI*2){super();this.type="LatheGeometry",this.parameters={points:J,segments:Q,phiStart:$,phiLength:Z},Q=Math.floor(Q),Z=p0(Z,0,Math.PI*2);let W=[],K=[],H=[],Y=[],X=[],U=1/Q,G=new P,N=new r,E=new P,q=new P,R=new P,O=0,F=0;for(let D=0;D<=J.length-1;D++)switch(D){case 0:O=J[D+1].x-J[D].x,F=J[D+1].y-J[D].y,E.x=F*1,E.y=-O,E.z=F*0,R.copy(E),E.normalize(),Y.push(E.x,E.y,E.z);break;case J.length-1:Y.push(R.x,R.y,R.z);break;default:O=J[D+1].x-J[D].x,F=J[D+1].y-J[D].y,E.x=F*1,E.y=-O,E.z=F*0,q.copy(E),E.x+=R.x,E.y+=R.y,E.z+=R.z,E.normalize(),Y.push(E.x,E.y,E.z),R.copy(q)}for(let D=0;D<=Q;D++){let k=$+D*U*Z,L=Math.sin(k),V=Math.cos(k);for(let w=0;w<=J.length-1;w++){G.x=J[w].x*L,G.y=J[w].y,G.z=J[w].x*V,K.push(G.x,G.y,G.z),N.x=D/Q,N.y=w/(J.length-1),H.push(N.x,N.y);let _=Y[3*w+0]*L,A=Y[3*w+1],M=Y[3*w+0]*V;X.push(_,A,M)}}for(let D=0;D<Q;D++)for(let k=0;k<J.length-1;k++){let L=k+D*J.length,V=L,w=L+J.length,_=L+J.length+1,A=L+1;W.push(V,w,A),W.push(_,A,w)}this.setIndex(W),this.setAttribute("position",new V0(K,3)),this.setAttribute("uv",new V0(H,2)),this.setAttribute("normal",new V0(X,3))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new u6(J.points,J.segments,J.phiStart,J.phiLength)}};d7=class d7 extends l9{constructor(J=1,Q=0){let $=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Z=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super($,Z,J,Q);this.type="OctahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new d7(J.radius,J.detail)}};c8=class c8 extends l0{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,K=Q/2,H=Math.floor($),Y=Math.floor(Z),X=H+1,U=Y+1,G=J/H,N=Q/Y,E=[],q=[],R=[],O=[];for(let F=0;F<U;F++){let D=F*N-K;for(let k=0;k<X;k++){let L=k*G-W;q.push(L,-D,0),R.push(0,0,1),O.push(k/H),O.push(1-F/Y)}}for(let F=0;F<Y;F++)for(let D=0;D<H;D++){let k=D+X*F,L=D+X*(F+1),V=D+1+X*(F+1),w=D+1+X*F;E.push(k,L,w),E.push(L,V,w)}this.setIndex(E),this.setAttribute("position",new V0(q,3)),this.setAttribute("normal",new V0(R,3)),this.setAttribute("uv",new V0(O,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new c8(J.width,J.height,J.widthSegments,J.heightSegments)}};c6=class c6 extends l0{constructor(J=0.5,Q=1,$=32,Z=1,W=0,K=Math.PI*2){super();this.type="RingGeometry",this.parameters={innerRadius:J,outerRadius:Q,thetaSegments:$,phiSegments:Z,thetaStart:W,thetaLength:K},$=Math.max(3,$),Z=Math.max(1,Z);let H=[],Y=[],X=[],U=[],G=J,N=(Q-J)/Z,E=new P,q=new r;for(let R=0;R<=Z;R++){for(let O=0;O<=$;O++){let F=W+O/$*K;E.x=G*Math.cos(F),E.y=G*Math.sin(F),Y.push(E.x,E.y,E.z),X.push(0,0,1),q.x=(E.x/Q+1)/2,q.y=(E.y/Q+1)/2,U.push(q.x,q.y)}G+=N}for(let R=0;R<Z;R++){let O=R*($+1);for(let F=0;F<$;F++){let D=F+O,k=D,L=D+$+1,V=D+$+2,w=D+1;H.push(k,L,w),H.push(L,V,w)}}this.setIndex(H),this.setAttribute("position",new V0(Y,3)),this.setAttribute("normal",new V0(X,3)),this.setAttribute("uv",new V0(U,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new c6(J.innerRadius,J.outerRadius,J.thetaSegments,J.phiSegments,J.thetaStart,J.thetaLength)}};n6=class n6 extends l0{constructor(J=new p9([new r(0,0.5),new r(-0.5,-0.5),new r(0.5,-0.5)]),Q=12){super();this.type="ShapeGeometry",this.parameters={shapes:J,curveSegments:Q};let $=[],Z=[],W=[],K=[],H=0,Y=0;if(Array.isArray(J)===!1)X(J);else for(let U=0;U<J.length;U++)X(J[U]),this.addGroup(H,Y,U),H+=Y,Y=0;this.setIndex($),this.setAttribute("position",new V0(Z,3)),this.setAttribute("normal",new V0(W,3)),this.setAttribute("uv",new V0(K,2));function X(U){let G=Z.length/3,N=U.extractPoints(Q),E=N.shape,q=N.holes;if(Z9.isClockWise(E)===!1)E=E.reverse();for(let O=0,F=q.length;O<F;O++){let D=q[O];if(Z9.isClockWise(D)===!0)q[O]=D.reverse()}let R=Z9.triangulateShape(E,q);for(let O=0,F=q.length;O<F;O++){let D=q[O];E=E.concat(D)}for(let O=0,F=E.length;O<F;O++){let D=E[O];Z.push(D.x,D.y,0),W.push(0,0,1),K.push(D.x,D.y)}for(let O=0,F=R.length;O<F;O++){let D=R[O],k=D[0]+G,L=D[1]+G,V=D[2]+G;$.push(k,L,V),Y+=3}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes;return AE(Q,J)}static fromJSON(J,Q){let $=[];for(let Z=0,W=J.shapes.length;Z<W;Z++){let K=Q[J.shapes[Z]];$.push(K)}return new n6($,J.curveSegments)}};l7=class l7 extends l0{constructor(J=1,Q=32,$=16,Z=0,W=Math.PI*2,K=0,H=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:Z,phiLength:W,thetaStart:K,thetaLength:H},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let Y=Math.min(K+H,Math.PI),X=0,U=[],G=new P,N=new P,E=[],q=[],R=[],O=[];for(let F=0;F<=$;F++){let D=[],k=F/$,L=0;if(F===0&&K===0)L=0.5/Q;else if(F===$&&Y===Math.PI)L=-0.5/Q;for(let V=0;V<=Q;V++){let w=V/Q;G.x=-J*Math.cos(Z+w*W)*Math.sin(K+k*H),G.y=J*Math.cos(K+k*H),G.z=J*Math.sin(Z+w*W)*Math.sin(K+k*H),q.push(G.x,G.y,G.z),N.copy(G).normalize(),R.push(N.x,N.y,N.z),O.push(w+L,1-k),D.push(X++)}U.push(D)}for(let F=0;F<$;F++)for(let D=0;D<Q;D++){let k=U[F][D+1],L=U[F][D],V=U[F+1][D],w=U[F+1][D+1];if(F!==0||K>0)E.push(k,L,w);if(F!==$-1||Y<Math.PI)E.push(L,V,w)}this.setIndex(E),this.setAttribute("position",new V0(q,3)),this.setAttribute("normal",new V0(R,3)),this.setAttribute("uv",new V0(O,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new l7(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}};s6=class s6 extends l9{constructor(J=1,Q=0){let $=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Z=[2,1,0,0,3,2,1,3,0,2,3,1];super($,Z,J,Q);this.type="TetrahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new s6(J.radius,J.detail)}};i6=class i6 extends l0{constructor(J=1,Q=0.4,$=12,Z=48,W=Math.PI*2,K=0,H=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:Z,arc:W,thetaStart:K,thetaLength:H},$=Math.floor($),Z=Math.floor(Z);let Y=[],X=[],U=[],G=[],N=new P,E=new P,q=new P;for(let R=0;R<=$;R++){let O=K+R/$*H;for(let F=0;F<=Z;F++){let D=F/Z*W;E.x=(J+Q*Math.cos(O))*Math.cos(D),E.y=(J+Q*Math.cos(O))*Math.sin(D),E.z=Q*Math.sin(O),X.push(E.x,E.y,E.z),N.x=J*Math.cos(D),N.y=J*Math.sin(D),q.subVectors(E,N).normalize(),U.push(q.x,q.y,q.z),G.push(F/Z),G.push(R/$)}}for(let R=1;R<=$;R++)for(let O=1;O<=Z;O++){let F=(Z+1)*R+O-1,D=(Z+1)*(R-1)+O-1,k=(Z+1)*(R-1)+O,L=(Z+1)*R+O;Y.push(F,D,L),Y.push(D,k,L)}this.setIndex(Y),this.setAttribute("position",new V0(X,3)),this.setAttribute("normal",new V0(U,3)),this.setAttribute("uv",new V0(G,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new i6(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}};o6=class o6 extends l0{constructor(J=1,Q=0.4,$=64,Z=8,W=2,K=3){super();this.type="TorusKnotGeometry",this.parameters={radius:J,tube:Q,tubularSegments:$,radialSegments:Z,p:W,q:K},$=Math.floor($),Z=Math.floor(Z);let H=[],Y=[],X=[],U=[],G=new P,N=new P,E=new P,q=new P,R=new P,O=new P,F=new P;for(let k=0;k<=$;++k){let L=k/$*W*Math.PI*2;D(L,W,K,J,E),D(L+0.01,W,K,J,q),O.subVectors(q,E),F.addVectors(q,E),R.crossVectors(O,F),F.crossVectors(R,O),R.normalize(),F.normalize();for(let V=0;V<=Z;++V){let w=V/Z*Math.PI*2,_=-Q*Math.cos(w),A=Q*Math.sin(w);G.x=E.x+(_*F.x+A*R.x),G.y=E.y+(_*F.y+A*R.y),G.z=E.z+(_*F.z+A*R.z),Y.push(G.x,G.y,G.z),N.subVectors(G,E).normalize(),X.push(N.x,N.y,N.z),U.push(k/$),U.push(V/Z)}}for(let k=1;k<=$;k++)for(let L=1;L<=Z;L++){let V=(Z+1)*(k-1)+(L-1),w=(Z+1)*k+(L-1),_=(Z+1)*k+L,A=(Z+1)*(k-1)+L;H.push(V,w,A),H.push(w,_,A)}this.setIndex(H),this.setAttribute("position",new V0(Y,3)),this.setAttribute("normal",new V0(X,3)),this.setAttribute("uv",new V0(U,2));function D(k,L,V,w,_){let A=Math.cos(k),M=Math.sin(k),C=V/L*k,h=Math.cos(C);_.x=w*(2+h)*0.5*A,_.y=w*(2+h)*M*0.5,_.z=w*Math.sin(C)*0.5}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new o6(J.radius,J.tube,J.tubularSegments,J.radialSegments,J.p,J.q)}};a6=class a6 extends l0{constructor(J=new p6(new P(-1,-1,0),new P(-1,1,0),new P(1,1,0)),Q=64,$=1,Z=8,W=!1){super();this.type="TubeGeometry",this.parameters={path:J,tubularSegments:Q,radius:$,radialSegments:Z,closed:W};let K=J.computeFrenetFrames(Q,W);this.tangents=K.tangents,this.normals=K.normals,this.binormals=K.binormals;let H=new P,Y=new P,X=new r,U=new P,G=[],N=[],E=[],q=[];R(),this.setIndex(q),this.setAttribute("position",new V0(G,3)),this.setAttribute("normal",new V0(N,3)),this.setAttribute("uv",new V0(E,2));function R(){for(let k=0;k<Q;k++)O(k);O(W===!1?Q:0),D(),F()}function O(k){U=J.getPointAt(k/Q,U);let L=K.normals[k],V=K.binormals[k];for(let w=0;w<=Z;w++){let _=w/Z*Math.PI*2,A=Math.sin(_),M=-Math.cos(_);Y.x=M*L.x+A*V.x,Y.y=M*L.y+A*V.y,Y.z=M*L.z+A*V.z,Y.normalize(),N.push(Y.x,Y.y,Y.z),H.x=U.x+$*Y.x,H.y=U.y+$*Y.y,H.z=U.z+$*Y.z,G.push(H.x,H.y,H.z)}}function F(){for(let k=1;k<=Q;k++)for(let L=1;L<=Z;L++){let V=(Z+1)*(k-1)+(L-1),w=(Z+1)*k+(L-1),_=(Z+1)*k+L,A=(Z+1)*(k-1)+L;q.push(V,w,A),q.push(w,_,A)}}function D(){for(let k=0;k<=Q;k++)for(let L=0;L<=Z;L++)X.x=k/Q,X.y=L/Z,E.push(X.x,X.y)}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON();return J.path=this.parameters.path.toJSON(),J}static fromJSON(J){return new a6(new K$[J.path.type]().fromJSON(J.path),J.tubularSegments,J.radius,J.radialSegments,J.closed)}};BZ=class BZ extends l0{constructor(J=null){super();if(this.type="WireframeGeometry",this.parameters={geometry:J},J!==null){let Q=[],$=new Set,Z=new P,W=new P;if(J.index!==null){let K=J.attributes.position,H=J.index,Y=J.groups;if(Y.length===0)Y=[{start:0,count:H.count,materialIndex:0}];for(let X=0,U=Y.length;X<U;++X){let G=Y[X],N=G.start,E=G.count;for(let q=N,R=N+E;q<R;q+=3)for(let O=0;O<3;O++){let F=H.getX(q+O),D=H.getX(q+(O+1)%3);if(Z.fromBufferAttribute(K,F),W.fromBufferAttribute(K,D),qX(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}}else{let K=J.attributes.position;for(let H=0,Y=K.count/3;H<Y;H++)for(let X=0;X<3;X++){let U=3*H+X,G=3*H+(X+1)%3;if(Z.fromBufferAttribute(K,U),W.fromBufferAttribute(K,G),qX(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}this.setAttribute("position",new V0(Q,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}};DX=Object.freeze({__proto__:null,BoxGeometry:q8,CapsuleGeometry:v6,CircleGeometry:f6,ConeGeometry:p7,CylinderGeometry:g7,DodecahedronGeometry:b6,EdgesGeometry:RZ,ExtrudeGeometry:d6,IcosahedronGeometry:l6,LatheGeometry:u6,OctahedronGeometry:d7,PlaneGeometry:c8,PolyhedronGeometry:l9,RingGeometry:c6,ShapeGeometry:n6,SphereGeometry:l7,TetrahedronGeometry:s6,TorusGeometry:i6,TorusKnotGeometry:o6,TubeGeometry:a6,WireframeGeometry:BZ});zZ=class zZ extends PJ{constructor(J){super();this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new M0(0),this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.fog=J.fog,this}};FH={clone:n8,merge:hJ};iJ=class iJ extends PJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=wE,this.fragmentShader=PE,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=n8(J.uniforms),this.uniformsGroups=CE(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 K=this.uniforms[Z].value;if(K&&K.isTexture)Q.uniforms[Z]={type:"t",value:K.toJSON(J).uuid};else if(K&&K.isColor)Q.uniforms[Z]={type:"c",value:K.getHex()};else if(K&&K.isVector2)Q.uniforms[Z]={type:"v2",value:K.toArray()};else if(K&&K.isVector3)Q.uniforms[Z]={type:"v3",value:K.toArray()};else if(K&&K.isVector4)Q.uniforms[Z]={type:"v4",value:K.toArray()};else if(K&&K.isMatrix3)Q.uniforms[Z]={type:"m3",value:K.toArray()};else if(K&&K.isMatrix4)Q.uniforms[Z]={type:"m4",value:K.toArray()};else Q.uniforms[Z]={value:K}}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}};r6=class r6 extends iJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};t6=class t6 extends PJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new M0(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 M0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(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 sJ,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}};IZ=class IZ extends t6{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 r(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return p0(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 M0(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 M0(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new M0(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}};_Z=class _Z extends PJ{constructor(J){super();this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new M0(16777215),this.specular=new M0(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new M0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sJ,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.specular.copy(J.specular),this.shininess=J.shininess,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}};AZ=class AZ extends PJ{constructor(J){super();this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new M0(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new M0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.gradientMap=J.gradientMap,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}};CZ=class CZ extends PJ{constructor(J){super();this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(J)}copy(J){return super.copy(J),this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this}};wZ=class wZ extends PJ{constructor(J){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new M0(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new M0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sJ,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}};e6=class e6 extends PJ{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}};JQ=class JQ extends PJ{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}};PZ=class PZ extends PJ{constructor(J){super();this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new M0(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={MATCAP:""},this.color.copy(J.color),this.matcap=J.matcap,this.map=J.map,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this.fog=J.fog,this}};TZ=class TZ extends jJ{constructor(J){super();this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(J)}copy(J){return super.copy(J),this.scale=J.scale,this.dashSize=J.dashSize,this.gapSize=J.gapSize,this}};SZ=class SZ extends D8{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,K=J+1,H=Z[W],Y=Z[K];if(H===void 0)switch(this.getSettings_().endingStart){case 2401:W=J,H=2*Q-$;break;case 2402:W=Z.length-2,H=Q+Z[W]-Z[W+1];break;default:W=J,H=$}if(Y===void 0)switch(this.getSettings_().endingEnd){case 2401:K=J,Y=2*$-Q;break;case 2402:K=1,Y=$+Z[1]-Z[0];break;default:K=J-1,Y=Q}let X=($-Q)*0.5,U=this.valueSize;this._weightPrev=X/(Q-H),this._weightNext=X/(Y-$),this._offsetPrev=W*U,this._offsetNext=K*U}interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,H=this.valueSize,Y=J*H,X=Y-H,U=this._offsetPrev,G=this._offsetNext,N=this._weightPrev,E=this._weightNext,q=($-Q)/(Z-Q),R=q*q,O=R*q,F=-N*O+2*N*R-N*q,D=(1+N)*O+(-1.5-2*N)*R+(-0.5+N)*q+1,k=(-1-E)*O+(1.5+E)*R+0.5*q,L=E*O-E*R;for(let V=0;V!==H;++V)W[V]=F*K[U+V]+D*K[X+V]+k*K[Y+V]+L*K[G+V];return W}};QQ=class QQ extends D8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,H=this.valueSize,Y=J*H,X=Y-H,U=($-Q)/(Z-Q),G=1-U;for(let N=0;N!==H;++N)W[N]=K[X+N]*G+K[Y+N]*U;return W}};jZ=class jZ extends D8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}};yZ=class yZ extends D8{interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,H=this.valueSize,Y=J*H,X=Y-H,U=this.settings||this.DefaultSettings_,G=U.inTangents,N=U.outTangents;if(!G||!N){let R=($-Q)/(Z-Q),O=1-R;for(let F=0;F!==H;++F)W[F]=K[X+F]*O+K[Y+F]*R;return W}let E=H*2,q=J-1;for(let R=0;R!==H;++R){let O=K[X+R],F=K[Y+R],D=q*E+R*2,k=N[D],L=N[D+1],V=J*E+R*2,w=G[V],_=G[V+1],A=($-Q)/(Z-Q),M,C,h,S,b;for(let l=0;l<8;l++){M=A*A,C=M*A,h=1-A,S=h*h,b=S*h;let c=b*Q+3*S*A*k+3*h*M*w+C*Z-$;if(Math.abs(c)<0.0000000001)break;let x=3*S*(k-Q)+6*h*A*(w-k)+3*M*(Z-w);if(Math.abs(x)<0.0000000001)break;A=A-c/x,A=Math.max(0,Math.min(1,A))}W[R]=b*O+3*S*A*L+3*h*M*_+C*F}return W}};oJ.prototype.ValueTypeName="";oJ.prototype.TimeBufferType=Float32Array;oJ.prototype.ValueBufferType=Float32Array;oJ.prototype.DefaultInterpolation=2301;u9=class u9 extends oJ{constructor(J,Q,$){super(J,Q,$)}};u9.prototype.ValueTypeName="bool";u9.prototype.ValueBufferType=Array;u9.prototype.DefaultInterpolation=2300;u9.prototype.InterpolantFactoryMethodLinear=void 0;u9.prototype.InterpolantFactoryMethodSmooth=void 0;$Q=class $Q extends oJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}};$Q.prototype.ValueTypeName="color";v8=class v8 extends oJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}};v8.prototype.ValueTypeName="number";vZ=class vZ extends D8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,H=this.valueSize,Y=($-Q)/(Z-Q),X=J*H;for(let U=X+H;X!==U;X+=4)SJ.slerpFlat(W,0,K,X-H,K,X,Y);return W}};s8=class s8 extends oJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new vZ(this.times,this.values,this.getValueSize(),J)}};s8.prototype.ValueTypeName="quaternion";s8.prototype.InterpolantFactoryMethodSmooth=void 0;c9=class c9 extends oJ{constructor(J,Q,$){super(J,Q,$)}};c9.prototype.ValueTypeName="string";c9.prototype.ValueBufferType=Array;c9.prototype.DefaultInterpolation=2300;c9.prototype.InterpolantFactoryMethodLinear=void 0;c9.prototype.InterpolantFactoryMethodSmooth=void 0;f8=class f8 extends oJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}};f8.prototype.ValueTypeName="vector";N9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(FX(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(FX(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};kH=new ZQ;xJ.DEFAULT_MATERIAL_NAME="__DEFAULT";h9={};UG=class UG extends Error{constructor(J,Q){super(J);this.response=Q}};q9=class q9 extends xJ{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=N9.get(`file:${J}`);if(W!==void 0)return this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0),W;if(h9[J]!==void 0){h9[J].push({onLoad:Q,onProgress:$,onError:Z});return}h9[J]=[],h9[J].push({onLoad:Q,onProgress:$,onError:Z});let K=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}),H=this.mimeType,Y=this.responseType;fetch(K).then((X)=>{if(X.status===200||X.status===0){if(X.status===0)U0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||X.body===void 0||X.body.getReader===void 0)return X;let U=h9[J],G=X.body.getReader(),N=X.headers.get("X-File-Size")||X.headers.get("Content-Length"),E=N?parseInt(N):0,q=E!==0,R=0,O=new ReadableStream({start(F){D();function D(){G.read().then(({done:k,value:L})=>{if(k)F.close();else{R+=L.byteLength;let V=new ProgressEvent("progress",{lengthComputable:q,loaded:R,total:E});for(let w=0,_=U.length;w<_;w++){let A=U[w];if(A.onProgress)A.onProgress(V)}F.enqueue(L),D()}},(k)=>{F.error(k)})}}});return new Response(O)}else throw new UG(`fetch for "${X.url}" responded with ${X.status}: ${X.statusText}`,X)}).then((X)=>{switch(Y){case"arraybuffer":return X.arrayBuffer();case"blob":return X.blob();case"document":return X.text().then((U)=>{return new DOMParser().parseFromString(U,H)});case"json":return X.json();default:if(H==="")return X.text();else{let G=/charset="?([^;"\s]*)"?/i.exec(H),N=G&&G[1]?G[1].toLowerCase():void 0,E=new TextDecoder(N);return X.arrayBuffer().then((q)=>E.decode(q))}}}).then((X)=>{N9.add(`file:${J}`,X);let U=h9[J];delete h9[J];for(let G=0,N=U.length;G<N;G++){let E=U[G];if(E.onLoad)E.onLoad(X)}}).catch((X)=>{let U=h9[J];if(U===void 0)throw this.manager.itemError(J),X;delete h9[J];for(let G=0,N=U.length;G<N;G++){let E=U[G];if(E.onError)E.onError(X)}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}};MH=class MH extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new q9(this.manager);K.setPath(this.path),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(H){try{Q(W.parse(JSON.parse(H)))}catch(Y){if(Z)Z(Y);else S0(Y);W.manager.itemError(J)}},$,Z)}parse(J){let Q=[];for(let $=0;$<J.length;$++){let Z=b8.parse(J[$]);Q.push(Z)}return Q}};LH=class LH extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=[],H=new x7,Y=new q9(this.manager);Y.setPath(this.path),Y.setResponseType("arraybuffer"),Y.setRequestHeader(this.requestHeader),Y.setWithCredentials(W.withCredentials);let X=0;function U(G){Y.load(J[G],function(N){let E=W.parse(N,!0);if(K[G]={width:E.width,height:E.height,format:E.format,mipmaps:E.mipmaps},X+=1,X===6){if(E.mipmapCount===1)H.minFilter=1006;if(H.image=K,H.format=E.format,H.needsUpdate=!0,Q)Q(H)}},$,Z)}if(Array.isArray(J))for(let G=0,N=J.length;G<N;++G)U(G);else Y.load(J,function(G){let N=W.parse(G,!0);if(N.isCubemap){let E=N.mipmaps.length/N.mipmapCount;for(let q=0;q<E;q++){K[q]={mipmaps:[]};for(let R=0;R<N.mipmapCount;R++)K[q].mipmaps.push(N.mipmaps[q*N.mipmapCount+R]),K[q].format=N.format,K[q].width=N.width,K[q].height=N.height}H.image=K}else H.image.width=N.width,H.image.height=N.height,H.mipmaps=N.mipmaps;if(N.mipmapCount===1)H.minFilter=1006;if(H.format=N.format,H.needsUpdate=!0,Q)Q(H)},$,Z);return H}};F7=new WeakMap;h8=class h8 extends xJ{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,K=N9.get(`image:${J}`);if(K!==void 0){if(K.complete===!0)W.manager.itemStart(J),setTimeout(function(){if(Q)Q(K);W.manager.itemEnd(J)},0);else{let G=F7.get(K);if(G===void 0)G=[],F7.set(K,G);G.push({onLoad:Q,onError:Z})}return K}let H=B7("img");function Y(){if(U(),Q)Q(this);let G=F7.get(this)||[];for(let N=0;N<G.length;N++){let E=G[N];if(E.onLoad)E.onLoad(this)}F7.delete(this),W.manager.itemEnd(J)}function X(G){if(U(),Z)Z(G);N9.remove(`image:${J}`);let N=F7.get(this)||[];for(let E=0;E<N.length;E++){let q=N[E];if(q.onError)q.onError(G)}F7.delete(this),W.manager.itemError(J),W.manager.itemEnd(J)}function U(){H.removeEventListener("load",Y,!1),H.removeEventListener("error",X,!1)}if(H.addEventListener("load",Y,!1),H.addEventListener("error",X,!1),J.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)H.crossOrigin=this.crossOrigin}return N9.add(`image:${J}`,H),W.manager.itemStart(J),H.src=J,H}};VH=class VH extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new u8;W.colorSpace="srgb";let K=new h8(this.manager);K.setCrossOrigin(this.crossOrigin),K.setPath(this.path);let H=0;function Y(X){K.load(J[X],function(U){if(W.images[X]=U,H++,H===6){if(W.needsUpdate=!0,Q)Q(W)}},void 0,Z)}for(let X=0;X<J.length;++X)Y(X);return W}};BH=class BH extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new J9,H=new q9(this.manager);return H.setResponseType("arraybuffer"),H.setRequestHeader(this.requestHeader),H.setPath(this.path),H.setWithCredentials(W.withCredentials),H.load(J,function(Y){let X;try{X=W.parse(Y)}catch(U){if(Z!==void 0)Z(U);else{U(U);return}}if(X.image!==void 0)K.image=X.image;else if(X.data!==void 0)K.image.width=X.width,K.image.height=X.height,K.image.data=X.data;if(K.wrapS=X.wrapS!==void 0?X.wrapS:1001,K.wrapT=X.wrapT!==void 0?X.wrapT:1001,K.magFilter=X.magFilter!==void 0?X.magFilter:1006,K.minFilter=X.minFilter!==void 0?X.minFilter:1006,K.anisotropy=X.anisotropy!==void 0?X.anisotropy:1,X.colorSpace!==void 0)K.colorSpace=X.colorSpace;if(X.flipY!==void 0)K.flipY=X.flipY;if(X.format!==void 0)K.format=X.format;if(X.type!==void 0)K.type=X.type;if(X.mipmaps!==void 0)K.mipmaps=X.mipmaps,K.minFilter=1008;if(X.mipmapCount===1)K.minFilter=1006;if(X.generateMipmaps!==void 0)K.generateMipmaps=X.generateMipmaps;if(K.needsUpdate=!0,Q)Q(K,X)},$,Z),K}};zH=class zH extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new FJ,K=new h8(this.manager);return K.setCrossOrigin(this.crossOrigin),K.setPath(this.path),K.load(J,function(H){if(W.image=H,W.needsUpdate=!0,Q!==void 0)Q(W)},$,Z),W}};P9=class P9 extends $J{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new M0(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}};fZ=class fZ extends P9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy($J.DEFAULT_UP),this.updateMatrix(),this.groundColor=new M0(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}};mW=new m0,RX=new P,OX=new P;iQ=new P,oQ=new SJ,B9=new P;u7=class u7 extends $J{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new m0,this.projectionMatrix=new m0,this.projectionMatrixInverse=new m0,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(iQ,oQ,B9),B9.x===1&&B9.y===1&&B9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(iQ,oQ,B9.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(iQ,oQ,B9),B9.x===1&&B9.y===1&&B9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(iQ,oQ,B9.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}};e9=new P,kX=new r,MX=new r;BJ=class BJ extends u7{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=j8*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(S8*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return j8*2*Math.atan(Math.tan(S8*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,$){e9.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(e9.x,e9.y).multiplyScalar(-J/e9.z),e9.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(e9.x,e9.y).multiplyScalar(-J/e9.z)}getViewSize(J,Q){return this.getViewBounds(J,kX,MX),Q.subVectors(MX,kX)}setViewOffset(J,Q,$,Z,W,K){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=K,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=this.near,Q=J*Math.tan(S8*0.5*this.fov)/this.zoom,$=2*Q,Z=this.aspect*$,W=-0.5*Z,K=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:Y,fullHeight:X}=K;W+=K.offsetX*Z/Y,Q-=K.offsetY*$/X,Z*=K.width/Y,$*=K.height/X}let H=this.filmOffset;if(H!==0)W+=J*H/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}};GG=class GG extends bZ{constructor(){super(new BJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=j8*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}};hZ=class hZ extends P9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,K=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy($J.DEFAULT_UP),this.updateMatrix(),this.target=new $J,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=K,this.map=null,this.shadow=new GG}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}};EG=class EG extends bZ{constructor(){super(new BJ(90,1,0.5,500));this.isPointLightShadow=!0}};xZ=class xZ extends P9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new EG}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}};i8=class i8 extends u7{constructor(J=-1,Q=1,$=1,Z=-1,W=0.1,K=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=K,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,K){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=K,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,K=$+J,H=Z+Q,Y=Z-Q;if(this.view!==null&&this.view.enabled){let X=(this.right-this.left)/this.view.fullWidth/this.zoom,U=(this.top-this.bottom)/this.view.fullHeight/this.zoom;W+=X*this.view.offsetX,K=W+X*this.view.width,H-=U*this.view.offsetY,Y=H-U*this.view.height}this.projectionMatrix.makeOrthographic(W,K,H,Y,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}};NG=class NG extends bZ{constructor(){super(new i8(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}};gZ=class gZ extends P9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy($J.DEFAULT_UP),this.updateMatrix(),this.target=new $J,this.shadow=new NG}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}};pZ=class pZ extends P9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}};mZ=class mZ extends P9{constructor(J,Q,$=10,Z=10){super(J,Q);this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=$,this.height=Z}get power(){return this.intensity*this.width*this.height*Math.PI}set power(J){this.intensity=J/(this.width*this.height*Math.PI)}copy(J){return super.copy(J),this.width=J.width,this.height=J.height,this}toJSON(J){let Q=super.toJSON(J);return Q.object.width=this.width,Q.object.height=this.height,Q}};dZ=class dZ extends P9{constructor(J=new WQ,Q=1){super(void 0,Q);this.isLightProbe=!0,this.sh=J}copy(J){return super.copy(J),this.sh.copy(J.sh),this}toJSON(J){let Q=super.toJSON(J);return Q.object.sh=this.sh.toArray(),Q}};KQ=class KQ extends xJ{constructor(J){super(J);this.textures={}}load(J,Q,$,Z){let W=this,K=new q9(W.manager);K.setPath(W.path),K.setRequestHeader(W.requestHeader),K.setWithCredentials(W.withCredentials),K.load(J,function(H){try{Q(W.parse(JSON.parse(H)))}catch(Y){if(Z)Z(Y);else S0(Y);W.manager.itemError(J)}},$,Z)}parse(J){let Q=this.textures;function $(W){if(Q[W]===void 0)U0("MaterialLoader: Undefined texture",W);return Q[W]}let Z=this.createMaterialFromType(J.type);if(J.uuid!==void 0)Z.uuid=J.uuid;if(J.name!==void 0)Z.name=J.name;if(J.color!==void 0&&Z.color!==void 0)Z.color.setHex(J.color);if(J.roughness!==void 0)Z.roughness=J.roughness;if(J.metalness!==void 0)Z.metalness=J.metalness;if(J.sheen!==void 0)Z.sheen=J.sheen;if(J.sheenColor!==void 0)Z.sheenColor=new M0().setHex(J.sheenColor);if(J.sheenRoughness!==void 0)Z.sheenRoughness=J.sheenRoughness;if(J.emissive!==void 0&&Z.emissive!==void 0)Z.emissive.setHex(J.emissive);if(J.specular!==void 0&&Z.specular!==void 0)Z.specular.setHex(J.specular);if(J.specularIntensity!==void 0)Z.specularIntensity=J.specularIntensity;if(J.specularColor!==void 0&&Z.specularColor!==void 0)Z.specularColor.setHex(J.specularColor);if(J.shininess!==void 0)Z.shininess=J.shininess;if(J.clearcoat!==void 0)Z.clearcoat=J.clearcoat;if(J.clearcoatRoughness!==void 0)Z.clearcoatRoughness=J.clearcoatRoughness;if(J.dispersion!==void 0)Z.dispersion=J.dispersion;if(J.iridescence!==void 0)Z.iridescence=J.iridescence;if(J.iridescenceIOR!==void 0)Z.iridescenceIOR=J.iridescenceIOR;if(J.iridescenceThicknessRange!==void 0)Z.iridescenceThicknessRange=J.iridescenceThicknessRange;if(J.transmission!==void 0)Z.transmission=J.transmission;if(J.thickness!==void 0)Z.thickness=J.thickness;if(J.attenuationDistance!==void 0)Z.attenuationDistance=J.attenuationDistance;if(J.attenuationColor!==void 0&&Z.attenuationColor!==void 0)Z.attenuationColor.setHex(J.attenuationColor);if(J.anisotropy!==void 0)Z.anisotropy=J.anisotropy;if(J.anisotropyRotation!==void 0)Z.anisotropyRotation=J.anisotropyRotation;if(J.fog!==void 0)Z.fog=J.fog;if(J.flatShading!==void 0)Z.flatShading=J.flatShading;if(J.blending!==void 0)Z.blending=J.blending;if(J.combine!==void 0)Z.combine=J.combine;if(J.side!==void 0)Z.side=J.side;if(J.shadowSide!==void 0)Z.shadowSide=J.shadowSide;if(J.opacity!==void 0)Z.opacity=J.opacity;if(J.transparent!==void 0)Z.transparent=J.transparent;if(J.alphaTest!==void 0)Z.alphaTest=J.alphaTest;if(J.alphaHash!==void 0)Z.alphaHash=J.alphaHash;if(J.depthFunc!==void 0)Z.depthFunc=J.depthFunc;if(J.depthTest!==void 0)Z.depthTest=J.depthTest;if(J.depthWrite!==void 0)Z.depthWrite=J.depthWrite;if(J.colorWrite!==void 0)Z.colorWrite=J.colorWrite;if(J.blendSrc!==void 0)Z.blendSrc=J.blendSrc;if(J.blendDst!==void 0)Z.blendDst=J.blendDst;if(J.blendEquation!==void 0)Z.blendEquation=J.blendEquation;if(J.blendSrcAlpha!==void 0)Z.blendSrcAlpha=J.blendSrcAlpha;if(J.blendDstAlpha!==void 0)Z.blendDstAlpha=J.blendDstAlpha;if(J.blendEquationAlpha!==void 0)Z.blendEquationAlpha=J.blendEquationAlpha;if(J.blendColor!==void 0&&Z.blendColor!==void 0)Z.blendColor.setHex(J.blendColor);if(J.blendAlpha!==void 0)Z.blendAlpha=J.blendAlpha;if(J.stencilWriteMask!==void 0)Z.stencilWriteMask=J.stencilWriteMask;if(J.stencilFunc!==void 0)Z.stencilFunc=J.stencilFunc;if(J.stencilRef!==void 0)Z.stencilRef=J.stencilRef;if(J.stencilFuncMask!==void 0)Z.stencilFuncMask=J.stencilFuncMask;if(J.stencilFail!==void 0)Z.stencilFail=J.stencilFail;if(J.stencilZFail!==void 0)Z.stencilZFail=J.stencilZFail;if(J.stencilZPass!==void 0)Z.stencilZPass=J.stencilZPass;if(J.stencilWrite!==void 0)Z.stencilWrite=J.stencilWrite;if(J.wireframe!==void 0)Z.wireframe=J.wireframe;if(J.wireframeLinewidth!==void 0)Z.wireframeLinewidth=J.wireframeLinewidth;if(J.wireframeLinecap!==void 0)Z.wireframeLinecap=J.wireframeLinecap;if(J.wireframeLinejoin!==void 0)Z.wireframeLinejoin=J.wireframeLinejoin;if(J.rotation!==void 0)Z.rotation=J.rotation;if(J.linewidth!==void 0)Z.linewidth=J.linewidth;if(J.dashSize!==void 0)Z.dashSize=J.dashSize;if(J.gapSize!==void 0)Z.gapSize=J.gapSize;if(J.scale!==void 0)Z.scale=J.scale;if(J.polygonOffset!==void 0)Z.polygonOffset=J.polygonOffset;if(J.polygonOffsetFactor!==void 0)Z.polygonOffsetFactor=J.polygonOffsetFactor;if(J.polygonOffsetUnits!==void 0)Z.polygonOffsetUnits=J.polygonOffsetUnits;if(J.dithering!==void 0)Z.dithering=J.dithering;if(J.alphaToCoverage!==void 0)Z.alphaToCoverage=J.alphaToCoverage;if(J.premultipliedAlpha!==void 0)Z.premultipliedAlpha=J.premultipliedAlpha;if(J.forceSinglePass!==void 0)Z.forceSinglePass=J.forceSinglePass;if(J.allowOverride!==void 0)Z.allowOverride=J.allowOverride;if(J.visible!==void 0)Z.visible=J.visible;if(J.toneMapped!==void 0)Z.toneMapped=J.toneMapped;if(J.userData!==void 0)Z.userData=J.userData;if(J.vertexColors!==void 0)if(typeof J.vertexColors==="number")Z.vertexColors=J.vertexColors>0?!0:!1;else Z.vertexColors=J.vertexColors;if(J.uniforms!==void 0)for(let W in J.uniforms){let K=J.uniforms[W];switch(Z.uniforms[W]={},K.type){case"t":Z.uniforms[W].value=$(K.value);break;case"c":Z.uniforms[W].value=new M0().setHex(K.value);break;case"v2":Z.uniforms[W].value=new r().fromArray(K.value);break;case"v3":Z.uniforms[W].value=new P().fromArray(K.value);break;case"v4":Z.uniforms[W].value=new GJ().fromArray(K.value);break;case"m3":Z.uniforms[W].value=new c0().fromArray(K.value);break;case"m4":Z.uniforms[W].value=new m0().fromArray(K.value);break;default:Z.uniforms[W].value=K.value}}if(J.defines!==void 0)Z.defines=J.defines;if(J.vertexShader!==void 0)Z.vertexShader=J.vertexShader;if(J.fragmentShader!==void 0)Z.fragmentShader=J.fragmentShader;if(J.glslVersion!==void 0)Z.glslVersion=J.glslVersion;if(J.extensions!==void 0)for(let W in J.extensions)Z.extensions[W]=J.extensions[W];if(J.lights!==void 0)Z.lights=J.lights;if(J.clipping!==void 0)Z.clipping=J.clipping;if(J.size!==void 0)Z.size=J.size;if(J.sizeAttenuation!==void 0)Z.sizeAttenuation=J.sizeAttenuation;if(J.map!==void 0)Z.map=$(J.map);if(J.matcap!==void 0)Z.matcap=$(J.matcap);if(J.alphaMap!==void 0)Z.alphaMap=$(J.alphaMap);if(J.bumpMap!==void 0)Z.bumpMap=$(J.bumpMap);if(J.bumpScale!==void 0)Z.bumpScale=J.bumpScale;if(J.normalMap!==void 0)Z.normalMap=$(J.normalMap);if(J.normalMapType!==void 0)Z.normalMapType=J.normalMapType;if(J.normalScale!==void 0){let W=J.normalScale;if(Array.isArray(W)===!1)W=[W,W];Z.normalScale=new r().fromArray(W)}if(J.displacementMap!==void 0)Z.displacementMap=$(J.displacementMap);if(J.displacementScale!==void 0)Z.displacementScale=J.displacementScale;if(J.displacementBias!==void 0)Z.displacementBias=J.displacementBias;if(J.roughnessMap!==void 0)Z.roughnessMap=$(J.roughnessMap);if(J.metalnessMap!==void 0)Z.metalnessMap=$(J.metalnessMap);if(J.emissiveMap!==void 0)Z.emissiveMap=$(J.emissiveMap);if(J.emissiveIntensity!==void 0)Z.emissiveIntensity=J.emissiveIntensity;if(J.specularMap!==void 0)Z.specularMap=$(J.specularMap);if(J.specularIntensityMap!==void 0)Z.specularIntensityMap=$(J.specularIntensityMap);if(J.specularColorMap!==void 0)Z.specularColorMap=$(J.specularColorMap);if(J.envMap!==void 0)Z.envMap=$(J.envMap);if(J.envMapRotation!==void 0)Z.envMapRotation.fromArray(J.envMapRotation);if(J.envMapIntensity!==void 0)Z.envMapIntensity=J.envMapIntensity;if(J.reflectivity!==void 0)Z.reflectivity=J.reflectivity;if(J.refractionRatio!==void 0)Z.refractionRatio=J.refractionRatio;if(J.lightMap!==void 0)Z.lightMap=$(J.lightMap);if(J.lightMapIntensity!==void 0)Z.lightMapIntensity=J.lightMapIntensity;if(J.aoMap!==void 0)Z.aoMap=$(J.aoMap);if(J.aoMapIntensity!==void 0)Z.aoMapIntensity=J.aoMapIntensity;if(J.gradientMap!==void 0)Z.gradientMap=$(J.gradientMap);if(J.clearcoatMap!==void 0)Z.clearcoatMap=$(J.clearcoatMap);if(J.clearcoatRoughnessMap!==void 0)Z.clearcoatRoughnessMap=$(J.clearcoatRoughnessMap);if(J.clearcoatNormalMap!==void 0)Z.clearcoatNormalMap=$(J.clearcoatNormalMap);if(J.clearcoatNormalScale!==void 0)Z.clearcoatNormalScale=new r().fromArray(J.clearcoatNormalScale);if(J.iridescenceMap!==void 0)Z.iridescenceMap=$(J.iridescenceMap);if(J.iridescenceThicknessMap!==void 0)Z.iridescenceThicknessMap=$(J.iridescenceThicknessMap);if(J.transmissionMap!==void 0)Z.transmissionMap=$(J.transmissionMap);if(J.thicknessMap!==void 0)Z.thicknessMap=$(J.thicknessMap);if(J.anisotropyMap!==void 0)Z.anisotropyMap=$(J.anisotropyMap);if(J.sheenColorMap!==void 0)Z.sheenColorMap=$(J.sheenColorMap);if(J.sheenRoughnessMap!==void 0)Z.sheenRoughnessMap=$(J.sheenRoughnessMap);return Z}setTextures(J){return this.textures=J,this}createMaterialFromType(J){return KQ.createMaterialFromType(J)}static createMaterialFromType(J){return new{ShadowMaterial:zZ,SpriteMaterial:w6,RawShaderMaterial:r6,ShaderMaterial:iJ,PointsMaterial:j6,MeshPhysicalMaterial:IZ,MeshStandardMaterial:t6,MeshPhongMaterial:_Z,MeshToonMaterial:AZ,MeshNormalMaterial:CZ,MeshLambertMaterial:wZ,MeshDepthMaterial:e6,MeshDistanceMaterial:JQ,MeshBasicMaterial:w9,MeshMatcapMaterial:PZ,LineDashedMaterial:TZ,LineBasicMaterial:jJ,Material:PJ}[J]}};lZ=class lZ extends l0{constructor(){super();this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(J){return super.copy(J),this.instanceCount=J.instanceCount,this}toJSON(){let J=super.toJSON();return J.instanceCount=this.instanceCount,J.isInstancedBufferGeometry=!0,J}};uZ=class uZ extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new q9(W.manager);K.setPath(W.path),K.setRequestHeader(W.requestHeader),K.setWithCredentials(W.withCredentials),K.load(J,function(H){try{Q(W.parse(JSON.parse(H)))}catch(Y){if(Z)Z(Y);else S0(Y);W.manager.itemError(J)}},$,Z)}parse(J){let Q={},$={};function Z(E,q){if(Q[q]!==void 0)return Q[q];let O=E.interleavedBuffers[q],F=W(E,O.buffer),D=L7(O.type,F),k=new h7(D,O.stride);return k.uuid=O.uuid,Q[q]=k,k}function W(E,q){if($[q]!==void 0)return $[q];let O=E.arrayBuffers[q],F=new Uint32Array(O).buffer;return $[q]=F,F}let K=J.isInstancedBufferGeometry?new lZ:new l0,H=J.data.index;if(H!==void 0){let E=L7(H.type,H.array);K.setIndex(new KJ(E,1))}let Y=J.data.attributes;for(let E in Y){let q=Y[E],R;if(q.isInterleavedBufferAttribute){let O=Z(J.data,q.data);R=new Z8(O,q.itemSize,q.offset,q.normalized)}else{let O=L7(q.type,q.array);R=new(q.isInstancedBufferAttribute?W8:KJ)(O,q.itemSize,q.normalized)}if(q.name!==void 0)R.name=q.name;if(q.usage!==void 0)R.setUsage(q.usage);K.setAttribute(E,R)}let X=J.data.morphAttributes;if(X)for(let E in X){let q=X[E],R=[];for(let O=0,F=q.length;O<F;O++){let D=q[O],k;if(D.isInterleavedBufferAttribute){let L=Z(J.data,D.data);k=new Z8(L,D.itemSize,D.offset,D.normalized)}else{let L=L7(D.type,D.array);k=new KJ(L,D.itemSize,D.normalized)}if(D.name!==void 0)k.name=D.name;R.push(k)}K.morphAttributes[E]=R}if(J.data.morphTargetsRelative)K.morphTargetsRelative=!0;let G=J.data.groups||J.data.drawcalls||J.data.offsets;if(G!==void 0)for(let E=0,q=G.length;E!==q;++E){let R=G[E];K.addGroup(R.start,R.count,R.materialIndex)}let N=J.data.boundingSphere;if(N!==void 0)K.boundingSphere=new zJ().fromJSON(N);if(J.name)K.name=J.name;if(J.userData)K.userData=J.userData;return K}};IH=class IH extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=this.path===""?N6.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||K;let H=new q9(this.manager);H.setPath(this.path),H.setRequestHeader(this.requestHeader),H.setWithCredentials(this.withCredentials),H.load(J,function(Y){let X=null;try{X=JSON.parse(Y)}catch(G){if(Z!==void 0)Z(G);G("ObjectLoader: Can't parse "+J+".",G.message);return}let U=X.metadata;if(U===void 0||U.type===void 0||U.type.toLowerCase()==="geometry"){if(Z!==void 0)Z(Error("THREE.ObjectLoader: Can't load "+J));S0("ObjectLoader: Can't load "+J);return}W.parse(X,Q)},$,Z)}async loadAsync(J,Q){let $=this,Z=this.path===""?N6.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||Z;let W=new q9(this.manager);W.setPath(this.path),W.setRequestHeader(this.requestHeader),W.setWithCredentials(this.withCredentials);let K=await W.loadAsync(J,Q),H;try{H=JSON.parse(K)}catch(X){throw Error("ObjectLoader: Can't parse "+J+". "+X.message)}let Y=H.metadata;if(Y===void 0||Y.type===void 0||Y.type.toLowerCase()==="geometry")throw Error("THREE.ObjectLoader: Can't load "+J);return await $.parseAsync(H)}parse(J,Q){let $=this.parseAnimations(J.animations),Z=this.parseShapes(J.shapes),W=this.parseGeometries(J.geometries,Z),K=this.parseImages(J.images,function(){if(Q!==void 0)Q(X)}),H=this.parseTextures(J.textures,K),Y=this.parseMaterials(J.materials,H),X=this.parseObject(J.object,W,Y,H,$),U=this.parseSkeletons(J.skeletons,X);if(this.bindSkeletons(X,U),this.bindLightTargets(X),Q!==void 0){let G=!1;for(let N in K)if(K[N].data instanceof HTMLImageElement){G=!0;break}if(G===!1)Q(X)}return X}async parseAsync(J){let Q=this.parseAnimations(J.animations),$=this.parseShapes(J.shapes),Z=this.parseGeometries(J.geometries,$),W=await this.parseImagesAsync(J.images),K=this.parseTextures(J.textures,W),H=this.parseMaterials(J.materials,K),Y=this.parseObject(J.object,Z,H,K,Q),X=this.parseSkeletons(J.skeletons,Y);return this.bindSkeletons(Y,X),this.bindLightTargets(Y),Y}parseShapes(J){let Q={};if(J!==void 0)for(let $=0,Z=J.length;$<Z;$++){let W=new p9().fromJSON(J[$]);Q[W.uuid]=W}return Q}parseSkeletons(J,Q){let $={},Z={};if(Q.traverse(function(W){if(W.isBone)Z[W.uuid]=W}),J!==void 0)for(let W=0,K=J.length;W<K;W++){let H=new T6().fromJSON(J[W],Z);$[H.uuid]=H}return $}parseGeometries(J,Q){let $={};if(J!==void 0){let Z=new uZ;for(let W=0,K=J.length;W<K;W++){let H,Y=J[W];switch(Y.type){case"BufferGeometry":case"InstancedBufferGeometry":H=Z.parse(Y);break;default:if(Y.type in DX)H=DX[Y.type].fromJSON(Y,Q);else U0(`ObjectLoader: Unsupported geometry type "${Y.type}"`)}if(H.uuid=Y.uuid,Y.name!==void 0)H.name=Y.name;if(Y.userData!==void 0)H.userData=Y.userData;$[Y.uuid]=H}}return $}parseMaterials(J,Q){let $={},Z={};if(J!==void 0){let W=new KQ;W.setTextures(Q);for(let K=0,H=J.length;K<H;K++){let Y=J[K];if($[Y.uuid]===void 0)$[Y.uuid]=W.parse(Y);Z[Y.uuid]=$[Y.uuid]}}return Z}parseAnimations(J){let Q={};if(J!==void 0)for(let $=0;$<J.length;$++){let Z=J[$],W=b8.parse(Z);Q[W.uuid]=W}return Q}parseImages(J,Q){let $=this,Z={},W;function K(Y){return $.manager.itemStart(Y),W.load(Y,function(){$.manager.itemEnd(Y)},void 0,function(){$.manager.itemError(Y),$.manager.itemEnd(Y)})}function H(Y){if(typeof Y==="string"){let X=Y,U=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(X)?X:$.resourcePath+X;return K(U)}else if(Y.data)return{data:L7(Y.type,Y.data),width:Y.width,height:Y.height};else return null}if(J!==void 0&&J.length>0){let Y=new ZQ(Q);W=new h8(Y),W.setCrossOrigin(this.crossOrigin);for(let X=0,U=J.length;X<U;X++){let G=J[X],N=G.url;if(Array.isArray(N)){let E=[];for(let q=0,R=N.length;q<R;q++){let O=N[q],F=H(O);if(F!==null)if(F instanceof HTMLImageElement)E.push(F);else E.push(new J9(F.data,F.width,F.height))}Z[G.uuid]=new I9(E)}else{let E=H(G.url);Z[G.uuid]=new I9(E)}}}return Z}async parseImagesAsync(J){let Q=this,$={},Z;async function W(K){if(typeof K==="string"){let H=K,Y=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(H)?H:Q.resourcePath+H;return await Z.loadAsync(Y)}else if(K.data)return{data:L7(K.type,K.data),width:K.width,height:K.height};else return null}if(J!==void 0&&J.length>0){Z=new h8(this.manager),Z.setCrossOrigin(this.crossOrigin);for(let K=0,H=J.length;K<H;K++){let Y=J[K],X=Y.url;if(Array.isArray(X)){let U=[];for(let G=0,N=X.length;G<N;G++){let E=X[G],q=await W(E);if(q!==null)if(q instanceof HTMLImageElement)U.push(q);else U.push(new J9(q.data,q.width,q.height))}$[Y.uuid]=new I9(U)}else{let U=await W(Y.url);$[Y.uuid]=new I9(U)}}}return $}parseTextures(J,Q){function $(W,K){if(typeof W==="number")return W;return U0("ObjectLoader.parseTexture: Constant should be in numeric form.",W),K[W]}let Z={};if(J!==void 0)for(let W=0,K=J.length;W<K;W++){let H=J[W];if(H.image===void 0)U0('ObjectLoader: No "image" specified for',H.uuid);if(Q[H.image]===void 0)U0("ObjectLoader: Undefined image",H.image);let Y=Q[H.image],X=Y.data,U;if(Array.isArray(X)){if(U=new u8,X.length===6)U.needsUpdate=!0}else{if(X&&X.data)U=new J9;else U=new FJ;if(X)U.needsUpdate=!0}if(U.source=Y,U.uuid=H.uuid,H.name!==void 0)U.name=H.name;if(H.mapping!==void 0)U.mapping=$(H.mapping,vE);if(H.channel!==void 0)U.channel=H.channel;if(H.offset!==void 0)U.offset.fromArray(H.offset);if(H.repeat!==void 0)U.repeat.fromArray(H.repeat);if(H.center!==void 0)U.center.fromArray(H.center);if(H.rotation!==void 0)U.rotation=H.rotation;if(H.wrap!==void 0)U.wrapS=$(H.wrap[0],LX),U.wrapT=$(H.wrap[1],LX);if(H.format!==void 0)U.format=H.format;if(H.internalFormat!==void 0)U.internalFormat=H.internalFormat;if(H.type!==void 0)U.type=H.type;if(H.colorSpace!==void 0)U.colorSpace=H.colorSpace;if(H.minFilter!==void 0)U.minFilter=$(H.minFilter,VX);if(H.magFilter!==void 0)U.magFilter=$(H.magFilter,VX);if(H.anisotropy!==void 0)U.anisotropy=H.anisotropy;if(H.flipY!==void 0)U.flipY=H.flipY;if(H.generateMipmaps!==void 0)U.generateMipmaps=H.generateMipmaps;if(H.premultiplyAlpha!==void 0)U.premultiplyAlpha=H.premultiplyAlpha;if(H.unpackAlignment!==void 0)U.unpackAlignment=H.unpackAlignment;if(H.compareFunction!==void 0)U.compareFunction=H.compareFunction;if(H.userData!==void 0)U.userData=H.userData;Z[H.uuid]=U}return Z}parseObject(J,Q,$,Z,W){let K;function H(N){if(Q[N]===void 0)U0("ObjectLoader: Undefined geometry",N);return Q[N]}function Y(N){if(N===void 0)return;if(Array.isArray(N)){let E=[];for(let q=0,R=N.length;q<R;q++){let O=N[q];if($[O]===void 0)U0("ObjectLoader: Undefined material",O);E.push($[O])}return E}if($[N]===void 0)U0("ObjectLoader: Undefined material",N);return $[N]}function X(N){if(Z[N]===void 0)U0("ObjectLoader: Undefined texture",N);return Z[N]}let U,G;switch(J.type){case"Scene":if(K=new HZ,J.background!==void 0)if(Number.isInteger(J.background))K.background=new M0(J.background);else K.background=X(J.background);if(J.environment!==void 0)K.environment=X(J.environment);if(J.fog!==void 0){if(J.fog.type==="Fog")K.fog=new _6(J.fog.color,J.fog.near,J.fog.far);else if(J.fog.type==="FogExp2")K.fog=new I6(J.fog.color,J.fog.density);if(J.fog.name!=="")K.fog.name=J.fog.name}if(J.backgroundBlurriness!==void 0)K.backgroundBlurriness=J.backgroundBlurriness;if(J.backgroundIntensity!==void 0)K.backgroundIntensity=J.backgroundIntensity;if(J.backgroundRotation!==void 0)K.backgroundRotation.fromArray(J.backgroundRotation);if(J.environmentIntensity!==void 0)K.environmentIntensity=J.environmentIntensity;if(J.environmentRotation!==void 0)K.environmentRotation.fromArray(J.environmentRotation);break;case"PerspectiveCamera":if(K=new BJ(J.fov,J.aspect,J.near,J.far),J.focus!==void 0)K.focus=J.focus;if(J.zoom!==void 0)K.zoom=J.zoom;if(J.filmGauge!==void 0)K.filmGauge=J.filmGauge;if(J.filmOffset!==void 0)K.filmOffset=J.filmOffset;if(J.view!==void 0)K.view=Object.assign({},J.view);break;case"OrthographicCamera":if(K=new i8(J.left,J.right,J.top,J.bottom,J.near,J.far),J.zoom!==void 0)K.zoom=J.zoom;if(J.view!==void 0)K.view=Object.assign({},J.view);break;case"AmbientLight":K=new pZ(J.color,J.intensity);break;case"DirectionalLight":K=new gZ(J.color,J.intensity),K.target=J.target||"";break;case"PointLight":K=new xZ(J.color,J.intensity,J.distance,J.decay);break;case"RectAreaLight":K=new mZ(J.color,J.intensity,J.width,J.height);break;case"SpotLight":K=new hZ(J.color,J.intensity,J.distance,J.angle,J.penumbra,J.decay),K.target=J.target||"";break;case"HemisphereLight":K=new fZ(J.color,J.groundColor,J.intensity);break;case"LightProbe":let N=new WQ().fromArray(J.sh);K=new dZ(N,J.intensity);break;case"SkinnedMesh":if(U=H(J.geometry),G=Y(J.material),K=new UZ(U,G),J.bindMode!==void 0)K.bindMode=J.bindMode;if(J.bindMatrix!==void 0)K.bindMatrix.fromArray(J.bindMatrix);if(J.skeleton!==void 0)K.skeleton=J.skeleton;break;case"Mesh":U=H(J.geometry),G=Y(J.material),K=new kJ(U,G);break;case"InstancedMesh":U=H(J.geometry),G=Y(J.material);let{count:E,instanceMatrix:q,instanceColor:R}=J;if(K=new GZ(U,G,E),K.instanceMatrix=new W8(new Float32Array(q.array),16),R!==void 0)K.instanceColor=new W8(new Float32Array(R.array),R.itemSize);break;case"BatchedMesh":if(U=H(J.geometry),G=Y(J.material),K=new EZ(J.maxInstanceCount,J.maxVertexCount,J.maxIndexCount,G),K.geometry=U,K.perObjectFrustumCulled=J.perObjectFrustumCulled,K.sortObjects=J.sortObjects,K._drawRanges=J.drawRanges,K._reservedRanges=J.reservedRanges,K._geometryInfo=J.geometryInfo.map((O)=>{let F=null,D=null;if(O.boundingBox!==void 0)F=new wJ().fromJSON(O.boundingBox);if(O.boundingSphere!==void 0)D=new zJ().fromJSON(O.boundingSphere);return{...O,boundingBox:F,boundingSphere:D}}),K._instanceInfo=J.instanceInfo,K._availableInstanceIds=J._availableInstanceIds,K._availableGeometryIds=J._availableGeometryIds,K._nextIndexStart=J.nextIndexStart,K._nextVertexStart=J.nextVertexStart,K._geometryCount=J.geometryCount,K._maxInstanceCount=J.maxInstanceCount,K._maxVertexCount=J.maxVertexCount,K._maxIndexCount=J.maxIndexCount,K._geometryInitialized=J.geometryInitialized,K._matricesTexture=X(J.matricesTexture.uuid),K._indirectTexture=X(J.indirectTexture.uuid),J.colorsTexture!==void 0)K._colorsTexture=X(J.colorsTexture.uuid);if(J.boundingSphere!==void 0)K.boundingSphere=new zJ().fromJSON(J.boundingSphere);if(J.boundingBox!==void 0)K.boundingBox=new wJ().fromJSON(J.boundingBox);break;case"LOD":K=new XZ;break;case"Line":K=new _9(H(J.geometry),Y(J.material));break;case"LineLoop":K=new NZ(H(J.geometry),Y(J.material));break;case"LineSegments":K=new Y9(H(J.geometry),Y(J.material));break;case"PointCloud":case"Points":K=new qZ(H(J.geometry),Y(J.material));break;case"Sprite":K=new YZ(Y(J.material));break;case"Group":K=new Q8;break;case"Bone":K=new P6;break;default:K=new $J}if(K.uuid=J.uuid,J.name!==void 0)K.name=J.name;if(J.matrix!==void 0){if(K.matrix.fromArray(J.matrix),J.matrixAutoUpdate!==void 0)K.matrixAutoUpdate=J.matrixAutoUpdate;if(K.matrixAutoUpdate)K.matrix.decompose(K.position,K.quaternion,K.scale)}else{if(J.position!==void 0)K.position.fromArray(J.position);if(J.rotation!==void 0)K.rotation.fromArray(J.rotation);if(J.quaternion!==void 0)K.quaternion.fromArray(J.quaternion);if(J.scale!==void 0)K.scale.fromArray(J.scale)}if(J.up!==void 0)K.up.fromArray(J.up);if(J.pivot!==void 0)K.pivot=new P().fromArray(J.pivot);if(J.morphTargetDictionary!==void 0)K.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);if(J.morphTargetInfluences!==void 0)K.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.castShadow!==void 0)K.castShadow=J.castShadow;if(J.receiveShadow!==void 0)K.receiveShadow=J.receiveShadow;if(J.shadow){if(J.shadow.intensity!==void 0)K.shadow.intensity=J.shadow.intensity;if(J.shadow.bias!==void 0)K.shadow.bias=J.shadow.bias;if(J.shadow.normalBias!==void 0)K.shadow.normalBias=J.shadow.normalBias;if(J.shadow.radius!==void 0)K.shadow.radius=J.shadow.radius;if(J.shadow.mapSize!==void 0)K.shadow.mapSize.fromArray(J.shadow.mapSize);if(J.shadow.camera!==void 0)K.shadow.camera=this.parseObject(J.shadow.camera)}if(J.visible!==void 0)K.visible=J.visible;if(J.frustumCulled!==void 0)K.frustumCulled=J.frustumCulled;if(J.renderOrder!==void 0)K.renderOrder=J.renderOrder;if(J.static!==void 0)K.static=J.static;if(J.userData!==void 0)K.userData=J.userData;if(J.layers!==void 0)K.layers.mask=J.layers;if(J.children!==void 0){let N=J.children;for(let E=0;E<N.length;E++)K.add(this.parseObject(N[E],Q,$,Z,W))}if(J.animations!==void 0){let N=J.animations;for(let E=0;E<N.length;E++){let q=N[E];K.animations.push(W[q])}}if(J.type==="LOD"){if(J.autoUpdate!==void 0)K.autoUpdate=J.autoUpdate;let N=J.levels;for(let E=0;E<N.length;E++){let q=N[E],R=K.getObjectByProperty("uuid",q.object);if(R!==void 0)K.addLevel(R,q.distance,q.hysteresis)}}return K}bindSkeletons(J,Q){if(Object.keys(Q).length===0)return;J.traverse(function($){if($.isSkinnedMesh===!0&&$.skeleton!==void 0){let Z=Q[$.skeleton];if(Z===void 0)U0("ObjectLoader: No skeleton found with UUID:",$.skeleton);else $.bind(Z,$.bindMatrix)}})}bindLightTargets(J){J.traverse(function(Q){if(Q.isDirectionalLight||Q.isSpotLight){let $=Q.target,Z=J.getObjectByProperty("uuid",$);if(Z!==void 0)Q.target=Z;else Q.target=new $J}})}};vE={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},LX={RepeatWrapping:1000,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},VX={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008},dW=new WeakMap;_H=class _H extends xJ{constructor(J){super(J);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")U0("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")U0("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,K=N9.get(`image-bitmap:${J}`);if(K!==void 0){if(W.manager.itemStart(J),K.then){K.then((X)=>{if(dW.has(K)===!0){if(Z)Z(dW.get(K));W.manager.itemError(J),W.manager.itemEnd(J)}else{if(Q)Q(X);return W.manager.itemEnd(J),X}});return}return setTimeout(function(){if(Q)Q(K);W.manager.itemEnd(J)},0),K}let H={};H.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",H.headers=this.requestHeader,H.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let Y=fetch(J,H).then(function(X){return X.blob()}).then(function(X){return createImageBitmap(X,Object.assign(W.options,{colorSpaceConversion:"none"}))}).then(function(X){if(N9.add(`image-bitmap:${J}`,X),Q)Q(X);return W.manager.itemEnd(J),X}).catch(function(X){if(Z)Z(X);dW.set(Y,X),N9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});N9.add(`image-bitmap:${J}`,Y),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};AH=class AH extends xJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new q9(this.manager);K.setResponseType("arraybuffer"),K.setPath(this.path),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(Y){try{let X=Y.slice(0);HQ.getContext().decodeAudioData(X,function(G){Q(G)}).catch(H)}catch(X){H(X)}},$,Z);function H(Y){if(Z)Z(Y);else S0(Y);W.manager.itemError(J)}}};BX=new m0,zX=new m0,I8=new m0;cZ=class cZ extends $J{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new BJ(R7,O7,J,Q);Z.layers=this.layers,this.add(Z);let W=new BJ(R7,O7,J,Q);W.layers=this.layers,this.add(W);let K=new BJ(R7,O7,J,Q);K.layers=this.layers,this.add(K);let H=new BJ(R7,O7,J,Q);H.layers=this.layers,this.add(H);let Y=new BJ(R7,O7,J,Q);Y.layers=this.layers,this.add(Y);let X=new BJ(R7,O7,J,Q);X.layers=this.layers,this.add(X)}updateCoordinateSystem(){let J=this.coordinateSystem,Q=this.children.concat(),[$,Z,W,K,H,Y]=Q;for(let X of Q)this.remove(X);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),K.up.set(0,0,1),K.lookAt(0,-1,0),H.up.set(0,1,0),H.lookAt(0,0,1),Y.up.set(0,1,0),Y.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),K.up.set(0,0,-1),K.lookAt(0,-1,0),H.up.set(0,-1,0),H.lookAt(0,0,1),Y.up.set(0,-1,0),Y.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+J);for(let X of Q)this.add(X),X.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,K,H,Y,X,U]=this.children,G=J.getRenderTarget(),N=J.getActiveCubeFace(),E=J.getActiveMipmapLevel(),q=J.xr.enabled;J.xr.enabled=!1;let R=$.texture.generateMipmaps;$.texture.generateMipmaps=!1;let O=!1;if(J.isWebGLRenderer===!0)O=J.state.buffers.depth.getReversed();else O=J.reversedDepthBuffer;if(J.setRenderTarget($,0,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,W),J.setRenderTarget($,1,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,K),J.setRenderTarget($,2,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,H),J.setRenderTarget($,3,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,Y),J.setRenderTarget($,4,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,X),$.texture.generateMipmaps=R,J.setRenderTarget($,5,Z),O&&J.autoClear===!1)J.clearDepth();J.render(Q,U),J.setRenderTarget(G,N,E),J.xr.enabled=q,$.texture.needsPMREMUpdate=!0}};nZ=class nZ extends BJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}};_8=new P,lW=new SJ,bE=new P,A8=new P,C8=new P;wH=class wH extends $J{constructor(){super();this.type="AudioListener",this.context=HQ.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new sZ}getInput(){return this.gain}removeFilter(){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null;return this}getFilter(){return this.filter}setFilter(J){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination);else this.gain.disconnect(this.context.destination);return this.filter=J,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}updateMatrixWorld(J){super.updateMatrixWorld(J),this._timer.update();let Q=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(_8,lW,bE),A8.set(0,0,-1).applyQuaternion(lW),C8.set(0,1,0).applyQuaternion(lW),Q.positionX){let $=this.context.currentTime+this.timeDelta;Q.positionX.linearRampToValueAtTime(_8.x,$),Q.positionY.linearRampToValueAtTime(_8.y,$),Q.positionZ.linearRampToValueAtTime(_8.z,$),Q.forwardX.linearRampToValueAtTime(A8.x,$),Q.forwardY.linearRampToValueAtTime(A8.y,$),Q.forwardZ.linearRampToValueAtTime(A8.z,$),Q.upX.linearRampToValueAtTime(C8.x,$),Q.upY.linearRampToValueAtTime(C8.y,$),Q.upZ.linearRampToValueAtTime(C8.z,$)}else Q.setPosition(_8.x,_8.y,_8.z),Q.setOrientation(A8.x,A8.y,A8.z,C8.x,C8.y,C8.z)}};iZ=class iZ extends $J{constructor(J){super();this.type="Audio",this.listener=J,this.context=J.context,this.gain=this.context.createGain(),this.gain.connect(J.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(J){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=J,this.connect(),this}setMediaElementSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(J),this.connect(),this}setMediaStreamSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(J),this.connect(),this}setBuffer(J){if(this.buffer=J,this.sourceType="buffer",this.autoplay)this.play();return this}play(J=0){if(this.isPlaying===!0){U0("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){U0("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+J;let Q=this.context.createBufferSource();return Q.buffer=this.buffer,Q.loop=this.loop,Q.loopStart=this.loopStart,Q.loopEnd=this.loopEnd,Q.onended=this.onEnded.bind(this),Q.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Q,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){U0("Audio: this Audio has no playback control.");return}if(this.isPlaying===!0){if(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0)this._progress=this._progress%(this.duration||this.buffer.duration);this.source.stop(),this.source.onended=null,this.isPlaying=!1}return this}stop(J=0){if(this.hasPlaybackControl===!1){U0("Audio: this Audio has no playback control.");return}if(this._progress=0,this.source!==null)this.source.stop(this.context.currentTime+J),this.source.onended=null;return this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].connect(this.filters[J]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected===!1)return;if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].disconnect(this.filters[J]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(J){if(!J)J=[];if(this._connected===!0)this.disconnect(),this.filters=J.slice(),this.connect();else this.filters=J.slice();return this}setDetune(J){if(this.detune=J,this.isPlaying===!0&&this.source.detune!==void 0)this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,0.01);return this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(J){return this.setFilters(J?[J]:[])}setPlaybackRate(J){if(this.hasPlaybackControl===!1){U0("Audio: this Audio has no playback control.");return}if(this.playbackRate=J,this.isPlaying===!0)this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,0.01);return this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){if(this.hasPlaybackControl===!1)return U0("Audio: this Audio has no playback control."),!1;return this.loop}setLoop(J){if(this.hasPlaybackControl===!1){U0("Audio: this Audio has no playback control.");return}if(this.loop=J,this.isPlaying===!0)this.source.loop=this.loop;return this}setLoopStart(J){return this.loopStart=J,this}setLoopEnd(J){return this.loopEnd=J,this}getVolume(){return this.gain.gain.value}setVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}copy(J,Q){if(super.copy(J,Q),J.sourceType!=="buffer")return U0("Audio: Audio source type cannot be copied."),this;return this.autoplay=J.autoplay,this.buffer=J.buffer,this.detune=J.detune,this.loop=J.loop,this.loopStart=J.loopStart,this.loopEnd=J.loopEnd,this.offset=J.offset,this.duration=J.duration,this.playbackRate=J.playbackRate,this.hasPlaybackControl=J.hasPlaybackControl,this.sourceType=J.sourceType,this.filters=J.filters.slice(),this}clone(J){return new this.constructor(this.listener).copy(this,J)}};w8=new P,IX=new SJ,hE=new P,P8=new P;PH=class PH extends iZ{constructor(J){super(J);this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(J){return this.panner.refDistance=J,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(J){return this.panner.rolloffFactor=J,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(J){return this.panner.distanceModel=J,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(J){return this.panner.maxDistance=J,this}setDirectionalCone(J,Q,$){return this.panner.coneInnerAngle=J,this.panner.coneOuterAngle=Q,this.panner.coneOuterGain=$,this}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(w8,IX,hE),P8.set(0,0,1).applyQuaternion(IX);let Q=this.panner;if(Q.positionX){let $=this.context.currentTime+this.listener.timeDelta;Q.positionX.linearRampToValueAtTime(w8.x,$),Q.positionY.linearRampToValueAtTime(w8.y,$),Q.positionZ.linearRampToValueAtTime(w8.z,$),Q.orientationX.linearRampToValueAtTime(P8.x,$),Q.orientationY.linearRampToValueAtTime(P8.y,$),Q.orientationZ.linearRampToValueAtTime(P8.z,$)}else Q.setPosition(w8.x,w8.y,w8.z),Q.setOrientation(P8.x,P8.y,P8.z)}};xE=new RegExp("["+SH+"]","g"),jH="[^"+SH+"]",gE="[^"+SH.replace("\\.","")+"]",pE=/((?:WC+[\/:])*)/.source.replace("WC",jH),mE=/(WCOD+)?/.source.replace("WCOD",gE),dE=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",jH),lE=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",jH),uE=new RegExp("^"+pE+mE+dE+lE+"$"),cE=["material","materials","bones","map"];QJ.Composite=qG;QJ.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};QJ.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};QJ.prototype.GetterByBindingType=[QJ.prototype._getValue_direct,QJ.prototype._getValue_array,QJ.prototype._getValue_arrayElement,QJ.prototype._getValue_toArray];QJ.prototype.SetterByBindingTypeAndVersioning=[[QJ.prototype._setValue_direct,QJ.prototype._setValue_direct_setNeedsUpdate,QJ.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[QJ.prototype._setValue_array,QJ.prototype._setValue_array_setNeedsUpdate,QJ.prototype._setValue_array_setMatrixWorldNeedsUpdate],[QJ.prototype._setValue_arrayElement,QJ.prototype._setValue_arrayElement_setNeedsUpdate,QJ.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[QJ.prototype._setValue_fromArray,QJ.prototype._setValue_fromArray_setNeedsUpdate,QJ.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];nE=new Float32Array(1);vH=class vH extends H9{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,K=J._propertyBindings,H=J._interpolants,Y=$.uuid,X=this._bindingsByRootAndName,U=X[Y];if(U===void 0)U={},X[Y]=U;for(let G=0;G!==W;++G){let N=Z[G],E=N.name,q=U[E];if(q!==void 0)++q.referenceCount,K[G]=q;else{if(q=K[G],q!==void 0){if(q._cacheIndex===null)++q.referenceCount,this._addInactiveBinding(q,Y,E);continue}let R=Q&&Q._propertyBindings[G].binding.parsedPath;q=new oZ(QJ.create($,E,R),N.ValueTypeName,N.getValueSize()),++q.referenceCount,this._addInactiveBinding(q,Y,E),K[G]=q}H[G].resultBuffer=q.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,K=W[Q];if(K===void 0)K={knownActions:[J],actionByRoot:{}},J._byClipCacheIndex=0,W[Q]=K;else{let H=K.knownActions;J._byClipCacheIndex=H.length,H.push(J)}J._cacheIndex=Z.length,Z.push(J),K.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,K=this._actionsByClip,H=K[W],Y=H.knownActions,X=Y[Y.length-1],U=J._byClipCacheIndex;X._byClipCacheIndex=U,Y[U]=X,Y.pop(),J._byClipCacheIndex=null;let G=H.actionByRoot,N=(J._localRoot||this._root).uuid;if(delete G[N],Y.length===0)delete K[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,K=Z[Q];if(K===void 0)K={},Z[Q]=K;K[$]=J,J._cacheIndex=W.length,W.push(J)}_removeInactiveBinding(J){let Q=this._bindings,$=J.binding,Z=$.rootNode.uuid,W=$.path,K=this._bindingsByRootAndName,H=K[Z],Y=Q[Q.length-1],X=J._cacheIndex;if(Y._cacheIndex=X,Q[X]=Y,Q.pop(),delete H[W],Object.keys(H).length===0)delete K[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 QQ(new Float32Array(2),new Float32Array(2),1,nE),$.__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,K=typeof J==="string"?b8.findByName(Z,J):J,H=K!==null?K.uuid:J,Y=this._actionsByClip[H],X=null;if($===void 0)if(K!==null)$=K.blendMode;else $=2500;if(Y!==void 0){let G=Y.actionByRoot[W];if(G!==void 0&&G.blendMode===$)return G;if(X=Y.knownActions[0],K===null)K=X._clip}if(K===null)return null;let U=new aZ(this,K,Q,$);return this._bindAction(U,X),this._addInactiveAction(U,H,W),U}existingAction(J,Q){let $=Q||this._root,Z=$.uuid,W=typeof J==="string"?b8.findByName($,J):J,K=W?W.uuid:J,H=this._actionsByClip[K];if(H!==void 0)return H.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),K=this._accuIndex^=1;for(let X=0;X!==$;++X)Q[X]._update(Z,J,W,K);let H=this._bindings,Y=this._nActiveBindings;for(let X=0;X!==Y;++X)H[X].apply(K);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 K=W.knownActions;for(let H=0,Y=K.length;H!==Y;++H){let X=K[H];this._deactivateAction(X);let U=X._cacheIndex,G=Q[Q.length-1];X._cacheIndex=null,X._byClipCacheIndex=null,G._cacheIndex=U,Q[U]=G,Q.pop(),this._removeInactiveBindingsForAction(X)}delete Z[$]}}uncacheRoot(J){let Q=J.uuid,$=this._actionsByClip;for(let K in $){let H=$[K].actionByRoot,Y=H[Q];if(Y!==void 0)this._deactivateAction(Y),this._removeInactiveAction(Y)}let Z=this._bindingsByRootAndName,W=Z[Q];if(W!==void 0)for(let K in W){let H=W[K];H.restoreOriginalState(),this._removeInactiveBinding(H)}}uncacheAction(J,Q){let $=this.existingAction(J,Q);if($!==null)this._deactivateAction($),this._removeInactiveAction($)}};fH=class fH extends z6{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isRenderTarget3D=!0,this.depth=$,this.texture=new v7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}};bH=class bH extends H9{constructor(){super();this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:sE++}),this.name="",this.usage=35044,this.uniforms=[]}add(J){return this.uniforms.push(J),this}remove(J){let Q=this.uniforms.indexOf(J);if(Q!==-1)this.uniforms.splice(Q,1);return this}setName(J){return this.name=J,this}setUsage(J){return this.usage=J,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(J){this.name=J.name,this.usage=J.usage;let Q=J.uniforms;this.uniforms.length=0;for(let $=0,Z=Q.length;$<Z;$++){let W=Array.isArray(Q[$])?Q[$]:[Q[$]];for(let K=0;K<W.length;K++)this.uniforms.push(W[K].clone())}return this}clone(){return new this.constructor().copy(this)}};hH=class hH extends h7{constructor(J,Q,$=1){super(J,Q);this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=$}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}clone(J){let Q=super.clone(J);return Q.meshPerAttribute=this.meshPerAttribute,Q}toJSON(J){let Q=super.toJSON(J);return Q.isInstancedInterleavedBuffer=!0,Q.meshPerAttribute=this.meshPerAttribute,Q}};_X=new m0;CX=new r;wX=new P,rQ=new P,k7=new P,M7=new P,uW=new P,iE=new P,oE=new P;PX=new P;cH=class cH extends $J{constructor(J,Q){super();this.light=J,this.matrixAutoUpdate=!1,this.color=Q,this.type="SpotLightHelper";let $=new l0,Z=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let K=0,H=1,Y=32;K<Y;K++,H++){let X=K/Y*Math.PI*2,U=H/Y*Math.PI*2;Z.push(Math.cos(X),Math.sin(X),1,Math.cos(U),Math.sin(U),1)}$.setAttribute("position",new V0(Z,3));let W=new jJ({fog:!1,toneMapped:!1});this.cone=new Y9($,W),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent)this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld);else this.matrix.copy(this.light.matrixWorld);this.matrixWorld.copy(this.light.matrixWorld);let J=this.light.distance?this.light.distance:1000,Q=J*Math.tan(this.light.angle);if(this.cone.scale.set(Q,Q,J),PX.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(PX),this.color!==void 0)this.cone.material.color.set(this.color);else this.cone.material.color.copy(this.light.color)}};J8=new P,tQ=new m0,cW=new m0;nH=class nH extends Y9{constructor(J){let Q=DG(J),$=new l0,Z=[],W=[];for(let X=0;X<Q.length;X++){let U=Q[X];if(U.parent&&U.parent.isBone)Z.push(0,0,0),Z.push(0,0,0),W.push(0,0,0),W.push(0,0,0)}$.setAttribute("position",new V0(Z,3)),$.setAttribute("color",new V0(W,3));let K=new jJ({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super($,K);this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=J,this.bones=Q,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1;let H=new M0(255),Y=new M0(65280);this.setColors(H,Y)}updateMatrixWorld(J){let Q=this.bones,$=this.geometry,Z=$.getAttribute("position");cW.copy(this.root.matrixWorld).invert();for(let W=0,K=0;W<Q.length;W++){let H=Q[W];if(H.parent&&H.parent.isBone)tQ.multiplyMatrices(cW,H.matrixWorld),J8.setFromMatrixPosition(tQ),Z.setXYZ(K,J8.x,J8.y,J8.z),tQ.multiplyMatrices(cW,H.parent.matrixWorld),J8.setFromMatrixPosition(tQ),Z.setXYZ(K+1,J8.x,J8.y,J8.z),K+=2}$.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(J)}setColors(J,Q){let Z=this.geometry.getAttribute("color");for(let W=0;W<Z.count;W+=2)Z.setXYZ(W,J.r,J.g,J.b),Z.setXYZ(W+1,Q.r,Q.g,Q.b);return Z.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};sH=class sH extends kJ{constructor(J,Q,$){let Z=new l7(Q,4,2),W=new w9({wireframe:!0,fog:!1,toneMapped:!1});super(Z,W);this.light=J,this.color=$,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.color!==void 0)this.material.color.set(this.color);else this.material.color.copy(this.light.color)}};aE=new P,TX=new M0,SX=new M0;iH=class iH extends $J{constructor(J,Q,$){super();this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="HemisphereLightHelper";let Z=new d7(Q);if(Z.rotateY(Math.PI*0.5),this.material=new w9({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0)this.material.vertexColors=!0;let W=Z.getAttribute("position"),K=new Float32Array(W.count*3);Z.setAttribute("color",new KJ(K,3)),this.add(new kJ(Z,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let J=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let Q=J.geometry.getAttribute("color");TX.copy(this.light.color),SX.copy(this.light.groundColor);for(let $=0,Z=Q.count;$<Z;$++){let W=$<Z/2?TX:SX;Q.setXYZ($,W.r,W.g,W.b)}Q.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),J.lookAt(aE.setFromMatrixPosition(this.light.matrixWorld).negate())}};oH=class oH extends Y9{constructor(J=10,Q=10,$=4473924,Z=8947848){$=new M0($),Z=new M0(Z);let W=Q/2,K=J/Q,H=J/2,Y=[],X=[];for(let N=0,E=0,q=-H;N<=Q;N++,q+=K){Y.push(-H,0,q,H,0,q),Y.push(q,0,-H,q,0,H);let R=N===W?$:Z;R.toArray(X,E),E+=3,R.toArray(X,E),E+=3,R.toArray(X,E),E+=3,R.toArray(X,E),E+=3}let U=new l0;U.setAttribute("position",new V0(Y,3)),U.setAttribute("color",new V0(X,3));let G=new jJ({vertexColors:!0,toneMapped:!1});super(U,G);this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};aH=class aH extends Y9{constructor(J=10,Q=16,$=8,Z=64,W=4473924,K=8947848){W=new M0(W),K=new M0(K);let H=[],Y=[];if(Q>1)for(let G=0;G<Q;G++){let N=G/Q*(Math.PI*2),E=Math.sin(N)*J,q=Math.cos(N)*J;H.push(0,0,0),H.push(E,0,q);let R=G&1?W:K;Y.push(R.r,R.g,R.b),Y.push(R.r,R.g,R.b)}for(let G=0;G<$;G++){let N=G&1?W:K,E=J-J/$*G;for(let q=0;q<Z;q++){let R=q/Z*(Math.PI*2),O=Math.sin(R)*E,F=Math.cos(R)*E;H.push(O,0,F),Y.push(N.r,N.g,N.b),R=(q+1)/Z*(Math.PI*2),O=Math.sin(R)*E,F=Math.cos(R)*E,H.push(O,0,F),Y.push(N.r,N.g,N.b)}}let X=new l0;X.setAttribute("position",new V0(H,3)),X.setAttribute("color",new V0(Y,3));let U=new jJ({vertexColors:!0,toneMapped:!1});super(X,U);this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};jX=new P,eQ=new P,yX=new P;rH=class rH extends $J{constructor(J,Q,$){super();if(this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="DirectionalLightHelper",Q===void 0)Q=1;let Z=new l0;Z.setAttribute("position",new V0([-Q,Q,0,Q,Q,0,Q,-Q,0,-Q,-Q,0,-Q,Q,0],3));let W=new jJ({fog:!1,toneMapped:!1});this.lightPlane=new _9(Z,W),this.add(this.lightPlane),Z=new l0,Z.setAttribute("position",new V0([0,0,0,0,0,1],3)),this.targetLine=new _9(Z,W),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),jX.setFromMatrixPosition(this.light.matrixWorld),eQ.setFromMatrixPosition(this.light.target.matrixWorld),yX.subVectors(eQ,jX),this.lightPlane.lookAt(eQ),this.color!==void 0)this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color);else this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color);this.targetLine.lookAt(eQ),this.targetLine.scale.z=yX.length()}};J$=new P,OJ=new u7;tH=class tH extends Y9{constructor(J){let Q=new l0,$=new jJ({color:16777215,vertexColors:!0,toneMapped:!1}),Z=[],W=[],K={};H("n1","n2"),H("n2","n4"),H("n4","n3"),H("n3","n1"),H("f1","f2"),H("f2","f4"),H("f4","f3"),H("f3","f1"),H("n1","f1"),H("n2","f2"),H("n3","f3"),H("n4","f4"),H("p","n1"),H("p","n2"),H("p","n3"),H("p","n4"),H("u1","u2"),H("u2","u3"),H("u3","u1"),H("c","t"),H("p","c"),H("cn1","cn2"),H("cn3","cn4"),H("cf1","cf2"),H("cf3","cf4");function H(q,R){Y(q),Y(R)}function Y(q){if(Z.push(0,0,0),W.push(0,0,0),K[q]===void 0)K[q]=[];K[q].push(Z.length/3-1)}Q.setAttribute("position",new V0(Z,3)),Q.setAttribute("color",new V0(W,3));super(Q,$);if(this.type="CameraHelper",this.camera=J,this.camera.updateProjectionMatrix)this.camera.updateProjectionMatrix();this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=K,this.update();let X=new M0(16755200),U=new M0(16711680),G=new M0(43775),N=new M0(16777215),E=new M0(3355443);this.setColors(X,U,G,N,E)}setColors(J,Q,$,Z,W){let H=this.geometry.getAttribute("color");return H.setXYZ(0,J.r,J.g,J.b),H.setXYZ(1,J.r,J.g,J.b),H.setXYZ(2,J.r,J.g,J.b),H.setXYZ(3,J.r,J.g,J.b),H.setXYZ(4,J.r,J.g,J.b),H.setXYZ(5,J.r,J.g,J.b),H.setXYZ(6,J.r,J.g,J.b),H.setXYZ(7,J.r,J.g,J.b),H.setXYZ(8,J.r,J.g,J.b),H.setXYZ(9,J.r,J.g,J.b),H.setXYZ(10,J.r,J.g,J.b),H.setXYZ(11,J.r,J.g,J.b),H.setXYZ(12,J.r,J.g,J.b),H.setXYZ(13,J.r,J.g,J.b),H.setXYZ(14,J.r,J.g,J.b),H.setXYZ(15,J.r,J.g,J.b),H.setXYZ(16,J.r,J.g,J.b),H.setXYZ(17,J.r,J.g,J.b),H.setXYZ(18,J.r,J.g,J.b),H.setXYZ(19,J.r,J.g,J.b),H.setXYZ(20,J.r,J.g,J.b),H.setXYZ(21,J.r,J.g,J.b),H.setXYZ(22,J.r,J.g,J.b),H.setXYZ(23,J.r,J.g,J.b),H.setXYZ(24,Q.r,Q.g,Q.b),H.setXYZ(25,Q.r,Q.g,Q.b),H.setXYZ(26,Q.r,Q.g,Q.b),H.setXYZ(27,Q.r,Q.g,Q.b),H.setXYZ(28,Q.r,Q.g,Q.b),H.setXYZ(29,Q.r,Q.g,Q.b),H.setXYZ(30,Q.r,Q.g,Q.b),H.setXYZ(31,Q.r,Q.g,Q.b),H.setXYZ(32,$.r,$.g,$.b),H.setXYZ(33,$.r,$.g,$.b),H.setXYZ(34,$.r,$.g,$.b),H.setXYZ(35,$.r,$.g,$.b),H.setXYZ(36,$.r,$.g,$.b),H.setXYZ(37,$.r,$.g,$.b),H.setXYZ(38,Z.r,Z.g,Z.b),H.setXYZ(39,Z.r,Z.g,Z.b),H.setXYZ(40,W.r,W.g,W.b),H.setXYZ(41,W.r,W.g,W.b),H.setXYZ(42,W.r,W.g,W.b),H.setXYZ(43,W.r,W.g,W.b),H.setXYZ(44,W.r,W.g,W.b),H.setXYZ(45,W.r,W.g,W.b),H.setXYZ(46,W.r,W.g,W.b),H.setXYZ(47,W.r,W.g,W.b),H.setXYZ(48,W.r,W.g,W.b),H.setXYZ(49,W.r,W.g,W.b),H.needsUpdate=!0,this}update(){let J=this.geometry,Q=this.pointMap,$=1,Z=1,W,K;if(OJ.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)W=1,K=0;else if(this.camera.coordinateSystem===2000)W=-1,K=1;else if(this.camera.coordinateSystem===2001)W=0,K=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);LJ("c",Q,J,OJ,0,0,W),LJ("t",Q,J,OJ,0,0,K),LJ("n1",Q,J,OJ,-1,-1,W),LJ("n2",Q,J,OJ,1,-1,W),LJ("n3",Q,J,OJ,-1,1,W),LJ("n4",Q,J,OJ,1,1,W),LJ("f1",Q,J,OJ,-1,-1,K),LJ("f2",Q,J,OJ,1,-1,K),LJ("f3",Q,J,OJ,-1,1,K),LJ("f4",Q,J,OJ,1,1,K),LJ("u1",Q,J,OJ,0.7,1.1,W),LJ("u2",Q,J,OJ,-0.7,1.1,W),LJ("u3",Q,J,OJ,0,2,W),LJ("cf1",Q,J,OJ,-1,0,K),LJ("cf2",Q,J,OJ,1,0,K),LJ("cf3",Q,J,OJ,0,-1,K),LJ("cf4",Q,J,OJ,0,1,K),LJ("cn1",Q,J,OJ,-1,0,W),LJ("cn2",Q,J,OJ,1,0,W),LJ("cn3",Q,J,OJ,0,-1,W),LJ("cn4",Q,J,OJ,0,1,W),J.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};Q$=new wJ;eH=class eH extends Y9{constructor(J,Q=16776960){let $=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Z=new Float32Array(24),W=new l0;W.setIndex(new KJ($,1)),W.setAttribute("position",new KJ(Z,3));super(W,new jJ({color:Q,toneMapped:!1}));this.object=J,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0)Q$.setFromObject(this.object);if(Q$.isEmpty())return;let{min:J,max:Q}=Q$,$=this.geometry.attributes.position,Z=$.array;Z[0]=Q.x,Z[1]=Q.y,Z[2]=Q.z,Z[3]=J.x,Z[4]=Q.y,Z[5]=Q.z,Z[6]=J.x,Z[7]=J.y,Z[8]=Q.z,Z[9]=Q.x,Z[10]=J.y,Z[11]=Q.z,Z[12]=Q.x,Z[13]=Q.y,Z[14]=J.z,Z[15]=J.x,Z[16]=Q.y,Z[17]=J.z,Z[18]=J.x,Z[19]=J.y,Z[20]=J.z,Z[21]=Q.x,Z[22]=J.y,Z[23]=J.z,$.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(J){return this.object=J,this.update(),this}copy(J,Q){return super.copy(J,Q),this.object=J.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}};JY=class JY extends Y9{constructor(J,Q=16776960){let $=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Z=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],W=new l0;W.setIndex(new KJ($,1)),W.setAttribute("position",new V0(Z,3));super(W,new jJ({color:Q,toneMapped:!1}));this.box=J,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(J){let Q=this.box;if(Q.isEmpty())return;Q.getCenter(this.position),Q.getSize(this.scale),this.scale.multiplyScalar(0.5),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose()}};QY=class QY extends _9{constructor(J,Q=1,$=16776960){let Z=$,W=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],K=new l0;K.setAttribute("position",new V0(W,3)),K.computeBoundingSphere();super(K,new jJ({color:Z,toneMapped:!1}));this.type="PlaneHelper",this.plane=J,this.size=Q;let H=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],Y=new l0;Y.setAttribute("position",new V0(H,3)),Y.computeBoundingSphere(),this.add(new kJ(Y,new w9({color:Z,opacity:0.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(J){this.position.set(0,0,0),this.scale.set(0.5*this.size,0.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}};vX=new P;$Y=class $Y extends $J{constructor(J=new P(0,0,1),Q=new P(0,0,0),$=1,Z=16776960,W=$*0.2,K=W*0.2){super();if(this.type="ArrowHelper",$$===void 0)$$=new l0,$$.setAttribute("position",new V0([0,0,0,0,1,0],3)),nW=new p7(0.5,1,5,1),nW.translate(0,-0.5,0);this.position.copy(Q),this.line=new _9($$,new jJ({color:Z,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kJ(nW,new w9({color:Z,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(J),this.setLength($,W,K)}setDirection(J){if(J.y>0.99999)this.quaternion.set(0,0,0,1);else if(J.y<-0.99999)this.quaternion.set(1,0,0,0);else{vX.set(J.z,0,-J.x).normalize();let Q=Math.acos(J.y);this.quaternion.setFromAxisAngle(vX,Q)}}setLength(J,Q=J*0.2,$=Q*0.2){this.line.scale.set(1,Math.max(0.0001,J-Q),1),this.line.updateMatrix(),this.cone.scale.set($,Q,$),this.cone.position.y=J,this.cone.updateMatrix()}setColor(J){this.line.material.color.set(J),this.cone.material.color.set(J)}copy(J){return super.copy(J,!1),this.line.copy(J.line),this.cone.copy(J.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}};ZY=class ZY extends Y9{constructor(J=1){let Q=[0,0,0,J,0,0,0,0,0,0,J,0,0,0,0,0,0,J],$=[1,0,0,1,0.6,0,0,1,0,0.6,1,0,0,0,1,0,0.6,1],Z=new l0;Z.setAttribute("position",new V0(Q,3)),Z.setAttribute("color",new V0($,3));let W=new jJ({vertexColors:!0,toneMapped:!1});super(Z,W);this.type="AxesHelper"}setColors(J,Q,$){let Z=new M0,W=this.geometry.attributes.color.array;return Z.set(J),Z.toArray(W,0),Z.toArray(W,3),Z.set(Q),Z.toArray(W,6),Z.toArray(W,9),Z.set($),Z.toArray(W,12),Z.toArray(W,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};KY=class KY extends H9{constructor(J,Q=null){super();this.object=J,this.domElement=Q,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(J){if(J===void 0){U0("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=J}disconnect(){}dispose(){}update(){}};if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"183"}}));if(typeof window<"u")if(window.__THREE__)U0("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="183"});var HW={};Y5(HW,{warnOnce:()=>I7,warn:()=>U0,setConsoleFunction:()=>iU,log:()=>z7,getConsoleFunction:()=>oU,error:()=>S0,createCanvasElement:()=>rK,ZeroStencilOp:()=>RU,ZeroSlopeEnding:()=>$U,ZeroFactor:()=>YK,ZeroCurvatureEnding:()=>QU,WrapAroundEnding:()=>ZU,WireframeGeometry:()=>BZ,WebXRController:()=>b7,WebGPUCoordinateSystem:()=>dU,WebGLUtils:()=>sG,WebGLRenderer:()=>aG,WebGLRenderTarget:()=>uJ,WebGLCubeRenderTarget:()=>WW,WebGLCoordinateSystem:()=>WZ,WebGLArrayRenderTarget:()=>eK,WebGL3DRenderTarget:()=>JH,VideoTexture:()=>DZ,VideoFrameTexture:()=>XH,VectorKeyframeTrack:()=>f8,Vector4:()=>GJ,Vector3:()=>P,Vector2:()=>r,VSMShadowMap:()=>x8,UnsignedShortType:()=>S7,UnsignedShort5551Type:()=>L$,UnsignedShort4444Type:()=>M$,UnsignedIntType:()=>d9,UnsignedInt5999Type:()=>hK,UnsignedInt248Type:()=>d8,UnsignedInt101111Type:()=>xK,UnsignedByteType:()=>K9,UniformsUtils:()=>FH,UniformsLib:()=>F0,UniformsGroup:()=>bH,Uniform:()=>rZ,Uint8ClampedBufferAttribute:()=>WH,Uint8BufferAttribute:()=>ZH,Uint32BufferAttribute:()=>C6,Uint16BufferAttribute:()=>A6,UVMapping:()=>dX,TubeGeometry:()=>a6,TrianglesDrawMode:()=>HU,TriangleStripDrawMode:()=>YU,TriangleFanDrawMode:()=>XU,Triangle:()=>mJ,TorusKnotGeometry:()=>o6,TorusGeometry:()=>i6,TimestampQuery:()=>lU,Timer:()=>sZ,TextureUtils:()=>HY,TextureLoader:()=>zH,Texture:()=>FJ,TetrahedronGeometry:()=>s6,TangentSpaceNormalMap:()=>dK,TOUCH:()=>bX,SubtractiveBlending:()=>X$,SubtractEquation:()=>ZK,StringKeyframeTrack:()=>c9,StreamReadUsage:()=>hU,StreamDrawUsage:()=>vU,StreamCopyUsage:()=>pU,StereoCamera:()=>CH,StaticReadUsage:()=>fU,StaticDrawUsage:()=>jU,StaticCopyUsage:()=>xU,SrcColorFactor:()=>UK,SrcAlphaSaturateFactor:()=>OK,SrcAlphaFactor:()=>EK,SpriteMaterial:()=>w6,Sprite:()=>YZ,SpotLightHelper:()=>cH,SpotLight:()=>hZ,SplineCurve:()=>m6,SphericalHarmonics3:()=>WQ,Spherical:()=>mH,SphereGeometry:()=>l7,Sphere:()=>zJ,Source:()=>I9,SkinnedMesh:()=>UZ,SkeletonHelper:()=>nH,Skeleton:()=>T6,ShortType:()=>bK,ShapeUtils:()=>Z9,ShapePath:()=>WY,ShapeGeometry:()=>n6,Shape:()=>p9,ShadowMaterial:()=>zZ,ShaderMaterial:()=>iJ,ShaderLib:()=>O9,ShaderChunk:()=>a0,Scene:()=>HZ,SRGBTransfer:()=>EJ,SRGBColorSpace:()=>uK,SIGNED_RG11_EAC_Format:()=>v$,SIGNED_RED_RGTC1_Format:()=>e$,SIGNED_RED_GREEN_RGTC2_Format:()=>QZ,SIGNED_R11_EAC_Format:()=>j$,RingGeometry:()=>c6,ReverseSubtractEquation:()=>WK,ReplaceStencilOp:()=>kU,RepeatWrapping:()=>jK,RenderTarget3D:()=>fH,RenderTarget:()=>z6,ReinhardToneMapping:()=>N$,RedIntegerFormat:()=>V$,RedFormat:()=>mK,RectAreaLight:()=>mZ,Raycaster:()=>gH,Ray:()=>G8,RawShaderMaterial:()=>r6,RGIntegerFormat:()=>B$,RGFormat:()=>l8,RGDepthPacking:()=>NU,RGB_S3TC_DXT1_Format:()=>O6,RGB_PVRTC_4BPPV1_Format:()=>I$,RGB_PVRTC_2BPPV1_Format:()=>_$,RGB_ETC2_Format:()=>P$,RGB_ETC1_Format:()=>w$,RGB_BPTC_UNSIGNED_Format:()=>r$,RGB_BPTC_SIGNED_Format:()=>a$,RGBIntegerFormat:()=>sX,RGBFormat:()=>pK,RGBDepthPacking:()=>EU,RGBA_S3TC_DXT5_Format:()=>L6,RGBA_S3TC_DXT3_Format:()=>M6,RGBA_S3TC_DXT1_Format:()=>k6,RGBA_PVRTC_4BPPV1_Format:()=>A$,RGBA_PVRTC_2BPPV1_Format:()=>C$,RGBA_ETC2_EAC_Format:()=>T$,RGBA_BPTC_Format:()=>o$,RGBA_ASTC_8x8_Format:()=>d$,RGBA_ASTC_8x6_Format:()=>m$,RGBA_ASTC_8x5_Format:()=>p$,RGBA_ASTC_6x6_Format:()=>g$,RGBA_ASTC_6x5_Format:()=>x$,RGBA_ASTC_5x5_Format:()=>h$,RGBA_ASTC_5x4_Format:()=>b$,RGBA_ASTC_4x4_Format:()=>f$,RGBA_ASTC_12x12_Format:()=>i$,RGBA_ASTC_12x10_Format:()=>s$,RGBA_ASTC_10x8_Format:()=>c$,RGBA_ASTC_10x6_Format:()=>u$,RGBA_ASTC_10x5_Format:()=>l$,RGBA_ASTC_10x10_Format:()=>n$,RGBAIntegerFormat:()=>z$,RGBAFormat:()=>R9,RGBADepthPacking:()=>GU,RG11_EAC_Format:()=>y$,REVISION:()=>tW,RED_RGTC1_Format:()=>t$,RED_GREEN_RGTC2_Format:()=>JZ,R11_EAC_Format:()=>S$,QuaternionLinearInterpolant:()=>vZ,QuaternionKeyframeTrack:()=>s8,Quaternion:()=>SJ,QuadraticBezierCurve3:()=>p6,QuadraticBezierCurve:()=>g6,PropertyMixer:()=>oZ,PropertyBinding:()=>QJ,PositionalAudio:()=>PH,PolyhedronGeometry:()=>l9,PolarGridHelper:()=>aH,PointsMaterial:()=>j6,Points:()=>qZ,PointLightHelper:()=>sH,PointLight:()=>xZ,PlaneHelper:()=>QY,PlaneGeometry:()=>c8,Plane:()=>z9,PerspectiveCamera:()=>BJ,Path:()=>_7,PMREMGenerator:()=>$W,PCFSoftShadowMap:()=>QK,PCFShadowMap:()=>C7,OrthographicCamera:()=>i8,OneMinusSrcColorFactor:()=>GK,OneMinusSrcAlphaFactor:()=>NK,OneMinusDstColorFactor:()=>RK,OneMinusDstAlphaFactor:()=>DK,OneMinusConstantColorFactor:()=>MK,OneMinusConstantAlphaFactor:()=>VK,OneFactor:()=>XK,OctahedronGeometry:()=>d7,ObjectSpaceNormalMap:()=>lK,ObjectLoader:()=>IH,Object3D:()=>$J,NumberKeyframeTrack:()=>v8,NotEqualStencilFunc:()=>PU,NotEqualDepth:()=>wK,NotEqualCompare:()=>oK,NormalRGPacking:()=>DU,NormalGAPacking:()=>FU,NormalBlending:()=>w7,NormalAnimationBlendMode:()=>WU,NoToneMapping:()=>W9,NoNormalPacking:()=>qU,NoColorSpace:()=>U8,NoBlending:()=>F9,NeverStencilFunc:()=>IU,NeverDepth:()=>BK,NeverCompare:()=>cK,NeutralToneMapping:()=>O$,NearestMipmapNearestFilter:()=>vK,NearestMipmapLinearFilter:()=>T7,NearestMipMapNearestFilter:()=>lX,NearestMipMapLinearFilter:()=>uX,NearestFilter:()=>m9,MultiplyOperation:()=>PK,MultiplyBlending:()=>U$,MixOperation:()=>TK,MirroredRepeatWrapping:()=>yK,MinEquation:()=>KK,MeshToonMaterial:()=>AZ,MeshStandardMaterial:()=>t6,MeshPhysicalMaterial:()=>IZ,MeshPhongMaterial:()=>_Z,MeshNormalMaterial:()=>CZ,MeshMatcapMaterial:()=>PZ,MeshLambertMaterial:()=>wZ,MeshDistanceMaterial:()=>JQ,MeshDepthMaterial:()=>e6,MeshBasicMaterial:()=>w9,Mesh:()=>kJ,MaxEquation:()=>HK,Matrix4:()=>m0,Matrix3:()=>c0,Matrix2:()=>tZ,MathUtils:()=>eU,MaterialLoader:()=>KQ,MaterialBlending:()=>gX,Material:()=>PJ,MOUSE:()=>fX,LoopRepeat:()=>oX,LoopPingPong:()=>aX,LoopOnce:()=>iX,LoadingManager:()=>ZQ,LoaderUtils:()=>N6,Loader:()=>xJ,LinearTransfer:()=>$Z,LinearToneMapping:()=>E$,LinearSRGBColorSpace:()=>j7,LinearMipmapNearestFilter:()=>R6,LinearMipmapLinearFilter:()=>H8,LinearMipMapNearestFilter:()=>cX,LinearMipMapLinearFilter:()=>nX,LinearInterpolant:()=>QQ,LinearFilter:()=>lJ,LineSegments:()=>Y9,LineLoop:()=>NZ,LineDashedMaterial:()=>TZ,LineCurve3:()=>LZ,LineCurve:()=>x6,LineBasicMaterial:()=>jJ,Line3:()=>uH,Line:()=>_9,LightProbe:()=>dZ,Light:()=>P9,LessStencilFunc:()=>_U,LessEqualStencilFunc:()=>CU,LessEqualDepth:()=>G$,LessEqualCompare:()=>V6,LessDepth:()=>IK,LessCompare:()=>nK,Layers:()=>f7,LatheGeometry:()=>u6,LOD:()=>XZ,KeyframeTrack:()=>oJ,KeepStencilOp:()=>OU,InvertStencilOp:()=>zU,InterpolationSamplingType:()=>uU,InterpolationSamplingMode:()=>cU,InterpolateSmooth:()=>eX,InterpolateLinear:()=>tX,InterpolateDiscrete:()=>rX,InterpolateBezier:()=>JU,Interpolant:()=>D8,InterleavedBufferAttribute:()=>Z8,InterleavedBuffer:()=>h7,IntType:()=>k$,Int8BufferAttribute:()=>$H,Int32BufferAttribute:()=>HH,Int16BufferAttribute:()=>KH,InstancedMesh:()=>GZ,InstancedInterleavedBuffer:()=>hH,InstancedBufferGeometry:()=>lZ,InstancedBufferAttribute:()=>W8,IncrementWrapStencilOp:()=>VU,IncrementStencilOp:()=>MU,ImageUtils:()=>KZ,ImageLoader:()=>h8,ImageBitmapLoader:()=>_H,IcosahedronGeometry:()=>l6,HemisphereLightHelper:()=>iH,HemisphereLight:()=>fZ,HalfFloatType:()=>C9,Group:()=>Q8,GridHelper:()=>oH,GreaterStencilFunc:()=>wU,GreaterEqualStencilFunc:()=>TU,GreaterEqualDepth:()=>AK,GreaterEqualCompare:()=>B6,GreaterDepth:()=>CK,GreaterCompare:()=>iK,GLSL3:()=>ZZ,GLSL1:()=>mU,GLBufferAttribute:()=>xH,FrustumArray:()=>S6,Frustum:()=>E8,FrontSide:()=>g8,FramebufferTexture:()=>UH,FogExp2:()=>I6,Fog:()=>_6,FloatType:()=>A9,Float32BufferAttribute:()=>V0,Float16BufferAttribute:()=>YH,FileLoader:()=>q9,ExtrudeGeometry:()=>d6,ExternalTexture:()=>y6,EventDispatcher:()=>H9,Euler:()=>sJ,EquirectangularRefractionMapping:()=>D6,EquirectangularReflectionMapping:()=>q6,EqualStencilFunc:()=>AU,EqualDepth:()=>_K,EqualCompare:()=>sK,EllipseCurve:()=>m7,EdgesGeometry:()=>RZ,DynamicReadUsage:()=>bU,DynamicDrawUsage:()=>yU,DynamicCopyUsage:()=>gU,DstColorFactor:()=>FK,DstAlphaFactor:()=>qK,DoubleSide:()=>D9,DodecahedronGeometry:()=>b6,DiscreteInterpolant:()=>jZ,DirectionalLightHelper:()=>rH,DirectionalLight:()=>gZ,DetachedBindMode:()=>mX,DepthTexture:()=>N8,DepthStencilFormat:()=>X8,DepthFormat:()=>Y8,DefaultLoadingManager:()=>kH,DecrementWrapStencilOp:()=>BU,DecrementStencilOp:()=>LU,DataUtils:()=>QH,DataTextureLoader:()=>BH,DataTexture:()=>J9,DataArrayTexture:()=>y7,Data3DTexture:()=>v7,Cylindrical:()=>dH,CylinderGeometry:()=>g7,CustomToneMapping:()=>F$,CustomBlending:()=>$K,CurvePath:()=>VZ,Curve:()=>Q9,CullFaceNone:()=>eW,CullFaceFrontBack:()=>hX,CullFaceFront:()=>JK,CullFaceBack:()=>H$,CubicInterpolant:()=>SZ,CubicBezierCurve3:()=>MZ,CubicBezierCurve:()=>h6,CubeUVReflectionMapping:()=>P7,CubeTextureLoader:()=>VH,CubeTexture:()=>u8,CubeRefractionMapping:()=>K8,CubeReflectionMapping:()=>m8,CubeDepthTexture:()=>FZ,CubeCamera:()=>cZ,Controls:()=>KY,ConstantColorFactor:()=>kK,ConstantAlphaFactor:()=>LK,ConeGeometry:()=>p7,CompressedTextureLoader:()=>LH,CompressedTexture:()=>x7,CompressedCubeTexture:()=>EH,CompressedArrayTexture:()=>GH,Compatibility:()=>nU,ColorManagement:()=>e0,ColorKeyframeTrack:()=>$Q,Color:()=>M0,Clock:()=>pH,ClampToEdgeWrapping:()=>F6,CircleGeometry:()=>f6,CineonToneMapping:()=>q$,CatmullRomCurve3:()=>kZ,CapsuleGeometry:()=>v6,CanvasTexture:()=>NH,CameraHelper:()=>tH,Camera:()=>u7,Cache:()=>N9,ByteType:()=>fK,BufferGeometryLoader:()=>uZ,BufferGeometry:()=>l0,BufferAttribute:()=>KJ,BoxHelper:()=>eH,BoxGeometry:()=>q8,Box3Helper:()=>JY,Box3:()=>wJ,Box2:()=>lH,BooleanKeyframeTrack:()=>u9,Bone:()=>P6,BezierInterpolant:()=>yZ,BatchedMesh:()=>EZ,BasicShadowMap:()=>xX,BasicDepthPacking:()=>UU,BackSide:()=>dJ,AxesHelper:()=>ZY,AudioLoader:()=>AH,AudioListener:()=>wH,AudioContext:()=>HQ,AudioAnalyser:()=>TH,Audio:()=>iZ,AttachedBindMode:()=>pX,ArrowHelper:()=>$Y,ArrayCamera:()=>nZ,ArcCurve:()=>OZ,AnimationUtils:()=>OH,AnimationObjectGroup:()=>yH,AnimationMixer:()=>vH,AnimationLoader:()=>MH,AnimationClip:()=>b8,AnimationAction:()=>aZ,AmbientLight:()=>pZ,AlwaysStencilFunc:()=>SU,AlwaysDepth:()=>zK,AlwaysCompare:()=>aK,AlphaFormat:()=>gK,AgXToneMapping:()=>R$,AdditiveBlending:()=>Y$,AdditiveAnimationBlendMode:()=>KU,AddOperation:()=>SK,AddEquation:()=>p8,ACESFilmicToneMapping:()=>D$});function hG(){let J=null,Q=!1,$=null,Z=null;function W(K,H){$(K,H),Z=J.requestAnimationFrame(W)}return{start:function(){if(Q===!0)return;if($===null)return;Z=J.requestAnimationFrame(W),Q=!0},stop:function(){J.cancelAnimationFrame(Z),Q=!1},setAnimationLoop:function(K){$=K},setContext:function(K){J=K}}}function QN(J){let Q=new WeakMap;function $(Y,X){let{array:U,usage:G}=Y,N=U.byteLength,E=J.createBuffer();J.bindBuffer(X,E),J.bufferData(X,U,G),Y.onUploadCallback();let q;if(U instanceof Float32Array)q=J.FLOAT;else if(typeof Float16Array<"u"&&U instanceof Float16Array)q=J.HALF_FLOAT;else if(U instanceof Uint16Array)if(Y.isFloat16BufferAttribute)q=J.HALF_FLOAT;else q=J.UNSIGNED_SHORT;else if(U instanceof Int16Array)q=J.SHORT;else if(U instanceof Uint32Array)q=J.UNSIGNED_INT;else if(U instanceof Int32Array)q=J.INT;else if(U instanceof Int8Array)q=J.BYTE;else if(U instanceof Uint8Array)q=J.UNSIGNED_BYTE;else if(U instanceof Uint8ClampedArray)q=J.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+U);return{buffer:E,type:q,bytesPerElement:U.BYTES_PER_ELEMENT,version:Y.version,size:N}}function Z(Y,X,U){let{array:G,updateRanges:N}=X;if(J.bindBuffer(U,Y),N.length===0)J.bufferSubData(U,0,G);else{N.sort((q,R)=>q.start-R.start);let E=0;for(let q=1;q<N.length;q++){let R=N[E],O=N[q];if(O.start<=R.start+R.count+1)R.count=Math.max(R.count,O.start+O.count-R.start);else++E,N[E]=O}N.length=E+1;for(let q=0,R=N.length;q<R;q++){let O=N[q];J.bufferSubData(U,O.start*G.BYTES_PER_ELEMENT,G,O.start,O.count)}X.clearUpdateRanges()}X.onUploadCallback()}function W(Y){if(Y.isInterleavedBufferAttribute)Y=Y.data;return Q.get(Y)}function K(Y){if(Y.isInterleavedBufferAttribute)Y=Y.data;let X=Q.get(Y);if(X)J.deleteBuffer(X.buffer),Q.delete(Y)}function H(Y,X){if(Y.isInterleavedBufferAttribute)Y=Y.data;if(Y.isGLBufferAttribute){let G=Q.get(Y);if(!G||G.version<Y.version)Q.set(Y,{buffer:Y.buffer,type:Y.type,bytesPerElement:Y.elementSize,version:Y.version});return}let U=Q.get(Y);if(U===void 0)Q.set(Y,$(Y,X));else if(U.version<Y.version){if(U.size!==Y.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,Y,X),U.version=Y.version}}return{get:W,remove:K,update:H}}function bD(J,Q,$,Z,W,K){let H=new M0(0),Y=W===!0?0:1,X,U,G=null,N=0,E=null;function q(k){let L=k.isScene===!0?k.background:null;if(L&&L.isTexture){let V=k.backgroundBlurriness>0;L=Q.get(L,V)}return L}function R(k){let L=!1,V=q(k);if(V===null)F(H,Y);else if(V&&V.isColor)F(V,1),L=!0;let w=J.xr.getEnvironmentBlendMode();if(w==="additive")$.buffers.color.setClear(0,0,0,1,K);else if(w==="alpha-blend")$.buffers.color.setClear(0,0,0,0,K);if(J.autoClear||L)$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function O(k,L){let V=q(L);if(V&&(V.isCubeTexture||V.mapping===P7)){if(U===void 0)U=new kJ(new q8(1,1,1),new iJ({name:"BackgroundCubeMaterial",uniforms:n8(O9.backgroundCube.uniforms),vertexShader:O9.backgroundCube.vertexShader,fragmentShader:O9.backgroundCube.fragmentShader,side:dJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(w,_,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(o8.copy(L.backgroundRotation),o8.x*=-1,o8.y*=-1,o8.z*=-1,V.isCubeTexture&&V.isRenderTargetTexture===!1)o8.y*=-1,o8.z*=-1;if(U.material.uniforms.envMap.value=V,U.material.uniforms.flipEnvMap.value=V.isCubeTexture&&V.isRenderTargetTexture===!1?-1:1,U.material.uniforms.backgroundBlurriness.value=L.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(fD.makeRotationFromEuler(o8)),U.material.toneMapped=e0.getTransfer(V.colorSpace)!==EJ,G!==V||N!==V.version||E!==J.toneMapping)U.material.needsUpdate=!0,G=V,N=V.version,E=J.toneMapping;U.layers.enableAll(),k.unshift(U,U.geometry,U.material,0,0,null)}else if(V&&V.isTexture){if(X===void 0)X=new kJ(new c8(2,2),new iJ({name:"BackgroundMaterial",uniforms:n8(O9.background.uniforms),vertexShader:O9.background.vertexShader,fragmentShader:O9.background.fragmentShader,side:g8,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),X.geometry.deleteAttribute("normal"),Object.defineProperty(X.material,"map",{get:function(){return this.uniforms.t2D.value}}),Z.update(X);if(X.material.uniforms.t2D.value=V,X.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,X.material.toneMapped=e0.getTransfer(V.colorSpace)!==EJ,V.matrixAutoUpdate===!0)V.updateMatrix();if(X.material.uniforms.uvTransform.value.copy(V.matrix),G!==V||N!==V.version||E!==J.toneMapping)X.material.needsUpdate=!0,G=V,N=V.version,E=J.toneMapping;X.layers.enableAll(),k.unshift(X,X.geometry,X.material,0,0,null)}}function F(k,L){k.getRGB(JW,DH(J)),$.buffers.color.setClear(JW.r,JW.g,JW.b,L,K)}function D(){if(U!==void 0)U.geometry.dispose(),U.material.dispose(),U=void 0;if(X!==void 0)X.geometry.dispose(),X.material.dispose(),X=void 0}return{getClearColor:function(){return H},setClearColor:function(k,L=1){H.set(k),Y=L,F(H,Y)},getClearAlpha:function(){return Y},setClearAlpha:function(k){Y=k,F(H,Y)},render:R,addToRenderList:O,dispose:D}}function hD(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=E(null),K=W,H=!1;function Y(S,b,l,v,c){let x=!1,m=N(S,v,l,b);if(K!==m)K=m,U(K.object);if(x=q(S,v,l,c),x)R(S,v,l,c);if(c!==null)Q.update(c,J.ELEMENT_ARRAY_BUFFER);if(x||H){if(H=!1,V(S,b,l,v),c!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(c).buffer)}}function X(){return J.createVertexArray()}function U(S){return J.bindVertexArray(S)}function G(S){return J.deleteVertexArray(S)}function N(S,b,l,v){let c=v.wireframe===!0,x=Z[b.id];if(x===void 0)x={},Z[b.id]=x;let m=S.isInstancedMesh===!0?S.id:0,Q0=x[m];if(Q0===void 0)Q0={},x[m]=Q0;let $0=Q0[l.id];if($0===void 0)$0={},Q0[l.id]=$0;let G0=$0[c];if(G0===void 0)G0=E(X()),$0[c]=G0;return G0}function E(S){let b=[],l=[],v=[];for(let c=0;c<$;c++)b[c]=0,l[c]=0,v[c]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:b,enabledAttributes:l,attributeDivisors:v,object:S,attributes:{},index:null}}function q(S,b,l,v){let c=K.attributes,x=b.attributes,m=0,Q0=l.getAttributes();for(let $0 in Q0)if(Q0[$0].location>=0){let w0=c[$0],K0=x[$0];if(K0===void 0){if($0==="instanceMatrix"&&S.instanceMatrix)K0=S.instanceMatrix;if($0==="instanceColor"&&S.instanceColor)K0=S.instanceColor}if(w0===void 0)return!0;if(w0.attribute!==K0)return!0;if(K0&&w0.data!==K0.data)return!0;m++}if(K.attributesNum!==m)return!0;if(K.index!==v)return!0;return!1}function R(S,b,l,v){let c={},x=b.attributes,m=0,Q0=l.getAttributes();for(let $0 in Q0)if(Q0[$0].location>=0){let w0=x[$0];if(w0===void 0){if($0==="instanceMatrix"&&S.instanceMatrix)w0=S.instanceMatrix;if($0==="instanceColor"&&S.instanceColor)w0=S.instanceColor}let K0={};if(K0.attribute=w0,w0&&w0.data)K0.data=w0.data;c[$0]=K0,m++}K.attributes=c,K.attributesNum=m,K.index=v}function O(){let S=K.newAttributes;for(let b=0,l=S.length;b<l;b++)S[b]=0}function F(S){D(S,0)}function D(S,b){let{newAttributes:l,enabledAttributes:v,attributeDivisors:c}=K;if(l[S]=1,v[S]===0)J.enableVertexAttribArray(S),v[S]=1;if(c[S]!==b)J.vertexAttribDivisor(S,b),c[S]=b}function k(){let{newAttributes:S,enabledAttributes:b}=K;for(let l=0,v=b.length;l<v;l++)if(b[l]!==S[l])J.disableVertexAttribArray(l),b[l]=0}function L(S,b,l,v,c,x,m){if(m===!0)J.vertexAttribIPointer(S,b,l,c,x);else J.vertexAttribPointer(S,b,l,v,c,x)}function V(S,b,l,v){O();let c=v.attributes,x=l.getAttributes(),m=b.defaultAttributeValues;for(let Q0 in x){let $0=x[Q0];if($0.location>=0){let G0=c[Q0];if(G0===void 0){if(Q0==="instanceMatrix"&&S.instanceMatrix)G0=S.instanceMatrix;if(Q0==="instanceColor"&&S.instanceColor)G0=S.instanceColor}if(G0!==void 0){let{normalized:w0,itemSize:K0}=G0,HJ=Q.get(G0);if(HJ===void 0)continue;let{buffer:WJ,type:s,bytesPerElement:E0}=HJ,B0=s===J.INT||s===J.UNSIGNED_INT||G0.gpuType===k$;if(G0.isInterleavedBufferAttribute){let q0=G0.data,f0=q0.stride,JJ=G0.offset;if(q0.isInstancedInterleavedBuffer){for(let n0=0;n0<$0.locationSize;n0++)D($0.location+n0,q0.meshPerAttribute);if(S.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=q0.meshPerAttribute*q0.count}else for(let n0=0;n0<$0.locationSize;n0++)F($0.location+n0);J.bindBuffer(J.ARRAY_BUFFER,WJ);for(let n0=0;n0<$0.locationSize;n0++)L($0.location+n0,K0/$0.locationSize,s,w0,f0*E0,(JJ+K0/$0.locationSize*n0)*E0,B0)}else{if(G0.isInstancedBufferAttribute){for(let q0=0;q0<$0.locationSize;q0++)D($0.location+q0,G0.meshPerAttribute);if(S.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=G0.meshPerAttribute*G0.count}else for(let q0=0;q0<$0.locationSize;q0++)F($0.location+q0);J.bindBuffer(J.ARRAY_BUFFER,WJ);for(let q0=0;q0<$0.locationSize;q0++)L($0.location+q0,K0/$0.locationSize,s,w0,K0*E0,K0/$0.locationSize*q0*E0,B0)}}else if(m!==void 0){let w0=m[Q0];if(w0!==void 0)switch(w0.length){case 2:J.vertexAttrib2fv($0.location,w0);break;case 3:J.vertexAttrib3fv($0.location,w0);break;case 4:J.vertexAttrib4fv($0.location,w0);break;default:J.vertexAttrib1fv($0.location,w0)}}}}k()}function w(){C();for(let S in Z){let b=Z[S];for(let l in b){let v=b[l];for(let c in v){let x=v[c];for(let m in x)G(x[m].object),delete x[m];delete v[c]}}delete Z[S]}}function _(S){if(Z[S.id]===void 0)return;let b=Z[S.id];for(let l in b){let v=b[l];for(let c in v){let x=v[c];for(let m in x)G(x[m].object),delete x[m];delete v[c]}}delete Z[S.id]}function A(S){for(let b in Z){let l=Z[b];for(let v in l){let c=l[v];if(c[S.id]===void 0)continue;let x=c[S.id];for(let m in x)G(x[m].object),delete x[m];delete c[S.id]}}}function M(S){for(let b in Z){let l=Z[b],v=S.isInstancedMesh===!0?S.id:0,c=l[v];if(c===void 0)continue;for(let x in c){let m=c[x];for(let Q0 in m)G(m[Q0].object),delete m[Q0];delete c[x]}if(delete l[v],Object.keys(l).length===0)delete Z[b]}}function C(){if(h(),H=!0,K===W)return;K=W,U(K.object)}function h(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:Y,reset:C,resetDefaultState:h,dispose:w,releaseStatesOfGeometry:_,releaseStatesOfObject:M,releaseStatesOfProgram:A,initAttributes:O,enableAttribute:F,disableUnusedAttributes:k}}function xD(J,Q,$){let Z;function W(U){Z=U}function K(U,G){J.drawArrays(Z,U,G),$.update(G,Z,1)}function H(U,G,N){if(N===0)return;J.drawArraysInstanced(Z,U,G,N),$.update(G,Z,N)}function Y(U,G,N){if(N===0)return;Q.get("WEBGL_multi_draw").multiDrawArraysWEBGL(Z,U,0,G,0,N);let q=0;for(let R=0;R<N;R++)q+=G[R];$.update(q,Z,1)}function X(U,G,N,E){if(N===0)return;let q=Q.get("WEBGL_multi_draw");if(q===null)for(let R=0;R<U.length;R++)H(U[R],G[R],E[R]);else{q.multiDrawArraysInstancedWEBGL(Z,U,0,G,0,E,0,N);let R=0;for(let O=0;O<N;O++)R+=G[O]*E[O];$.update(R,Z,1)}}this.setMode=W,this.render=K,this.renderInstances=H,this.renderMultiDraw=Y,this.renderMultiDrawInstances=X}function gD(J,Q,$,Z){let W;function K(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let A=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function H(A){if(A!==R9&&Z.convert(A)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function Y(A){let M=A===C9&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(A!==K9&&Z.convert(A)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==A9&&!M)return!1;return!0}function X(A){if(A==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";A="mediump"}if(A==="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=X(U);if(G!==U)U0("WebGLRenderer:",U,"not supported, using",G,"instead."),U=G;let N=$.logarithmicDepthBuffer===!0,E=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control"),q=J.getParameter(J.MAX_TEXTURE_IMAGE_UNITS),R=J.getParameter(J.MAX_VERTEX_TEXTURE_IMAGE_UNITS),O=J.getParameter(J.MAX_TEXTURE_SIZE),F=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),D=J.getParameter(J.MAX_VERTEX_ATTRIBS),k=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),L=J.getParameter(J.MAX_VARYING_VECTORS),V=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),w=J.getParameter(J.MAX_SAMPLES),_=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:K,getMaxPrecision:X,textureFormatReadable:H,textureTypeReadable:Y,precision:U,logarithmicDepthBuffer:N,reversedDepthBuffer:E,maxTextures:q,maxVertexTextures:R,maxTextureSize:O,maxCubemapSize:F,maxAttributes:D,maxVertexUniforms:k,maxVaryings:L,maxFragmentUniforms:V,maxSamples:w,samples:_}}function pD(J){let Q=this,$=null,Z=0,W=!1,K=!1,H=new z9,Y=new c0,X={value:null,needsUpdate:!1};this.uniform=X,this.numPlanes=0,this.numIntersection=0,this.init=function(N,E){let q=N.length!==0||E||Z!==0||W;return W=E,Z=N.length,q},this.beginShadows=function(){K=!0,G(null)},this.endShadows=function(){K=!1},this.setGlobalState=function(N,E){$=G(N,E,0)},this.setState=function(N,E,q){let{clippingPlanes:R,clipIntersection:O,clipShadows:F}=N,D=J.get(N);if(!W||R===null||R.length===0||K&&!F)if(K)G(null);else U();else{let k=K?0:Z,L=k*4,V=D.clippingState||null;X.value=V,V=G(R,E,L,q);for(let w=0;w!==L;++w)V[w]=$[w];D.clippingState=V,this.numIntersection=O?this.numPlanes:0,this.numPlanes+=k}};function U(){if(X.value!==$)X.value=$,X.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function G(N,E,q,R){let O=N!==null?N.length:0,F=null;if(O!==0){if(F=X.value,R!==!0||F===null){let D=q+O*4,k=E.matrixWorldInverse;if(Y.getNormalMatrix(k),F===null||F.length<D)F=new Float32Array(D);for(let L=0,V=q;L!==O;++L,V+=4)H.copy(N[L]).applyMatrix4(k,Y),H.normal.toArray(F,V),F[V+3]=H.constant}X.value=F,X.needsUpdate=!0}return Q.numPlanes=O,Q.numIntersection=0,F}}class $W{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:K=256,position:H=dD}=W;XY=this._renderer.getRenderTarget(),UY=this._renderer.getActiveCubeFace(),GY=this._renderer.getActiveMipmapLevel(),EY=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(K);let Y=this._allocateTargets();if(Y.depthBuffer=!0,this._sceneToCubeUV(J,$,Z,Y,H),Q>0)this._blur(Y,0,0,Q);return this._applyPMREM(Y),this._cleanup(Y),Y}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=MG(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=kG(),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(XY,UY,GY),this._renderer.xr.enabled=EY,J.scissorTest=!1,c7(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===m8||J.mapping===K8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);XY=this._renderer.getRenderTarget(),UY=this._renderer.getActiveCubeFace(),GY=this._renderer.getActiveMipmapLevel(),EY=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:lJ,minFilter:lJ,generateMipmaps:!1,type:C9,format:R9,colorSpace:j7,depthBuffer:!1},Z=OG(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=OG(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=lD(W)),this._blurMaterial=cD(W,J,Q),this._ggxMaterial=uD(W,J,Q)}return Z}_compileMaterial(J){let Q=new kJ(new l0,J);this._renderer.compile(Q,YQ)}_sceneToCubeUV(J,Q,$,Z,W){let Y=new BJ(90,1,Q,$),X=[1,-1,1,1,1,1],U=[1,1,1,-1,-1,-1],G=this._renderer,N=G.autoClear,E=G.toneMapping;if(G.getClearColor(RG),G.toneMapping=W9,G.autoClear=!1,G.state.buffers.depth.getReversed())G.setRenderTarget(Z),G.clearDepth(),G.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new kJ(new q8,new w9({name:"PMREM.Background",side:dJ,depthWrite:!1,depthTest:!1}));let R=this._backgroundBox,O=R.material,F=!1,D=J.background;if(D){if(D.isColor)O.color.copy(D),J.background=null,F=!0}else O.color.copy(RG),F=!0;for(let k=0;k<6;k++){let L=k%3;if(L===0)Y.up.set(0,X[k],0),Y.position.set(W.x,W.y,W.z),Y.lookAt(W.x+U[k],W.y,W.z);else if(L===1)Y.up.set(0,0,X[k]),Y.position.set(W.x,W.y,W.z),Y.lookAt(W.x,W.y+U[k],W.z);else Y.up.set(0,X[k],0),Y.position.set(W.x,W.y,W.z),Y.lookAt(W.x,W.y,W.z+U[k]);let V=this._cubeSize;if(c7(Z,L*V,k>2?V:0,V,V),G.setRenderTarget(Z),F)G.render(R,Y);G.render(J,Y)}G.toneMapping=E,G.autoClear=N,J.background=D}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===m8||J.mapping===K8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=MG();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=kG();let W=Z?this._cubemapMaterial:this._equirectMaterial,K=this._lodMeshes[0];K.material=W;let H=W.uniforms;H.envMap.value=J;let Y=this._cubeSize;c7(Q,0,0,3*Y,2*Y),$.setRenderTarget(Q),$.render(K,YQ)}_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,K=this._ggxMaterial,H=this._lodMeshes[$];H.material=K;let Y=K.uniforms,X=$/(this._lodMeshes.length-1),U=Q/(this._lodMeshes.length-1),G=Math.sqrt(X*X-U*U),N=0+X*1.25,E=G*N,{_lodMax:q}=this,R=this._sizeLods[$],O=3*R*($>q-F8?$-q+F8:0),F=4*(this._cubeSize-R);Y.envMap.value=J.texture,Y.roughness.value=E,Y.mipInt.value=q-Q,c7(W,O,F,3*R,2*R),Z.setRenderTarget(W),Z.render(H,YQ),Y.envMap.value=W.texture,Y.roughness.value=0,Y.mipInt.value=q-$,c7(J,O,F,3*R,2*R),Z.setRenderTarget(J),Z.render(H,YQ)}_blur(J,Q,$,Z,W){let K=this._pingPongRenderTarget;this._halfBlur(J,K,Q,$,Z,"latitudinal",W),this._halfBlur(K,J,$,$,Z,"longitudinal",W)}_halfBlur(J,Q,$,Z,W,K,H){let Y=this._renderer,X=this._blurMaterial;if(K!=="latitudinal"&&K!=="longitudinal")S0("blur direction must be either latitudinal or longitudinal!");let U=3,G=this._lodMeshes[Z];G.material=X;let N=X.uniforms,E=this._sizeLods[$]-1,q=isFinite(W)?Math.PI/(2*E):2*Math.PI/(2*r8-1),R=W/q,O=isFinite(W)?1+Math.floor(U*R):r8;if(O>r8)U0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${O} samples when the maximum is set to ${r8}`);let F=[],D=0;for(let _=0;_<r8;++_){let A=_/R,M=Math.exp(-A*A/2);if(F.push(M),_===0)D+=M;else if(_<O)D+=2*M}for(let _=0;_<F.length;_++)F[_]=F[_]/D;if(N.envMap.value=J.texture,N.samples.value=O,N.weights.value=F,N.latitudinal.value=K==="latitudinal",H)N.poleAxis.value=H;let{_lodMax:k}=this;N.dTheta.value=q,N.mipInt.value=k-$;let L=this._sizeLods[Z],V=3*L*(Z>k-F8?Z-k+F8:0),w=4*(this._cubeSize-L);c7(Q,V,w,3*L,2*L),Y.setRenderTarget(Q),Y.render(G,YQ)}}function lD(J){let Q=[],$=[],Z=[],W=J,K=J-F8+1+FG.length;for(let H=0;H<K;H++){let Y=Math.pow(2,W);Q.push(Y);let X=1/Y;if(H>J-F8)X=FG[H-J+F8-1];else if(H===0)X=0;$.push(X);let U=1/(Y-2),G=-U,N=1+U,E=[G,G,N,G,N,N,G,G,N,N,G,N],q=6,R=6,O=3,F=2,D=1,k=new Float32Array(O*R*q),L=new Float32Array(F*R*q),V=new Float32Array(D*R*q);for(let _=0;_<q;_++){let A=_%3*2/3-1,M=_>2?0:-1,C=[A,M,0,A+0.6666666666666666,M,0,A+0.6666666666666666,M+1,0,A,M,0,A+0.6666666666666666,M+1,0,A,M+1,0];k.set(C,O*R*_),L.set(E,F*R*_);let h=[_,_,_,_,_,_];V.set(h,D*R*_)}let w=new l0;if(w.setAttribute("position",new KJ(k,O)),w.setAttribute("uv",new KJ(L,F)),w.setAttribute("faceIndex",new KJ(V,D)),Z.push(new kJ(w,null)),W>F8)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function OG(J,Q,$){let Z=new uJ(J,Q,$);return Z.texture.mapping=P7,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function c7(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function uD(J,Q,$){return new iJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:mD,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:ZW(),fragmentShader:`
5
+ }`,aJ,JQ,QQ,wZ,PZ,TZ,SZ,jZ,$Q,ZQ,yZ,vZ,fZ,WQ,bZ,hZ,i9,KQ,x8,xZ,a8,o9,g8,R9,LY,p9,qG,O9,VY,BY,R7,m8,zY,IY,_Y,y9,gZ,dW,LH,VH,tQ,eQ,A9,l7,W8,BH,zH,CJ,DG,mZ,FG,dZ,r8,RG,lZ,uZ,cZ,nZ,HQ,sZ,iZ,lW,AY,mE,IH,_H,uW,CY,J$,wY,AH,CH,w8,O7=-90,k7=1,oZ,aZ,P8,cW,lE,T8,S8,TY,tZ,j8,wH,uE,y8,SY,yY="\\[\\]\\.:\\/",cE,vY,nE,sE,iE,oE,aE,rE,tE,eE,bY,hY,JN=0,xY,gY,PH,$W,SH,jH,Q$,M7,L7,nW,QN,$N,yH,sY,K8,$$,sW,iY,oY,ZN,vH,fH,aY,rY,tY,bH,Z$,hH,eY,W$,LJ,JX,K$,QX,$X,ZX,xH,Y$,iW,WX,KX,XX;var UX=PX(()=>{gH={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},pH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},sU={COMPUTE:"compute",RENDER:"render"},iU={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},oU={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},aU={TEXTURE_COMPARE:"depthTextureCompare"};R5={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};TX={};$G={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};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"],f8=Math.PI/180,b8=180/Math.PI;ZG={DEG2RAD:f8,RAD2DEG:b8,generateUUID:Q9,clamp:m0,euclideanModulo:eK,mapLinear:O5,inverseLerp:k5,lerp:Y6,damp:M5,pingpong:L5,smoothstep:V5,smootherstep:B5,randInt:z5,randFloat:I5,randFloatSpread:_5,seededRandom:A5,degToRad:C5,radToDeg:w5,isPowerOfTwo:P5,ceilPowerOfTwo:T5,floorPowerOfTwo:S5,setQuaternionFromProperEuler:j5,normalize:o0,denormalize:lJ};r=class r{static{r.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,K=this.y-J.y;return this.x=W*$-K*Z+J.x,this.y=W*Z+K*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};vJ=class vJ{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,K,Y){let X=$[Z+0],H=$[Z+1],U=$[Z+2],E=$[Z+3],N=W[K+0],G=W[K+1],q=W[K+2],R=W[K+3];if(E!==R||X!==N||H!==G||U!==q){let O=X*N+H*G+U*q+E*R;if(O<0)N=-N,G=-G,q=-q,R=-R,O=-O;let F=1-Y;if(O<0.9995){let D=Math.acos(O),k=Math.sin(D);F=Math.sin(F*D)/k,Y=Math.sin(Y*D)/k,X=X*F+N*Y,H=H*F+G*Y,U=U*F+q*Y,E=E*F+R*Y}else{X=X*F+N*Y,H=H*F+G*Y,U=U*F+q*Y,E=E*F+R*Y;let D=1/Math.sqrt(X*X+H*H+U*U+E*E);X*=D,H*=D,U*=D,E*=D}}J[Q]=X,J[Q+1]=H,J[Q+2]=U,J[Q+3]=E}static multiplyQuaternionsFlat(J,Q,$,Z,W,K){let Y=$[Z],X=$[Z+1],H=$[Z+2],U=$[Z+3],E=W[K],N=W[K+1],G=W[K+2],q=W[K+3];return J[Q]=Y*q+U*E+X*G-H*N,J[Q+1]=X*q+U*N+H*E-Y*G,J[Q+2]=H*q+U*G+Y*N-X*E,J[Q+3]=U*q-Y*E-X*N-H*G,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:K}=J,Y=Math.cos,X=Math.sin,H=Y($/2),U=Y(Z/2),E=Y(W/2),N=X($/2),G=X(Z/2),q=X(W/2);switch(K){case"XYZ":this._x=N*U*E+H*G*q,this._y=H*G*E-N*U*q,this._z=H*U*q+N*G*E,this._w=H*U*E-N*G*q;break;case"YXZ":this._x=N*U*E+H*G*q,this._y=H*G*E-N*U*q,this._z=H*U*q-N*G*E,this._w=H*U*E+N*G*q;break;case"ZXY":this._x=N*U*E-H*G*q,this._y=H*G*E+N*U*q,this._z=H*U*q+N*G*E,this._w=H*U*E-N*G*q;break;case"ZYX":this._x=N*U*E-H*G*q,this._y=H*G*E+N*U*q,this._z=H*U*q-N*G*E,this._w=H*U*E+N*G*q;break;case"YZX":this._x=N*U*E+H*G*q,this._y=H*G*E+N*U*q,this._z=H*U*q-N*G*E,this._w=H*U*E-N*G*q;break;case"XZY":this._x=N*U*E-H*G*q,this._y=H*G*E-N*U*q,this._z=H*U*q+N*G*E,this._w=H*U*E+N*G*q;break;default:H0("Quaternion: .setFromEuler() encountered an unknown order: "+K)}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],K=Q[1],Y=Q[5],X=Q[9],H=Q[2],U=Q[6],E=Q[10],N=$+Y+E;if(N>0){let G=0.5/Math.sqrt(N+1);this._w=0.25/G,this._x=(U-X)*G,this._y=(W-H)*G,this._z=(K-Z)*G}else if($>Y&&$>E){let G=2*Math.sqrt(1+$-Y-E);this._w=(U-X)/G,this._x=0.25*G,this._y=(Z+K)/G,this._z=(W+H)/G}else if(Y>E){let G=2*Math.sqrt(1+Y-$-E);this._w=(W-H)/G,this._x=(Z+K)/G,this._y=0.25*G,this._z=(X+U)/G}else{let G=2*Math.sqrt(1+E-$-Y);this._w=(K-Z)/G,this._x=(W+H)/G,this._y=(X+U)/G,this._z=0.25*G}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:K}=J,Y=Q._x,X=Q._y,H=Q._z,U=Q._w;return this._x=$*U+K*Y+Z*H-W*X,this._y=Z*U+K*X+W*Y-$*H,this._z=W*U+K*H+$*X-Z*Y,this._w=K*U-$*Y-Z*X-W*H,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:Z,_z:W,_w:K}=J,Y=this.dot(J);if(Y<0)$=-$,Z=-Z,W=-W,K=-K,Y=-Y;let X=1-Q;if(Y<0.9995){let H=Math.acos(Y),U=Math.sin(H);X=Math.sin(X*H)/U,Q=Math.sin(Q*H)/U,this._x=this._x*X+$*Q,this._y=this._y*X+Z*Q,this._z=this._z*X+W*Q,this._w=this._w*X+K*Q,this._onChangeCallback()}else this._x=this._x*X+$*Q,this._y=this._y*X+Z*Q,this._z=this._z*X+W*Q,this._w=this._w*X+K*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}};P=class P{static{P.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(jX.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(jX.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,K=1/(W[3]*Q+W[7]*$+W[11]*Z+W[15]);return this.x=(W[0]*Q+W[4]*$+W[8]*Z+W[12])*K,this.y=(W[1]*Q+W[5]*$+W[9]*Z+W[13])*K,this.z=(W[2]*Q+W[6]*$+W[10]*Z+W[14])*K,this}applyQuaternion(J){let Q=this.x,$=this.y,Z=this.z,W=J.x,K=J.y,Y=J.z,X=J.w,H=2*(K*Z-Y*$),U=2*(Y*Q-W*Z),E=2*(W*$-K*Q);return this.x=Q+X*H+K*E-Y*U,this.y=$+X*U+Y*H-W*E,this.z=Z+X*E+W*U-K*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,K=Q.x,Y=Q.y,X=Q.z;return this.x=Z*X-W*Y,this.y=W*K-$*X,this.z=$*Y-Z*K,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 EW.copy(this).projectOnVector(J),this.sub(EW)}reflect(J){return this.sub(EW.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}};EW=new P,jX=new vJ;u0=class u0{static{u0.prototype.isMatrix3=!0}constructor(J,Q,$,Z,W,K,Y,X,H){if(this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,K,Y,X,H)}set(J,Q,$,Z,W,K,Y,X,H){let U=this.elements;return U[0]=J,U[1]=Z,U[2]=Y,U[3]=Q,U[4]=W,U[5]=X,U[6]=$,U[7]=K,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,K=$[0],Y=$[3],X=$[6],H=$[1],U=$[4],E=$[7],N=$[2],G=$[5],q=$[8],R=Z[0],O=Z[3],F=Z[6],D=Z[1],k=Z[4],M=Z[7],V=Z[2],_=Z[5],A=Z[8];return W[0]=K*R+Y*D+X*V,W[3]=K*O+Y*k+X*_,W[6]=K*F+Y*M+X*A,W[1]=H*R+U*D+E*V,W[4]=H*O+U*k+E*_,W[7]=H*F+U*M+E*A,W[2]=N*R+G*D+q*V,W[5]=N*O+G*k+q*_,W[8]=N*F+G*M+q*A,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],K=J[4],Y=J[5],X=J[6],H=J[7],U=J[8];return Q*K*U-Q*Y*H-$*W*U+$*Y*X+Z*W*H-Z*K*X}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],K=J[4],Y=J[5],X=J[6],H=J[7],U=J[8],E=U*K-Y*H,N=Y*X-U*W,G=H*W-K*X,q=Q*E+$*N+Z*G;if(q===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/q;return J[0]=E*R,J[1]=(Z*H-U*$)*R,J[2]=(Y*$-Z*K)*R,J[3]=N*R,J[4]=(U*Q-Z*X)*R,J[5]=(Z*W-Y*Q)*R,J[6]=G*R,J[7]=($*X-H*Q)*R,J[8]=(K*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,K,Y){let X=Math.cos(W),H=Math.sin(W);return this.set($*X,$*H,-$*(X*K+H*Y)+K+J,-Z*H,Z*X,-Z*(-H*K+X*Y)+Y+Q,0,0,1),this}scale(J,Q){return this.premultiply(NW.makeScale(J,Q)),this}rotate(J){return this.premultiply(NW.makeRotation(-J)),this}translate(J,Q){return this.premultiply(NW.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)}};NW=new u0,yX=new u0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),vX=new u0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);$J=y5();DW=new P;OJ=class OJ extends Z9{constructor(J=OJ.DEFAULT_IMAGE,Q=OJ.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,K=1008,Y=1023,X=1009,H=OJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:f5++}),this.uuid=Q9(),this.name="",this.source=new w9(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=Z,this.magFilter=W,this.minFilter=K,this.anisotropy=H,this.format=Y,this.internalFormat=null,this.type=X,this.offset=new r(0,0),this.repeat=new r(1,1),this.center=new r(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new u0,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(DW).x}get height(){return this.source.getSize(DW).y}get depth(){return this.source.getSize(DW).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){H0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){H0(`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++}};OJ.DEFAULT_IMAGE=null;OJ.DEFAULT_MAPPING=300;OJ.DEFAULT_ANISOTROPY=1;GJ=class GJ{static{GJ.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,K=J.elements;return this.x=K[0]*Q+K[4]*$+K[8]*Z+K[12]*W,this.y=K[1]*Q+K[5]*$+K[9]*Z+K[13]*W,this.z=K[2]*Q+K[6]*$+K[10]*Z+K[14]*W,this.w=K[3]*Q+K[7]*$+K[11]*Z+K[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,K=0.01,Y=0.1,X=J.elements,H=X[0],U=X[4],E=X[8],N=X[1],G=X[5],q=X[9],R=X[2],O=X[6],F=X[10];if(Math.abs(U-N)<0.01&&Math.abs(E-R)<0.01&&Math.abs(q-O)<0.01){if(Math.abs(U+N)<0.1&&Math.abs(E+R)<0.1&&Math.abs(q+O)<0.1&&Math.abs(H+G+F-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let k=(H+1)/2,M=(G+1)/2,V=(F+1)/2,_=(U+N)/4,A=(E+R)/4,C=(q+O)/4;if(k>M&&k>V)if(k<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(k),Z=_/$,W=A/$;else if(M>V)if(M<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(M),$=_/Z,W=C/Z;else if(V<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(V),$=A/W,Z=C/W;return this.set($,Z,W,Q),this}let D=Math.sqrt((O-q)*(O-q)+(E-R)*(E-R)+(N-U)*(N-U));if(Math.abs(D)<0.001)D=1;return this.x=(O-q)/D,this.y=(E-R)/D,this.z=(N-U)/D,this.w=Math.acos((H+G+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=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}};A6=class A6 extends Z9{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 GJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new GJ(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new OJ(Z),K=$.count;for(let Y=0;Y<K;Y++)this.textures[Y]=W.clone(),this.textures[Y].isRenderTargetTexture=!0,this.textures[Y].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 w9(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"})}};sJ=class sJ extends A6{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}};j7=class j7 extends OJ{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()}};JY=class JY extends sJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGLArrayRenderTarget=!0,this.depth=$,this.texture=new j7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}};y7=class y7 extends OJ{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}};QY=class QY extends sJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGL3DRenderTarget=!0,this.depth=$,this.texture=new y7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}};d0=class d0{static{d0.prototype.isMatrix4=!0}constructor(J,Q,$,Z,W,K,Y,X,H,U,E,N,G,q,R,O){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,K,Y,X,H,U,E,N,G,q,R,O)}set(J,Q,$,Z,W,K,Y,X,H,U,E,N,G,q,R,O){let F=this.elements;return F[0]=J,F[4]=Q,F[8]=$,F[12]=Z,F[1]=W,F[5]=K,F[9]=Y,F[13]=X,F[2]=H,F[6]=U,F[10]=E,F[14]=N,F[3]=G,F[7]=q,F[11]=R,F[15]=O,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 d0().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/$7.setFromMatrixColumn(J,0).length(),W=1/$7.setFromMatrixColumn(J,1).length(),K=1/$7.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]*K,Q[9]=$[9]*K,Q[10]=$[10]*K,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,K=Math.cos($),Y=Math.sin($),X=Math.cos(Z),H=Math.sin(Z),U=Math.cos(W),E=Math.sin(W);if(J.order==="XYZ"){let N=K*U,G=K*E,q=Y*U,R=Y*E;Q[0]=X*U,Q[4]=-X*E,Q[8]=H,Q[1]=G+q*H,Q[5]=N-R*H,Q[9]=-Y*X,Q[2]=R-N*H,Q[6]=q+G*H,Q[10]=K*X}else if(J.order==="YXZ"){let N=X*U,G=X*E,q=H*U,R=H*E;Q[0]=N+R*Y,Q[4]=q*Y-G,Q[8]=K*H,Q[1]=K*E,Q[5]=K*U,Q[9]=-Y,Q[2]=G*Y-q,Q[6]=R+N*Y,Q[10]=K*X}else if(J.order==="ZXY"){let N=X*U,G=X*E,q=H*U,R=H*E;Q[0]=N-R*Y,Q[4]=-K*E,Q[8]=q+G*Y,Q[1]=G+q*Y,Q[5]=K*U,Q[9]=R-N*Y,Q[2]=-K*H,Q[6]=Y,Q[10]=K*X}else if(J.order==="ZYX"){let N=K*U,G=K*E,q=Y*U,R=Y*E;Q[0]=X*U,Q[4]=q*H-G,Q[8]=N*H+R,Q[1]=X*E,Q[5]=R*H+N,Q[9]=G*H-q,Q[2]=-H,Q[6]=Y*X,Q[10]=K*X}else if(J.order==="YZX"){let N=K*X,G=K*H,q=Y*X,R=Y*H;Q[0]=X*U,Q[4]=R-N*E,Q[8]=q*E+G,Q[1]=E,Q[5]=K*U,Q[9]=-Y*U,Q[2]=-H*U,Q[6]=G*E+q,Q[10]=N-R*E}else if(J.order==="XZY"){let N=K*X,G=K*H,q=Y*X,R=Y*H;Q[0]=X*U,Q[4]=-E,Q[8]=H*U,Q[1]=N*E+R,Q[5]=K*U,Q[9]=G*E-q,Q[2]=q*E-G,Q[6]=Y*U,Q[10]=R*E+N}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(b5,J,h5)}lookAt(J,Q,$){let Z=this.elements;if(eJ.subVectors(J,Q),eJ.lengthSq()===0)eJ.z=1;if(eJ.normalize(),e9.crossVectors($,eJ),e9.lengthSq()===0){if(Math.abs($.z)===1)eJ.x+=0.0001;else eJ.z+=0.0001;eJ.normalize(),e9.crossVectors($,eJ)}return e9.normalize(),kQ.crossVectors(eJ,e9),Z[0]=e9.x,Z[4]=kQ.x,Z[8]=eJ.x,Z[1]=e9.y,Z[5]=kQ.y,Z[9]=eJ.y,Z[2]=e9.z,Z[6]=kQ.z,Z[10]=eJ.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,K=$[0],Y=$[4],X=$[8],H=$[12],U=$[1],E=$[5],N=$[9],G=$[13],q=$[2],R=$[6],O=$[10],F=$[14],D=$[3],k=$[7],M=$[11],V=$[15],_=Z[0],A=Z[4],C=Z[8],L=Z[12],I=Z[1],b=Z[5],T=Z[9],g=Z[13],u=Z[2],y=Z[6],l=Z[10],h=Z[14],m=Z[3],a=Z[7],W0=Z[11],N0=Z[15];return W[0]=K*_+Y*I+X*u+H*m,W[4]=K*A+Y*b+X*y+H*a,W[8]=K*C+Y*T+X*l+H*W0,W[12]=K*L+Y*g+X*h+H*N0,W[1]=U*_+E*I+N*u+G*m,W[5]=U*A+E*b+N*y+G*a,W[9]=U*C+E*T+N*l+G*W0,W[13]=U*L+E*g+N*h+G*N0,W[2]=q*_+R*I+O*u+F*m,W[6]=q*A+R*b+O*y+F*a,W[10]=q*C+R*T+O*l+F*W0,W[14]=q*L+R*g+O*h+F*N0,W[3]=D*_+k*I+M*u+V*m,W[7]=D*A+k*b+M*y+V*a,W[11]=D*C+k*T+M*l+V*W0,W[15]=D*L+k*g+M*h+V*N0,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],K=J[1],Y=J[5],X=J[9],H=J[13],U=J[2],E=J[6],N=J[10],G=J[14],q=J[3],R=J[7],O=J[11],F=J[15],D=X*G-H*N,k=Y*G-H*E,M=Y*N-X*E,V=K*G-H*U,_=K*N-X*U,A=K*E-Y*U;return Q*(R*D-O*k+F*M)-$*(q*D-O*V+F*_)+Z*(q*k-R*V+F*A)-W*(q*M-R*_+O*A)}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],K=J[4],Y=J[5],X=J[6],H=J[7],U=J[8],E=J[9],N=J[10],G=J[11],q=J[12],R=J[13],O=J[14],F=J[15],D=Q*Y-$*K,k=Q*X-Z*K,M=Q*H-W*K,V=$*X-Z*Y,_=$*H-W*Y,A=Z*H-W*X,C=U*R-E*q,L=U*O-N*q,I=U*F-G*q,b=E*O-N*R,T=E*F-G*R,g=N*F-G*O,u=D*g-k*T+M*b+V*I-_*L+A*C;if(u===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let y=1/u;return J[0]=(Y*g-X*T+H*b)*y,J[1]=(Z*T-$*g-W*b)*y,J[2]=(R*A-O*_+F*V)*y,J[3]=(N*_-E*A-G*V)*y,J[4]=(X*I-K*g-H*L)*y,J[5]=(Q*g-Z*I+W*L)*y,J[6]=(O*M-q*A-F*k)*y,J[7]=(U*A-N*M+G*k)*y,J[8]=(K*T-Y*I+H*C)*y,J[9]=($*I-Q*T-W*C)*y,J[10]=(q*_-R*M+F*D)*y,J[11]=(E*M-U*_-G*D)*y,J[12]=(Y*L-K*b-X*C)*y,J[13]=(Q*b-$*L+Z*C)*y,J[14]=(R*k-q*V-O*D)*y,J[15]=(U*V-E*k+N*D)*y,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-$,K=J.x,Y=J.y,X=J.z,H=W*K,U=W*Y;return this.set(H*K+$,H*Y-Z*X,H*X+Z*Y,0,H*Y+Z*X,U*Y+$,U*X-Z*K,0,H*X-Z*Y,U*X+Z*K,W*X*X+$,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,K){return this.set(1,$,W,0,J,1,K,0,Q,Z,1,0,0,0,0,1),this}compose(J,Q,$){let Z=this.elements,W=Q._x,K=Q._y,Y=Q._z,X=Q._w,H=W+W,U=K+K,E=Y+Y,N=W*H,G=W*U,q=W*E,R=K*U,O=K*E,F=Y*E,D=X*H,k=X*U,M=X*E,V=$.x,_=$.y,A=$.z;return Z[0]=(1-(R+F))*V,Z[1]=(G+M)*V,Z[2]=(q-k)*V,Z[3]=0,Z[4]=(G-M)*_,Z[5]=(1-(N+F))*_,Z[6]=(O+D)*_,Z[7]=0,Z[8]=(q+k)*A,Z[9]=(O-D)*A,Z[10]=(1-(N+R))*A,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 K=$7.set(Z[0],Z[1],Z[2]).length(),Y=$7.set(Z[4],Z[5],Z[6]).length(),X=$7.set(Z[8],Z[9],Z[10]).length();if(W<0)K=-K;q9.copy(this);let H=1/K,U=1/Y,E=1/X;return q9.elements[0]*=H,q9.elements[1]*=H,q9.elements[2]*=H,q9.elements[4]*=U,q9.elements[5]*=U,q9.elements[6]*=U,q9.elements[8]*=E,q9.elements[9]*=E,q9.elements[10]*=E,Q.setFromRotationMatrix(q9),$.x=K,$.y=Y,$.z=X,this}makePerspective(J,Q,$,Z,W,K,Y=2000,X=!1){let H=this.elements,U=2*W/(Q-J),E=2*W/($-Z),N=(Q+J)/(Q-J),G=($+Z)/($-Z),q,R;if(X)q=W/(K-W),R=K*W/(K-W);else if(Y===2000)q=-(K+W)/(K-W),R=-2*K*W/(K-W);else if(Y===2001)q=-K/(K-W),R=-K*W/(K-W);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Y);return H[0]=U,H[4]=0,H[8]=N,H[12]=0,H[1]=0,H[5]=E,H[9]=G,H[13]=0,H[2]=0,H[6]=0,H[10]=q,H[14]=R,H[3]=0,H[7]=0,H[11]=-1,H[15]=0,this}makeOrthographic(J,Q,$,Z,W,K,Y=2000,X=!1){let H=this.elements,U=2/(Q-J),E=2/($-Z),N=-(Q+J)/(Q-J),G=-($+Z)/($-Z),q,R;if(X)q=1/(K-W),R=K/(K-W);else if(Y===2000)q=-2/(K-W),R=-(K+W)/(K-W);else if(Y===2001)q=-1/(K-W),R=-W/(K-W);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Y);return H[0]=U,H[4]=0,H[8]=0,H[12]=N,H[1]=0,H[5]=E,H[9]=0,H[13]=G,H[2]=0,H[6]=0,H[10]=q,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}};$7=new P,q9=new d0,b5=new P(0,0,0),h5=new P(1,1,1),e9=new P,kQ=new P,eJ=new P,fX=new d0,bX=new vJ;H9=class H9{constructor(J=0,Q=0,$=0,Z=H9.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],K=Z[4],Y=Z[8],X=Z[1],H=Z[5],U=Z[9],E=Z[2],N=Z[6],G=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(m0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(-U,G),this._z=Math.atan2(-K,W);else this._x=Math.atan2(N,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(Y,G),this._z=Math.atan2(X,H);else this._y=Math.atan2(-E,W),this._z=0;break;case"ZXY":if(this._x=Math.asin(m0(N,-1,1)),Math.abs(N)<0.9999999)this._y=Math.atan2(-E,G),this._z=Math.atan2(-K,H);else this._y=0,this._z=Math.atan2(X,W);break;case"ZYX":if(this._y=Math.asin(-m0(E,-1,1)),Math.abs(E)<0.9999999)this._x=Math.atan2(N,G),this._z=Math.atan2(X,W);else this._x=0,this._z=Math.atan2(-K,H);break;case"YZX":if(this._z=Math.asin(m0(X,-1,1)),Math.abs(X)<0.9999999)this._x=Math.atan2(-U,H),this._y=Math.atan2(-E,W);else this._x=0,this._y=Math.atan2(Y,G);break;case"XZY":if(this._z=Math.asin(-m0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(N,H),this._y=Math.atan2(Y,W);else this._x=Math.atan2(-U,G),this._y=0;break;default:H0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return fX.makeRotationFromQuaternion(J),this.setFromRotationMatrix(fX,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return bX.setFromEuler(this),this.setFromQuaternion(bX,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}};H9.DEFAULT_ORDER="XYZ";hX=new P,Z7=new vJ,f9=new d0,MQ=new P,n7=new P,g5=new P,p5=new vJ,xX=new P(1,0,0),gX=new P(0,1,0),pX=new P(0,0,1),mX={type:"added"},m5={type:"removed"},W7={type:"childadded",child:null},FW={type:"childremoved",child:null};KJ=class KJ extends Z9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:x5++}),this.uuid=Q9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=KJ.DEFAULT_UP.clone();let J=new P,Q=new H9,$=new vJ,Z=new P(1,1,1);function W(){$.setFromEuler(Q,!1)}function K(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(W),$._onChange(K),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 d0},normalMatrix:{value:new u0}}),this.matrix=new d0,this.matrixWorld=new d0,this.matrixAutoUpdate=KJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=KJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new v7,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 Z7.setFromAxisAngle(J,Q),this.quaternion.multiply(Z7),this}rotateOnWorldAxis(J,Q){return Z7.setFromAxisAngle(J,Q),this.quaternion.premultiply(Z7),this}rotateX(J){return this.rotateOnAxis(xX,J)}rotateY(J){return this.rotateOnAxis(gX,J)}rotateZ(J){return this.rotateOnAxis(pX,J)}translateOnAxis(J,Q){return hX.copy(J).applyQuaternion(this.quaternion),this.position.add(hX.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(xX,J)}translateY(J){return this.translateOnAxis(gX,J)}translateZ(J){return this.translateOnAxis(pX,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(f9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)MQ.copy(J);else MQ.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),n7.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)f9.lookAt(n7,MQ,this.up);else f9.lookAt(MQ,n7,this.up);if(this.quaternion.setFromRotationMatrix(f9),Z)f9.extractRotation(Z.matrixWorld),Z7.setFromRotationMatrix(f9),this.quaternion.premultiply(Z7.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 T0("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(mX),W7.child=J,this.dispatchEvent(W7),W7.child=null;else T0("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(m5),FW.child=J,this.dispatchEvent(FW),FW.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),f9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),f9.multiply(J.parent.matrixWorld);return J.applyMatrix4(f9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(mX),W7.child=J,this.dispatchEvent(W7),W7.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 K=this.children[$].getObjectByProperty(J,Q);if(K!==void 0)return K}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let Z=this.children;for(let W=0,K=Z.length;W<K;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(n7,J,g5),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n7,p5,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,K=Z.length;W<K;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((Y)=>({...Y,boundingBox:Y.boundingBox?Y.boundingBox.toJSON():void 0,boundingSphere:Y.boundingSphere?Y.boundingSphere.toJSON():void 0})),Z.instanceInfo=this._instanceInfo.map((Y)=>({...Y})),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(Y,X){if(Y[X.uuid]===void 0)Y[X.uuid]=X.toJSON(J);return X.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 Y=this.geometry.parameters;if(Y!==void 0&&Y.shapes!==void 0){let X=Y.shapes;if(Array.isArray(X))for(let H=0,U=X.length;H<U;H++){let E=X[H];W(J.shapes,E)}else W(J.shapes,X)}}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 Y=[];for(let X=0,H=this.material.length;X<H;X++)Y.push(W(J.materials,this.material[X]));Z.material=Y}else Z.material=W(J.materials,this.material);if(this.children.length>0){Z.children=[];for(let Y=0;Y<this.children.length;Y++)Z.children.push(this.children[Y].toJSON(J).object)}if(this.animations.length>0){Z.animations=[];for(let Y=0;Y<this.animations.length;Y++){let X=this.animations[Y];Z.animations.push(W(J.animations,X))}}if(Q){let Y=K(J.geometries),X=K(J.materials),H=K(J.textures),U=K(J.images),E=K(J.shapes),N=K(J.skeletons),G=K(J.animations),q=K(J.nodes);if(Y.length>0)$.geometries=Y;if(X.length>0)$.materials=X;if(H.length>0)$.textures=H;if(U.length>0)$.images=U;if(E.length>0)$.shapes=E;if(N.length>0)$.skeletons=N;if(G.length>0)$.animations=G;if(q.length>0)$.nodes=q}return $.object=Z,$;function K(Y){let X=[];for(let H in Y){let U=Y[H];delete U.metadata,X.push(U)}return X}}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}};KJ.DEFAULT_UP=new P(0,1,0);KJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;KJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;Y8=class Y8 extends KJ{constructor(){super();this.isGroup=!0,this.type="Group"}};d5={type:"move"};WG={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},J8={h:0,s:0,l:0},LQ={h:0,s:0,l:0};V0=class V0{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,$J.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=$J.workingColorSpace){return this.r=J,this.g=Q,this.b=$,$J.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=$J.workingColorSpace){if(J=eK(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,K=2*$-W;this.r=RW(K,W,J+0.3333333333333333),this.g=RW(K,W,J),this.b=RW(K,W,J-0.3333333333333333)}return $J.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)H0("Color: Alpha component of "+J+" will be ignored.")}let Z;if(Z=/^(\w+)\(([^\)]*)\)/.exec(J)){let W,K=Z[1],Y=Z[2];switch(K){case"rgb":case"rgba":if(W=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Y))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(Y))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(Y))return $(W[4]),this.setHSL(parseFloat(W[1])/360,parseFloat(W[2])/100,parseFloat(W[3])/100,Q);break;default:H0("Color: Unknown color model "+J)}}else if(Z=/^\#([A-Fa-f\d]+)$/.exec(J)){let W=Z[1],K=W.length;if(K===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(K===6)return this.setHex(parseInt(W,16),Q);else H0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=WG[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else H0("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=d9(J.r),this.g=d9(J.g),this.b=d9(J.b),this}copyLinearToSRGB(J){return this.r=B7(J.r),this.g=B7(J.g),this.b=B7(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return $J.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=$J.workingColorSpace){$J.workingToColorSpace(xJ.copy(this),Q);let{r:$,g:Z,b:W}=xJ,K=Math.max($,Z,W),Y=Math.min($,Z,W),X,H,U=(Y+K)/2;if(Y===K)X=0,H=0;else{let E=K-Y;switch(H=U<=0.5?E/(K+Y):E/(2-K-Y),K){case $:X=(Z-W)/E+(Z<W?6:0);break;case Z:X=(W-$)/E+2;break;case W:X=($-Z)/E+4;break}X/=6}return J.h=X,J.s=H,J.l=U,J}getRGB(J,Q=$J.workingColorSpace){return $J.workingToColorSpace(xJ.copy(this),Q),J.r=xJ.r,J.g=xJ.g,J.b=xJ.b,J}getStyle(J="srgb"){$J.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(J8),this.setHSL(J8.h+J,J8.s+Q,J8.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(J8),J.getHSL(LQ);let $=Y6(J8.h,LQ.h,Q),Z=Y6(J8.s,LQ.s,Q),W=Y6(J8.l,LQ.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}};xJ=new V0;V0.NAMES=WG;GZ=class GZ extends KJ{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 H9,this.environmentIntensity=1,this.environmentRotation=new H9,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}};D9=new P,b9=new P,OW=new P,h9=new P,K7=new P,Y7=new P,dX=new P,kW=new P,MW=new P,LW=new P,VW=new GJ,BW=new GJ,zW=new GJ;x9=[new P,new P,new P,new P,new P,new P,new P,new P],F9=new P,VQ=new jJ,X7=new P,H7=new P,U7=new P,Q8=new P,$8=new P,B8=new P,s7=new P,BQ=new P,zQ=new P,z8=new P;m9=l5();AJ=new P,IQ=new r;UJ=class UJ extends Z9{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:u5++}),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++)IQ.fromBufferAttribute(this,Q),IQ.applyMatrix3(J),this.setXY(Q,IQ.x,IQ.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)AJ.fromBufferAttribute(this,Q),AJ.applyMatrix3(J),this.setXYZ(Q,AJ.x,AJ.y,AJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)AJ.fromBufferAttribute(this,Q),AJ.applyMatrix4(J),this.setXYZ(Q,AJ.x,AJ.y,AJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)AJ.fromBufferAttribute(this,Q),AJ.applyNormalMatrix(J),this.setXYZ(Q,AJ.x,AJ.y,AJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)AJ.fromBufferAttribute(this,Q),AJ.transformDirection(J),this.setXYZ(Q,AJ.x,AJ.y,AJ.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)$=lJ($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=o0($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=lJ(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=o0(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=lJ(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=o0(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=lJ(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=o0(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=lJ(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array),Z=o0(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=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array),W=o0(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"})}};ZY=class ZY extends UJ{constructor(J,Q,$){super(new Int8Array(J),Q,$)}};WY=class WY extends UJ{constructor(J,Q,$){super(new Uint8Array(J),Q,$)}};KY=class KY extends UJ{constructor(J,Q,$){super(new Uint8ClampedArray(J),Q,$)}};YY=class YY extends UJ{constructor(J,Q,$){super(new Int16Array(J),Q,$)}};P6=class P6 extends UJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}};XY=class XY extends UJ{constructor(J,Q,$){super(new Int32Array(J),Q,$)}};T6=class T6 extends UJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}};HY=class HY extends UJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$);this.isFloat16BufferAttribute=!0}getX(J){let Q=W6(this.array[J*this.itemSize]);if(this.normalized)Q=lJ(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize]=oJ(Q),this}getY(J){let Q=W6(this.array[J*this.itemSize+1]);if(this.normalized)Q=lJ(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+1]=oJ(Q),this}getZ(J){let Q=W6(this.array[J*this.itemSize+2]);if(this.normalized)Q=lJ(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+2]=oJ(Q),this}getW(J){let Q=W6(this.array[J*this.itemSize+3]);if(this.normalized)Q=lJ(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=o0(Q,this.array);return this.array[J*this.itemSize+3]=oJ(Q),this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array);return this.array[J+0]=oJ(Q),this.array[J+1]=oJ($),this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array);return this.array[J+0]=oJ(Q),this.array[J+1]=oJ($),this.array[J+2]=oJ(Z),this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=o0(Q,this.array),$=o0($,this.array),Z=o0(Z,this.array),W=o0(W,this.array);return this.array[J+0]=oJ(Q),this.array[J+1]=oJ($),this.array[J+2]=oJ(Z),this.array[J+3]=oJ(W),this}};z0=class z0 extends UJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}};c5=new jJ,i7=new P,_W=new P;Y9=new d0,AW=new KJ,G7=new P,J9=new jJ,o7=new jJ,SJ=new P;c0=class c0 extends Z9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:n5++}),this.uuid=Q9(),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((F5(J))?T6:P6)(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 u0().getNormalMatrix(J);$.applyNormalMatrix(W),$.needsUpdate=!0}let Z=this.attributes.tangent;if(Z!==void 0)Z.transformDirection(J),Z.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this}applyQuaternion(J){return Y9.makeRotationFromQuaternion(J),this.applyMatrix4(Y9),this}rotateX(J){return Y9.makeRotationX(J),this.applyMatrix4(Y9),this}rotateY(J){return Y9.makeRotationY(J),this.applyMatrix4(Y9),this}rotateZ(J){return Y9.makeRotationZ(J),this.applyMatrix4(Y9),this}translate(J,Q,$){return Y9.makeTranslation(J,Q,$),this.applyMatrix4(Y9),this}scale(J,Q,$){return Y9.makeScale(J,Q,$),this.applyMatrix4(Y9),this}lookAt(J){return AW.lookAt(J),AW.updateMatrix(),this.applyMatrix4(AW.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(G7).negate(),this.translate(G7.x,G7.y,G7.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 K=J[Z];$.push(K.x,K.y,K.z||0)}this.setAttribute("position",new z0($,3))}else{let $=Math.min(J.length,Q.count);for(let Z=0;Z<$;Z++){let W=J[Z];Q.setXYZ(Z,W.x,W.y,W.z||0)}if(J.length>Q.count)H0("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 jJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){T0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(J9.setFromBufferAttribute(W),this.morphTargetsRelative)SJ.addVectors(this.boundingBox.min,J9.min),this.boundingBox.expandByPoint(SJ),SJ.addVectors(this.boundingBox.max,J9.max),this.boundingBox.expandByPoint(SJ);else this.boundingBox.expandByPoint(J9.min),this.boundingBox.expandByPoint(J9.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))T0('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 wJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){T0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new P,1/0);return}if(J){let $=this.boundingSphere.center;if(J9.setFromBufferAttribute(J),Q)for(let W=0,K=Q.length;W<K;W++){let Y=Q[W];if(o7.setFromBufferAttribute(Y),this.morphTargetsRelative)SJ.addVectors(J9.min,o7.min),J9.expandByPoint(SJ),SJ.addVectors(J9.max,o7.max),J9.expandByPoint(SJ);else J9.expandByPoint(o7.min),J9.expandByPoint(o7.max)}J9.getCenter($);let Z=0;for(let W=0,K=J.count;W<K;W++)SJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(SJ));if(Q)for(let W=0,K=Q.length;W<K;W++){let Y=Q[W],X=this.morphTargetsRelative;for(let H=0,U=Y.count;H<U;H++){if(SJ.fromBufferAttribute(Y,H),X)G7.fromBufferAttribute(J,H),SJ.add(G7);Z=Math.max(Z,$.distanceToSquared(SJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))T0('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){T0("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 UJ(new Float32Array(4*$.count),4));let K=this.getAttribute("tangent"),Y=[],X=[];for(let C=0;C<$.count;C++)Y[C]=new P,X[C]=new P;let H=new P,U=new P,E=new P,N=new r,G=new r,q=new r,R=new P,O=new P;function F(C,L,I){H.fromBufferAttribute($,C),U.fromBufferAttribute($,L),E.fromBufferAttribute($,I),N.fromBufferAttribute(W,C),G.fromBufferAttribute(W,L),q.fromBufferAttribute(W,I),U.sub(H),E.sub(H),G.sub(N),q.sub(N);let b=1/(G.x*q.y-q.x*G.y);if(!isFinite(b))return;R.copy(U).multiplyScalar(q.y).addScaledVector(E,-G.y).multiplyScalar(b),O.copy(E).multiplyScalar(G.x).addScaledVector(U,-q.x).multiplyScalar(b),Y[C].add(R),Y[L].add(R),Y[I].add(R),X[C].add(O),X[L].add(O),X[I].add(O)}let D=this.groups;if(D.length===0)D=[{start:0,count:J.count}];for(let C=0,L=D.length;C<L;++C){let I=D[C],b=I.start,T=I.count;for(let g=b,u=b+T;g<u;g+=3)F(J.getX(g+0),J.getX(g+1),J.getX(g+2))}let k=new P,M=new P,V=new P,_=new P;function A(C){V.fromBufferAttribute(Z,C),_.copy(V);let L=Y[C];k.copy(L),k.sub(V.multiplyScalar(V.dot(L))).normalize(),M.crossVectors(_,L);let b=M.dot(X[C])<0?-1:1;K.setXYZW(C,k.x,k.y,k.z,b)}for(let C=0,L=D.length;C<L;++C){let I=D[C],b=I.start,T=I.count;for(let g=b,u=b+T;g<u;g+=3)A(J.getX(g+0)),A(J.getX(g+1)),A(J.getX(g+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new UJ(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let N=0,G=$.count;N<G;N++)$.setXYZ(N,0,0,0);let Z=new P,W=new P,K=new P,Y=new P,X=new P,H=new P,U=new P,E=new P;if(J)for(let N=0,G=J.count;N<G;N+=3){let q=J.getX(N+0),R=J.getX(N+1),O=J.getX(N+2);Z.fromBufferAttribute(Q,q),W.fromBufferAttribute(Q,R),K.fromBufferAttribute(Q,O),U.subVectors(K,W),E.subVectors(Z,W),U.cross(E),Y.fromBufferAttribute($,q),X.fromBufferAttribute($,R),H.fromBufferAttribute($,O),Y.add(U),X.add(U),H.add(U),$.setXYZ(q,Y.x,Y.y,Y.z),$.setXYZ(R,X.x,X.y,X.z),$.setXYZ(O,H.x,H.y,H.z)}else for(let N=0,G=Q.count;N<G;N+=3)Z.fromBufferAttribute(Q,N+0),W.fromBufferAttribute(Q,N+1),K.fromBufferAttribute(Q,N+2),U.subVectors(K,W),E.subVectors(Z,W),U.cross(E),$.setXYZ(N+0,U.x,U.y,U.z),$.setXYZ(N+1,U.x,U.y,U.z),$.setXYZ(N+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++)SJ.fromBufferAttribute(J,Q),SJ.normalize(),J.setXYZ(Q,SJ.x,SJ.y,SJ.z)}toNonIndexed(){function J(Y,X){let{array:H,itemSize:U,normalized:E}=Y,N=new H.constructor(X.length*U),G=0,q=0;for(let R=0,O=X.length;R<O;R++){if(Y.isInterleavedBufferAttribute)G=X[R]*Y.data.stride+Y.offset;else G=X[R]*U;for(let F=0;F<U;F++)N[q++]=H[G++]}return new UJ(N,U,E)}if(this.index===null)return H0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new c0,$=this.index.array,Z=this.attributes;for(let Y in Z){let X=Z[Y],H=J(X,$);Q.setAttribute(Y,H)}let W=this.morphAttributes;for(let Y in W){let X=[],H=W[Y];for(let U=0,E=H.length;U<E;U++){let N=H[U],G=J(N,$);X.push(G)}Q.morphAttributes[Y]=X}Q.morphTargetsRelative=this.morphTargetsRelative;let K=this.groups;for(let Y=0,X=K.length;Y<X;Y++){let H=K[Y];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 X=this.parameters;for(let H in X)if(X[H]!==void 0)J[H]=X[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 X in $){let H=$[X];J.data.attributes[X]=H.toJSON(J.data)}let Z={},W=!1;for(let X in this.morphAttributes){let H=this.morphAttributes[X],U=[];for(let E=0,N=H.length;E<N;E++){let G=H[E];U.push(G.toJSON(J.data))}if(U.length>0)Z[X]=U,W=!0}if(W)J.data.morphAttributes=Z,J.data.morphTargetsRelative=this.morphTargetsRelative;let K=this.groups;if(K.length>0)J.data.groups=JSON.parse(JSON.stringify(K));let Y=this.boundingSphere;if(Y!==null)J.data.boundingSphere=Y.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=[],E=W[H];for(let N=0,G=E.length;N<G;N++)U.push(E[N].clone(Q));this.morphAttributes[H]=U}this.morphTargetsRelative=J.morphTargetsRelative;let K=J.groups;for(let H=0,U=K.length;H<U;H++){let E=K[H];this.addGroup(E.start,E.count,E.materialIndex)}let Y=J.boundingBox;if(Y!==null)this.boundingBox=Y.clone();let X=J.boundingSphere;if(X!==null)this.boundingSphere=X.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};dJ=new P;yJ=class yJ extends Z9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:s5++}),this.uuid=Q9(),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 V0(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){H0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){H0(`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 K=[];for(let Y in W){let X=W[Y];delete X.metadata,K.push(X)}return K}if(Q){let W=Z(J.textures),K=Z(J.images);if(W.length>0)$.textures=W;if(K.length>0)$.images=K}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++}};S6=class S6 extends yJ{constructor(J){super();this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new V0(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.rotation=J.rotation,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}};a7=new P,N7=new P,q7=new P,D7=new r,r7=new r,KG=new d0,_Q=new P,t7=new P,AQ=new P,lX=new r,CW=new r,uX=new r;EZ=class EZ extends KJ{constructor(J=new S6){super();if(this.isSprite=!0,this.type="Sprite",E7===void 0){E7=new c0;let Q=new Float32Array([-0.5,-0.5,0,0,0,0.5,-0.5,0,1,0,0.5,0.5,0,1,1,-0.5,0.5,0,0,1]),$=new b7(Q,5);E7.setIndex([0,1,2,0,2,3]),E7.setAttribute("position",new H8($,3,0,!1)),E7.setAttribute("uv",new H8($,2,3,!1))}this.geometry=E7,this.material=J,this.center=new r(0.5,0.5),this.count=1}raycast(J,Q){if(J.camera===null)T0('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');if(N7.setFromMatrixScale(this.matrixWorld),KG.copy(J.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(J.camera.matrixWorldInverse,this.matrixWorld),q7.setFromMatrixPosition(this.modelViewMatrix),J.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1)N7.multiplyScalar(-q7.z);let $=this.material.rotation,Z,W;if($!==0)W=Math.cos($),Z=Math.sin($);let K=this.center;CQ(_Q.set(-0.5,-0.5,0),q7,K,N7,Z,W),CQ(t7.set(0.5,-0.5,0),q7,K,N7,Z,W),CQ(AQ.set(0.5,0.5,0),q7,K,N7,Z,W),lX.set(0,0),CW.set(1,0),uX.set(1,1);let Y=J.ray.intersectTriangle(_Q,t7,AQ,!1,a7);if(Y===null){if(CQ(t7.set(-0.5,0.5,0),q7,K,N7,Z,W),CW.set(0,1),Y=J.ray.intersectTriangle(_Q,AQ,t7,!1,a7),Y===null)return}let X=J.ray.origin.distanceTo(a7);if(X<J.near||X>J.far)return;Q.push({distance:X,point:a7.clone(),uv:uJ.getInterpolation(a7,_Q,t7,AQ,lX,CW,uX,new r),face:null,object:this})}copy(J,Q){if(super.copy(J,Q),J.center!==void 0)this.center.copy(J.center);return this.material=J.material,this}};wQ=new P,cX=new P;NZ=class NZ extends KJ{constructor(){super();this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(J){super.copy(J,!1);let Q=J.levels;for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];this.addLevel(W.object.clone(),W.distance,W.hysteresis)}return this.autoUpdate=J.autoUpdate,this}addLevel(J,Q=0,$=0){Q=Math.abs(Q);let Z=this.levels,W;for(W=0;W<Z.length;W++)if(Q<Z[W].distance)break;return Z.splice(W,0,{distance:Q,hysteresis:$,object:J}),this.add(J),this}removeLevel(J){let Q=this.levels;for(let $=0;$<Q.length;$++)if(Q[$].distance===J){let Z=Q.splice($,1);return this.remove(Z[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(J){let Q=this.levels;if(Q.length>0){let $,Z;for($=1,Z=Q.length;$<Z;$++){let W=Q[$].distance;if(Q[$].object.visible)W-=W*Q[$].hysteresis;if(J<W)break}return Q[$-1].object}return null}raycast(J,Q){if(this.levels.length>0){wQ.setFromMatrixPosition(this.matrixWorld);let Z=J.ray.origin.distanceTo(wQ);this.getObjectForDistance(Z).raycast(J,Q)}}update(J){let Q=this.levels;if(Q.length>1){wQ.setFromMatrixPosition(J.matrixWorld),cX.setFromMatrixPosition(this.matrixWorld);let $=wQ.distanceTo(cX)/J.zoom;Q[0].object.visible=!0;let Z,W;for(Z=1,W=Q.length;Z<W;Z++){let K=Q[Z].distance;if(Q[Z].object.visible)K-=K*Q[Z].hysteresis;if($>=K)Q[Z-1].object.visible=!1,Q[Z].object.visible=!0;else break}this._currentLevel=Z-1;for(;Z<W;Z++)Q[Z].object.visible=!1}}toJSON(J){let Q=super.toJSON(J);if(this.autoUpdate===!1)Q.object.autoUpdate=!1;Q.object.levels=[];let $=this.levels;for(let Z=0,W=$.length;Z<W;Z++){let K=$[Z];Q.object.levels.push({object:K.object.uuid,distance:K.distance,hysteresis:K.hysteresis})}return Q}};g9=new P,wW=new P,PQ=new P,Z8=new P,PW=new P,TQ=new P,TW=new P;j9=class j9 extends yJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new V0(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 H9,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}};nX=new d0,I8=new R8,SQ=new wJ,sX=new P,jQ=new P,yQ=new P,vQ=new P,SW=new P,fQ=new P,iX=new P,bQ=new P;VJ=class VJ extends KJ{constructor(J=new c0,Q=new j9){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,K=Z.length;W<K;W++){let Y=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Y]=W}}}}getVertexPosition(J,Q){let $=this.geometry,Z=$.attributes.position,W=$.morphAttributes.position,K=$.morphTargetsRelative;Q.fromBufferAttribute(Z,J);let Y=this.morphTargetInfluences;if(W&&Y){fQ.set(0,0,0);for(let X=0,H=W.length;X<H;X++){let U=Y[X],E=W[X];if(U===0)continue;if(SW.fromBufferAttribute(E,J),K)fQ.addScaledVector(SW,U);else fQ.addScaledVector(SW.sub(Q),U)}Q.add(fQ)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(SQ.copy($.boundingSphere),SQ.applyMatrix4(W),I8.copy(J.ray).recast(J.near),SQ.containsPoint(I8.origin)===!1){if(I8.intersectSphere(SQ,sX)===null)return;if(I8.origin.distanceToSquared(sX)>(J.far-J.near)**2)return}if(nX.copy(W).invert(),I8.copy(J.ray).applyMatrix4(nX),$.boundingBox!==null){if(I8.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,I8)}_computeIntersections(J,Q,$){let Z,W=this.geometry,K=this.material,Y=W.index,X=W.attributes.position,H=W.attributes.uv,U=W.attributes.uv1,E=W.attributes.normal,N=W.groups,G=W.drawRange;if(Y!==null)if(Array.isArray(K))for(let q=0,R=N.length;q<R;q++){let O=N[q],F=K[O.materialIndex],D=Math.max(O.start,G.start),k=Math.min(Y.count,Math.min(O.start+O.count,G.start+G.count));for(let M=D,V=k;M<V;M+=3){let _=Y.getX(M),A=Y.getX(M+1),C=Y.getX(M+2);if(Z=hQ(this,F,J,$,H,U,E,_,A,C),Z)Z.faceIndex=Math.floor(M/3),Z.face.materialIndex=O.materialIndex,Q.push(Z)}}else{let q=Math.max(0,G.start),R=Math.min(Y.count,G.start+G.count);for(let O=q,F=R;O<F;O+=3){let D=Y.getX(O),k=Y.getX(O+1),M=Y.getX(O+2);if(Z=hQ(this,K,J,$,H,U,E,D,k,M),Z)Z.faceIndex=Math.floor(O/3),Q.push(Z)}}else if(X!==void 0)if(Array.isArray(K))for(let q=0,R=N.length;q<R;q++){let O=N[q],F=K[O.materialIndex],D=Math.max(O.start,G.start),k=Math.min(X.count,Math.min(O.start+O.count,G.start+G.count));for(let M=D,V=k;M<V;M+=3){let _=M,A=M+1,C=M+2;if(Z=hQ(this,F,J,$,H,U,E,_,A,C),Z)Z.faceIndex=Math.floor(M/3),Z.face.materialIndex=O.materialIndex,Q.push(Z)}}else{let q=Math.max(0,G.start),R=Math.min(X.count,G.start+G.count);for(let O=q,F=R;O<F;O+=3){let D=O,k=O+1,M=O+2;if(Z=hQ(this,K,J,$,H,U,E,D,k,M),Z)Z.faceIndex=Math.floor(O/3),Q.push(Z)}}}};e7=new GJ,oX=new GJ,aX=new GJ,o5=new GJ,rX=new d0,xQ=new P,jW=new wJ,tX=new d0,yW=new R8;qZ=class qZ extends VJ{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new d0,this.bindMatrixInverse=new d0,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let J=this.geometry;if(this.boundingBox===null)this.boundingBox=new jJ;this.boundingBox.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,xQ),this.boundingBox.expandByPoint(xQ)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new wJ;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,xQ),this.boundingSphere.expandByPoint(xQ)}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(jW.copy(this.boundingSphere),jW.applyMatrix4(Z),J.ray.intersectsSphere(jW)===!1)return;if(tX.copy(Z).invert(),yW.copy(J.ray).applyMatrix4(tX),this.boundingBox!==null){if(yW.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,yW)}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 GJ,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 H0("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(J,Q){let $=this.skeleton,Z=this.geometry;if(oX.fromBufferAttribute(Z.attributes.skinIndex,J),aX.fromBufferAttribute(Z.attributes.skinWeight,J),Q.isVector4)e7.copy(Q),Q.set(0,0,0,0);else e7.set(...Q,1),Q.set(0,0,0);e7.applyMatrix4(this.bindMatrix);for(let W=0;W<4;W++){let K=aX.getComponent(W);if(K!==0){let Y=oX.getComponent(W);rX.multiplyMatrices($.bones[Y].matrixWorld,$.boneInverses[Y]),Q.addScaledVector(o5.copy(e7).applyMatrix4(rX),K)}}if(Q.isVector4)Q.w=e7.w;return Q.applyMatrix4(this.bindMatrixInverse)}};j6=class j6 extends KJ{constructor(){super();this.isBone=!0,this.type="Bone"}};$9=class $9 extends OJ{constructor(J=null,Q=1,$=1,Z,W,K,Y,X,H=1003,U=1003,E,N){super(null,K,Y,X,H,U,Z,W,E,N);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};eX=new d0,a5=new d0;U8=class U8 extends UJ{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}};F7=new d0,JH=new d0,gQ=[],QH=new jJ,r5=new d0,J6=new VJ,Q6=new wJ;DZ=class DZ extends VJ{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new U8(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,r5)}computeBoundingBox(){let J=this.geometry,Q=this.count;if(this.boundingBox===null)this.boundingBox=new jJ;if(J.boundingBox===null)J.computeBoundingBox();this.boundingBox.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,F7),QH.copy(J.boundingBox).applyMatrix4(F7),this.boundingBox.union(QH)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new wJ;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,F7),Q6.copy(J.boundingSphere).applyMatrix4(F7),this.boundingSphere.union(Q6)}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,K=J*W+1;for(let Y=0;Y<$.length;Y++)$[Y]=Z[K+Y]}raycast(J,Q){let $=this.matrixWorld,Z=this.count;if(J6.geometry=this.geometry,J6.material=this.material,J6.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Q6.copy(this.boundingSphere),Q6.applyMatrix4($),J.ray.intersectsSphere(Q6)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,F7),JH.multiplyMatrices($,F7),J6.matrixWorld=JH,J6.raycast(J,gQ);for(let K=0,Y=gQ.length;K<Y;K++){let X=gQ[K];X.instanceId=W,X.object=this,Q.push(X)}gQ.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new U8(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 $9(new Float32Array(Z*this.count),Z,this.count,1028,1015);let W=this.morphTexture.source.data.data,K=0;for(let H=0;H<$.length;H++)K+=$[H];let Y=this.geometry.morphTargetsRelative?1:1-K,X=Z*J;return W[X]=Y,W.set($,X+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}};vW=new P,t5=new P,e5=new u0;_8=new wJ,JE=new r(0.5,0.5),pQ=new P;I9=new d0,_9=new O8;iJ=new d0,ZE=new V0(1,1,1),$H=new O8,WE=new v6,mQ=new jJ,A8=new wJ,$6=new P,ZH=new P,KE=new P,bW=new YG,gJ=new VJ,dQ=[];FZ=class FZ extends VJ{constructor(J,Q,$=Q*2,Z){super(new c0,Z);this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=J,this._maxVertexCount=Q,this._maxIndexCount=$,this._multiDrawCounts=new Int32Array(J),this._multiDrawStarts=new Int32Array(J),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let J=Math.sqrt(this._maxInstanceCount*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4),$=new $9(Q,J,J,1023,1015);this._matricesTexture=$}_initIndirectTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Uint32Array(J*J),$=new $9(Q,J,J,1029,1014);this._indirectTexture=$}_initColorsTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Float32Array(J*J*4).fill(1),$=new $9(Q,J,J,1023,1015);$.colorSpace=$J.workingColorSpace,this._colorsTexture=$}_initializeGeometry(J){let Q=this.geometry,$=this._maxVertexCount,Z=this._maxIndexCount;if(this._geometryInitialized===!1){for(let W in J.attributes){let K=J.getAttribute(W),{array:Y,itemSize:X,normalized:H}=K,U=new Y.constructor($*X),E=new UJ(U,X,H);Q.setAttribute(W,E)}if(J.getIndex()!==null){let W=$>65535?new Uint32Array(Z):new Uint16Array(Z);Q.setIndex(new UJ(W,1))}this._geometryInitialized=!0}}_validateGeometry(J){let Q=this.geometry;if(Boolean(J.getIndex())!==Boolean(Q.getIndex()))throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let $ in Q.attributes){if(!J.hasAttribute($))throw Error(`THREE.BatchedMesh: Added geometry missing "${$}". All geometries must have consistent attributes.`);let Z=J.getAttribute($),W=Q.getAttribute($);if(Z.itemSize!==W.itemSize||Z.normalized!==W.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(J){let Q=this._instanceInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${J}. Instance is either out of range or has been deleted.`)}validateGeometryId(J){let Q=this._geometryInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${J}. Geometry is either out of range or has been deleted.`)}setCustomSort(J){return this.customSort=J,this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new jJ;let J=this.boundingBox,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,iJ),this.getBoundingBoxAt(W,mQ).applyMatrix4(iJ),J.union(mQ)}}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new wJ;let J=this.boundingSphere,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,iJ),this.getBoundingSphereAt(W,A8).applyMatrix4(iJ),J.union(A8)}}addInstance(J){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error("THREE.BatchedMesh: Maximum item count reached.");let $={visible:!0,active:!0,geometryIndex:J},Z=null;if(this._availableInstanceIds.length>0)this._availableInstanceIds.sort(fW),Z=this._availableInstanceIds.shift(),this._instanceInfo[Z]=$;else Z=this._instanceInfo.length,this._instanceInfo.push($);let W=this._matricesTexture;iJ.identity().toArray(W.image.data,Z*16),W.needsUpdate=!0;let K=this._colorsTexture;if(K)ZE.toArray(K.image.data,Z*4),K.needsUpdate=!0;return this._visibilityChanged=!0,Z}addGeometry(J,Q=-1,$=-1){this._initializeGeometry(J),this._validateGeometry(J);let Z={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},W=this._geometryInfo;Z.vertexStart=this._nextVertexStart,Z.reservedVertexCount=Q===-1?J.getAttribute("position").count:Q;let K=J.getIndex();if(K!==null)Z.indexStart=this._nextIndexStart,Z.reservedIndexCount=$===-1?K.count:$;if(Z.indexStart!==-1&&Z.indexStart+Z.reservedIndexCount>this._maxIndexCount||Z.vertexStart+Z.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let X;if(this._availableGeometryIds.length>0)this._availableGeometryIds.sort(fW),X=this._availableGeometryIds.shift(),W[X]=Z;else X=this._geometryCount,this._geometryCount++,W.push(Z);return this.setGeometryAt(X,J),this._nextIndexStart=Z.indexStart+Z.reservedIndexCount,this._nextVertexStart=Z.vertexStart+Z.reservedVertexCount,X}setGeometryAt(J,Q){if(J>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Q);let $=this.geometry,Z=$.getIndex()!==null,W=$.getIndex(),K=Q.getIndex(),Y=this._geometryInfo[J];if(Z&&K.count>Y.reservedIndexCount||Q.attributes.position.count>Y.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let{vertexStart:X,reservedVertexCount:H}=Y;Y.vertexCount=Q.getAttribute("position").count;for(let U in $.attributes){let E=Q.getAttribute(U),N=$.getAttribute(U);YE(E,N,X);let G=E.itemSize;for(let q=E.count,R=H;q<R;q++){let O=X+q;for(let F=0;F<G;F++)N.setComponent(O,F,0)}N.needsUpdate=!0,N.addUpdateRange(X*G,H*G)}if(Z){let{indexStart:U,reservedIndexCount:E}=Y;Y.indexCount=Q.getIndex().count;for(let N=0;N<K.count;N++)W.setX(U+N,X+K.getX(N));for(let N=K.count,G=E;N<G;N++)W.setX(U+N,X);W.needsUpdate=!0,W.addUpdateRange(U,Y.reservedIndexCount)}if(Y.start=Z?Y.indexStart:Y.vertexStart,Y.count=Z?Y.indexCount:Y.vertexCount,Y.boundingBox=null,Q.boundingBox!==null)Y.boundingBox=Q.boundingBox.clone();if(Y.boundingSphere=null,Q.boundingSphere!==null)Y.boundingSphere=Q.boundingSphere.clone();return this._visibilityChanged=!0,J}deleteGeometry(J){let Q=this._geometryInfo;if(J>=Q.length||Q[J].active===!1)return this;let $=this._instanceInfo;for(let Z=0,W=$.length;Z<W;Z++)if($[Z].active&&$[Z].geometryIndex===J)this.deleteInstance(Z);return Q[J].active=!1,this._availableGeometryIds.push(J),this._visibilityChanged=!0,this}deleteInstance(J){return this.validateInstanceId(J),this._instanceInfo[J].active=!1,this._availableInstanceIds.push(J),this._visibilityChanged=!0,this}optimize(){let J=0,Q=0,$=this._geometryInfo,Z=$.map((K,Y)=>Y).sort((K,Y)=>{return $[K].vertexStart-$[Y].vertexStart}),W=this.geometry;for(let K=0,Y=$.length;K<Y;K++){let X=Z[K],H=$[X];if(H.active===!1)continue;if(W.index!==null){if(H.indexStart!==Q){let{indexStart:U,vertexStart:E,reservedIndexCount:N}=H,G=W.index,q=G.array,R=J-E;for(let O=U;O<U+N;O++)q[O]=q[O]+R;G.array.copyWithin(Q,U,U+N),G.addUpdateRange(Q,N),G.needsUpdate=!0,H.indexStart=Q}Q+=H.reservedIndexCount}if(H.vertexStart!==J){let{vertexStart:U,reservedVertexCount:E}=H,N=W.attributes;for(let G in N){let q=N[G],{array:R,itemSize:O}=q;R.copyWithin(J*O,U*O,(U+E)*O),q.addUpdateRange(J*O,E*O),q.needsUpdate=!0}H.vertexStart=J}J+=H.reservedVertexCount,H.start=W.index?H.indexStart:H.vertexStart}return this._nextIndexStart=Q,this._nextVertexStart=J,this._visibilityChanged=!0,this}getBoundingBoxAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingBox===null){let W=new jJ,K=$.index,Y=$.attributes.position;for(let X=Z.start,H=Z.start+Z.count;X<H;X++){let U=X;if(K)U=K.getX(U);W.expandByPoint($6.fromBufferAttribute(Y,U))}Z.boundingBox=W}return Q.copy(Z.boundingBox),Q}getBoundingSphereAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingSphere===null){let W=new wJ;this.getBoundingBoxAt(J,mQ),mQ.getCenter(W.center);let K=$.index,Y=$.attributes.position,X=0;for(let H=Z.start,U=Z.start+Z.count;H<U;H++){let E=H;if(K)E=K.getX(E);$6.fromBufferAttribute(Y,E),X=Math.max(X,W.center.distanceToSquared($6))}W.radius=Math.sqrt(X),Z.boundingSphere=W}return Q.copy(Z.boundingSphere),Q}setMatrixAt(J,Q){this.validateInstanceId(J);let $=this._matricesTexture,Z=this._matricesTexture.image.data;return Q.toArray(Z,J*16),$.needsUpdate=!0,this}getMatrixAt(J,Q){return this.validateInstanceId(J),Q.fromArray(this._matricesTexture.image.data,J*16)}setColorAt(J,Q){if(this.validateInstanceId(J),this._colorsTexture===null)this._initColorsTexture();return Q.toArray(this._colorsTexture.image.data,J*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(J,Q){if(this.validateInstanceId(J),this._colorsTexture===null)if(Q.isVector4)return Q.set(1,1,1,1);else return Q.setRGB(1,1,1);else return Q.fromArray(this._colorsTexture.image.data,J*4)}setVisibleAt(J,Q){if(this.validateInstanceId(J),this._instanceInfo[J].visible===Q)return this;return this._instanceInfo[J].visible=Q,this._visibilityChanged=!0,this}getVisibleAt(J){return this.validateInstanceId(J),this._instanceInfo[J].visible}setGeometryIdAt(J,Q){return this.validateInstanceId(J),this.validateGeometryId(Q),this._instanceInfo[J].geometryIndex=Q,this}getGeometryIdAt(J){return this.validateInstanceId(J),this._instanceInfo[J].geometryIndex}getGeometryRangeAt(J,Q={}){this.validateGeometryId(J);let $=this._geometryInfo[J];return Q.vertexStart=$.vertexStart,Q.vertexCount=$.vertexCount,Q.reservedVertexCount=$.reservedVertexCount,Q.indexStart=$.indexStart,Q.indexCount=$.indexCount,Q.reservedIndexCount=$.reservedIndexCount,Q.start=$.start,Q.count=$.count,Q}setInstanceCount(J){let Q=this._availableInstanceIds,$=this._instanceInfo;Q.sort(fW);while(Q[Q.length-1]===$.length-1)$.pop(),Q.pop();if(J<$.length)throw Error(`BatchedMesh: Instance ids outside the range ${J} are being used. Cannot shrink instance count.`);let Z=new Int32Array(J),W=new Int32Array(J);C8(this._multiDrawCounts,Z),C8(this._multiDrawStarts,W),this._multiDrawCounts=Z,this._multiDrawStarts=W,this._maxInstanceCount=J;let K=this._indirectTexture,Y=this._matricesTexture,X=this._colorsTexture;if(K.dispose(),this._initIndirectTexture(),C8(K.image.data,this._indirectTexture.image.data),Y.dispose(),this._initMatricesTexture(),C8(Y.image.data,this._matricesTexture.image.data),X)X.dispose(),this._initColorsTexture(),C8(X.image.data,this._colorsTexture.image.data)}setGeometrySize(J,Q){let $=[...this._geometryInfo].filter((Y)=>Y.active);if(Math.max(...$.map((Y)=>Y.vertexStart+Y.reservedVertexCount))>J)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${Q}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...$.map((X)=>X.indexStart+X.reservedIndexCount))>Q)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${Q}. Cannot shrink further.`)}let W=this.geometry;if(W.dispose(),this._maxVertexCount=J,this._maxIndexCount=Q,this._geometryInitialized)this._geometryInitialized=!1,this.geometry=new c0,this._initializeGeometry(W);let K=this.geometry;if(W.index)C8(W.index.array,K.index.array);for(let Y in W.attributes)C8(W.attributes[Y].array,K.attributes[Y].array)}raycast(J,Q){let $=this._instanceInfo,Z=this._geometryInfo,W=this.matrixWorld,K=this.geometry;if(gJ.material=this.material,gJ.geometry.index=K.index,gJ.geometry.attributes=K.attributes,gJ.geometry.boundingBox===null)gJ.geometry.boundingBox=new jJ;if(gJ.geometry.boundingSphere===null)gJ.geometry.boundingSphere=new wJ;for(let Y=0,X=$.length;Y<X;Y++){if(!$[Y].visible||!$[Y].active)continue;let H=$[Y].geometryIndex,U=Z[H];gJ.geometry.setDrawRange(U.start,U.count),this.getMatrixAt(Y,gJ.matrixWorld).premultiply(W),this.getBoundingBoxAt(H,gJ.geometry.boundingBox),this.getBoundingSphereAt(H,gJ.geometry.boundingSphere),gJ.raycast(J,dQ);for(let E=0,N=dQ.length;E<N;E++){let G=dQ[E];G.object=this,G.batchId=Y,Q.push(G)}dQ.length=0}gJ.material=null,gJ.geometry.index=null,gJ.geometry.attributes={},gJ.geometry.setDrawRange(0,1/0)}copy(J){if(super.copy(J),this.geometry=J.geometry.clone(),this.perObjectFrustumCulled=J.perObjectFrustumCulled,this.sortObjects=J.sortObjects,this.boundingBox=J.boundingBox!==null?J.boundingBox.clone():null,this.boundingSphere=J.boundingSphere!==null?J.boundingSphere.clone():null,this._geometryInfo=J._geometryInfo.map((Q)=>({...Q,boundingBox:Q.boundingBox!==null?Q.boundingBox.clone():null,boundingSphere:Q.boundingSphere!==null?Q.boundingSphere.clone():null})),this._instanceInfo=J._instanceInfo.map((Q)=>({...Q})),this._availableInstanceIds=J._availableInstanceIds.slice(),this._availableGeometryIds=J._availableGeometryIds.slice(),this._nextIndexStart=J._nextIndexStart,this._nextVertexStart=J._nextVertexStart,this._geometryCount=J._geometryCount,this._maxInstanceCount=J._maxInstanceCount,this._maxVertexCount=J._maxVertexCount,this._maxIndexCount=J._maxIndexCount,this._geometryInitialized=J._geometryInitialized,this._multiDrawCounts=J._multiDrawCounts.slice(),this._multiDrawStarts=J._multiDrawStarts.slice(),this._indirectTexture=J._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=J._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null)this._colorsTexture=J._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice();return this}dispose(){if(this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null)this._colorsTexture.dispose(),this._colorsTexture=null}onBeforeRender(J,Q,$,Z,W){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let K=Z.getIndex(),Y=K===null?1:K.array.BYTES_PER_ELEMENT,X=1;if(W.wireframe)X=2,Y=Z.attributes.position.count>65535?4:2;let H=this._instanceInfo,U=this._multiDrawStarts,E=this._multiDrawCounts,N=this._geometryInfo,G=this.perObjectFrustumCulled,q=this._indirectTexture,R=q.image.data,O=$.isArrayCamera?WE:$H;if(G&&!$.isArrayCamera)iJ.multiplyMatrices($.projectionMatrix,$.matrixWorldInverse).multiply(this.matrixWorld),$H.setFromProjectionMatrix(iJ,$.coordinateSystem,$.reversedDepth);let F=0;if(this.sortObjects){iJ.copy(this.matrixWorld).invert(),$6.setFromMatrixPosition($.matrixWorld).applyMatrix4(iJ),ZH.set(0,0,-1).transformDirection($.matrixWorld).transformDirection(iJ);for(let M=0,V=H.length;M<V;M++)if(H[M].visible&&H[M].active){let _=H[M].geometryIndex;this.getMatrixAt(M,iJ),this.getBoundingSphereAt(_,A8).applyMatrix4(iJ);let A=!1;if(G)A=!O.intersectsSphere(A8,$);if(!A){let C=N[_],L=KE.subVectors(A8.center,$6).dot(ZH);bW.push(C.start,C.count,L,M)}}let D=bW.list,k=this.customSort;if(k===null)D.sort(W.transparent?$E:QE);else k.call(this,D,$);for(let M=0,V=D.length;M<V;M++){let _=D[M];U[F]=_.start*Y*X,E[F]=_.count*X,R[F]=_.index,F++}bW.reset()}else for(let D=0,k=H.length;D<k;D++)if(H[D].visible&&H[D].active){let M=H[D].geometryIndex,V=!1;if(G)this.getMatrixAt(D,iJ),this.getBoundingSphereAt(M,A8).applyMatrix4(iJ),V=!O.intersectsSphere(A8,$);if(!V){let _=N[M];U[F]=_.start*Y*X,E[F]=_.count*X,R[F]=D,F++}}q.needsUpdate=!0,this._multiDrawCount=F,this._visibilityChanged=!1}onBeforeShadow(J,Q,$,Z,W,K){this.onBeforeRender(J,null,Z,W,K)}};fJ=class fJ extends yJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new V0(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}};X$=new P,H$=new P,WH=new d0,Z6=new R8,lQ=new wJ,hW=new P,KH=new P;P9=class P9 extends KJ{constructor(J=new c0,Q=new fJ){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++)X$.fromBufferAttribute(Q,Z-1),H$.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=X$.distanceTo(H$);J.setAttribute("lineDistance",new z0($,1))}else H0("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,K=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(lQ.copy($.boundingSphere),lQ.applyMatrix4(Z),lQ.radius+=W,J.ray.intersectsSphere(lQ)===!1)return;WH.copy(Z).invert(),Z6.copy(J.ray).applyMatrix4(WH);let Y=W/((this.scale.x+this.scale.y+this.scale.z)/3),X=Y*Y,H=this.isLineSegments?2:1,U=$.index,N=$.attributes.position;if(U!==null){let G=Math.max(0,K.start),q=Math.min(U.count,K.start+K.count);for(let R=G,O=q-1;R<O;R+=H){let F=U.getX(R),D=U.getX(R+1),k=uQ(this,J,Z6,X,F,D,R);if(k)Q.push(k)}if(this.isLineLoop){let R=U.getX(q-1),O=U.getX(G),F=uQ(this,J,Z6,X,R,O,q-1);if(F)Q.push(F)}}else{let G=Math.max(0,K.start),q=Math.min(N.count,K.start+K.count);for(let R=G,O=q-1;R<O;R+=H){let F=uQ(this,J,Z6,X,R,R+1,R);if(F)Q.push(F)}if(this.isLineLoop){let R=uQ(this,J,Z6,X,q-1,G,q-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,K=Z.length;W<K;W++){let Y=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Y]=W}}}}};YH=new P,XH=new P;E9=class E9 extends P9{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)YH.fromBufferAttribute(Q,Z),XH.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+YH.distanceTo(XH);J.setAttribute("lineDistance",new z0($,1))}else H0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};RZ=class RZ extends P9{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}};f6=class f6 extends yJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new V0(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}};HH=new d0,oW=new R8,cQ=new wJ,nQ=new P;OZ=class OZ extends KJ{constructor(J=new c0,Q=new f6){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,K=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(cQ.copy($.boundingSphere),cQ.applyMatrix4(Z),cQ.radius+=W,J.ray.intersectsSphere(cQ)===!1)return;HH.copy(Z).invert(),oW.copy(J.ray).applyMatrix4(HH);let Y=W/((this.scale.x+this.scale.y+this.scale.z)/3),X=Y*Y,H=$.index,E=$.attributes.position;if(H!==null){let N=Math.max(0,K.start),G=Math.min(H.count,K.start+K.count);for(let q=N,R=G;q<R;q++){let O=H.getX(q);nQ.fromBufferAttribute(E,O),UH(nQ,O,X,Z,J,Q,this)}}else{let N=Math.max(0,K.start),G=Math.min(E.count,K.start+K.count);for(let q=N,R=G;q<R;q++)nQ.fromBufferAttribute(E,q),UH(nQ,q,X,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,K=Z.length;W<K;W++){let Y=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Y]=W}}}}};kZ=class kZ extends OJ{constructor(J,Q,$,Z,W=1006,K=1006,Y,X,H){super(J,Q,$,Z,W,K,Y,X,H);this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let U=this;function E(){U.needsUpdate=!0,U._requestVideoFrameCallbackId=J.requestVideoFrameCallback(E)}if("requestVideoFrameCallback"in J)this._requestVideoFrameCallbackId=J.requestVideoFrameCallback(E)}clone(){return new this.constructor(this.image).copy(this)}update(){let J=this.image;if("requestVideoFrameCallback"in J===!1&&J.readyState>=J.HAVE_CURRENT_DATA)this.needsUpdate=!0}dispose(){if(this._requestVideoFrameCallbackId!==0)this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0;super.dispose()}};UY=class UY extends kZ{constructor(J,Q,$,Z,W,K,Y,X){super({},J,Q,$,Z,W,K,Y,X);this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(J){this.image=J,this.needsUpdate=!0}};GY=class GY extends OJ{constructor(J,Q){super({width:J,height:Q});this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}};h7=class h7 extends OJ{constructor(J,Q,$,Z,W,K,Y,X,H,U,E,N){super(null,K,Y,X,H,U,Z,W,E,N);this.isCompressedTexture=!0,this.image={width:Q,height:$},this.mipmaps=J,this.flipY=!1,this.generateMipmaps=!1}};EY=class EY extends h7{constructor(J,Q,$,Z,W,K){super(J,Q,$,W,K);this.isCompressedArrayTexture=!0,this.image.depth=Z,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}};NY=class NY extends h7{constructor(J,Q,$){super(void 0,J[0].width,J[0].height,Q,$,301);this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=J}};s8=class s8 extends OJ{constructor(J=[],Q=301,$,Z,W,K,Y,X,H,U){super(J,Q,$,Z,W,K,Y,X,H,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}};qY=class qY extends OJ{constructor(J,Q,$,Z,W,K,Y,X,H){super(J,Q,$,Z,W,K,Y,X,H);this.isCanvasTexture=!0,this.needsUpdate=!0}};DY=class DY extends OJ{constructor(J,Q,$,Z,W,K,Y,X,H){super(J,Q,$,Z,W,K,Y,X,H);this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let U=J?J.parentNode:null;if(U!==null&&"requestPaint"in U)U.onpaint=()=>{this.needsUpdate=!0},U.requestPaint()}dispose(){let J=this.image?this.image.parentNode:null;if(J!==null&&"onpaint"in J)J.onpaint=null;super.dispose()}};n9=class n9 extends OJ{constructor(J,Q,$=1014,Z,W,K,Y=1003,X=1003,H,U=1026,E=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let N={width:J,height:Q,depth:E};super(N,Z,W,K,Y,X,U,$,H);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new w9(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}};MZ=class MZ extends n9{constructor(J,Q=1014,$=301,Z,W,K=1003,Y=1003,X,H=1026){let U={width:J,height:J,depth:1},E=[U,U,U,U,U,U];super(J,J,Q,$,Z,W,K,Y,X,H);this.image=E,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}};b6=class b6 extends OJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}};k8=class k8 extends c0{constructor(J=1,Q=1,$=1,Z=1,W=1,K=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:Z,heightSegments:W,depthSegments:K};let Y=this;Z=Math.floor(Z),W=Math.floor(W),K=Math.floor(K);let X=[],H=[],U=[],E=[],N=0,G=0;q("z","y","x",-1,-1,$,Q,J,K,W,0),q("z","y","x",1,-1,$,Q,-J,K,W,1),q("x","z","y",1,1,J,$,Q,Z,K,2),q("x","z","y",1,-1,J,$,-Q,Z,K,3),q("x","y","z",1,-1,J,Q,$,Z,W,4),q("x","y","z",-1,-1,J,Q,-$,Z,W,5),this.setIndex(X),this.setAttribute("position",new z0(H,3)),this.setAttribute("normal",new z0(U,3)),this.setAttribute("uv",new z0(E,2));function q(R,O,F,D,k,M,V,_,A,C,L){let I=M/A,b=V/C,T=M/2,g=V/2,u=_/2,y=A+1,l=C+1,h=0,m=0,a=new P;for(let W0=0;W0<l;W0++){let N0=W0*b-g;for(let j0=0;j0<y;j0++){let B0=j0*I-T;a[R]=B0*D,a[O]=N0*k,a[F]=u,H.push(a.x,a.y,a.z),a[R]=0,a[O]=0,a[F]=_>0?1:-1,U.push(a.x,a.y,a.z),E.push(j0/A),E.push(1-W0/C),h+=1}}for(let W0=0;W0<C;W0++)for(let N0=0;N0<A;N0++){let j0=N+N0+y*W0,B0=N+N0+y*(W0+1),ZJ=N+(N0+1)+y*(W0+1),t0=N+(N0+1)+y*W0;X.push(j0,B0,t0),X.push(B0,ZJ,t0),m+=6}Y.addGroup(G,m,L),G+=m,N+=h}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new k8(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}};h6=class h6 extends c0{constructor(J=1,Q=1,$=4,Z=8,W=1){super();this.type="CapsuleGeometry",this.parameters={radius:J,height:Q,capSegments:$,radialSegments:Z,heightSegments:W},Q=Math.max(0,Q),$=Math.max(1,Math.floor($)),Z=Math.max(3,Math.floor(Z)),W=Math.max(1,Math.floor(W));let K=[],Y=[],X=[],H=[],U=Q/2,E=Math.PI/2*J,N=Q,G=2*E+N,q=$*2+W,R=Z+1,O=new P,F=new P;for(let D=0;D<=q;D++){let k=0,M=0,V=0,_=0;if(D<=$){let L=D/$,I=L*Math.PI/2;M=-U-J*Math.cos(I),V=J*Math.sin(I),_=-J*Math.cos(I),k=L*E}else if(D<=$+W){let L=(D-$)/W;M=-U+L*Q,V=J,_=0,k=E+L*N}else{let L=(D-$-W)/$,I=L*Math.PI/2;M=U+J*Math.sin(I),V=J*Math.cos(I),_=J*Math.sin(I),k=E+N+L*E}let A=Math.max(0,Math.min(1,k/G)),C=0;if(D===0)C=0.5/Z;else if(D===q)C=-0.5/Z;for(let L=0;L<=Z;L++){let I=L/Z,b=I*Math.PI*2,T=Math.sin(b),g=Math.cos(b);F.x=-V*g,F.y=M,F.z=V*T,Y.push(F.x,F.y,F.z),O.set(-V*g,_,V*T),O.normalize(),X.push(O.x,O.y,O.z),H.push(I+C,A)}if(D>0){let L=(D-1)*R;for(let I=0;I<Z;I++){let b=L+I,T=L+I+1,g=D*R+I,u=D*R+I+1;K.push(b,T,g),K.push(T,u,g)}}}this.setIndex(K),this.setAttribute("position",new z0(Y,3)),this.setAttribute("normal",new z0(X,3)),this.setAttribute("uv",new z0(H,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new h6(J.radius,J.height,J.capSegments,J.radialSegments,J.heightSegments)}};x6=class x6 extends c0{constructor(J=1,Q=32,$=0,Z=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:J,segments:Q,thetaStart:$,thetaLength:Z},Q=Math.max(3,Q);let W=[],K=[],Y=[],X=[],H=new P,U=new r;K.push(0,0,0),Y.push(0,0,1),X.push(0.5,0.5);for(let E=0,N=3;E<=Q;E++,N+=3){let G=$+E/Q*Z;H.x=J*Math.cos(G),H.y=J*Math.sin(G),K.push(H.x,H.y,H.z),Y.push(0,0,1),U.x=(K[N]/J+1)/2,U.y=(K[N+1]/J+1)/2,X.push(U.x,U.y)}for(let E=1;E<=Q;E++)W.push(E,E+1,0);this.setIndex(W),this.setAttribute("position",new z0(K,3)),this.setAttribute("normal",new z0(Y,3)),this.setAttribute("uv",new z0(X,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new x6(J.radius,J.segments,J.thetaStart,J.thetaLength)}};x7=class x7 extends c0{constructor(J=1,Q=1,$=1,Z=32,W=1,K=!1,Y=0,X=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:Z,heightSegments:W,openEnded:K,thetaStart:Y,thetaLength:X};let H=this;Z=Math.floor(Z),W=Math.floor(W);let U=[],E=[],N=[],G=[],q=0,R=[],O=$/2,F=0;if(D(),K===!1){if(J>0)k(!0);if(Q>0)k(!1)}this.setIndex(U),this.setAttribute("position",new z0(E,3)),this.setAttribute("normal",new z0(N,3)),this.setAttribute("uv",new z0(G,2));function D(){let M=new P,V=new P,_=0,A=(Q-J)/$;for(let C=0;C<=W;C++){let L=[],I=C/W,b=I*(Q-J)+J;for(let T=0;T<=Z;T++){let g=T/Z,u=g*X+Y,y=Math.sin(u),l=Math.cos(u);V.x=b*y,V.y=-I*$+O,V.z=b*l,E.push(V.x,V.y,V.z),M.set(y,A,l).normalize(),N.push(M.x,M.y,M.z),G.push(g,1-I),L.push(q++)}R.push(L)}for(let C=0;C<Z;C++)for(let L=0;L<W;L++){let I=R[L][C],b=R[L+1][C],T=R[L+1][C+1],g=R[L][C+1];if(J>0||L!==0)U.push(I,b,g),_+=3;if(Q>0||L!==W-1)U.push(b,T,g),_+=3}H.addGroup(F,_,0),F+=_}function k(M){let V=q,_=new r,A=new P,C=0,L=M===!0?J:Q,I=M===!0?1:-1;for(let T=1;T<=Z;T++)E.push(0,O*I,0),N.push(0,I,0),G.push(0.5,0.5),q++;let b=q;for(let T=0;T<=Z;T++){let u=T/Z*X+Y,y=Math.cos(u),l=Math.sin(u);A.x=L*l,A.y=O*I,A.z=L*y,E.push(A.x,A.y,A.z),N.push(0,I,0),_.x=y*0.5+0.5,_.y=l*0.5*I+0.5,G.push(_.x,_.y),q++}for(let T=0;T<Z;T++){let g=V+T,u=b+T;if(M===!0)U.push(u,u+1,g);else U.push(u+1,u,g);C+=3}H.addGroup(F,C,M===!0?1:2),F+=C}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new x7(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}};g7=class g7 extends x7{constructor(J=1,Q=1,$=32,Z=1,W=!1,K=0,Y=Math.PI*2){super(0,J,Q,$,Z,W,K,Y);this.type="ConeGeometry",this.parameters={radius:J,height:Q,radialSegments:$,heightSegments:Z,openEnded:W,thetaStart:K,thetaLength:Y}}static fromJSON(J){return new g7(J.radius,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}};s9=class s9 extends c0{constructor(J=[],Q=[],$=1,Z=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:J,indices:Q,radius:$,detail:Z};let W=[],K=[];if(Y(Z),H($),U(),this.setAttribute("position",new z0(W,3)),this.setAttribute("normal",new z0(W.slice(),3)),this.setAttribute("uv",new z0(K,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function Y(D){let k=new P,M=new P,V=new P;for(let _=0;_<Q.length;_+=3)G(Q[_+0],k),G(Q[_+1],M),G(Q[_+2],V),X(k,M,V,D)}function X(D,k,M,V){let _=V+1,A=[];for(let C=0;C<=_;C++){A[C]=[];let L=D.clone().lerp(M,C/_),I=k.clone().lerp(M,C/_),b=_-C;for(let T=0;T<=b;T++)if(T===0&&C===_)A[C][T]=L;else A[C][T]=L.clone().lerp(I,T/b)}for(let C=0;C<_;C++)for(let L=0;L<2*(_-C)-1;L++){let I=Math.floor(L/2);if(L%2===0)N(A[C][I+1]),N(A[C+1][I]),N(A[C][I]);else N(A[C][I+1]),N(A[C+1][I+1]),N(A[C+1][I])}}function H(D){let k=new P;for(let M=0;M<W.length;M+=3)k.x=W[M+0],k.y=W[M+1],k.z=W[M+2],k.normalize().multiplyScalar(D),W[M+0]=k.x,W[M+1]=k.y,W[M+2]=k.z}function U(){let D=new P;for(let k=0;k<W.length;k+=3){D.x=W[k+0],D.y=W[k+1],D.z=W[k+2];let M=O(D)/2/Math.PI+0.5,V=F(D)/Math.PI+0.5;K.push(M,1-V)}q(),E()}function E(){for(let D=0;D<K.length;D+=6){let k=K[D+0],M=K[D+2],V=K[D+4],_=Math.max(k,M,V),A=Math.min(k,M,V);if(_>0.9&&A<0.1){if(k<0.2)K[D+0]+=1;if(M<0.2)K[D+2]+=1;if(V<0.2)K[D+4]+=1}}}function N(D){W.push(D.x,D.y,D.z)}function G(D,k){let M=D*3;k.x=J[M+0],k.y=J[M+1],k.z=J[M+2]}function q(){let D=new P,k=new P,M=new P,V=new P,_=new r,A=new r,C=new r;for(let L=0,I=0;L<W.length;L+=9,I+=6){D.set(W[L+0],W[L+1],W[L+2]),k.set(W[L+3],W[L+4],W[L+5]),M.set(W[L+6],W[L+7],W[L+8]),_.set(K[I+0],K[I+1]),A.set(K[I+2],K[I+3]),C.set(K[I+4],K[I+5]),V.copy(D).add(k).add(M).divideScalar(3);let b=O(V);R(_,I+0,D,b),R(A,I+2,k,b),R(C,I+4,M,b)}}function R(D,k,M,V){if(V<0&&D.x===1)K[k]=D.x-1;if(M.x===0&&M.z===0)K[k]=V/2/Math.PI+0.5}function O(D){return Math.atan2(D.z,-D.x)}function F(D){return Math.atan2(-D.y,Math.sqrt(D.x*D.x+D.z*D.z))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new s9(J.vertices,J.indices,J.radius,J.detail)}};g6=class g6 extends s9{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=1/$,W=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,0,-$,0,-Z,$,0,-Z,-$,0,Z,$,0,Z],K=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(W,K,J,Q);this.type="DodecahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new g6(J.radius,J.detail)}};sQ=new P,iQ=new P,xW=new P,oQ=new uJ;LZ=class LZ extends c0{constructor(J=null,Q=1){super();if(this.type="EdgesGeometry",this.parameters={geometry:J,thresholdAngle:Q},J!==null){let Z=Math.pow(10,4),W=Math.cos(f8*Q),K=J.getIndex(),Y=J.getAttribute("position"),X=K?K.count:Y.count,H=[0,0,0],U=["a","b","c"],E=[,,,],N={},G=[];for(let q=0;q<X;q+=3){if(K)H[0]=K.getX(q),H[1]=K.getX(q+1),H[2]=K.getX(q+2);else H[0]=q,H[1]=q+1,H[2]=q+2;let{a:R,b:O,c:F}=oQ;if(R.fromBufferAttribute(Y,H[0]),O.fromBufferAttribute(Y,H[1]),F.fromBufferAttribute(Y,H[2]),oQ.getNormal(xW),E[0]=`${Math.round(R.x*Z)},${Math.round(R.y*Z)},${Math.round(R.z*Z)}`,E[1]=`${Math.round(O.x*Z)},${Math.round(O.y*Z)},${Math.round(O.z*Z)}`,E[2]=`${Math.round(F.x*Z)},${Math.round(F.y*Z)},${Math.round(F.z*Z)}`,E[0]===E[1]||E[1]===E[2]||E[2]===E[0])continue;for(let D=0;D<3;D++){let k=(D+1)%3,M=E[D],V=E[k],_=oQ[U[D]],A=oQ[U[k]],C=`${M}_${V}`,L=`${V}_${M}`;if(L in N&&N[L]){if(xW.dot(N[L].normal)<=W)G.push(_.x,_.y,_.z),G.push(A.x,A.y,A.z);N[L]=null}else if(!(C in N))N[C]={index0:H[D],index1:H[k],normal:xW.clone()}}}for(let q in N)if(N[q]){let{index0:R,index1:O}=N[q];sQ.fromBufferAttribute(Y,R),iQ.fromBufferAttribute(Y,O),G.push(sQ.x,sQ.y,sQ.z),G.push(iQ.x,iQ.y,iQ.z)}this.setAttribute("position",new z0(G,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}};p7=class p7 extends W9{constructor(J=0,Q=0,$=1,Z=1,W=0,K=Math.PI*2,Y=!1,X=0){super();this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=J,this.aY=Q,this.xRadius=$,this.yRadius=Z,this.aStartAngle=W,this.aEndAngle=K,this.aClockwise=Y,this.aRotation=X}getPoint(J,Q=new r){let $=Q,Z=Math.PI*2,W=this.aEndAngle-this.aStartAngle,K=Math.abs(W)<Number.EPSILON;while(W<0)W+=Z;while(W>Z)W-=Z;if(W<Number.EPSILON)if(K)W=0;else W=Z;if(this.aClockwise===!0&&!K)if(W===Z)W=-Z;else W=W-Z;let Y=this.aStartAngle+J*W,X=this.aX+this.xRadius*Math.cos(Y),H=this.aY+this.yRadius*Math.sin(Y);if(this.aRotation!==0){let U=Math.cos(this.aRotation),E=Math.sin(this.aRotation),N=X-this.aX,G=H-this.aY;X=N*U-G*E+this.aX,H=N*E+G*U+this.aY}return $.set(X,H)}copy(J){return super.copy(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}toJSON(){let J=super.toJSON();return J.aX=this.aX,J.aY=this.aY,J.xRadius=this.xRadius,J.yRadius=this.yRadius,J.aStartAngle=this.aStartAngle,J.aEndAngle=this.aEndAngle,J.aClockwise=this.aClockwise,J.aRotation=this.aRotation,J}fromJSON(J){return super.fromJSON(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}};VZ=class VZ extends p7{constructor(J,Q,$,Z,W,K){super(J,Q,$,$,Z,W,K);this.isArcCurve=!0,this.type="ArcCurve"}};GH=new P,EH=new P,gW=new FY,pW=new FY,mW=new FY;BZ=class BZ extends W9{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 P){let $=Q,Z=this.points,W=Z.length,K=(W-(this.closed?0:1))*J,Y=Math.floor(K),X=K-Y;if(this.closed)Y+=Y>0?0:(Math.floor(Math.abs(Y)/W)+1)*W;else if(X===0&&Y===W-1)Y=W-2,X=1;let H,U;if(this.closed||Y>0)H=Z[(Y-1)%W];else EH.subVectors(Z[0],Z[1]).add(Z[0]),H=EH;let E=Z[Y%W],N=Z[(Y+1)%W];if(this.closed||Y+2<W)U=Z[(Y+2)%W];else GH.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=GH;if(this.curveType==="centripetal"||this.curveType==="chordal"){let G=this.curveType==="chordal"?0.5:0.25,q=Math.pow(H.distanceToSquared(E),G),R=Math.pow(E.distanceToSquared(N),G),O=Math.pow(N.distanceToSquared(U),G);if(R<0.0001)R=1;if(q<0.0001)q=R;if(O<0.0001)O=R;gW.initNonuniformCatmullRom(H.x,E.x,N.x,U.x,q,R,O),pW.initNonuniformCatmullRom(H.y,E.y,N.y,U.y,q,R,O),mW.initNonuniformCatmullRom(H.z,E.z,N.z,U.z,q,R,O)}else if(this.curveType==="catmullrom")gW.initCatmullRom(H.x,E.x,N.x,U.x,this.tension),pW.initCatmullRom(H.y,E.y,N.y,U.y,this.tension),mW.initCatmullRom(H.z,E.z,N.z,U.z,this.tension);return $.set(gW.calc(X),pW.calc(X),mW.calc(X)),$}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 P().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}};p6=class p6 extends W9{constructor(J=new r,Q=new r,$=new r,Z=new r){super();this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new r){let $=Q,Z=this.v0,W=this.v1,K=this.v2,Y=this.v3;return $.set(H6(J,Z.x,W.x,K.x,Y.x),H6(J,Z.y,W.y,K.y,Y.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}};zZ=class zZ extends W9{constructor(J=new P,Q=new P,$=new P,Z=new P){super();this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new P){let $=Q,Z=this.v0,W=this.v1,K=this.v2,Y=this.v3;return $.set(H6(J,Z.x,W.x,K.x,Y.x),H6(J,Z.y,W.y,K.y,Y.y),H6(J,Z.z,W.z,K.z,Y.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}};m6=class m6 extends W9{constructor(J=new r,Q=new r){super();this.isLineCurve=!0,this.type="LineCurve",this.v1=J,this.v2=Q}getPoint(J,Q=new r){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new r){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};IZ=class IZ extends W9{constructor(J=new P,Q=new P){super();this.isLineCurve3=!0,this.type="LineCurve3",this.v1=J,this.v2=Q}getPoint(J,Q=new P){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new P){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};d6=class d6 extends W9{constructor(J=new r,Q=new r,$=new r){super();this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new r){let $=Q,Z=this.v0,W=this.v1,K=this.v2;return $.set(X6(J,Z.x,W.x,K.x),X6(J,Z.y,W.y,K.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};l6=class l6 extends W9{constructor(J=new P,Q=new P,$=new P){super();this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new P){let $=Q,Z=this.v0,W=this.v1,K=this.v2;return $.set(X6(J,Z.x,W.x,K.x),X6(J,Z.y,W.y,K.y),X6(J,Z.z,W.z,K.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}};u6=class u6 extends W9{constructor(J=[]){super();this.isSplineCurve=!0,this.type="SplineCurve",this.points=J}getPoint(J,Q=new r){let $=Q,Z=this.points,W=(Z.length-1)*J,K=Math.floor(W),Y=W-K,X=Z[K===0?K:K-1],H=Z[K],U=Z[K>Z.length-2?Z.length-1:K+1],E=Z[K>Z.length-3?Z.length-1:K+2];return $.set(NH(Y,X.x,H.x,U.x,E.x),NH(Y,X.y,H.y,U.y,E.y)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new r().fromArray(Z))}return this}};U$=Object.freeze({__proto__:null,ArcCurve:VZ,CatmullRomCurve3:BZ,CubicBezierCurve:p6,CubicBezierCurve3:zZ,EllipseCurve:p7,LineCurve:m6,LineCurve3:IZ,QuadraticBezierCurve:d6,QuadraticBezierCurve3:l6,SplineCurve:u6});_Z=class _Z extends W9{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(J){this.curves.push(J)}closePath(){let J=this.curves[0].getPoint(0),Q=this.curves[this.curves.length-1].getPoint(1);if(!J.equals(Q)){let $=J.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new U$[$](Q,J))}return this}getPoint(J,Q){let $=J*this.getLength(),Z=this.getCurveLengths(),W=0;while(W<Z.length){if(Z[W]>=$){let K=Z[W]-$,Y=this.curves[W],X=Y.getLength(),H=X===0?0:1-K/X;return Y.getPointAt(H,Q)}W++}return null}getLength(){let J=this.getCurveLengths();return J[J.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let J=[],Q=0;for(let $=0,Z=this.curves.length;$<Z;$++)Q+=this.curves[$].getLength(),J.push(Q);return this.cacheLengths=J,J}getSpacedPoints(J=40){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));if(this.autoClose)Q.push(Q[0]);return Q}getPoints(J=12){let Q=[],$;for(let Z=0,W=this.curves;Z<W.length;Z++){let K=W[Z],Y=K.isEllipseCurve?J*2:K.isLineCurve||K.isLineCurve3?1:K.isSplineCurve?J*K.points.length:J,X=K.getPoints(Y);for(let H=0;H<X.length;H++){let U=X[H];if($&&$.equals(U))continue;Q.push(U),$=U}}if(this.autoClose&&Q.length>1&&!Q[Q.length-1].equals(Q[0]))Q.push(Q[0]);return Q}copy(J){super.copy(J),this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(Z.clone())}return this.autoClose=J.autoClose,this}toJSON(){let J=super.toJSON();J.autoClose=this.autoClose,J.curves=[];for(let Q=0,$=this.curves.length;Q<$;Q++){let Z=this.curves[Q];J.curves.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.autoClose=J.autoClose,this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(new U$[Z.type]().fromJSON(Z))}return this}};_7=class _7 extends _Z{constructor(J){super();if(this.type="Path",this.currentPoint=new r,J)this.setFromPoints(J)}setFromPoints(J){this.moveTo(J[0].x,J[0].y);for(let Q=1,$=J.length;Q<$;Q++)this.lineTo(J[Q].x,J[Q].y);return this}moveTo(J,Q){return this.currentPoint.set(J,Q),this}lineTo(J,Q){let $=new m6(this.currentPoint.clone(),new r(J,Q));return this.curves.push($),this.currentPoint.set(J,Q),this}quadraticCurveTo(J,Q,$,Z){let W=new d6(this.currentPoint.clone(),new r(J,Q),new r($,Z));return this.curves.push(W),this.currentPoint.set($,Z),this}bezierCurveTo(J,Q,$,Z,W,K){let Y=new p6(this.currentPoint.clone(),new r(J,Q),new r($,Z),new r(W,K));return this.curves.push(Y),this.currentPoint.set(W,K),this}splineThru(J){let Q=[this.currentPoint.clone()].concat(J),$=new u6(Q);return this.curves.push($),this.currentPoint.copy(J[J.length-1]),this}arc(J,Q,$,Z,W,K){let Y=this.currentPoint.x,X=this.currentPoint.y;return this.absarc(J+Y,Q+X,$,Z,W,K),this}absarc(J,Q,$,Z,W,K){return this.absellipse(J,Q,$,$,Z,W,K),this}ellipse(J,Q,$,Z,W,K,Y,X){let H=this.currentPoint.x,U=this.currentPoint.y;return this.absellipse(J+H,Q+U,$,Z,W,K,Y,X),this}absellipse(J,Q,$,Z,W,K,Y,X){let H=new p7(J,Q,$,Z,W,K,Y,X);if(this.curves.length>0){let E=H.getPoint(0);if(!E.equals(this.currentPoint))this.lineTo(E.x,E.y)}this.curves.push(H);let U=H.getPoint(1);return this.currentPoint.copy(U),this}copy(J){return super.copy(J),this.currentPoint.copy(J.currentPoint),this}toJSON(){let J=super.toJSON();return J.currentPoint=this.currentPoint.toArray(),J}fromJSON(J){return super.fromJSON(J),this.currentPoint.fromArray(J.currentPoint),this}};l9=class l9 extends _7{constructor(J){super(J);this.uuid=Q9(),this.type="Shape",this.holes=[]}getPointsHoles(J){let Q=[];for(let $=0,Z=this.holes.length;$<Z;$++)Q[$]=this.holes[$].getPoints(J);return Q}extractPoints(J){return{shape:this.getPoints(J),holes:this.getPointsHoles(J)}}copy(J){super.copy(J),this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.uuid=this.uuid,J.holes=[];for(let Q=0,$=this.holes.length;Q<$;Q++){let Z=this.holes[Q];J.holes.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.uuid=J.uuid,this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(new _7().fromJSON(Z))}return this}};c6=class c6 extends c0{constructor(J=new l9([new r(0.5,0.5),new r(-0.5,0.5),new r(-0.5,-0.5),new r(0.5,-0.5)]),Q={}){super();this.type="ExtrudeGeometry",this.parameters={shapes:J,options:Q},J=Array.isArray(J)?J:[J];let $=this,Z=[],W=[];for(let Y=0,X=J.length;Y<X;Y++){let H=J[Y];K(H)}this.setAttribute("position",new z0(Z,3)),this.setAttribute("uv",new z0(W,2)),this.computeVertexNormals();function K(Y){let X=[],H=Q.curveSegments!==void 0?Q.curveSegments:12,U=Q.steps!==void 0?Q.steps:1,E=Q.depth!==void 0?Q.depth:1,N=Q.bevelEnabled!==void 0?Q.bevelEnabled:!0,G=Q.bevelThickness!==void 0?Q.bevelThickness:0.2,q=Q.bevelSize!==void 0?Q.bevelSize:G-0.1,R=Q.bevelOffset!==void 0?Q.bevelOffset:0,O=Q.bevelSegments!==void 0?Q.bevelSegments:3,F=Q.extrudePath,D=Q.UVGenerator!==void 0?Q.UVGenerator:SE,k,M=!1,V,_,A,C;if(F){k=F.getSpacedPoints(U),M=!0,N=!1;let t=F.isCatmullRomCurve3?F.closed:!1;V=F.computeFrenetFrames(U,t),_=new P,A=new P,C=new P}if(!N)O=0,G=0,q=0,R=0;let L=Y.extractPoints(H),I=L.shape,b=L.holes;if(!X9.isClockWise(I)){I=I.reverse();for(let t=0,$0=b.length;t<$0;t++){let e=b[t];if(X9.isClockWise(e))b[t]=e.reverse()}}function g(t){let L0=t[0];for(let M0=1;M0<=t.length;M0++){let x0=M0%t.length,S=t[x0],e0=S.x-L0.x,y0=S.y-L0.y,g0=e0*e0+y0*y0,K0=Math.max(Math.abs(S.x),Math.abs(S.y),Math.abs(L0.x),Math.abs(L0.y)),HJ=0.000000000000000000010000000000000001*K0*K0;if(g0<=HJ){t.splice(x0,1),M0--;continue}L0=S}}g(I),b.forEach(g);let u=b.length,y=I;for(let t=0;t<u;t++){let $0=b[t];I=I.concat($0)}function l(t,$0,e){if(!$0)T0("ExtrudeGeometry: vec does not exist");return t.clone().addScaledVector($0,e)}let h=I.length;function m(t,$0,e){let L0,M0,x0,S=t.x-$0.x,e0=t.y-$0.y,y0=e.x-t.x,g0=e.y-t.y,K0=S*S+e0*e0,HJ=S*g0-e0*y0;if(Math.abs(HJ)>Number.EPSILON){let A0=Math.sqrt(K0),w=Math.sqrt(y0*y0+g0*g0),B=$0.x-e0/A0,f=$0.y+S/A0,i=e.x-g0/w,J0=e.y+y0/w,Z0=((i-B)*g0-(J0-f)*y0)/(S*g0-e0*y0);L0=B+S*Z0-t.x,M0=f+e0*Z0-t.y;let q0=L0*L0+M0*M0;if(q0<=2)return new r(L0,M0);else x0=Math.sqrt(q0/2)}else{let A0=!1;if(S>Number.EPSILON){if(y0>Number.EPSILON)A0=!0}else if(S<-Number.EPSILON){if(y0<-Number.EPSILON)A0=!0}else if(Math.sign(e0)===Math.sign(g0))A0=!0;if(A0)L0=-e0,M0=S,x0=Math.sqrt(K0);else L0=S,M0=e0,x0=Math.sqrt(K0/2)}return new r(L0/x0,M0/x0)}let a=[];for(let t=0,$0=y.length,e=$0-1,L0=t+1;t<$0;t++,e++,L0++){if(e===$0)e=0;if(L0===$0)L0=0;a[t]=m(y[t],y[e],y[L0])}let W0=[],N0,j0=a.concat();for(let t=0,$0=u;t<$0;t++){let e=b[t];N0=[];for(let L0=0,M0=e.length,x0=M0-1,S=L0+1;L0<M0;L0++,x0++,S++){if(x0===M0)x0=0;if(S===M0)S=0;N0[L0]=m(e[L0],e[x0],e[S])}W0.push(N0),j0=j0.concat(N0)}let B0;if(O===0)B0=X9.triangulateShape(y,b);else{let t=[],$0=[];for(let e=0;e<O;e++){let L0=e/O,M0=G*Math.cos(L0*Math.PI/2),x0=q*Math.sin(L0*Math.PI/2)+R;for(let S=0,e0=y.length;S<e0;S++){let y0=l(y[S],a[S],x0);if(G0(y0.x,y0.y,-M0),L0===0)t.push(y0)}for(let S=0,e0=u;S<e0;S++){let y0=b[S];N0=W0[S];let g0=[];for(let K0=0,HJ=y0.length;K0<HJ;K0++){let A0=l(y0[K0],N0[K0],x0);if(G0(A0.x,A0.y,-M0),L0===0)g0.push(A0)}if(L0===0)$0.push(g0)}}B0=X9.triangulateShape(t,$0)}let ZJ=B0.length,t0=q+R;for(let t=0;t<h;t++){let $0=N?l(I[t],j0[t],t0):I[t];if(!M)G0($0.x,$0.y,0);else A.copy(V.normals[0]).multiplyScalar($0.x),_.copy(V.binormals[0]).multiplyScalar($0.y),C.copy(k[0]).add(A).add(_),G0(C.x,C.y,C.z)}for(let t=1;t<=U;t++)for(let $0=0;$0<h;$0++){let e=N?l(I[$0],j0[$0],t0):I[$0];if(!M)G0(e.x,e.y,E/U*t);else A.copy(V.normals[t]).multiplyScalar(e.x),_.copy(V.binormals[t]).multiplyScalar(e.y),C.copy(k[t]).add(A).add(_),G0(C.x,C.y,C.z)}for(let t=O-1;t>=0;t--){let $0=t/O,e=G*Math.cos($0*Math.PI/2),L0=q*Math.sin($0*Math.PI/2)+R;for(let M0=0,x0=y.length;M0<x0;M0++){let S=l(y[M0],a[M0],L0);G0(S.x,S.y,E+e)}for(let M0=0,x0=b.length;M0<x0;M0++){let S=b[M0];N0=W0[M0];for(let e0=0,y0=S.length;e0<y0;e0++){let g0=l(S[e0],N0[e0],L0);if(!M)G0(g0.x,g0.y,E+e);else G0(g0.x,g0.y+k[U-1].y,k[U-1].x+e)}}}s(),R0();function s(){let t=Z.length/3;if(N){let $0=0,e=h*$0;for(let L0=0;L0<ZJ;L0++){let M0=B0[L0];b0(M0[2]+e,M0[1]+e,M0[0]+e)}$0=U+O*2,e=h*$0;for(let L0=0;L0<ZJ;L0++){let M0=B0[L0];b0(M0[0]+e,M0[1]+e,M0[2]+e)}}else{for(let $0=0;$0<ZJ;$0++){let e=B0[$0];b0(e[2],e[1],e[0])}for(let $0=0;$0<ZJ;$0++){let e=B0[$0];b0(e[0]+h*U,e[1]+h*U,e[2]+h*U)}}$.addGroup(t,Z.length/3-t,0)}function R0(){let t=Z.length/3,$0=0;P0(y,$0),$0+=y.length;for(let e=0,L0=b.length;e<L0;e++){let M0=b[e];P0(M0,$0),$0+=M0.length}$.addGroup(t,Z.length/3-t,1)}function P0(t,$0){let e=t.length;while(--e>=0){let L0=e,M0=e-1;if(M0<0)M0=t.length-1;for(let x0=0,S=U+O*2;x0<S;x0++){let e0=h*x0,y0=h*(x0+1),g0=$0+L0+e0,K0=$0+M0+e0,HJ=$0+M0+y0,A0=$0+L0+y0;YJ(g0,K0,HJ,A0)}}}function G0(t,$0,e){X.push(t),X.push($0),X.push(e)}function b0(t,$0,e){p0(t),p0($0),p0(e);let L0=Z.length/3,M0=D.generateTopUV($,Z,L0-3,L0-2,L0-1);l0(M0[0]),l0(M0[1]),l0(M0[2])}function YJ(t,$0,e,L0){p0(t),p0($0),p0(L0),p0($0),p0(e),p0(L0);let M0=Z.length/3,x0=D.generateSideWallUV($,Z,M0-6,M0-3,M0-2,M0-1);l0(x0[0]),l0(x0[1]),l0(x0[3]),l0(x0[1]),l0(x0[2]),l0(x0[3])}function p0(t){Z.push(X[t*3+0]),Z.push(X[t*3+1]),Z.push(X[t*3+2])}function l0(t){W.push(t.x),W.push(t.y)}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes,$=this.parameters.options;return jE(Q,$,J)}static fromJSON(J,Q){let $=[];for(let W=0,K=J.shapes.length;W<K;W++){let Y=Q[J.shapes[W]];$.push(Y)}let Z=J.options.extrudePath;if(Z!==void 0)J.options.extrudePath=new U$[Z.type]().fromJSON(Z);return new c6($,J.options)}};SE={generateTopUV:function(J,Q,$,Z,W){let K=Q[$*3],Y=Q[$*3+1],X=Q[Z*3],H=Q[Z*3+1],U=Q[W*3],E=Q[W*3+1];return[new r(K,Y),new r(X,H),new r(U,E)]},generateSideWallUV:function(J,Q,$,Z,W,K){let Y=Q[$*3],X=Q[$*3+1],H=Q[$*3+2],U=Q[Z*3],E=Q[Z*3+1],N=Q[Z*3+2],G=Q[W*3],q=Q[W*3+1],R=Q[W*3+2],O=Q[K*3],F=Q[K*3+1],D=Q[K*3+2];if(Math.abs(X-E)<Math.abs(Y-U))return[new r(Y,1-H),new r(U,1-N),new r(G,1-R),new r(O,1-D)];else return[new r(X,1-H),new r(E,1-N),new r(q,1-R),new r(F,1-D)]}};n6=class n6 extends s9{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 n6(J.radius,J.detail)}};s6=class s6 extends c0{constructor(J=[new r(0,-0.5),new r(0.5,0),new r(0,0.5)],Q=12,$=0,Z=Math.PI*2){super();this.type="LatheGeometry",this.parameters={points:J,segments:Q,phiStart:$,phiLength:Z},Q=Math.floor(Q),Z=m0(Z,0,Math.PI*2);let W=[],K=[],Y=[],X=[],H=[],U=1/Q,E=new P,N=new r,G=new P,q=new P,R=new P,O=0,F=0;for(let D=0;D<=J.length-1;D++)switch(D){case 0:O=J[D+1].x-J[D].x,F=J[D+1].y-J[D].y,G.x=F*1,G.y=-O,G.z=F*0,R.copy(G),G.normalize(),X.push(G.x,G.y,G.z);break;case J.length-1:X.push(R.x,R.y,R.z);break;default:O=J[D+1].x-J[D].x,F=J[D+1].y-J[D].y,G.x=F*1,G.y=-O,G.z=F*0,q.copy(G),G.x+=R.x,G.y+=R.y,G.z+=R.z,G.normalize(),X.push(G.x,G.y,G.z),R.copy(q)}for(let D=0;D<=Q;D++){let k=$+D*U*Z,M=Math.sin(k),V=Math.cos(k);for(let _=0;_<=J.length-1;_++){E.x=J[_].x*M,E.y=J[_].y,E.z=J[_].x*V,K.push(E.x,E.y,E.z),N.x=D/Q,N.y=_/(J.length-1),Y.push(N.x,N.y);let A=X[3*_+0]*M,C=X[3*_+1],L=X[3*_+0]*V;H.push(A,C,L)}}for(let D=0;D<Q;D++)for(let k=0;k<J.length-1;k++){let M=k+D*J.length,V=M,_=M+J.length,A=M+J.length+1,C=M+1;W.push(V,_,C),W.push(A,C,_)}this.setIndex(W),this.setAttribute("position",new z0(K,3)),this.setAttribute("uv",new z0(Y,2)),this.setAttribute("normal",new z0(H,3))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new s6(J.points,J.segments,J.phiStart,J.phiLength)}};m7=class m7 extends s9{constructor(J=1,Q=0){let $=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Z=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super($,Z,J,Q);this.type="OctahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new m7(J.radius,J.detail)}};i8=class i8 extends c0{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,K=Q/2,Y=Math.floor($),X=Math.floor(Z),H=Y+1,U=X+1,E=J/Y,N=Q/X,G=[],q=[],R=[],O=[];for(let F=0;F<U;F++){let D=F*N-K;for(let k=0;k<H;k++){let M=k*E-W;q.push(M,-D,0),R.push(0,0,1),O.push(k/Y),O.push(1-F/X)}}for(let F=0;F<X;F++)for(let D=0;D<Y;D++){let k=D+H*F,M=D+H*(F+1),V=D+1+H*(F+1),_=D+1+H*F;G.push(k,M,_),G.push(M,V,_)}this.setIndex(G),this.setAttribute("position",new z0(q,3)),this.setAttribute("normal",new z0(R,3)),this.setAttribute("uv",new z0(O,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new i8(J.width,J.height,J.widthSegments,J.heightSegments)}};i6=class i6 extends c0{constructor(J=0.5,Q=1,$=32,Z=1,W=0,K=Math.PI*2){super();this.type="RingGeometry",this.parameters={innerRadius:J,outerRadius:Q,thetaSegments:$,phiSegments:Z,thetaStart:W,thetaLength:K},$=Math.max(3,$),Z=Math.max(1,Z);let Y=[],X=[],H=[],U=[],E=J,N=(Q-J)/Z,G=new P,q=new r;for(let R=0;R<=Z;R++){for(let O=0;O<=$;O++){let F=W+O/$*K;G.x=E*Math.cos(F),G.y=E*Math.sin(F),X.push(G.x,G.y,G.z),H.push(0,0,1),q.x=(G.x/Q+1)/2,q.y=(G.y/Q+1)/2,U.push(q.x,q.y)}E+=N}for(let R=0;R<Z;R++){let O=R*($+1);for(let F=0;F<$;F++){let D=F+O,k=D,M=D+$+1,V=D+$+2,_=D+1;Y.push(k,M,_),Y.push(M,V,_)}}this.setIndex(Y),this.setAttribute("position",new z0(X,3)),this.setAttribute("normal",new z0(H,3)),this.setAttribute("uv",new z0(U,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new i6(J.innerRadius,J.outerRadius,J.thetaSegments,J.phiSegments,J.thetaStart,J.thetaLength)}};o6=class o6 extends c0{constructor(J=new l9([new r(0,0.5),new r(-0.5,-0.5),new r(0.5,-0.5)]),Q=12){super();this.type="ShapeGeometry",this.parameters={shapes:J,curveSegments:Q};let $=[],Z=[],W=[],K=[],Y=0,X=0;if(Array.isArray(J)===!1)H(J);else for(let U=0;U<J.length;U++)H(J[U]),this.addGroup(Y,X,U),Y+=X,X=0;this.setIndex($),this.setAttribute("position",new z0(Z,3)),this.setAttribute("normal",new z0(W,3)),this.setAttribute("uv",new z0(K,2));function H(U){let E=Z.length/3,N=U.extractPoints(Q),G=N.shape,q=N.holes;if(X9.isClockWise(G)===!1)G=G.reverse();for(let O=0,F=q.length;O<F;O++){let D=q[O];if(X9.isClockWise(D)===!0)q[O]=D.reverse()}let R=X9.triangulateShape(G,q);for(let O=0,F=q.length;O<F;O++){let D=q[O];G=G.concat(D)}for(let O=0,F=G.length;O<F;O++){let D=G[O];Z.push(D.x,D.y,0),W.push(0,0,1),K.push(D.x,D.y)}for(let O=0,F=R.length;O<F;O++){let D=R[O],k=D[0]+E,M=D[1]+E,V=D[2]+E;$.push(k,M,V),X+=3}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes;return yE(Q,J)}static fromJSON(J,Q){let $=[];for(let Z=0,W=J.shapes.length;Z<W;Z++){let K=Q[J.shapes[Z]];$.push(K)}return new o6($,J.curveSegments)}};d7=class d7 extends c0{constructor(J=1,Q=32,$=16,Z=0,W=Math.PI*2,K=0,Y=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:Z,phiLength:W,thetaStart:K,thetaLength:Y},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let X=Math.min(K+Y,Math.PI),H=0,U=[],E=new P,N=new P,G=[],q=[],R=[],O=[];for(let F=0;F<=$;F++){let D=[],k=F/$,M=0;if(F===0&&K===0)M=0.5/Q;else if(F===$&&X===Math.PI)M=-0.5/Q;for(let V=0;V<=Q;V++){let _=V/Q;E.x=-J*Math.cos(Z+_*W)*Math.sin(K+k*Y),E.y=J*Math.cos(K+k*Y),E.z=J*Math.sin(Z+_*W)*Math.sin(K+k*Y),q.push(E.x,E.y,E.z),N.copy(E).normalize(),R.push(N.x,N.y,N.z),O.push(_+M,1-k),D.push(H++)}U.push(D)}for(let F=0;F<$;F++)for(let D=0;D<Q;D++){let k=U[F][D+1],M=U[F][D],V=U[F+1][D],_=U[F+1][D+1];if(F!==0||K>0)G.push(k,M,_);if(F!==$-1||X<Math.PI)G.push(M,V,_)}this.setIndex(G),this.setAttribute("position",new z0(q,3)),this.setAttribute("normal",new z0(R,3)),this.setAttribute("uv",new z0(O,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new d7(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}};a6=class a6 extends s9{constructor(J=1,Q=0){let $=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Z=[2,1,0,0,3,2,1,3,0,2,3,1];super($,Z,J,Q);this.type="TetrahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new a6(J.radius,J.detail)}};r6=class r6 extends c0{constructor(J=1,Q=0.4,$=12,Z=48,W=Math.PI*2,K=0,Y=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:Z,arc:W,thetaStart:K,thetaLength:Y},$=Math.floor($),Z=Math.floor(Z);let X=[],H=[],U=[],E=[],N=new P,G=new P,q=new P;for(let R=0;R<=$;R++){let O=K+R/$*Y;for(let F=0;F<=Z;F++){let D=F/Z*W;G.x=(J+Q*Math.cos(O))*Math.cos(D),G.y=(J+Q*Math.cos(O))*Math.sin(D),G.z=Q*Math.sin(O),H.push(G.x,G.y,G.z),N.x=J*Math.cos(D),N.y=J*Math.sin(D),q.subVectors(G,N).normalize(),U.push(q.x,q.y,q.z),E.push(F/Z),E.push(R/$)}}for(let R=1;R<=$;R++)for(let O=1;O<=Z;O++){let F=(Z+1)*R+O-1,D=(Z+1)*(R-1)+O-1,k=(Z+1)*(R-1)+O,M=(Z+1)*R+O;X.push(F,D,M),X.push(D,k,M)}this.setIndex(X),this.setAttribute("position",new z0(H,3)),this.setAttribute("normal",new z0(U,3)),this.setAttribute("uv",new z0(E,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)}};t6=class t6 extends c0{constructor(J=1,Q=0.4,$=64,Z=8,W=2,K=3){super();this.type="TorusKnotGeometry",this.parameters={radius:J,tube:Q,tubularSegments:$,radialSegments:Z,p:W,q:K},$=Math.floor($),Z=Math.floor(Z);let Y=[],X=[],H=[],U=[],E=new P,N=new P,G=new P,q=new P,R=new P,O=new P,F=new P;for(let k=0;k<=$;++k){let M=k/$*W*Math.PI*2;D(M,W,K,J,G),D(M+0.01,W,K,J,q),O.subVectors(q,G),F.addVectors(q,G),R.crossVectors(O,F),F.crossVectors(R,O),R.normalize(),F.normalize();for(let V=0;V<=Z;++V){let _=V/Z*Math.PI*2,A=-Q*Math.cos(_),C=Q*Math.sin(_);E.x=G.x+(A*F.x+C*R.x),E.y=G.y+(A*F.y+C*R.y),E.z=G.z+(A*F.z+C*R.z),X.push(E.x,E.y,E.z),N.subVectors(E,G).normalize(),H.push(N.x,N.y,N.z),U.push(k/$),U.push(V/Z)}}for(let k=1;k<=$;k++)for(let M=1;M<=Z;M++){let V=(Z+1)*(k-1)+(M-1),_=(Z+1)*k+(M-1),A=(Z+1)*k+M,C=(Z+1)*(k-1)+M;Y.push(V,_,C),Y.push(_,A,C)}this.setIndex(Y),this.setAttribute("position",new z0(X,3)),this.setAttribute("normal",new z0(H,3)),this.setAttribute("uv",new z0(U,2));function D(k,M,V,_,A){let C=Math.cos(k),L=Math.sin(k),I=V/M*k,b=Math.cos(I);A.x=_*(2+b)*0.5*C,A.y=_*(2+b)*L*0.5,A.z=_*Math.sin(I)*0.5}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new t6(J.radius,J.tube,J.tubularSegments,J.radialSegments,J.p,J.q)}};e6=class e6 extends c0{constructor(J=new l6(new P(-1,-1,0),new P(-1,1,0),new P(1,1,0)),Q=64,$=1,Z=8,W=!1){super();this.type="TubeGeometry",this.parameters={path:J,tubularSegments:Q,radius:$,radialSegments:Z,closed:W};let K=J.computeFrenetFrames(Q,W);this.tangents=K.tangents,this.normals=K.normals,this.binormals=K.binormals;let Y=new P,X=new P,H=new r,U=new P,E=[],N=[],G=[],q=[];R(),this.setIndex(q),this.setAttribute("position",new z0(E,3)),this.setAttribute("normal",new z0(N,3)),this.setAttribute("uv",new z0(G,2));function R(){for(let k=0;k<Q;k++)O(k);O(W===!1?Q:0),D(),F()}function O(k){U=J.getPointAt(k/Q,U);let M=K.normals[k],V=K.binormals[k];for(let _=0;_<=Z;_++){let A=_/Z*Math.PI*2,C=Math.sin(A),L=-Math.cos(A);X.x=L*M.x+C*V.x,X.y=L*M.y+C*V.y,X.z=L*M.z+C*V.z,X.normalize(),N.push(X.x,X.y,X.z),Y.x=U.x+$*X.x,Y.y=U.y+$*X.y,Y.z=U.z+$*X.z,E.push(Y.x,Y.y,Y.z)}}function F(){for(let k=1;k<=Q;k++)for(let M=1;M<=Z;M++){let V=(Z+1)*(k-1)+(M-1),_=(Z+1)*k+(M-1),A=(Z+1)*k+M,C=(Z+1)*(k-1)+M;q.push(V,_,C),q.push(_,A,C)}}function D(){for(let k=0;k<=Q;k++)for(let M=0;M<=Z;M++)H.x=k/Q,H.y=M/Z,G.push(H.x,H.y)}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON();return J.path=this.parameters.path.toJSON(),J}static fromJSON(J){return new e6(new U$[J.path.type]().fromJSON(J.path),J.tubularSegments,J.radius,J.radialSegments,J.closed)}};AZ=class AZ extends c0{constructor(J=null){super();if(this.type="WireframeGeometry",this.parameters={geometry:J},J!==null){let Q=[],$=new Set,Z=new P,W=new P;if(J.index!==null){let K=J.attributes.position,Y=J.index,X=J.groups;if(X.length===0)X=[{start:0,count:Y.count,materialIndex:0}];for(let H=0,U=X.length;H<U;++H){let E=X[H],N=E.start,G=E.count;for(let q=N,R=N+G;q<R;q+=3)for(let O=0;O<3;O++){let F=Y.getX(q+O),D=Y.getX(q+(O+1)%3);if(Z.fromBufferAttribute(K,F),W.fromBufferAttribute(K,D),RH(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}}else{let K=J.attributes.position;for(let Y=0,X=K.count/3;Y<X;Y++)for(let H=0;H<3;H++){let U=3*Y+H,E=3*Y+(H+1)%3;if(Z.fromBufferAttribute(K,U),W.fromBufferAttribute(K,E),RH(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}this.setAttribute("position",new z0(Q,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}};OH=Object.freeze({__proto__:null,BoxGeometry:k8,CapsuleGeometry:h6,CircleGeometry:x6,ConeGeometry:g7,CylinderGeometry:x7,DodecahedronGeometry:g6,EdgesGeometry:LZ,ExtrudeGeometry:c6,IcosahedronGeometry:n6,LatheGeometry:s6,OctahedronGeometry:m7,PlaneGeometry:i8,PolyhedronGeometry:s9,RingGeometry:i6,ShapeGeometry:o6,SphereGeometry:d7,TetrahedronGeometry:a6,TorusGeometry:r6,TorusKnotGeometry:t6,TubeGeometry:e6,WireframeGeometry:AZ});CZ=class CZ extends yJ{constructor(J){super();this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new V0(0),this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.fog=J.fog,this}};OY={clone:o8,merge:pJ};aJ=class aJ extends yJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=fE,this.fragmentShader=bE,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=o8(J.uniforms),this.uniformsGroups=vE(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 K=this.uniforms[Z].value;if(K&&K.isTexture)Q.uniforms[Z]={type:"t",value:K.toJSON(J).uuid};else if(K&&K.isColor)Q.uniforms[Z]={type:"c",value:K.getHex()};else if(K&&K.isVector2)Q.uniforms[Z]={type:"v2",value:K.toArray()};else if(K&&K.isVector3)Q.uniforms[Z]={type:"v3",value:K.toArray()};else if(K&&K.isVector4)Q.uniforms[Z]={type:"v4",value:K.toArray()};else if(K&&K.isMatrix3)Q.uniforms[Z]={type:"m3",value:K.toArray()};else if(K&&K.isMatrix4)Q.uniforms[Z]={type:"m4",value:K.toArray()};else Q.uniforms[Z]={value:K}}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}};JQ=class JQ extends aJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};QQ=class QQ extends yJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new V0(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 V0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(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 H9,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}};wZ=class wZ extends QQ{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 r(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 V0(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 V0(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new V0(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}};PZ=class PZ extends yJ{constructor(J){super();this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new V0(16777215),this.specular=new V0(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new V0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new H9,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.specular.copy(J.specular),this.shininess=J.shininess,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}};TZ=class TZ extends yJ{constructor(J){super();this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new V0(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new V0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.gradientMap=J.gradientMap,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}};SZ=class SZ extends yJ{constructor(J){super();this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(J)}copy(J){return super.copy(J),this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this}};jZ=class jZ extends yJ{constructor(J){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new V0(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new V0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new H9,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}};$Q=class $Q extends yJ{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}};ZQ=class ZQ extends yJ{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}};yZ=class yZ extends yJ{constructor(J){super();this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new V0(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={MATCAP:""},this.color.copy(J.color),this.matcap=J.matcap,this.map=J.map,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this.fog=J.fog,this}};vZ=class vZ extends fJ{constructor(J){super();this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(J)}copy(J){return super.copy(J),this.scale=J.scale,this.dashSize=J.dashSize,this.gapSize=J.gapSize,this}};fZ=class fZ extends M8{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,K=J+1,Y=Z[W],X=Z[K];if(Y===void 0)switch(this.getSettings_().endingStart){case 2401:W=J,Y=2*Q-$;break;case 2402:W=Z.length-2,Y=Q+Z[W]-Z[W+1];break;default:W=J,Y=$}if(X===void 0)switch(this.getSettings_().endingEnd){case 2401:K=J,X=2*$-Q;break;case 2402:K=1,X=$+Z[1]-Z[0];break;default:K=J-1,X=Q}let H=($-Q)*0.5,U=this.valueSize;this._weightPrev=H/(Q-Y),this._weightNext=H/(X-$),this._offsetPrev=W*U,this._offsetNext=K*U}interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,Y=this.valueSize,X=J*Y,H=X-Y,U=this._offsetPrev,E=this._offsetNext,N=this._weightPrev,G=this._weightNext,q=($-Q)/(Z-Q),R=q*q,O=R*q,F=-N*O+2*N*R-N*q,D=(1+N)*O+(-1.5-2*N)*R+(-0.5+N)*q+1,k=(-1-G)*O+(1.5+G)*R+0.5*q,M=G*O-G*R;for(let V=0;V!==Y;++V)W[V]=F*K[U+V]+D*K[H+V]+k*K[X+V]+M*K[E+V];return W}};WQ=class WQ extends M8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,Y=this.valueSize,X=J*Y,H=X-Y,U=($-Q)/(Z-Q),E=1-U;for(let N=0;N!==Y;++N)W[N]=K[H+N]*E+K[X+N]*U;return W}};bZ=class bZ extends M8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}};hZ=class hZ extends M8{interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,Y=this.valueSize,X=J*Y,H=X-Y,U=this.settings||this.DefaultSettings_,E=U.inTangents,N=U.outTangents;if(!E||!N){let R=($-Q)/(Z-Q),O=1-R;for(let F=0;F!==Y;++F)W[F]=K[H+F]*O+K[X+F]*R;return W}let G=Y*2,q=J-1;for(let R=0;R!==Y;++R){let O=K[H+R],F=K[X+R],D=q*G+R*2,k=N[D],M=N[D+1],V=J*G+R*2,_=E[V],A=E[V+1],C=($-Q)/(Z-Q),L,I,b,T,g;for(let u=0;u<8;u++){L=C*C,I=L*C,b=1-C,T=b*b,g=T*b;let l=g*Q+3*T*C*k+3*b*L*_+I*Z-$;if(Math.abs(l)<0.0000000001)break;let h=3*T*(k-Q)+6*b*C*(_-k)+3*L*(Z-_);if(Math.abs(h)<0.0000000001)break;C=C-l/h,C=Math.max(0,Math.min(1,C))}W[R]=g*O+3*T*C*M+3*b*L*A+I*F}return W}};rJ.prototype.ValueTypeName="";rJ.prototype.TimeBufferType=Float32Array;rJ.prototype.ValueBufferType=Float32Array;rJ.prototype.DefaultInterpolation=2301;i9=class i9 extends rJ{constructor(J,Q,$){super(J,Q,$)}};i9.prototype.ValueTypeName="bool";i9.prototype.ValueBufferType=Array;i9.prototype.DefaultInterpolation=2300;i9.prototype.InterpolantFactoryMethodLinear=void 0;i9.prototype.InterpolantFactoryMethodSmooth=void 0;KQ=class KQ extends rJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}};KQ.prototype.ValueTypeName="color";x8=class x8 extends rJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}};x8.prototype.ValueTypeName="number";xZ=class xZ extends M8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,Y=this.valueSize,X=($-Q)/(Z-Q),H=J*Y;for(let U=H+Y;H!==U;H+=4)vJ.slerpFlat(W,0,K,H-Y,K,H,X);return W}};a8=class a8 extends rJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new xZ(this.times,this.values,this.getValueSize(),J)}};a8.prototype.ValueTypeName="quaternion";a8.prototype.InterpolantFactoryMethodSmooth=void 0;o9=class o9 extends rJ{constructor(J,Q,$){super(J,Q,$)}};o9.prototype.ValueTypeName="string";o9.prototype.ValueBufferType=Array;o9.prototype.DefaultInterpolation=2300;o9.prototype.InterpolantFactoryMethodLinear=void 0;o9.prototype.InterpolantFactoryMethodSmooth=void 0;g8=class g8 extends rJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}};g8.prototype.ValueTypeName="vector";R9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(MH(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(MH(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};LY=new YQ;mJ.DEFAULT_MATERIAL_NAME="__DEFAULT";p9={};qG=class qG extends Error{constructor(J,Q){super(J);this.response=Q}};O9=class O9 extends mJ{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=R9.get(`file:${J}`);if(W!==void 0){this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0);return}if(p9[J]!==void 0){p9[J].push({onLoad:Q,onProgress:$,onError:Z});return}p9[J]=[],p9[J].push({onLoad:Q,onProgress:$,onError:Z});let K=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}),Y=this.mimeType,X=this.responseType;fetch(K).then((H)=>{if(H.status===200||H.status===0){if(H.status===0)H0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||H.body===void 0||H.body.getReader===void 0)return H;let U=p9[J],E=H.body.getReader(),N=H.headers.get("X-File-Size")||H.headers.get("Content-Length"),G=N?parseInt(N):0,q=G!==0,R=0,O=new ReadableStream({start(F){D();function D(){E.read().then(({done:k,value:M})=>{if(k)F.close();else{R+=M.byteLength;let V=new ProgressEvent("progress",{lengthComputable:q,loaded:R,total:G});for(let _=0,A=U.length;_<A;_++){let C=U[_];if(C.onProgress)C.onProgress(V)}F.enqueue(M),D()}},(k)=>{F.error(k)})}}});return new Response(O)}else throw new qG(`fetch for "${H.url}" responded with ${H.status}: ${H.statusText}`,H)}).then((H)=>{switch(X){case"arraybuffer":return H.arrayBuffer();case"blob":return H.blob();case"document":return H.text().then((U)=>{return new DOMParser().parseFromString(U,Y)});case"json":return H.json();default:if(Y==="")return H.text();else{let E=/charset="?([^;"\s]*)"?/i.exec(Y),N=E&&E[1]?E[1].toLowerCase():void 0,G=new TextDecoder(N);return H.arrayBuffer().then((q)=>G.decode(q))}}}).then((H)=>{R9.add(`file:${J}`,H);let U=p9[J];delete p9[J];for(let E=0,N=U.length;E<N;E++){let G=U[E];if(G.onLoad)G.onLoad(H)}}).catch((H)=>{let U=p9[J];if(U===void 0)throw this.manager.itemError(J),H;delete p9[J];for(let E=0,N=U.length;E<N;E++){let G=U[E];if(G.onError)G.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}};VY=class VY extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new O9(this.manager);K.setPath(this.path),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(Y){try{Q(W.parse(JSON.parse(Y)))}catch(X){if(Z)Z(X);else T0(X);W.manager.itemError(J)}},$,Z)}parse(J){let Q=[];for(let $=0;$<J.length;$++){let Z=p8.parse(J[$]);Q.push(Z)}return Q}};BY=class BY extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=[],Y=new h7,X=new O9(this.manager);X.setPath(this.path),X.setResponseType("arraybuffer"),X.setRequestHeader(this.requestHeader),X.setWithCredentials(W.withCredentials);let H=0;function U(E){X.load(J[E],function(N){let G=W.parse(N,!0);if(K[E]={width:G.width,height:G.height,format:G.format,mipmaps:G.mipmaps},H+=1,H===6){if(G.mipmapCount===1)Y.minFilter=1006;if(Y.image=K,Y.format=G.format,Y.needsUpdate=!0,Q)Q(Y)}},$,Z)}if(Array.isArray(J))for(let E=0,N=J.length;E<N;++E)U(E);else X.load(J,function(E){let N=W.parse(E,!0);if(N.isCubemap){let G=N.mipmaps.length/N.mipmapCount;for(let q=0;q<G;q++){K[q]={mipmaps:[]};for(let R=0;R<N.mipmapCount;R++)K[q].mipmaps.push(N.mipmaps[q*N.mipmapCount+R]),K[q].format=N.format,K[q].width=N.width,K[q].height=N.height}Y.image=K}else Y.image.width=N.width,Y.image.height=N.height,Y.mipmaps=N.mipmaps;if(N.mipmapCount===1)Y.minFilter=1006;if(Y.format=N.format,Y.needsUpdate=!0,Q)Q(Y)},$,Z);return Y}};R7=new WeakMap;m8=class m8 extends mJ{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,K=R9.get(`image:${J}`);if(K!==void 0){if(K.complete===!0)W.manager.itemStart(J),setTimeout(function(){if(Q)Q(K);W.manager.itemEnd(J)},0);else{let E=R7.get(K);if(E===void 0)E=[],R7.set(K,E);E.push({onLoad:Q,onError:Z})}return K}let Y=z7("img");function X(){if(U(),Q)Q(this);let E=R7.get(this)||[];for(let N=0;N<E.length;N++){let G=E[N];if(G.onLoad)G.onLoad(this)}R7.delete(this),W.manager.itemEnd(J)}function H(E){if(U(),Z)Z(E);R9.remove(`image:${J}`);let N=R7.get(this)||[];for(let G=0;G<N.length;G++){let q=N[G];if(q.onError)q.onError(E)}R7.delete(this),W.manager.itemError(J),W.manager.itemEnd(J)}function U(){Y.removeEventListener("load",X,!1),Y.removeEventListener("error",H,!1)}if(Y.addEventListener("load",X,!1),Y.addEventListener("error",H,!1),J.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)Y.crossOrigin=this.crossOrigin}return R9.add(`image:${J}`,Y),W.manager.itemStart(J),Y.src=J,Y}};zY=class zY extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new s8;W.colorSpace="srgb";let K=new m8(this.manager);K.setCrossOrigin(this.crossOrigin),K.setPath(this.path);let Y=0;function X(H){K.load(J[H],function(U){if(W.images[H]=U,Y++,Y===6){if(W.needsUpdate=!0,Q)Q(W)}},void 0,Z)}for(let H=0;H<J.length;++H)X(H);return W}};IY=class IY extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new $9,Y=new O9(this.manager);return Y.setResponseType("arraybuffer"),Y.setRequestHeader(this.requestHeader),Y.setPath(this.path),Y.setWithCredentials(W.withCredentials),Y.load(J,function(X){let H;try{H=W.parse(X)}catch(U){if(Z!==void 0)Z(U);else T0(U);return}if(H.image!==void 0)K.image=H.image;else if(H.data!==void 0)K.image.width=H.width,K.image.height=H.height,K.image.data=H.data;if(K.wrapS=H.wrapS!==void 0?H.wrapS:1001,K.wrapT=H.wrapT!==void 0?H.wrapT:1001,K.magFilter=H.magFilter!==void 0?H.magFilter:1006,K.minFilter=H.minFilter!==void 0?H.minFilter:1006,K.anisotropy=H.anisotropy!==void 0?H.anisotropy:1,H.colorSpace!==void 0)K.colorSpace=H.colorSpace;if(H.flipY!==void 0)K.flipY=H.flipY;if(H.format!==void 0)K.format=H.format;if(H.type!==void 0)K.type=H.type;if(H.mipmaps!==void 0)K.mipmaps=H.mipmaps,K.minFilter=1008;if(H.mipmapCount===1)K.minFilter=1006;if(H.generateMipmaps!==void 0)K.generateMipmaps=H.generateMipmaps;if(K.needsUpdate=!0,Q)Q(K,H)},$,Z),K}};_Y=class _Y extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new OJ,K=new m8(this.manager);return K.setCrossOrigin(this.crossOrigin),K.setPath(this.path),K.load(J,function(Y){if(W.image=Y,W.needsUpdate=!0,Q!==void 0)Q(W)},$,Z),W}};y9=class y9 extends KJ{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new V0(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}};gZ=class gZ extends y9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(KJ.DEFAULT_UP),this.updateMatrix(),this.groundColor=new V0(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}};dW=new d0,LH=new P,VH=new P;tQ=new P,eQ=new vJ,A9=new P;l7=class l7 extends KJ{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new d0,this.projectionMatrix=new d0,this.projectionMatrixInverse=new d0,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(tQ,eQ,A9),A9.x===1&&A9.y===1&&A9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(tQ,eQ,A9.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(tQ,eQ,A9),A9.x===1&&A9.y===1&&A9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(tQ,eQ,A9.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}};W8=new P,BH=new r,zH=new r;CJ=class CJ extends l7{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=b8*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(f8*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return b8*2*Math.atan(Math.tan(f8*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,$){W8.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(W8.x,W8.y).multiplyScalar(-J/W8.z),W8.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(W8.x,W8.y).multiplyScalar(-J/W8.z)}getViewSize(J,Q){return this.getViewBounds(J,BH,zH),Q.subVectors(zH,BH)}setViewOffset(J,Q,$,Z,W,K){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=K,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=this.near,Q=J*Math.tan(f8*0.5*this.fov)/this.zoom,$=2*Q,Z=this.aspect*$,W=-0.5*Z,K=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:X,fullHeight:H}=K;W+=K.offsetX*Z/X,Q-=K.offsetY*$/H,Z*=K.width/X,$*=K.height/H}let Y=this.filmOffset;if(Y!==0)W+=J*Y/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}};DG=class DG extends pZ{constructor(){super(new CJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=b8*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}};mZ=class mZ extends y9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,K=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(KJ.DEFAULT_UP),this.updateMatrix(),this.target=new KJ,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=K,this.map=null,this.shadow=new DG}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}};FG=class FG extends pZ{constructor(){super(new CJ(90,1,0.5,500));this.isPointLightShadow=!0}};dZ=class dZ extends y9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new FG}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}};r8=class r8 extends l7{constructor(J=-1,Q=1,$=1,Z=-1,W=0.1,K=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=K,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,K){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=K,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,K=$+J,Y=Z+Q,X=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,K=W+H*this.view.width,Y-=U*this.view.offsetY,X=Y-U*this.view.height}this.projectionMatrix.makeOrthographic(W,K,Y,X,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}};RG=class RG extends pZ{constructor(){super(new r8(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}};lZ=class lZ extends y9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(KJ.DEFAULT_UP),this.updateMatrix(),this.target=new KJ,this.shadow=new RG}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}};uZ=class uZ extends y9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}};cZ=class cZ extends y9{constructor(J,Q,$=10,Z=10){super(J,Q);this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=$,this.height=Z}get power(){return this.intensity*this.width*this.height*Math.PI}set power(J){this.intensity=J/(this.width*this.height*Math.PI)}copy(J){return super.copy(J),this.width=J.width,this.height=J.height,this}toJSON(J){let Q=super.toJSON(J);return Q.object.width=this.width,Q.object.height=this.height,Q}};nZ=class nZ extends y9{constructor(J=new XQ,Q=1){super(void 0,Q);this.isLightProbe=!0,this.sh=J}copy(J){return super.copy(J),this.sh.copy(J.sh),this}toJSON(J){let Q=super.toJSON(J);return Q.object.sh=this.sh.toArray(),Q}};HQ=class HQ extends mJ{constructor(J){super(J);this.textures={}}load(J,Q,$,Z){let W=this,K=new O9(W.manager);K.setPath(W.path),K.setRequestHeader(W.requestHeader),K.setWithCredentials(W.withCredentials),K.load(J,function(Y){try{Q(W.parse(JSON.parse(Y)))}catch(X){if(Z)Z(X);else T0(X);W.manager.itemError(J)}},$,Z)}parse(J){let Q=this.textures;function $(W){if(Q[W]===void 0)H0("MaterialLoader: Undefined texture",W);return Q[W]}let Z=this.createMaterialFromType(J.type);if(J.uuid!==void 0)Z.uuid=J.uuid;if(J.name!==void 0)Z.name=J.name;if(J.color!==void 0&&Z.color!==void 0)Z.color.setHex(J.color);if(J.roughness!==void 0)Z.roughness=J.roughness;if(J.metalness!==void 0)Z.metalness=J.metalness;if(J.sheen!==void 0)Z.sheen=J.sheen;if(J.sheenColor!==void 0)Z.sheenColor=new V0().setHex(J.sheenColor);if(J.sheenRoughness!==void 0)Z.sheenRoughness=J.sheenRoughness;if(J.emissive!==void 0&&Z.emissive!==void 0)Z.emissive.setHex(J.emissive);if(J.specular!==void 0&&Z.specular!==void 0)Z.specular.setHex(J.specular);if(J.specularIntensity!==void 0)Z.specularIntensity=J.specularIntensity;if(J.specularColor!==void 0&&Z.specularColor!==void 0)Z.specularColor.setHex(J.specularColor);if(J.shininess!==void 0)Z.shininess=J.shininess;if(J.clearcoat!==void 0)Z.clearcoat=J.clearcoat;if(J.clearcoatRoughness!==void 0)Z.clearcoatRoughness=J.clearcoatRoughness;if(J.dispersion!==void 0)Z.dispersion=J.dispersion;if(J.iridescence!==void 0)Z.iridescence=J.iridescence;if(J.iridescenceIOR!==void 0)Z.iridescenceIOR=J.iridescenceIOR;if(J.iridescenceThicknessRange!==void 0)Z.iridescenceThicknessRange=J.iridescenceThicknessRange;if(J.transmission!==void 0)Z.transmission=J.transmission;if(J.thickness!==void 0)Z.thickness=J.thickness;if(J.attenuationDistance!==void 0)Z.attenuationDistance=J.attenuationDistance;if(J.attenuationColor!==void 0&&Z.attenuationColor!==void 0)Z.attenuationColor.setHex(J.attenuationColor);if(J.anisotropy!==void 0)Z.anisotropy=J.anisotropy;if(J.anisotropyRotation!==void 0)Z.anisotropyRotation=J.anisotropyRotation;if(J.fog!==void 0)Z.fog=J.fog;if(J.flatShading!==void 0)Z.flatShading=J.flatShading;if(J.blending!==void 0)Z.blending=J.blending;if(J.combine!==void 0)Z.combine=J.combine;if(J.side!==void 0)Z.side=J.side;if(J.shadowSide!==void 0)Z.shadowSide=J.shadowSide;if(J.opacity!==void 0)Z.opacity=J.opacity;if(J.transparent!==void 0)Z.transparent=J.transparent;if(J.alphaTest!==void 0)Z.alphaTest=J.alphaTest;if(J.alphaHash!==void 0)Z.alphaHash=J.alphaHash;if(J.depthFunc!==void 0)Z.depthFunc=J.depthFunc;if(J.depthTest!==void 0)Z.depthTest=J.depthTest;if(J.depthWrite!==void 0)Z.depthWrite=J.depthWrite;if(J.colorWrite!==void 0)Z.colorWrite=J.colorWrite;if(J.blendSrc!==void 0)Z.blendSrc=J.blendSrc;if(J.blendDst!==void 0)Z.blendDst=J.blendDst;if(J.blendEquation!==void 0)Z.blendEquation=J.blendEquation;if(J.blendSrcAlpha!==void 0)Z.blendSrcAlpha=J.blendSrcAlpha;if(J.blendDstAlpha!==void 0)Z.blendDstAlpha=J.blendDstAlpha;if(J.blendEquationAlpha!==void 0)Z.blendEquationAlpha=J.blendEquationAlpha;if(J.blendColor!==void 0&&Z.blendColor!==void 0)Z.blendColor.setHex(J.blendColor);if(J.blendAlpha!==void 0)Z.blendAlpha=J.blendAlpha;if(J.stencilWriteMask!==void 0)Z.stencilWriteMask=J.stencilWriteMask;if(J.stencilFunc!==void 0)Z.stencilFunc=J.stencilFunc;if(J.stencilRef!==void 0)Z.stencilRef=J.stencilRef;if(J.stencilFuncMask!==void 0)Z.stencilFuncMask=J.stencilFuncMask;if(J.stencilFail!==void 0)Z.stencilFail=J.stencilFail;if(J.stencilZFail!==void 0)Z.stencilZFail=J.stencilZFail;if(J.stencilZPass!==void 0)Z.stencilZPass=J.stencilZPass;if(J.stencilWrite!==void 0)Z.stencilWrite=J.stencilWrite;if(J.wireframe!==void 0)Z.wireframe=J.wireframe;if(J.wireframeLinewidth!==void 0)Z.wireframeLinewidth=J.wireframeLinewidth;if(J.wireframeLinecap!==void 0)Z.wireframeLinecap=J.wireframeLinecap;if(J.wireframeLinejoin!==void 0)Z.wireframeLinejoin=J.wireframeLinejoin;if(J.rotation!==void 0)Z.rotation=J.rotation;if(J.linewidth!==void 0)Z.linewidth=J.linewidth;if(J.dashSize!==void 0)Z.dashSize=J.dashSize;if(J.gapSize!==void 0)Z.gapSize=J.gapSize;if(J.scale!==void 0)Z.scale=J.scale;if(J.polygonOffset!==void 0)Z.polygonOffset=J.polygonOffset;if(J.polygonOffsetFactor!==void 0)Z.polygonOffsetFactor=J.polygonOffsetFactor;if(J.polygonOffsetUnits!==void 0)Z.polygonOffsetUnits=J.polygonOffsetUnits;if(J.dithering!==void 0)Z.dithering=J.dithering;if(J.alphaToCoverage!==void 0)Z.alphaToCoverage=J.alphaToCoverage;if(J.premultipliedAlpha!==void 0)Z.premultipliedAlpha=J.premultipliedAlpha;if(J.forceSinglePass!==void 0)Z.forceSinglePass=J.forceSinglePass;if(J.allowOverride!==void 0)Z.allowOverride=J.allowOverride;if(J.visible!==void 0)Z.visible=J.visible;if(J.toneMapped!==void 0)Z.toneMapped=J.toneMapped;if(J.userData!==void 0)Z.userData=J.userData;if(J.vertexColors!==void 0)if(typeof J.vertexColors==="number")Z.vertexColors=J.vertexColors>0;else Z.vertexColors=J.vertexColors;if(J.uniforms!==void 0)for(let W in J.uniforms){let K=J.uniforms[W];switch(Z.uniforms[W]={},K.type){case"t":Z.uniforms[W].value=$(K.value);break;case"c":Z.uniforms[W].value=new V0().setHex(K.value);break;case"v2":Z.uniforms[W].value=new r().fromArray(K.value);break;case"v3":Z.uniforms[W].value=new P().fromArray(K.value);break;case"v4":Z.uniforms[W].value=new GJ().fromArray(K.value);break;case"m3":Z.uniforms[W].value=new u0().fromArray(K.value);break;case"m4":Z.uniforms[W].value=new d0().fromArray(K.value);break;default:Z.uniforms[W].value=K.value}}if(J.defines!==void 0)Z.defines=J.defines;if(J.vertexShader!==void 0)Z.vertexShader=J.vertexShader;if(J.fragmentShader!==void 0)Z.fragmentShader=J.fragmentShader;if(J.glslVersion!==void 0)Z.glslVersion=J.glslVersion;if(J.extensions!==void 0)for(let W in J.extensions)Z.extensions[W]=J.extensions[W];if(J.lights!==void 0)Z.lights=J.lights;if(J.clipping!==void 0)Z.clipping=J.clipping;if(J.size!==void 0)Z.size=J.size;if(J.sizeAttenuation!==void 0)Z.sizeAttenuation=J.sizeAttenuation;if(J.map!==void 0)Z.map=$(J.map);if(J.matcap!==void 0)Z.matcap=$(J.matcap);if(J.alphaMap!==void 0)Z.alphaMap=$(J.alphaMap);if(J.bumpMap!==void 0)Z.bumpMap=$(J.bumpMap);if(J.bumpScale!==void 0)Z.bumpScale=J.bumpScale;if(J.normalMap!==void 0)Z.normalMap=$(J.normalMap);if(J.normalMapType!==void 0)Z.normalMapType=J.normalMapType;if(J.normalScale!==void 0){let W=J.normalScale;if(Array.isArray(W)===!1)W=[W,W];Z.normalScale=new r().fromArray(W)}if(J.displacementMap!==void 0)Z.displacementMap=$(J.displacementMap);if(J.displacementScale!==void 0)Z.displacementScale=J.displacementScale;if(J.displacementBias!==void 0)Z.displacementBias=J.displacementBias;if(J.roughnessMap!==void 0)Z.roughnessMap=$(J.roughnessMap);if(J.metalnessMap!==void 0)Z.metalnessMap=$(J.metalnessMap);if(J.emissiveMap!==void 0)Z.emissiveMap=$(J.emissiveMap);if(J.emissiveIntensity!==void 0)Z.emissiveIntensity=J.emissiveIntensity;if(J.specularMap!==void 0)Z.specularMap=$(J.specularMap);if(J.specularIntensityMap!==void 0)Z.specularIntensityMap=$(J.specularIntensityMap);if(J.specularColorMap!==void 0)Z.specularColorMap=$(J.specularColorMap);if(J.envMap!==void 0)Z.envMap=$(J.envMap);if(J.envMapRotation!==void 0)Z.envMapRotation.fromArray(J.envMapRotation);if(J.envMapIntensity!==void 0)Z.envMapIntensity=J.envMapIntensity;if(J.reflectivity!==void 0)Z.reflectivity=J.reflectivity;if(J.refractionRatio!==void 0)Z.refractionRatio=J.refractionRatio;if(J.lightMap!==void 0)Z.lightMap=$(J.lightMap);if(J.lightMapIntensity!==void 0)Z.lightMapIntensity=J.lightMapIntensity;if(J.aoMap!==void 0)Z.aoMap=$(J.aoMap);if(J.aoMapIntensity!==void 0)Z.aoMapIntensity=J.aoMapIntensity;if(J.gradientMap!==void 0)Z.gradientMap=$(J.gradientMap);if(J.clearcoatMap!==void 0)Z.clearcoatMap=$(J.clearcoatMap);if(J.clearcoatRoughnessMap!==void 0)Z.clearcoatRoughnessMap=$(J.clearcoatRoughnessMap);if(J.clearcoatNormalMap!==void 0)Z.clearcoatNormalMap=$(J.clearcoatNormalMap);if(J.clearcoatNormalScale!==void 0)Z.clearcoatNormalScale=new r().fromArray(J.clearcoatNormalScale);if(J.iridescenceMap!==void 0)Z.iridescenceMap=$(J.iridescenceMap);if(J.iridescenceThicknessMap!==void 0)Z.iridescenceThicknessMap=$(J.iridescenceThicknessMap);if(J.transmissionMap!==void 0)Z.transmissionMap=$(J.transmissionMap);if(J.thicknessMap!==void 0)Z.thicknessMap=$(J.thicknessMap);if(J.anisotropyMap!==void 0)Z.anisotropyMap=$(J.anisotropyMap);if(J.sheenColorMap!==void 0)Z.sheenColorMap=$(J.sheenColorMap);if(J.sheenRoughnessMap!==void 0)Z.sheenRoughnessMap=$(J.sheenRoughnessMap);return Z}setTextures(J){return this.textures=J,this}createMaterialFromType(J){return HQ.createMaterialFromType(J)}static createMaterialFromType(J){return new{ShadowMaterial:CZ,SpriteMaterial:S6,RawShaderMaterial:JQ,ShaderMaterial:aJ,PointsMaterial:f6,MeshPhysicalMaterial:wZ,MeshStandardMaterial:QQ,MeshPhongMaterial:PZ,MeshToonMaterial:TZ,MeshNormalMaterial:SZ,MeshLambertMaterial:jZ,MeshDepthMaterial:$Q,MeshDistanceMaterial:ZQ,MeshBasicMaterial:j9,MeshMatcapMaterial:yZ,LineDashedMaterial:vZ,LineBasicMaterial:fJ,Material:yJ}[J]}};sZ=class sZ extends c0{constructor(){super();this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(J){return super.copy(J),this.instanceCount=J.instanceCount,this}toJSON(){let J=super.toJSON();return J.instanceCount=this.instanceCount,J.isInstancedBufferGeometry=!0,J}};iZ=class iZ extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new O9(W.manager);K.setPath(W.path),K.setRequestHeader(W.requestHeader),K.setWithCredentials(W.withCredentials),K.load(J,function(Y){try{Q(W.parse(JSON.parse(Y)))}catch(X){if(Z)Z(X);else T0(X);W.manager.itemError(J)}},$,Z)}parse(J){let Q={},$={};function Z(G,q){if(Q[q]!==void 0)return Q[q];let O=G.interleavedBuffers[q],F=W(G,O.buffer),D=V7(O.type,F),k=new b7(D,O.stride);return k.uuid=O.uuid,Q[q]=k,k}function W(G,q){if($[q]!==void 0)return $[q];let O=G.arrayBuffers[q],F=new Uint32Array(O).buffer;return $[q]=F,F}let K=J.isInstancedBufferGeometry?new sZ:new c0,Y=J.data.index;if(Y!==void 0){let G=V7(Y.type,Y.array);K.setIndex(new UJ(G,1))}let X=J.data.attributes;for(let G in X){let q=X[G],R;if(q.isInterleavedBufferAttribute){let O=Z(J.data,q.data);R=new H8(O,q.itemSize,q.offset,q.normalized)}else{let O=V7(q.type,q.array);R=new(q.isInstancedBufferAttribute?U8:UJ)(O,q.itemSize,q.normalized)}if(q.name!==void 0)R.name=q.name;if(q.usage!==void 0)R.setUsage(q.usage);K.setAttribute(G,R)}let H=J.data.morphAttributes;if(H)for(let G in H){let q=H[G],R=[];for(let O=0,F=q.length;O<F;O++){let D=q[O],k;if(D.isInterleavedBufferAttribute){let M=Z(J.data,D.data);k=new H8(M,D.itemSize,D.offset,D.normalized)}else{let M=V7(D.type,D.array);k=new UJ(M,D.itemSize,D.normalized)}if(D.name!==void 0)k.name=D.name;R.push(k)}K.morphAttributes[G]=R}if(J.data.morphTargetsRelative)K.morphTargetsRelative=!0;let E=J.data.groups||J.data.drawcalls||J.data.offsets;if(E!==void 0)for(let G=0,q=E.length;G!==q;++G){let R=E[G];K.addGroup(R.start,R.count,R.materialIndex)}let N=J.data.boundingSphere;if(N!==void 0)K.boundingSphere=new wJ().fromJSON(N);if(J.name)K.name=J.name;if(J.userData)K.userData=J.userData;return K}};lW={};AY=class AY extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=this.path===""?q6.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||K;let Y=new O9(this.manager);Y.setPath(this.path),Y.setRequestHeader(this.requestHeader),Y.setWithCredentials(this.withCredentials),Y.load(J,function(X){let H=null;try{H=JSON.parse(X)}catch(E){if(Z!==void 0)Z(E);T0("ObjectLoader: Can't parse "+J+".",E.message);return}let U=H.metadata;if(U===void 0||U.type===void 0||U.type.toLowerCase()==="geometry"){if(Z!==void 0)Z(Error("THREE.ObjectLoader: Can't load "+J));T0("ObjectLoader: Can't load "+J);return}W.parse(H,Q)},$,Z)}async loadAsync(J,Q){let $=this,Z=this.path===""?q6.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||Z;let W=new O9(this.manager);W.setPath(this.path),W.setRequestHeader(this.requestHeader),W.setWithCredentials(this.withCredentials);let K=await W.loadAsync(J,Q),Y;try{Y=JSON.parse(K)}catch(H){throw Error("ObjectLoader: Can't parse "+J+". "+H.message)}let X=Y.metadata;if(X===void 0||X.type===void 0||X.type.toLowerCase()==="geometry")throw Error("THREE.ObjectLoader: Can't load "+J);return await $.parseAsync(Y)}parse(J,Q){let $=this.parseAnimations(J.animations),Z=this.parseShapes(J.shapes),W=this.parseGeometries(J.geometries,Z),K=this.parseImages(J.images,function(){if(Q!==void 0)Q(H)}),Y=this.parseTextures(J.textures,K),X=this.parseMaterials(J.materials,Y),H=this.parseObject(J.object,W,X,Y,$),U=this.parseSkeletons(J.skeletons,H);if(this.bindSkeletons(H,U),this.bindLightTargets(H),Q!==void 0){let E=!1;for(let N in K)if(K[N].data instanceof HTMLImageElement){E=!0;break}if(E===!1)Q(H)}return H}async parseAsync(J){let Q=this.parseAnimations(J.animations),$=this.parseShapes(J.shapes),Z=this.parseGeometries(J.geometries,$),W=await this.parseImagesAsync(J.images),K=this.parseTextures(J.textures,W),Y=this.parseMaterials(J.materials,K),X=this.parseObject(J.object,Z,Y,K,Q),H=this.parseSkeletons(J.skeletons,X);return this.bindSkeletons(X,H),this.bindLightTargets(X),X}static registerGeometry(J,Q){lW[J]=Q}parseShapes(J){let Q={};if(J!==void 0)for(let $=0,Z=J.length;$<Z;$++){let W=new l9().fromJSON(J[$]);Q[W.uuid]=W}return Q}parseSkeletons(J,Q){let $={},Z={};if(Q.traverse(function(W){if(W.isBone)Z[W.uuid]=W}),J!==void 0)for(let W=0,K=J.length;W<K;W++){let Y=new y6().fromJSON(J[W],Z);$[Y.uuid]=Y}return $}parseGeometries(J,Q){let $={};if(J!==void 0){let Z=new iZ;for(let W=0,K=J.length;W<K;W++){let Y,X=J[W];switch(X.type){case"BufferGeometry":case"InstancedBufferGeometry":Y=Z.parse(X);break;default:if(X.type in OH)Y=OH[X.type].fromJSON(X,Q);else if(X.type in lW)Y=lW[X.type].fromJSON(X,Q);else H0(`ObjectLoader: Unknown geometry type "${X.type}". Use .registerGeometry() before starting the deserialization process.`)}if(Y.uuid=X.uuid,X.name!==void 0)Y.name=X.name;if(X.userData!==void 0)Y.userData=X.userData;$[X.uuid]=Y}}return $}parseMaterials(J,Q){let $={},Z={};if(J!==void 0){let W=new HQ;W.setTextures(Q);for(let K=0,Y=J.length;K<Y;K++){let X=J[K];if($[X.uuid]===void 0)$[X.uuid]=W.parse(X);Z[X.uuid]=$[X.uuid]}}return Z}parseAnimations(J){let Q={};if(J!==void 0)for(let $=0;$<J.length;$++){let Z=J[$],W=p8.parse(Z);Q[W.uuid]=W}return Q}parseImages(J,Q){let $=this,Z={},W;function K(X){return $.manager.itemStart(X),W.load(X,function(){$.manager.itemEnd(X)},void 0,function(){$.manager.itemError(X),$.manager.itemEnd(X)})}function Y(X){if(typeof X==="string"){let H=X,U=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(H)?H:$.resourcePath+H;return K(U)}else if(X.data)return{data:V7(X.type,X.data),width:X.width,height:X.height};else return null}if(J!==void 0&&J.length>0){let X=new YQ(Q);W=new m8(X),W.setCrossOrigin(this.crossOrigin);for(let H=0,U=J.length;H<U;H++){let E=J[H],N=E.url;if(Array.isArray(N)){let G=[];for(let q=0,R=N.length;q<R;q++){let O=N[q],F=Y(O);if(F!==null)if(F instanceof HTMLImageElement)G.push(F);else G.push(new $9(F.data,F.width,F.height))}Z[E.uuid]=new w9(G)}else{let G=Y(E.url);Z[E.uuid]=new w9(G)}}}return Z}async parseImagesAsync(J){let Q=this,$={},Z;async function W(K){if(typeof K==="string"){let Y=K,X=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(Y)?Y:Q.resourcePath+Y;return await Z.loadAsync(X)}else if(K.data)return{data:V7(K.type,K.data),width:K.width,height:K.height};else return null}if(J!==void 0&&J.length>0){Z=new m8(this.manager),Z.setCrossOrigin(this.crossOrigin);for(let K=0,Y=J.length;K<Y;K++){let X=J[K],H=X.url;if(Array.isArray(H)){let U=[];for(let E=0,N=H.length;E<N;E++){let G=H[E],q=await W(G);if(q!==null)if(q instanceof HTMLImageElement)U.push(q);else U.push(new $9(q.data,q.width,q.height))}$[X.uuid]=new w9(U)}else{let U=await W(X.url);$[X.uuid]=new w9(U)}}}return $}parseTextures(J,Q){function $(W,K){if(typeof W==="number")return W;return H0("ObjectLoader.parseTexture: Constant should be in numeric form.",W),K[W]}let Z={};if(J!==void 0)for(let W=0,K=J.length;W<K;W++){let Y=J[W];if(Y.image===void 0)H0('ObjectLoader: No "image" specified for',Y.uuid);if(Q[Y.image]===void 0)H0("ObjectLoader: Undefined image",Y.image);let X=Q[Y.image],H=X.data,U;if(Array.isArray(H)){if(U=new s8,H.length===6)U.needsUpdate=!0}else{if(H&&H.data)U=new $9;else U=new OJ;if(H)U.needsUpdate=!0}if(U.source=X,U.uuid=Y.uuid,Y.name!==void 0)U.name=Y.name;if(Y.mapping!==void 0)U.mapping=$(Y.mapping,mE);if(Y.channel!==void 0)U.channel=Y.channel;if(Y.offset!==void 0)U.offset.fromArray(Y.offset);if(Y.repeat!==void 0)U.repeat.fromArray(Y.repeat);if(Y.center!==void 0)U.center.fromArray(Y.center);if(Y.rotation!==void 0)U.rotation=Y.rotation;if(Y.wrap!==void 0)U.wrapS=$(Y.wrap[0],IH),U.wrapT=$(Y.wrap[1],IH);if(Y.format!==void 0)U.format=Y.format;if(Y.internalFormat!==void 0)U.internalFormat=Y.internalFormat;if(Y.type!==void 0)U.type=Y.type;if(Y.colorSpace!==void 0)U.colorSpace=Y.colorSpace;if(Y.minFilter!==void 0)U.minFilter=$(Y.minFilter,_H);if(Y.magFilter!==void 0)U.magFilter=$(Y.magFilter,_H);if(Y.anisotropy!==void 0)U.anisotropy=Y.anisotropy;if(Y.flipY!==void 0)U.flipY=Y.flipY;if(Y.generateMipmaps!==void 0)U.generateMipmaps=Y.generateMipmaps;if(Y.premultiplyAlpha!==void 0)U.premultiplyAlpha=Y.premultiplyAlpha;if(Y.unpackAlignment!==void 0)U.unpackAlignment=Y.unpackAlignment;if(Y.compareFunction!==void 0)U.compareFunction=Y.compareFunction;if(Y.normalized!==void 0)U.normalized=Y.normalized;if(Y.userData!==void 0)U.userData=Y.userData;Z[Y.uuid]=U}return Z}parseObject(J,Q,$,Z,W){let K;function Y(N){if(Q[N]===void 0)H0("ObjectLoader: Undefined geometry",N);return Q[N]}function X(N){if(N===void 0)return;if(Array.isArray(N)){let G=[];for(let q=0,R=N.length;q<R;q++){let O=N[q];if($[O]===void 0)H0("ObjectLoader: Undefined material",O);G.push($[O])}return G}if($[N]===void 0)H0("ObjectLoader: Undefined material",N);return $[N]}function H(N){if(Z[N]===void 0)H0("ObjectLoader: Undefined texture",N);return Z[N]}let U,E;switch(J.type){case"Scene":if(K=new GZ,J.background!==void 0)if(Number.isInteger(J.background))K.background=new V0(J.background);else K.background=H(J.background);if(J.environment!==void 0)K.environment=H(J.environment);if(J.fog!==void 0){if(J.fog.type==="Fog")K.fog=new w6(J.fog.color,J.fog.near,J.fog.far);else if(J.fog.type==="FogExp2")K.fog=new C6(J.fog.color,J.fog.density);if(J.fog.name!=="")K.fog.name=J.fog.name}if(J.backgroundBlurriness!==void 0)K.backgroundBlurriness=J.backgroundBlurriness;if(J.backgroundIntensity!==void 0)K.backgroundIntensity=J.backgroundIntensity;if(J.backgroundRotation!==void 0)K.backgroundRotation.fromArray(J.backgroundRotation);if(J.environmentIntensity!==void 0)K.environmentIntensity=J.environmentIntensity;if(J.environmentRotation!==void 0)K.environmentRotation.fromArray(J.environmentRotation);break;case"PerspectiveCamera":if(K=new CJ(J.fov,J.aspect,J.near,J.far),J.focus!==void 0)K.focus=J.focus;if(J.zoom!==void 0)K.zoom=J.zoom;if(J.filmGauge!==void 0)K.filmGauge=J.filmGauge;if(J.filmOffset!==void 0)K.filmOffset=J.filmOffset;if(J.view!==void 0)K.view=Object.assign({},J.view);break;case"OrthographicCamera":if(K=new r8(J.left,J.right,J.top,J.bottom,J.near,J.far),J.zoom!==void 0)K.zoom=J.zoom;if(J.view!==void 0)K.view=Object.assign({},J.view);break;case"AmbientLight":K=new uZ(J.color,J.intensity);break;case"DirectionalLight":K=new lZ(J.color,J.intensity),K.target=J.target||"";break;case"PointLight":K=new dZ(J.color,J.intensity,J.distance,J.decay);break;case"RectAreaLight":K=new cZ(J.color,J.intensity,J.width,J.height);break;case"SpotLight":K=new mZ(J.color,J.intensity,J.distance,J.angle,J.penumbra,J.decay),K.target=J.target||"";break;case"HemisphereLight":K=new gZ(J.color,J.groundColor,J.intensity);break;case"LightProbe":let N=new XQ().fromArray(J.sh);K=new nZ(N,J.intensity);break;case"SkinnedMesh":if(U=Y(J.geometry),E=X(J.material),K=new qZ(U,E),J.bindMode!==void 0)K.bindMode=J.bindMode;if(J.bindMatrix!==void 0)K.bindMatrix.fromArray(J.bindMatrix);if(J.skeleton!==void 0)K.skeleton=J.skeleton;break;case"Mesh":U=Y(J.geometry),E=X(J.material),K=new VJ(U,E);break;case"InstancedMesh":U=Y(J.geometry),E=X(J.material);let{count:G,instanceMatrix:q,instanceColor:R}=J;if(K=new DZ(U,E,G),K.instanceMatrix=new U8(new Float32Array(q.array),16),R!==void 0)K.instanceColor=new U8(new Float32Array(R.array),R.itemSize);break;case"BatchedMesh":if(U=Y(J.geometry),E=X(J.material),K=new FZ(J.maxInstanceCount,J.maxVertexCount,J.maxIndexCount,E),K.geometry=U,K.perObjectFrustumCulled=J.perObjectFrustumCulled,K.sortObjects=J.sortObjects,K._drawRanges=J.drawRanges,K._reservedRanges=J.reservedRanges,K._geometryInfo=J.geometryInfo.map((O)=>{let F=null,D=null;if(O.boundingBox!==void 0)F=new jJ().fromJSON(O.boundingBox);if(O.boundingSphere!==void 0)D=new wJ().fromJSON(O.boundingSphere);return{...O,boundingBox:F,boundingSphere:D}}),K._instanceInfo=J.instanceInfo,K._availableInstanceIds=J._availableInstanceIds,K._availableGeometryIds=J._availableGeometryIds,K._nextIndexStart=J.nextIndexStart,K._nextVertexStart=J.nextVertexStart,K._geometryCount=J.geometryCount,K._maxInstanceCount=J.maxInstanceCount,K._maxVertexCount=J.maxVertexCount,K._maxIndexCount=J.maxIndexCount,K._geometryInitialized=J.geometryInitialized,K._matricesTexture=H(J.matricesTexture.uuid),K._indirectTexture=H(J.indirectTexture.uuid),J.colorsTexture!==void 0)K._colorsTexture=H(J.colorsTexture.uuid);if(J.boundingSphere!==void 0)K.boundingSphere=new wJ().fromJSON(J.boundingSphere);if(J.boundingBox!==void 0)K.boundingBox=new jJ().fromJSON(J.boundingBox);break;case"LOD":K=new NZ;break;case"Line":K=new P9(Y(J.geometry),X(J.material));break;case"LineLoop":K=new RZ(Y(J.geometry),X(J.material));break;case"LineSegments":K=new E9(Y(J.geometry),X(J.material));break;case"PointCloud":case"Points":K=new OZ(Y(J.geometry),X(J.material));break;case"Sprite":K=new EZ(X(J.material));break;case"Group":K=new Y8;break;case"Bone":K=new j6;break;default:K=new KJ}if(K.uuid=J.uuid,J.name!==void 0)K.name=J.name;if(J.matrix!==void 0){if(K.matrix.fromArray(J.matrix),J.matrixAutoUpdate!==void 0)K.matrixAutoUpdate=J.matrixAutoUpdate;if(K.matrixAutoUpdate)K.matrix.decompose(K.position,K.quaternion,K.scale)}else{if(J.position!==void 0)K.position.fromArray(J.position);if(J.rotation!==void 0)K.rotation.fromArray(J.rotation);if(J.quaternion!==void 0)K.quaternion.fromArray(J.quaternion);if(J.scale!==void 0)K.scale.fromArray(J.scale)}if(J.up!==void 0)K.up.fromArray(J.up);if(J.pivot!==void 0)K.pivot=new P().fromArray(J.pivot);if(J.morphTargetDictionary!==void 0)K.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);if(J.morphTargetInfluences!==void 0)K.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.castShadow!==void 0)K.castShadow=J.castShadow;if(J.receiveShadow!==void 0)K.receiveShadow=J.receiveShadow;if(J.shadow){if(J.shadow.intensity!==void 0)K.shadow.intensity=J.shadow.intensity;if(J.shadow.bias!==void 0)K.shadow.bias=J.shadow.bias;if(J.shadow.normalBias!==void 0)K.shadow.normalBias=J.shadow.normalBias;if(J.shadow.radius!==void 0)K.shadow.radius=J.shadow.radius;if(J.shadow.mapSize!==void 0)K.shadow.mapSize.fromArray(J.shadow.mapSize);if(J.shadow.camera!==void 0)K.shadow.camera=this.parseObject(J.shadow.camera)}if(J.visible!==void 0)K.visible=J.visible;if(J.frustumCulled!==void 0)K.frustumCulled=J.frustumCulled;if(J.renderOrder!==void 0)K.renderOrder=J.renderOrder;if(J.static!==void 0)K.static=J.static;if(J.userData!==void 0)K.userData=J.userData;if(J.layers!==void 0)K.layers.mask=J.layers;if(J.children!==void 0){let N=J.children;for(let G=0;G<N.length;G++)K.add(this.parseObject(N[G],Q,$,Z,W))}if(J.animations!==void 0){let N=J.animations;for(let G=0;G<N.length;G++){let q=N[G];K.animations.push(W[q])}}if(J.type==="LOD"){if(J.autoUpdate!==void 0)K.autoUpdate=J.autoUpdate;let N=J.levels;for(let G=0;G<N.length;G++){let q=N[G],R=K.getObjectByProperty("uuid",q.object);if(R!==void 0)K.addLevel(R,q.distance,q.hysteresis)}}return K}bindSkeletons(J,Q){if(Object.keys(Q).length===0)return;J.traverse(function($){if($.isSkinnedMesh===!0&&$.skeleton!==void 0){let Z=Q[$.skeleton];if(Z===void 0)H0("ObjectLoader: No skeleton found with UUID:",$.skeleton);else $.bind(Z,$.bindMatrix)}})}bindLightTargets(J){J.traverse(function(Q){if(Q.isDirectionalLight||Q.isSpotLight){let $=Q.target,Z=J.getObjectByProperty("uuid",$);if(Z!==void 0)Q.target=Z;else Q.target=new KJ}})}};mE={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},IH={RepeatWrapping:1000,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},_H={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008},uW=new WeakMap;CY=class CY extends mJ{constructor(J){super(J);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")H0("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")H0("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,K=R9.get(`image-bitmap:${J}`);if(K!==void 0){if(W.manager.itemStart(J),K.then){K.then((H)=>{if(uW.has(K)===!0){if(Z)Z(uW.get(K));W.manager.itemError(J),W.manager.itemEnd(J)}else{if(Q)Q(H);W.manager.itemEnd(J)}});return}setTimeout(function(){if(Q)Q(K);W.manager.itemEnd(J)},0);return}let Y={};Y.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",Y.headers=this.requestHeader,Y.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let X=fetch(J,Y).then(function(H){return H.blob()}).then(function(H){return createImageBitmap(H,Object.assign(W.options,{colorSpaceConversion:"none"}))}).then(function(H){if(R9.add(`image-bitmap:${J}`,H),Q)Q(H);W.manager.itemEnd(J)}).catch(function(H){if(Z)Z(H);uW.set(X,H),R9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});R9.add(`image-bitmap:${J}`,X),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};wY=class wY extends mJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,K=new O9(this.manager);K.setResponseType("arraybuffer"),K.setPath(this.path),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(X){try{let H=X.slice(0),U=UQ.getContext(),E=J+"#decode";W.manager.itemStart(E),U.decodeAudioData(H,function(N){Q(N),W.manager.itemEnd(E)}).catch(function(N){Y(N),W.manager.itemEnd(E)})}catch(H){Y(H)}},$,Z);function Y(X){if(Z)Z(X);else T0(X);W.manager.itemError(J)}}};AH=new d0,CH=new d0,w8=new d0;oZ=class oZ extends KJ{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new CJ(O7,k7,J,Q);Z.layers=this.layers,this.add(Z);let W=new CJ(O7,k7,J,Q);W.layers=this.layers,this.add(W);let K=new CJ(O7,k7,J,Q);K.layers=this.layers,this.add(K);let Y=new CJ(O7,k7,J,Q);Y.layers=this.layers,this.add(Y);let X=new CJ(O7,k7,J,Q);X.layers=this.layers,this.add(X);let H=new CJ(O7,k7,J,Q);H.layers=this.layers,this.add(H)}updateCoordinateSystem(){let J=this.coordinateSystem,Q=this.children.concat(),[$,Z,W,K,Y,X]=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),K.up.set(0,0,1),K.lookAt(0,-1,0),Y.up.set(0,1,0),Y.lookAt(0,0,1),X.up.set(0,1,0),X.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),K.up.set(0,0,-1),K.lookAt(0,-1,0),Y.up.set(0,-1,0),Y.lookAt(0,0,1),X.up.set(0,-1,0),X.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,K,Y,X,H,U]=this.children,E=J.getRenderTarget(),N=J.getActiveCubeFace(),G=J.getActiveMipmapLevel(),q=J.xr.enabled;J.xr.enabled=!1;let R=$.texture.generateMipmaps;$.texture.generateMipmaps=!1;let O=!1;if(J.isWebGLRenderer===!0)O=J.state.buffers.depth.getReversed();else O=J.reversedDepthBuffer;if(J.setRenderTarget($,0,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,W),J.setRenderTarget($,1,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,K),J.setRenderTarget($,2,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,Y),J.setRenderTarget($,3,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,X),J.setRenderTarget($,4,Z),O&&J.autoClear===!1)J.clearDepth();if(J.render(Q,H),$.texture.generateMipmaps=R,J.setRenderTarget($,5,Z),O&&J.autoClear===!1)J.clearDepth();J.render(Q,U),J.setRenderTarget(E,N,G),J.xr.enabled=q,$.texture.needsPMREMUpdate=!0}};aZ=class aZ extends CJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}};P8=new P,cW=new vJ,lE=new P,T8=new P,S8=new P;TY=class TY extends KJ{constructor(){super();this.type="AudioListener",this.context=UQ.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new rZ}getInput(){return this.gain}removeFilter(){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null;return this}getFilter(){return this.filter}setFilter(J){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination);else this.gain.disconnect(this.context.destination);return this.filter=J,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}updateMatrixWorld(J){super.updateMatrixWorld(J),this._timer.update();let Q=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(P8,cW,lE),T8.set(0,0,-1).applyQuaternion(cW),S8.set(0,1,0).applyQuaternion(cW),Q.positionX){let $=this.context.currentTime+this.timeDelta;Q.positionX.linearRampToValueAtTime(P8.x,$),Q.positionY.linearRampToValueAtTime(P8.y,$),Q.positionZ.linearRampToValueAtTime(P8.z,$),Q.forwardX.linearRampToValueAtTime(T8.x,$),Q.forwardY.linearRampToValueAtTime(T8.y,$),Q.forwardZ.linearRampToValueAtTime(T8.z,$),Q.upX.linearRampToValueAtTime(S8.x,$),Q.upY.linearRampToValueAtTime(S8.y,$),Q.upZ.linearRampToValueAtTime(S8.z,$)}else Q.setPosition(P8.x,P8.y,P8.z),Q.setOrientation(T8.x,T8.y,T8.z,S8.x,S8.y,S8.z)}};tZ=class tZ extends KJ{constructor(J){super();this.type="Audio",this.listener=J,this.context=J.context,this.gain=this.context.createGain(),this.gain.connect(J.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(J){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=J,this.connect(),this}setMediaElementSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(J),this.connect(),this}setMediaStreamSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(J),this.connect(),this}setBuffer(J){if(this.buffer=J,this.sourceType="buffer",this.autoplay)this.play();return this}play(J=0){if(this.isPlaying===!0){H0("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){H0("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+J;let Q=this.context.createBufferSource();return Q.buffer=this.buffer,Q.loop=this.loop,Q.loopStart=this.loopStart,Q.loopEnd=this.loopEnd,Q.onended=this.onEnded.bind(this),Q.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Q,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){H0("Audio: this Audio has no playback control.");return}if(this.isPlaying===!0){if(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0)this._progress=this._progress%(this.duration||this.buffer.duration);this.source.stop(),this.source.onended=null,this.isPlaying=!1}return this}stop(J=0){if(this.hasPlaybackControl===!1){H0("Audio: this Audio has no playback control.");return}if(this._progress=0,this.source!==null)this.source.stop(this.context.currentTime+J),this.source.onended=null;return this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].connect(this.filters[J]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected===!1)return;if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].disconnect(this.filters[J]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(J){if(!J)J=[];if(this._connected===!0)this.disconnect(),this.filters=J.slice(),this.connect();else this.filters=J.slice();return this}setDetune(J){if(this.detune=J,this.isPlaying===!0&&this.source.detune!==void 0)this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,0.01);return this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(J){return this.setFilters(J?[J]:[])}setPlaybackRate(J){if(this.hasPlaybackControl===!1){H0("Audio: this Audio has no playback control.");return}if(this.playbackRate=J,this.isPlaying===!0)this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,0.01);return this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){if(this.hasPlaybackControl===!1)return H0("Audio: this Audio has no playback control."),!1;return this.loop}setLoop(J){if(this.hasPlaybackControl===!1){H0("Audio: this Audio has no playback control.");return}if(this.loop=J,this.isPlaying===!0)this.source.loop=this.loop;return this}setLoopStart(J){return this.loopStart=J,this}setLoopEnd(J){return this.loopEnd=J,this}getVolume(){return this.gain.gain.value}setVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}copy(J,Q){if(super.copy(J,Q),J.sourceType!=="buffer")return H0("Audio: Audio source type cannot be copied."),this;return this.autoplay=J.autoplay,this.buffer=J.buffer,this.detune=J.detune,this.loop=J.loop,this.loopStart=J.loopStart,this.loopEnd=J.loopEnd,this.offset=J.offset,this.duration=J.duration,this.playbackRate=J.playbackRate,this.hasPlaybackControl=J.hasPlaybackControl,this.sourceType=J.sourceType,this.filters=J.filters.slice(),this}clone(J){return new this.constructor(this.listener).copy(this,J)}};j8=new P,wH=new vJ,uE=new P,y8=new P;SY=class SY extends tZ{constructor(J){super(J);this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(J){return this.panner.refDistance=J,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(J){return this.panner.rolloffFactor=J,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(J){return this.panner.distanceModel=J,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(J){return this.panner.maxDistance=J,this}setDirectionalCone(J,Q,$){return this.panner.coneInnerAngle=J,this.panner.coneOuterAngle=Q,this.panner.coneOuterGain=$,this}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(j8,wH,uE),y8.set(0,0,1).applyQuaternion(wH);let Q=this.panner;if(Q.positionX){let $=this.context.currentTime+this.listener.timeDelta;Q.positionX.linearRampToValueAtTime(j8.x,$),Q.positionY.linearRampToValueAtTime(j8.y,$),Q.positionZ.linearRampToValueAtTime(j8.z,$),Q.orientationX.linearRampToValueAtTime(y8.x,$),Q.orientationY.linearRampToValueAtTime(y8.y,$),Q.orientationZ.linearRampToValueAtTime(y8.z,$)}else Q.setPosition(j8.x,j8.y,j8.z),Q.setOrientation(y8.x,y8.y,y8.z)}};cE=new RegExp("["+yY+"]","g"),vY="[^"+yY+"]",nE="[^"+yY.replace("\\.","")+"]",sE=/((?:WC+[\/:])*)/.source.replace("WC",vY),iE=/(WCOD+)?/.source.replace("WCOD",nE),oE=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",vY),aE=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",vY),rE=new RegExp("^"+sE+iE+oE+aE+"$"),tE=["material","materials","bones","map"];WJ.Composite=OG;WJ.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};WJ.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};WJ.prototype.GetterByBindingType=[WJ.prototype._getValue_direct,WJ.prototype._getValue_array,WJ.prototype._getValue_arrayElement,WJ.prototype._getValue_toArray];WJ.prototype.SetterByBindingTypeAndVersioning=[[WJ.prototype._setValue_direct,WJ.prototype._setValue_direct_setNeedsUpdate,WJ.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[WJ.prototype._setValue_array,WJ.prototype._setValue_array_setNeedsUpdate,WJ.prototype._setValue_array_setMatrixWorldNeedsUpdate],[WJ.prototype._setValue_arrayElement,WJ.prototype._setValue_arrayElement_setNeedsUpdate,WJ.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[WJ.prototype._setValue_fromArray,WJ.prototype._setValue_fromArray_setNeedsUpdate,WJ.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];eE=new Float32Array(1);bY=class bY extends Z9{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,K=J._propertyBindings,Y=J._interpolants,X=$.uuid,H=this._bindingsByRootAndName,U=H[X];if(U===void 0)U={},H[X]=U;for(let E=0;E!==W;++E){let N=Z[E],G=N.name,q=U[G];if(q!==void 0)++q.referenceCount,K[E]=q;else{if(q=K[E],q!==void 0){if(q._cacheIndex===null)++q.referenceCount,this._addInactiveBinding(q,X,G);continue}let R=Q&&Q._propertyBindings[E].binding.parsedPath;q=new eZ(WJ.create($,G,R),N.ValueTypeName,N.getValueSize()),++q.referenceCount,this._addInactiveBinding(q,X,G),K[E]=q}Y[E].resultBuffer=q.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,K=W[Q];if(K===void 0)K={knownActions:[J],actionByRoot:{}},J._byClipCacheIndex=0,W[Q]=K;else{let Y=K.knownActions;J._byClipCacheIndex=Y.length,Y.push(J)}J._cacheIndex=Z.length,Z.push(J),K.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,K=this._actionsByClip,Y=K[W],X=Y.knownActions,H=X[X.length-1],U=J._byClipCacheIndex;H._byClipCacheIndex=U,X[U]=H,X.pop(),J._byClipCacheIndex=null;let E=Y.actionByRoot,N=(J._localRoot||this._root).uuid;if(delete E[N],X.length===0)delete K[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,K=Z[Q];if(K===void 0)K={},Z[Q]=K;K[$]=J,J._cacheIndex=W.length,W.push(J)}_removeInactiveBinding(J){let Q=this._bindings,$=J.binding,Z=$.rootNode.uuid,W=$.path,K=this._bindingsByRootAndName,Y=K[Z],X=Q[Q.length-1],H=J._cacheIndex;if(X._cacheIndex=H,Q[H]=X,Q.pop(),delete Y[W],Object.keys(Y).length===0)delete K[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 WQ(new Float32Array(2),new Float32Array(2),1,eE),$.__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,K=typeof J==="string"?p8.findByName(Z,J):J,Y=K!==null?K.uuid:J,X=this._actionsByClip[Y],H=null;if($===void 0)if(K!==null)$=K.blendMode;else $=2500;if(X!==void 0){let E=X.actionByRoot[W];if(E!==void 0&&E.blendMode===$)return E;if(H=X.knownActions[0],K===null)K=H._clip}if(K===null)return null;let U=new JW(this,K,Q,$);return this._bindAction(U,H),this._addInactiveAction(U,Y,W),U}existingAction(J,Q){let $=Q||this._root,Z=$.uuid,W=typeof J==="string"?p8.findByName($,J):J,K=W?W.uuid:J,Y=this._actionsByClip[K];if(Y!==void 0)return Y.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),K=this._accuIndex^=1;for(let H=0;H!==$;++H)Q[H]._update(Z,J,W,K);let Y=this._bindings,X=this._nActiveBindings;for(let H=0;H!==X;++H)Y[H].apply(K);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 K=W.knownActions;for(let Y=0,X=K.length;Y!==X;++Y){let H=K[Y];this._deactivateAction(H);let U=H._cacheIndex,E=Q[Q.length-1];H._cacheIndex=null,H._byClipCacheIndex=null,E._cacheIndex=U,Q[U]=E,Q.pop(),this._removeInactiveBindingsForAction(H)}delete Z[$]}}uncacheRoot(J){let Q=J.uuid,$=this._actionsByClip;for(let K in $){let Y=$[K].actionByRoot,X=Y[Q];if(X!==void 0)this._deactivateAction(X),this._removeInactiveAction(X)}let Z=this._bindingsByRootAndName,W=Z[Q];if(W!==void 0)for(let K in W){let Y=W[K];Y.restoreOriginalState(),this._removeInactiveBinding(Y)}}uncacheAction(J,Q){let $=this.existingAction(J,Q);if($!==null)this._deactivateAction($),this._removeInactiveAction($)}};hY=class hY extends A6{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isRenderTarget3D=!0,this.depth=$,this.texture=new y7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}};xY=class xY extends Z9{constructor(){super();this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:JN++}),this.name="",this.usage=35044,this.uniforms=[]}add(J){return this.uniforms.push(J),this}remove(J){let Q=this.uniforms.indexOf(J);if(Q!==-1)this.uniforms.splice(Q,1);return this}setName(J){return this.name=J,this}setUsage(J){return this.usage=J,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(J){this.name=J.name,this.usage=J.usage;let Q=J.uniforms;this.uniforms.length=0;for(let $=0,Z=Q.length;$<Z;$++){let W=Array.isArray(Q[$])?Q[$]:[Q[$]];for(let K=0;K<W.length;K++)this.uniforms.push(W[K].clone())}return this}clone(){return new this.constructor().copy(this)}};gY=class gY extends b7{constructor(J,Q,$=1){super(J,Q);this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=$}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}clone(J){let Q=super.clone(J);return Q.meshPerAttribute=this.meshPerAttribute,Q}toJSON(J){let Q=super.toJSON(J);return Q.isInstancedInterleavedBuffer=!0,Q.meshPerAttribute=this.meshPerAttribute,Q}};PH=new d0;$W=class $W{static{$W.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}};SH=new r;jH=new P,Q$=new P,M7=new P,L7=new P,nW=new P,QN=new P,$N=new P;yH=new P;sY=class sY extends KJ{constructor(J,Q){super();this.light=J,this.matrixAutoUpdate=!1,this.color=Q,this.type="SpotLightHelper";let $=new c0,Z=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let K=0,Y=1,X=32;K<X;K++,Y++){let H=K/X*Math.PI*2,U=Y/X*Math.PI*2;Z.push(Math.cos(H),Math.sin(H),1,Math.cos(U),Math.sin(U),1)}$.setAttribute("position",new z0(Z,3));let W=new fJ({fog:!1,toneMapped:!1});this.cone=new E9($,W),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent)this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld);else this.matrix.copy(this.light.matrixWorld);this.matrixWorld.copy(this.light.matrixWorld);let J=this.light.distance?this.light.distance:1000,Q=J*Math.tan(this.light.angle);if(this.cone.scale.set(Q,Q,J),yH.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(yH),this.color!==void 0)this.cone.material.color.set(this.color);else this.cone.material.color.copy(this.light.color)}};K8=new P,$$=new d0,sW=new d0;iY=class iY extends E9{constructor(J){let Q=kG(J),$=new c0,Z=[],W=[];for(let H=0;H<Q.length;H++){let U=Q[H];if(U.parent&&U.parent.isBone)Z.push(0,0,0),Z.push(0,0,0),W.push(0,0,0),W.push(0,0,0)}$.setAttribute("position",new z0(Z,3)),$.setAttribute("color",new z0(W,3));let K=new fJ({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super($,K);this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=J,this.bones=Q,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1;let Y=new V0(255),X=new V0(65280);this.setColors(Y,X)}updateMatrixWorld(J){let Q=this.bones,$=this.geometry,Z=$.getAttribute("position");sW.copy(this.root.matrixWorld).invert();for(let W=0,K=0;W<Q.length;W++){let Y=Q[W];if(Y.parent&&Y.parent.isBone)$$.multiplyMatrices(sW,Y.matrixWorld),K8.setFromMatrixPosition($$),Z.setXYZ(K,K8.x,K8.y,K8.z),$$.multiplyMatrices(sW,Y.parent.matrixWorld),K8.setFromMatrixPosition($$),Z.setXYZ(K+1,K8.x,K8.y,K8.z),K+=2}$.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(J)}setColors(J,Q){let Z=this.geometry.getAttribute("color");for(let W=0;W<Z.count;W+=2)Z.setXYZ(W,J.r,J.g,J.b),Z.setXYZ(W+1,Q.r,Q.g,Q.b);return Z.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};oY=class oY extends VJ{constructor(J,Q,$){let Z=new d7(Q,4,2),W=new j9({wireframe:!0,fog:!1,toneMapped:!1});super(Z,W);this.light=J,this.color=$,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.color!==void 0)this.material.color.set(this.color);else this.material.color.copy(this.light.color)}};ZN=new P,vH=new V0,fH=new V0;aY=class aY extends KJ{constructor(J,Q,$){super();this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="HemisphereLightHelper";let Z=new m7(Q);if(Z.rotateY(Math.PI*0.5),this.material=new j9({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0)this.material.vertexColors=!0;let W=Z.getAttribute("position"),K=new Float32Array(W.count*3);Z.setAttribute("color",new UJ(K,3)),this.add(new VJ(Z,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let J=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let Q=J.geometry.getAttribute("color");vH.copy(this.light.color),fH.copy(this.light.groundColor);for(let $=0,Z=Q.count;$<Z;$++){let W=$<Z/2?vH:fH;Q.setXYZ($,W.r,W.g,W.b)}Q.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),J.lookAt(ZN.setFromMatrixPosition(this.light.matrixWorld).negate())}};rY=class rY extends E9{constructor(J=10,Q=10,$=4473924,Z=8947848){$=new V0($),Z=new V0(Z);let W=Q/2,K=J/Q,Y=J/2,X=[],H=[];for(let N=0,G=0,q=-Y;N<=Q;N++,q+=K){X.push(-Y,0,q,Y,0,q),X.push(q,0,-Y,q,0,Y);let R=N===W?$:Z;R.toArray(H,G),G+=3,R.toArray(H,G),G+=3,R.toArray(H,G),G+=3,R.toArray(H,G),G+=3}let U=new c0;U.setAttribute("position",new z0(X,3)),U.setAttribute("color",new z0(H,3));let E=new fJ({vertexColors:!0,toneMapped:!1});super(U,E);this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};tY=class tY extends E9{constructor(J=10,Q=16,$=8,Z=64,W=4473924,K=8947848){W=new V0(W),K=new V0(K);let Y=[],X=[];if(Q>1)for(let E=0;E<Q;E++){let N=E/Q*(Math.PI*2),G=Math.sin(N)*J,q=Math.cos(N)*J;Y.push(0,0,0),Y.push(G,0,q);let R=E&1?W:K;X.push(R.r,R.g,R.b),X.push(R.r,R.g,R.b)}for(let E=0;E<$;E++){let N=E&1?W:K,G=J-J/$*E;for(let q=0;q<Z;q++){let R=q/Z*(Math.PI*2),O=Math.sin(R)*G,F=Math.cos(R)*G;Y.push(O,0,F),X.push(N.r,N.g,N.b),R=(q+1)/Z*(Math.PI*2),O=Math.sin(R)*G,F=Math.cos(R)*G,Y.push(O,0,F),X.push(N.r,N.g,N.b)}}let H=new c0;H.setAttribute("position",new z0(Y,3)),H.setAttribute("color",new z0(X,3));let U=new fJ({vertexColors:!0,toneMapped:!1});super(H,U);this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};bH=new P,Z$=new P,hH=new P;eY=class eY extends KJ{constructor(J,Q,$){super();if(this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="DirectionalLightHelper",Q===void 0)Q=1;let Z=new c0;Z.setAttribute("position",new z0([-Q,Q,0,Q,Q,0,Q,-Q,0,-Q,-Q,0,-Q,Q,0],3));let W=new fJ({fog:!1,toneMapped:!1});this.lightPlane=new P9(Z,W),this.add(this.lightPlane),Z=new c0,Z.setAttribute("position",new z0([0,0,0,0,0,1],3)),this.targetLine=new P9(Z,W),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),bH.setFromMatrixPosition(this.light.matrixWorld),Z$.setFromMatrixPosition(this.light.target.matrixWorld),hH.subVectors(Z$,bH),this.lightPlane.lookAt(Z$),this.color!==void 0)this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color);else this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color);this.targetLine.lookAt(Z$),this.targetLine.scale.z=hH.length()}};W$=new P,LJ=new l7;JX=class JX extends E9{constructor(J){let Q=new c0,$=new fJ({color:16777215,vertexColors:!0,toneMapped:!1}),Z=[],W=[],K={};Y("n1","n2"),Y("n2","n4"),Y("n4","n3"),Y("n3","n1"),Y("f1","f2"),Y("f2","f4"),Y("f4","f3"),Y("f3","f1"),Y("n1","f1"),Y("n2","f2"),Y("n3","f3"),Y("n4","f4"),Y("p","n1"),Y("p","n2"),Y("p","n3"),Y("p","n4"),Y("u1","u2"),Y("u2","u3"),Y("u3","u1"),Y("c","t"),Y("p","c"),Y("cn1","cn2"),Y("cn3","cn4"),Y("cf1","cf2"),Y("cf3","cf4");function Y(q,R){X(q),X(R)}function X(q){if(Z.push(0,0,0),W.push(0,0,0),K[q]===void 0)K[q]=[];K[q].push(Z.length/3-1)}Q.setAttribute("position",new z0(Z,3)),Q.setAttribute("color",new z0(W,3));super(Q,$);if(this.type="CameraHelper",this.camera=J,this.camera.updateProjectionMatrix)this.camera.updateProjectionMatrix();this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=K,this.update();let H=new V0(16755200),U=new V0(16711680),E=new V0(43775),N=new V0(16777215),G=new V0(3355443);this.setColors(H,U,E,N,G)}setColors(J,Q,$,Z,W){let Y=this.geometry.getAttribute("color");return Y.setXYZ(0,J.r,J.g,J.b),Y.setXYZ(1,J.r,J.g,J.b),Y.setXYZ(2,J.r,J.g,J.b),Y.setXYZ(3,J.r,J.g,J.b),Y.setXYZ(4,J.r,J.g,J.b),Y.setXYZ(5,J.r,J.g,J.b),Y.setXYZ(6,J.r,J.g,J.b),Y.setXYZ(7,J.r,J.g,J.b),Y.setXYZ(8,J.r,J.g,J.b),Y.setXYZ(9,J.r,J.g,J.b),Y.setXYZ(10,J.r,J.g,J.b),Y.setXYZ(11,J.r,J.g,J.b),Y.setXYZ(12,J.r,J.g,J.b),Y.setXYZ(13,J.r,J.g,J.b),Y.setXYZ(14,J.r,J.g,J.b),Y.setXYZ(15,J.r,J.g,J.b),Y.setXYZ(16,J.r,J.g,J.b),Y.setXYZ(17,J.r,J.g,J.b),Y.setXYZ(18,J.r,J.g,J.b),Y.setXYZ(19,J.r,J.g,J.b),Y.setXYZ(20,J.r,J.g,J.b),Y.setXYZ(21,J.r,J.g,J.b),Y.setXYZ(22,J.r,J.g,J.b),Y.setXYZ(23,J.r,J.g,J.b),Y.setXYZ(24,Q.r,Q.g,Q.b),Y.setXYZ(25,Q.r,Q.g,Q.b),Y.setXYZ(26,Q.r,Q.g,Q.b),Y.setXYZ(27,Q.r,Q.g,Q.b),Y.setXYZ(28,Q.r,Q.g,Q.b),Y.setXYZ(29,Q.r,Q.g,Q.b),Y.setXYZ(30,Q.r,Q.g,Q.b),Y.setXYZ(31,Q.r,Q.g,Q.b),Y.setXYZ(32,$.r,$.g,$.b),Y.setXYZ(33,$.r,$.g,$.b),Y.setXYZ(34,$.r,$.g,$.b),Y.setXYZ(35,$.r,$.g,$.b),Y.setXYZ(36,$.r,$.g,$.b),Y.setXYZ(37,$.r,$.g,$.b),Y.setXYZ(38,Z.r,Z.g,Z.b),Y.setXYZ(39,Z.r,Z.g,Z.b),Y.setXYZ(40,W.r,W.g,W.b),Y.setXYZ(41,W.r,W.g,W.b),Y.setXYZ(42,W.r,W.g,W.b),Y.setXYZ(43,W.r,W.g,W.b),Y.setXYZ(44,W.r,W.g,W.b),Y.setXYZ(45,W.r,W.g,W.b),Y.setXYZ(46,W.r,W.g,W.b),Y.setXYZ(47,W.r,W.g,W.b),Y.setXYZ(48,W.r,W.g,W.b),Y.setXYZ(49,W.r,W.g,W.b),Y.needsUpdate=!0,this}update(){let J=this.geometry,Q=this.pointMap,$=1,Z=1,W,K;if(LJ.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)W=1,K=0;else if(this.camera.coordinateSystem===2000)W=-1,K=1;else if(this.camera.coordinateSystem===2001)W=0,K=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);IJ("c",Q,J,LJ,0,0,W),IJ("t",Q,J,LJ,0,0,K),IJ("n1",Q,J,LJ,-1,-1,W),IJ("n2",Q,J,LJ,1,-1,W),IJ("n3",Q,J,LJ,-1,1,W),IJ("n4",Q,J,LJ,1,1,W),IJ("f1",Q,J,LJ,-1,-1,K),IJ("f2",Q,J,LJ,1,-1,K),IJ("f3",Q,J,LJ,-1,1,K),IJ("f4",Q,J,LJ,1,1,K),IJ("u1",Q,J,LJ,0.7,1.1,W),IJ("u2",Q,J,LJ,-0.7,1.1,W),IJ("u3",Q,J,LJ,0,2,W),IJ("cf1",Q,J,LJ,-1,0,K),IJ("cf2",Q,J,LJ,1,0,K),IJ("cf3",Q,J,LJ,0,-1,K),IJ("cf4",Q,J,LJ,0,1,K),IJ("cn1",Q,J,LJ,-1,0,W),IJ("cn2",Q,J,LJ,1,0,W),IJ("cn3",Q,J,LJ,0,-1,W),IJ("cn4",Q,J,LJ,0,1,W),J.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};K$=new jJ;QX=class QX extends E9{constructor(J,Q=16776960){let $=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Z=new Float32Array(24),W=new c0;W.setIndex(new UJ($,1)),W.setAttribute("position",new UJ(Z,3));super(W,new fJ({color:Q,toneMapped:!1}));this.object=J,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0)K$.setFromObject(this.object);if(K$.isEmpty())return;let{min:J,max:Q}=K$,$=this.geometry.attributes.position,Z=$.array;Z[0]=Q.x,Z[1]=Q.y,Z[2]=Q.z,Z[3]=J.x,Z[4]=Q.y,Z[5]=Q.z,Z[6]=J.x,Z[7]=J.y,Z[8]=Q.z,Z[9]=Q.x,Z[10]=J.y,Z[11]=Q.z,Z[12]=Q.x,Z[13]=Q.y,Z[14]=J.z,Z[15]=J.x,Z[16]=Q.y,Z[17]=J.z,Z[18]=J.x,Z[19]=J.y,Z[20]=J.z,Z[21]=Q.x,Z[22]=J.y,Z[23]=J.z,$.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(J){return this.object=J,this.update(),this}copy(J,Q){return super.copy(J,Q),this.object=J.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}};$X=class $X extends E9{constructor(J,Q=16776960){let $=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Z=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],W=new c0;W.setIndex(new UJ($,1)),W.setAttribute("position",new z0(Z,3));super(W,new fJ({color:Q,toneMapped:!1}));this.box=J,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(J){let Q=this.box;if(Q.isEmpty())return;Q.getCenter(this.position),Q.getSize(this.scale),this.scale.multiplyScalar(0.5),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose()}};ZX=class ZX extends P9{constructor(J,Q=1,$=16776960){let Z=$,W=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],K=new c0;K.setAttribute("position",new z0(W,3)),K.computeBoundingSphere();super(K,new fJ({color:Z,toneMapped:!1}));this.type="PlaneHelper",this.plane=J,this.size=Q;let Y=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],X=new c0;X.setAttribute("position",new z0(Y,3)),X.computeBoundingSphere(),this.add(new VJ(X,new j9({color:Z,opacity:0.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(J){this.position.set(0,0,0),this.scale.set(0.5*this.size,0.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}};xH=new P;WX=class WX extends KJ{constructor(J=new P(0,0,1),Q=new P(0,0,0),$=1,Z=16776960,W=$*0.2,K=W*0.2){super();if(this.type="ArrowHelper",Y$===void 0)Y$=new c0,Y$.setAttribute("position",new z0([0,0,0,0,1,0],3)),iW=new g7(0.5,1,5,1),iW.translate(0,-0.5,0);this.position.copy(Q),this.line=new P9(Y$,new fJ({color:Z,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new VJ(iW,new j9({color:Z,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(J),this.setLength($,W,K)}setDirection(J){if(J.y>0.99999)this.quaternion.set(0,0,0,1);else if(J.y<-0.99999)this.quaternion.set(1,0,0,0);else{xH.set(J.z,0,-J.x).normalize();let Q=Math.acos(J.y);this.quaternion.setFromAxisAngle(xH,Q)}}setLength(J,Q=J*0.2,$=Q*0.2){this.line.scale.set(1,Math.max(0.0001,J-Q),1),this.line.updateMatrix(),this.cone.scale.set($,Q,$),this.cone.position.y=J,this.cone.updateMatrix()}setColor(J){this.line.material.color.set(J),this.cone.material.color.set(J)}copy(J){return super.copy(J,!1),this.line.copy(J.line),this.cone.copy(J.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}};KX=class KX extends E9{constructor(J=1){let Q=[0,0,0,J,0,0,0,0,0,0,J,0,0,0,0,0,0,J],$=[1,0,0,1,0.6,0,0,1,0,0.6,1,0,0,0,1,0,0.6,1],Z=new c0;Z.setAttribute("position",new z0(Q,3)),Z.setAttribute("color",new z0($,3));let W=new fJ({vertexColors:!0,toneMapped:!1});super(Z,W);this.type="AxesHelper"}setColors(J,Q,$){let Z=new V0,W=this.geometry.attributes.color.array;return Z.set(J),Z.toArray(W,0),Z.toArray(W,3),Z.set(Q),Z.toArray(W,6),Z.toArray(W,9),Z.set($),Z.toArray(W,12),Z.toArray(W,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};XX=class XX extends Z9{constructor(J,Q=null){super();this.object=J,this.domElement=Q,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(J){if(J===void 0){H0("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=J}disconnect(){}dispose(){}update(){}};if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));if(typeof window<"u")if(window.__THREE__)H0("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="184"});var DQ={};D5(DQ,{warnOnce:()=>U6,warn:()=>H0,setConsoleFunction:()=>tU,log:()=>I7,getConsoleFunction:()=>eU,error:()=>T0,createCanvasElement:()=>tK,ZeroStencilOp:()=>LU,ZeroSlopeEnding:()=>YU,ZeroFactor:()=>UK,ZeroCurvatureEnding:()=>KU,WrapAroundEnding:()=>XU,WireframeGeometry:()=>AZ,WebXRController:()=>f7,WebGPUCoordinateSystem:()=>nU,WebGLUtils:()=>tG,WebGLRenderer:()=>$5,WebGLRenderTarget:()=>sJ,WebGLCubeRenderTarget:()=>HW,WebGLCoordinateSystem:()=>HZ,WebGLArrayRenderTarget:()=>JY,WebGL3DRenderTarget:()=>QY,VideoTexture:()=>kZ,VideoFrameTexture:()=>UY,VectorKeyframeTrack:()=>g8,Vector4:()=>GJ,Vector3:()=>P,Vector2:()=>r,VSMShadowMap:()=>d8,UnsignedShortType:()=>S7,UnsignedShort5551Type:()=>I$,UnsignedShort4444Type:()=>z$,UnsignedIntType:()=>c9,UnsignedInt5999Type:()=>gK,UnsignedInt248Type:()=>n8,UnsignedInt101111Type:()=>pK,UnsignedByteType:()=>G9,UniformsUtils:()=>OY,UniformsLib:()=>D0,UniformsGroup:()=>xY,Uniform:()=>QW,Uint8ClampedBufferAttribute:()=>KY,Uint8BufferAttribute:()=>WY,Uint32BufferAttribute:()=>T6,Uint16BufferAttribute:()=>P6,UVMapping:()=>nH,TubeGeometry:()=>e6,TrianglesDrawMode:()=>GU,TriangleStripDrawMode:()=>EU,TriangleFanDrawMode:()=>NU,Triangle:()=>uJ,TorusKnotGeometry:()=>t6,TorusGeometry:()=>r6,TimestampQuery:()=>sU,Timer:()=>rZ,TextureUtils:()=>HX,TextureLoader:()=>_Y,Texture:()=>OJ,TetrahedronGeometry:()=>a6,TangentSpaceNormalMap:()=>WZ,TOUCH:()=>pH,SubtractiveBlending:()=>N$,SubtractEquation:()=>KK,StringKeyframeTrack:()=>o9,StreamReadUsage:()=>mU,StreamDrawUsage:()=>xU,StreamCopyUsage:()=>uU,StereoCamera:()=>PY,StaticReadUsage:()=>gU,StaticDrawUsage:()=>bU,StaticCopyUsage:()=>dU,SrcColorFactor:()=>EK,SrcAlphaSaturateFactor:()=>MK,SrcAlphaFactor:()=>qK,SpriteMaterial:()=>S6,Sprite:()=>EZ,SpotLightHelper:()=>sY,SpotLight:()=>mZ,SplineCurve:()=>u6,SphericalHarmonics3:()=>XQ,Spherical:()=>lY,SphereGeometry:()=>d7,Sphere:()=>wJ,Source:()=>w9,SkinnedMesh:()=>qZ,SkeletonHelper:()=>iY,Skeleton:()=>y6,ShortType:()=>xK,ShapeUtils:()=>X9,ShapePath:()=>YX,ShapeGeometry:()=>o6,Shape:()=>l9,ShadowMaterial:()=>CZ,ShaderMaterial:()=>aJ,ShaderLib:()=>V9,ShaderChunk:()=>r0,Scene:()=>GZ,SRGBTransfer:()=>qJ,SRGBColorSpace:()=>cK,SIGNED_RG11_EAC_Format:()=>h$,SIGNED_RED_RGTC1_Format:()=>$Z,SIGNED_RED_GREEN_RGTC2_Format:()=>ZZ,SIGNED_R11_EAC_Format:()=>b$,RingGeometry:()=>i6,ReverseSubtractEquation:()=>YK,ReplaceStencilOp:()=>BU,RepeatWrapping:()=>vK,RenderTarget3D:()=>hY,RenderTarget:()=>A6,ReinhardToneMapping:()=>R$,RedIntegerFormat:()=>_$,RedFormat:()=>lK,RectAreaLight:()=>cZ,Raycaster:()=>mY,Ray:()=>R8,RawShaderMaterial:()=>JQ,RGIntegerFormat:()=>A$,RGFormat:()=>D8,RGDepthPacking:()=>RU,RGB_S3TC_DXT1_Format:()=>k6,RGB_PVRTC_4BPPV1_Format:()=>w$,RGB_PVRTC_2BPPV1_Format:()=>P$,RGB_ETC2_Format:()=>y$,RGB_ETC1_Format:()=>j$,RGB_BPTC_UNSIGNED_Format:()=>JZ,RGB_BPTC_SIGNED_Format:()=>e$,RGBIntegerFormat:()=>rH,RGBFormat:()=>dK,RGBDepthPacking:()=>FU,RGBA_S3TC_DXT5_Format:()=>V6,RGBA_S3TC_DXT3_Format:()=>L6,RGBA_S3TC_DXT1_Format:()=>M6,RGBA_PVRTC_4BPPV1_Format:()=>T$,RGBA_PVRTC_2BPPV1_Format:()=>S$,RGBA_ETC2_EAC_Format:()=>v$,RGBA_BPTC_Format:()=>t$,RGBA_ASTC_8x8_Format:()=>c$,RGBA_ASTC_8x6_Format:()=>u$,RGBA_ASTC_8x5_Format:()=>l$,RGBA_ASTC_6x6_Format:()=>d$,RGBA_ASTC_6x5_Format:()=>m$,RGBA_ASTC_5x5_Format:()=>p$,RGBA_ASTC_5x4_Format:()=>g$,RGBA_ASTC_4x4_Format:()=>x$,RGBA_ASTC_12x12_Format:()=>r$,RGBA_ASTC_12x10_Format:()=>a$,RGBA_ASTC_10x8_Format:()=>i$,RGBA_ASTC_10x6_Format:()=>s$,RGBA_ASTC_10x5_Format:()=>n$,RGBA_ASTC_10x10_Format:()=>o$,RGBAIntegerFormat:()=>C$,RGBAFormat:()=>L9,RGBADepthPacking:()=>DU,RG11_EAC_Format:()=>B6,REVISION:()=>JK,RED_RGTC1_Format:()=>QZ,RED_GREEN_RGTC2_Format:()=>z6,R11_EAC_Format:()=>f$,QuaternionLinearInterpolant:()=>xZ,QuaternionKeyframeTrack:()=>a8,Quaternion:()=>vJ,QuadraticBezierCurve3:()=>l6,QuadraticBezierCurve:()=>d6,PropertyMixer:()=>eZ,PropertyBinding:()=>WJ,PositionalAudio:()=>SY,PolyhedronGeometry:()=>s9,PolarGridHelper:()=>tY,PointsMaterial:()=>f6,Points:()=>OZ,PointLightHelper:()=>oY,PointLight:()=>dZ,PlaneHelper:()=>ZX,PlaneGeometry:()=>i8,Plane:()=>C9,PerspectiveCamera:()=>CJ,Path:()=>_7,PMREMGenerator:()=>YW,PCFSoftShadowMap:()=>ZK,PCFShadowMap:()=>C7,OrthographicCamera:()=>r8,OneMinusSrcColorFactor:()=>NK,OneMinusSrcAlphaFactor:()=>DK,OneMinusDstColorFactor:()=>kK,OneMinusDstAlphaFactor:()=>RK,OneMinusConstantColorFactor:()=>VK,OneMinusConstantAlphaFactor:()=>zK,OneFactor:()=>GK,OctahedronGeometry:()=>m7,ObjectSpaceNormalMap:()=>uK,ObjectLoader:()=>AY,Object3D:()=>KJ,NumberKeyframeTrack:()=>x8,NotEqualStencilFunc:()=>yU,NotEqualDepth:()=>TK,NotEqualCompare:()=>aK,NormalRGPacking:()=>kU,NormalGAPacking:()=>MU,NormalBlending:()=>w7,NormalAnimationBlendMode:()=>HU,NoToneMapping:()=>U9,NoNormalPacking:()=>OU,NoColorSpace:()=>F8,NoBlending:()=>M9,NeverStencilFunc:()=>wU,NeverDepth:()=>IK,NeverCompare:()=>nK,NeutralToneMapping:()=>V$,NearestMipmapNearestFilter:()=>bK,NearestMipmapLinearFilter:()=>T7,NearestMipMapNearestFilter:()=>sH,NearestMipMapLinearFilter:()=>iH,NearestFilter:()=>u9,MultiplyOperation:()=>SK,MultiplyBlending:()=>q$,MixOperation:()=>jK,MirroredRepeatWrapping:()=>fK,MinEquation:()=>XK,MeshToonMaterial:()=>TZ,MeshStandardMaterial:()=>QQ,MeshPhysicalMaterial:()=>wZ,MeshPhongMaterial:()=>PZ,MeshNormalMaterial:()=>SZ,MeshMatcapMaterial:()=>yZ,MeshLambertMaterial:()=>jZ,MeshDistanceMaterial:()=>ZQ,MeshDepthMaterial:()=>$Q,MeshBasicMaterial:()=>j9,Mesh:()=>VJ,MaxEquation:()=>HK,Matrix4:()=>d0,Matrix3:()=>u0,Matrix2:()=>$W,MathUtils:()=>ZG,MaterialLoader:()=>HQ,MaterialBlending:()=>lH,Material:()=>yJ,MOUSE:()=>gH,LoopRepeat:()=>eH,LoopPingPong:()=>JU,LoopOnce:()=>tH,LoadingManager:()=>YQ,LoaderUtils:()=>q6,Loader:()=>mJ,LinearTransfer:()=>YZ,LinearToneMapping:()=>F$,LinearSRGBColorSpace:()=>KZ,LinearMipmapNearestFilter:()=>O6,LinearMipmapLinearFilter:()=>E8,LinearMipMapNearestFilter:()=>oH,LinearMipMapLinearFilter:()=>aH,LinearInterpolant:()=>WQ,LinearFilter:()=>nJ,LineSegments:()=>E9,LineLoop:()=>RZ,LineDashedMaterial:()=>vZ,LineCurve3:()=>IZ,LineCurve:()=>m6,LineBasicMaterial:()=>fJ,Line3:()=>nY,Line:()=>P9,LightProbe:()=>nZ,Light:()=>y9,LessStencilFunc:()=>PU,LessEqualStencilFunc:()=>SU,LessEqualDepth:()=>D$,LessEqualCompare:()=>I6,LessDepth:()=>AK,LessCompare:()=>sK,Layers:()=>v7,LatheGeometry:()=>s6,LOD:()=>NZ,KeyframeTrack:()=>rJ,KeepStencilOp:()=>VU,InvertStencilOp:()=>CU,InterpolationSamplingType:()=>iU,InterpolationSamplingMode:()=>oU,InterpolateSmooth:()=>ZU,InterpolateLinear:()=>$U,InterpolateDiscrete:()=>QU,InterpolateBezier:()=>WU,Interpolant:()=>M8,InterleavedBufferAttribute:()=>H8,InterleavedBuffer:()=>b7,IntType:()=>B$,Int8BufferAttribute:()=>ZY,Int32BufferAttribute:()=>XY,Int16BufferAttribute:()=>YY,InstancedMesh:()=>DZ,InstancedInterleavedBuffer:()=>gY,InstancedBufferGeometry:()=>sZ,InstancedBufferAttribute:()=>U8,IncrementWrapStencilOp:()=>_U,IncrementStencilOp:()=>zU,ImageUtils:()=>UZ,ImageLoader:()=>m8,ImageBitmapLoader:()=>CY,IcosahedronGeometry:()=>n6,HemisphereLightHelper:()=>aY,HemisphereLight:()=>gZ,HalfFloatType:()=>S9,HTMLTexture:()=>DY,Group:()=>Y8,GridHelper:()=>rY,GreaterStencilFunc:()=>jU,GreaterEqualStencilFunc:()=>vU,GreaterEqualDepth:()=>wK,GreaterEqualCompare:()=>_6,GreaterDepth:()=>PK,GreaterCompare:()=>oK,GLSL3:()=>XZ,GLSL1:()=>cU,GLBufferAttribute:()=>pY,FrustumArray:()=>v6,Frustum:()=>O8,FrontSide:()=>l8,FramebufferTexture:()=>GY,FogExp2:()=>C6,Fog:()=>w6,FloatType:()=>T9,Float32BufferAttribute:()=>z0,Float16BufferAttribute:()=>HY,FileLoader:()=>O9,ExtrudeGeometry:()=>c6,ExternalTexture:()=>b6,EventDispatcher:()=>Z9,Euler:()=>H9,EquirectangularRefractionMapping:()=>F6,EquirectangularReflectionMapping:()=>D6,EqualStencilFunc:()=>TU,EqualDepth:()=>CK,EqualCompare:()=>iK,EllipseCurve:()=>p7,EdgesGeometry:()=>LZ,DynamicReadUsage:()=>pU,DynamicDrawUsage:()=>hU,DynamicCopyUsage:()=>lU,DstColorFactor:()=>OK,DstAlphaFactor:()=>FK,DoubleSide:()=>k9,DodecahedronGeometry:()=>g6,DiscreteInterpolant:()=>bZ,DirectionalLightHelper:()=>eY,DirectionalLight:()=>lZ,DetachedBindMode:()=>cH,DepthTexture:()=>n9,DepthStencilFormat:()=>q8,DepthFormat:()=>N8,DefaultLoadingManager:()=>LY,DecrementWrapStencilOp:()=>AU,DecrementStencilOp:()=>IU,DataUtils:()=>$Y,DataTextureLoader:()=>IY,DataTexture:()=>$9,DataArrayTexture:()=>j7,Data3DTexture:()=>y7,Cylindrical:()=>uY,CylinderGeometry:()=>x7,CustomToneMapping:()=>M$,CustomBlending:()=>WK,CurvePath:()=>_Z,Curve:()=>W9,CullFaceNone:()=>QK,CullFaceFrontBack:()=>mH,CullFaceFront:()=>$K,CullFaceBack:()=>G$,CubicInterpolant:()=>fZ,CubicBezierCurve3:()=>zZ,CubicBezierCurve:()=>p6,CubeUVReflectionMapping:()=>P7,CubeTextureLoader:()=>zY,CubeTexture:()=>s8,CubeRefractionMapping:()=>G8,CubeReflectionMapping:()=>c8,CubeDepthTexture:()=>MZ,CubeCamera:()=>oZ,Controls:()=>XX,ConstantColorFactor:()=>LK,ConstantAlphaFactor:()=>BK,ConeGeometry:()=>g7,CompressedTextureLoader:()=>BY,CompressedTexture:()=>h7,CompressedCubeTexture:()=>NY,CompressedArrayTexture:()=>EY,Compatibility:()=>aU,ColorManagement:()=>$J,ColorKeyframeTrack:()=>KQ,Color:()=>V0,Clock:()=>dY,ClampToEdgeWrapping:()=>R6,CircleGeometry:()=>x6,CineonToneMapping:()=>O$,CatmullRomCurve3:()=>BZ,CapsuleGeometry:()=>h6,CanvasTexture:()=>qY,CameraHelper:()=>JX,Camera:()=>l7,Cache:()=>R9,ByteType:()=>hK,BufferGeometryLoader:()=>iZ,BufferGeometry:()=>c0,BufferAttribute:()=>UJ,BoxHelper:()=>QX,BoxGeometry:()=>k8,Box3Helper:()=>$X,Box3:()=>jJ,Box2:()=>cY,BooleanKeyframeTrack:()=>i9,Bone:()=>j6,BezierInterpolant:()=>hZ,BatchedMesh:()=>FZ,BasicShadowMap:()=>dH,BasicDepthPacking:()=>qU,BackSide:()=>cJ,AxesHelper:()=>KX,AudioLoader:()=>wY,AudioListener:()=>TY,AudioContext:()=>UQ,AudioAnalyser:()=>jY,Audio:()=>tZ,AttachedBindMode:()=>uH,ArrowHelper:()=>WX,ArrayCamera:()=>aZ,ArcCurve:()=>VZ,AnimationUtils:()=>MY,AnimationObjectGroup:()=>fY,AnimationMixer:()=>bY,AnimationLoader:()=>VY,AnimationClip:()=>p8,AnimationAction:()=>JW,AmbientLight:()=>uZ,AlwaysStencilFunc:()=>fU,AlwaysDepth:()=>_K,AlwaysCompare:()=>rK,AlphaFormat:()=>mK,AgXToneMapping:()=>L$,AdditiveBlending:()=>E$,AdditiveAnimationBlendMode:()=>UU,AddOperation:()=>yK,AddEquation:()=>u8,ACESFilmicToneMapping:()=>k$});function mG(){let J=null,Q=!1,$=null,Z=null;function W(K,Y){$(K,Y),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(K){$=K},setContext:function(K){J=K}}}function HN(J){let Q=new WeakMap;function $(X,H){let{array:U,usage:E}=X,N=U.byteLength,G=J.createBuffer();J.bindBuffer(H,G),J.bufferData(H,U,E),X.onUploadCallback();let q;if(U instanceof Float32Array)q=J.FLOAT;else if(typeof Float16Array<"u"&&U instanceof Float16Array)q=J.HALF_FLOAT;else if(U instanceof Uint16Array)if(X.isFloat16BufferAttribute)q=J.HALF_FLOAT;else q=J.UNSIGNED_SHORT;else if(U instanceof Int16Array)q=J.SHORT;else if(U instanceof Uint32Array)q=J.UNSIGNED_INT;else if(U instanceof Int32Array)q=J.INT;else if(U instanceof Int8Array)q=J.BYTE;else if(U instanceof Uint8Array)q=J.UNSIGNED_BYTE;else if(U instanceof Uint8ClampedArray)q=J.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+U);return{buffer:G,type:q,bytesPerElement:U.BYTES_PER_ELEMENT,version:X.version,size:N}}function Z(X,H,U){let{array:E,updateRanges:N}=H;if(J.bindBuffer(U,X),N.length===0)J.bufferSubData(U,0,E);else{N.sort((q,R)=>q.start-R.start);let G=0;for(let q=1;q<N.length;q++){let R=N[G],O=N[q];if(O.start<=R.start+R.count+1)R.count=Math.max(R.count,O.start+O.count-R.start);else++G,N[G]=O}N.length=G+1;for(let q=0,R=N.length;q<R;q++){let O=N[q];J.bufferSubData(U,O.start*E.BYTES_PER_ELEMENT,E,O.start,O.count)}H.clearUpdateRanges()}H.onUploadCallback()}function W(X){if(X.isInterleavedBufferAttribute)X=X.data;return Q.get(X)}function K(X){if(X.isInterleavedBufferAttribute)X=X.data;let H=Q.get(X);if(H)J.deleteBuffer(H.buffer),Q.delete(X)}function Y(X,H){if(X.isInterleavedBufferAttribute)X=X.data;if(X.isGLBufferAttribute){let E=Q.get(X);if(!E||E.version<X.version)Q.set(X,{buffer:X.buffer,type:X.type,bytesPerElement:X.elementSize,version:X.version});return}let U=Q.get(X);if(U===void 0)Q.set(X,$(X,H));else if(U.version<X.version){if(U.size!==X.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,X,H),U.version=X.version}}return{get:W,remove:K,update:Y}}function uD(J,Q,$,Z,W,K){let Y=new V0(0),X=W===!0?0:1,H,U,E=null,N=0,G=null;function q(k){let M=k.isScene===!0?k.background:null;if(M&&M.isTexture){let V=k.backgroundBlurriness>0;M=Q.get(M,V)}return M}function R(k){let M=!1,V=q(k);if(V===null)F(Y,X);else if(V&&V.isColor)F(V,1),M=!0;let _=J.xr.getEnvironmentBlendMode();if(_==="additive")$.buffers.color.setClear(0,0,0,1,K);else if(_==="alpha-blend")$.buffers.color.setClear(0,0,0,0,K);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 O(k,M){let V=q(M);if(V&&(V.isCubeTexture||V.mapping===P7)){if(U===void 0)U=new VJ(new k8(1,1,1),new aJ({name:"BackgroundCubeMaterial",uniforms:o8(V9.backgroundCube.uniforms),vertexShader:V9.backgroundCube.vertexShader,fragmentShader:V9.backgroundCube.fragmentShader,side:cJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(_,A,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(U.material.uniforms.envMap.value=V,U.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(lD.makeRotationFromEuler(M.backgroundRotation)).transpose(),V.isCubeTexture&&V.isRenderTargetTexture===!1)U.material.uniforms.backgroundRotation.value.premultiply(dG);if(U.material.toneMapped=$J.getTransfer(V.colorSpace)!==qJ,E!==V||N!==V.version||G!==J.toneMapping)U.material.needsUpdate=!0,E=V,N=V.version,G=J.toneMapping;U.layers.enableAll(),k.unshift(U,U.geometry,U.material,0,0,null)}else if(V&&V.isTexture){if(H===void 0)H=new VJ(new i8(2,2),new aJ({name:"BackgroundMaterial",uniforms:o8(V9.background.uniforms),vertexShader:V9.background.vertexShader,fragmentShader:V9.background.fragmentShader,side:l8,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),H.geometry.deleteAttribute("normal"),Object.defineProperty(H.material,"map",{get:function(){return this.uniforms.t2D.value}}),Z.update(H);if(H.material.uniforms.t2D.value=V,H.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,H.material.toneMapped=$J.getTransfer(V.colorSpace)!==qJ,V.matrixAutoUpdate===!0)V.updateMatrix();if(H.material.uniforms.uvTransform.value.copy(V.matrix),E!==V||N!==V.version||G!==J.toneMapping)H.material.needsUpdate=!0,E=V,N=V.version,G=J.toneMapping;H.layers.enableAll(),k.unshift(H,H.geometry,H.material,0,0,null)}}function F(k,M){k.getRGB(WW,RY(J)),$.buffers.color.setClear(WW.r,WW.g,WW.b,M,K)}function D(){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 Y},setClearColor:function(k,M=1){Y.set(k),X=M,F(Y,X)},getClearAlpha:function(){return X},setClearAlpha:function(k){X=k,F(Y,X)},render:R,addToRenderList:O,dispose:D}}function cD(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=G(null),K=W,Y=!1;function X(T,g,u,y,l){let h=!1,m=N(T,y,u,g);if(K!==m)K=m,U(K.object);if(h=q(T,y,u,l),h)R(T,y,u,l);if(l!==null)Q.update(l,J.ELEMENT_ARRAY_BUFFER);if(h||Y){if(Y=!1,V(T,g,u,y),l!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(l).buffer)}}function H(){return J.createVertexArray()}function U(T){return J.bindVertexArray(T)}function E(T){return J.deleteVertexArray(T)}function N(T,g,u,y){let l=y.wireframe===!0,h=Z[g.id];if(h===void 0)h={},Z[g.id]=h;let m=T.isInstancedMesh===!0?T.id:0,a=h[m];if(a===void 0)a={},h[m]=a;let W0=a[u.id];if(W0===void 0)W0={},a[u.id]=W0;let N0=W0[l];if(N0===void 0)N0=G(H()),W0[l]=N0;return N0}function G(T){let g=[],u=[],y=[];for(let l=0;l<$;l++)g[l]=0,u[l]=0,y[l]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:g,enabledAttributes:u,attributeDivisors:y,object:T,attributes:{},index:null}}function q(T,g,u,y){let l=K.attributes,h=g.attributes,m=0,a=u.getAttributes();for(let W0 in a)if(a[W0].location>=0){let j0=l[W0],B0=h[W0];if(B0===void 0){if(W0==="instanceMatrix"&&T.instanceMatrix)B0=T.instanceMatrix;if(W0==="instanceColor"&&T.instanceColor)B0=T.instanceColor}if(j0===void 0)return!0;if(j0.attribute!==B0)return!0;if(B0&&j0.data!==B0.data)return!0;m++}if(K.attributesNum!==m)return!0;if(K.index!==y)return!0;return!1}function R(T,g,u,y){let l={},h=g.attributes,m=0,a=u.getAttributes();for(let W0 in a)if(a[W0].location>=0){let j0=h[W0];if(j0===void 0){if(W0==="instanceMatrix"&&T.instanceMatrix)j0=T.instanceMatrix;if(W0==="instanceColor"&&T.instanceColor)j0=T.instanceColor}let B0={};if(B0.attribute=j0,j0&&j0.data)B0.data=j0.data;l[W0]=B0,m++}K.attributes=l,K.attributesNum=m,K.index=y}function O(){let T=K.newAttributes;for(let g=0,u=T.length;g<u;g++)T[g]=0}function F(T){D(T,0)}function D(T,g){let{newAttributes:u,enabledAttributes:y,attributeDivisors:l}=K;if(u[T]=1,y[T]===0)J.enableVertexAttribArray(T),y[T]=1;if(l[T]!==g)J.vertexAttribDivisor(T,g),l[T]=g}function k(){let{newAttributes:T,enabledAttributes:g}=K;for(let u=0,y=g.length;u<y;u++)if(g[u]!==T[u])J.disableVertexAttribArray(u),g[u]=0}function M(T,g,u,y,l,h,m){if(m===!0)J.vertexAttribIPointer(T,g,u,l,h);else J.vertexAttribPointer(T,g,u,y,l,h)}function V(T,g,u,y){O();let l=y.attributes,h=u.getAttributes(),m=g.defaultAttributeValues;for(let a in h){let W0=h[a];if(W0.location>=0){let N0=l[a];if(N0===void 0){if(a==="instanceMatrix"&&T.instanceMatrix)N0=T.instanceMatrix;if(a==="instanceColor"&&T.instanceColor)N0=T.instanceColor}if(N0!==void 0){let{normalized:j0,itemSize:B0}=N0,ZJ=Q.get(N0);if(ZJ===void 0)continue;let{buffer:t0,type:s,bytesPerElement:R0}=ZJ,P0=s===J.INT||s===J.UNSIGNED_INT||N0.gpuType===B$;if(N0.isInterleavedBufferAttribute){let G0=N0.data,b0=G0.stride,YJ=N0.offset;if(G0.isInstancedInterleavedBuffer){for(let p0=0;p0<W0.locationSize;p0++)D(W0.location+p0,G0.meshPerAttribute);if(T.isInstancedMesh!==!0&&y._maxInstanceCount===void 0)y._maxInstanceCount=G0.meshPerAttribute*G0.count}else for(let p0=0;p0<W0.locationSize;p0++)F(W0.location+p0);J.bindBuffer(J.ARRAY_BUFFER,t0);for(let p0=0;p0<W0.locationSize;p0++)M(W0.location+p0,B0/W0.locationSize,s,j0,b0*R0,(YJ+B0/W0.locationSize*p0)*R0,P0)}else{if(N0.isInstancedBufferAttribute){for(let G0=0;G0<W0.locationSize;G0++)D(W0.location+G0,N0.meshPerAttribute);if(T.isInstancedMesh!==!0&&y._maxInstanceCount===void 0)y._maxInstanceCount=N0.meshPerAttribute*N0.count}else for(let G0=0;G0<W0.locationSize;G0++)F(W0.location+G0);J.bindBuffer(J.ARRAY_BUFFER,t0);for(let G0=0;G0<W0.locationSize;G0++)M(W0.location+G0,B0/W0.locationSize,s,j0,B0*R0,B0/W0.locationSize*G0*R0,P0)}}else if(m!==void 0){let j0=m[a];if(j0!==void 0)switch(j0.length){case 2:J.vertexAttrib2fv(W0.location,j0);break;case 3:J.vertexAttrib3fv(W0.location,j0);break;case 4:J.vertexAttrib4fv(W0.location,j0);break;default:J.vertexAttrib1fv(W0.location,j0)}}}}k()}function _(){I();for(let T in Z){let g=Z[T];for(let u in g){let y=g[u];for(let l in y){let h=y[l];for(let m in h)E(h[m].object),delete h[m];delete y[l]}}delete Z[T]}}function A(T){if(Z[T.id]===void 0)return;let g=Z[T.id];for(let u in g){let y=g[u];for(let l in y){let h=y[l];for(let m in h)E(h[m].object),delete h[m];delete y[l]}}delete Z[T.id]}function C(T){for(let g in Z){let u=Z[g];for(let y in u){let l=u[y];if(l[T.id]===void 0)continue;let h=l[T.id];for(let m in h)E(h[m].object),delete h[m];delete l[T.id]}}}function L(T){for(let g in Z){let u=Z[g],y=T.isInstancedMesh===!0?T.id:0,l=u[y];if(l===void 0)continue;for(let h in l){let m=l[h];for(let a in m)E(m[a].object),delete m[a];delete l[h]}if(delete u[y],Object.keys(u).length===0)delete Z[g]}}function I(){if(b(),Y=!0,K===W)return;K=W,U(K.object)}function b(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:X,reset:I,resetDefaultState:b,dispose:_,releaseStatesOfGeometry:A,releaseStatesOfObject:L,releaseStatesOfProgram:C,initAttributes:O,enableAttribute:F,disableUnusedAttributes:k}}function nD(J,Q,$){let Z;function W(H){Z=H}function K(H,U){J.drawArrays(Z,H,U),$.update(U,Z,1)}function Y(H,U,E){if(E===0)return;J.drawArraysInstanced(Z,H,U,E),$.update(U,Z,E)}function X(H,U,E){if(E===0)return;Q.get("WEBGL_multi_draw").multiDrawArraysWEBGL(Z,H,0,U,0,E);let G=0;for(let q=0;q<E;q++)G+=U[q];$.update(G,Z,1)}this.setMode=W,this.render=K,this.renderInstances=Y,this.renderMultiDraw=X}function sD(J,Q,$,Z){let W;function K(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let C=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function Y(C){if(C!==L9&&Z.convert(C)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function X(C){let L=C===S9&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(C!==G9&&Z.convert(C)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==T9&&!L)return!1;return!0}function H(C){if(C==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";C="mediump"}if(C==="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",E=H(U);if(E!==U)H0("WebGLRenderer:",U,"not supported, using",E,"instead."),U=E;let N=$.logarithmicDepthBuffer===!0,G=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control");if($.reversedDepthBuffer===!0&&G===!1)H0("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let q=J.getParameter(J.MAX_TEXTURE_IMAGE_UNITS),R=J.getParameter(J.MAX_VERTEX_TEXTURE_IMAGE_UNITS),O=J.getParameter(J.MAX_TEXTURE_SIZE),F=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),D=J.getParameter(J.MAX_VERTEX_ATTRIBS),k=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),M=J.getParameter(J.MAX_VARYING_VECTORS),V=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),_=J.getParameter(J.MAX_SAMPLES),A=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:K,getMaxPrecision:H,textureFormatReadable:Y,textureTypeReadable:X,precision:U,logarithmicDepthBuffer:N,reversedDepthBuffer:G,maxTextures:q,maxVertexTextures:R,maxTextureSize:O,maxCubemapSize:F,maxAttributes:D,maxVertexUniforms:k,maxVaryings:M,maxFragmentUniforms:V,maxSamples:_,samples:A}}function iD(J){let Q=this,$=null,Z=0,W=!1,K=!1,Y=new C9,X=new u0,H={value:null,needsUpdate:!1};this.uniform=H,this.numPlanes=0,this.numIntersection=0,this.init=function(N,G){let q=N.length!==0||G||Z!==0||W;return W=G,Z=N.length,q},this.beginShadows=function(){K=!0,E(null)},this.endShadows=function(){K=!1},this.setGlobalState=function(N,G){$=E(N,G,0)},this.setState=function(N,G,q){let{clippingPlanes:R,clipIntersection:O,clipShadows:F}=N,D=J.get(N);if(!W||R===null||R.length===0||K&&!F)if(K)E(null);else U();else{let k=K?0:Z,M=k*4,V=D.clippingState||null;H.value=V,V=E(R,G,M,q);for(let _=0;_!==M;++_)V[_]=$[_];D.clippingState=V,this.numIntersection=O?this.numPlanes:0,this.numPlanes+=k}};function U(){if(H.value!==$)H.value=$,H.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function E(N,G,q,R){let O=N!==null?N.length:0,F=null;if(O!==0){if(F=H.value,R!==!0||F===null){let D=q+O*4,k=G.matrixWorldInverse;if(X.getNormalMatrix(k),F===null||F.length<D)F=new Float32Array(D);for(let M=0,V=q;M!==O;++M,V+=4)Y.copy(N[M]).applyMatrix4(k,X),Y.normal.toArray(F,V),F[V+3]=Y.constant}H.value=F,H.needsUpdate=!0}return Q.numPlanes=O,Q.numIntersection=0,F}}class YW{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:K=256,position:Y=aD}=W;GX=this._renderer.getRenderTarget(),EX=this._renderer.getActiveCubeFace(),NX=this._renderer.getActiveMipmapLevel(),qX=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(K);let X=this._allocateTargets();if(X.depthBuffer=!0,this._sceneToCubeUV(J,$,Z,X,Y),Q>0)this._blur(X,0,0,Q);return this._applyPMREM(X),this._cleanup(X),X}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=zG(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=BG(),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(GX,EX,NX),this._renderer.xr.enabled=qX,J.scissorTest=!1,u7(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===c8||J.mapping===G8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);GX=this._renderer.getRenderTarget(),EX=this._renderer.getActiveCubeFace(),NX=this._renderer.getActiveMipmapLevel(),qX=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:nJ,minFilter:nJ,generateMipmaps:!1,type:S9,format:L9,colorSpace:KZ,depthBuffer:!1},Z=VG(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=VG(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=rD(W)),this._blurMaterial=eD(W,J,Q),this._ggxMaterial=tD(W,J,Q)}return Z}_compileMaterial(J){let Q=new VJ(new c0,J);this._renderer.compile(Q,GQ)}_sceneToCubeUV(J,Q,$,Z,W){let X=new CJ(90,1,Q,$),H=[1,-1,1,1,1,1],U=[1,1,1,-1,-1,-1],E=this._renderer,N=E.autoClear,G=E.toneMapping;if(E.getClearColor(LG),E.toneMapping=U9,E.autoClear=!1,E.state.buffers.depth.getReversed())E.setRenderTarget(Z),E.clearDepth(),E.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new VJ(new k8,new j9({name:"PMREM.Background",side:cJ,depthWrite:!1,depthTest:!1}));let R=this._backgroundBox,O=R.material,F=!1,D=J.background;if(D){if(D.isColor)O.color.copy(D),J.background=null,F=!0}else O.color.copy(LG),F=!0;for(let k=0;k<6;k++){let M=k%3;if(M===0)X.up.set(0,H[k],0),X.position.set(W.x,W.y,W.z),X.lookAt(W.x+U[k],W.y,W.z);else if(M===1)X.up.set(0,0,H[k]),X.position.set(W.x,W.y,W.z),X.lookAt(W.x,W.y+U[k],W.z);else X.up.set(0,H[k],0),X.position.set(W.x,W.y,W.z),X.lookAt(W.x,W.y,W.z+U[k]);let V=this._cubeSize;if(u7(Z,M*V,k>2?V:0,V,V),E.setRenderTarget(Z),F)E.render(R,X);E.render(J,X)}E.toneMapping=G,E.autoClear=N,J.background=D}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===c8||J.mapping===G8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=zG();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=BG();let W=Z?this._cubemapMaterial:this._equirectMaterial,K=this._lodMeshes[0];K.material=W;let Y=W.uniforms;Y.envMap.value=J;let X=this._cubeSize;u7(Q,0,0,3*X,2*X),$.setRenderTarget(Q),$.render(K,GQ)}_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,K=this._ggxMaterial,Y=this._lodMeshes[$];Y.material=K;let X=K.uniforms,H=$/(this._lodMeshes.length-1),U=Q/(this._lodMeshes.length-1),E=Math.sqrt(H*H-U*U),N=0+H*1.25,G=E*N,{_lodMax:q}=this,R=this._sizeLods[$],O=3*R*($>q-L8?$-q+L8:0),F=4*(this._cubeSize-R);X.envMap.value=J.texture,X.roughness.value=G,X.mipInt.value=q-Q,u7(W,O,F,3*R,2*R),Z.setRenderTarget(W),Z.render(Y,GQ),X.envMap.value=W.texture,X.roughness.value=0,X.mipInt.value=q-$,u7(J,O,F,3*R,2*R),Z.setRenderTarget(J),Z.render(Y,GQ)}_blur(J,Q,$,Z,W){let K=this._pingPongRenderTarget;this._halfBlur(J,K,Q,$,Z,"latitudinal",W),this._halfBlur(K,J,$,$,Z,"longitudinal",W)}_halfBlur(J,Q,$,Z,W,K,Y){let X=this._renderer,H=this._blurMaterial;if(K!=="latitudinal"&&K!=="longitudinal")T0("blur direction must be either latitudinal or longitudinal!");let U=3,E=this._lodMeshes[Z];E.material=H;let N=H.uniforms,G=this._sizeLods[$]-1,q=isFinite(W)?Math.PI/(2*G):2*Math.PI/(2*t8-1),R=W/q,O=isFinite(W)?1+Math.floor(U*R):t8;if(O>t8)H0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${O} samples when the maximum is set to ${t8}`);let F=[],D=0;for(let A=0;A<t8;++A){let C=A/R,L=Math.exp(-C*C/2);if(F.push(L),A===0)D+=L;else if(A<O)D+=2*L}for(let A=0;A<F.length;A++)F[A]=F[A]/D;if(N.envMap.value=J.texture,N.samples.value=O,N.weights.value=F,N.latitudinal.value=K==="latitudinal",Y)N.poleAxis.value=Y;let{_lodMax:k}=this;N.dTheta.value=q,N.mipInt.value=k-$;let M=this._sizeLods[Z],V=3*M*(Z>k-L8?Z-k+L8:0),_=4*(this._cubeSize-M);u7(Q,V,_,3*M,2*M),X.setRenderTarget(Q),X.render(E,GQ)}}function rD(J){let Q=[],$=[],Z=[],W=J,K=J-L8+1+MG.length;for(let Y=0;Y<K;Y++){let X=Math.pow(2,W);Q.push(X);let H=1/X;if(Y>J-L8)H=MG[Y-J+L8-1];else if(Y===0)H=0;$.push(H);let U=1/(X-2),E=-U,N=1+U,G=[E,E,N,E,N,N,E,E,N,N,E,N],q=6,R=6,O=3,F=2,D=1,k=new Float32Array(O*R*q),M=new Float32Array(F*R*q),V=new Float32Array(D*R*q);for(let A=0;A<q;A++){let C=A%3*2/3-1,L=A>2?0:-1,I=[C,L,0,C+0.6666666666666666,L,0,C+0.6666666666666666,L+1,0,C,L,0,C+0.6666666666666666,L+1,0,C,L+1,0];k.set(I,O*R*A),M.set(G,F*R*A);let b=[A,A,A,A,A,A];V.set(b,D*R*A)}let _=new c0;if(_.setAttribute("position",new UJ(k,O)),_.setAttribute("uv",new UJ(M,F)),_.setAttribute("faceIndex",new UJ(V,D)),Z.push(new VJ(_,null)),W>L8)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function VG(J,Q,$){let Z=new sJ(J,Q,$);return Z.texture.mapping=P7,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function u7(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function tD(J,Q,$){return new aJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:oD,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:XW(),fragmentShader:`
6
6
 
7
7
  precision highp float;
8
8
  precision highp int;
@@ -106,7 +106,7 @@ var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null
106
106
 
107
107
  gl_FragColor = vec4(prefilteredColor, 1.0);
108
108
  }
109
- `,blending:F9,depthTest:!1,depthWrite:!1})}function cD(J,Q,$){let Z=new Float32Array(r8),W=new P(0,1,0);return new iJ({name:"SphericalGaussianBlur",defines:{n:r8,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:ZW(),fragmentShader:`
109
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function eD(J,Q,$){let Z=new Float32Array(t8),W=new P(0,1,0);return new aJ({name:"SphericalGaussianBlur",defines:{n:t8,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:XW(),fragmentShader:`
110
110
 
111
111
  precision mediump float;
112
112
  precision mediump int;
@@ -166,7 +166,7 @@ var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null
166
166
  }
167
167
 
168
168
  }
169
- `,blending:F9,depthTest:!1,depthWrite:!1})}function kG(){return new iJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ZW(),fragmentShader:`
169
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function BG(){return new aJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:XW(),fragmentShader:`
170
170
 
171
171
  precision mediump float;
172
172
  precision mediump int;
@@ -185,7 +185,7 @@ var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null
185
185
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
186
186
 
187
187
  }
188
- `,blending:F9,depthTest:!1,depthWrite:!1})}function MG(){return new iJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ZW(),fragmentShader:`
188
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function zG(){return new aJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:XW(),fragmentShader:`
189
189
 
190
190
  precision mediump float;
191
191
  precision mediump int;
@@ -201,7 +201,7 @@ var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null
201
201
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
202
202
 
203
203
  }
204
- `,blending:F9,depthTest:!1,depthWrite:!1})}function ZW(){return`
204
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function XW(){return`
205
205
 
206
206
  precision mediump float;
207
207
  precision mediump int;
@@ -256,7 +256,7 @@ var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null
256
256
  gl_Position = vec4( position, 1.0 );
257
257
 
258
258
  }
259
- `}function nD(J){let Q=new WeakMap,$=new WeakMap,Z=null;function W(E,q=!1){if(E===null||E===void 0)return null;if(q)return H(E);return K(E)}function K(E){if(E&&E.isTexture){let q=E.mapping;if(q===q6||q===D6)if(Q.has(E)){let R=Q.get(E).texture;return Y(R,E.mapping)}else{let R=E.image;if(R&&R.height>0){let O=new WW(R.height);return O.fromEquirectangularTexture(J,E),Q.set(E,O),E.addEventListener("dispose",U),Y(O.texture,E.mapping)}else return null}}return E}function H(E){if(E&&E.isTexture){let q=E.mapping,R=q===q6||q===D6,O=q===m8||q===K8;if(R||O){let F=$.get(E),D=F!==void 0?F.texture.pmremVersion:0;if(E.isRenderTargetTexture&&E.pmremVersion!==D){if(Z===null)Z=new $W(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 k=E.image;if(R&&k&&k.height>0||O&&k&&X(k)){if(Z===null)Z=new $W(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 Y(E,q){if(q===q6)E.mapping=m8;else if(q===D6)E.mapping=K8;return E}function X(E){let q=0,R=6;for(let O=0;O<R;O++)if(E[O]!==void 0)q++;return q===R}function U(E){let q=E.target;q.removeEventListener("dispose",U);let R=Q.get(q);if(R!==void 0)Q.delete(q),R.dispose()}function G(E){let q=E.target;q.removeEventListener("dispose",G);let R=$.get(q);if(R!==void 0)$.delete(q),R.dispose()}function N(){if(Q=new WeakMap,$=new WeakMap,Z!==null)Z.dispose(),Z=null}return{get:W,dispose:N}}function sD(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)I7("WebGLRenderer: "+Z+" extension not supported.");return W}}}function iD(J,Q,$,Z){let W={},K=new WeakMap;function H(N){let E=N.target;if(E.index!==null)Q.remove(E.index);for(let R in E.attributes)Q.remove(E.attributes[R]);E.removeEventListener("dispose",H),delete W[E.id];let q=K.get(E);if(q)Q.remove(q),K.delete(E);if(Z.releaseStatesOfGeometry(E),E.isInstancedBufferGeometry===!0)delete E._maxInstanceCount;$.memory.geometries--}function Y(N,E){if(W[E.id]===!0)return E;return E.addEventListener("dispose",H),W[E.id]=!0,$.memory.geometries++,E}function X(N){let E=N.attributes;for(let q in E)Q.update(E[q],J.ARRAY_BUFFER)}function U(N){let E=[],q=N.index,R=N.attributes.position,O=0;if(R===void 0)return;if(q!==null){let k=q.array;O=q.version;for(let L=0,V=k.length;L<V;L+=3){let w=k[L+0],_=k[L+1],A=k[L+2];E.push(w,_,_,A,A,w)}}else{let k=R.array;O=R.version;for(let L=0,V=k.length/3-1;L<V;L+=3){let w=L+0,_=L+1,A=L+2;E.push(w,_,_,A,A,w)}}let F=new(R.count>=65535?C6:A6)(E,1);F.version=O;let D=K.get(N);if(D)Q.remove(D);K.set(N,F)}function G(N){let E=K.get(N);if(E){let q=N.index;if(q!==null){if(E.version<q.version)U(N)}}else U(N);return K.get(N)}return{get:Y,update:X,getWireframeAttribute:G}}function oD(J,Q,$){let Z;function W(E){Z=E}let K,H;function Y(E){K=E.type,H=E.bytesPerElement}function X(E,q){J.drawElements(Z,q,K,E*H),$.update(q,Z,1)}function U(E,q,R){if(R===0)return;J.drawElementsInstanced(Z,q,K,E*H,R),$.update(q,Z,R)}function G(E,q,R){if(R===0)return;Q.get("WEBGL_multi_draw").multiDrawElementsWEBGL(Z,q,0,K,E,0,R);let F=0;for(let D=0;D<R;D++)F+=q[D];$.update(F,Z,1)}function N(E,q,R,O){if(R===0)return;let F=Q.get("WEBGL_multi_draw");if(F===null)for(let D=0;D<E.length;D++)U(E[D]/H,q[D],O[D]);else{F.multiDrawElementsInstancedWEBGL(Z,q,0,K,E,0,O,0,R);let D=0;for(let k=0;k<R;k++)D+=q[k]*O[k];$.update(D,Z,1)}}this.setMode=W,this.setIndex=Y,this.render=X,this.renderInstances=U,this.renderMultiDraw=G,this.renderMultiDrawInstances=N}function aD(J){let Q={geometries:0,textures:0},$={frame:0,calls:0,triangles:0,points:0,lines:0};function Z(K,H,Y){switch($.calls++,H){case J.TRIANGLES:$.triangles+=Y*(K/3);break;case J.LINES:$.lines+=Y*(K/2);break;case J.LINE_STRIP:$.lines+=Y*(K-1);break;case J.LINE_LOOP:$.lines+=Y*K;break;case J.POINTS:$.points+=Y*K;break;default:S0("WebGLInfo: Unknown draw mode:",H);break}}function W(){$.calls=0,$.triangles=0,$.points=0,$.lines=0}return{memory:Q,render:$,programs:null,autoReset:!0,reset:W,update:Z}}function rD(J,Q,$){let Z=new WeakMap,W=new GJ;function K(H,Y,X){let U=H.morphTargetInfluences,G=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,N=G!==void 0?G.length:0,E=Z.get(Y);if(E===void 0||E.count!==N){let C=function(){A.dispose(),Z.delete(Y),Y.removeEventListener("dispose",C)};if(E!==void 0)E.texture.dispose();let q=Y.morphAttributes.position!==void 0,R=Y.morphAttributes.normal!==void 0,O=Y.morphAttributes.color!==void 0,F=Y.morphAttributes.position||[],D=Y.morphAttributes.normal||[],k=Y.morphAttributes.color||[],L=0;if(q===!0)L=1;if(R===!0)L=2;if(O===!0)L=3;let V=Y.attributes.position.count*L,w=1;if(V>Q.maxTextureSize)w=Math.ceil(V/Q.maxTextureSize),V=Q.maxTextureSize;let _=new Float32Array(V*w*4*N),A=new y7(_,V,w,N);A.type=A9,A.needsUpdate=!0;let M=L*4;for(let h=0;h<N;h++){let S=F[h],b=D[h],l=k[h],v=V*w*4*h;for(let c=0;c<S.count;c++){let x=c*M;if(q===!0)W.fromBufferAttribute(S,c),_[v+x+0]=W.x,_[v+x+1]=W.y,_[v+x+2]=W.z,_[v+x+3]=0;if(R===!0)W.fromBufferAttribute(b,c),_[v+x+4]=W.x,_[v+x+5]=W.y,_[v+x+6]=W.z,_[v+x+7]=0;if(O===!0)W.fromBufferAttribute(l,c),_[v+x+8]=W.x,_[v+x+9]=W.y,_[v+x+10]=W.z,_[v+x+11]=l.itemSize===4?W.w:1}}E={count:N,texture:A,size:new r(V,w)},Z.set(Y,E),Y.addEventListener("dispose",C)}if(H.isInstancedMesh===!0&&H.morphTexture!==null)X.getUniforms().setValue(J,"morphTexture",H.morphTexture,$);else{let q=0;for(let O=0;O<U.length;O++)q+=U[O];let R=Y.morphTargetsRelative?1:1-q;X.getUniforms().setValue(J,"morphTargetBaseInfluence",R),X.getUniforms().setValue(J,"morphTargetInfluences",U)}X.getUniforms().setValue(J,"morphTargetsTexture",E.texture,$),X.getUniforms().setValue(J,"morphTargetsTextureSize",E.size)}return{update:K}}function tD(J,Q,$,Z,W){let K=new WeakMap;function H(U){let G=W.render.frame,N=U.geometry,E=Q.get(U,N);if(K.get(E)!==G)Q.update(E),K.set(E,G);if(U.isInstancedMesh){if(U.hasEventListener("dispose",X)===!1)U.addEventListener("dispose",X);if(K.get(U)!==G){if($.update(U.instanceMatrix,J.ARRAY_BUFFER),U.instanceColor!==null)$.update(U.instanceColor,J.ARRAY_BUFFER);K.set(U,G)}}if(U.isSkinnedMesh){let q=U.skeleton;if(K.get(q)!==G)q.update(),K.set(q,G)}return E}function Y(){K=new WeakMap}function X(U){let G=U.target;if(G.removeEventListener("dispose",X),Z.releaseStatesOfObject(G),$.remove(G.instanceMatrix),G.instanceColor!==null)$.remove(G.instanceColor)}return{update:H,dispose:Y}}function JF(J,Q,$,Z,W){let K=new uJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W}),H=new uJ(Q,$,{type:C9,depthBuffer:!1,stencilBuffer:!1}),Y=new l0;Y.setAttribute("position",new V0([-1,3,0,-1,-1,0,3,-1,0],3)),Y.setAttribute("uv",new V0([0,2,0,0,2,0],2));let X=new r6({uniforms:{tDiffuse:{value:null}},vertexShader:`
259
+ `}function JF(J){let Q=new WeakMap,$=new WeakMap,Z=null;function W(G,q=!1){if(G===null||G===void 0)return null;if(q)return Y(G);return K(G)}function K(G){if(G&&G.isTexture){let q=G.mapping;if(q===D6||q===F6)if(Q.has(G)){let R=Q.get(G).texture;return X(R,G.mapping)}else{let R=G.image;if(R&&R.height>0){let O=new HW(R.height);return O.fromEquirectangularTexture(J,G),Q.set(G,O),G.addEventListener("dispose",U),X(O.texture,G.mapping)}else return null}}return G}function Y(G){if(G&&G.isTexture){let q=G.mapping,R=q===D6||q===F6,O=q===c8||q===G8;if(R||O){let F=$.get(G),D=F!==void 0?F.texture.pmremVersion:0;if(G.isRenderTargetTexture&&G.pmremVersion!==D){if(Z===null)Z=new YW(J);return F=R?Z.fromEquirectangular(G,F):Z.fromCubemap(G,F),F.texture.pmremVersion=G.pmremVersion,$.set(G,F),F.texture}else if(F!==void 0)return F.texture;else{let k=G.image;if(R&&k&&k.height>0||O&&k&&H(k)){if(Z===null)Z=new YW(J);return F=R?Z.fromEquirectangular(G):Z.fromCubemap(G),F.texture.pmremVersion=G.pmremVersion,$.set(G,F),G.addEventListener("dispose",E),F.texture}else return null}}}return G}function X(G,q){if(q===D6)G.mapping=c8;else if(q===F6)G.mapping=G8;return G}function H(G){let q=0,R=6;for(let O=0;O<R;O++)if(G[O]!==void 0)q++;return q===R}function U(G){let q=G.target;q.removeEventListener("dispose",U);let R=Q.get(q);if(R!==void 0)Q.delete(q),R.dispose()}function E(G){let q=G.target;q.removeEventListener("dispose",E);let R=$.get(q);if(R!==void 0)$.delete(q),R.dispose()}function N(){if(Q=new WeakMap,$=new WeakMap,Z!==null)Z.dispose(),Z=null}return{get:W,dispose:N}}function QF(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)U6("WebGLRenderer: "+Z+" extension not supported.");return W}}}function $F(J,Q,$,Z){let W={},K=new WeakMap;function Y(N){let G=N.target;if(G.index!==null)Q.remove(G.index);for(let R in G.attributes)Q.remove(G.attributes[R]);G.removeEventListener("dispose",Y),delete W[G.id];let q=K.get(G);if(q)Q.remove(q),K.delete(G);if(Z.releaseStatesOfGeometry(G),G.isInstancedBufferGeometry===!0)delete G._maxInstanceCount;$.memory.geometries--}function X(N,G){if(W[G.id]===!0)return G;return G.addEventListener("dispose",Y),W[G.id]=!0,$.memory.geometries++,G}function H(N){let G=N.attributes;for(let q in G)Q.update(G[q],J.ARRAY_BUFFER)}function U(N){let G=[],q=N.index,R=N.attributes.position,O=0;if(R===void 0)return;if(q!==null){let k=q.array;O=q.version;for(let M=0,V=k.length;M<V;M+=3){let _=k[M+0],A=k[M+1],C=k[M+2];G.push(_,A,A,C,C,_)}}else{let k=R.array;O=R.version;for(let M=0,V=k.length/3-1;M<V;M+=3){let _=M+0,A=M+1,C=M+2;G.push(_,A,A,C,C,_)}}let F=new(R.count>=65535?T6:P6)(G,1);F.version=O;let D=K.get(N);if(D)Q.remove(D);K.set(N,F)}function E(N){let G=K.get(N);if(G){let q=N.index;if(q!==null){if(G.version<q.version)U(N)}}else U(N);return K.get(N)}return{get:X,update:H,getWireframeAttribute:E}}function ZF(J,Q,$){let Z;function W(N){Z=N}let K,Y;function X(N){K=N.type,Y=N.bytesPerElement}function H(N,G){J.drawElements(Z,G,K,N*Y),$.update(G,Z,1)}function U(N,G,q){if(q===0)return;J.drawElementsInstanced(Z,G,K,N*Y,q),$.update(G,Z,q)}function E(N,G,q){if(q===0)return;Q.get("WEBGL_multi_draw").multiDrawElementsWEBGL(Z,G,0,K,N,0,q);let O=0;for(let F=0;F<q;F++)O+=G[F];$.update(O,Z,1)}this.setMode=W,this.setIndex=X,this.render=H,this.renderInstances=U,this.renderMultiDraw=E}function WF(J){let Q={geometries:0,textures:0},$={frame:0,calls:0,triangles:0,points:0,lines:0};function Z(K,Y,X){switch($.calls++,Y){case J.TRIANGLES:$.triangles+=X*(K/3);break;case J.LINES:$.lines+=X*(K/2);break;case J.LINE_STRIP:$.lines+=X*(K-1);break;case J.LINE_LOOP:$.lines+=X*K;break;case J.POINTS:$.points+=X*K;break;default:T0("WebGLInfo: Unknown draw mode:",Y);break}}function W(){$.calls=0,$.triangles=0,$.points=0,$.lines=0}return{memory:Q,render:$,programs:null,autoReset:!0,reset:W,update:Z}}function KF(J,Q,$){let Z=new WeakMap,W=new GJ;function K(Y,X,H){let U=Y.morphTargetInfluences,E=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,N=E!==void 0?E.length:0,G=Z.get(X);if(G===void 0||G.count!==N){let I=function(){C.dispose(),Z.delete(X),X.removeEventListener("dispose",I)};if(G!==void 0)G.texture.dispose();let q=X.morphAttributes.position!==void 0,R=X.morphAttributes.normal!==void 0,O=X.morphAttributes.color!==void 0,F=X.morphAttributes.position||[],D=X.morphAttributes.normal||[],k=X.morphAttributes.color||[],M=0;if(q===!0)M=1;if(R===!0)M=2;if(O===!0)M=3;let V=X.attributes.position.count*M,_=1;if(V>Q.maxTextureSize)_=Math.ceil(V/Q.maxTextureSize),V=Q.maxTextureSize;let A=new Float32Array(V*_*4*N),C=new j7(A,V,_,N);C.type=T9,C.needsUpdate=!0;let L=M*4;for(let b=0;b<N;b++){let T=F[b],g=D[b],u=k[b],y=V*_*4*b;for(let l=0;l<T.count;l++){let h=l*L;if(q===!0)W.fromBufferAttribute(T,l),A[y+h+0]=W.x,A[y+h+1]=W.y,A[y+h+2]=W.z,A[y+h+3]=0;if(R===!0)W.fromBufferAttribute(g,l),A[y+h+4]=W.x,A[y+h+5]=W.y,A[y+h+6]=W.z,A[y+h+7]=0;if(O===!0)W.fromBufferAttribute(u,l),A[y+h+8]=W.x,A[y+h+9]=W.y,A[y+h+10]=W.z,A[y+h+11]=u.itemSize===4?W.w:1}}G={count:N,texture:C,size:new r(V,_)},Z.set(X,G),X.addEventListener("dispose",I)}if(Y.isInstancedMesh===!0&&Y.morphTexture!==null)H.getUniforms().setValue(J,"morphTexture",Y.morphTexture,$);else{let q=0;for(let O=0;O<U.length;O++)q+=U[O];let R=X.morphTargetsRelative?1:1-q;H.getUniforms().setValue(J,"morphTargetBaseInfluence",R),H.getUniforms().setValue(J,"morphTargetInfluences",U)}H.getUniforms().setValue(J,"morphTargetsTexture",G.texture,$),H.getUniforms().setValue(J,"morphTargetsTextureSize",G.size)}return{update:K}}function YF(J,Q,$,Z,W){let K=new WeakMap;function Y(U){let E=W.render.frame,N=U.geometry,G=Q.get(U,N);if(K.get(G)!==E)Q.update(G),K.set(G,E);if(U.isInstancedMesh){if(U.hasEventListener("dispose",H)===!1)U.addEventListener("dispose",H);if(K.get(U)!==E){if($.update(U.instanceMatrix,J.ARRAY_BUFFER),U.instanceColor!==null)$.update(U.instanceColor,J.ARRAY_BUFFER);K.set(U,E)}}if(U.isSkinnedMesh){let q=U.skeleton;if(K.get(q)!==E)q.update(),K.set(q,E)}return G}function X(){K=new WeakMap}function H(U){let E=U.target;if(E.removeEventListener("dispose",H),Z.releaseStatesOfObject(E),$.remove(E.instanceMatrix),E.instanceColor!==null)$.remove(E.instanceColor)}return{update:Y,dispose:X}}function HF(J,Q,$,Z,W){let K=new sJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W,depthTexture:Z?new n9(Q,$):void 0}),Y=new sJ(Q,$,{type:S9,depthBuffer:!1,stencilBuffer:!1}),X=new c0;X.setAttribute("position",new z0([-1,3,0,-1,-1,0,3,-1,0],3)),X.setAttribute("uv",new z0([0,2,0,0,2,0],2));let H=new JQ({uniforms:{tDiffuse:{value:null}},vertexShader:`
260
260
  precision highp float;
261
261
 
262
262
  uniform mat4 modelViewMatrix;
@@ -302,17 +302,17 @@ var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null
302
302
  #ifdef SRGB_TRANSFER
303
303
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
304
304
  #endif
305
- }`,depthTest:!1,depthWrite:!1}),U=new kJ(Y,X),G=new i8(-1,1,1,-1,0,1),N=null,E=null,q=!1,R,O=null,F=[],D=!1;this.setSize=function(k,L){K.setSize(k,L),H.setSize(k,L);for(let V=0;V<F.length;V++){let w=F[V];if(w.setSize)w.setSize(k,L)}},this.setEffects=function(k){F=k,D=F.length>0&&F[0].isRenderPass===!0;let{width:L,height:V}=K;for(let w=0;w<F.length;w++){let _=F[w];if(_.setSize)_.setSize(L,V)}},this.begin=function(k,L){if(q)return!1;if(k.toneMapping===W9&&F.length===0)return!1;if(O=L,L!==null){let{width:V,height:w}=L;if(K.width!==V||K.height!==w)this.setSize(V,w)}if(D===!1)k.setRenderTarget(K);return R=k.toneMapping,k.toneMapping=W9,!0},this.hasRenderPass=function(){return D},this.end=function(k,L){k.toneMapping=R,q=!0;let V=K,w=H;for(let _=0;_<F.length;_++){let A=F[_];if(A.enabled===!1)continue;if(A.render(k,w,V,L),A.needsSwap!==!1){let M=V;V=w,w=M}}if(N!==k.outputColorSpace||E!==k.toneMapping){if(N=k.outputColorSpace,E=k.toneMapping,X.defines={},e0.getTransfer(N)===EJ)X.defines.SRGB_TRANSFER="";let _=eD[E];if(_)X.defines[_]="";X.needsUpdate=!0}X.uniforms.tDiffuse.value=V.texture,k.setRenderTarget(O),k.render(U,G),O=null,q=!1},this.isCompositing=function(){return q},this.dispose=function(){K.dispose(),H.dispose(),Y.dispose(),X.dispose()}}function n7(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,K=LG[W];if(K===void 0)K=new Float32Array(W),LG[W]=K;if(Q!==0){Z.toArray(K,0);for(let H=1,Y=0;H!==Q;++H)Y+=$,J[H].toArray(K,Y)}return K}function IJ(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$<Z;$++)if(J[$]!==Q[$])return!1;return!0}function _J(J,Q){for(let $=0,Z=Q.length;$<Z;$++)J[$]=Q[$]}function KW(J,Q){let $=VG[Q];if($===void 0)$=new Int32Array(Q),VG[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function QF(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function $F(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(IJ($,Q))return;J.uniform2fv(this.addr,Q),_J($,Q)}}function ZF(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(IJ($,Q))return;J.uniform3fv(this.addr,Q),_J($,Q)}}function WF(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(IJ($,Q))return;J.uniform4fv(this.addr,Q),_J($,Q)}}function KF(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(IJ($,Q))return;J.uniformMatrix2fv(this.addr,!1,Q),_J($,Q)}else{if(IJ($,Z))return;IG.set(Z),J.uniformMatrix2fv(this.addr,!1,IG),_J($,Z)}}function HF(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(IJ($,Q))return;J.uniformMatrix3fv(this.addr,!1,Q),_J($,Q)}else{if(IJ($,Z))return;zG.set(Z),J.uniformMatrix3fv(this.addr,!1,zG),_J($,Z)}}function YF(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(IJ($,Q))return;J.uniformMatrix4fv(this.addr,!1,Q),_J($,Q)}else{if(IJ($,Z))return;BG.set(Z),J.uniformMatrix4fv(this.addr,!1,BG),_J($,Z)}}function XF(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function UF(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(IJ($,Q))return;J.uniform2iv(this.addr,Q),_J($,Q)}}function GF(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(IJ($,Q))return;J.uniform3iv(this.addr,Q),_J($,Q)}}function EF(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(IJ($,Q))return;J.uniform4iv(this.addr,Q),_J($,Q)}}function NF(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function qF(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(IJ($,Q))return;J.uniform2uiv(this.addr,Q),_J($,Q)}}function DF(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(IJ($,Q))return;J.uniform3uiv(this.addr,Q),_J($,Q)}}function FF(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(IJ($,Q))return;J.uniform4uiv(this.addr,Q),_J($,Q)}}function RF(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;let K;if(this.type===J.SAMPLER_2D_SHADOW)DY.compareFunction=$.isReversedDepthBuffer()?B6:V6,K=DY;else K=xG;$.setTexture2D(Q||K,W)}function OF(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||pG,W)}function kF(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||mG,W)}function MF(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||gG,W)}function LF(J){switch(J){case 5126:return QF;case 35664:return $F;case 35665:return ZF;case 35666:return WF;case 35674:return KF;case 35675:return HF;case 35676:return YF;case 5124:case 35670:return XF;case 35667:case 35671:return UF;case 35668:case 35672:return GF;case 35669:case 35673:return EF;case 5125:return NF;case 36294:return qF;case 36295:return DF;case 36296:return FF;case 35678:case 36198:case 36298:case 36306:case 35682:return RF;case 35679:case 36299:case 36307:return OF;case 35680:case 36300:case 36308:case 36293:return kF;case 36289:case 36303:case 36311:case 36292:return MF}}function VF(J,Q){J.uniform1fv(this.addr,Q)}function BF(J,Q){let $=n7(Q,this.size,2);J.uniform2fv(this.addr,$)}function zF(J,Q){let $=n7(Q,this.size,3);J.uniform3fv(this.addr,$)}function IF(J,Q){let $=n7(Q,this.size,4);J.uniform4fv(this.addr,$)}function _F(J,Q){let $=n7(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function AF(J,Q){let $=n7(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function CF(J,Q){let $=n7(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function wF(J,Q){J.uniform1iv(this.addr,Q)}function PF(J,Q){J.uniform2iv(this.addr,Q)}function TF(J,Q){J.uniform3iv(this.addr,Q)}function SF(J,Q){J.uniform4iv(this.addr,Q)}function jF(J,Q){J.uniform1uiv(this.addr,Q)}function yF(J,Q){J.uniform2uiv(this.addr,Q)}function vF(J,Q){J.uniform3uiv(this.addr,Q)}function fF(J,Q){J.uniform4uiv(this.addr,Q)}function bF(J,Q,$){let Z=this.cache,W=Q.length,K=KW($,W);if(!IJ(Z,K))J.uniform1iv(this.addr,K),_J(Z,K);let H;if(this.type===J.SAMPLER_2D_SHADOW)H=DY;else H=xG;for(let Y=0;Y!==W;++Y)$.setTexture2D(Q[Y]||H,K[Y])}function hF(J,Q,$){let Z=this.cache,W=Q.length,K=KW($,W);if(!IJ(Z,K))J.uniform1iv(this.addr,K),_J(Z,K);for(let H=0;H!==W;++H)$.setTexture3D(Q[H]||pG,K[H])}function xF(J,Q,$){let Z=this.cache,W=Q.length,K=KW($,W);if(!IJ(Z,K))J.uniform1iv(this.addr,K),_J(Z,K);for(let H=0;H!==W;++H)$.setTextureCube(Q[H]||mG,K[H])}function gF(J,Q,$){let Z=this.cache,W=Q.length,K=KW($,W);if(!IJ(Z,K))J.uniform1iv(this.addr,K),_J(Z,K);for(let H=0;H!==W;++H)$.setTexture2DArray(Q[H]||gG,K[H])}function pF(J){switch(J){case 5126:return VF;case 35664:return BF;case 35665:return zF;case 35666:return IF;case 35674:return _F;case 35675:return AF;case 35676:return CF;case 5124:case 35670:return wF;case 35667:case 35671:return PF;case 35668:case 35672:return TF;case 35669:case 35673:return SF;case 5125:return jF;case 36294:return yF;case 36295:return vF;case 36296:return fF;case 35678:case 36198:case 36298:case 36306:case 35682:return bF;case 35679:case 36299:case 36307:return hF;case 35680:case 36300:case 36308:case 36293:return xF;case 36289:case 36303:case 36311:case 36292:return gF}}class dG{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=LF(Q.type)}}class lG{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=pF(Q.type)}}class uG{constructor(J){this.id=J,this.seq=[],this.map={}}setValue(J,Q,$){let Z=this.seq;for(let W=0,K=Z.length;W!==K;++W){let H=Z[W];H.setValue(J,Q[H.id],$)}}}function _G(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function mF(J,Q,$){let Z=J.name,W=Z.length;NY.lastIndex=0;while(!0){let K=NY.exec(Z),H=NY.lastIndex,Y=K[1],X=K[2]==="]",U=K[3];if(X)Y=Y|0;if(U===void 0||U==="["&&H+2===W){_G($,U===void 0?new dG(Y,J,Q):new lG(Y,J,Q));break}else{let N=$.map[Y];if(N===void 0)N=new uG(Y),_G($,N);$=N}}}class GQ{constructor(J,Q){this.seq=[],this.map={};let $=J.getProgramParameter(Q,J.ACTIVE_UNIFORMS);for(let K=0;K<$;++K){let H=J.getActiveUniform(Q,K),Y=J.getUniformLocation(Q,H.name);mF(H,Y,this)}let Z=[],W=[];for(let K of this.seq)if(K.type===J.SAMPLER_2D_SHADOW||K.type===J.SAMPLER_CUBE_SHADOW||K.type===J.SAMPLER_2D_ARRAY_SHADOW)Z.push(K);else W.push(K);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,K=Q.length;W!==K;++W){let H=Q[W],Y=$[H.id];if(Y.needsUpdate!==!1)H.setValue(J,Y.value,Z)}}static seqWithValue(J,Q){let $=[];for(let Z=0,W=J.length;Z!==W;++Z){let K=J[Z];if(K.id in Q)$.push(K)}return $}}function AG(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}function uF(J,Q){let $=J.split(`
306
- `),Z=[],W=Math.max(Q-6,0),K=Math.min(Q+6,$.length);for(let H=W;H<K;H++){let Y=H+1;Z.push(`${Y===Q?">":" "} ${Y}: ${$[H]}`)}return Z.join(`
307
- `)}function cF(J){e0._getMatrix(CG,e0.workingColorSpace,J);let Q=`mat3( ${CG.elements.map(($)=>$.toFixed(4))} )`;switch(e0.getTransfer(J)){case $Z:return[Q,"LinearTransferOETF"];case EJ:return[Q,"sRGBTransferOETF"];default:return U0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function wG(J,Q,$){let Z=J.getShaderParameter(Q,J.COMPILE_STATUS),K=(J.getShaderInfoLog(Q)||"").trim();if(Z&&K==="")return"";let H=/ERROR: 0:(\d+)/.exec(K);if(H){let Y=parseInt(H[1]);return $.toUpperCase()+`
305
+ }`,depthTest:!1,depthWrite:!1}),U=new VJ(X,H),E=new r8(-1,1,1,-1,0,1),N=null,G=null,q=!1,R,O=null,F=[],D=!1;this.setSize=function(k,M){K.setSize(k,M),Y.setSize(k,M);for(let V=0;V<F.length;V++){let _=F[V];if(_.setSize)_.setSize(k,M)}},this.setEffects=function(k){F=k,D=F.length>0&&F[0].isRenderPass===!0;let{width:M,height:V}=K;for(let _=0;_<F.length;_++){let A=F[_];if(A.setSize)A.setSize(M,V)}},this.begin=function(k,M){if(q)return!1;if(k.toneMapping===U9&&F.length===0)return!1;if(O=M,M!==null){let{width:V,height:_}=M;if(K.width!==V||K.height!==_)this.setSize(V,_)}if(D===!1)k.setRenderTarget(K);return R=k.toneMapping,k.toneMapping=U9,!0},this.hasRenderPass=function(){return D},this.end=function(k,M){k.toneMapping=R,q=!0;let V=K,_=Y;for(let A=0;A<F.length;A++){let C=F[A];if(C.enabled===!1)continue;if(C.render(k,_,V,M),C.needsSwap!==!1){let L=V;V=_,_=L}}if(N!==k.outputColorSpace||G!==k.toneMapping){if(N=k.outputColorSpace,G=k.toneMapping,H.defines={},$J.getTransfer(N)===qJ)H.defines.SRGB_TRANSFER="";let A=XF[G];if(A)H.defines[A]="";H.needsUpdate=!0}H.uniforms.tDiffuse.value=V.texture,k.setRenderTarget(O),k.render(U,E),O=null,q=!1},this.isCompositing=function(){return q},this.dispose=function(){if(K.depthTexture)K.depthTexture.dispose();K.dispose(),Y.dispose(),X.dispose(),H.dispose()}}function c7(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,K=IG[W];if(K===void 0)K=new Float32Array(W),IG[W]=K;if(Q!==0){Z.toArray(K,0);for(let Y=1,X=0;Y!==Q;++Y)X+=$,J[Y].toArray(K,X)}return K}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 UW(J,Q){let $=_G[Q];if($===void 0)$=new Int32Array(Q),_G[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function UF(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function GF(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 EF(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 NF(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 qF(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;wG.set(Z),J.uniformMatrix2fv(this.addr,!1,wG),TJ($,Z)}}function DF(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;CG.set(Z),J.uniformMatrix3fv(this.addr,!1,CG),TJ($,Z)}}function FF(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;AG.set(Z),J.uniformMatrix4fv(this.addr,!1,AG),TJ($,Z)}}function RF(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function OF(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 kF(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 MF(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 LF(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function VF(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 BF(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 zF(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 IF(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;let K;if(this.type===J.SAMPLER_2D_SHADOW)RX.compareFunction=$.isReversedDepthBuffer()?_6:I6,K=RX;else K=lG;$.setTexture2D(Q||K,W)}function _F(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||cG,W)}function AF(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||nG,W)}function CF(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||uG,W)}function wF(J){switch(J){case 5126:return UF;case 35664:return GF;case 35665:return EF;case 35666:return NF;case 35674:return qF;case 35675:return DF;case 35676:return FF;case 5124:case 35670:return RF;case 35667:case 35671:return OF;case 35668:case 35672:return kF;case 35669:case 35673:return MF;case 5125:return LF;case 36294:return VF;case 36295:return BF;case 36296:return zF;case 35678:case 36198:case 36298:case 36306:case 35682:return IF;case 35679:case 36299:case 36307:return _F;case 35680:case 36300:case 36308:case 36293:return AF;case 36289:case 36303:case 36311:case 36292:return CF}}function PF(J,Q){J.uniform1fv(this.addr,Q)}function TF(J,Q){let $=c7(Q,this.size,2);J.uniform2fv(this.addr,$)}function SF(J,Q){let $=c7(Q,this.size,3);J.uniform3fv(this.addr,$)}function jF(J,Q){let $=c7(Q,this.size,4);J.uniform4fv(this.addr,$)}function yF(J,Q){let $=c7(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function vF(J,Q){let $=c7(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function fF(J,Q){let $=c7(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function bF(J,Q){J.uniform1iv(this.addr,Q)}function hF(J,Q){J.uniform2iv(this.addr,Q)}function xF(J,Q){J.uniform3iv(this.addr,Q)}function gF(J,Q){J.uniform4iv(this.addr,Q)}function pF(J,Q){J.uniform1uiv(this.addr,Q)}function mF(J,Q){J.uniform2uiv(this.addr,Q)}function dF(J,Q){J.uniform3uiv(this.addr,Q)}function lF(J,Q){J.uniform4uiv(this.addr,Q)}function uF(J,Q,$){let Z=this.cache,W=Q.length,K=UW($,W);if(!PJ(Z,K))J.uniform1iv(this.addr,K),TJ(Z,K);let Y;if(this.type===J.SAMPLER_2D_SHADOW)Y=RX;else Y=lG;for(let X=0;X!==W;++X)$.setTexture2D(Q[X]||Y,K[X])}function cF(J,Q,$){let Z=this.cache,W=Q.length,K=UW($,W);if(!PJ(Z,K))J.uniform1iv(this.addr,K),TJ(Z,K);for(let Y=0;Y!==W;++Y)$.setTexture3D(Q[Y]||cG,K[Y])}function nF(J,Q,$){let Z=this.cache,W=Q.length,K=UW($,W);if(!PJ(Z,K))J.uniform1iv(this.addr,K),TJ(Z,K);for(let Y=0;Y!==W;++Y)$.setTextureCube(Q[Y]||nG,K[Y])}function sF(J,Q,$){let Z=this.cache,W=Q.length,K=UW($,W);if(!PJ(Z,K))J.uniform1iv(this.addr,K),TJ(Z,K);for(let Y=0;Y!==W;++Y)$.setTexture2DArray(Q[Y]||uG,K[Y])}function iF(J){switch(J){case 5126:return PF;case 35664:return TF;case 35665:return SF;case 35666:return jF;case 35674:return yF;case 35675:return vF;case 35676:return fF;case 5124:case 35670:return bF;case 35667:case 35671:return hF;case 35668:case 35672:return xF;case 35669:case 35673:return gF;case 5125:return pF;case 36294:return mF;case 36295:return dF;case 36296:return lF;case 35678:case 36198:case 36298:case 36306:case 35682:return uF;case 35679:case 36299:case 36307:return cF;case 35680:case 36300:case 36308:case 36293:return nF;case 36289:case 36303:case 36311:case 36292:return sF}}class sG{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=wF(Q.type)}}class iG{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=iF(Q.type)}}class oG{constructor(J){this.id=J,this.seq=[],this.map={}}setValue(J,Q,$){let Z=this.seq;for(let W=0,K=Z.length;W!==K;++W){let Y=Z[W];Y.setValue(J,Q[Y.id],$)}}}function PG(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function oF(J,Q,$){let Z=J.name,W=Z.length;DX.lastIndex=0;while(!0){let K=DX.exec(Z),Y=DX.lastIndex,X=K[1],H=K[2]==="]",U=K[3];if(H)X=X|0;if(U===void 0||U==="["&&Y+2===W){PG($,U===void 0?new sG(X,J,Q):new iG(X,J,Q));break}else{let N=$.map[X];if(N===void 0)N=new oG(X),PG($,N);$=N}}}class qQ{constructor(J,Q){this.seq=[],this.map={};let $=J.getProgramParameter(Q,J.ACTIVE_UNIFORMS);for(let K=0;K<$;++K){let Y=J.getActiveUniform(Q,K),X=J.getUniformLocation(Q,Y.name);oF(Y,X,this)}let Z=[],W=[];for(let K of this.seq)if(K.type===J.SAMPLER_2D_SHADOW||K.type===J.SAMPLER_CUBE_SHADOW||K.type===J.SAMPLER_2D_ARRAY_SHADOW)Z.push(K);else W.push(K);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,K=Q.length;W!==K;++W){let Y=Q[W],X=$[Y.id];if(X.needsUpdate!==!1)Y.setValue(J,X.value,Z)}}static seqWithValue(J,Q){let $=[];for(let Z=0,W=J.length;Z!==W;++Z){let K=J[Z];if(K.id in Q)$.push(K)}return $}}function TG(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}function tF(J,Q){let $=J.split(`
306
+ `),Z=[],W=Math.max(Q-6,0),K=Math.min(Q+6,$.length);for(let Y=W;Y<K;Y++){let X=Y+1;Z.push(`${X===Q?">":" "} ${X}: ${$[Y]}`)}return Z.join(`
307
+ `)}function eF(J){$J._getMatrix(SG,$J.workingColorSpace,J);let Q=`mat3( ${SG.elements.map(($)=>$.toFixed(4))} )`;switch($J.getTransfer(J)){case YZ:return[Q,"LinearTransferOETF"];case qJ:return[Q,"sRGBTransferOETF"];default:return H0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function jG(J,Q,$){let Z=J.getShaderParameter(Q,J.COMPILE_STATUS),K=(J.getShaderInfoLog(Q)||"").trim();if(Z&&K==="")return"";let Y=/ERROR: 0:(\d+)/.exec(K);if(Y){let X=parseInt(Y[1]);return $.toUpperCase()+`
308
308
 
309
309
  `+K+`
310
310
 
311
- `+uF(J.getShaderSource(Q),Y)}else return K}function nF(J,Q){let $=cF(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
312
- `)}function iF(J,Q){let $=sF[Q];if($===void 0)return U0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}function oF(){e0.getLuminanceCoefficients(QW);let J=QW.x.toFixed(4),Q=QW.y.toFixed(4),$=QW.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
313
- `)}function aF(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(UQ).join(`
314
- `)}function rF(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
315
- `)}function tF(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W<Z;W++){let K=J.getActiveAttrib(Q,W),H=K.name,Y=1;if(K.type===J.FLOAT_MAT2)Y=2;if(K.type===J.FLOAT_MAT3)Y=3;if(K.type===J.FLOAT_MAT4)Y=4;$[H]={type:K.type,location:J.getAttribLocation(Q,H),locationSize:Y}}return $}function UQ(J){return J!==""}function PG(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 TG(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}function FY(J){return J.replace(eF,Q1)}function Q1(J,Q){let $=a0[Q];if($===void 0){let Z=J1.get(Q);if(Z!==void 0)$=a0[Z],U0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return FY($)}function SG(J){return J.replace($1,Z1)}function Z1(J,Q,$,Z){let W="";for(let K=parseInt(Q);K<parseInt($);K++)W+=Z.replace(/\[\s*i\s*\]/g,"[ "+K+" ]").replace(/UNROLLED_LOOP_INDEX/g,K);return W}function jG(J){let Q=`precision ${J.precision} float;
311
+ `+tF(J.getShaderSource(Q),X)}else return K}function J1(J,Q){let $=eF(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
312
+ `)}function $1(J,Q){let $=Q1[Q];if($===void 0)return H0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}function Z1(){$J.getLuminanceCoefficients(KW);let J=KW.x.toFixed(4),Q=KW.y.toFixed(4),$=KW.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
313
+ `)}function W1(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(NQ).join(`
314
+ `)}function K1(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
315
+ `)}function Y1(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W<Z;W++){let K=J.getActiveAttrib(Q,W),Y=K.name,X=1;if(K.type===J.FLOAT_MAT2)X=2;if(K.type===J.FLOAT_MAT3)X=3;if(K.type===J.FLOAT_MAT4)X=4;$[Y]={type:K.type,location:J.getAttribLocation(Q,Y),locationSize:X}}return $}function NQ(J){return J!==""}function yG(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 vG(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}function OX(J){return J.replace(X1,U1)}function U1(J,Q){let $=r0[Q];if($===void 0){let Z=H1.get(Q);if(Z!==void 0)$=r0[Z],H0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return OX($)}function fG(J){return J.replace(G1,E1)}function E1(J,Q,$,Z){let W="";for(let K=parseInt(Q);K<parseInt($);K++)W+=Z.replace(/\[\s*i\s*\]/g,"[ "+K+" ]").replace(/UNROLLED_LOOP_INDEX/g,K);return W}function bG(J){let Q=`precision ${J.precision} float;
316
316
  precision ${J.precision} int;
317
317
  precision ${J.precision} sampler2D;
318
318
  precision ${J.precision} samplerCube;
@@ -332,30 +332,30 @@ var W5=Object.defineProperty;var K5=(J)=>J;function H5(J,Q){this[J]=K5.bind(null
332
332
  `;if(J.precision==="highp")Q+=`
333
333
  #define HIGH_PRECISION`;else if(J.precision==="mediump")Q+=`
334
334
  #define MEDIUM_PRECISION`;else if(J.precision==="lowp")Q+=`
335
- #define LOW_PRECISION`;return Q}function K1(J){return W1[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}function Y1(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return H1[J.envMapMode]||"ENVMAP_TYPE_CUBE"}function U1(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return X1[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}function E1(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return G1[J.combine]||"ENVMAP_BLENDING_NONE"}function N1(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 q1(J,Q,$,Z){let W=J.getContext(),K=$.defines,H=$.vertexShader,Y=$.fragmentShader,X=K1($),U=Y1($),G=U1($),N=E1($),E=N1($),q=aF($),R=rF(K),O=W.createProgram(),F,D,k=$.glslVersion?"#version "+$.glslVersion+`
336
- `:"";if($.isRawShaderMaterial){if(F=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(UQ).join(`
335
+ #define LOW_PRECISION`;return Q}function q1(J){return N1[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}function F1(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return D1[J.envMapMode]||"ENVMAP_TYPE_CUBE"}function O1(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return R1[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}function M1(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return k1[J.combine]||"ENVMAP_BLENDING_NONE"}function L1(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 V1(J,Q,$,Z){let W=J.getContext(),K=$.defines,Y=$.vertexShader,X=$.fragmentShader,H=q1($),U=F1($),E=O1($),N=M1($),G=L1($),q=W1($),R=K1(K),O=W.createProgram(),F,D,k=$.glslVersion?"#version "+$.glslVersion+`
336
+ `:"";if($.isRawShaderMaterial){if(F=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(NQ).join(`
337
337
  `),F.length>0)F+=`
338
- `;if(D=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(UQ).join(`
338
+ `;if(D=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(NQ).join(`
339
339
  `),D.length>0)D+=`
340
- `}else F=[jG($),"#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":"",$.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 "+X:"",$.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",`
341
- `].filter(UQ).join(`
342
- `),D=[jG($),"#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 "+N:"",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":"",$.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 "+X:"",$.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.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!==W9?"#define TONE_MAPPING":"",$.toneMapping!==W9?a0.tonemapping_pars_fragment:"",$.toneMapping!==W9?iF("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",a0.colorspace_pars_fragment,nF("linearToOutputTexel",$.outputColorSpace),oF(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
343
- `].filter(UQ).join(`
344
- `);if(H=FY(H),H=PG(H,$),H=TG(H,$),Y=FY(Y),Y=PG(Y,$),Y=TG(Y,$),H=SG(H),Y=SG(Y),$.isRawShaderMaterial!==!0)k=`#version 300 es
340
+ `}else F=[bG($),"#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 "+E:"",$.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",`
341
+ `].filter(NQ).join(`
342
+ `),D=[bG($),"#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 "+E:"",$.envMap?"#define "+N:"",G?"#define CUBEUV_TEXEL_WIDTH "+G.texelWidth:"",G?"#define CUBEUV_TEXEL_HEIGHT "+G.texelHeight:"",G?"#define CUBEUV_MAX_MIP "+G.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!==U9?"#define TONE_MAPPING":"",$.toneMapping!==U9?r0.tonemapping_pars_fragment:"",$.toneMapping!==U9?$1("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",r0.colorspace_pars_fragment,J1("linearToOutputTexel",$.outputColorSpace),Z1(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
343
+ `].filter(NQ).join(`
344
+ `);if(Y=OX(Y),Y=yG(Y,$),Y=vG(Y,$),X=OX(X),X=yG(X,$),X=vG(X,$),Y=fG(Y),X=fG(X),$.isRawShaderMaterial!==!0)k=`#version 300 es
345
345
  `,F=[q,"#define attribute in","#define varying out","#define texture2D texture"].join(`
346
346
  `)+`
347
- `+F,D=["#define varying in",$.glslVersion===ZZ?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===ZZ?"":"#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(`
347
+ `+F,D=["#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(`
348
348
  `)+`
349
- `+D;let L=k+F+H,V=k+D+Y,w=AG(W,W.VERTEX_SHADER,L),_=AG(W,W.FRAGMENT_SHADER,V);if(W.attachShader(O,w),W.attachShader(O,_),$.index0AttributeName!==void 0)W.bindAttribLocation(O,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(O,0,"position");W.linkProgram(O);function A(S){if(J.debug.checkShaderErrors){let b=W.getProgramInfoLog(O)||"",l=W.getShaderInfoLog(w)||"",v=W.getShaderInfoLog(_)||"",c=b.trim(),x=l.trim(),m=v.trim(),Q0=!0,$0=!0;if(W.getProgramParameter(O,W.LINK_STATUS)===!1)if(Q0=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,O,w,_);else{let G0=wG(W,w,"vertex"),w0=wG(W,_,"fragment");S0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(O,W.VALIDATE_STATUS)+`
349
+ `+D;let M=k+F+Y,V=k+D+X,_=TG(W,W.VERTEX_SHADER,M),A=TG(W,W.FRAGMENT_SHADER,V);if(W.attachShader(O,_),W.attachShader(O,A),$.index0AttributeName!==void 0)W.bindAttribLocation(O,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(O,0,"position");W.linkProgram(O);function C(T){if(J.debug.checkShaderErrors){let g=W.getProgramInfoLog(O)||"",u=W.getShaderInfoLog(_)||"",y=W.getShaderInfoLog(A)||"",l=g.trim(),h=u.trim(),m=y.trim(),a=!0,W0=!0;if(W.getProgramParameter(O,W.LINK_STATUS)===!1)if(a=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,O,_,A);else{let N0=jG(W,_,"vertex"),j0=jG(W,A,"fragment");T0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(O,W.VALIDATE_STATUS)+`
350
350
 
351
- Material Name: `+S.name+`
352
- Material Type: `+S.type+`
351
+ Material Name: `+T.name+`
352
+ Material Type: `+T.type+`
353
353
 
354
- Program Info Log: `+c+`
355
- `+G0+`
356
- `+w0)}else if(c!=="")U0("WebGLProgram: Program Info Log:",c);else if(x===""||m==="")$0=!1;if($0)S.diagnostics={runnable:Q0,programLog:c,vertexShader:{log:x,prefix:F},fragmentShader:{log:m,prefix:D}}}W.deleteShader(w),W.deleteShader(_),M=new GQ(W,O),C=tF(W,O)}let M;this.getUniforms=function(){if(M===void 0)A(this);return M};let C;this.getAttributes=function(){if(C===void 0)A(this);return C};let h=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(h===!1)h=W.getProgramParameter(O,dF);return h},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(O),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=lF++,this.cacheKey=Q,this.usedTimes=1,this.program=O,this.vertexShader=w,this.fragmentShader=_,this}class cG{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(J){let{vertexShader:Q,fragmentShader:$}=J,Z=this._getShaderStage(Q),W=this._getShaderStage($),K=this._getShaderCacheForMaterial(J);if(K.has(Z)===!1)K.add(Z),Z.usedTimes++;if(K.has(W)===!1)K.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 nG(J),Q.set(J,$);return $}}class nG{constructor(J){this.id=D1++,this.code=J,this.usedTimes=0}}function F1(J,Q,$,Z,W,K){let H=new f7,Y=new cG,X=new Set,U=[],G=new Map,N=Z.logarithmicDepthBuffer,E=Z.precision,q={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(M){if(X.add(M),M===0)return"uv";return`uv${M}`}function O(M,C,h,S,b){let l=S.fog,v=b.geometry,c=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?S.environment:null,x=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap,m=Q.get(M.envMap||c,x),Q0=!!m&&m.mapping===P7?m.image.height:null,$0=q[M.type];if(M.precision!==null){if(E=Z.getMaxPrecision(M.precision),E!==M.precision)U0("WebGLProgram.getParameters:",M.precision,"not supported, using",E,"instead.")}let G0=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,w0=G0!==void 0?G0.length:0,K0=0;if(v.morphAttributes.position!==void 0)K0=1;if(v.morphAttributes.normal!==void 0)K0=2;if(v.morphAttributes.color!==void 0)K0=3;let HJ,WJ,s,E0;if($0){let YJ=O9[$0];HJ=YJ.vertexShader,WJ=YJ.fragmentShader}else HJ=M.vertexShader,WJ=M.fragmentShader,Y.update(M),s=Y.getVertexShaderID(M),E0=Y.getFragmentShaderID(M);let B0=J.getRenderTarget(),q0=J.state.buffers.depth.getReversed(),f0=b.isInstancedMesh===!0,JJ=b.isBatchedMesh===!0,n0=!!M.map,s0=!!M.matcap,a=!!m,Z0=!!M.aoMap,e=!!M.lightMap,R0=!!M.bumpMap,T=!!M.normalMap,h0=!!M.displacementMap,N0=!!M.emissiveMap,x0=!!M.metalnessMap,H0=!!M.roughnessMap,d0=M.anisotropy>0,I=M.clearcoat>0,B=M.dispersion>0,f=M.iridescence>0,n=M.sheen>0,t=M.transmission>0,u=d0&&!!M.anisotropyMap,z0=I&&!!M.clearcoatMap,D0=I&&!!M.clearcoatNormalMap,j0=I&&!!M.clearcoatRoughnessMap,b0=f&&!!M.iridescenceMap,J0=f&&!!M.iridescenceThicknessMap,W0=n&&!!M.sheenColorMap,A0=n&&!!M.sheenRoughnessMap,g0=!!M.specularMap,L0=!!M.specularColorMap,r0=!!M.specularIntensityMap,j=t&&!!M.transmissionMap,Y0=t&&!!M.thicknessMap,X0=!!M.gradientMap,_0=!!M.alphaMap,i=M.alphaTest>0,o=!!M.alphaHash,C0=!!M.extensions,u0=W9;if(M.toneMapped){if(B0===null||B0.isXRRenderTarget===!0)u0=J.toneMapping}let qJ={shaderID:$0,shaderType:M.type,shaderName:M.name,vertexShader:HJ,fragmentShader:WJ,defines:M.defines,customVertexShaderID:s,customFragmentShaderID:E0,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:E,batching:JJ,batchingColor:JJ&&b._colorsTexture!==null,instancing:f0,instancingColor:f0&&b.instanceColor!==null,instancingMorph:f0&&b.morphTexture!==null,outputColorSpace:B0===null?J.outputColorSpace:B0.isXRRenderTarget===!0?B0.texture.colorSpace:j7,alphaToCoverage:!!M.alphaToCoverage,map:n0,matcap:s0,envMap:a,envMapMode:a&&m.mapping,envMapCubeUVHeight:Q0,aoMap:Z0,lightMap:e,bumpMap:R0,normalMap:T,displacementMap:h0,emissiveMap:N0,normalMapObjectSpace:T&&M.normalMapType===lK,normalMapTangentSpace:T&&M.normalMapType===dK,metalnessMap:x0,roughnessMap:H0,anisotropy:d0,anisotropyMap:u,clearcoat:I,clearcoatMap:z0,clearcoatNormalMap:D0,clearcoatRoughnessMap:j0,dispersion:B,iridescence:f,iridescenceMap:b0,iridescenceThicknessMap:J0,sheen:n,sheenColorMap:W0,sheenRoughnessMap:A0,specularMap:g0,specularColorMap:L0,specularIntensityMap:r0,transmission:t,transmissionMap:j,thicknessMap:Y0,gradientMap:X0,opaque:M.transparent===!1&&M.blending===w7&&M.alphaToCoverage===!1,alphaMap:_0,alphaTest:i,alphaHash:o,combine:M.combine,mapUv:n0&&R(M.map.channel),aoMapUv:Z0&&R(M.aoMap.channel),lightMapUv:e&&R(M.lightMap.channel),bumpMapUv:R0&&R(M.bumpMap.channel),normalMapUv:T&&R(M.normalMap.channel),displacementMapUv:h0&&R(M.displacementMap.channel),emissiveMapUv:N0&&R(M.emissiveMap.channel),metalnessMapUv:x0&&R(M.metalnessMap.channel),roughnessMapUv:H0&&R(M.roughnessMap.channel),anisotropyMapUv:u&&R(M.anisotropyMap.channel),clearcoatMapUv:z0&&R(M.clearcoatMap.channel),clearcoatNormalMapUv:D0&&R(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:j0&&R(M.clearcoatRoughnessMap.channel),iridescenceMapUv:b0&&R(M.iridescenceMap.channel),iridescenceThicknessMapUv:J0&&R(M.iridescenceThicknessMap.channel),sheenColorMapUv:W0&&R(M.sheenColorMap.channel),sheenRoughnessMapUv:A0&&R(M.sheenRoughnessMap.channel),specularMapUv:g0&&R(M.specularMap.channel),specularColorMapUv:L0&&R(M.specularColorMap.channel),specularIntensityMapUv:r0&&R(M.specularIntensityMap.channel),transmissionMapUv:j&&R(M.transmissionMap.channel),thicknessMapUv:Y0&&R(M.thicknessMap.channel),alphaMapUv:_0&&R(M.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(T||d0),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!v.attributes.color&&v.attributes.color.itemSize===4,pointsUvs:b.isPoints===!0&&!!v.attributes.uv&&(n0||_0),fog:!!l,useFog:M.fog===!0,fogExp2:!!l&&l.isFogExp2,flatShading:M.wireframe===!1&&(M.flatShading===!0||v.attributes.normal===void 0&&T===!1&&(M.isMeshLambertMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isMeshPhysicalMaterial)),sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:N,reversedDepthBuffer:q0,skinning:b.isSkinnedMesh===!0,morphTargets:v.morphAttributes.position!==void 0,morphNormals:v.morphAttributes.normal!==void 0,morphColors:v.morphAttributes.color!==void 0,morphTargetsCount:w0,morphTextureStride:K0,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numClippingPlanes:K.numPlanes,numClipIntersection:K.numIntersection,dithering:M.dithering,shadowMapEnabled:J.shadowMap.enabled&&h.length>0,shadowMapType:J.shadowMap.type,toneMapping:u0,decodeVideoTexture:n0&&M.map.isVideoTexture===!0&&e0.getTransfer(M.map.colorSpace)===EJ,decodeVideoTextureEmissive:N0&&M.emissiveMap.isVideoTexture===!0&&e0.getTransfer(M.emissiveMap.colorSpace)===EJ,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===D9,flipSided:M.side===dJ,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:C0&&M.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(C0&&M.extensions.multiDraw===!0||JJ)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return qJ.vertexUv1s=X.has(1),qJ.vertexUv2s=X.has(2),qJ.vertexUv3s=X.has(3),X.clear(),qJ}function F(M){let C=[];if(M.shaderID)C.push(M.shaderID);else C.push(M.customVertexShaderID),C.push(M.customFragmentShaderID);if(M.defines!==void 0)for(let h in M.defines)C.push(h),C.push(M.defines[h]);if(M.isRawShaderMaterial===!1)D(C,M),k(C,M),C.push(J.outputColorSpace);return C.push(M.customProgramCacheKey),C.join()}function D(M,C){M.push(C.precision),M.push(C.outputColorSpace),M.push(C.envMapMode),M.push(C.envMapCubeUVHeight),M.push(C.mapUv),M.push(C.alphaMapUv),M.push(C.lightMapUv),M.push(C.aoMapUv),M.push(C.bumpMapUv),M.push(C.normalMapUv),M.push(C.displacementMapUv),M.push(C.emissiveMapUv),M.push(C.metalnessMapUv),M.push(C.roughnessMapUv),M.push(C.anisotropyMapUv),M.push(C.clearcoatMapUv),M.push(C.clearcoatNormalMapUv),M.push(C.clearcoatRoughnessMapUv),M.push(C.iridescenceMapUv),M.push(C.iridescenceThicknessMapUv),M.push(C.sheenColorMapUv),M.push(C.sheenRoughnessMapUv),M.push(C.specularMapUv),M.push(C.specularColorMapUv),M.push(C.specularIntensityMapUv),M.push(C.transmissionMapUv),M.push(C.thicknessMapUv),M.push(C.combine),M.push(C.fogExp2),M.push(C.sizeAttenuation),M.push(C.morphTargetsCount),M.push(C.morphAttributeCount),M.push(C.numDirLights),M.push(C.numPointLights),M.push(C.numSpotLights),M.push(C.numSpotLightMaps),M.push(C.numHemiLights),M.push(C.numRectAreaLights),M.push(C.numDirLightShadows),M.push(C.numPointLightShadows),M.push(C.numSpotLightShadows),M.push(C.numSpotLightShadowsWithMaps),M.push(C.numLightProbes),M.push(C.shadowMapType),M.push(C.toneMapping),M.push(C.numClippingPlanes),M.push(C.numClipIntersection),M.push(C.depthPacking)}function k(M,C){if(H.disableAll(),C.instancing)H.enable(0);if(C.instancingColor)H.enable(1);if(C.instancingMorph)H.enable(2);if(C.matcap)H.enable(3);if(C.envMap)H.enable(4);if(C.normalMapObjectSpace)H.enable(5);if(C.normalMapTangentSpace)H.enable(6);if(C.clearcoat)H.enable(7);if(C.iridescence)H.enable(8);if(C.alphaTest)H.enable(9);if(C.vertexColors)H.enable(10);if(C.vertexAlphas)H.enable(11);if(C.vertexUv1s)H.enable(12);if(C.vertexUv2s)H.enable(13);if(C.vertexUv3s)H.enable(14);if(C.vertexTangents)H.enable(15);if(C.anisotropy)H.enable(16);if(C.alphaHash)H.enable(17);if(C.batching)H.enable(18);if(C.dispersion)H.enable(19);if(C.batchingColor)H.enable(20);if(C.gradientMap)H.enable(21);if(M.push(H.mask),H.disableAll(),C.fog)H.enable(0);if(C.useFog)H.enable(1);if(C.flatShading)H.enable(2);if(C.logarithmicDepthBuffer)H.enable(3);if(C.reversedDepthBuffer)H.enable(4);if(C.skinning)H.enable(5);if(C.morphTargets)H.enable(6);if(C.morphNormals)H.enable(7);if(C.morphColors)H.enable(8);if(C.premultipliedAlpha)H.enable(9);if(C.shadowMapEnabled)H.enable(10);if(C.doubleSided)H.enable(11);if(C.flipSided)H.enable(12);if(C.useDepthPacking)H.enable(13);if(C.dithering)H.enable(14);if(C.transmission)H.enable(15);if(C.sheen)H.enable(16);if(C.opaque)H.enable(17);if(C.pointsUvs)H.enable(18);if(C.decodeVideoTexture)H.enable(19);if(C.decodeVideoTextureEmissive)H.enable(20);if(C.alphaToCoverage)H.enable(21);M.push(H.mask)}function L(M){let C=q[M.type],h;if(C){let S=O9[C];h=FH.clone(S.uniforms)}else h=M.uniforms;return h}function V(M,C){let h=G.get(C);if(h!==void 0)++h.usedTimes;else h=new q1(J,C,M,W),U.push(h),G.set(C,h);return h}function w(M){if(--M.usedTimes===0){let C=U.indexOf(M);U[C]=U[U.length-1],U.pop(),G.delete(M.cacheKey),M.destroy()}}function _(M){Y.remove(M)}function A(){Y.dispose()}return{getParameters:O,getProgramCacheKey:F,getUniforms:L,acquireProgram:V,releaseProgram:w,releaseShaderCache:_,programs:U,dispose:A}}function R1(){let J=new WeakMap;function Q(H){return J.has(H)}function $(H){let Y=J.get(H);if(Y===void 0)Y={},J.set(H,Y);return Y}function Z(H){J.delete(H)}function W(H,Y,X){J.get(H)[Y]=X}function K(){J=new WeakMap}return{has:Q,get:$,remove:Z,update:W,dispose:K}}function O1(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 yG(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 vG(){let J=[],Q=0,$=[],Z=[],W=[];function K(){Q=0,$.length=0,Z.length=0,W.length=0}function H(E){let q=0;if(E.isInstancedMesh)q+=2;if(E.isSkinnedMesh)q+=1;return q}function Y(E,q,R,O,F,D){let k=J[Q];if(k===void 0)k={id:E.id,object:E,geometry:q,material:R,materialVariant:H(E),groupOrder:O,renderOrder:E.renderOrder,z:F,group:D},J[Q]=k;else k.id=E.id,k.object=E,k.geometry=q,k.material=R,k.materialVariant=H(E),k.groupOrder=O,k.renderOrder=E.renderOrder,k.z=F,k.group=D;return Q++,k}function X(E,q,R,O,F,D){let k=Y(E,q,R,O,F,D);if(R.transmission>0)Z.push(k);else if(R.transparent===!0)W.push(k);else $.push(k)}function U(E,q,R,O,F,D){let k=Y(E,q,R,O,F,D);if(R.transmission>0)Z.unshift(k);else if(R.transparent===!0)W.unshift(k);else $.unshift(k)}function G(E,q){if($.length>1)$.sort(E||O1);if(Z.length>1)Z.sort(q||yG);if(W.length>1)W.sort(q||yG)}function N(){for(let E=Q,q=J.length;E<q;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:K,push:X,unshift:U,finish:N,sort:G}}function k1(){let J=new WeakMap;function Q(Z,W){let K=J.get(Z),H;if(K===void 0)H=new vG,J.set(Z,[H]);else if(W>=K.length)H=new vG,K.push(H);else H=K[W];return H}function $(){J=new WeakMap}return{get:Q,dispose:$}}function M1(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new P,color:new M0};break;case"SpotLight":$={position:new P,direction:new P,color:new M0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new P,color:new M0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new P,skyColor:new M0,groundColor:new M0};break;case"RectAreaLight":$={color:new M0,position:new P,halfWidth:new P,halfHeight:new P};break}return J[Q.id]=$,$}}}function L1(){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 r};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new r};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new r,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}function B1(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function z1(J){let Q=new M1,$=L1(),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 P);let W=new P,K=new m0,H=new m0;function Y(U){let G=0,N=0,E=0;for(let C=0;C<9;C++)Z.probe[C].set(0,0,0);let q=0,R=0,O=0,F=0,D=0,k=0,L=0,V=0,w=0,_=0,A=0;U.sort(B1);for(let C=0,h=U.length;C<h;C++){let S=U[C],b=S.color,l=S.intensity,v=S.distance,c=null;if(S.shadow&&S.shadow.map)if(S.shadow.map.texture.format===l8)c=S.shadow.map.texture;else c=S.shadow.map.depthTexture||S.shadow.map.texture;if(S.isAmbientLight)G+=b.r*l,N+=b.g*l,E+=b.b*l;else if(S.isLightProbe){for(let x=0;x<9;x++)Z.probe[x].addScaledVector(S.sh.coefficients[x],l);A++}else if(S.isDirectionalLight){let x=Q.get(S);if(x.color.copy(S.color).multiplyScalar(S.intensity),S.castShadow){let m=S.shadow,Q0=$.get(S);Q0.shadowIntensity=m.intensity,Q0.shadowBias=m.bias,Q0.shadowNormalBias=m.normalBias,Q0.shadowRadius=m.radius,Q0.shadowMapSize=m.mapSize,Z.directionalShadow[q]=Q0,Z.directionalShadowMap[q]=c,Z.directionalShadowMatrix[q]=S.shadow.matrix,k++}Z.directional[q]=x,q++}else if(S.isSpotLight){let x=Q.get(S);x.position.setFromMatrixPosition(S.matrixWorld),x.color.copy(b).multiplyScalar(l),x.distance=v,x.coneCos=Math.cos(S.angle),x.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),x.decay=S.decay,Z.spot[O]=x;let m=S.shadow;if(S.map){if(Z.spotLightMap[w]=S.map,w++,m.updateMatrices(S),S.castShadow)_++}if(Z.spotLightMatrix[O]=m.matrix,S.castShadow){let Q0=$.get(S);Q0.shadowIntensity=m.intensity,Q0.shadowBias=m.bias,Q0.shadowNormalBias=m.normalBias,Q0.shadowRadius=m.radius,Q0.shadowMapSize=m.mapSize,Z.spotShadow[O]=Q0,Z.spotShadowMap[O]=c,V++}O++}else if(S.isRectAreaLight){let x=Q.get(S);x.color.copy(b).multiplyScalar(l),x.halfWidth.set(S.width*0.5,0,0),x.halfHeight.set(0,S.height*0.5,0),Z.rectArea[F]=x,F++}else if(S.isPointLight){let x=Q.get(S);if(x.color.copy(S.color).multiplyScalar(S.intensity),x.distance=S.distance,x.decay=S.decay,S.castShadow){let m=S.shadow,Q0=$.get(S);Q0.shadowIntensity=m.intensity,Q0.shadowBias=m.bias,Q0.shadowNormalBias=m.normalBias,Q0.shadowRadius=m.radius,Q0.shadowMapSize=m.mapSize,Q0.shadowCameraNear=m.camera.near,Q0.shadowCameraFar=m.camera.far,Z.pointShadow[R]=Q0,Z.pointShadowMap[R]=c,Z.pointShadowMatrix[R]=S.shadow.matrix,L++}Z.point[R]=x,R++}else if(S.isHemisphereLight){let x=Q.get(S);x.skyColor.copy(S.color).multiplyScalar(l),x.groundColor.copy(S.groundColor).multiplyScalar(l),Z.hemi[D]=x,D++}}if(F>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=F0.LTC_FLOAT_1,Z.rectAreaLTC2=F0.LTC_FLOAT_2;else Z.rectAreaLTC1=F0.LTC_HALF_1,Z.rectAreaLTC2=F0.LTC_HALF_2;Z.ambient[0]=G,Z.ambient[1]=N,Z.ambient[2]=E;let M=Z.hash;if(M.directionalLength!==q||M.pointLength!==R||M.spotLength!==O||M.rectAreaLength!==F||M.hemiLength!==D||M.numDirectionalShadows!==k||M.numPointShadows!==L||M.numSpotShadows!==V||M.numSpotMaps!==w||M.numLightProbes!==A)Z.directional.length=q,Z.spot.length=O,Z.rectArea.length=F,Z.point.length=R,Z.hemi.length=D,Z.directionalShadow.length=k,Z.directionalShadowMap.length=k,Z.pointShadow.length=L,Z.pointShadowMap.length=L,Z.spotShadow.length=V,Z.spotShadowMap.length=V,Z.directionalShadowMatrix.length=k,Z.pointShadowMatrix.length=L,Z.spotLightMatrix.length=V+w-_,Z.spotLightMap.length=w,Z.numSpotLightShadowsWithMaps=_,Z.numLightProbes=A,M.directionalLength=q,M.pointLength=R,M.spotLength=O,M.rectAreaLength=F,M.hemiLength=D,M.numDirectionalShadows=k,M.numPointShadows=L,M.numSpotShadows=V,M.numSpotMaps=w,M.numLightProbes=A,Z.version=V1++}function X(U,G){let N=0,E=0,q=0,R=0,O=0,F=G.matrixWorldInverse;for(let D=0,k=U.length;D<k;D++){let L=U[D];if(L.isDirectionalLight){let V=Z.directional[N];V.direction.setFromMatrixPosition(L.matrixWorld),W.setFromMatrixPosition(L.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(F),N++}else if(L.isSpotLight){let V=Z.spot[q];V.position.setFromMatrixPosition(L.matrixWorld),V.position.applyMatrix4(F),V.direction.setFromMatrixPosition(L.matrixWorld),W.setFromMatrixPosition(L.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(F),q++}else if(L.isRectAreaLight){let V=Z.rectArea[R];V.position.setFromMatrixPosition(L.matrixWorld),V.position.applyMatrix4(F),H.identity(),K.copy(L.matrixWorld),K.premultiply(F),H.extractRotation(K),V.halfWidth.set(L.width*0.5,0,0),V.halfHeight.set(0,L.height*0.5,0),V.halfWidth.applyMatrix4(H),V.halfHeight.applyMatrix4(H),R++}else if(L.isPointLight){let V=Z.point[E];V.position.setFromMatrixPosition(L.matrixWorld),V.position.applyMatrix4(F),E++}else if(L.isHemisphereLight){let V=Z.hemi[O];V.direction.setFromMatrixPosition(L.matrixWorld),V.direction.transformDirection(F),O++}}}return{setup:Y,setupView:X,state:Z}}function fG(J){let Q=new z1(J),$=[],Z=[];function W(G){U.camera=G,$.length=0,Z.length=0}function K(G){$.push(G)}function H(G){Z.push(G)}function Y(){Q.setup($)}function X(G){Q.setupView($,G)}let U={lightsArray:$,shadowsArray:Z,camera:null,lights:Q,transmissionRenderTarget:{}};return{init:W,state:U,setupLights:Y,setupLightsView:X,pushLight:K,pushShadow:H}}function I1(J){let Q=new WeakMap;function $(W,K=0){let H=Q.get(W),Y;if(H===void 0)Y=new fG(J),Q.set(W,[Y]);else if(K>=H.length)Y=new fG(J),H.push(Y);else Y=H[K];return Y}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}function P1(J,Q,$){let Z=new E8,W=new r,K=new r,H=new GJ,Y=new e6,X=new JQ,U={},G=$.maxTextureSize,N={[g8]:dJ,[dJ]:g8,[D9]:D9},E=new iJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new r},radius:{value:4}},vertexShader:_1,fragmentShader:A1}),q=E.clone();q.defines.HORIZONTAL_PASS=1;let R=new l0;R.setAttribute("position",new KJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let O=new kJ(R,E),F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=C7;let D=this.type;this.render=function(_,A,M){if(F.enabled===!1)return;if(F.autoUpdate===!1&&F.needsUpdate===!1)return;if(_.length===0)return;if(this.type===QK)U0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=C7;let C=J.getRenderTarget(),h=J.getActiveCubeFace(),S=J.getActiveMipmapLevel(),b=J.state;if(b.setBlending(F9),b.buffers.depth.getReversed()===!0)b.buffers.color.setClear(0,0,0,0);else b.buffers.color.setClear(1,1,1,1);b.buffers.depth.setTest(!0),b.setScissorTest(!1);let l=D!==this.type;if(l)A.traverse(function(v){if(v.material)if(Array.isArray(v.material))v.material.forEach((c)=>c.needsUpdate=!0);else v.material.needsUpdate=!0});for(let v=0,c=_.length;v<c;v++){let x=_[v],m=x.shadow;if(m===void 0){U0("WebGLShadowMap:",x,"has no shadow.");continue}if(m.autoUpdate===!1&&m.needsUpdate===!1)continue;W.copy(m.mapSize);let Q0=m.getFrameExtents();if(W.multiply(Q0),K.copy(m.mapSize),W.x>G||W.y>G){if(W.x>G)K.x=Math.floor(G/Q0.x),W.x=K.x*Q0.x,m.mapSize.x=K.x;if(W.y>G)K.y=Math.floor(G/Q0.y),W.y=K.y*Q0.y,m.mapSize.y=K.y}let $0=J.state.buffers.depth.getReversed();if(m.camera._reversedDepth=$0,m.map===null||l===!0){if(m.map!==null){if(m.map.depthTexture!==null)m.map.depthTexture.dispose(),m.map.depthTexture=null;m.map.dispose()}if(this.type===x8){if(x.isPointLight){U0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}m.map=new uJ(W.x,W.y,{format:l8,type:C9,minFilter:lJ,magFilter:lJ,generateMipmaps:!1}),m.map.texture.name=x.name+".shadowMap",m.map.depthTexture=new N8(W.x,W.y,A9),m.map.depthTexture.name=x.name+".shadowMapDepth",m.map.depthTexture.format=Y8,m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=m9,m.map.depthTexture.magFilter=m9}else{if(x.isPointLight)m.map=new WW(W.x),m.map.depthTexture=new FZ(W.x,d9);else m.map=new uJ(W.x,W.y),m.map.depthTexture=new N8(W.x,W.y,d9);if(m.map.depthTexture.name=x.name+".shadowMap",m.map.depthTexture.format=Y8,this.type===C7)m.map.depthTexture.compareFunction=$0?B6:V6,m.map.depthTexture.minFilter=lJ,m.map.depthTexture.magFilter=lJ;else m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=m9,m.map.depthTexture.magFilter=m9}m.camera.updateProjectionMatrix()}let G0=m.map.isWebGLCubeRenderTarget?6:1;for(let w0=0;w0<G0;w0++){if(m.map.isWebGLCubeRenderTarget)J.setRenderTarget(m.map,w0),J.clear();else{if(w0===0)J.setRenderTarget(m.map),J.clear();let K0=m.getViewport(w0);H.set(K.x*K0.x,K.y*K0.y,K.x*K0.z,K.y*K0.w),b.viewport(H)}if(x.isPointLight){let{camera:K0,matrix:HJ}=m,WJ=x.distance||K0.far;if(WJ!==K0.far)K0.far=WJ,K0.updateProjectionMatrix();XQ.setFromMatrixPosition(x.matrixWorld),K0.position.copy(XQ),qY.copy(K0.position),qY.add(C1[w0]),K0.up.copy(w1[w0]),K0.lookAt(qY),K0.updateMatrixWorld(),HJ.makeTranslation(-XQ.x,-XQ.y,-XQ.z),bG.multiplyMatrices(K0.projectionMatrix,K0.matrixWorldInverse),m._frustum.setFromProjectionMatrix(bG,K0.coordinateSystem,K0.reversedDepth)}else m.updateMatrices(x);Z=m.getFrustum(),V(A,M,m.camera,x,this.type)}if(m.isPointLightShadow!==!0&&this.type===x8)k(m,M);m.needsUpdate=!1}D=this.type,F.needsUpdate=!1,J.setRenderTarget(C,h,S)};function k(_,A){let M=Q.update(O);if(E.defines.VSM_SAMPLES!==_.blurSamples)E.defines.VSM_SAMPLES=_.blurSamples,q.defines.VSM_SAMPLES=_.blurSamples,E.needsUpdate=!0,q.needsUpdate=!0;if(_.mapPass===null)_.mapPass=new uJ(W.x,W.y,{format:l8,type:C9});E.uniforms.shadow_pass.value=_.map.depthTexture,E.uniforms.resolution.value=_.mapSize,E.uniforms.radius.value=_.radius,J.setRenderTarget(_.mapPass),J.clear(),J.renderBufferDirect(A,null,M,E,O,null),q.uniforms.shadow_pass.value=_.mapPass.texture,q.uniforms.resolution.value=_.mapSize,q.uniforms.radius.value=_.radius,J.setRenderTarget(_.map),J.clear(),J.renderBufferDirect(A,null,M,q,O,null)}function L(_,A,M,C){let h=null,S=M.isPointLight===!0?_.customDistanceMaterial:_.customDepthMaterial;if(S!==void 0)h=S;else if(h=M.isPointLight===!0?X:Y,J.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){let b=h.uuid,l=A.uuid,v=U[b];if(v===void 0)v={},U[b]=v;let c=v[l];if(c===void 0)c=h.clone(),v[l]=c,A.addEventListener("dispose",w);h=c}if(h.visible=A.visible,h.wireframe=A.wireframe,C===x8)h.side=A.shadowSide!==null?A.shadowSide:A.side;else h.side=A.shadowSide!==null?A.shadowSide:N[A.side];if(h.alphaMap=A.alphaMap,h.alphaTest=A.alphaToCoverage===!0?0.5:A.alphaTest,h.map=A.map,h.clipShadows=A.clipShadows,h.clippingPlanes=A.clippingPlanes,h.clipIntersection=A.clipIntersection,h.displacementMap=A.displacementMap,h.displacementScale=A.displacementScale,h.displacementBias=A.displacementBias,h.wireframeLinewidth=A.wireframeLinewidth,h.linewidth=A.linewidth,M.isPointLight===!0&&h.isMeshDistanceMaterial===!0){let b=J.properties.get(h);b.light=M}return h}function V(_,A,M,C,h){if(_.visible===!1)return;if(_.layers.test(A.layers)&&(_.isMesh||_.isLine||_.isPoints)){if((_.castShadow||_.receiveShadow&&h===x8)&&(!_.frustumCulled||Z.intersectsObject(_))){_.modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,_.matrixWorld);let l=Q.update(_),v=_.material;if(Array.isArray(v)){let c=l.groups;for(let x=0,m=c.length;x<m;x++){let Q0=c[x],$0=v[Q0.materialIndex];if($0&&$0.visible){let G0=L(_,$0,C,h);_.onBeforeShadow(J,_,A,M,l,G0,Q0),J.renderBufferDirect(M,null,l,G0,_,Q0),_.onAfterShadow(J,_,A,M,l,G0,Q0)}}}else if(v.visible){let c=L(_,v,C,h);_.onBeforeShadow(J,_,A,M,l,c,null),J.renderBufferDirect(M,null,l,c,_,null),_.onAfterShadow(J,_,A,M,l,c,null)}}}let b=_.children;for(let l=0,v=b.length;l<v;l++)V(b[l],A,M,C,h)}function w(_){_.target.removeEventListener("dispose",w);for(let M in U){let C=U[M],h=_.target.uuid;if(h in C)C[h].dispose(),delete C[h]}}}function T1(J,Q){function $(){let j=!1,Y0=new GJ,X0=null,_0=new GJ(0,0,0,0);return{setMask:function(i){if(X0!==i&&!j)J.colorMask(i,i,i,i),X0=i},setLocked:function(i){j=i},setClear:function(i,o,C0,u0,qJ){if(qJ===!0)i*=u0,o*=u0,C0*=u0;if(Y0.set(i,o,C0,u0),_0.equals(Y0)===!1)J.clearColor(i,o,C0,u0),_0.copy(Y0)},reset:function(){j=!1,X0=null,_0.set(-1,0,0,0)}}}function Z(){let j=!1,Y0=!1,X0=null,_0=null,i=null;return{setReversed:function(o){if(Y0!==o){let C0=Q.get("EXT_clip_control");if(o)C0.clipControlEXT(C0.LOWER_LEFT_EXT,C0.ZERO_TO_ONE_EXT);else C0.clipControlEXT(C0.LOWER_LEFT_EXT,C0.NEGATIVE_ONE_TO_ONE_EXT);Y0=o;let u0=i;i=null,this.setClear(u0)}},getReversed:function(){return Y0},setTest:function(o){if(o)B0(J.DEPTH_TEST);else q0(J.DEPTH_TEST)},setMask:function(o){if(X0!==o&&!j)J.depthMask(o),X0=o},setFunc:function(o){if(Y0)o=tU[o];if(_0!==o){switch(o){case BK:J.depthFunc(J.NEVER);break;case zK:J.depthFunc(J.ALWAYS);break;case IK:J.depthFunc(J.LESS);break;case G$:J.depthFunc(J.LEQUAL);break;case _K:J.depthFunc(J.EQUAL);break;case AK:J.depthFunc(J.GEQUAL);break;case CK:J.depthFunc(J.GREATER);break;case wK:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}_0=o}},setLocked:function(o){j=o},setClear:function(o){if(i!==o){if(i=o,Y0)o=1-o;J.clearDepth(o)}},reset:function(){j=!1,X0=null,_0=null,i=null,Y0=!1}}}function W(){let j=!1,Y0=null,X0=null,_0=null,i=null,o=null,C0=null,u0=null,qJ=null;return{setTest:function(YJ){if(!j)if(YJ)B0(J.STENCIL_TEST);else q0(J.STENCIL_TEST)},setMask:function(YJ){if(Y0!==YJ&&!j)J.stencilMask(YJ),Y0=YJ},setFunc:function(YJ,S9,k9){if(X0!==YJ||_0!==S9||i!==k9)J.stencilFunc(YJ,S9,k9),X0=YJ,_0=S9,i=k9},setOp:function(YJ,S9,k9){if(o!==YJ||C0!==S9||u0!==k9)J.stencilOp(YJ,S9,k9),o=YJ,C0=S9,u0=k9},setLocked:function(YJ){j=YJ},setClear:function(YJ){if(qJ!==YJ)J.clearStencil(YJ),qJ=YJ},reset:function(){j=!1,Y0=null,X0=null,_0=null,i=null,o=null,C0=null,u0=null,qJ=null}}}let K=new $,H=new Z,Y=new W,X=new WeakMap,U=new WeakMap,G={},N={},E=new WeakMap,q=[],R=null,O=!1,F=null,D=null,k=null,L=null,V=null,w=null,_=null,A=new M0(0,0,0),M=0,C=!1,h=null,S=null,b=null,l=null,v=null,c=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),x=!1,m=0,Q0=J.getParameter(J.VERSION);if(Q0.indexOf("WebGL")!==-1)m=parseFloat(/^WebGL (\d)/.exec(Q0)[1]),x=m>=1;else if(Q0.indexOf("OpenGL ES")!==-1)m=parseFloat(/^OpenGL ES (\d)/.exec(Q0)[1]),x=m>=2;let $0=null,G0={},w0=J.getParameter(J.SCISSOR_BOX),K0=J.getParameter(J.VIEWPORT),HJ=new GJ().fromArray(w0),WJ=new GJ().fromArray(K0);function s(j,Y0,X0,_0){let i=new Uint8Array(4),o=J.createTexture();J.bindTexture(j,o),J.texParameteri(j,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(j,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let C0=0;C0<X0;C0++)if(j===J.TEXTURE_3D||j===J.TEXTURE_2D_ARRAY)J.texImage3D(Y0,0,J.RGBA,1,1,_0,0,J.RGBA,J.UNSIGNED_BYTE,i);else J.texImage2D(Y0+C0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,i);return o}let E0={};E0[J.TEXTURE_2D]=s(J.TEXTURE_2D,J.TEXTURE_2D,1),E0[J.TEXTURE_CUBE_MAP]=s(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),E0[J.TEXTURE_2D_ARRAY]=s(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),E0[J.TEXTURE_3D]=s(J.TEXTURE_3D,J.TEXTURE_3D,1,1),K.setClear(0,0,0,1),H.setClear(1),Y.setClear(0),B0(J.DEPTH_TEST),H.setFunc(G$),R0(!1),T(H$),B0(J.CULL_FACE),Z0(F9);function B0(j){if(G[j]!==!0)J.enable(j),G[j]=!0}function q0(j){if(G[j]!==!1)J.disable(j),G[j]=!1}function f0(j,Y0){if(N[j]!==Y0){if(J.bindFramebuffer(j,Y0),N[j]=Y0,j===J.DRAW_FRAMEBUFFER)N[J.FRAMEBUFFER]=Y0;if(j===J.FRAMEBUFFER)N[J.DRAW_FRAMEBUFFER]=Y0;return!0}return!1}function JJ(j,Y0){let X0=q,_0=!1;if(j){if(X0=E.get(Y0),X0===void 0)X0=[],E.set(Y0,X0);let i=j.textures;if(X0.length!==i.length||X0[0]!==J.COLOR_ATTACHMENT0){for(let o=0,C0=i.length;o<C0;o++)X0[o]=J.COLOR_ATTACHMENT0+o;X0.length=i.length,_0=!0}}else if(X0[0]!==J.BACK)X0[0]=J.BACK,_0=!0;if(_0)J.drawBuffers(X0)}function n0(j){if(R!==j)return J.useProgram(j),R=j,!0;return!1}let s0={[p8]:J.FUNC_ADD,[ZK]:J.FUNC_SUBTRACT,[WK]:J.FUNC_REVERSE_SUBTRACT};s0[KK]=J.MIN,s0[HK]=J.MAX;let a={[YK]:J.ZERO,[XK]:J.ONE,[UK]:J.SRC_COLOR,[EK]:J.SRC_ALPHA,[OK]:J.SRC_ALPHA_SATURATE,[FK]:J.DST_COLOR,[qK]:J.DST_ALPHA,[GK]:J.ONE_MINUS_SRC_COLOR,[NK]:J.ONE_MINUS_SRC_ALPHA,[RK]:J.ONE_MINUS_DST_COLOR,[DK]:J.ONE_MINUS_DST_ALPHA,[kK]:J.CONSTANT_COLOR,[MK]:J.ONE_MINUS_CONSTANT_COLOR,[LK]:J.CONSTANT_ALPHA,[VK]:J.ONE_MINUS_CONSTANT_ALPHA};function Z0(j,Y0,X0,_0,i,o,C0,u0,qJ,YJ){if(j===F9){if(O===!0)q0(J.BLEND),O=!1;return}if(O===!1)B0(J.BLEND),O=!0;if(j!==$K){if(j!==F||YJ!==C){if(D!==p8||V!==p8)J.blendEquation(J.FUNC_ADD),D=p8,V=p8;if(YJ)switch(j){case w7:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case Y$:J.blendFunc(J.ONE,J.ONE);break;case X$:J.blendFuncSeparate(J.ZERO,J.ONE_MINUS_SRC_COLOR,J.ZERO,J.ONE);break;case U$:J.blendFuncSeparate(J.DST_COLOR,J.ONE_MINUS_SRC_ALPHA,J.ZERO,J.ONE);break;default:S0("WebGLState: Invalid blending: ",j);break}else switch(j){case w7:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case Y$:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case X$:S0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case U$:S0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:S0("WebGLState: Invalid blending: ",j);break}k=null,L=null,w=null,_=null,A.set(0,0,0),M=0,F=j,C=YJ}return}if(i=i||Y0,o=o||X0,C0=C0||_0,Y0!==D||i!==V)J.blendEquationSeparate(s0[Y0],s0[i]),D=Y0,V=i;if(X0!==k||_0!==L||o!==w||C0!==_)J.blendFuncSeparate(a[X0],a[_0],a[o],a[C0]),k=X0,L=_0,w=o,_=C0;if(u0.equals(A)===!1||qJ!==M)J.blendColor(u0.r,u0.g,u0.b,qJ),A.copy(u0),M=qJ;F=j,C=!1}function e(j,Y0){j.side===D9?q0(J.CULL_FACE):B0(J.CULL_FACE);let X0=j.side===dJ;if(Y0)X0=!X0;R0(X0),j.blending===w7&&j.transparent===!1?Z0(F9):Z0(j.blending,j.blendEquation,j.blendSrc,j.blendDst,j.blendEquationAlpha,j.blendSrcAlpha,j.blendDstAlpha,j.blendColor,j.blendAlpha,j.premultipliedAlpha),H.setFunc(j.depthFunc),H.setTest(j.depthTest),H.setMask(j.depthWrite),K.setMask(j.colorWrite);let _0=j.stencilWrite;if(Y.setTest(_0),_0)Y.setMask(j.stencilWriteMask),Y.setFunc(j.stencilFunc,j.stencilRef,j.stencilFuncMask),Y.setOp(j.stencilFail,j.stencilZFail,j.stencilZPass);N0(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits),j.alphaToCoverage===!0?B0(J.SAMPLE_ALPHA_TO_COVERAGE):q0(J.SAMPLE_ALPHA_TO_COVERAGE)}function R0(j){if(h!==j){if(j)J.frontFace(J.CW);else J.frontFace(J.CCW);h=j}}function T(j){if(j!==eW){if(B0(J.CULL_FACE),j!==S)if(j===H$)J.cullFace(J.BACK);else if(j===JK)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else q0(J.CULL_FACE);S=j}function h0(j){if(j!==b){if(x)J.lineWidth(j);b=j}}function N0(j,Y0,X0){if(j){if(B0(J.POLYGON_OFFSET_FILL),l!==Y0||v!==X0){if(l=Y0,v=X0,H.getReversed())Y0=-Y0;J.polygonOffset(Y0,X0)}}else q0(J.POLYGON_OFFSET_FILL)}function x0(j){if(j)B0(J.SCISSOR_TEST);else q0(J.SCISSOR_TEST)}function H0(j){if(j===void 0)j=J.TEXTURE0+c-1;if($0!==j)J.activeTexture(j),$0=j}function d0(j,Y0,X0){if(X0===void 0)if($0===null)X0=J.TEXTURE0+c-1;else X0=$0;let _0=G0[X0];if(_0===void 0)_0={type:void 0,texture:void 0},G0[X0]=_0;if(_0.type!==j||_0.texture!==Y0){if($0!==X0)J.activeTexture(X0),$0=X0;J.bindTexture(j,Y0||E0[j]),_0.type=j,_0.texture=Y0}}function I(){let j=G0[$0];if(j!==void 0&&j.type!==void 0)J.bindTexture(j.type,null),j.type=void 0,j.texture=void 0}function B(){try{J.compressedTexImage2D(...arguments)}catch(j){S0("WebGLState:",j)}}function f(){try{J.compressedTexImage3D(...arguments)}catch(j){S0("WebGLState:",j)}}function n(){try{J.texSubImage2D(...arguments)}catch(j){S0("WebGLState:",j)}}function t(){try{J.texSubImage3D(...arguments)}catch(j){S0("WebGLState:",j)}}function u(){try{J.compressedTexSubImage2D(...arguments)}catch(j){S0("WebGLState:",j)}}function z0(){try{J.compressedTexSubImage3D(...arguments)}catch(j){S0("WebGLState:",j)}}function D0(){try{J.texStorage2D(...arguments)}catch(j){S0("WebGLState:",j)}}function j0(){try{J.texStorage3D(...arguments)}catch(j){S0("WebGLState:",j)}}function b0(){try{J.texImage2D(...arguments)}catch(j){S0("WebGLState:",j)}}function J0(){try{J.texImage3D(...arguments)}catch(j){S0("WebGLState:",j)}}function W0(j){if(HJ.equals(j)===!1)J.scissor(j.x,j.y,j.z,j.w),HJ.copy(j)}function A0(j){if(WJ.equals(j)===!1)J.viewport(j.x,j.y,j.z,j.w),WJ.copy(j)}function g0(j,Y0){let X0=U.get(Y0);if(X0===void 0)X0=new WeakMap,U.set(Y0,X0);let _0=X0.get(j);if(_0===void 0)_0=J.getUniformBlockIndex(Y0,j.name),X0.set(j,_0)}function L0(j,Y0){let _0=U.get(Y0).get(j);if(X.get(Y0)!==_0)J.uniformBlockBinding(Y0,_0,j.__bindingPointIndex),X.set(Y0,_0)}function r0(){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),H.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),G={},$0=null,G0={},N={},E=new WeakMap,q=[],R=null,O=!1,F=null,D=null,k=null,L=null,V=null,w=null,_=null,A=new M0(0,0,0),M=0,C=!1,h=null,S=null,b=null,l=null,v=null,HJ.set(0,0,J.canvas.width,J.canvas.height),WJ.set(0,0,J.canvas.width,J.canvas.height),K.reset(),H.reset(),Y.reset()}return{buffers:{color:K,depth:H,stencil:Y},enable:B0,disable:q0,bindFramebuffer:f0,drawBuffers:JJ,useProgram:n0,setBlending:Z0,setMaterial:e,setFlipSided:R0,setCullFace:T,setLineWidth:h0,setPolygonOffset:N0,setScissorTest:x0,activeTexture:H0,bindTexture:d0,unbindTexture:I,compressedTexImage2D:B,compressedTexImage3D:f,texImage2D:b0,texImage3D:J0,updateUBOMapping:g0,uniformBlockBinding:L0,texStorage2D:D0,texStorage3D:j0,texSubImage2D:n,texSubImage3D:t,compressedTexSubImage2D:u,compressedTexSubImage3D:z0,scissor:W0,viewport:A0,reset:r0}}function S1(J,Q,$,Z,W,K,H){let Y=Q.has("WEBGL_multisampled_render_to_texture")?Q.get("WEBGL_multisampled_render_to_texture"):null,X=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),U=new r,G=new WeakMap,N,E=new WeakMap,q=!1;try{q=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(I){}function R(I,B){return q?new OffscreenCanvas(I,B):B7("canvas")}function O(I,B,f){let n=1,t=d0(I);if(t.width>f||t.height>f)n=f/Math.max(t.width,t.height);if(n<1)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap||typeof VideoFrame<"u"&&I instanceof VideoFrame){let u=Math.floor(n*t.width),z0=Math.floor(n*t.height);if(N===void 0)N=R(u,z0);let D0=B?R(u,z0):N;return D0.width=u,D0.height=z0,D0.getContext("2d").drawImage(I,0,0,u,z0),U0("WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+u+"x"+z0+")."),D0}else{if("data"in I)U0("WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+").");return I}return I}function F(I){return I.generateMipmaps}function D(I){J.generateMipmap(I)}function k(I){if(I.isWebGLCubeRenderTarget)return J.TEXTURE_CUBE_MAP;if(I.isWebGL3DRenderTarget)return J.TEXTURE_3D;if(I.isWebGLArrayRenderTarget||I.isCompressedArrayTexture)return J.TEXTURE_2D_ARRAY;return J.TEXTURE_2D}function L(I,B,f,n,t=!1){if(I!==null){if(J[I]!==void 0)return J[I];U0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let u=B;if(B===J.RED){if(f===J.FLOAT)u=J.R32F;if(f===J.HALF_FLOAT)u=J.R16F;if(f===J.UNSIGNED_BYTE)u=J.R8}if(B===J.RED_INTEGER){if(f===J.UNSIGNED_BYTE)u=J.R8UI;if(f===J.UNSIGNED_SHORT)u=J.R16UI;if(f===J.UNSIGNED_INT)u=J.R32UI;if(f===J.BYTE)u=J.R8I;if(f===J.SHORT)u=J.R16I;if(f===J.INT)u=J.R32I}if(B===J.RG){if(f===J.FLOAT)u=J.RG32F;if(f===J.HALF_FLOAT)u=J.RG16F;if(f===J.UNSIGNED_BYTE)u=J.RG8}if(B===J.RG_INTEGER){if(f===J.UNSIGNED_BYTE)u=J.RG8UI;if(f===J.UNSIGNED_SHORT)u=J.RG16UI;if(f===J.UNSIGNED_INT)u=J.RG32UI;if(f===J.BYTE)u=J.RG8I;if(f===J.SHORT)u=J.RG16I;if(f===J.INT)u=J.RG32I}if(B===J.RGB_INTEGER){if(f===J.UNSIGNED_BYTE)u=J.RGB8UI;if(f===J.UNSIGNED_SHORT)u=J.RGB16UI;if(f===J.UNSIGNED_INT)u=J.RGB32UI;if(f===J.BYTE)u=J.RGB8I;if(f===J.SHORT)u=J.RGB16I;if(f===J.INT)u=J.RGB32I}if(B===J.RGBA_INTEGER){if(f===J.UNSIGNED_BYTE)u=J.RGBA8UI;if(f===J.UNSIGNED_SHORT)u=J.RGBA16UI;if(f===J.UNSIGNED_INT)u=J.RGBA32UI;if(f===J.BYTE)u=J.RGBA8I;if(f===J.SHORT)u=J.RGBA16I;if(f===J.INT)u=J.RGBA32I}if(B===J.RGB){if(f===J.UNSIGNED_INT_5_9_9_9_REV)u=J.RGB9_E5;if(f===J.UNSIGNED_INT_10F_11F_11F_REV)u=J.R11F_G11F_B10F}if(B===J.RGBA){let z0=t?$Z:e0.getTransfer(n);if(f===J.FLOAT)u=J.RGBA32F;if(f===J.HALF_FLOAT)u=J.RGBA16F;if(f===J.UNSIGNED_BYTE)u=z0===EJ?J.SRGB8_ALPHA8:J.RGBA8;if(f===J.UNSIGNED_SHORT_4_4_4_4)u=J.RGBA4;if(f===J.UNSIGNED_SHORT_5_5_5_1)u=J.RGB5_A1}if(u===J.R16F||u===J.R32F||u===J.RG16F||u===J.RG32F||u===J.RGBA16F||u===J.RGBA32F)Q.get("EXT_color_buffer_float");return u}function V(I,B){let f;if(I){if(B===null||B===d9||B===d8)f=J.DEPTH24_STENCIL8;else if(B===A9)f=J.DEPTH32F_STENCIL8;else if(B===S7)f=J.DEPTH24_STENCIL8,U0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(B===null||B===d9||B===d8)f=J.DEPTH_COMPONENT24;else if(B===A9)f=J.DEPTH_COMPONENT32F;else if(B===S7)f=J.DEPTH_COMPONENT16;return f}function w(I,B){if(F(I)===!0||I.isFramebufferTexture&&I.minFilter!==m9&&I.minFilter!==lJ)return Math.log2(Math.max(B.width,B.height))+1;else if(I.mipmaps!==void 0&&I.mipmaps.length>0)return I.mipmaps.length;else if(I.isCompressedTexture&&Array.isArray(I.image))return B.mipmaps.length;else return 1}function _(I){let B=I.target;if(B.removeEventListener("dispose",_),M(B),B.isVideoTexture)G.delete(B)}function A(I){let B=I.target;B.removeEventListener("dispose",A),h(B)}function M(I){let B=Z.get(I);if(B.__webglInit===void 0)return;let f=I.source,n=E.get(f);if(n){let t=n[B.__cacheKey];if(t.usedTimes--,t.usedTimes===0)C(I);if(Object.keys(n).length===0)E.delete(f)}Z.remove(I)}function C(I){let B=Z.get(I);J.deleteTexture(B.__webglTexture);let f=I.source,n=E.get(f);delete n[B.__cacheKey],H.memory.textures--}function h(I){let B=Z.get(I);if(I.depthTexture)I.depthTexture.dispose(),Z.remove(I.depthTexture);if(I.isWebGLCubeRenderTarget)for(let n=0;n<6;n++){if(Array.isArray(B.__webglFramebuffer[n]))for(let t=0;t<B.__webglFramebuffer[n].length;t++)J.deleteFramebuffer(B.__webglFramebuffer[n][t]);else J.deleteFramebuffer(B.__webglFramebuffer[n]);if(B.__webglDepthbuffer)J.deleteRenderbuffer(B.__webglDepthbuffer[n])}else{if(Array.isArray(B.__webglFramebuffer))for(let n=0;n<B.__webglFramebuffer.length;n++)J.deleteFramebuffer(B.__webglFramebuffer[n]);else J.deleteFramebuffer(B.__webglFramebuffer);if(B.__webglDepthbuffer)J.deleteRenderbuffer(B.__webglDepthbuffer);if(B.__webglMultisampledFramebuffer)J.deleteFramebuffer(B.__webglMultisampledFramebuffer);if(B.__webglColorRenderbuffer){for(let n=0;n<B.__webglColorRenderbuffer.length;n++)if(B.__webglColorRenderbuffer[n])J.deleteRenderbuffer(B.__webglColorRenderbuffer[n])}if(B.__webglDepthRenderbuffer)J.deleteRenderbuffer(B.__webglDepthRenderbuffer)}let f=I.textures;for(let n=0,t=f.length;n<t;n++){let u=Z.get(f[n]);if(u.__webglTexture)J.deleteTexture(u.__webglTexture),H.memory.textures--;Z.remove(f[n])}Z.remove(I)}let S=0;function b(){S=0}function l(){let I=S;if(I>=W.maxTextures)U0("WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+W.maxTextures);return S+=1,I}function v(I){let B=[];return B.push(I.wrapS),B.push(I.wrapT),B.push(I.wrapR||0),B.push(I.magFilter),B.push(I.minFilter),B.push(I.anisotropy),B.push(I.internalFormat),B.push(I.format),B.push(I.type),B.push(I.generateMipmaps),B.push(I.premultiplyAlpha),B.push(I.flipY),B.push(I.unpackAlignment),B.push(I.colorSpace),B.join()}function c(I,B){let f=Z.get(I);if(I.isVideoTexture)x0(I);if(I.isRenderTargetTexture===!1&&I.isExternalTexture!==!0&&I.version>0&&f.__version!==I.version){let n=I.image;if(n===null)U0("WebGLRenderer: Texture marked for update but no image data found.");else if(n.complete===!1)U0("WebGLRenderer: Texture marked for update but image is incomplete");else{E0(f,I,B);return}}else if(I.isExternalTexture)f.__webglTexture=I.sourceTexture?I.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,f.__webglTexture,J.TEXTURE0+B)}function x(I,B){let f=Z.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&f.__version!==I.version){E0(f,I,B);return}else if(I.isExternalTexture)f.__webglTexture=I.sourceTexture?I.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,f.__webglTexture,J.TEXTURE0+B)}function m(I,B){let f=Z.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&f.__version!==I.version){E0(f,I,B);return}$.bindTexture(J.TEXTURE_3D,f.__webglTexture,J.TEXTURE0+B)}function Q0(I,B){let f=Z.get(I);if(I.isCubeDepthTexture!==!0&&I.version>0&&f.__version!==I.version){B0(f,I,B);return}$.bindTexture(J.TEXTURE_CUBE_MAP,f.__webglTexture,J.TEXTURE0+B)}let $0={[jK]:J.REPEAT,[F6]:J.CLAMP_TO_EDGE,[yK]:J.MIRRORED_REPEAT},G0={[m9]:J.NEAREST,[vK]:J.NEAREST_MIPMAP_NEAREST,[T7]:J.NEAREST_MIPMAP_LINEAR,[lJ]:J.LINEAR,[R6]:J.LINEAR_MIPMAP_NEAREST,[H8]:J.LINEAR_MIPMAP_LINEAR},w0={[cK]:J.NEVER,[aK]:J.ALWAYS,[nK]:J.LESS,[V6]:J.LEQUAL,[sK]:J.EQUAL,[B6]:J.GEQUAL,[iK]:J.GREATER,[oK]:J.NOTEQUAL};function K0(I,B){if(B.type===A9&&Q.has("OES_texture_float_linear")===!1&&(B.magFilter===lJ||B.magFilter===R6||B.magFilter===T7||B.magFilter===H8||B.minFilter===lJ||B.minFilter===R6||B.minFilter===T7||B.minFilter===H8))U0("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(J.texParameteri(I,J.TEXTURE_WRAP_S,$0[B.wrapS]),J.texParameteri(I,J.TEXTURE_WRAP_T,$0[B.wrapT]),I===J.TEXTURE_3D||I===J.TEXTURE_2D_ARRAY)J.texParameteri(I,J.TEXTURE_WRAP_R,$0[B.wrapR]);if(J.texParameteri(I,J.TEXTURE_MAG_FILTER,G0[B.magFilter]),J.texParameteri(I,J.TEXTURE_MIN_FILTER,G0[B.minFilter]),B.compareFunction)J.texParameteri(I,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(I,J.TEXTURE_COMPARE_FUNC,w0[B.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(B.magFilter===m9)return;if(B.minFilter!==T7&&B.minFilter!==H8)return;if(B.type===A9&&Q.has("OES_texture_float_linear")===!1)return;if(B.anisotropy>1||Z.get(B).__currentAnisotropy){let f=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(I,f.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,W.getMaxAnisotropy())),Z.get(B).__currentAnisotropy=B.anisotropy}}}function HJ(I,B){let f=!1;if(I.__webglInit===void 0)I.__webglInit=!0,B.addEventListener("dispose",_);let n=B.source,t=E.get(n);if(t===void 0)t={},E.set(n,t);let u=v(B);if(u!==I.__cacheKey){if(t[u]===void 0)t[u]={texture:J.createTexture(),usedTimes:0},H.memory.textures++,f=!0;t[u].usedTimes++;let z0=t[I.__cacheKey];if(z0!==void 0){if(t[I.__cacheKey].usedTimes--,z0.usedTimes===0)C(B)}I.__cacheKey=u,I.__webglTexture=t[u].texture}return f}function WJ(I,B,f){return Math.floor(Math.floor(I/f)/B)}function s(I,B,f,n){let u=I.updateRanges;if(u.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,B.width,B.height,f,n,B.data);else{u.sort((J0,W0)=>J0.start-W0.start);let z0=0;for(let J0=1;J0<u.length;J0++){let W0=u[z0],A0=u[J0],g0=W0.start+W0.count,L0=WJ(A0.start,B.width,4),r0=WJ(W0.start,B.width,4);if(A0.start<=g0+1&&L0===r0&&WJ(A0.start+A0.count-1,B.width,4)===L0)W0.count=Math.max(W0.count,A0.start+A0.count-W0.start);else++z0,u[z0]=A0}u.length=z0+1;let D0=J.getParameter(J.UNPACK_ROW_LENGTH),j0=J.getParameter(J.UNPACK_SKIP_PIXELS),b0=J.getParameter(J.UNPACK_SKIP_ROWS);J.pixelStorei(J.UNPACK_ROW_LENGTH,B.width);for(let J0=0,W0=u.length;J0<W0;J0++){let A0=u[J0],g0=Math.floor(A0.start/4),L0=Math.ceil(A0.count/4),r0=g0%B.width,j=Math.floor(g0/B.width),Y0=L0,X0=1;J.pixelStorei(J.UNPACK_SKIP_PIXELS,r0),J.pixelStorei(J.UNPACK_SKIP_ROWS,j),$.texSubImage2D(J.TEXTURE_2D,0,r0,j,Y0,1,f,n,B.data)}I.clearUpdateRanges(),J.pixelStorei(J.UNPACK_ROW_LENGTH,D0),J.pixelStorei(J.UNPACK_SKIP_PIXELS,j0),J.pixelStorei(J.UNPACK_SKIP_ROWS,b0)}}function E0(I,B,f){let n=J.TEXTURE_2D;if(B.isDataArrayTexture||B.isCompressedArrayTexture)n=J.TEXTURE_2D_ARRAY;if(B.isData3DTexture)n=J.TEXTURE_3D;let t=HJ(I,B),u=B.source;$.bindTexture(n,I.__webglTexture,J.TEXTURE0+f);let z0=Z.get(u);if(u.version!==z0.__version||t===!0){$.activeTexture(J.TEXTURE0+f);let D0=e0.getPrimaries(e0.workingColorSpace),j0=B.colorSpace===U8?null:e0.getPrimaries(B.colorSpace),b0=B.colorSpace===U8||D0===j0?J.NONE:J.BROWSER_DEFAULT_WEBGL;J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,B.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,B.unpackAlignment),J.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,b0);let J0=O(B.image,!1,W.maxTextureSize);J0=H0(B,J0);let W0=K.convert(B.format,B.colorSpace),A0=K.convert(B.type),g0=L(B.internalFormat,W0,A0,B.colorSpace,B.isVideoTexture);K0(n,B);let L0,r0=B.mipmaps,j=B.isVideoTexture!==!0,Y0=z0.__version===void 0||t===!0,X0=u.dataReady,_0=w(B,J0);if(B.isDepthTexture){if(g0=V(B.format===X8,B.type),Y0)if(j)$.texStorage2D(J.TEXTURE_2D,1,g0,J0.width,J0.height);else $.texImage2D(J.TEXTURE_2D,0,g0,J0.width,J0.height,0,W0,A0,null)}else if(B.isDataTexture)if(r0.length>0){if(j&&Y0)$.texStorage2D(J.TEXTURE_2D,_0,g0,r0[0].width,r0[0].height);for(let i=0,o=r0.length;i<o;i++)if(L0=r0[i],j){if(X0)$.texSubImage2D(J.TEXTURE_2D,i,0,0,L0.width,L0.height,W0,A0,L0.data)}else $.texImage2D(J.TEXTURE_2D,i,g0,L0.width,L0.height,0,W0,A0,L0.data);B.generateMipmaps=!1}else if(j){if(Y0)$.texStorage2D(J.TEXTURE_2D,_0,g0,J0.width,J0.height);if(X0)s(B,J0,W0,A0)}else $.texImage2D(J.TEXTURE_2D,0,g0,J0.width,J0.height,0,W0,A0,J0.data);else if(B.isCompressedTexture)if(B.isCompressedArrayTexture){if(j&&Y0)$.texStorage3D(J.TEXTURE_2D_ARRAY,_0,g0,r0[0].width,r0[0].height,J0.depth);for(let i=0,o=r0.length;i<o;i++)if(L0=r0[i],B.format!==R9)if(W0!==null)if(j){if(X0)if(B.layerUpdates.size>0){let C0=eZ(L0.width,L0.height,B.format,B.type);for(let u0 of B.layerUpdates){let qJ=L0.data.subarray(u0*C0/L0.data.BYTES_PER_ELEMENT,(u0+1)*C0/L0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,u0,L0.width,L0.height,1,W0,qJ)}B.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,L0.width,L0.height,J0.depth,W0,L0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,i,g0,L0.width,L0.height,J0.depth,0,L0.data,0,0);else U0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(j){if(X0)$.texSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,L0.width,L0.height,J0.depth,W0,A0,L0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,i,g0,L0.width,L0.height,J0.depth,0,W0,A0,L0.data)}else{if(j&&Y0)$.texStorage2D(J.TEXTURE_2D,_0,g0,r0[0].width,r0[0].height);for(let i=0,o=r0.length;i<o;i++)if(L0=r0[i],B.format!==R9)if(W0!==null)if(j){if(X0)$.compressedTexSubImage2D(J.TEXTURE_2D,i,0,0,L0.width,L0.height,W0,L0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,i,g0,L0.width,L0.height,0,L0.data);else U0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(j){if(X0)$.texSubImage2D(J.TEXTURE_2D,i,0,0,L0.width,L0.height,W0,A0,L0.data)}else $.texImage2D(J.TEXTURE_2D,i,g0,L0.width,L0.height,0,W0,A0,L0.data)}else if(B.isDataArrayTexture)if(j){if(Y0)$.texStorage3D(J.TEXTURE_2D_ARRAY,_0,g0,J0.width,J0.height,J0.depth);if(X0)if(B.layerUpdates.size>0){let i=eZ(J0.width,J0.height,B.format,B.type);for(let o of B.layerUpdates){let C0=J0.data.subarray(o*i/J0.data.BYTES_PER_ELEMENT,(o+1)*i/J0.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,o,J0.width,J0.height,1,W0,A0,C0)}B.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,J0.width,J0.height,J0.depth,W0,A0,J0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,g0,J0.width,J0.height,J0.depth,0,W0,A0,J0.data);else if(B.isData3DTexture)if(j){if(Y0)$.texStorage3D(J.TEXTURE_3D,_0,g0,J0.width,J0.height,J0.depth);if(X0)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,J0.width,J0.height,J0.depth,W0,A0,J0.data)}else $.texImage3D(J.TEXTURE_3D,0,g0,J0.width,J0.height,J0.depth,0,W0,A0,J0.data);else if(B.isFramebufferTexture){if(Y0)if(j)$.texStorage2D(J.TEXTURE_2D,_0,g0,J0.width,J0.height);else{let{width:i,height:o}=J0;for(let C0=0;C0<_0;C0++)$.texImage2D(J.TEXTURE_2D,C0,g0,i,o,0,W0,A0,null),i>>=1,o>>=1}}else if(r0.length>0){if(j&&Y0){let i=d0(r0[0]);$.texStorage2D(J.TEXTURE_2D,_0,g0,i.width,i.height)}for(let i=0,o=r0.length;i<o;i++)if(L0=r0[i],j){if(X0)$.texSubImage2D(J.TEXTURE_2D,i,0,0,W0,A0,L0)}else $.texImage2D(J.TEXTURE_2D,i,g0,W0,A0,L0);B.generateMipmaps=!1}else if(j){if(Y0){let i=d0(J0);$.texStorage2D(J.TEXTURE_2D,_0,g0,i.width,i.height)}if(X0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,W0,A0,J0)}else $.texImage2D(J.TEXTURE_2D,0,g0,W0,A0,J0);if(F(B))D(n);if(z0.__version=u.version,B.onUpdate)B.onUpdate(B)}I.__version=B.version}function B0(I,B,f){if(B.image.length!==6)return;let n=HJ(I,B),t=B.source;$.bindTexture(J.TEXTURE_CUBE_MAP,I.__webglTexture,J.TEXTURE0+f);let u=Z.get(t);if(t.version!==u.__version||n===!0){$.activeTexture(J.TEXTURE0+f);let z0=e0.getPrimaries(e0.workingColorSpace),D0=B.colorSpace===U8?null:e0.getPrimaries(B.colorSpace),j0=B.colorSpace===U8||z0===D0?J.NONE:J.BROWSER_DEFAULT_WEBGL;J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,B.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,B.unpackAlignment),J.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,j0);let b0=B.isCompressedTexture||B.image[0].isCompressedTexture,J0=B.image[0]&&B.image[0].isDataTexture,W0=[];for(let o=0;o<6;o++){if(!b0&&!J0)W0[o]=O(B.image[o],!0,W.maxCubemapSize);else W0[o]=J0?B.image[o].image:B.image[o];W0[o]=H0(B,W0[o])}let A0=W0[0],g0=K.convert(B.format,B.colorSpace),L0=K.convert(B.type),r0=L(B.internalFormat,g0,L0,B.colorSpace),j=B.isVideoTexture!==!0,Y0=u.__version===void 0||n===!0,X0=t.dataReady,_0=w(B,A0);K0(J.TEXTURE_CUBE_MAP,B);let i;if(b0){if(j&&Y0)$.texStorage2D(J.TEXTURE_CUBE_MAP,_0,r0,A0.width,A0.height);for(let o=0;o<6;o++){i=W0[o].mipmaps;for(let C0=0;C0<i.length;C0++){let u0=i[C0];if(B.format!==R9)if(g0!==null)if(j){if(X0)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0,0,0,u0.width,u0.height,g0,u0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0,r0,u0.width,u0.height,0,u0.data);else U0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(j){if(X0)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0,0,0,u0.width,u0.height,g0,L0,u0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0,r0,u0.width,u0.height,0,g0,L0,u0.data)}}}else{if(i=B.mipmaps,j&&Y0){if(i.length>0)_0++;let o=d0(W0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,_0,r0,o.width,o.height)}for(let o=0;o<6;o++)if(J0){if(j){if(X0)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,W0[o].width,W0[o].height,g0,L0,W0[o].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,r0,W0[o].width,W0[o].height,0,g0,L0,W0[o].data);for(let C0=0;C0<i.length;C0++){let qJ=i[C0].image[o].image;if(j){if(X0)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0+1,0,0,qJ.width,qJ.height,g0,L0,qJ.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0+1,r0,qJ.width,qJ.height,0,g0,L0,qJ.data)}}else{if(j){if(X0)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,g0,L0,W0[o])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,r0,g0,L0,W0[o]);for(let C0=0;C0<i.length;C0++){let u0=i[C0];if(j){if(X0)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0+1,0,0,g0,L0,u0.image[o])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,C0+1,r0,g0,L0,u0.image[o])}}}if(F(B))D(J.TEXTURE_CUBE_MAP);if(u.__version=t.version,B.onUpdate)B.onUpdate(B)}I.__version=B.version}function q0(I,B,f,n,t,u){let z0=K.convert(f.format,f.colorSpace),D0=K.convert(f.type),j0=L(f.internalFormat,z0,D0,f.colorSpace),b0=Z.get(B),J0=Z.get(f);if(J0.__renderTarget=B,!b0.__hasExternalTextures){let W0=Math.max(1,B.width>>u),A0=Math.max(1,B.height>>u);if(t===J.TEXTURE_3D||t===J.TEXTURE_2D_ARRAY)$.texImage3D(t,u,j0,W0,A0,B.depth,0,z0,D0,null);else $.texImage2D(t,u,j0,W0,A0,0,z0,D0,null)}if($.bindFramebuffer(J.FRAMEBUFFER,I),N0(B))Y.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,n,t,J0.__webglTexture,0,h0(B));else if(t===J.TEXTURE_2D||t>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&t<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,n,t,J0.__webglTexture,u);$.bindFramebuffer(J.FRAMEBUFFER,null)}function f0(I,B,f){if(J.bindRenderbuffer(J.RENDERBUFFER,I),B.depthBuffer){let n=B.depthTexture,t=n&&n.isDepthTexture?n.type:null,u=V(B.stencilBuffer,t),z0=B.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(N0(B))Y.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,h0(B),u,B.width,B.height);else if(f)J.renderbufferStorageMultisample(J.RENDERBUFFER,h0(B),u,B.width,B.height);else J.renderbufferStorage(J.RENDERBUFFER,u,B.width,B.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,z0,J.RENDERBUFFER,I)}else{let n=B.textures;for(let t=0;t<n.length;t++){let u=n[t],z0=K.convert(u.format,u.colorSpace),D0=K.convert(u.type),j0=L(u.internalFormat,z0,D0,u.colorSpace);if(N0(B))Y.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,h0(B),j0,B.width,B.height);else if(f)J.renderbufferStorageMultisample(J.RENDERBUFFER,h0(B),j0,B.width,B.height);else J.renderbufferStorage(J.RENDERBUFFER,j0,B.width,B.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function JJ(I,B,f){let n=B.isWebGLCubeRenderTarget===!0;if($.bindFramebuffer(J.FRAMEBUFFER,I),!(B.depthTexture&&B.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let t=Z.get(B.depthTexture);if(t.__renderTarget=B,!t.__webglTexture||B.depthTexture.image.width!==B.width||B.depthTexture.image.height!==B.height)B.depthTexture.image.width=B.width,B.depthTexture.image.height=B.height,B.depthTexture.needsUpdate=!0;if(n){if(t.__webglInit===void 0)t.__webglInit=!0,B.depthTexture.addEventListener("dispose",_);if(t.__webglTexture===void 0){t.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,t.__webglTexture),K0(J.TEXTURE_CUBE_MAP,B.depthTexture);let b0=K.convert(B.depthTexture.format),J0=K.convert(B.depthTexture.type),W0;if(B.depthTexture.format===Y8)W0=J.DEPTH_COMPONENT24;else if(B.depthTexture.format===X8)W0=J.DEPTH24_STENCIL8;for(let A0=0;A0<6;A0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+A0,0,W0,B.width,B.height,0,b0,J0,null)}}else c(B.depthTexture,0);let u=t.__webglTexture,z0=h0(B),D0=n?J.TEXTURE_CUBE_MAP_POSITIVE_X+f:J.TEXTURE_2D,j0=B.depthTexture.format===X8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(B.depthTexture.format===Y8)if(N0(B))Y.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,j0,D0,u,0,z0);else J.framebufferTexture2D(J.FRAMEBUFFER,j0,D0,u,0);else if(B.depthTexture.format===X8)if(N0(B))Y.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,j0,D0,u,0,z0);else J.framebufferTexture2D(J.FRAMEBUFFER,j0,D0,u,0);else throw Error("Unknown depthTexture format")}function n0(I){let B=Z.get(I),f=I.isWebGLCubeRenderTarget===!0;if(B.__boundDepthTexture!==I.depthTexture){let n=I.depthTexture;if(B.__depthDisposeCallback)B.__depthDisposeCallback();if(n){let t=()=>{delete B.__boundDepthTexture,delete B.__depthDisposeCallback,n.removeEventListener("dispose",t)};n.addEventListener("dispose",t),B.__depthDisposeCallback=t}B.__boundDepthTexture=n}if(I.depthTexture&&!B.__autoAllocateDepthBuffer)if(f)for(let n=0;n<6;n++)JJ(B.__webglFramebuffer[n],I,n);else{let n=I.texture.mipmaps;if(n&&n.length>0)JJ(B.__webglFramebuffer[0],I,0);else JJ(B.__webglFramebuffer,I,0)}else if(f){B.__webglDepthbuffer=[];for(let n=0;n<6;n++)if($.bindFramebuffer(J.FRAMEBUFFER,B.__webglFramebuffer[n]),B.__webglDepthbuffer[n]===void 0)B.__webglDepthbuffer[n]=J.createRenderbuffer(),f0(B.__webglDepthbuffer[n],I,!1);else{let t=I.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,u=B.__webglDepthbuffer[n];J.bindRenderbuffer(J.RENDERBUFFER,u),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,u)}}else{let n=I.texture.mipmaps;if(n&&n.length>0)$.bindFramebuffer(J.FRAMEBUFFER,B.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,B.__webglFramebuffer);if(B.__webglDepthbuffer===void 0)B.__webglDepthbuffer=J.createRenderbuffer(),f0(B.__webglDepthbuffer,I,!1);else{let t=I.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,u=B.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,u),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,u)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function s0(I,B,f){let n=Z.get(I);if(B!==void 0)q0(n.__webglFramebuffer,I,I.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(f!==void 0)n0(I)}function a(I){let B=I.texture,f=Z.get(I),n=Z.get(B);I.addEventListener("dispose",A);let t=I.textures,u=I.isWebGLCubeRenderTarget===!0,z0=t.length>1;if(!z0){if(n.__webglTexture===void 0)n.__webglTexture=J.createTexture();n.__version=B.version,H.memory.textures++}if(u){f.__webglFramebuffer=[];for(let D0=0;D0<6;D0++)if(B.mipmaps&&B.mipmaps.length>0){f.__webglFramebuffer[D0]=[];for(let j0=0;j0<B.mipmaps.length;j0++)f.__webglFramebuffer[D0][j0]=J.createFramebuffer()}else f.__webglFramebuffer[D0]=J.createFramebuffer()}else{if(B.mipmaps&&B.mipmaps.length>0){f.__webglFramebuffer=[];for(let D0=0;D0<B.mipmaps.length;D0++)f.__webglFramebuffer[D0]=J.createFramebuffer()}else f.__webglFramebuffer=J.createFramebuffer();if(z0)for(let D0=0,j0=t.length;D0<j0;D0++){let b0=Z.get(t[D0]);if(b0.__webglTexture===void 0)b0.__webglTexture=J.createTexture(),H.memory.textures++}if(I.samples>0&&N0(I)===!1){f.__webglMultisampledFramebuffer=J.createFramebuffer(),f.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,f.__webglMultisampledFramebuffer);for(let D0=0;D0<t.length;D0++){let j0=t[D0];f.__webglColorRenderbuffer[D0]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,f.__webglColorRenderbuffer[D0]);let b0=K.convert(j0.format,j0.colorSpace),J0=K.convert(j0.type),W0=L(j0.internalFormat,b0,J0,j0.colorSpace,I.isXRRenderTarget===!0),A0=h0(I);J.renderbufferStorageMultisample(J.RENDERBUFFER,A0,W0,I.width,I.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+D0,J.RENDERBUFFER,f.__webglColorRenderbuffer[D0])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),I.depthBuffer)f.__webglDepthRenderbuffer=J.createRenderbuffer(),f0(f.__webglDepthRenderbuffer,I,!0);$.bindFramebuffer(J.FRAMEBUFFER,null)}}if(u){$.bindTexture(J.TEXTURE_CUBE_MAP,n.__webglTexture),K0(J.TEXTURE_CUBE_MAP,B);for(let D0=0;D0<6;D0++)if(B.mipmaps&&B.mipmaps.length>0)for(let j0=0;j0<B.mipmaps.length;j0++)q0(f.__webglFramebuffer[D0][j0],I,B,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+D0,j0);else q0(f.__webglFramebuffer[D0],I,B,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+D0,0);if(F(B))D(J.TEXTURE_CUBE_MAP);$.unbindTexture()}else if(z0){for(let D0=0,j0=t.length;D0<j0;D0++){let b0=t[D0],J0=Z.get(b0),W0=J.TEXTURE_2D;if(I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)W0=I.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(W0,J0.__webglTexture),K0(W0,b0),q0(f.__webglFramebuffer,I,b0,J.COLOR_ATTACHMENT0+D0,W0,0),F(b0))D(W0)}$.unbindTexture()}else{let D0=J.TEXTURE_2D;if(I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)D0=I.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(D0,n.__webglTexture),K0(D0,B),B.mipmaps&&B.mipmaps.length>0)for(let j0=0;j0<B.mipmaps.length;j0++)q0(f.__webglFramebuffer[j0],I,B,J.COLOR_ATTACHMENT0,D0,j0);else q0(f.__webglFramebuffer,I,B,J.COLOR_ATTACHMENT0,D0,0);if(F(B))D(D0);$.unbindTexture()}if(I.depthBuffer)n0(I)}function Z0(I){let B=I.textures;for(let f=0,n=B.length;f<n;f++){let t=B[f];if(F(t)){let u=k(I),z0=Z.get(t).__webglTexture;$.bindTexture(u,z0),D(u),$.unbindTexture()}}}let e=[],R0=[];function T(I){if(I.samples>0){if(N0(I)===!1){let{textures:B,width:f,height:n}=I,t=J.COLOR_BUFFER_BIT,u=I.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,z0=Z.get(I),D0=B.length>1;if(D0)for(let b0=0;b0<B.length;b0++)$.bindFramebuffer(J.FRAMEBUFFER,z0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+b0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,z0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+b0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,z0.__webglMultisampledFramebuffer);let j0=I.texture.mipmaps;if(j0&&j0.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,z0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,z0.__webglFramebuffer);for(let b0=0;b0<B.length;b0++){if(I.resolveDepthBuffer){if(I.depthBuffer)t|=J.DEPTH_BUFFER_BIT;if(I.stencilBuffer&&I.resolveStencilBuffer)t|=J.STENCIL_BUFFER_BIT}if(D0){J.framebufferRenderbuffer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.RENDERBUFFER,z0.__webglColorRenderbuffer[b0]);let J0=Z.get(B[b0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,J0,0)}if(J.blitFramebuffer(0,0,f,n,0,0,f,n,t,J.NEAREST),X===!0){if(e.length=0,R0.length=0,e.push(J.COLOR_ATTACHMENT0+b0),I.depthBuffer&&I.resolveDepthBuffer===!1)e.push(u),R0.push(u),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,R0);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,e)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),D0)for(let b0=0;b0<B.length;b0++){$.bindFramebuffer(J.FRAMEBUFFER,z0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+b0,J.RENDERBUFFER,z0.__webglColorRenderbuffer[b0]);let J0=Z.get(B[b0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,z0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+b0,J.TEXTURE_2D,J0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,z0.__webglMultisampledFramebuffer)}else if(I.depthBuffer&&I.resolveDepthBuffer===!1&&X){let B=I.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,[B])}}}function h0(I){return Math.min(W.maxSamples,I.samples)}function N0(I){let B=Z.get(I);return I.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&B.__useRenderToTexture!==!1}function x0(I){let B=H.render.frame;if(G.get(I)!==B)G.set(I,B),I.update()}function H0(I,B){let{colorSpace:f,format:n,type:t}=I;if(I.isCompressedTexture===!0||I.isVideoTexture===!0)return B;if(f!==j7&&f!==U8)if(e0.getTransfer(f)===EJ){if(n!==R9||t!==K9)U0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else S0("WebGLTextures: Unsupported texture color space:",f);return B}function d0(I){if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement)U.width=I.naturalWidth||I.width,U.height=I.naturalHeight||I.height;else if(typeof VideoFrame<"u"&&I instanceof VideoFrame)U.width=I.displayWidth,U.height=I.displayHeight;else U.width=I.width,U.height=I.height;return U}this.allocateTextureUnit=l,this.resetTextureUnits=b,this.setTexture2D=c,this.setTexture2DArray=x,this.setTexture3D=m,this.setTextureCube=Q0,this.rebindTextures=s0,this.setupRenderTarget=a,this.updateRenderTargetMipmap=Z0,this.updateMultisampleRenderTarget=T,this.setupDepthRenderbuffer=n0,this.setupFrameBufferTexture=q0,this.useMultisampledRTT=N0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function sG(J,Q){function $(Z,W=U8){let K,H=e0.getTransfer(W);if(Z===K9)return J.UNSIGNED_BYTE;if(Z===M$)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===L$)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===hK)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===xK)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===fK)return J.BYTE;if(Z===bK)return J.SHORT;if(Z===S7)return J.UNSIGNED_SHORT;if(Z===k$)return J.INT;if(Z===d9)return J.UNSIGNED_INT;if(Z===A9)return J.FLOAT;if(Z===C9)return J.HALF_FLOAT;if(Z===gK)return J.ALPHA;if(Z===pK)return J.RGB;if(Z===R9)return J.RGBA;if(Z===Y8)return J.DEPTH_COMPONENT;if(Z===X8)return J.DEPTH_STENCIL;if(Z===mK)return J.RED;if(Z===V$)return J.RED_INTEGER;if(Z===l8)return J.RG;if(Z===B$)return J.RG_INTEGER;if(Z===z$)return J.RGBA_INTEGER;if(Z===O6||Z===k6||Z===M6||Z===L6)if(H===EJ)if(K=Q.get("WEBGL_compressed_texture_s3tc_srgb"),K!==null){if(Z===O6)return K.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===k6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===M6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===L6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(K=Q.get("WEBGL_compressed_texture_s3tc"),K!==null){if(Z===O6)return K.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===k6)return K.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===M6)return K.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===L6)return K.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===I$||Z===_$||Z===A$||Z===C$)if(K=Q.get("WEBGL_compressed_texture_pvrtc"),K!==null){if(Z===I$)return K.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===_$)return K.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===A$)return K.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===C$)return K.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===w$||Z===P$||Z===T$||Z===S$||Z===j$||Z===y$||Z===v$)if(K=Q.get("WEBGL_compressed_texture_etc"),K!==null){if(Z===w$||Z===P$)return H===EJ?K.COMPRESSED_SRGB8_ETC2:K.COMPRESSED_RGB8_ETC2;if(Z===T$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:K.COMPRESSED_RGBA8_ETC2_EAC;if(Z===S$)return K.COMPRESSED_R11_EAC;if(Z===j$)return K.COMPRESSED_SIGNED_R11_EAC;if(Z===y$)return K.COMPRESSED_RG11_EAC;if(Z===v$)return K.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===f$||Z===b$||Z===h$||Z===x$||Z===g$||Z===p$||Z===m$||Z===d$||Z===l$||Z===u$||Z===c$||Z===n$||Z===s$||Z===i$)if(K=Q.get("WEBGL_compressed_texture_astc"),K!==null){if(Z===f$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:K.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===b$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:K.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===h$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:K.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===x$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:K.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===g$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:K.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===p$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:K.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===m$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:K.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===d$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:K.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===l$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:K.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===u$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:K.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===c$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:K.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===n$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:K.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===s$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:K.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===i$)return H===EJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:K.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===o$||Z===a$||Z===r$)if(K=Q.get("EXT_texture_compression_bptc"),K!==null){if(Z===o$)return H===EJ?K.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:K.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===a$)return K.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===r$)return K.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===t$||Z===e$||Z===JZ||Z===QZ)if(K=Q.get("EXT_texture_compression_rgtc"),K!==null){if(Z===t$)return K.COMPRESSED_RED_RGTC1_EXT;if(Z===e$)return K.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===JZ)return K.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===QZ)return K.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===d8)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}class iG{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new y6(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 iJ({vertexShader:j1,fragmentShader:y1,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new kJ(new c8(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}function f1(J,Q){function $(F,D){if(F.matrixAutoUpdate===!0)F.updateMatrix();D.value.copy(F.matrix)}function Z(F,D){if(D.color.getRGB(F.fogColor.value,DH(J)),D.isFog)F.fogNear.value=D.near,F.fogFar.value=D.far;else if(D.isFogExp2)F.fogDensity.value=D.density}function W(F,D,k,L,V){if(D.isMeshBasicMaterial)K(F,D);else if(D.isMeshLambertMaterial){if(K(F,D),D.envMap)F.envMapIntensity.value=D.envMapIntensity}else if(D.isMeshToonMaterial)K(F,D),N(F,D);else if(D.isMeshPhongMaterial){if(K(F,D),G(F,D),D.envMap)F.envMapIntensity.value=D.envMapIntensity}else if(D.isMeshStandardMaterial){if(K(F,D),E(F,D),D.isMeshPhysicalMaterial)q(F,D,V)}else if(D.isMeshMatcapMaterial)K(F,D),R(F,D);else if(D.isMeshDepthMaterial)K(F,D);else if(D.isMeshDistanceMaterial)K(F,D),O(F,D);else if(D.isMeshNormalMaterial)K(F,D);else if(D.isLineBasicMaterial){if(H(F,D),D.isLineDashedMaterial)Y(F,D)}else if(D.isPointsMaterial)X(F,D,k,L);else if(D.isSpriteMaterial)U(F,D);else if(D.isShadowMaterial)F.color.value.copy(D.color),F.opacity.value=D.opacity;else if(D.isShaderMaterial)D.uniformsNeedUpdate=!1}function K(F,D){if(F.opacity.value=D.opacity,D.color)F.diffuse.value.copy(D.color);if(D.emissive)F.emissive.value.copy(D.emissive).multiplyScalar(D.emissiveIntensity);if(D.map)F.map.value=D.map,$(D.map,F.mapTransform);if(D.alphaMap)F.alphaMap.value=D.alphaMap,$(D.alphaMap,F.alphaMapTransform);if(D.bumpMap){if(F.bumpMap.value=D.bumpMap,$(D.bumpMap,F.bumpMapTransform),F.bumpScale.value=D.bumpScale,D.side===dJ)F.bumpScale.value*=-1}if(D.normalMap){if(F.normalMap.value=D.normalMap,$(D.normalMap,F.normalMapTransform),F.normalScale.value.copy(D.normalScale),D.side===dJ)F.normalScale.value.negate()}if(D.displacementMap)F.displacementMap.value=D.displacementMap,$(D.displacementMap,F.displacementMapTransform),F.displacementScale.value=D.displacementScale,F.displacementBias.value=D.displacementBias;if(D.emissiveMap)F.emissiveMap.value=D.emissiveMap,$(D.emissiveMap,F.emissiveMapTransform);if(D.specularMap)F.specularMap.value=D.specularMap,$(D.specularMap,F.specularMapTransform);if(D.alphaTest>0)F.alphaTest.value=D.alphaTest;let k=Q.get(D),L=k.envMap,V=k.envMapRotation;if(L){if(F.envMap.value=L,a8.copy(V),a8.x*=-1,a8.y*=-1,a8.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1)a8.y*=-1,a8.z*=-1;F.envMapRotation.value.setFromMatrix4(v1.makeRotationFromEuler(a8)),F.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,F.reflectivity.value=D.reflectivity,F.ior.value=D.ior,F.refractionRatio.value=D.refractionRatio}if(D.lightMap)F.lightMap.value=D.lightMap,F.lightMapIntensity.value=D.lightMapIntensity,$(D.lightMap,F.lightMapTransform);if(D.aoMap)F.aoMap.value=D.aoMap,F.aoMapIntensity.value=D.aoMapIntensity,$(D.aoMap,F.aoMapTransform)}function H(F,D){if(F.diffuse.value.copy(D.color),F.opacity.value=D.opacity,D.map)F.map.value=D.map,$(D.map,F.mapTransform)}function Y(F,D){F.dashSize.value=D.dashSize,F.totalSize.value=D.dashSize+D.gapSize,F.scale.value=D.scale}function X(F,D,k,L){if(F.diffuse.value.copy(D.color),F.opacity.value=D.opacity,F.size.value=D.size*k,F.scale.value=L*0.5,D.map)F.map.value=D.map,$(D.map,F.uvTransform);if(D.alphaMap)F.alphaMap.value=D.alphaMap,$(D.alphaMap,F.alphaMapTransform);if(D.alphaTest>0)F.alphaTest.value=D.alphaTest}function U(F,D){if(F.diffuse.value.copy(D.color),F.opacity.value=D.opacity,F.rotation.value=D.rotation,D.map)F.map.value=D.map,$(D.map,F.mapTransform);if(D.alphaMap)F.alphaMap.value=D.alphaMap,$(D.alphaMap,F.alphaMapTransform);if(D.alphaTest>0)F.alphaTest.value=D.alphaTest}function G(F,D){F.specular.value.copy(D.specular),F.shininess.value=Math.max(D.shininess,0.0001)}function N(F,D){if(D.gradientMap)F.gradientMap.value=D.gradientMap}function E(F,D){if(F.metalness.value=D.metalness,D.metalnessMap)F.metalnessMap.value=D.metalnessMap,$(D.metalnessMap,F.metalnessMapTransform);if(F.roughness.value=D.roughness,D.roughnessMap)F.roughnessMap.value=D.roughnessMap,$(D.roughnessMap,F.roughnessMapTransform);if(D.envMap)F.envMapIntensity.value=D.envMapIntensity}function q(F,D,k){if(F.ior.value=D.ior,D.sheen>0){if(F.sheenColor.value.copy(D.sheenColor).multiplyScalar(D.sheen),F.sheenRoughness.value=D.sheenRoughness,D.sheenColorMap)F.sheenColorMap.value=D.sheenColorMap,$(D.sheenColorMap,F.sheenColorMapTransform);if(D.sheenRoughnessMap)F.sheenRoughnessMap.value=D.sheenRoughnessMap,$(D.sheenRoughnessMap,F.sheenRoughnessMapTransform)}if(D.clearcoat>0){if(F.clearcoat.value=D.clearcoat,F.clearcoatRoughness.value=D.clearcoatRoughness,D.clearcoatMap)F.clearcoatMap.value=D.clearcoatMap,$(D.clearcoatMap,F.clearcoatMapTransform);if(D.clearcoatRoughnessMap)F.clearcoatRoughnessMap.value=D.clearcoatRoughnessMap,$(D.clearcoatRoughnessMap,F.clearcoatRoughnessMapTransform);if(D.clearcoatNormalMap){if(F.clearcoatNormalMap.value=D.clearcoatNormalMap,$(D.clearcoatNormalMap,F.clearcoatNormalMapTransform),F.clearcoatNormalScale.value.copy(D.clearcoatNormalScale),D.side===dJ)F.clearcoatNormalScale.value.negate()}}if(D.dispersion>0)F.dispersion.value=D.dispersion;if(D.iridescence>0){if(F.iridescence.value=D.iridescence,F.iridescenceIOR.value=D.iridescenceIOR,F.iridescenceThicknessMinimum.value=D.iridescenceThicknessRange[0],F.iridescenceThicknessMaximum.value=D.iridescenceThicknessRange[1],D.iridescenceMap)F.iridescenceMap.value=D.iridescenceMap,$(D.iridescenceMap,F.iridescenceMapTransform);if(D.iridescenceThicknessMap)F.iridescenceThicknessMap.value=D.iridescenceThicknessMap,$(D.iridescenceThicknessMap,F.iridescenceThicknessMapTransform)}if(D.transmission>0){if(F.transmission.value=D.transmission,F.transmissionSamplerMap.value=k.texture,F.transmissionSamplerSize.value.set(k.width,k.height),D.transmissionMap)F.transmissionMap.value=D.transmissionMap,$(D.transmissionMap,F.transmissionMapTransform);if(F.thickness.value=D.thickness,D.thicknessMap)F.thicknessMap.value=D.thicknessMap,$(D.thicknessMap,F.thicknessMapTransform);F.attenuationDistance.value=D.attenuationDistance,F.attenuationColor.value.copy(D.attenuationColor)}if(D.anisotropy>0){if(F.anisotropyVector.value.set(D.anisotropy*Math.cos(D.anisotropyRotation),D.anisotropy*Math.sin(D.anisotropyRotation)),D.anisotropyMap)F.anisotropyMap.value=D.anisotropyMap,$(D.anisotropyMap,F.anisotropyMapTransform)}if(F.specularIntensity.value=D.specularIntensity,F.specularColor.value.copy(D.specularColor),D.specularColorMap)F.specularColorMap.value=D.specularColorMap,$(D.specularColorMap,F.specularColorMapTransform);if(D.specularIntensityMap)F.specularIntensityMap.value=D.specularIntensityMap,$(D.specularIntensityMap,F.specularIntensityMapTransform)}function R(F,D){if(D.matcap)F.matcap.value=D.matcap}function O(F,D){let k=Q.get(D).light;F.referencePosition.value.setFromMatrixPosition(k.matrixWorld),F.nearDistance.value=k.shadow.camera.near,F.farDistance.value=k.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function b1(J,Q,$,Z){let W={},K={},H=[],Y=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function X(k,L){let V=L.program;Z.uniformBlockBinding(k,V)}function U(k,L){let V=W[k.id];if(V===void 0)R(k),V=G(k),W[k.id]=V,k.addEventListener("dispose",F);let w=L.program;Z.updateUBOMapping(k,w);let _=Q.render.frame;if(K[k.id]!==_)E(k),K[k.id]=_}function G(k){let L=N();k.__bindingPointIndex=L;let V=J.createBuffer(),w=k.__size,_=k.usage;return J.bindBuffer(J.UNIFORM_BUFFER,V),J.bufferData(J.UNIFORM_BUFFER,w,_),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,L,V),V}function N(){for(let k=0;k<Y;k++)if(H.indexOf(k)===-1)return H.push(k),k;return S0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(k){let L=W[k.id],V=k.uniforms,w=k.__cache;J.bindBuffer(J.UNIFORM_BUFFER,L);for(let _=0,A=V.length;_<A;_++){let M=Array.isArray(V[_])?V[_]:[V[_]];for(let C=0,h=M.length;C<h;C++){let S=M[C];if(q(S,_,C,w)===!0){let b=S.__offset,l=Array.isArray(S.value)?S.value:[S.value],v=0;for(let c=0;c<l.length;c++){let x=l[c],m=O(x);if(typeof x==="number"||typeof x==="boolean")S.__data[0]=x,J.bufferSubData(J.UNIFORM_BUFFER,b+v,S.__data);else if(x.isMatrix3)S.__data[0]=x.elements[0],S.__data[1]=x.elements[1],S.__data[2]=x.elements[2],S.__data[3]=0,S.__data[4]=x.elements[3],S.__data[5]=x.elements[4],S.__data[6]=x.elements[5],S.__data[7]=0,S.__data[8]=x.elements[6],S.__data[9]=x.elements[7],S.__data[10]=x.elements[8],S.__data[11]=0;else x.toArray(S.__data,v),v+=m.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,b,S.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function q(k,L,V,w){let _=k.value,A=L+"_"+V;if(w[A]===void 0){if(typeof _==="number"||typeof _==="boolean")w[A]=_;else w[A]=_.clone();return!0}else{let M=w[A];if(typeof _==="number"||typeof _==="boolean"){if(M!==_)return w[A]=_,!0}else if(M.equals(_)===!1)return M.copy(_),!0}return!1}function R(k){let L=k.uniforms,V=0,w=16;for(let A=0,M=L.length;A<M;A++){let C=Array.isArray(L[A])?L[A]:[L[A]];for(let h=0,S=C.length;h<S;h++){let b=C[h],l=Array.isArray(b.value)?b.value:[b.value];for(let v=0,c=l.length;v<c;v++){let x=l[v],m=O(x),Q0=V%w,$0=Q0%m.boundary,G0=Q0+$0;if(V+=$0,G0!==0&&w-G0<m.storage)V+=w-G0;b.__data=new Float32Array(m.storage/Float32Array.BYTES_PER_ELEMENT),b.__offset=V,V+=m.storage}}}let _=V%w;if(_>0)V+=w-_;return k.__size=V,k.__cache={},this}function O(k){let L={boundary:0,storage:0};if(typeof k==="number"||typeof k==="boolean")L.boundary=4,L.storage=4;else if(k.isVector2)L.boundary=8,L.storage=8;else if(k.isVector3||k.isColor)L.boundary=16,L.storage=12;else if(k.isVector4)L.boundary=16,L.storage=16;else if(k.isMatrix3)L.boundary=48,L.storage=48;else if(k.isMatrix4)L.boundary=64,L.storage=64;else if(k.isTexture)U0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else U0("WebGLRenderer: Unsupported uniform value type.",k);return L}function F(k){let L=k.target;L.removeEventListener("dispose",F);let V=H.indexOf(L.__bindingPointIndex);H.splice(V,1),J.deleteBuffer(W[L.id]),delete W[L.id],delete K[L.id]}function D(){for(let k in W)J.deleteBuffer(W[k]);H=[],W={},K={}}return{bind:X,update:U,dispose:D}}function x1(){if(T9===null)T9=new J9(h1,16,16,l8,C9),T9.name="DFG_LUT",T9.minFilter=lJ,T9.magFilter=lJ,T9.wrapS=F6,T9.wrapT=F6,T9.generateMipmaps=!1,T9.needsUpdate=!0;return T9}class aG{constructor(J={}){let{canvas:Q=rK(),context:$=null,depth:Z=!0,stencil:W=!1,alpha:K=!1,antialias:H=!1,premultipliedAlpha:Y=!0,preserveDrawingBuffer:X=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:G=!1,reversedDepthBuffer:N=!1,outputBufferType:E=K9}=J;this.isWebGLRenderer=!0;let q;if($!==null){if(typeof WebGLRenderingContext<"u"&&$ instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");q=$.getContextAttributes().alpha}else q=K;let R=E,O=new Set([z$,B$,V$]),F=new Set([K9,d9,S7,d8,M$,L$]),D=new Uint32Array(4),k=new Int32Array(4),L=null,V=null,w=[],_=[],A=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=W9,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let M=this,C=!1;this._outputColorSpace=uK;let h=0,S=0,b=null,l=-1,v=null,c=new GJ,x=new GJ,m=null,Q0=new M0(0),$0=0,G0=Q.width,w0=Q.height,K0=1,HJ=null,WJ=null,s=new GJ(0,0,G0,w0),E0=new GJ(0,0,G0,w0),B0=!1,q0=new E8,f0=!1,JJ=!1,n0=new m0,s0=new P,a=new GJ,Z0={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},e=!1;function R0(){return b===null?K0:1}let T=$;function h0(z,y){return Q.getContext(z,y)}try{let z={alpha:!0,depth:Z,stencil:W,antialias:H,premultipliedAlpha:Y,preserveDrawingBuffer:X,powerPreference:U,failIfMajorPerformanceCaveat:G};if("setAttribute"in Q)Q.setAttribute("data-engine",`three.js r${tW}`);if(Q.addEventListener("webglcontextlost",o,!1),Q.addEventListener("webglcontextrestored",C0,!1),Q.addEventListener("webglcontextcreationerror",u0,!1),T===null){if(T=h0("webgl2",z),T===null)if(h0("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(z){throw S0("WebGLRenderer: "+z.message),z}let N0,x0,H0,d0,I,B,f,n,t,u,z0,D0,j0,b0,J0,W0,A0,g0,L0,r0,j,Y0,X0;function _0(){if(N0=new sD(T),N0.init(),j=new sG(T,N0),x0=new gD(T,N0,J,j),H0=new T1(T,N0),x0.reversedDepthBuffer&&N)H0.buffers.depth.setReversed(!0);d0=new aD(T),I=new R1,B=new S1(T,N0,H0,I,x0,j,d0),f=new nD(M),n=new QN(T),Y0=new hD(T,n),t=new iD(T,n,d0,Y0),u=new tD(T,t,n,Y0,d0),g0=new rD(T,x0,B),J0=new pD(I),z0=new F1(M,f,N0,x0,Y0,J0),D0=new f1(M,I),j0=new k1,b0=new I1(N0),A0=new bD(M,f,H0,u,q,Y),W0=new P1(M,u,x0),X0=new b1(T,d0,x0,H0),L0=new xD(T,N0,d0),r0=new oD(T,N0,d0),d0.programs=z0.programs,M.capabilities=x0,M.extensions=N0,M.properties=I,M.renderLists=j0,M.shadowMap=W0,M.state=H0,M.info=d0}if(_0(),R!==K9)A=new JF(R,Q.width,Q.height,Z,W);let i=new oG(M,T);this.xr=i,this.getContext=function(){return T},this.getContextAttributes=function(){return T.getContextAttributes()},this.forceContextLoss=function(){let z=N0.get("WEBGL_lose_context");if(z)z.loseContext()},this.forceContextRestore=function(){let z=N0.get("WEBGL_lose_context");if(z)z.restoreContext()},this.getPixelRatio=function(){return K0},this.setPixelRatio=function(z){if(z===void 0)return;K0=z,this.setSize(G0,w0,!1)},this.getSize=function(z){return z.set(G0,w0)},this.setSize=function(z,y,d=!0){if(i.isPresenting){U0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(G0=z,w0=y,Q.width=Math.floor(z*K0),Q.height=Math.floor(y*K0),d===!0)Q.style.width=z+"px",Q.style.height=y+"px";if(A!==null)A.setSize(Q.width,Q.height);this.setViewport(0,0,z,y)},this.getDrawingBufferSize=function(z){return z.set(G0*K0,w0*K0).floor()},this.setDrawingBufferSize=function(z,y,d){G0=z,w0=y,K0=d,Q.width=Math.floor(z*d),Q.height=Math.floor(y*d),this.setViewport(0,0,z,y)},this.setEffects=function(z){if(R===K9){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(z){for(let y=0;y<z.length;y++)if(z[y].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}A.setEffects(z||[])},this.getCurrentViewport=function(z){return z.copy(c)},this.getViewport=function(z){return z.copy(s)},this.setViewport=function(z,y,d,p){if(z.isVector4)s.set(z.x,z.y,z.z,z.w);else s.set(z,y,d,p);H0.viewport(c.copy(s).multiplyScalar(K0).round())},this.getScissor=function(z){return z.copy(E0)},this.setScissor=function(z,y,d,p){if(z.isVector4)E0.set(z.x,z.y,z.z,z.w);else E0.set(z,y,d,p);H0.scissor(x.copy(E0).multiplyScalar(K0).round())},this.getScissorTest=function(){return B0},this.setScissorTest=function(z){H0.setScissorTest(B0=z)},this.setOpaqueSort=function(z){HJ=z},this.setTransparentSort=function(z){WJ=z},this.getClearColor=function(z){return z.copy(A0.getClearColor())},this.setClearColor=function(){A0.setClearColor(...arguments)},this.getClearAlpha=function(){return A0.getClearAlpha()},this.setClearAlpha=function(){A0.setClearAlpha(...arguments)},this.clear=function(z=!0,y=!0,d=!0){let p=0;if(z){let g=!1;if(b!==null){let O0=b.texture.format;g=O.has(O0)}if(g){let O0=b.texture.type,I0=F.has(O0),k0=A0.getClearColor(),P0=A0.getClearAlpha(),y0=k0.r,i0=k0.g,t0=k0.b;if(I0)D[0]=y0,D[1]=i0,D[2]=t0,D[3]=P0,T.clearBufferuiv(T.COLOR,0,D);else k[0]=y0,k[1]=i0,k[2]=t0,k[3]=P0,T.clearBufferiv(T.COLOR,0,k)}else p|=T.COLOR_BUFFER_BIT}if(y)p|=T.DEPTH_BUFFER_BIT;if(d)p|=T.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(p!==0)T.clear(p)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){Q.removeEventListener("webglcontextlost",o,!1),Q.removeEventListener("webglcontextrestored",C0,!1),Q.removeEventListener("webglcontextcreationerror",u0,!1),A0.dispose(),j0.dispose(),b0.dispose(),I.dispose(),f.dispose(),u.dispose(),Y0.dispose(),X0.dispose(),z0.dispose(),i.dispose(),i.removeEventListener("sessionstart",MY),i.removeEventListener("sessionend",LY),R8.stop()};function o(z){z.preventDefault(),z7("WebGLRenderer: Context Lost."),C=!0}function C0(){z7("WebGLRenderer: Context Restored."),C=!1;let z=d0.autoReset,y=W0.enabled,d=W0.autoUpdate,p=W0.needsUpdate,g=W0.type;_0(),d0.autoReset=z,W0.enabled=y,W0.autoUpdate=d,W0.needsUpdate=p,W0.type=g}function u0(z){S0("WebGLRenderer: A WebGL context could not be created. Reason: ",z.statusMessage)}function qJ(z){let y=z.target;y.removeEventListener("dispose",qJ),YJ(y)}function YJ(z){S9(z),I.remove(z)}function S9(z){let y=I.get(z).programs;if(y!==void 0){if(y.forEach(function(d){z0.releaseProgram(d)}),z.isShaderMaterial)z0.releaseShaderCache(z)}}this.renderBufferDirect=function(z,y,d,p,g,O0){if(y===null)y=Z0;let I0=g.isMesh&&g.matrixWorld.determinant()<0,k0=tG(z,y,d,p,g);H0.setMaterial(p,I0);let P0=d.index,y0=1;if(p.wireframe===!0){if(P0=t.getWireframeAttribute(d),P0===void 0)return;y0=2}let i0=d.drawRange,t0=d.attributes.position,v0=i0.start*y0,XJ=(i0.start+i0.count)*y0;if(O0!==null)v0=Math.max(v0,O0.start*y0),XJ=Math.min(XJ,(O0.start+O0.count)*y0);if(P0!==null)v0=Math.max(v0,0),XJ=Math.min(XJ,P0.count);else if(t0!==void 0&&t0!==null)v0=Math.max(v0,0),XJ=Math.min(XJ,t0.count);let MJ=XJ-v0;if(MJ<0||MJ===1/0)return;Y0.setup(g,p,k0,d,P0);let RJ,UJ=L0;if(P0!==null)RJ=n.get(P0),UJ=r0,UJ.setIndex(RJ);if(g.isMesh)if(p.wireframe===!0)H0.setLineWidth(p.wireframeLinewidth*R0()),UJ.setMode(T.LINES);else UJ.setMode(T.TRIANGLES);else if(g.isLine){let yJ=p.linewidth;if(yJ===void 0)yJ=1;if(H0.setLineWidth(yJ*R0()),g.isLineSegments)UJ.setMode(T.LINES);else if(g.isLineLoop)UJ.setMode(T.LINE_LOOP);else UJ.setMode(T.LINE_STRIP)}else if(g.isPoints)UJ.setMode(T.POINTS);else if(g.isSprite)UJ.setMode(T.TRIANGLES);if(g.isBatchedMesh)if(g._multiDrawInstances!==null)I7("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),UJ.renderMultiDrawInstances(g._multiDrawStarts,g._multiDrawCounts,g._multiDrawCount,g._multiDrawInstances);else if(!N0.get("WEBGL_multi_draw")){let{_multiDrawStarts:yJ,_multiDrawCounts:T0,_multiDrawCount:aJ}=g,ZJ=P0?n.get(P0).bytesPerElement:1,X9=I.get(p).currentProgram.getUniforms();for(let M9=0;M9<aJ;M9++)X9.setValue(T,"_gl_DrawID",M9),UJ.render(yJ[M9]/ZJ,T0[M9])}else UJ.renderMultiDraw(g._multiDrawStarts,g._multiDrawCounts,g._multiDrawCount);else if(g.isInstancedMesh)UJ.renderInstances(v0,MJ,g.count);else if(d.isInstancedBufferGeometry){let yJ=d._maxInstanceCount!==void 0?d._maxInstanceCount:1/0,T0=Math.min(d.instanceCount,yJ);UJ.renderInstances(v0,MJ,T0)}else UJ.render(v0,MJ)};function k9(z,y,d){if(z.transparent===!0&&z.side===D9&&z.forceSinglePass===!1)z.side=dJ,z.needsUpdate=!0,NQ(z,y,d),z.side=g8,z.needsUpdate=!0,NQ(z,y,d),z.side=D9;else NQ(z,y,d)}this.compile=function(z,y,d=null){if(d===null)d=z;if(V=b0.get(d),V.init(y),_.push(V),d.traverseVisible(function(g){if(g.isLight&&g.layers.test(y.layers)){if(V.pushLight(g),g.castShadow)V.pushShadow(g)}}),z!==d)z.traverseVisible(function(g){if(g.isLight&&g.layers.test(y.layers)){if(V.pushLight(g),g.castShadow)V.pushShadow(g)}});V.setupLights();let p=new Set;return z.traverse(function(g){if(!(g.isMesh||g.isPoints||g.isLine||g.isSprite))return;let O0=g.material;if(O0)if(Array.isArray(O0))for(let I0=0;I0<O0.length;I0++){let k0=O0[I0];k9(k0,d,g),p.add(k0)}else k9(O0,d,g),p.add(O0)}),V=_.pop(),p},this.compileAsync=function(z,y,d=null){let p=this.compile(z,y,d);return new Promise((g)=>{function O0(){if(p.forEach(function(I0){if(I.get(I0).currentProgram.isReady())p.delete(I0)}),p.size===0){g(z);return}setTimeout(O0,10)}if(N0.get("KHR_parallel_shader_compile")!==null)O0();else setTimeout(O0,10)})};let XW=null;function rG(z){if(XW)XW(z)}function MY(){R8.stop()}function LY(){R8.start()}let R8=new hG;if(R8.setAnimationLoop(rG),typeof self<"u")R8.setContext(self);this.setAnimationLoop=function(z){XW=z,i.setAnimationLoop(z),z===null?R8.stop():R8.start()},i.addEventListener("sessionstart",MY),i.addEventListener("sessionend",LY),this.render=function(z,y){if(y!==void 0&&y.isCamera!==!0){S0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;let d=i.enabled===!0&&i.isPresenting===!0,p=A!==null&&(b===null||d)&&A.begin(M,b);if(z.matrixWorldAutoUpdate===!0)z.updateMatrixWorld();if(y.parent===null&&y.matrixWorldAutoUpdate===!0)y.updateMatrixWorld();if(i.enabled===!0&&i.isPresenting===!0&&(A===null||A.isCompositing()===!1)){if(i.cameraAutoUpdate===!0)i.updateCamera(y);y=i.getCamera()}if(z.isScene===!0)z.onBeforeRender(M,z,y,b);if(V=b0.get(z,_.length),V.init(y),_.push(V),n0.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),q0.setFromProjectionMatrix(n0,WZ,y.reversedDepth),JJ=this.localClippingEnabled,f0=J0.init(this.clippingPlanes,JJ),L=j0.get(z,w.length),L.init(),w.push(L),i.enabled===!0&&i.isPresenting===!0){let I0=M.xr.getDepthSensingMesh();if(I0!==null)UW(I0,y,-1/0,M.sortObjects)}if(UW(z,y,0,M.sortObjects),L.finish(),M.sortObjects===!0)L.sort(HJ,WJ);if(e=i.enabled===!1||i.isPresenting===!1||i.hasDepthSensing()===!1,e)A0.addToRenderList(L,z);if(this.info.render.frame++,f0===!0)J0.beginShadows();let g=V.state.shadowsArray;if(W0.render(g,z,y),f0===!0)J0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((p&&A.hasRenderPass())===!1){let{opaque:I0,transmissive:k0}=L;if(V.setupLights(),y.isArrayCamera){let P0=y.cameras;if(k0.length>0)for(let y0=0,i0=P0.length;y0<i0;y0++){let t0=P0[y0];BY(I0,k0,z,t0)}if(e)A0.render(z);for(let y0=0,i0=P0.length;y0<i0;y0++){let t0=P0[y0];VY(L,z,t0,t0.viewport)}}else{if(k0.length>0)BY(I0,k0,z,y);if(e)A0.render(z);VY(L,z,y)}}if(b!==null&&S===0)B.updateMultisampleRenderTarget(b),B.updateRenderTargetMipmap(b);if(p)A.end(M);if(z.isScene===!0)z.onAfterRender(M,z,y);if(Y0.resetDefaultState(),l=-1,v=null,_.pop(),_.length>0){if(V=_[_.length-1],f0===!0)J0.setGlobalState(M.clippingPlanes,V.state.camera)}else V=null;if(w.pop(),w.length>0)L=w[w.length-1];else L=null};function UW(z,y,d,p){if(z.visible===!1)return;if(z.layers.test(y.layers)){if(z.isGroup)d=z.renderOrder;else if(z.isLOD){if(z.autoUpdate===!0)z.update(y)}else if(z.isLight){if(V.pushLight(z),z.castShadow)V.pushShadow(z)}else if(z.isSprite){if(!z.frustumCulled||q0.intersectsSprite(z)){if(p)a.setFromMatrixPosition(z.matrixWorld).applyMatrix4(n0);let I0=u.update(z),k0=z.material;if(k0.visible)L.push(z,I0,k0,d,a.z,null)}}else if(z.isMesh||z.isLine||z.isPoints){if(!z.frustumCulled||q0.intersectsObject(z)){let I0=u.update(z),k0=z.material;if(p){if(z.boundingSphere!==void 0){if(z.boundingSphere===null)z.computeBoundingSphere();a.copy(z.boundingSphere.center)}else{if(I0.boundingSphere===null)I0.computeBoundingSphere();a.copy(I0.boundingSphere.center)}a.applyMatrix4(z.matrixWorld).applyMatrix4(n0)}if(Array.isArray(k0)){let P0=I0.groups;for(let y0=0,i0=P0.length;y0<i0;y0++){let t0=P0[y0],v0=k0[t0.materialIndex];if(v0&&v0.visible)L.push(z,I0,v0,d,a.z,t0)}}else if(k0.visible)L.push(z,I0,k0,d,a.z,null)}}}let O0=z.children;for(let I0=0,k0=O0.length;I0<k0;I0++)UW(O0[I0],y,d,p)}function VY(z,y,d,p){let{opaque:g,transmissive:O0,transparent:I0}=z;if(V.setupLightsView(d),f0===!0)J0.setGlobalState(M.clippingPlanes,d);if(p)H0.viewport(c.copy(p));if(g.length>0)EQ(g,y,d);if(O0.length>0)EQ(O0,y,d);if(I0.length>0)EQ(I0,y,d);H0.buffers.depth.setTest(!0),H0.buffers.depth.setMask(!0),H0.buffers.color.setMask(!0),H0.setPolygonOffset(!1)}function BY(z,y,d,p){if((d.isScene===!0?d.overrideMaterial:null)!==null)return;if(V.state.transmissionRenderTarget[p.id]===void 0){let v0=N0.has("EXT_color_buffer_half_float")||N0.has("EXT_color_buffer_float");V.state.transmissionRenderTarget[p.id]=new uJ(1,1,{generateMipmaps:!0,type:v0?C9:K9,minFilter:H8,samples:Math.max(4,x0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:e0.workingColorSpace})}let O0=V.state.transmissionRenderTarget[p.id],I0=p.viewport||c;O0.setSize(I0.z*M.transmissionResolutionScale,I0.w*M.transmissionResolutionScale);let k0=M.getRenderTarget(),P0=M.getActiveCubeFace(),y0=M.getActiveMipmapLevel();if(M.setRenderTarget(O0),M.getClearColor(Q0),$0=M.getClearAlpha(),$0<1)M.setClearColor(16777215,0.5);if(M.clear(),e)A0.render(d);let i0=M.toneMapping;M.toneMapping=W9;let t0=p.viewport;if(p.viewport!==void 0)p.viewport=void 0;if(V.setupLightsView(p),f0===!0)J0.setGlobalState(M.clippingPlanes,p);if(EQ(z,d,p),B.updateMultisampleRenderTarget(O0),B.updateRenderTargetMipmap(O0),N0.has("WEBGL_multisampled_render_to_texture")===!1){let v0=!1;for(let XJ=0,MJ=y.length;XJ<MJ;XJ++){let RJ=y[XJ],{object:UJ,geometry:yJ,material:T0,group:aJ}=RJ;if(T0.side===D9&&UJ.layers.test(p.layers)){let ZJ=T0.side;T0.side=dJ,T0.needsUpdate=!0,zY(UJ,d,p,yJ,T0,aJ),T0.side=ZJ,T0.needsUpdate=!0,v0=!0}}if(v0===!0)B.updateMultisampleRenderTarget(O0),B.updateRenderTargetMipmap(O0)}if(M.setRenderTarget(k0,P0,y0),M.setClearColor(Q0,$0),t0!==void 0)p.viewport=t0;M.toneMapping=i0}function EQ(z,y,d){let p=y.isScene===!0?y.overrideMaterial:null;for(let g=0,O0=z.length;g<O0;g++){let I0=z[g],{object:k0,geometry:P0,group:y0}=I0,i0=I0.material;if(i0.allowOverride===!0&&p!==null)i0=p;if(k0.layers.test(d.layers))zY(k0,y,d,P0,i0,y0)}}function zY(z,y,d,p,g,O0){if(z.onBeforeRender(M,y,d,p,g,O0),z.modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,z.matrixWorld),z.normalMatrix.getNormalMatrix(z.modelViewMatrix),g.onBeforeRender(M,y,d,p,z,O0),g.transparent===!0&&g.side===D9&&g.forceSinglePass===!1)g.side=dJ,g.needsUpdate=!0,M.renderBufferDirect(d,y,p,g,z,O0),g.side=g8,g.needsUpdate=!0,M.renderBufferDirect(d,y,p,g,z,O0),g.side=D9;else M.renderBufferDirect(d,y,p,g,z,O0);z.onAfterRender(M,y,d,p,g,O0)}function NQ(z,y,d){if(y.isScene!==!0)y=Z0;let p=I.get(z),g=V.state.lights,O0=V.state.shadowsArray,I0=g.state.version,k0=z0.getParameters(z,g.state,O0,y,d),P0=z0.getProgramCacheKey(k0),y0=p.programs;p.environment=z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial?y.environment:null,p.fog=y.fog;let i0=z.isMeshStandardMaterial||z.isMeshLambertMaterial&&!z.envMap||z.isMeshPhongMaterial&&!z.envMap;if(p.envMap=f.get(z.envMap||p.environment,i0),p.envMapRotation=p.environment!==null&&z.envMap===null?y.environmentRotation:z.envMapRotation,y0===void 0)z.addEventListener("dispose",qJ),y0=new Map,p.programs=y0;let t0=y0.get(P0);if(t0!==void 0){if(p.currentProgram===t0&&p.lightsStateVersion===I0)return _Y(z,k0),t0}else k0.uniforms=z0.getUniforms(z),z.onBeforeCompile(k0,M),t0=z0.acquireProgram(k0,P0),y0.set(P0,t0),p.uniforms=k0.uniforms;let v0=p.uniforms;if(!z.isShaderMaterial&&!z.isRawShaderMaterial||z.clipping===!0)v0.clippingPlanes=J0.uniform;if(_Y(z,k0),p.needsLights=J5(z),p.lightsStateVersion=I0,p.needsLights)v0.ambientLightColor.value=g.state.ambient,v0.lightProbe.value=g.state.probe,v0.directionalLights.value=g.state.directional,v0.directionalLightShadows.value=g.state.directionalShadow,v0.spotLights.value=g.state.spot,v0.spotLightShadows.value=g.state.spotShadow,v0.rectAreaLights.value=g.state.rectArea,v0.ltc_1.value=g.state.rectAreaLTC1,v0.ltc_2.value=g.state.rectAreaLTC2,v0.pointLights.value=g.state.point,v0.pointLightShadows.value=g.state.pointShadow,v0.hemisphereLights.value=g.state.hemi,v0.directionalShadowMatrix.value=g.state.directionalShadowMatrix,v0.spotLightMatrix.value=g.state.spotLightMatrix,v0.spotLightMap.value=g.state.spotLightMap,v0.pointShadowMatrix.value=g.state.pointShadowMatrix;return p.currentProgram=t0,p.uniformsList=null,t0}function IY(z){if(z.uniformsList===null){let y=z.currentProgram.getUniforms();z.uniformsList=GQ.seqWithValue(y.seq,z.uniforms)}return z.uniformsList}function _Y(z,y){let d=I.get(z);d.outputColorSpace=y.outputColorSpace,d.batching=y.batching,d.batchingColor=y.batchingColor,d.instancing=y.instancing,d.instancingColor=y.instancingColor,d.instancingMorph=y.instancingMorph,d.skinning=y.skinning,d.morphTargets=y.morphTargets,d.morphNormals=y.morphNormals,d.morphColors=y.morphColors,d.morphTargetsCount=y.morphTargetsCount,d.numClippingPlanes=y.numClippingPlanes,d.numIntersection=y.numClipIntersection,d.vertexAlphas=y.vertexAlphas,d.vertexTangents=y.vertexTangents,d.toneMapping=y.toneMapping}function tG(z,y,d,p,g){if(y.isScene!==!0)y=Z0;B.resetTextureUnits();let O0=y.fog,I0=p.isMeshStandardMaterial||p.isMeshLambertMaterial||p.isMeshPhongMaterial?y.environment:null,k0=b===null?M.outputColorSpace:b.isXRRenderTarget===!0?b.texture.colorSpace:j7,P0=p.isMeshStandardMaterial||p.isMeshLambertMaterial&&!p.envMap||p.isMeshPhongMaterial&&!p.envMap,y0=f.get(p.envMap||I0,P0),i0=p.vertexColors===!0&&!!d.attributes.color&&d.attributes.color.itemSize===4,t0=!!d.attributes.tangent&&(!!p.normalMap||p.anisotropy>0),v0=!!d.morphAttributes.position,XJ=!!d.morphAttributes.normal,MJ=!!d.morphAttributes.color,RJ=W9;if(p.toneMapped){if(b===null||b.isXRRenderTarget===!0)RJ=M.toneMapping}let UJ=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,yJ=UJ!==void 0?UJ.length:0,T0=I.get(p),aJ=V.state.lights;if(f0===!0){if(JJ===!0||z!==v){let AJ=z===v&&p.id===l;J0.setState(p,z,AJ)}}let ZJ=!1;if(p.version===T0.__version){if(T0.needsLights&&T0.lightsStateVersion!==aJ.state.version)ZJ=!0;else if(T0.outputColorSpace!==k0)ZJ=!0;else if(g.isBatchedMesh&&T0.batching===!1)ZJ=!0;else if(!g.isBatchedMesh&&T0.batching===!0)ZJ=!0;else if(g.isBatchedMesh&&T0.batchingColor===!0&&g.colorTexture===null)ZJ=!0;else if(g.isBatchedMesh&&T0.batchingColor===!1&&g.colorTexture!==null)ZJ=!0;else if(g.isInstancedMesh&&T0.instancing===!1)ZJ=!0;else if(!g.isInstancedMesh&&T0.instancing===!0)ZJ=!0;else if(g.isSkinnedMesh&&T0.skinning===!1)ZJ=!0;else if(!g.isSkinnedMesh&&T0.skinning===!0)ZJ=!0;else if(g.isInstancedMesh&&T0.instancingColor===!0&&g.instanceColor===null)ZJ=!0;else if(g.isInstancedMesh&&T0.instancingColor===!1&&g.instanceColor!==null)ZJ=!0;else if(g.isInstancedMesh&&T0.instancingMorph===!0&&g.morphTexture===null)ZJ=!0;else if(g.isInstancedMesh&&T0.instancingMorph===!1&&g.morphTexture!==null)ZJ=!0;else if(T0.envMap!==y0)ZJ=!0;else if(p.fog===!0&&T0.fog!==O0)ZJ=!0;else if(T0.numClippingPlanes!==void 0&&(T0.numClippingPlanes!==J0.numPlanes||T0.numIntersection!==J0.numIntersection))ZJ=!0;else if(T0.vertexAlphas!==i0)ZJ=!0;else if(T0.vertexTangents!==t0)ZJ=!0;else if(T0.morphTargets!==v0)ZJ=!0;else if(T0.morphNormals!==XJ)ZJ=!0;else if(T0.morphColors!==MJ)ZJ=!0;else if(T0.toneMapping!==RJ)ZJ=!0;else if(T0.morphTargetsCount!==yJ)ZJ=!0}else ZJ=!0,T0.__version=p.version;let X9=T0.currentProgram;if(ZJ===!0)X9=NQ(p,y,g);let M9=!1,O8=!1,t8=!1,NJ=X9.getUniforms(),TJ=T0.uniforms;if(H0.useProgram(X9.program))M9=!0,O8=!0,t8=!0;if(p.id!==l)l=p.id,O8=!0;if(M9||v!==z){if(H0.buffers.depth.getReversed()&&z.reversedDepth!==!0)z._reversedDepth=!0,z.updateProjectionMatrix();NJ.setValue(T,"projectionMatrix",z.projectionMatrix),NJ.setValue(T,"viewMatrix",z.matrixWorldInverse);let s9=NJ.map.cameraPosition;if(s9!==void 0)s9.setValue(T,s0.setFromMatrixPosition(z.matrixWorld));if(x0.logarithmicDepthBuffer)NJ.setValue(T,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2));if(p.isMeshPhongMaterial||p.isMeshToonMaterial||p.isMeshLambertMaterial||p.isMeshBasicMaterial||p.isMeshStandardMaterial||p.isShaderMaterial)NJ.setValue(T,"isOrthographic",z.isOrthographicCamera===!0);if(v!==z)v=z,O8=!0,t8=!0}if(T0.needsLights){if(aJ.state.directionalShadowMap.length>0)NJ.setValue(T,"directionalShadowMap",aJ.state.directionalShadowMap,B);if(aJ.state.spotShadowMap.length>0)NJ.setValue(T,"spotShadowMap",aJ.state.spotShadowMap,B);if(aJ.state.pointShadowMap.length>0)NJ.setValue(T,"pointShadowMap",aJ.state.pointShadowMap,B)}if(g.isSkinnedMesh){NJ.setOptional(T,g,"bindMatrix"),NJ.setOptional(T,g,"bindMatrixInverse");let AJ=g.skeleton;if(AJ){if(AJ.boneTexture===null)AJ.computeBoneTexture();NJ.setValue(T,"boneTexture",AJ.boneTexture,B)}}if(g.isBatchedMesh){if(NJ.setOptional(T,g,"batchingTexture"),NJ.setValue(T,"batchingTexture",g._matricesTexture,B),NJ.setOptional(T,g,"batchingIdTexture"),NJ.setValue(T,"batchingIdTexture",g._indirectTexture,B),NJ.setOptional(T,g,"batchingColorTexture"),g._colorsTexture!==null)NJ.setValue(T,"batchingColorTexture",g._colorsTexture,B)}let n9=d.morphAttributes;if(n9.position!==void 0||n9.normal!==void 0||n9.color!==void 0)g0.update(g,d,X9);if(O8||T0.receiveShadow!==g.receiveShadow)T0.receiveShadow=g.receiveShadow,NJ.setValue(T,"receiveShadow",g.receiveShadow);if((p.isMeshStandardMaterial||p.isMeshLambertMaterial||p.isMeshPhongMaterial)&&p.envMap===null&&y.environment!==null)TJ.envMapIntensity.value=y.environmentIntensity;if(TJ.dfgLUT!==void 0)TJ.dfgLUT.value=x1();if(O8){if(NJ.setValue(T,"toneMappingExposure",M.toneMappingExposure),T0.needsLights)eG(TJ,t8);if(O0&&p.fog===!0)D0.refreshFogUniforms(TJ,O0);D0.refreshMaterialUniforms(TJ,p,K0,w0,V.state.transmissionRenderTarget[z.id]),GQ.upload(T,IY(T0),TJ,B)}if(p.isShaderMaterial&&p.uniformsNeedUpdate===!0)GQ.upload(T,IY(T0),TJ,B),p.uniformsNeedUpdate=!1;if(p.isSpriteMaterial)NJ.setValue(T,"center",g.center);if(NJ.setValue(T,"modelViewMatrix",g.modelViewMatrix),NJ.setValue(T,"normalMatrix",g.normalMatrix),NJ.setValue(T,"modelMatrix",g.matrixWorld),p.isShaderMaterial||p.isRawShaderMaterial){let AJ=p.uniformsGroups;for(let s9=0,e8=AJ.length;s9<e8;s9++){let AY=AJ[s9];X0.update(AY,X9),X0.bind(AY,X9)}}return X9}function eG(z,y){z.ambientLightColor.needsUpdate=y,z.lightProbe.needsUpdate=y,z.directionalLights.needsUpdate=y,z.directionalLightShadows.needsUpdate=y,z.pointLights.needsUpdate=y,z.pointLightShadows.needsUpdate=y,z.spotLights.needsUpdate=y,z.spotLightShadows.needsUpdate=y,z.rectAreaLights.needsUpdate=y,z.hemisphereLights.needsUpdate=y}function J5(z){return z.isMeshLambertMaterial||z.isMeshToonMaterial||z.isMeshPhongMaterial||z.isMeshStandardMaterial||z.isShadowMaterial||z.isShaderMaterial&&z.lights===!0}this.getActiveCubeFace=function(){return h},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(z,y,d){let p=I.get(z);if(p.__autoAllocateDepthBuffer=z.resolveDepthBuffer===!1,p.__autoAllocateDepthBuffer===!1)p.__useRenderToTexture=!1;I.get(z.texture).__webglTexture=y,I.get(z.depthTexture).__webglTexture=p.__autoAllocateDepthBuffer?void 0:d,p.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(z,y){let d=I.get(z);d.__webglFramebuffer=y,d.__useDefaultFramebuffer=y===void 0};let Q5=T.createFramebuffer();this.setRenderTarget=function(z,y=0,d=0){b=z,h=y,S=d;let p=null,g=!1,O0=!1;if(z){let k0=I.get(z);if(k0.__useDefaultFramebuffer!==void 0){H0.bindFramebuffer(T.FRAMEBUFFER,k0.__webglFramebuffer),c.copy(z.viewport),x.copy(z.scissor),m=z.scissorTest,H0.viewport(c),H0.scissor(x),H0.setScissorTest(m),l=-1;return}else if(k0.__webglFramebuffer===void 0)B.setupRenderTarget(z);else if(k0.__hasExternalTextures)B.rebindTextures(z,I.get(z.texture).__webglTexture,I.get(z.depthTexture).__webglTexture);else if(z.depthBuffer){let i0=z.depthTexture;if(k0.__boundDepthTexture!==i0){if(i0!==null&&I.has(i0)&&(z.width!==i0.image.width||z.height!==i0.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");B.setupDepthRenderbuffer(z)}}let P0=z.texture;if(P0.isData3DTexture||P0.isDataArrayTexture||P0.isCompressedArrayTexture)O0=!0;let y0=I.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget){if(Array.isArray(y0[y]))p=y0[y][d];else p=y0[y];g=!0}else if(z.samples>0&&B.useMultisampledRTT(z)===!1)p=I.get(z).__webglMultisampledFramebuffer;else if(Array.isArray(y0))p=y0[d];else p=y0;c.copy(z.viewport),x.copy(z.scissor),m=z.scissorTest}else c.copy(s).multiplyScalar(K0).floor(),x.copy(E0).multiplyScalar(K0).floor(),m=B0;if(d!==0)p=Q5;if(H0.bindFramebuffer(T.FRAMEBUFFER,p))H0.drawBuffers(z,p);if(H0.viewport(c),H0.scissor(x),H0.setScissorTest(m),g){let k0=I.get(z.texture);T.framebufferTexture2D(T.FRAMEBUFFER,T.COLOR_ATTACHMENT0,T.TEXTURE_CUBE_MAP_POSITIVE_X+y,k0.__webglTexture,d)}else if(O0){let k0=y;for(let P0=0;P0<z.textures.length;P0++){let y0=I.get(z.textures[P0]);T.framebufferTextureLayer(T.FRAMEBUFFER,T.COLOR_ATTACHMENT0+P0,y0.__webglTexture,d,k0)}}else if(z!==null&&d!==0){let k0=I.get(z.texture);T.framebufferTexture2D(T.FRAMEBUFFER,T.COLOR_ATTACHMENT0,T.TEXTURE_2D,k0.__webglTexture,d)}l=-1},this.readRenderTargetPixels=function(z,y,d,p,g,O0,I0,k0=0){if(!(z&&z.isWebGLRenderTarget)){S0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let P0=I.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&I0!==void 0)P0=P0[I0];if(P0){H0.bindFramebuffer(T.FRAMEBUFFER,P0);try{let y0=z.textures[k0],i0=y0.format,t0=y0.type;if(z.textures.length>1)T.readBuffer(T.COLOR_ATTACHMENT0+k0);if(!x0.textureFormatReadable(i0)){S0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!x0.textureTypeReadable(t0)){S0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(y>=0&&y<=z.width-p&&(d>=0&&d<=z.height-g))T.readPixels(y,d,p,g,j.convert(i0),j.convert(t0),O0)}finally{let y0=b!==null?I.get(b).__webglFramebuffer:null;H0.bindFramebuffer(T.FRAMEBUFFER,y0)}}},this.readRenderTargetPixelsAsync=async function(z,y,d,p,g,O0,I0,k0=0){if(!(z&&z.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let P0=I.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&I0!==void 0)P0=P0[I0];if(P0)if(y>=0&&y<=z.width-p&&(d>=0&&d<=z.height-g)){H0.bindFramebuffer(T.FRAMEBUFFER,P0);let y0=z.textures[k0],i0=y0.format,t0=y0.type;if(z.textures.length>1)T.readBuffer(T.COLOR_ATTACHMENT0+k0);if(!x0.textureFormatReadable(i0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!x0.textureTypeReadable(t0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let v0=T.createBuffer();T.bindBuffer(T.PIXEL_PACK_BUFFER,v0),T.bufferData(T.PIXEL_PACK_BUFFER,O0.byteLength,T.STREAM_READ),T.readPixels(y,d,p,g,j.convert(i0),j.convert(t0),0);let XJ=b!==null?I.get(b).__webglFramebuffer:null;H0.bindFramebuffer(T.FRAMEBUFFER,XJ);let MJ=T.fenceSync(T.SYNC_GPU_COMMANDS_COMPLETE,0);return T.flush(),await rU(T,MJ,4),T.bindBuffer(T.PIXEL_PACK_BUFFER,v0),T.getBufferSubData(T.PIXEL_PACK_BUFFER,0,O0),T.deleteBuffer(v0),T.deleteSync(MJ),O0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(z,y=null,d=0){let p=Math.pow(2,-d),g=Math.floor(z.image.width*p),O0=Math.floor(z.image.height*p),I0=y!==null?y.x:0,k0=y!==null?y.y:0;B.setTexture2D(z,0),T.copyTexSubImage2D(T.TEXTURE_2D,d,0,0,I0,k0,g,O0),H0.unbindTexture()};let $5=T.createFramebuffer(),Z5=T.createFramebuffer();if(this.copyTextureToTexture=function(z,y,d=null,p=null,g=0,O0=0){let I0,k0,P0,y0,i0,t0,v0,XJ,MJ,RJ=z.isCompressedTexture?z.mipmaps[O0]:z.image;if(d!==null)I0=d.max.x-d.min.x,k0=d.max.y-d.min.y,P0=d.isBox3?d.max.z-d.min.z:1,y0=d.min.x,i0=d.min.y,t0=d.isBox3?d.min.z:0;else{let TJ=Math.pow(2,-g);if(I0=Math.floor(RJ.width*TJ),k0=Math.floor(RJ.height*TJ),z.isDataArrayTexture)P0=RJ.depth;else if(z.isData3DTexture)P0=Math.floor(RJ.depth*TJ);else P0=1;y0=0,i0=0,t0=0}if(p!==null)v0=p.x,XJ=p.y,MJ=p.z;else v0=0,XJ=0,MJ=0;let UJ=j.convert(y.format),yJ=j.convert(y.type),T0;if(y.isData3DTexture)B.setTexture3D(y,0),T0=T.TEXTURE_3D;else if(y.isDataArrayTexture||y.isCompressedArrayTexture)B.setTexture2DArray(y,0),T0=T.TEXTURE_2D_ARRAY;else B.setTexture2D(y,0),T0=T.TEXTURE_2D;T.pixelStorei(T.UNPACK_FLIP_Y_WEBGL,y.flipY),T.pixelStorei(T.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),T.pixelStorei(T.UNPACK_ALIGNMENT,y.unpackAlignment);let aJ=T.getParameter(T.UNPACK_ROW_LENGTH),ZJ=T.getParameter(T.UNPACK_IMAGE_HEIGHT),X9=T.getParameter(T.UNPACK_SKIP_PIXELS),M9=T.getParameter(T.UNPACK_SKIP_ROWS),O8=T.getParameter(T.UNPACK_SKIP_IMAGES);T.pixelStorei(T.UNPACK_ROW_LENGTH,RJ.width),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,RJ.height),T.pixelStorei(T.UNPACK_SKIP_PIXELS,y0),T.pixelStorei(T.UNPACK_SKIP_ROWS,i0),T.pixelStorei(T.UNPACK_SKIP_IMAGES,t0);let t8=z.isDataArrayTexture||z.isData3DTexture,NJ=y.isDataArrayTexture||y.isData3DTexture;if(z.isDepthTexture){let TJ=I.get(z),n9=I.get(y),AJ=I.get(TJ.__renderTarget),s9=I.get(n9.__renderTarget);H0.bindFramebuffer(T.READ_FRAMEBUFFER,AJ.__webglFramebuffer),H0.bindFramebuffer(T.DRAW_FRAMEBUFFER,s9.__webglFramebuffer);for(let e8=0;e8<P0;e8++){if(t8)T.framebufferTextureLayer(T.READ_FRAMEBUFFER,T.COLOR_ATTACHMENT0,I.get(z).__webglTexture,g,t0+e8),T.framebufferTextureLayer(T.DRAW_FRAMEBUFFER,T.COLOR_ATTACHMENT0,I.get(y).__webglTexture,O0,MJ+e8);T.blitFramebuffer(y0,i0,I0,k0,v0,XJ,I0,k0,T.DEPTH_BUFFER_BIT,T.NEAREST)}H0.bindFramebuffer(T.READ_FRAMEBUFFER,null),H0.bindFramebuffer(T.DRAW_FRAMEBUFFER,null)}else if(g!==0||z.isRenderTargetTexture||I.has(z)){let TJ=I.get(z),n9=I.get(y);H0.bindFramebuffer(T.READ_FRAMEBUFFER,$5),H0.bindFramebuffer(T.DRAW_FRAMEBUFFER,Z5);for(let AJ=0;AJ<P0;AJ++){if(t8)T.framebufferTextureLayer(T.READ_FRAMEBUFFER,T.COLOR_ATTACHMENT0,TJ.__webglTexture,g,t0+AJ);else T.framebufferTexture2D(T.READ_FRAMEBUFFER,T.COLOR_ATTACHMENT0,T.TEXTURE_2D,TJ.__webglTexture,g);if(NJ)T.framebufferTextureLayer(T.DRAW_FRAMEBUFFER,T.COLOR_ATTACHMENT0,n9.__webglTexture,O0,MJ+AJ);else T.framebufferTexture2D(T.DRAW_FRAMEBUFFER,T.COLOR_ATTACHMENT0,T.TEXTURE_2D,n9.__webglTexture,O0);if(g!==0)T.blitFramebuffer(y0,i0,I0,k0,v0,XJ,I0,k0,T.COLOR_BUFFER_BIT,T.NEAREST);else if(NJ)T.copyTexSubImage3D(T0,O0,v0,XJ,MJ+AJ,y0,i0,I0,k0);else T.copyTexSubImage2D(T0,O0,v0,XJ,y0,i0,I0,k0)}H0.bindFramebuffer(T.READ_FRAMEBUFFER,null),H0.bindFramebuffer(T.DRAW_FRAMEBUFFER,null)}else if(NJ)if(z.isDataTexture||z.isData3DTexture)T.texSubImage3D(T0,O0,v0,XJ,MJ,I0,k0,P0,UJ,yJ,RJ.data);else if(y.isCompressedArrayTexture)T.compressedTexSubImage3D(T0,O0,v0,XJ,MJ,I0,k0,P0,UJ,RJ.data);else T.texSubImage3D(T0,O0,v0,XJ,MJ,I0,k0,P0,UJ,yJ,RJ);else if(z.isDataTexture)T.texSubImage2D(T.TEXTURE_2D,O0,v0,XJ,I0,k0,UJ,yJ,RJ.data);else if(z.isCompressedTexture)T.compressedTexSubImage2D(T.TEXTURE_2D,O0,v0,XJ,RJ.width,RJ.height,UJ,RJ.data);else T.texSubImage2D(T.TEXTURE_2D,O0,v0,XJ,I0,k0,UJ,yJ,RJ);if(T.pixelStorei(T.UNPACK_ROW_LENGTH,aJ),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,ZJ),T.pixelStorei(T.UNPACK_SKIP_PIXELS,X9),T.pixelStorei(T.UNPACK_SKIP_ROWS,M9),T.pixelStorei(T.UNPACK_SKIP_IMAGES,O8),O0===0&&y.generateMipmaps)T.generateMipmap(T0);H0.unbindTexture()},this.initRenderTarget=function(z){if(I.get(z).__webglFramebuffer===void 0)B.setupRenderTarget(z)},this.initTexture=function(z){if(z.isCubeTexture)B.setTextureCube(z,0);else if(z.isData3DTexture)B.setTexture3D(z,0);else if(z.isDataArrayTexture||z.isCompressedArrayTexture)B.setTexture2DArray(z,0);else B.setTexture2D(z,0);H0.unbindTexture()},this.resetState=function(){h=0,S=0,b=null,H0.reset(),Y0.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return WZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=e0._getDrawingBufferColorSpace(J),Q.unpackColorSpace=e0._getUnpackColorSpace()}}var $N=`#ifdef USE_ALPHAHASH
354
+ Program Info Log: `+l+`
355
+ `+N0+`
356
+ `+j0)}else if(l!=="")H0("WebGLProgram: Program Info Log:",l);else if(h===""||m==="")W0=!1;if(W0)T.diagnostics={runnable:a,programLog:l,vertexShader:{log:h,prefix:F},fragmentShader:{log:m,prefix:D}}}W.deleteShader(_),W.deleteShader(A),L=new qQ(W,O),I=Y1(W,O)}let L;this.getUniforms=function(){if(L===void 0)C(this);return L};let I;this.getAttributes=function(){if(I===void 0)C(this);return I};let b=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(b===!1)b=W.getProgramParameter(O,aF);return b},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(O),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=rF++,this.cacheKey=Q,this.usedTimes=1,this.program=O,this.vertexShader=_,this.fragmentShader=A,this}class aG{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(J){let{vertexShader:Q,fragmentShader:$}=J,Z=this._getShaderStage(Q),W=this._getShaderStage($),K=this._getShaderCacheForMaterial(J);if(K.has(Z)===!1)K.add(Z),Z.usedTimes++;if(K.has(W)===!1)K.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 rG(J),Q.set(J,$);return $}}class rG{constructor(J){this.id=B1++,this.code=J,this.usedTimes=0}}function z1(J){return J===D8||J===B6||J===z6}function I1(J,Q,$,Z,W,K){let Y=new v7,X=new aG,H=new Set,U=[],E=new Map,N=Z.logarithmicDepthBuffer,G=Z.precision,q={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 O(L,I,b,T,g,u){let y=T.fog,l=g.geometry,h=L.isMeshStandardMaterial||L.isMeshLambertMaterial||L.isMeshPhongMaterial?T.environment:null,m=L.isMeshStandardMaterial||L.isMeshLambertMaterial&&!L.envMap||L.isMeshPhongMaterial&&!L.envMap,a=Q.get(L.envMap||h,m),W0=!!a&&a.mapping===P7?a.image.height:null,N0=q[L.type];if(L.precision!==null){if(G=Z.getMaxPrecision(L.precision),G!==L.precision)H0("WebGLProgram.getParameters:",L.precision,"not supported, using",G,"instead.")}let j0=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,B0=j0!==void 0?j0.length:0,ZJ=0;if(l.morphAttributes.position!==void 0)ZJ=1;if(l.morphAttributes.normal!==void 0)ZJ=2;if(l.morphAttributes.color!==void 0)ZJ=3;let t0,s,R0,P0;if(N0){let s0=V9[N0];t0=s0.vertexShader,s=s0.fragmentShader}else t0=L.vertexShader,s=L.fragmentShader,X.update(L),R0=X.getVertexShaderID(L),P0=X.getFragmentShaderID(L);let G0=J.getRenderTarget(),b0=J.state.buffers.depth.getReversed(),YJ=g.isInstancedMesh===!0,p0=g.isBatchedMesh===!0,l0=!!L.map,t=!!L.matcap,$0=!!a,e=!!L.aoMap,L0=!!L.lightMap,M0=!!L.bumpMap,x0=!!L.normalMap,S=!!L.displacementMap,e0=!!L.emissiveMap,y0=!!L.metalnessMap,g0=!!L.roughnessMap,K0=L.anisotropy>0,HJ=L.clearcoat>0,A0=L.dispersion>0,w=L.iridescence>0,B=L.sheen>0,f=L.transmission>0,i=K0&&!!L.anisotropyMap,J0=HJ&&!!L.clearcoatMap,Z0=HJ&&!!L.clearcoatNormalMap,q0=HJ&&!!L.clearcoatRoughnessMap,c=w&&!!L.iridescenceMap,o=w&&!!L.iridescenceThicknessMap,E0=B&&!!L.sheenColorMap,C0=B&&!!L.sheenRoughnessMap,X0=!!L.specularMap,F0=!!L.specularColorMap,n0=!!L.specularIntensityMap,a0=f&&!!L.transmissionMap,JJ=f&&!!L.thicknessMap,j=!!L.gradientMap,U0=!!L.alphaMap,n=L.alphaTest>0,Y0=!!L.alphaHash,w0=!!L.extensions,Q0=U9;if(L.toneMapped){if(G0===null||G0.isXRRenderTarget===!0)Q0=J.toneMapping}let v0={shaderID:N0,shaderType:L.type,shaderName:L.name,vertexShader:t0,fragmentShader:s,defines:L.defines,customVertexShaderID:R0,customFragmentShaderID:P0,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:G,batching:p0,batchingColor:p0&&g._colorsTexture!==null,instancing:YJ,instancingColor:YJ&&g.instanceColor!==null,instancingMorph:YJ&&g.morphTexture!==null,outputColorSpace:G0===null?J.outputColorSpace:G0.isXRRenderTarget===!0?G0.texture.colorSpace:$J.workingColorSpace,alphaToCoverage:!!L.alphaToCoverage,map:l0,matcap:t,envMap:$0,envMapMode:$0&&a.mapping,envMapCubeUVHeight:W0,aoMap:e,lightMap:L0,bumpMap:M0,normalMap:x0,displacementMap:S,emissiveMap:e0,normalMapObjectSpace:x0&&L.normalMapType===uK,normalMapTangentSpace:x0&&L.normalMapType===WZ,packedNormalMap:x0&&L.normalMapType===WZ&&z1(L.normalMap.format),metalnessMap:y0,roughnessMap:g0,anisotropy:K0,anisotropyMap:i,clearcoat:HJ,clearcoatMap:J0,clearcoatNormalMap:Z0,clearcoatRoughnessMap:q0,dispersion:A0,iridescence:w,iridescenceMap:c,iridescenceThicknessMap:o,sheen:B,sheenColorMap:E0,sheenRoughnessMap:C0,specularMap:X0,specularColorMap:F0,specularIntensityMap:n0,transmission:f,transmissionMap:a0,thicknessMap:JJ,gradientMap:j,opaque:L.transparent===!1&&L.blending===w7&&L.alphaToCoverage===!1,alphaMap:U0,alphaTest:n,alphaHash:Y0,combine:L.combine,mapUv:l0&&R(L.map.channel),aoMapUv:e&&R(L.aoMap.channel),lightMapUv:L0&&R(L.lightMap.channel),bumpMapUv:M0&&R(L.bumpMap.channel),normalMapUv:x0&&R(L.normalMap.channel),displacementMapUv:S&&R(L.displacementMap.channel),emissiveMapUv:e0&&R(L.emissiveMap.channel),metalnessMapUv:y0&&R(L.metalnessMap.channel),roughnessMapUv:g0&&R(L.roughnessMap.channel),anisotropyMapUv:i&&R(L.anisotropyMap.channel),clearcoatMapUv:J0&&R(L.clearcoatMap.channel),clearcoatNormalMapUv:Z0&&R(L.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:q0&&R(L.clearcoatRoughnessMap.channel),iridescenceMapUv:c&&R(L.iridescenceMap.channel),iridescenceThicknessMapUv:o&&R(L.iridescenceThicknessMap.channel),sheenColorMapUv:E0&&R(L.sheenColorMap.channel),sheenRoughnessMapUv:C0&&R(L.sheenRoughnessMap.channel),specularMapUv:X0&&R(L.specularMap.channel),specularColorMapUv:F0&&R(L.specularColorMap.channel),specularIntensityMapUv:n0&&R(L.specularIntensityMap.channel),transmissionMapUv:a0&&R(L.transmissionMap.channel),thicknessMapUv:JJ&&R(L.thicknessMap.channel),alphaMapUv:U0&&R(L.alphaMap.channel),vertexTangents:!!l.attributes.tangent&&(x0||K0),vertexNormals:!!l.attributes.normal,vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,pointsUvs:g.isPoints===!0&&!!l.attributes.uv&&(l0||U0),fog:!!y,useFog:L.fog===!0,fogExp2:!!y&&y.isFogExp2,flatShading:L.wireframe===!1&&(L.flatShading===!0||l.attributes.normal===void 0&&x0===!1&&(L.isMeshLambertMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isMeshPhysicalMaterial)),sizeAttenuation:L.sizeAttenuation===!0,logarithmicDepthBuffer:N,reversedDepthBuffer:b0,skinning:g.isSkinnedMesh===!0,morphTargets:l.morphAttributes.position!==void 0,morphNormals:l.morphAttributes.normal!==void 0,morphColors:l.morphAttributes.color!==void 0,morphTargetsCount:B0,morphTextureStride:ZJ,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numLightProbeGrids:u.length,numClippingPlanes:K.numPlanes,numClipIntersection:K.numIntersection,dithering:L.dithering,shadowMapEnabled:J.shadowMap.enabled&&b.length>0,shadowMapType:J.shadowMap.type,toneMapping:Q0,decodeVideoTexture:l0&&L.map.isVideoTexture===!0&&$J.getTransfer(L.map.colorSpace)===qJ,decodeVideoTextureEmissive:e0&&L.emissiveMap.isVideoTexture===!0&&$J.getTransfer(L.emissiveMap.colorSpace)===qJ,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===k9,flipSided:L.side===cJ,useDepthPacking:L.depthPacking>=0,depthPacking:L.depthPacking||0,index0AttributeName:L.index0AttributeName,extensionClipCullDistance:w0&&L.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(w0&&L.extensions.multiDraw===!0||p0)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:L.customProgramCacheKey()};return v0.vertexUv1s=H.has(1),v0.vertexUv2s=H.has(2),v0.vertexUv3s=H.has(3),H.clear(),v0}function F(L){let I=[];if(L.shaderID)I.push(L.shaderID);else I.push(L.customVertexShaderID),I.push(L.customFragmentShaderID);if(L.defines!==void 0)for(let b in L.defines)I.push(b),I.push(L.defines[b]);if(L.isRawShaderMaterial===!1)D(I,L),k(I,L),I.push(J.outputColorSpace);return I.push(L.customProgramCacheKey),I.join()}function D(L,I){L.push(I.precision),L.push(I.outputColorSpace),L.push(I.envMapMode),L.push(I.envMapCubeUVHeight),L.push(I.mapUv),L.push(I.alphaMapUv),L.push(I.lightMapUv),L.push(I.aoMapUv),L.push(I.bumpMapUv),L.push(I.normalMapUv),L.push(I.displacementMapUv),L.push(I.emissiveMapUv),L.push(I.metalnessMapUv),L.push(I.roughnessMapUv),L.push(I.anisotropyMapUv),L.push(I.clearcoatMapUv),L.push(I.clearcoatNormalMapUv),L.push(I.clearcoatRoughnessMapUv),L.push(I.iridescenceMapUv),L.push(I.iridescenceThicknessMapUv),L.push(I.sheenColorMapUv),L.push(I.sheenRoughnessMapUv),L.push(I.specularMapUv),L.push(I.specularColorMapUv),L.push(I.specularIntensityMapUv),L.push(I.transmissionMapUv),L.push(I.thicknessMapUv),L.push(I.combine),L.push(I.fogExp2),L.push(I.sizeAttenuation),L.push(I.morphTargetsCount),L.push(I.morphAttributeCount),L.push(I.numDirLights),L.push(I.numPointLights),L.push(I.numSpotLights),L.push(I.numSpotLightMaps),L.push(I.numHemiLights),L.push(I.numRectAreaLights),L.push(I.numDirLightShadows),L.push(I.numPointLightShadows),L.push(I.numSpotLightShadows),L.push(I.numSpotLightShadowsWithMaps),L.push(I.numLightProbes),L.push(I.shadowMapType),L.push(I.toneMapping),L.push(I.numClippingPlanes),L.push(I.numClipIntersection),L.push(I.depthPacking)}function k(L,I){if(Y.disableAll(),I.instancing)Y.enable(0);if(I.instancingColor)Y.enable(1);if(I.instancingMorph)Y.enable(2);if(I.matcap)Y.enable(3);if(I.envMap)Y.enable(4);if(I.normalMapObjectSpace)Y.enable(5);if(I.normalMapTangentSpace)Y.enable(6);if(I.clearcoat)Y.enable(7);if(I.iridescence)Y.enable(8);if(I.alphaTest)Y.enable(9);if(I.vertexColors)Y.enable(10);if(I.vertexAlphas)Y.enable(11);if(I.vertexUv1s)Y.enable(12);if(I.vertexUv2s)Y.enable(13);if(I.vertexUv3s)Y.enable(14);if(I.vertexTangents)Y.enable(15);if(I.anisotropy)Y.enable(16);if(I.alphaHash)Y.enable(17);if(I.batching)Y.enable(18);if(I.dispersion)Y.enable(19);if(I.batchingColor)Y.enable(20);if(I.gradientMap)Y.enable(21);if(I.packedNormalMap)Y.enable(22);if(I.vertexNormals)Y.enable(23);if(L.push(Y.mask),Y.disableAll(),I.fog)Y.enable(0);if(I.useFog)Y.enable(1);if(I.flatShading)Y.enable(2);if(I.logarithmicDepthBuffer)Y.enable(3);if(I.reversedDepthBuffer)Y.enable(4);if(I.skinning)Y.enable(5);if(I.morphTargets)Y.enable(6);if(I.morphNormals)Y.enable(7);if(I.morphColors)Y.enable(8);if(I.premultipliedAlpha)Y.enable(9);if(I.shadowMapEnabled)Y.enable(10);if(I.doubleSided)Y.enable(11);if(I.flipSided)Y.enable(12);if(I.useDepthPacking)Y.enable(13);if(I.dithering)Y.enable(14);if(I.transmission)Y.enable(15);if(I.sheen)Y.enable(16);if(I.opaque)Y.enable(17);if(I.pointsUvs)Y.enable(18);if(I.decodeVideoTexture)Y.enable(19);if(I.decodeVideoTextureEmissive)Y.enable(20);if(I.alphaToCoverage)Y.enable(21);if(I.numLightProbeGrids>0)Y.enable(22);L.push(Y.mask)}function M(L){let I=q[L.type],b;if(I){let T=V9[I];b=OY.clone(T.uniforms)}else b=L.uniforms;return b}function V(L,I){let b=E.get(I);if(b!==void 0)++b.usedTimes;else b=new V1(J,I,L,W),U.push(b),E.set(I,b);return b}function _(L){if(--L.usedTimes===0){let I=U.indexOf(L);U[I]=U[U.length-1],U.pop(),E.delete(L.cacheKey),L.destroy()}}function A(L){X.remove(L)}function C(){X.dispose()}return{getParameters:O,getProgramCacheKey:F,getUniforms:M,acquireProgram:V,releaseProgram:_,releaseShaderCache:A,programs:U,dispose:C}}function _1(){let J=new WeakMap;function Q(Y){return J.has(Y)}function $(Y){let X=J.get(Y);if(X===void 0)X={},J.set(Y,X);return X}function Z(Y){J.delete(Y)}function W(Y,X,H){J.get(Y)[X]=H}function K(){J=new WeakMap}return{has:Q,get:$,remove:Z,update:W,dispose:K}}function A1(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 hG(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 xG(){let J=[],Q=0,$=[],Z=[],W=[];function K(){Q=0,$.length=0,Z.length=0,W.length=0}function Y(G){let q=0;if(G.isInstancedMesh)q+=2;if(G.isSkinnedMesh)q+=1;return q}function X(G,q,R,O,F,D){let k=J[Q];if(k===void 0)k={id:G.id,object:G,geometry:q,material:R,materialVariant:Y(G),groupOrder:O,renderOrder:G.renderOrder,z:F,group:D},J[Q]=k;else k.id=G.id,k.object=G,k.geometry=q,k.material=R,k.materialVariant=Y(G),k.groupOrder=O,k.renderOrder=G.renderOrder,k.z=F,k.group=D;return Q++,k}function H(G,q,R,O,F,D){let k=X(G,q,R,O,F,D);if(R.transmission>0)Z.push(k);else if(R.transparent===!0)W.push(k);else $.push(k)}function U(G,q,R,O,F,D){let k=X(G,q,R,O,F,D);if(R.transmission>0)Z.unshift(k);else if(R.transparent===!0)W.unshift(k);else $.unshift(k)}function E(G,q){if($.length>1)$.sort(G||A1);if(Z.length>1)Z.sort(q||hG);if(W.length>1)W.sort(q||hG)}function N(){for(let G=Q,q=J.length;G<q;G++){let R=J[G];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:K,push:H,unshift:U,finish:N,sort:E}}function C1(){let J=new WeakMap;function Q(Z,W){let K=J.get(Z),Y;if(K===void 0)Y=new xG,J.set(Z,[Y]);else if(W>=K.length)Y=new xG,K.push(Y);else Y=K[W];return Y}function $(){J=new WeakMap}return{get:Q,dispose:$}}function w1(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new P,color:new V0};break;case"SpotLight":$={position:new P,direction:new P,color:new V0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new P,color:new V0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new P,skyColor:new V0,groundColor:new V0};break;case"RectAreaLight":$={color:new V0,position:new P,halfWidth:new P,halfHeight:new P};break}return J[Q.id]=$,$}}}function P1(){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 r};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new r};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new r,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}function S1(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function j1(J){let Q=new w1,$=P1(),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 P);let W=new P,K=new d0,Y=new d0;function X(U){let E=0,N=0,G=0;for(let I=0;I<9;I++)Z.probe[I].set(0,0,0);let q=0,R=0,O=0,F=0,D=0,k=0,M=0,V=0,_=0,A=0,C=0;U.sort(S1);for(let I=0,b=U.length;I<b;I++){let T=U[I],g=T.color,u=T.intensity,y=T.distance,l=null;if(T.shadow&&T.shadow.map)if(T.shadow.map.texture.format===D8)l=T.shadow.map.texture;else l=T.shadow.map.depthTexture||T.shadow.map.texture;if(T.isAmbientLight)E+=g.r*u,N+=g.g*u,G+=g.b*u;else if(T.isLightProbe){for(let h=0;h<9;h++)Z.probe[h].addScaledVector(T.sh.coefficients[h],u);C++}else if(T.isDirectionalLight){let h=Q.get(T);if(h.color.copy(T.color).multiplyScalar(T.intensity),T.castShadow){let m=T.shadow,a=$.get(T);a.shadowIntensity=m.intensity,a.shadowBias=m.bias,a.shadowNormalBias=m.normalBias,a.shadowRadius=m.radius,a.shadowMapSize=m.mapSize,Z.directionalShadow[q]=a,Z.directionalShadowMap[q]=l,Z.directionalShadowMatrix[q]=T.shadow.matrix,k++}Z.directional[q]=h,q++}else if(T.isSpotLight){let h=Q.get(T);h.position.setFromMatrixPosition(T.matrixWorld),h.color.copy(g).multiplyScalar(u),h.distance=y,h.coneCos=Math.cos(T.angle),h.penumbraCos=Math.cos(T.angle*(1-T.penumbra)),h.decay=T.decay,Z.spot[O]=h;let m=T.shadow;if(T.map){if(Z.spotLightMap[_]=T.map,_++,m.updateMatrices(T),T.castShadow)A++}if(Z.spotLightMatrix[O]=m.matrix,T.castShadow){let a=$.get(T);a.shadowIntensity=m.intensity,a.shadowBias=m.bias,a.shadowNormalBias=m.normalBias,a.shadowRadius=m.radius,a.shadowMapSize=m.mapSize,Z.spotShadow[O]=a,Z.spotShadowMap[O]=l,V++}O++}else if(T.isRectAreaLight){let h=Q.get(T);h.color.copy(g).multiplyScalar(u),h.halfWidth.set(T.width*0.5,0,0),h.halfHeight.set(0,T.height*0.5,0),Z.rectArea[F]=h,F++}else if(T.isPointLight){let h=Q.get(T);if(h.color.copy(T.color).multiplyScalar(T.intensity),h.distance=T.distance,h.decay=T.decay,T.castShadow){let m=T.shadow,a=$.get(T);a.shadowIntensity=m.intensity,a.shadowBias=m.bias,a.shadowNormalBias=m.normalBias,a.shadowRadius=m.radius,a.shadowMapSize=m.mapSize,a.shadowCameraNear=m.camera.near,a.shadowCameraFar=m.camera.far,Z.pointShadow[R]=a,Z.pointShadowMap[R]=l,Z.pointShadowMatrix[R]=T.shadow.matrix,M++}Z.point[R]=h,R++}else if(T.isHemisphereLight){let h=Q.get(T);h.skyColor.copy(T.color).multiplyScalar(u),h.groundColor.copy(T.groundColor).multiplyScalar(u),Z.hemi[D]=h,D++}}if(F>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=D0.LTC_FLOAT_1,Z.rectAreaLTC2=D0.LTC_FLOAT_2;else Z.rectAreaLTC1=D0.LTC_HALF_1,Z.rectAreaLTC2=D0.LTC_HALF_2;Z.ambient[0]=E,Z.ambient[1]=N,Z.ambient[2]=G;let L=Z.hash;if(L.directionalLength!==q||L.pointLength!==R||L.spotLength!==O||L.rectAreaLength!==F||L.hemiLength!==D||L.numDirectionalShadows!==k||L.numPointShadows!==M||L.numSpotShadows!==V||L.numSpotMaps!==_||L.numLightProbes!==C)Z.directional.length=q,Z.spot.length=O,Z.rectArea.length=F,Z.point.length=R,Z.hemi.length=D,Z.directionalShadow.length=k,Z.directionalShadowMap.length=k,Z.pointShadow.length=M,Z.pointShadowMap.length=M,Z.spotShadow.length=V,Z.spotShadowMap.length=V,Z.directionalShadowMatrix.length=k,Z.pointShadowMatrix.length=M,Z.spotLightMatrix.length=V+_-A,Z.spotLightMap.length=_,Z.numSpotLightShadowsWithMaps=A,Z.numLightProbes=C,L.directionalLength=q,L.pointLength=R,L.spotLength=O,L.rectAreaLength=F,L.hemiLength=D,L.numDirectionalShadows=k,L.numPointShadows=M,L.numSpotShadows=V,L.numSpotMaps=_,L.numLightProbes=C,Z.version=T1++}function H(U,E){let N=0,G=0,q=0,R=0,O=0,F=E.matrixWorldInverse;for(let D=0,k=U.length;D<k;D++){let M=U[D];if(M.isDirectionalLight){let V=Z.directional[N];V.direction.setFromMatrixPosition(M.matrixWorld),W.setFromMatrixPosition(M.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(F),N++}else if(M.isSpotLight){let V=Z.spot[q];V.position.setFromMatrixPosition(M.matrixWorld),V.position.applyMatrix4(F),V.direction.setFromMatrixPosition(M.matrixWorld),W.setFromMatrixPosition(M.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(F),q++}else if(M.isRectAreaLight){let V=Z.rectArea[R];V.position.setFromMatrixPosition(M.matrixWorld),V.position.applyMatrix4(F),Y.identity(),K.copy(M.matrixWorld),K.premultiply(F),Y.extractRotation(K),V.halfWidth.set(M.width*0.5,0,0),V.halfHeight.set(0,M.height*0.5,0),V.halfWidth.applyMatrix4(Y),V.halfHeight.applyMatrix4(Y),R++}else if(M.isPointLight){let V=Z.point[G];V.position.setFromMatrixPosition(M.matrixWorld),V.position.applyMatrix4(F),G++}else if(M.isHemisphereLight){let V=Z.hemi[O];V.direction.setFromMatrixPosition(M.matrixWorld),V.direction.transformDirection(F),O++}}}return{setup:X,setupView:H,state:Z}}function gG(J){let Q=new j1(J),$=[],Z=[],W=[];function K(G){N.camera=G,$.length=0,Z.length=0,W.length=0}function Y(G){$.push(G)}function X(G){Z.push(G)}function H(G){W.push(G)}function U(){Q.setup($)}function E(G){Q.setupView($,G)}let N={lightsArray:$,shadowsArray:Z,lightProbeGridArray:W,camera:null,lights:Q,transmissionRenderTarget:{},textureUnits:0};return{init:K,state:N,setupLights:U,setupLightsView:E,pushLight:Y,pushShadow:X,pushLightProbeGrid:H}}function y1(J){let Q=new WeakMap;function $(W,K=0){let Y=Q.get(W),X;if(Y===void 0)X=new gG(J),Q.set(W,[X]);else if(K>=Y.length)X=new gG(J),Y.push(X);else X=Y[K];return X}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}function x1(J,Q,$){let Z=new O8,W=new r,K=new r,Y=new GJ,X=new $Q,H=new ZQ,U={},E=$.maxTextureSize,N={[l8]:cJ,[cJ]:l8,[k9]:k9},G=new aJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new r},radius:{value:4}},vertexShader:v1,fragmentShader:f1}),q=G.clone();q.defines.HORIZONTAL_PASS=1;let R=new c0;R.setAttribute("position",new UJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let O=new VJ(R,G),F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=C7;let D=this.type;this.render=function(A,C,L){if(F.enabled===!1)return;if(F.autoUpdate===!1&&F.needsUpdate===!1)return;if(A.length===0)return;if(this.type===ZK)H0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=C7;let I=J.getRenderTarget(),b=J.getActiveCubeFace(),T=J.getActiveMipmapLevel(),g=J.state;if(g.setBlending(M9),g.buffers.depth.getReversed()===!0)g.buffers.color.setClear(0,0,0,0);else g.buffers.color.setClear(1,1,1,1);g.buffers.depth.setTest(!0),g.setScissorTest(!1);let u=D!==this.type;if(u)C.traverse(function(y){if(y.material)if(Array.isArray(y.material))y.material.forEach((l)=>l.needsUpdate=!0);else y.material.needsUpdate=!0});for(let y=0,l=A.length;y<l;y++){let h=A[y],m=h.shadow;if(m===void 0){H0("WebGLShadowMap:",h,"has no shadow.");continue}if(m.autoUpdate===!1&&m.needsUpdate===!1)continue;W.copy(m.mapSize);let a=m.getFrameExtents();if(W.multiply(a),K.copy(m.mapSize),W.x>E||W.y>E){if(W.x>E)K.x=Math.floor(E/a.x),W.x=K.x*a.x,m.mapSize.x=K.x;if(W.y>E)K.y=Math.floor(E/a.y),W.y=K.y*a.y,m.mapSize.y=K.y}let W0=J.state.buffers.depth.getReversed();if(m.camera._reversedDepth=W0,m.map===null||u===!0){if(m.map!==null){if(m.map.depthTexture!==null)m.map.depthTexture.dispose(),m.map.depthTexture=null;m.map.dispose()}if(this.type===d8){if(h.isPointLight){H0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}m.map=new sJ(W.x,W.y,{format:D8,type:S9,minFilter:nJ,magFilter:nJ,generateMipmaps:!1}),m.map.texture.name=h.name+".shadowMap",m.map.depthTexture=new n9(W.x,W.y,T9),m.map.depthTexture.name=h.name+".shadowMapDepth",m.map.depthTexture.format=N8,m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=u9,m.map.depthTexture.magFilter=u9}else{if(h.isPointLight)m.map=new HW(W.x),m.map.depthTexture=new MZ(W.x,c9);else m.map=new sJ(W.x,W.y),m.map.depthTexture=new n9(W.x,W.y,c9);if(m.map.depthTexture.name=h.name+".shadowMap",m.map.depthTexture.format=N8,this.type===C7)m.map.depthTexture.compareFunction=W0?_6:I6,m.map.depthTexture.minFilter=nJ,m.map.depthTexture.magFilter=nJ;else m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=u9,m.map.depthTexture.magFilter=u9}m.camera.updateProjectionMatrix()}let N0=m.map.isWebGLCubeRenderTarget?6:1;for(let j0=0;j0<N0;j0++){if(m.map.isWebGLCubeRenderTarget)J.setRenderTarget(m.map,j0),J.clear();else{if(j0===0)J.setRenderTarget(m.map),J.clear();let B0=m.getViewport(j0);Y.set(K.x*B0.x,K.y*B0.y,K.x*B0.z,K.y*B0.w),g.viewport(Y)}if(h.isPointLight){let{camera:B0,matrix:ZJ}=m,t0=h.distance||B0.far;if(t0!==B0.far)B0.far=t0,B0.updateProjectionMatrix();EQ.setFromMatrixPosition(h.matrixWorld),B0.position.copy(EQ),FX.copy(B0.position),FX.add(b1[j0]),B0.up.copy(h1[j0]),B0.lookAt(FX),B0.updateMatrixWorld(),ZJ.makeTranslation(-EQ.x,-EQ.y,-EQ.z),pG.multiplyMatrices(B0.projectionMatrix,B0.matrixWorldInverse),m._frustum.setFromProjectionMatrix(pG,B0.coordinateSystem,B0.reversedDepth)}else m.updateMatrices(h);Z=m.getFrustum(),V(C,L,m.camera,h,this.type)}if(m.isPointLightShadow!==!0&&this.type===d8)k(m,L);m.needsUpdate=!1}D=this.type,F.needsUpdate=!1,J.setRenderTarget(I,b,T)};function k(A,C){let L=Q.update(O);if(G.defines.VSM_SAMPLES!==A.blurSamples)G.defines.VSM_SAMPLES=A.blurSamples,q.defines.VSM_SAMPLES=A.blurSamples,G.needsUpdate=!0,q.needsUpdate=!0;if(A.mapPass===null)A.mapPass=new sJ(W.x,W.y,{format:D8,type:S9});G.uniforms.shadow_pass.value=A.map.depthTexture,G.uniforms.resolution.value=A.mapSize,G.uniforms.radius.value=A.radius,J.setRenderTarget(A.mapPass),J.clear(),J.renderBufferDirect(C,null,L,G,O,null),q.uniforms.shadow_pass.value=A.mapPass.texture,q.uniforms.resolution.value=A.mapSize,q.uniforms.radius.value=A.radius,J.setRenderTarget(A.map),J.clear(),J.renderBufferDirect(C,null,L,q,O,null)}function M(A,C,L,I){let b=null,T=L.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(T!==void 0)b=T;else if(b=L.isPointLight===!0?H:X,J.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){let g=b.uuid,u=C.uuid,y=U[g];if(y===void 0)y={},U[g]=y;let l=y[u];if(l===void 0)l=b.clone(),y[u]=l,C.addEventListener("dispose",_);b=l}if(b.visible=C.visible,b.wireframe=C.wireframe,I===d8)b.side=C.shadowSide!==null?C.shadowSide:C.side;else b.side=C.shadowSide!==null?C.shadowSide:N[C.side];if(b.alphaMap=C.alphaMap,b.alphaTest=C.alphaToCoverage===!0?0.5:C.alphaTest,b.map=C.map,b.clipShadows=C.clipShadows,b.clippingPlanes=C.clippingPlanes,b.clipIntersection=C.clipIntersection,b.displacementMap=C.displacementMap,b.displacementScale=C.displacementScale,b.displacementBias=C.displacementBias,b.wireframeLinewidth=C.wireframeLinewidth,b.linewidth=C.linewidth,L.isPointLight===!0&&b.isMeshDistanceMaterial===!0){let g=J.properties.get(b);g.light=L}return b}function V(A,C,L,I,b){if(A.visible===!1)return;if(A.layers.test(C.layers)&&(A.isMesh||A.isLine||A.isPoints)){if((A.castShadow||A.receiveShadow&&b===d8)&&(!A.frustumCulled||Z.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,A.matrixWorld);let u=Q.update(A),y=A.material;if(Array.isArray(y)){let l=u.groups;for(let h=0,m=l.length;h<m;h++){let a=l[h],W0=y[a.materialIndex];if(W0&&W0.visible){let N0=M(A,W0,I,b);A.onBeforeShadow(J,A,C,L,u,N0,a),J.renderBufferDirect(L,null,u,N0,A,a),A.onAfterShadow(J,A,C,L,u,N0,a)}}}else if(y.visible){let l=M(A,y,I,b);A.onBeforeShadow(J,A,C,L,u,l,null),J.renderBufferDirect(L,null,u,l,A,null),A.onAfterShadow(J,A,C,L,u,l,null)}}}let g=A.children;for(let u=0,y=g.length;u<y;u++)V(g[u],C,L,I,b)}function _(A){A.target.removeEventListener("dispose",_);for(let L in U){let I=U[L],b=A.target.uuid;if(b in I)I[b].dispose(),delete I[b]}}}function g1(J,Q){function $(){let j=!1,U0=new GJ,n=null,Y0=new GJ(0,0,0,0);return{setMask:function(w0){if(n!==w0&&!j)J.colorMask(w0,w0,w0,w0),n=w0},setLocked:function(w0){j=w0},setClear:function(w0,Q0,v0,s0,_J){if(_J===!0)w0*=s0,Q0*=s0,v0*=s0;if(U0.set(w0,Q0,v0,s0),Y0.equals(U0)===!1)J.clearColor(w0,Q0,v0,s0),Y0.copy(U0)},reset:function(){j=!1,n=null,Y0.set(-1,0,0,0)}}}function Z(){let j=!1,U0=!1,n=null,Y0=null,w0=null;return{setReversed:function(Q0){if(U0!==Q0){let v0=Q.get("EXT_clip_control");if(Q0)v0.clipControlEXT(v0.LOWER_LEFT_EXT,v0.ZERO_TO_ONE_EXT);else v0.clipControlEXT(v0.LOWER_LEFT_EXT,v0.NEGATIVE_ONE_TO_ONE_EXT);U0=Q0;let s0=w0;w0=null,this.setClear(s0)}},getReversed:function(){return U0},setTest:function(Q0){if(Q0)G0(J.DEPTH_TEST);else b0(J.DEPTH_TEST)},setMask:function(Q0){if(n!==Q0&&!j)J.depthMask(Q0),n=Q0},setFunc:function(Q0){if(U0)Q0=$G[Q0];if(Y0!==Q0){switch(Q0){case IK:J.depthFunc(J.NEVER);break;case _K:J.depthFunc(J.ALWAYS);break;case AK:J.depthFunc(J.LESS);break;case D$:J.depthFunc(J.LEQUAL);break;case CK:J.depthFunc(J.EQUAL);break;case wK:J.depthFunc(J.GEQUAL);break;case PK:J.depthFunc(J.GREATER);break;case TK:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}Y0=Q0}},setLocked:function(Q0){j=Q0},setClear:function(Q0){if(w0!==Q0){if(w0=Q0,U0)Q0=1-Q0;J.clearDepth(Q0)}},reset:function(){j=!1,n=null,Y0=null,w0=null,U0=!1}}}function W(){let j=!1,U0=null,n=null,Y0=null,w0=null,Q0=null,v0=null,s0=null,_J=null;return{setTest:function(EJ){if(!j)if(EJ)G0(J.STENCIL_TEST);else b0(J.STENCIL_TEST)},setMask:function(EJ){if(U0!==EJ&&!j)J.stencilMask(EJ),U0=EJ},setFunc:function(EJ,B9,N9){if(n!==EJ||Y0!==B9||w0!==N9)J.stencilFunc(EJ,B9,N9),n=EJ,Y0=B9,w0=N9},setOp:function(EJ,B9,N9){if(Q0!==EJ||v0!==B9||s0!==N9)J.stencilOp(EJ,B9,N9),Q0=EJ,v0=B9,s0=N9},setLocked:function(EJ){j=EJ},setClear:function(EJ){if(_J!==EJ)J.clearStencil(EJ),_J=EJ},reset:function(){j=!1,U0=null,n=null,Y0=null,w0=null,Q0=null,v0=null,s0=null,_J=null}}}let K=new $,Y=new Z,X=new W,H=new WeakMap,U=new WeakMap,E={},N={},G={},q=new WeakMap,R=[],O=null,F=!1,D=null,k=null,M=null,V=null,_=null,A=null,C=null,L=new V0(0,0,0),I=0,b=!1,T=null,g=null,u=null,y=null,l=null,h=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),m=!1,a=0,W0=J.getParameter(J.VERSION);if(W0.indexOf("WebGL")!==-1)a=parseFloat(/^WebGL (\d)/.exec(W0)[1]),m=a>=1;else if(W0.indexOf("OpenGL ES")!==-1)a=parseFloat(/^OpenGL ES (\d)/.exec(W0)[1]),m=a>=2;let N0=null,j0={},B0=J.getParameter(J.SCISSOR_BOX),ZJ=J.getParameter(J.VIEWPORT),t0=new GJ().fromArray(B0),s=new GJ().fromArray(ZJ);function R0(j,U0,n,Y0){let w0=new Uint8Array(4),Q0=J.createTexture();J.bindTexture(j,Q0),J.texParameteri(j,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(j,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let v0=0;v0<n;v0++)if(j===J.TEXTURE_3D||j===J.TEXTURE_2D_ARRAY)J.texImage3D(U0,0,J.RGBA,1,1,Y0,0,J.RGBA,J.UNSIGNED_BYTE,w0);else J.texImage2D(U0+v0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,w0);return Q0}let P0={};P0[J.TEXTURE_2D]=R0(J.TEXTURE_2D,J.TEXTURE_2D,1),P0[J.TEXTURE_CUBE_MAP]=R0(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),P0[J.TEXTURE_2D_ARRAY]=R0(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),P0[J.TEXTURE_3D]=R0(J.TEXTURE_3D,J.TEXTURE_3D,1,1),K.setClear(0,0,0,1),Y.setClear(1),X.setClear(0),G0(J.DEPTH_TEST),Y.setFunc(D$),M0(!1),x0(G$),G0(J.CULL_FACE),e(M9);function G0(j){if(E[j]!==!0)J.enable(j),E[j]=!0}function b0(j){if(E[j]!==!1)J.disable(j),E[j]=!1}function YJ(j,U0){if(G[j]!==U0){if(J.bindFramebuffer(j,U0),G[j]=U0,j===J.DRAW_FRAMEBUFFER)G[J.FRAMEBUFFER]=U0;if(j===J.FRAMEBUFFER)G[J.DRAW_FRAMEBUFFER]=U0;return!0}return!1}function p0(j,U0){let n=R,Y0=!1;if(j){if(n=q.get(U0),n===void 0)n=[],q.set(U0,n);let w0=j.textures;if(n.length!==w0.length||n[0]!==J.COLOR_ATTACHMENT0){for(let Q0=0,v0=w0.length;Q0<v0;Q0++)n[Q0]=J.COLOR_ATTACHMENT0+Q0;n.length=w0.length,Y0=!0}}else if(n[0]!==J.BACK)n[0]=J.BACK,Y0=!0;if(Y0)J.drawBuffers(n)}function l0(j){if(O!==j)return J.useProgram(j),O=j,!0;return!1}let t={[u8]:J.FUNC_ADD,[KK]:J.FUNC_SUBTRACT,[YK]:J.FUNC_REVERSE_SUBTRACT};t[XK]=J.MIN,t[HK]=J.MAX;let $0={[UK]:J.ZERO,[GK]:J.ONE,[EK]:J.SRC_COLOR,[qK]:J.SRC_ALPHA,[MK]:J.SRC_ALPHA_SATURATE,[OK]:J.DST_COLOR,[FK]:J.DST_ALPHA,[NK]:J.ONE_MINUS_SRC_COLOR,[DK]:J.ONE_MINUS_SRC_ALPHA,[kK]:J.ONE_MINUS_DST_COLOR,[RK]:J.ONE_MINUS_DST_ALPHA,[LK]:J.CONSTANT_COLOR,[VK]:J.ONE_MINUS_CONSTANT_COLOR,[BK]:J.CONSTANT_ALPHA,[zK]:J.ONE_MINUS_CONSTANT_ALPHA};function e(j,U0,n,Y0,w0,Q0,v0,s0,_J,EJ){if(j===M9){if(F===!0)b0(J.BLEND),F=!1;return}if(F===!1)G0(J.BLEND),F=!0;if(j!==WK){if(j!==D||EJ!==b){if(k!==u8||_!==u8)J.blendEquation(J.FUNC_ADD),k=u8,_=u8;if(EJ)switch(j){case w7:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case E$:J.blendFunc(J.ONE,J.ONE);break;case N$: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:T0("WebGLState: Invalid blending: ",j);break}else switch(j){case w7:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case E$:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case N$:T0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case q$:T0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:T0("WebGLState: Invalid blending: ",j);break}M=null,V=null,A=null,C=null,L.set(0,0,0),I=0,D=j,b=EJ}return}if(w0=w0||U0,Q0=Q0||n,v0=v0||Y0,U0!==k||w0!==_)J.blendEquationSeparate(t[U0],t[w0]),k=U0,_=w0;if(n!==M||Y0!==V||Q0!==A||v0!==C)J.blendFuncSeparate($0[n],$0[Y0],$0[Q0],$0[v0]),M=n,V=Y0,A=Q0,C=v0;if(s0.equals(L)===!1||_J!==I)J.blendColor(s0.r,s0.g,s0.b,_J),L.copy(s0),I=_J;D=j,b=!1}function L0(j,U0){j.side===k9?b0(J.CULL_FACE):G0(J.CULL_FACE);let n=j.side===cJ;if(U0)n=!n;M0(n),j.blending===w7&&j.transparent===!1?e(M9):e(j.blending,j.blendEquation,j.blendSrc,j.blendDst,j.blendEquationAlpha,j.blendSrcAlpha,j.blendDstAlpha,j.blendColor,j.blendAlpha,j.premultipliedAlpha),Y.setFunc(j.depthFunc),Y.setTest(j.depthTest),Y.setMask(j.depthWrite),K.setMask(j.colorWrite);let Y0=j.stencilWrite;if(X.setTest(Y0),Y0)X.setMask(j.stencilWriteMask),X.setFunc(j.stencilFunc,j.stencilRef,j.stencilFuncMask),X.setOp(j.stencilFail,j.stencilZFail,j.stencilZPass);e0(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits),j.alphaToCoverage===!0?G0(J.SAMPLE_ALPHA_TO_COVERAGE):b0(J.SAMPLE_ALPHA_TO_COVERAGE)}function M0(j){if(T!==j){if(j)J.frontFace(J.CW);else J.frontFace(J.CCW);T=j}}function x0(j){if(j!==QK){if(G0(J.CULL_FACE),j!==g)if(j===G$)J.cullFace(J.BACK);else if(j===$K)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else b0(J.CULL_FACE);g=j}function S(j){if(j!==u){if(m)J.lineWidth(j);u=j}}function e0(j,U0,n){if(j){if(G0(J.POLYGON_OFFSET_FILL),y!==U0||l!==n){if(y=U0,l=n,Y.getReversed())U0=-U0;J.polygonOffset(U0,n)}}else b0(J.POLYGON_OFFSET_FILL)}function y0(j){if(j)G0(J.SCISSOR_TEST);else b0(J.SCISSOR_TEST)}function g0(j){if(j===void 0)j=J.TEXTURE0+h-1;if(N0!==j)J.activeTexture(j),N0=j}function K0(j,U0,n){if(n===void 0)if(N0===null)n=J.TEXTURE0+h-1;else n=N0;let Y0=j0[n];if(Y0===void 0)Y0={type:void 0,texture:void 0},j0[n]=Y0;if(Y0.type!==j||Y0.texture!==U0){if(N0!==n)J.activeTexture(n),N0=n;J.bindTexture(j,U0||P0[j]),Y0.type=j,Y0.texture=U0}}function HJ(){let j=j0[N0];if(j!==void 0&&j.type!==void 0)J.bindTexture(j.type,null),j.type=void 0,j.texture=void 0}function A0(){try{J.compressedTexImage2D(...arguments)}catch(j){T0("WebGLState:",j)}}function w(){try{J.compressedTexImage3D(...arguments)}catch(j){T0("WebGLState:",j)}}function B(){try{J.texSubImage2D(...arguments)}catch(j){T0("WebGLState:",j)}}function f(){try{J.texSubImage3D(...arguments)}catch(j){T0("WebGLState:",j)}}function i(){try{J.compressedTexSubImage2D(...arguments)}catch(j){T0("WebGLState:",j)}}function J0(){try{J.compressedTexSubImage3D(...arguments)}catch(j){T0("WebGLState:",j)}}function Z0(){try{J.texStorage2D(...arguments)}catch(j){T0("WebGLState:",j)}}function q0(){try{J.texStorage3D(...arguments)}catch(j){T0("WebGLState:",j)}}function c(){try{J.texImage2D(...arguments)}catch(j){T0("WebGLState:",j)}}function o(){try{J.texImage3D(...arguments)}catch(j){T0("WebGLState:",j)}}function E0(j){if(N[j]!==void 0)return N[j];else return J.getParameter(j)}function C0(j,U0){if(N[j]!==U0)J.pixelStorei(j,U0),N[j]=U0}function X0(j){if(t0.equals(j)===!1)J.scissor(j.x,j.y,j.z,j.w),t0.copy(j)}function F0(j){if(s.equals(j)===!1)J.viewport(j.x,j.y,j.z,j.w),s.copy(j)}function n0(j,U0){let n=U.get(U0);if(n===void 0)n=new WeakMap,U.set(U0,n);let Y0=n.get(j);if(Y0===void 0)Y0=J.getUniformBlockIndex(U0,j.name),n.set(j,Y0)}function a0(j,U0){let Y0=U.get(U0).get(j);if(H.get(U0)!==Y0)J.uniformBlockBinding(U0,Y0,j.__bindingPointIndex),H.set(U0,Y0)}function JJ(){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),Y.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),E={},N={},N0=null,j0={},G={},q=new WeakMap,R=[],O=null,F=!1,D=null,k=null,M=null,V=null,_=null,A=null,C=null,L=new V0(0,0,0),I=0,b=!1,T=null,g=null,u=null,y=null,l=null,t0.set(0,0,J.canvas.width,J.canvas.height),s.set(0,0,J.canvas.width,J.canvas.height),K.reset(),Y.reset(),X.reset()}return{buffers:{color:K,depth:Y,stencil:X},enable:G0,disable:b0,bindFramebuffer:YJ,drawBuffers:p0,useProgram:l0,setBlending:e,setMaterial:L0,setFlipSided:M0,setCullFace:x0,setLineWidth:S,setPolygonOffset:e0,setScissorTest:y0,activeTexture:g0,bindTexture:K0,unbindTexture:HJ,compressedTexImage2D:A0,compressedTexImage3D:w,texImage2D:c,texImage3D:o,pixelStorei:C0,getParameter:E0,updateUBOMapping:n0,uniformBlockBinding:a0,texStorage2D:Z0,texStorage3D:q0,texSubImage2D:B,texSubImage3D:f,compressedTexSubImage2D:i,compressedTexSubImage3D:J0,scissor:X0,viewport:F0,reset:JJ}}function p1(J,Q,$,Z,W,K,Y){let X=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 r,E=new WeakMap,N=new Set,G,q=new WeakMap,R=!1;try{R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(w){}function O(w,B){return R?new OffscreenCanvas(w,B):z7("canvas")}function F(w,B,f){let i=1,J0=A0(w);if(J0.width>f||J0.height>f)i=f/Math.max(J0.width,J0.height);if(i<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 Z0=Math.floor(i*J0.width),q0=Math.floor(i*J0.height);if(G===void 0)G=O(Z0,q0);let c=B?O(Z0,q0):G;return c.width=Z0,c.height=q0,c.getContext("2d").drawImage(w,0,0,Z0,q0),H0("WebGLRenderer: Texture has been resized from ("+J0.width+"x"+J0.height+") to ("+Z0+"x"+q0+")."),c}else{if("data"in w)H0("WebGLRenderer: Image in DataTexture is too big ("+J0.width+"x"+J0.height+").");return w}return w}function D(w){return w.generateMipmaps}function k(w){J.generateMipmap(w)}function M(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 V(w,B,f,i,J0,Z0=!1){if(w!==null){if(J[w]!==void 0)return J[w];H0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let q0;if(i){if(q0=Q.get("EXT_texture_norm16"),!q0)H0("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let c=B;if(B===J.RED){if(f===J.FLOAT)c=J.R32F;if(f===J.HALF_FLOAT)c=J.R16F;if(f===J.UNSIGNED_BYTE)c=J.R8;if(f===J.UNSIGNED_SHORT&&q0)c=q0.R16_EXT;if(f===J.SHORT&&q0)c=q0.R16_SNORM_EXT}if(B===J.RED_INTEGER){if(f===J.UNSIGNED_BYTE)c=J.R8UI;if(f===J.UNSIGNED_SHORT)c=J.R16UI;if(f===J.UNSIGNED_INT)c=J.R32UI;if(f===J.BYTE)c=J.R8I;if(f===J.SHORT)c=J.R16I;if(f===J.INT)c=J.R32I}if(B===J.RG){if(f===J.FLOAT)c=J.RG32F;if(f===J.HALF_FLOAT)c=J.RG16F;if(f===J.UNSIGNED_BYTE)c=J.RG8;if(f===J.UNSIGNED_SHORT&&q0)c=q0.RG16_EXT;if(f===J.SHORT&&q0)c=q0.RG16_SNORM_EXT}if(B===J.RG_INTEGER){if(f===J.UNSIGNED_BYTE)c=J.RG8UI;if(f===J.UNSIGNED_SHORT)c=J.RG16UI;if(f===J.UNSIGNED_INT)c=J.RG32UI;if(f===J.BYTE)c=J.RG8I;if(f===J.SHORT)c=J.RG16I;if(f===J.INT)c=J.RG32I}if(B===J.RGB_INTEGER){if(f===J.UNSIGNED_BYTE)c=J.RGB8UI;if(f===J.UNSIGNED_SHORT)c=J.RGB16UI;if(f===J.UNSIGNED_INT)c=J.RGB32UI;if(f===J.BYTE)c=J.RGB8I;if(f===J.SHORT)c=J.RGB16I;if(f===J.INT)c=J.RGB32I}if(B===J.RGBA_INTEGER){if(f===J.UNSIGNED_BYTE)c=J.RGBA8UI;if(f===J.UNSIGNED_SHORT)c=J.RGBA16UI;if(f===J.UNSIGNED_INT)c=J.RGBA32UI;if(f===J.BYTE)c=J.RGBA8I;if(f===J.SHORT)c=J.RGBA16I;if(f===J.INT)c=J.RGBA32I}if(B===J.RGB){if(f===J.UNSIGNED_SHORT&&q0)c=q0.RGB16_EXT;if(f===J.SHORT&&q0)c=q0.RGB16_SNORM_EXT;if(f===J.UNSIGNED_INT_5_9_9_9_REV)c=J.RGB9_E5;if(f===J.UNSIGNED_INT_10F_11F_11F_REV)c=J.R11F_G11F_B10F}if(B===J.RGBA){let o=Z0?YZ:$J.getTransfer(J0);if(f===J.FLOAT)c=J.RGBA32F;if(f===J.HALF_FLOAT)c=J.RGBA16F;if(f===J.UNSIGNED_BYTE)c=o===qJ?J.SRGB8_ALPHA8:J.RGBA8;if(f===J.UNSIGNED_SHORT&&q0)c=q0.RGBA16_EXT;if(f===J.SHORT&&q0)c=q0.RGBA16_SNORM_EXT;if(f===J.UNSIGNED_SHORT_4_4_4_4)c=J.RGBA4;if(f===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 _(w,B){let f;if(w){if(B===null||B===c9||B===n8)f=J.DEPTH24_STENCIL8;else if(B===T9)f=J.DEPTH32F_STENCIL8;else if(B===S7)f=J.DEPTH24_STENCIL8,H0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(B===null||B===c9||B===n8)f=J.DEPTH_COMPONENT24;else if(B===T9)f=J.DEPTH_COMPONENT32F;else if(B===S7)f=J.DEPTH_COMPONENT16;return f}function A(w,B){if(D(w)===!0||w.isFramebufferTexture&&w.minFilter!==u9&&w.minFilter!==nJ)return Math.log2(Math.max(B.width,B.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 B.mipmaps.length;else return 1}function C(w){let B=w.target;if(B.removeEventListener("dispose",C),I(B),B.isVideoTexture)E.delete(B);if(B.isHTMLTexture)N.delete(B)}function L(w){let B=w.target;B.removeEventListener("dispose",L),T(B)}function I(w){let B=Z.get(w);if(B.__webglInit===void 0)return;let f=w.source,i=q.get(f);if(i){let J0=i[B.__cacheKey];if(J0.usedTimes--,J0.usedTimes===0)b(w);if(Object.keys(i).length===0)q.delete(f)}Z.remove(w)}function b(w){let B=Z.get(w);J.deleteTexture(B.__webglTexture);let f=w.source,i=q.get(f);delete i[B.__cacheKey],Y.memory.textures--}function T(w){let B=Z.get(w);if(w.depthTexture)w.depthTexture.dispose(),Z.remove(w.depthTexture);if(w.isWebGLCubeRenderTarget)for(let i=0;i<6;i++){if(Array.isArray(B.__webglFramebuffer[i]))for(let J0=0;J0<B.__webglFramebuffer[i].length;J0++)J.deleteFramebuffer(B.__webglFramebuffer[i][J0]);else J.deleteFramebuffer(B.__webglFramebuffer[i]);if(B.__webglDepthbuffer)J.deleteRenderbuffer(B.__webglDepthbuffer[i])}else{if(Array.isArray(B.__webglFramebuffer))for(let i=0;i<B.__webglFramebuffer.length;i++)J.deleteFramebuffer(B.__webglFramebuffer[i]);else J.deleteFramebuffer(B.__webglFramebuffer);if(B.__webglDepthbuffer)J.deleteRenderbuffer(B.__webglDepthbuffer);if(B.__webglMultisampledFramebuffer)J.deleteFramebuffer(B.__webglMultisampledFramebuffer);if(B.__webglColorRenderbuffer){for(let i=0;i<B.__webglColorRenderbuffer.length;i++)if(B.__webglColorRenderbuffer[i])J.deleteRenderbuffer(B.__webglColorRenderbuffer[i])}if(B.__webglDepthRenderbuffer)J.deleteRenderbuffer(B.__webglDepthRenderbuffer)}let f=w.textures;for(let i=0,J0=f.length;i<J0;i++){let Z0=Z.get(f[i]);if(Z0.__webglTexture)J.deleteTexture(Z0.__webglTexture),Y.memory.textures--;Z.remove(f[i])}Z.remove(w)}let g=0;function u(){g=0}function y(){return g}function l(w){g=w}function h(){let w=g;if(w>=W.maxTextures)H0("WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+W.maxTextures);return g+=1,w}function m(w){let B=[];return B.push(w.wrapS),B.push(w.wrapT),B.push(w.wrapR||0),B.push(w.magFilter),B.push(w.minFilter),B.push(w.anisotropy),B.push(w.internalFormat),B.push(w.format),B.push(w.type),B.push(w.generateMipmaps),B.push(w.premultiplyAlpha),B.push(w.flipY),B.push(w.unpackAlignment),B.push(w.colorSpace),B.join()}function a(w,B){let f=Z.get(w);if(w.isVideoTexture)K0(w);if(w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&f.__version!==w.version){let i=w.image;if(i===null)H0("WebGLRenderer: Texture marked for update but no image data found.");else if(i.complete===!1)H0("WebGLRenderer: Texture marked for update but image is incomplete");else{b0(f,w,B);return}}else if(w.isExternalTexture)f.__webglTexture=w.sourceTexture?w.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,f.__webglTexture,J.TEXTURE0+B)}function W0(w,B){let f=Z.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&f.__version!==w.version){b0(f,w,B);return}else if(w.isExternalTexture)f.__webglTexture=w.sourceTexture?w.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,f.__webglTexture,J.TEXTURE0+B)}function N0(w,B){let f=Z.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&f.__version!==w.version){b0(f,w,B);return}$.bindTexture(J.TEXTURE_3D,f.__webglTexture,J.TEXTURE0+B)}function j0(w,B){let f=Z.get(w);if(w.isCubeDepthTexture!==!0&&w.version>0&&f.__version!==w.version){YJ(f,w,B);return}$.bindTexture(J.TEXTURE_CUBE_MAP,f.__webglTexture,J.TEXTURE0+B)}let B0={[vK]:J.REPEAT,[R6]:J.CLAMP_TO_EDGE,[fK]:J.MIRRORED_REPEAT},ZJ={[u9]:J.NEAREST,[bK]:J.NEAREST_MIPMAP_NEAREST,[T7]:J.NEAREST_MIPMAP_LINEAR,[nJ]:J.LINEAR,[O6]:J.LINEAR_MIPMAP_NEAREST,[E8]:J.LINEAR_MIPMAP_LINEAR},t0={[nK]:J.NEVER,[rK]:J.ALWAYS,[sK]:J.LESS,[I6]:J.LEQUAL,[iK]:J.EQUAL,[_6]:J.GEQUAL,[oK]:J.GREATER,[aK]:J.NOTEQUAL};function s(w,B){if(B.type===T9&&Q.has("OES_texture_float_linear")===!1&&(B.magFilter===nJ||B.magFilter===O6||B.magFilter===T7||B.magFilter===E8||B.minFilter===nJ||B.minFilter===O6||B.minFilter===T7||B.minFilter===E8))H0("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,B0[B.wrapS]),J.texParameteri(w,J.TEXTURE_WRAP_T,B0[B.wrapT]),w===J.TEXTURE_3D||w===J.TEXTURE_2D_ARRAY)J.texParameteri(w,J.TEXTURE_WRAP_R,B0[B.wrapR]);if(J.texParameteri(w,J.TEXTURE_MAG_FILTER,ZJ[B.magFilter]),J.texParameteri(w,J.TEXTURE_MIN_FILTER,ZJ[B.minFilter]),B.compareFunction)J.texParameteri(w,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(w,J.TEXTURE_COMPARE_FUNC,t0[B.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(B.magFilter===u9)return;if(B.minFilter!==T7&&B.minFilter!==E8)return;if(B.type===T9&&Q.has("OES_texture_float_linear")===!1)return;if(B.anisotropy>1||Z.get(B).__currentAnisotropy){let f=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(w,f.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,W.getMaxAnisotropy())),Z.get(B).__currentAnisotropy=B.anisotropy}}}function R0(w,B){let f=!1;if(w.__webglInit===void 0)w.__webglInit=!0,B.addEventListener("dispose",C);let i=B.source,J0=q.get(i);if(J0===void 0)J0={},q.set(i,J0);let Z0=m(B);if(Z0!==w.__cacheKey){if(J0[Z0]===void 0)J0[Z0]={texture:J.createTexture(),usedTimes:0},Y.memory.textures++,f=!0;J0[Z0].usedTimes++;let q0=J0[w.__cacheKey];if(q0!==void 0){if(J0[w.__cacheKey].usedTimes--,q0.usedTimes===0)b(B)}w.__cacheKey=Z0,w.__webglTexture=J0[Z0].texture}return f}function P0(w,B,f){return Math.floor(Math.floor(w/f)/B)}function G0(w,B,f,i){let Z0=w.updateRanges;if(Z0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,B.width,B.height,f,i,B.data);else{Z0.sort((C0,X0)=>C0.start-X0.start);let q0=0;for(let C0=1;C0<Z0.length;C0++){let X0=Z0[q0],F0=Z0[C0],n0=X0.start+X0.count,a0=P0(F0.start,B.width,4),JJ=P0(X0.start,B.width,4);if(F0.start<=n0+1&&a0===JJ&&P0(F0.start+F0.count-1,B.width,4)===a0)X0.count=Math.max(X0.count,F0.start+F0.count-X0.start);else++q0,Z0[q0]=F0}Z0.length=q0+1;let c=$.getParameter(J.UNPACK_ROW_LENGTH),o=$.getParameter(J.UNPACK_SKIP_PIXELS),E0=$.getParameter(J.UNPACK_SKIP_ROWS);$.pixelStorei(J.UNPACK_ROW_LENGTH,B.width);for(let C0=0,X0=Z0.length;C0<X0;C0++){let F0=Z0[C0],n0=Math.floor(F0.start/4),a0=Math.ceil(F0.count/4),JJ=n0%B.width,j=Math.floor(n0/B.width),U0=a0,n=1;$.pixelStorei(J.UNPACK_SKIP_PIXELS,JJ),$.pixelStorei(J.UNPACK_SKIP_ROWS,j),$.texSubImage2D(J.TEXTURE_2D,0,JJ,j,U0,1,f,i,B.data)}w.clearUpdateRanges(),$.pixelStorei(J.UNPACK_ROW_LENGTH,c),$.pixelStorei(J.UNPACK_SKIP_PIXELS,o),$.pixelStorei(J.UNPACK_SKIP_ROWS,E0)}}function b0(w,B,f){let i=J.TEXTURE_2D;if(B.isDataArrayTexture||B.isCompressedArrayTexture)i=J.TEXTURE_2D_ARRAY;if(B.isData3DTexture)i=J.TEXTURE_3D;let J0=R0(w,B),Z0=B.source;$.bindTexture(i,w.__webglTexture,J.TEXTURE0+f);let q0=Z.get(Z0);if(Z0.version!==q0.__version||J0===!0){if($.activeTexture(J.TEXTURE0+f),(typeof ImageBitmap<"u"&&B.image instanceof ImageBitmap)===!1){let n=$J.getPrimaries($J.workingColorSpace),Y0=B.colorSpace===F8?null:$J.getPrimaries(B.colorSpace),w0=B.colorSpace===F8||n===Y0?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,B.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,w0)}$.pixelStorei(J.UNPACK_ALIGNMENT,B.unpackAlignment);let o=F(B.image,!1,W.maxTextureSize);o=HJ(B,o);let E0=K.convert(B.format,B.colorSpace),C0=K.convert(B.type),X0=V(B.internalFormat,E0,C0,B.normalized,B.colorSpace,B.isVideoTexture);s(i,B);let F0,n0=B.mipmaps,a0=B.isVideoTexture!==!0,JJ=q0.__version===void 0||J0===!0,j=Z0.dataReady,U0=A(B,o);if(B.isDepthTexture){if(X0=_(B.format===q8,B.type),JJ)if(a0)$.texStorage2D(J.TEXTURE_2D,1,X0,o.width,o.height);else $.texImage2D(J.TEXTURE_2D,0,X0,o.width,o.height,0,E0,C0,null)}else if(B.isDataTexture)if(n0.length>0){if(a0&&JJ)$.texStorage2D(J.TEXTURE_2D,U0,X0,n0[0].width,n0[0].height);for(let n=0,Y0=n0.length;n<Y0;n++)if(F0=n0[n],a0){if(j)$.texSubImage2D(J.TEXTURE_2D,n,0,0,F0.width,F0.height,E0,C0,F0.data)}else $.texImage2D(J.TEXTURE_2D,n,X0,F0.width,F0.height,0,E0,C0,F0.data);B.generateMipmaps=!1}else if(a0){if(JJ)$.texStorage2D(J.TEXTURE_2D,U0,X0,o.width,o.height);if(j)G0(B,o,E0,C0)}else $.texImage2D(J.TEXTURE_2D,0,X0,o.width,o.height,0,E0,C0,o.data);else if(B.isCompressedTexture)if(B.isCompressedArrayTexture){if(a0&&JJ)$.texStorage3D(J.TEXTURE_2D_ARRAY,U0,X0,n0[0].width,n0[0].height,o.depth);for(let n=0,Y0=n0.length;n<Y0;n++)if(F0=n0[n],B.format!==L9)if(E0!==null)if(a0){if(j)if(B.layerUpdates.size>0){let w0=ZW(F0.width,F0.height,B.format,B.type);for(let Q0 of B.layerUpdates){let v0=F0.data.subarray(Q0*w0/F0.data.BYTES_PER_ELEMENT,(Q0+1)*w0/F0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,n,0,0,Q0,F0.width,F0.height,1,E0,v0)}B.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,n,0,0,0,F0.width,F0.height,o.depth,E0,F0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,n,X0,F0.width,F0.height,o.depth,0,F0.data,0,0);else H0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(a0){if(j)$.texSubImage3D(J.TEXTURE_2D_ARRAY,n,0,0,0,F0.width,F0.height,o.depth,E0,C0,F0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,n,X0,F0.width,F0.height,o.depth,0,E0,C0,F0.data)}else{if(a0&&JJ)$.texStorage2D(J.TEXTURE_2D,U0,X0,n0[0].width,n0[0].height);for(let n=0,Y0=n0.length;n<Y0;n++)if(F0=n0[n],B.format!==L9)if(E0!==null)if(a0){if(j)$.compressedTexSubImage2D(J.TEXTURE_2D,n,0,0,F0.width,F0.height,E0,F0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,n,X0,F0.width,F0.height,0,F0.data);else H0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(a0){if(j)$.texSubImage2D(J.TEXTURE_2D,n,0,0,F0.width,F0.height,E0,C0,F0.data)}else $.texImage2D(J.TEXTURE_2D,n,X0,F0.width,F0.height,0,E0,C0,F0.data)}else if(B.isDataArrayTexture)if(a0){if(JJ)$.texStorage3D(J.TEXTURE_2D_ARRAY,U0,X0,o.width,o.height,o.depth);if(j)if(B.layerUpdates.size>0){let n=ZW(o.width,o.height,B.format,B.type);for(let Y0 of B.layerUpdates){let w0=o.data.subarray(Y0*n/o.data.BYTES_PER_ELEMENT,(Y0+1)*n/o.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,Y0,o.width,o.height,1,E0,C0,w0)}B.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,o.width,o.height,o.depth,E0,C0,o.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,X0,o.width,o.height,o.depth,0,E0,C0,o.data);else if(B.isData3DTexture)if(a0){if(JJ)$.texStorage3D(J.TEXTURE_3D,U0,X0,o.width,o.height,o.depth);if(j)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,o.width,o.height,o.depth,E0,C0,o.data)}else $.texImage3D(J.TEXTURE_3D,0,X0,o.width,o.height,o.depth,0,E0,C0,o.data);else if(B.isFramebufferTexture){if(JJ)if(a0)$.texStorage2D(J.TEXTURE_2D,U0,X0,o.width,o.height);else{let{width:n,height:Y0}=o;for(let w0=0;w0<U0;w0++)$.texImage2D(J.TEXTURE_2D,w0,X0,n,Y0,0,E0,C0,null),n>>=1,Y0>>=1}}else if(B.isHTMLTexture){if("texElementImage2D"in J){let n=J.canvas;if(!n.hasAttribute("layoutsubtree"))n.setAttribute("layoutsubtree","true");if(o.parentNode!==n){n.appendChild(o),N.add(B),n.onpaint=(s0)=>{let _J=s0.changedElements;for(let EJ of N)if(_J.includes(EJ.image))EJ.needsUpdate=!0},n.requestPaint();return}let Y0=0,w0=J.RGBA,Q0=J.RGBA,v0=J.UNSIGNED_BYTE;J.texElementImage2D(J.TEXTURE_2D,Y0,w0,Q0,v0,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(n0.length>0){if(a0&&JJ){let n=A0(n0[0]);$.texStorage2D(J.TEXTURE_2D,U0,X0,n.width,n.height)}for(let n=0,Y0=n0.length;n<Y0;n++)if(F0=n0[n],a0){if(j)$.texSubImage2D(J.TEXTURE_2D,n,0,0,E0,C0,F0)}else $.texImage2D(J.TEXTURE_2D,n,X0,E0,C0,F0);B.generateMipmaps=!1}else if(a0){if(JJ){let n=A0(o);$.texStorage2D(J.TEXTURE_2D,U0,X0,n.width,n.height)}if(j)$.texSubImage2D(J.TEXTURE_2D,0,0,0,E0,C0,o)}else $.texImage2D(J.TEXTURE_2D,0,X0,E0,C0,o);if(D(B))k(i);if(q0.__version=Z0.version,B.onUpdate)B.onUpdate(B)}w.__version=B.version}function YJ(w,B,f){if(B.image.length!==6)return;let i=R0(w,B),J0=B.source;$.bindTexture(J.TEXTURE_CUBE_MAP,w.__webglTexture,J.TEXTURE0+f);let Z0=Z.get(J0);if(J0.version!==Z0.__version||i===!0){$.activeTexture(J.TEXTURE0+f);let q0=$J.getPrimaries($J.workingColorSpace),c=B.colorSpace===F8?null:$J.getPrimaries(B.colorSpace),o=B.colorSpace===F8||q0===c?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,B.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),$.pixelStorei(J.UNPACK_ALIGNMENT,B.unpackAlignment),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,o);let E0=B.isCompressedTexture||B.image[0].isCompressedTexture,C0=B.image[0]&&B.image[0].isDataTexture,X0=[];for(let Q0=0;Q0<6;Q0++){if(!E0&&!C0)X0[Q0]=F(B.image[Q0],!0,W.maxCubemapSize);else X0[Q0]=C0?B.image[Q0].image:B.image[Q0];X0[Q0]=HJ(B,X0[Q0])}let F0=X0[0],n0=K.convert(B.format,B.colorSpace),a0=K.convert(B.type),JJ=V(B.internalFormat,n0,a0,B.normalized,B.colorSpace),j=B.isVideoTexture!==!0,U0=Z0.__version===void 0||i===!0,n=J0.dataReady,Y0=A(B,F0);s(J.TEXTURE_CUBE_MAP,B);let w0;if(E0){if(j&&U0)$.texStorage2D(J.TEXTURE_CUBE_MAP,Y0,JJ,F0.width,F0.height);for(let Q0=0;Q0<6;Q0++){w0=X0[Q0].mipmaps;for(let v0=0;v0<w0.length;v0++){let s0=w0[v0];if(B.format!==L9)if(n0!==null)if(j){if(n)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0,0,0,s0.width,s0.height,n0,s0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0,JJ,s0.width,s0.height,0,s0.data);else H0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(j){if(n)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0,0,0,s0.width,s0.height,n0,a0,s0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0,JJ,s0.width,s0.height,0,n0,a0,s0.data)}}}else{if(w0=B.mipmaps,j&&U0){if(w0.length>0)Y0++;let Q0=A0(X0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,Y0,JJ,Q0.width,Q0.height)}for(let Q0=0;Q0<6;Q0++)if(C0){if(j){if(n)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,0,0,0,X0[Q0].width,X0[Q0].height,n0,a0,X0[Q0].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,0,JJ,X0[Q0].width,X0[Q0].height,0,n0,a0,X0[Q0].data);for(let v0=0;v0<w0.length;v0++){let _J=w0[v0].image[Q0].image;if(j){if(n)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0+1,0,0,_J.width,_J.height,n0,a0,_J.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0+1,JJ,_J.width,_J.height,0,n0,a0,_J.data)}}else{if(j){if(n)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,0,0,0,n0,a0,X0[Q0])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,0,JJ,n0,a0,X0[Q0]);for(let v0=0;v0<w0.length;v0++){let s0=w0[v0];if(j){if(n)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0+1,0,0,n0,a0,s0.image[Q0])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Q0,v0+1,JJ,n0,a0,s0.image[Q0])}}}if(D(B))k(J.TEXTURE_CUBE_MAP);if(Z0.__version=J0.version,B.onUpdate)B.onUpdate(B)}w.__version=B.version}function p0(w,B,f,i,J0,Z0){let q0=K.convert(f.format,f.colorSpace),c=K.convert(f.type),o=V(f.internalFormat,q0,c,f.normalized,f.colorSpace),E0=Z.get(B),C0=Z.get(f);if(C0.__renderTarget=B,!E0.__hasExternalTextures){let X0=Math.max(1,B.width>>Z0),F0=Math.max(1,B.height>>Z0);if(J0===J.TEXTURE_3D||J0===J.TEXTURE_2D_ARRAY)$.texImage3D(J0,Z0,o,X0,F0,B.depth,0,q0,c,null);else $.texImage2D(J0,Z0,o,X0,F0,0,q0,c,null)}if($.bindFramebuffer(J.FRAMEBUFFER,w),g0(B))X.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,i,J0,C0.__webglTexture,0,y0(B));else if(J0===J.TEXTURE_2D||J0>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&J0<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,i,J0,C0.__webglTexture,Z0);$.bindFramebuffer(J.FRAMEBUFFER,null)}function l0(w,B,f){if(J.bindRenderbuffer(J.RENDERBUFFER,w),B.depthBuffer){let i=B.depthTexture,J0=i&&i.isDepthTexture?i.type:null,Z0=_(B.stencilBuffer,J0),q0=B.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(g0(B))X.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,y0(B),Z0,B.width,B.height);else if(f)J.renderbufferStorageMultisample(J.RENDERBUFFER,y0(B),Z0,B.width,B.height);else J.renderbufferStorage(J.RENDERBUFFER,Z0,B.width,B.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,q0,J.RENDERBUFFER,w)}else{let i=B.textures;for(let J0=0;J0<i.length;J0++){let Z0=i[J0],q0=K.convert(Z0.format,Z0.colorSpace),c=K.convert(Z0.type),o=V(Z0.internalFormat,q0,c,Z0.normalized,Z0.colorSpace);if(g0(B))X.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,y0(B),o,B.width,B.height);else if(f)J.renderbufferStorageMultisample(J.RENDERBUFFER,y0(B),o,B.width,B.height);else J.renderbufferStorage(J.RENDERBUFFER,o,B.width,B.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function t(w,B,f){let i=B.isWebGLCubeRenderTarget===!0;if($.bindFramebuffer(J.FRAMEBUFFER,w),!(B.depthTexture&&B.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let J0=Z.get(B.depthTexture);if(J0.__renderTarget=B,!J0.__webglTexture||B.depthTexture.image.width!==B.width||B.depthTexture.image.height!==B.height)B.depthTexture.image.width=B.width,B.depthTexture.image.height=B.height,B.depthTexture.needsUpdate=!0;if(i){if(J0.__webglInit===void 0)J0.__webglInit=!0,B.depthTexture.addEventListener("dispose",C);if(J0.__webglTexture===void 0){J0.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,J0.__webglTexture),s(J.TEXTURE_CUBE_MAP,B.depthTexture);let E0=K.convert(B.depthTexture.format),C0=K.convert(B.depthTexture.type),X0;if(B.depthTexture.format===N8)X0=J.DEPTH_COMPONENT24;else if(B.depthTexture.format===q8)X0=J.DEPTH24_STENCIL8;for(let F0=0;F0<6;F0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+F0,0,X0,B.width,B.height,0,E0,C0,null)}}else a(B.depthTexture,0);let Z0=J0.__webglTexture,q0=y0(B),c=i?J.TEXTURE_CUBE_MAP_POSITIVE_X+f:J.TEXTURE_2D,o=B.depthTexture.format===q8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(B.depthTexture.format===N8)if(g0(B))X.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,c,Z0,0,q0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,c,Z0,0);else if(B.depthTexture.format===q8)if(g0(B))X.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,c,Z0,0,q0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,c,Z0,0);else throw Error("Unknown depthTexture format")}function $0(w){let B=Z.get(w),f=w.isWebGLCubeRenderTarget===!0;if(B.__boundDepthTexture!==w.depthTexture){let i=w.depthTexture;if(B.__depthDisposeCallback)B.__depthDisposeCallback();if(i){let J0=()=>{delete B.__boundDepthTexture,delete B.__depthDisposeCallback,i.removeEventListener("dispose",J0)};i.addEventListener("dispose",J0),B.__depthDisposeCallback=J0}B.__boundDepthTexture=i}if(w.depthTexture&&!B.__autoAllocateDepthBuffer)if(f)for(let i=0;i<6;i++)t(B.__webglFramebuffer[i],w,i);else{let i=w.texture.mipmaps;if(i&&i.length>0)t(B.__webglFramebuffer[0],w,0);else t(B.__webglFramebuffer,w,0)}else if(f){B.__webglDepthbuffer=[];for(let i=0;i<6;i++)if($.bindFramebuffer(J.FRAMEBUFFER,B.__webglFramebuffer[i]),B.__webglDepthbuffer[i]===void 0)B.__webglDepthbuffer[i]=J.createRenderbuffer(),l0(B.__webglDepthbuffer[i],w,!1);else{let J0=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,Z0=B.__webglDepthbuffer[i];J.bindRenderbuffer(J.RENDERBUFFER,Z0),J.framebufferRenderbuffer(J.FRAMEBUFFER,J0,J.RENDERBUFFER,Z0)}}else{let i=w.texture.mipmaps;if(i&&i.length>0)$.bindFramebuffer(J.FRAMEBUFFER,B.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,B.__webglFramebuffer);if(B.__webglDepthbuffer===void 0)B.__webglDepthbuffer=J.createRenderbuffer(),l0(B.__webglDepthbuffer,w,!1);else{let J0=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,Z0=B.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,Z0),J.framebufferRenderbuffer(J.FRAMEBUFFER,J0,J.RENDERBUFFER,Z0)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function e(w,B,f){let i=Z.get(w);if(B!==void 0)p0(i.__webglFramebuffer,w,w.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(f!==void 0)$0(w)}function L0(w){let B=w.texture,f=Z.get(w),i=Z.get(B);w.addEventListener("dispose",L);let J0=w.textures,Z0=w.isWebGLCubeRenderTarget===!0,q0=J0.length>1;if(!q0){if(i.__webglTexture===void 0)i.__webglTexture=J.createTexture();i.__version=B.version,Y.memory.textures++}if(Z0){f.__webglFramebuffer=[];for(let c=0;c<6;c++)if(B.mipmaps&&B.mipmaps.length>0){f.__webglFramebuffer[c]=[];for(let o=0;o<B.mipmaps.length;o++)f.__webglFramebuffer[c][o]=J.createFramebuffer()}else f.__webglFramebuffer[c]=J.createFramebuffer()}else{if(B.mipmaps&&B.mipmaps.length>0){f.__webglFramebuffer=[];for(let c=0;c<B.mipmaps.length;c++)f.__webglFramebuffer[c]=J.createFramebuffer()}else f.__webglFramebuffer=J.createFramebuffer();if(q0)for(let c=0,o=J0.length;c<o;c++){let E0=Z.get(J0[c]);if(E0.__webglTexture===void 0)E0.__webglTexture=J.createTexture(),Y.memory.textures++}if(w.samples>0&&g0(w)===!1){f.__webglMultisampledFramebuffer=J.createFramebuffer(),f.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,f.__webglMultisampledFramebuffer);for(let c=0;c<J0.length;c++){let o=J0[c];f.__webglColorRenderbuffer[c]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,f.__webglColorRenderbuffer[c]);let E0=K.convert(o.format,o.colorSpace),C0=K.convert(o.type),X0=V(o.internalFormat,E0,C0,o.normalized,o.colorSpace,w.isXRRenderTarget===!0),F0=y0(w);J.renderbufferStorageMultisample(J.RENDERBUFFER,F0,X0,w.width,w.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+c,J.RENDERBUFFER,f.__webglColorRenderbuffer[c])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),w.depthBuffer)f.__webglDepthRenderbuffer=J.createRenderbuffer(),l0(f.__webglDepthRenderbuffer,w,!0);$.bindFramebuffer(J.FRAMEBUFFER,null)}}if(Z0){$.bindTexture(J.TEXTURE_CUBE_MAP,i.__webglTexture),s(J.TEXTURE_CUBE_MAP,B);for(let c=0;c<6;c++)if(B.mipmaps&&B.mipmaps.length>0)for(let o=0;o<B.mipmaps.length;o++)p0(f.__webglFramebuffer[c][o],w,B,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+c,o);else p0(f.__webglFramebuffer[c],w,B,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+c,0);if(D(B))k(J.TEXTURE_CUBE_MAP);$.unbindTexture()}else if(q0){for(let c=0,o=J0.length;c<o;c++){let E0=J0[c],C0=Z.get(E0),X0=J.TEXTURE_2D;if(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)X0=w.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(X0,C0.__webglTexture),s(X0,E0),p0(f.__webglFramebuffer,w,E0,J.COLOR_ATTACHMENT0+c,X0,0),D(E0))k(X0)}$.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,i.__webglTexture),s(c,B),B.mipmaps&&B.mipmaps.length>0)for(let o=0;o<B.mipmaps.length;o++)p0(f.__webglFramebuffer[o],w,B,J.COLOR_ATTACHMENT0,c,o);else p0(f.__webglFramebuffer,w,B,J.COLOR_ATTACHMENT0,c,0);if(D(B))k(c);$.unbindTexture()}if(w.depthBuffer)$0(w)}function M0(w){let B=w.textures;for(let f=0,i=B.length;f<i;f++){let J0=B[f];if(D(J0)){let Z0=M(w),q0=Z.get(J0).__webglTexture;$.bindTexture(Z0,q0),k(Z0),$.unbindTexture()}}}let x0=[],S=[];function e0(w){if(w.samples>0){if(g0(w)===!1){let{textures:B,width:f,height:i}=w,J0=J.COLOR_BUFFER_BIT,Z0=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,q0=Z.get(w),c=B.length>1;if(c)for(let E0=0;E0<B.length;E0++)$.bindFramebuffer(J.FRAMEBUFFER,q0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+E0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,q0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+E0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,q0.__webglMultisampledFramebuffer);let o=w.texture.mipmaps;if(o&&o.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,q0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,q0.__webglFramebuffer);for(let E0=0;E0<B.length;E0++){if(w.resolveDepthBuffer){if(w.depthBuffer)J0|=J.DEPTH_BUFFER_BIT;if(w.stencilBuffer&&w.resolveStencilBuffer)J0|=J.STENCIL_BUFFER_BIT}if(c){J.framebufferRenderbuffer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.RENDERBUFFER,q0.__webglColorRenderbuffer[E0]);let C0=Z.get(B[E0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,C0,0)}if(J.blitFramebuffer(0,0,f,i,0,0,f,i,J0,J.NEAREST),H===!0){if(x0.length=0,S.length=0,x0.push(J.COLOR_ATTACHMENT0+E0),w.depthBuffer&&w.resolveDepthBuffer===!1)x0.push(Z0),S.push(Z0),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,S);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,x0)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),c)for(let E0=0;E0<B.length;E0++){$.bindFramebuffer(J.FRAMEBUFFER,q0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+E0,J.RENDERBUFFER,q0.__webglColorRenderbuffer[E0]);let C0=Z.get(B[E0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,q0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+E0,J.TEXTURE_2D,C0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,q0.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.resolveDepthBuffer===!1&&H){let B=w.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,[B])}}}function y0(w){return Math.min(W.maxSamples,w.samples)}function g0(w){let B=Z.get(w);return w.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&B.__useRenderToTexture!==!1}function K0(w){let B=Y.render.frame;if(E.get(w)!==B)E.set(w,B),w.update()}function HJ(w,B){let{colorSpace:f,format:i,type:J0}=w;if(w.isCompressedTexture===!0||w.isVideoTexture===!0)return B;if(f!==KZ&&f!==F8)if($J.getTransfer(f)===qJ){if(i!==L9||J0!==G9)H0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else T0("WebGLTextures: Unsupported texture color space:",f);return B}function A0(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=h,this.resetTextureUnits=u,this.getTextureUnits=y,this.setTextureUnits=l,this.setTexture2D=a,this.setTexture2DArray=W0,this.setTexture3D=N0,this.setTextureCube=j0,this.rebindTextures=e,this.setupRenderTarget=L0,this.updateRenderTargetMipmap=M0,this.updateMultisampleRenderTarget=e0,this.setupDepthRenderbuffer=$0,this.setupFrameBufferTexture=p0,this.useMultisampledRTT=g0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function tG(J,Q){function $(Z,W=F8){let K,Y=$J.getTransfer(W);if(Z===G9)return J.UNSIGNED_BYTE;if(Z===z$)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===I$)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===gK)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===pK)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===hK)return J.BYTE;if(Z===xK)return J.SHORT;if(Z===S7)return J.UNSIGNED_SHORT;if(Z===B$)return J.INT;if(Z===c9)return J.UNSIGNED_INT;if(Z===T9)return J.FLOAT;if(Z===S9)return J.HALF_FLOAT;if(Z===mK)return J.ALPHA;if(Z===dK)return J.RGB;if(Z===L9)return J.RGBA;if(Z===N8)return J.DEPTH_COMPONENT;if(Z===q8)return J.DEPTH_STENCIL;if(Z===lK)return J.RED;if(Z===_$)return J.RED_INTEGER;if(Z===D8)return J.RG;if(Z===A$)return J.RG_INTEGER;if(Z===C$)return J.RGBA_INTEGER;if(Z===k6||Z===M6||Z===L6||Z===V6)if(Y===qJ)if(K=Q.get("WEBGL_compressed_texture_s3tc_srgb"),K!==null){if(Z===k6)return K.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===M6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===L6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===V6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(K=Q.get("WEBGL_compressed_texture_s3tc"),K!==null){if(Z===k6)return K.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===M6)return K.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===L6)return K.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===V6)return K.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===w$||Z===P$||Z===T$||Z===S$)if(K=Q.get("WEBGL_compressed_texture_pvrtc"),K!==null){if(Z===w$)return K.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===P$)return K.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===T$)return K.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===S$)return K.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===j$||Z===y$||Z===v$||Z===f$||Z===b$||Z===B6||Z===h$)if(K=Q.get("WEBGL_compressed_texture_etc"),K!==null){if(Z===j$||Z===y$)return Y===qJ?K.COMPRESSED_SRGB8_ETC2:K.COMPRESSED_RGB8_ETC2;if(Z===v$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:K.COMPRESSED_RGBA8_ETC2_EAC;if(Z===f$)return K.COMPRESSED_R11_EAC;if(Z===b$)return K.COMPRESSED_SIGNED_R11_EAC;if(Z===B6)return K.COMPRESSED_RG11_EAC;if(Z===h$)return K.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===x$||Z===g$||Z===p$||Z===m$||Z===d$||Z===l$||Z===u$||Z===c$||Z===n$||Z===s$||Z===i$||Z===o$||Z===a$||Z===r$)if(K=Q.get("WEBGL_compressed_texture_astc"),K!==null){if(Z===x$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:K.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===g$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:K.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===p$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:K.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===m$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:K.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===d$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:K.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===l$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:K.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===u$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:K.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===c$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:K.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===n$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:K.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===s$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:K.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===i$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:K.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===o$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:K.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===a$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:K.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===r$)return Y===qJ?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:K.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===t$||Z===e$||Z===JZ)if(K=Q.get("EXT_texture_compression_bptc"),K!==null){if(Z===t$)return Y===qJ?K.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:K.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===e$)return K.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===JZ)return K.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===QZ||Z===$Z||Z===z6||Z===ZZ)if(K=Q.get("EXT_texture_compression_rgtc"),K!==null){if(Z===QZ)return K.COMPRESSED_RED_RGTC1_EXT;if(Z===$Z)return K.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===z6)return K.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===ZZ)return K.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===n8)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}class eG{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new b6(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 aJ({vertexShader:m1,fragmentShader:d1,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new VJ(new i8(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}function u1(J,Q){function $(F,D){if(F.matrixAutoUpdate===!0)F.updateMatrix();D.value.copy(F.matrix)}function Z(F,D){if(D.color.getRGB(F.fogColor.value,RY(J)),D.isFog)F.fogNear.value=D.near,F.fogFar.value=D.far;else if(D.isFogExp2)F.fogDensity.value=D.density}function W(F,D,k,M,V){if(D.isNodeMaterial)D.uniformsNeedUpdate=!1;else if(D.isMeshBasicMaterial)K(F,D);else if(D.isMeshLambertMaterial){if(K(F,D),D.envMap)F.envMapIntensity.value=D.envMapIntensity}else if(D.isMeshToonMaterial)K(F,D),N(F,D);else if(D.isMeshPhongMaterial){if(K(F,D),E(F,D),D.envMap)F.envMapIntensity.value=D.envMapIntensity}else if(D.isMeshStandardMaterial){if(K(F,D),G(F,D),D.isMeshPhysicalMaterial)q(F,D,V)}else if(D.isMeshMatcapMaterial)K(F,D),R(F,D);else if(D.isMeshDepthMaterial)K(F,D);else if(D.isMeshDistanceMaterial)K(F,D),O(F,D);else if(D.isMeshNormalMaterial)K(F,D);else if(D.isLineBasicMaterial){if(Y(F,D),D.isLineDashedMaterial)X(F,D)}else if(D.isPointsMaterial)H(F,D,k,M);else if(D.isSpriteMaterial)U(F,D);else if(D.isShadowMaterial)F.color.value.copy(D.color),F.opacity.value=D.opacity;else if(D.isShaderMaterial)D.uniformsNeedUpdate=!1}function K(F,D){if(F.opacity.value=D.opacity,D.color)F.diffuse.value.copy(D.color);if(D.emissive)F.emissive.value.copy(D.emissive).multiplyScalar(D.emissiveIntensity);if(D.map)F.map.value=D.map,$(D.map,F.mapTransform);if(D.alphaMap)F.alphaMap.value=D.alphaMap,$(D.alphaMap,F.alphaMapTransform);if(D.bumpMap){if(F.bumpMap.value=D.bumpMap,$(D.bumpMap,F.bumpMapTransform),F.bumpScale.value=D.bumpScale,D.side===cJ)F.bumpScale.value*=-1}if(D.normalMap){if(F.normalMap.value=D.normalMap,$(D.normalMap,F.normalMapTransform),F.normalScale.value.copy(D.normalScale),D.side===cJ)F.normalScale.value.negate()}if(D.displacementMap)F.displacementMap.value=D.displacementMap,$(D.displacementMap,F.displacementMapTransform),F.displacementScale.value=D.displacementScale,F.displacementBias.value=D.displacementBias;if(D.emissiveMap)F.emissiveMap.value=D.emissiveMap,$(D.emissiveMap,F.emissiveMapTransform);if(D.specularMap)F.specularMap.value=D.specularMap,$(D.specularMap,F.specularMapTransform);if(D.alphaTest>0)F.alphaTest.value=D.alphaTest;let k=Q.get(D),M=k.envMap,V=k.envMapRotation;if(M){if(F.envMap.value=M,F.envMapRotation.value.setFromMatrix4(l1.makeRotationFromEuler(V)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1)F.envMapRotation.value.premultiply(Q5);F.reflectivity.value=D.reflectivity,F.ior.value=D.ior,F.refractionRatio.value=D.refractionRatio}if(D.lightMap)F.lightMap.value=D.lightMap,F.lightMapIntensity.value=D.lightMapIntensity,$(D.lightMap,F.lightMapTransform);if(D.aoMap)F.aoMap.value=D.aoMap,F.aoMapIntensity.value=D.aoMapIntensity,$(D.aoMap,F.aoMapTransform)}function Y(F,D){if(F.diffuse.value.copy(D.color),F.opacity.value=D.opacity,D.map)F.map.value=D.map,$(D.map,F.mapTransform)}function X(F,D){F.dashSize.value=D.dashSize,F.totalSize.value=D.dashSize+D.gapSize,F.scale.value=D.scale}function H(F,D,k,M){if(F.diffuse.value.copy(D.color),F.opacity.value=D.opacity,F.size.value=D.size*k,F.scale.value=M*0.5,D.map)F.map.value=D.map,$(D.map,F.uvTransform);if(D.alphaMap)F.alphaMap.value=D.alphaMap,$(D.alphaMap,F.alphaMapTransform);if(D.alphaTest>0)F.alphaTest.value=D.alphaTest}function U(F,D){if(F.diffuse.value.copy(D.color),F.opacity.value=D.opacity,F.rotation.value=D.rotation,D.map)F.map.value=D.map,$(D.map,F.mapTransform);if(D.alphaMap)F.alphaMap.value=D.alphaMap,$(D.alphaMap,F.alphaMapTransform);if(D.alphaTest>0)F.alphaTest.value=D.alphaTest}function E(F,D){F.specular.value.copy(D.specular),F.shininess.value=Math.max(D.shininess,0.0001)}function N(F,D){if(D.gradientMap)F.gradientMap.value=D.gradientMap}function G(F,D){if(F.metalness.value=D.metalness,D.metalnessMap)F.metalnessMap.value=D.metalnessMap,$(D.metalnessMap,F.metalnessMapTransform);if(F.roughness.value=D.roughness,D.roughnessMap)F.roughnessMap.value=D.roughnessMap,$(D.roughnessMap,F.roughnessMapTransform);if(D.envMap)F.envMapIntensity.value=D.envMapIntensity}function q(F,D,k){if(F.ior.value=D.ior,D.sheen>0){if(F.sheenColor.value.copy(D.sheenColor).multiplyScalar(D.sheen),F.sheenRoughness.value=D.sheenRoughness,D.sheenColorMap)F.sheenColorMap.value=D.sheenColorMap,$(D.sheenColorMap,F.sheenColorMapTransform);if(D.sheenRoughnessMap)F.sheenRoughnessMap.value=D.sheenRoughnessMap,$(D.sheenRoughnessMap,F.sheenRoughnessMapTransform)}if(D.clearcoat>0){if(F.clearcoat.value=D.clearcoat,F.clearcoatRoughness.value=D.clearcoatRoughness,D.clearcoatMap)F.clearcoatMap.value=D.clearcoatMap,$(D.clearcoatMap,F.clearcoatMapTransform);if(D.clearcoatRoughnessMap)F.clearcoatRoughnessMap.value=D.clearcoatRoughnessMap,$(D.clearcoatRoughnessMap,F.clearcoatRoughnessMapTransform);if(D.clearcoatNormalMap){if(F.clearcoatNormalMap.value=D.clearcoatNormalMap,$(D.clearcoatNormalMap,F.clearcoatNormalMapTransform),F.clearcoatNormalScale.value.copy(D.clearcoatNormalScale),D.side===cJ)F.clearcoatNormalScale.value.negate()}}if(D.dispersion>0)F.dispersion.value=D.dispersion;if(D.iridescence>0){if(F.iridescence.value=D.iridescence,F.iridescenceIOR.value=D.iridescenceIOR,F.iridescenceThicknessMinimum.value=D.iridescenceThicknessRange[0],F.iridescenceThicknessMaximum.value=D.iridescenceThicknessRange[1],D.iridescenceMap)F.iridescenceMap.value=D.iridescenceMap,$(D.iridescenceMap,F.iridescenceMapTransform);if(D.iridescenceThicknessMap)F.iridescenceThicknessMap.value=D.iridescenceThicknessMap,$(D.iridescenceThicknessMap,F.iridescenceThicknessMapTransform)}if(D.transmission>0){if(F.transmission.value=D.transmission,F.transmissionSamplerMap.value=k.texture,F.transmissionSamplerSize.value.set(k.width,k.height),D.transmissionMap)F.transmissionMap.value=D.transmissionMap,$(D.transmissionMap,F.transmissionMapTransform);if(F.thickness.value=D.thickness,D.thicknessMap)F.thicknessMap.value=D.thicknessMap,$(D.thicknessMap,F.thicknessMapTransform);F.attenuationDistance.value=D.attenuationDistance,F.attenuationColor.value.copy(D.attenuationColor)}if(D.anisotropy>0){if(F.anisotropyVector.value.set(D.anisotropy*Math.cos(D.anisotropyRotation),D.anisotropy*Math.sin(D.anisotropyRotation)),D.anisotropyMap)F.anisotropyMap.value=D.anisotropyMap,$(D.anisotropyMap,F.anisotropyMapTransform)}if(F.specularIntensity.value=D.specularIntensity,F.specularColor.value.copy(D.specularColor),D.specularColorMap)F.specularColorMap.value=D.specularColorMap,$(D.specularColorMap,F.specularColorMapTransform);if(D.specularIntensityMap)F.specularIntensityMap.value=D.specularIntensityMap,$(D.specularIntensityMap,F.specularIntensityMapTransform)}function R(F,D){if(D.matcap)F.matcap.value=D.matcap}function O(F,D){let k=Q.get(D).light;F.referencePosition.value.setFromMatrixPosition(k.matrixWorld),F.nearDistance.value=k.shadow.camera.near,F.farDistance.value=k.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function c1(J,Q,$,Z){let W={},K={},Y=[],X=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function H(k,M){let V=M.program;Z.uniformBlockBinding(k,V)}function U(k,M){let V=W[k.id];if(V===void 0)R(k),V=E(k),W[k.id]=V,k.addEventListener("dispose",F);let _=M.program;Z.updateUBOMapping(k,_);let A=Q.render.frame;if(K[k.id]!==A)G(k),K[k.id]=A}function E(k){let M=N();k.__bindingPointIndex=M;let V=J.createBuffer(),_=k.__size,A=k.usage;return J.bindBuffer(J.UNIFORM_BUFFER,V),J.bufferData(J.UNIFORM_BUFFER,_,A),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,M,V),V}function N(){for(let k=0;k<X;k++)if(Y.indexOf(k)===-1)return Y.push(k),k;return T0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function G(k){let M=W[k.id],V=k.uniforms,_=k.__cache;J.bindBuffer(J.UNIFORM_BUFFER,M);for(let A=0,C=V.length;A<C;A++){let L=Array.isArray(V[A])?V[A]:[V[A]];for(let I=0,b=L.length;I<b;I++){let T=L[I];if(q(T,A,I,_)===!0){let g=T.__offset,u=Array.isArray(T.value)?T.value:[T.value],y=0;for(let l=0;l<u.length;l++){let h=u[l],m=O(h);if(typeof h==="number"||typeof h==="boolean")T.__data[0]=h,J.bufferSubData(J.UNIFORM_BUFFER,g+y,T.__data);else if(h.isMatrix3)T.__data[0]=h.elements[0],T.__data[1]=h.elements[1],T.__data[2]=h.elements[2],T.__data[3]=0,T.__data[4]=h.elements[3],T.__data[5]=h.elements[4],T.__data[6]=h.elements[5],T.__data[7]=0,T.__data[8]=h.elements[6],T.__data[9]=h.elements[7],T.__data[10]=h.elements[8],T.__data[11]=0;else if(ArrayBuffer.isView(h))T.__data.set(new h.constructor(h.buffer,h.byteOffset,T.__data.length));else h.toArray(T.__data,y),y+=m.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,g,T.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function q(k,M,V,_){let A=k.value,C=M+"_"+V;if(_[C]===void 0){if(typeof A==="number"||typeof A==="boolean")_[C]=A;else if(ArrayBuffer.isView(A))_[C]=A.slice();else _[C]=A.clone();return!0}else{let L=_[C];if(typeof A==="number"||typeof A==="boolean"){if(L!==A)return _[C]=A,!0}else if(ArrayBuffer.isView(A))return!0;else if(L.equals(A)===!1)return L.copy(A),!0}return!1}function R(k){let M=k.uniforms,V=0,_=16;for(let C=0,L=M.length;C<L;C++){let I=Array.isArray(M[C])?M[C]:[M[C]];for(let b=0,T=I.length;b<T;b++){let g=I[b],u=Array.isArray(g.value)?g.value:[g.value];for(let y=0,l=u.length;y<l;y++){let h=u[y],m=O(h),a=V%_,W0=a%m.boundary,N0=a+W0;if(V+=W0,N0!==0&&_-N0<m.storage)V+=_-N0;g.__data=new Float32Array(m.storage/Float32Array.BYTES_PER_ELEMENT),g.__offset=V,V+=m.storage}}}let A=V%_;if(A>0)V+=_-A;return k.__size=V,k.__cache={},this}function O(k){let M={boundary:0,storage:0};if(typeof k==="number"||typeof k==="boolean")M.boundary=4,M.storage=4;else if(k.isVector2)M.boundary=8,M.storage=8;else if(k.isVector3||k.isColor)M.boundary=16,M.storage=12;else if(k.isVector4)M.boundary=16,M.storage=16;else if(k.isMatrix3)M.boundary=48,M.storage=48;else if(k.isMatrix4)M.boundary=64,M.storage=64;else if(k.isTexture)H0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(k))M.boundary=16,M.storage=k.byteLength;else H0("WebGLRenderer: Unsupported uniform value type.",k);return M}function F(k){let M=k.target;M.removeEventListener("dispose",F);let V=Y.indexOf(M.__bindingPointIndex);Y.splice(V,1),J.deleteBuffer(W[M.id]),delete W[M.id],delete K[M.id]}function D(){for(let k in W)J.deleteBuffer(W[k]);Y=[],W={},K={}}return{bind:H,update:U,dispose:D}}function s1(){if(v9===null)v9=new $9(n1,16,16,D8,S9),v9.name="DFG_LUT",v9.minFilter=nJ,v9.magFilter=nJ,v9.wrapS=R6,v9.wrapT=R6,v9.generateMipmaps=!1,v9.needsUpdate=!0;return v9}class $5{constructor(J={}){let{canvas:Q=tK(),context:$=null,depth:Z=!0,stencil:W=!1,alpha:K=!1,antialias:Y=!1,premultipliedAlpha:X=!0,preserveDrawingBuffer:H=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:E=!1,reversedDepthBuffer:N=!1,outputBufferType:G=G9}=J;this.isWebGLRenderer=!0;let q;if($!==null){if(typeof WebGLRenderingContext<"u"&&$ instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");q=$.getContextAttributes().alpha}else q=K;let R=G,O=new Set([C$,A$,_$]),F=new Set([G9,c9,S7,n8,z$,I$]),D=new Uint32Array(4),k=new Int32Array(4),M=new P,V=null,_=null,A=[],C=[],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=U9,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let I=this,b=!1,T=null;this._outputColorSpace=cK;let g=0,u=0,y=null,l=-1,h=null,m=new GJ,a=new GJ,W0=null,N0=new V0(0),j0=0,B0=Q.width,ZJ=Q.height,t0=1,s=null,R0=null,P0=new GJ(0,0,B0,ZJ),G0=new GJ(0,0,B0,ZJ),b0=!1,YJ=new O8,p0=!1,l0=!1,t=new d0,$0=new P,e=new GJ,L0={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},M0=!1;function x0(){return y===null?t0:1}let S=$;function e0(z,v){return Q.getContext(z,v)}try{let z={alpha:!0,depth:Z,stencil:W,antialias:Y,premultipliedAlpha:X,preserveDrawingBuffer:H,powerPreference:U,failIfMajorPerformanceCaveat:E};if("setAttribute"in Q)Q.setAttribute("data-engine",`three.js r${JK}`);if(Q.addEventListener("webglcontextlost",w0,!1),Q.addEventListener("webglcontextrestored",Q0,!1),Q.addEventListener("webglcontextcreationerror",v0,!1),S===null){if(S=e0("webgl2",z),S===null)if(e0("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(z){throw T0("WebGLRenderer: "+z.message),z}let y0,g0,K0,HJ,A0,w,B,f,i,J0,Z0,q0,c,o,E0,C0,X0,F0,n0,a0,JJ,j,U0;function n(){if(y0=new QF(S),y0.init(),JJ=new tG(S,y0),g0=new sD(S,y0,J,JJ),K0=new g1(S,y0),g0.reversedDepthBuffer&&N)K0.buffers.depth.setReversed(!0);HJ=new WF(S),A0=new _1,w=new p1(S,y0,K0,A0,g0,JJ,HJ),B=new JF(I),f=new HN(S),j=new cD(S,f),i=new $F(S,f,HJ,j),J0=new YF(S,i,f,j,HJ),F0=new KF(S,g0,w),E0=new iD(A0),Z0=new I1(I,B,y0,g0,j,E0),q0=new u1(I,A0),c=new C1,o=new y1(y0),X0=new uD(I,B,K0,J0,q,X),C0=new x1(I,J0,g0),U0=new c1(S,HJ,g0,K0),n0=new nD(S,y0,HJ),a0=new ZF(S,y0,HJ),HJ.programs=Z0.programs,I.capabilities=g0,I.extensions=y0,I.properties=A0,I.renderLists=c,I.shadowMap=C0,I.state=K0,I.info=HJ}if(n(),R!==G9)L=new HF(R,Q.width,Q.height,Z,W);let Y0=new J5(I,S);this.xr=Y0,this.getContext=function(){return S},this.getContextAttributes=function(){return S.getContextAttributes()},this.forceContextLoss=function(){let z=y0.get("WEBGL_lose_context");if(z)z.loseContext()},this.forceContextRestore=function(){let z=y0.get("WEBGL_lose_context");if(z)z.restoreContext()},this.getPixelRatio=function(){return t0},this.setPixelRatio=function(z){if(z===void 0)return;t0=z,this.setSize(B0,ZJ,!1)},this.getSize=function(z){return z.set(B0,ZJ)},this.setSize=function(z,v,d=!0){if(Y0.isPresenting){H0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(B0=z,ZJ=v,Q.width=Math.floor(z*t0),Q.height=Math.floor(v*t0),d===!0)Q.style.width=z+"px",Q.style.height=v+"px";if(L!==null)L.setSize(Q.width,Q.height);this.setViewport(0,0,z,v)},this.getDrawingBufferSize=function(z){return z.set(B0*t0,ZJ*t0).floor()},this.setDrawingBufferSize=function(z,v,d){B0=z,ZJ=v,t0=d,Q.width=Math.floor(z*d),Q.height=Math.floor(v*d),this.setViewport(0,0,z,v)},this.setEffects=function(z){if(R===G9){T0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(z){for(let v=0;v<z.length;v++)if(z[v].isOutputPass===!0){H0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}L.setEffects(z||[])},this.getCurrentViewport=function(z){return z.copy(m)},this.getViewport=function(z){return z.copy(P0)},this.setViewport=function(z,v,d,x){if(z.isVector4)P0.set(z.x,z.y,z.z,z.w);else P0.set(z,v,d,x);K0.viewport(m.copy(P0).multiplyScalar(t0).round())},this.getScissor=function(z){return z.copy(G0)},this.setScissor=function(z,v,d,x){if(z.isVector4)G0.set(z.x,z.y,z.z,z.w);else G0.set(z,v,d,x);K0.scissor(a.copy(G0).multiplyScalar(t0).round())},this.getScissorTest=function(){return b0},this.setScissorTest=function(z){K0.setScissorTest(b0=z)},this.setOpaqueSort=function(z){s=z},this.setTransparentSort=function(z){R0=z},this.getClearColor=function(z){return z.copy(X0.getClearColor())},this.setClearColor=function(){X0.setClearColor(...arguments)},this.getClearAlpha=function(){return X0.getClearAlpha()},this.setClearAlpha=function(){X0.setClearAlpha(...arguments)},this.clear=function(z=!0,v=!0,d=!0){let x=0;if(z){let p=!1;if(y!==null){let k0=y.texture.format;p=O.has(k0)}if(p){let k0=y.texture.type,_0=F.has(k0),O0=X0.getClearColor(),S0=X0.getClearAlpha(),f0=O0.r,i0=O0.g,QJ=O0.b;if(_0)D[0]=f0,D[1]=i0,D[2]=QJ,D[3]=S0,S.clearBufferuiv(S.COLOR,0,D);else k[0]=f0,k[1]=i0,k[2]=QJ,k[3]=S0,S.clearBufferiv(S.COLOR,0,k)}else x|=S.COLOR_BUFFER_BIT}if(v)x|=S.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(d)x|=S.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(x!==0)S.clear(x)},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(z){z.setRenderer(this),T=z},this.dispose=function(){Q.removeEventListener("webglcontextlost",w0,!1),Q.removeEventListener("webglcontextrestored",Q0,!1),Q.removeEventListener("webglcontextcreationerror",v0,!1),X0.dispose(),c.dispose(),o.dispose(),A0.dispose(),B.dispose(),J0.dispose(),j.dispose(),U0.dispose(),Z0.dispose(),Y0.dispose(),Y0.removeEventListener("sessionstart",VX),Y0.removeEventListener("sessionend",BX),V8.stop()};function w0(z){z.preventDefault(),I7("WebGLRenderer: Context Lost."),b=!0}function Q0(){I7("WebGLRenderer: Context Restored."),b=!1;let z=HJ.autoReset,v=C0.enabled,d=C0.autoUpdate,x=C0.needsUpdate,p=C0.type;n(),HJ.autoReset=z,C0.enabled=v,C0.autoUpdate=d,C0.needsUpdate=x,C0.type=p}function v0(z){T0("WebGLRenderer: A WebGL context could not be created. Reason: ",z.statusMessage)}function s0(z){let v=z.target;v.removeEventListener("dispose",s0),_J(v)}function _J(z){EJ(z),A0.remove(z)}function EJ(z){let v=A0.get(z).programs;if(v!==void 0){if(v.forEach(function(d){Z0.releaseProgram(d)}),z.isShaderMaterial)Z0.releaseShaderCache(z)}}this.renderBufferDirect=function(z,v,d,x,p,k0){if(v===null)v=L0;let _0=p.isMesh&&p.matrixWorld.determinant()<0,O0=K5(z,v,d,x,p);K0.setMaterial(x,_0);let S0=d.index,f0=1;if(x.wireframe===!0){if(S0=i.getWireframeAttribute(d),S0===void 0)return;f0=2}let i0=d.drawRange,QJ=d.attributes.position,h0=i0.start*f0,NJ=(i0.start+i0.count)*f0;if(k0!==null)h0=Math.max(h0,k0.start*f0),NJ=Math.min(NJ,(k0.start+k0.count)*f0);if(S0!==null)h0=Math.max(h0,0),NJ=Math.min(NJ,S0.count);else if(QJ!==void 0&&QJ!==null)h0=Math.max(h0,0),NJ=Math.min(NJ,QJ.count);let BJ=NJ-h0;if(BJ<0||BJ===1/0)return;j.setup(p,x,O0,d,S0);let MJ,DJ=n0;if(S0!==null)MJ=f.get(S0),DJ=a0,DJ.setIndex(MJ);if(p.isMesh)if(x.wireframe===!0)K0.setLineWidth(x.wireframeLinewidth*x0()),DJ.setMode(S.LINES);else DJ.setMode(S.TRIANGLES);else if(p.isLine){let bJ=x.linewidth;if(bJ===void 0)bJ=1;if(K0.setLineWidth(bJ*x0()),p.isLineSegments)DJ.setMode(S.LINES);else if(p.isLineLoop)DJ.setMode(S.LINE_LOOP);else DJ.setMode(S.LINE_STRIP)}else if(p.isPoints)DJ.setMode(S.POINTS);else if(p.isSprite)DJ.setMode(S.TRIANGLES);if(p.isBatchedMesh)if(!y0.get("WEBGL_multi_draw")){let{_multiDrawStarts:bJ,_multiDrawCounts:I0,_multiDrawCount:tJ}=p,XJ=S0?f.get(S0).bytesPerElement:1,K9=A0.get(x).currentProgram.getUniforms();for(let z9=0;z9<tJ;z9++)K9.setValue(S,"_gl_DrawID",z9),DJ.render(bJ[z9]/XJ,I0[z9])}else DJ.renderMultiDraw(p._multiDrawStarts,p._multiDrawCounts,p._multiDrawCount);else if(p.isInstancedMesh)DJ.renderInstances(h0,BJ,p.count);else if(d.isInstancedBufferGeometry){let bJ=d._maxInstanceCount!==void 0?d._maxInstanceCount:1/0,I0=Math.min(d.instanceCount,bJ);DJ.renderInstances(h0,BJ,I0)}else DJ.render(h0,BJ)};function B9(z,v,d){if(z.transparent===!0&&z.side===k9&&z.forceSinglePass===!1)z.side=cJ,z.needsUpdate=!0,OQ(z,v,d),z.side=l8,z.needsUpdate=!0,OQ(z,v,d),z.side=k9;else OQ(z,v,d)}this.compile=function(z,v,d=null){if(d===null)d=z;if(_=o.get(d),_.init(v),C.push(_),d.traverseVisible(function(p){if(p.isLight&&p.layers.test(v.layers)){if(_.pushLight(p),p.castShadow)_.pushShadow(p)}}),z!==d)z.traverseVisible(function(p){if(p.isLight&&p.layers.test(v.layers)){if(_.pushLight(p),p.castShadow)_.pushShadow(p)}});_.setupLights();let x=new Set;return z.traverse(function(p){if(!(p.isMesh||p.isPoints||p.isLine||p.isSprite))return;let k0=p.material;if(k0)if(Array.isArray(k0))for(let _0=0;_0<k0.length;_0++){let O0=k0[_0];B9(O0,d,p),x.add(O0)}else B9(k0,d,p),x.add(k0)}),_=C.pop(),x},this.compileAsync=function(z,v,d=null){let x=this.compile(z,v,d);return new Promise((p)=>{function k0(){if(x.forEach(function(_0){if(A0.get(_0).currentProgram.isReady())x.delete(_0)}),x.size===0){p(z);return}setTimeout(k0,10)}if(y0.get("KHR_parallel_shader_compile")!==null)k0();else setTimeout(k0,10)})};let N9=null;function Z5(z){if(N9)N9(z)}function VX(){V8.stop()}function BX(){V8.start()}let V8=new mG;if(V8.setAnimationLoop(Z5),typeof self<"u")V8.setContext(self);this.setAnimationLoop=function(z){N9=z,Y0.setAnimationLoop(z),z===null?V8.stop():V8.start()},Y0.addEventListener("sessionstart",VX),Y0.addEventListener("sessionend",BX),this.render=function(z,v){if(v!==void 0&&v.isCamera!==!0){T0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;if(T!==null)T.renderStart(z,v);let d=Y0.enabled===!0&&Y0.isPresenting===!0,x=L!==null&&(y===null||d)&&L.begin(I,y);if(z.matrixWorldAutoUpdate===!0)z.updateMatrixWorld();if(v.parent===null&&v.matrixWorldAutoUpdate===!0)v.updateMatrixWorld();if(Y0.enabled===!0&&Y0.isPresenting===!0&&(L===null||L.isCompositing()===!1)){if(Y0.cameraAutoUpdate===!0)Y0.updateCamera(v);v=Y0.getCamera()}if(z.isScene===!0)z.onBeforeRender(I,z,v,y);if(_=o.get(z,C.length),_.init(v),_.state.textureUnits=w.getTextureUnits(),C.push(_),t.multiplyMatrices(v.projectionMatrix,v.matrixWorldInverse),YJ.setFromProjectionMatrix(t,HZ,v.reversedDepth),l0=this.localClippingEnabled,p0=E0.init(this.clippingPlanes,l0),V=c.get(z,A.length),V.init(),A.push(V),Y0.enabled===!0&&Y0.isPresenting===!0){let _0=I.xr.getDepthSensingMesh();if(_0!==null)GW(_0,v,-1/0,I.sortObjects)}if(GW(z,v,0,I.sortObjects),V.finish(),I.sortObjects===!0)V.sort(s,R0);if(M0=Y0.enabled===!1||Y0.isPresenting===!1||Y0.hasDepthSensing()===!1,M0)X0.addToRenderList(V,z);if(this.info.render.frame++,p0===!0)E0.beginShadows();let p=_.state.shadowsArray;if(C0.render(p,z,v),p0===!0)E0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((x&&L.hasRenderPass())===!1){let{opaque:_0,transmissive:O0}=V;if(_.setupLights(),v.isArrayCamera){let S0=v.cameras;if(O0.length>0)for(let f0=0,i0=S0.length;f0<i0;f0++){let QJ=S0[f0];IX(_0,O0,z,QJ)}if(M0)X0.render(z);for(let f0=0,i0=S0.length;f0<i0;f0++){let QJ=S0[f0];zX(V,z,QJ,QJ.viewport)}}else{if(O0.length>0)IX(_0,O0,z,v);if(M0)X0.render(z);zX(V,z,v)}}if(y!==null&&u===0)w.updateMultisampleRenderTarget(y),w.updateRenderTargetMipmap(y);if(x)L.end(I);if(z.isScene===!0)z.onAfterRender(I,z,v);if(j.resetDefaultState(),l=-1,h=null,C.pop(),C.length>0){if(_=C[C.length-1],w.setTextureUnits(_.state.textureUnits),p0===!0)E0.setGlobalState(I.clippingPlanes,_.state.camera)}else _=null;if(A.pop(),A.length>0)V=A[A.length-1];else V=null;if(T!==null)T.renderEnd()};function GW(z,v,d,x){if(z.visible===!1)return;if(z.layers.test(v.layers)){if(z.isGroup)d=z.renderOrder;else if(z.isLOD){if(z.autoUpdate===!0)z.update(v)}else if(z.isLightProbeGrid)_.pushLightProbeGrid(z);else if(z.isLight){if(_.pushLight(z),z.castShadow)_.pushShadow(z)}else if(z.isSprite){if(!z.frustumCulled||YJ.intersectsSprite(z)){if(x)e.setFromMatrixPosition(z.matrixWorld).applyMatrix4(t);let _0=J0.update(z),O0=z.material;if(O0.visible)V.push(z,_0,O0,d,e.z,null)}}else if(z.isMesh||z.isLine||z.isPoints){if(!z.frustumCulled||YJ.intersectsObject(z)){let _0=J0.update(z),O0=z.material;if(x){if(z.boundingSphere!==void 0){if(z.boundingSphere===null)z.computeBoundingSphere();e.copy(z.boundingSphere.center)}else{if(_0.boundingSphere===null)_0.computeBoundingSphere();e.copy(_0.boundingSphere.center)}e.applyMatrix4(z.matrixWorld).applyMatrix4(t)}if(Array.isArray(O0)){let S0=_0.groups;for(let f0=0,i0=S0.length;f0<i0;f0++){let QJ=S0[f0],h0=O0[QJ.materialIndex];if(h0&&h0.visible)V.push(z,_0,h0,d,e.z,QJ)}}else if(O0.visible)V.push(z,_0,O0,d,e.z,null)}}}let k0=z.children;for(let _0=0,O0=k0.length;_0<O0;_0++)GW(k0[_0],v,d,x)}function zX(z,v,d,x){let{opaque:p,transmissive:k0,transparent:_0}=z;if(_.setupLightsView(d),p0===!0)E0.setGlobalState(I.clippingPlanes,d);if(x)K0.viewport(m.copy(x));if(p.length>0)RQ(p,v,d);if(k0.length>0)RQ(k0,v,d);if(_0.length>0)RQ(_0,v,d);K0.buffers.depth.setTest(!0),K0.buffers.depth.setMask(!0),K0.buffers.color.setMask(!0),K0.setPolygonOffset(!1)}function IX(z,v,d,x){if((d.isScene===!0?d.overrideMaterial:null)!==null)return;if(_.state.transmissionRenderTarget[x.id]===void 0){let h0=y0.has("EXT_color_buffer_half_float")||y0.has("EXT_color_buffer_float");_.state.transmissionRenderTarget[x.id]=new sJ(1,1,{generateMipmaps:!0,type:h0?S9:G9,minFilter:E8,samples:Math.max(4,g0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:$J.workingColorSpace})}let k0=_.state.transmissionRenderTarget[x.id],_0=x.viewport||m;k0.setSize(_0.z*I.transmissionResolutionScale,_0.w*I.transmissionResolutionScale);let O0=I.getRenderTarget(),S0=I.getActiveCubeFace(),f0=I.getActiveMipmapLevel();if(I.setRenderTarget(k0),I.getClearColor(N0),j0=I.getClearAlpha(),j0<1)I.setClearColor(16777215,0.5);if(I.clear(),M0)X0.render(d);let i0=I.toneMapping;I.toneMapping=U9;let QJ=x.viewport;if(x.viewport!==void 0)x.viewport=void 0;if(_.setupLightsView(x),p0===!0)E0.setGlobalState(I.clippingPlanes,x);if(RQ(z,d,x),w.updateMultisampleRenderTarget(k0),w.updateRenderTargetMipmap(k0),y0.has("WEBGL_multisampled_render_to_texture")===!1){let h0=!1;for(let NJ=0,BJ=v.length;NJ<BJ;NJ++){let MJ=v[NJ],{object:DJ,geometry:bJ,material:I0,group:tJ}=MJ;if(I0.side===k9&&DJ.layers.test(x.layers)){let XJ=I0.side;I0.side=cJ,I0.needsUpdate=!0,_X(DJ,d,x,bJ,I0,tJ),I0.side=XJ,I0.needsUpdate=!0,h0=!0}}if(h0===!0)w.updateMultisampleRenderTarget(k0),w.updateRenderTargetMipmap(k0)}if(I.setRenderTarget(O0,S0,f0),I.setClearColor(N0,j0),QJ!==void 0)x.viewport=QJ;I.toneMapping=i0}function RQ(z,v,d){let x=v.isScene===!0?v.overrideMaterial:null;for(let p=0,k0=z.length;p<k0;p++){let _0=z[p],{object:O0,geometry:S0,group:f0}=_0,i0=_0.material;if(i0.allowOverride===!0&&x!==null)i0=x;if(O0.layers.test(d.layers))_X(O0,v,d,S0,i0,f0)}}function _X(z,v,d,x,p,k0){if(z.onBeforeRender(I,v,d,x,p,k0),z.modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,z.matrixWorld),z.normalMatrix.getNormalMatrix(z.modelViewMatrix),p.onBeforeRender(I,v,d,x,z,k0),p.transparent===!0&&p.side===k9&&p.forceSinglePass===!1)p.side=cJ,p.needsUpdate=!0,I.renderBufferDirect(d,v,x,p,z,k0),p.side=l8,p.needsUpdate=!0,I.renderBufferDirect(d,v,x,p,z,k0),p.side=k9;else I.renderBufferDirect(d,v,x,p,z,k0);z.onAfterRender(I,v,d,x,p,k0)}function OQ(z,v,d){if(v.isScene!==!0)v=L0;let x=A0.get(z),p=_.state.lights,k0=_.state.shadowsArray,_0=p.state.version,O0=Z0.getParameters(z,p.state,k0,v,d,_.state.lightProbeGridArray),S0=Z0.getProgramCacheKey(O0),f0=x.programs;x.environment=z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial?v.environment:null,x.fog=v.fog;let i0=z.isMeshStandardMaterial||z.isMeshLambertMaterial&&!z.envMap||z.isMeshPhongMaterial&&!z.envMap;if(x.envMap=B.get(z.envMap||x.environment,i0),x.envMapRotation=x.environment!==null&&z.envMap===null?v.environmentRotation:z.envMapRotation,f0===void 0)z.addEventListener("dispose",s0),f0=new Map,x.programs=f0;let QJ=f0.get(S0);if(QJ!==void 0){if(x.currentProgram===QJ&&x.lightsStateVersion===_0)return CX(z,O0),QJ}else{if(O0.uniforms=Z0.getUniforms(z),T!==null&&z.isNodeMaterial)T.build(z,d,O0);z.onBeforeCompile(O0,I),QJ=Z0.acquireProgram(O0,S0),f0.set(S0,QJ),x.uniforms=O0.uniforms}let h0=x.uniforms;if(!z.isShaderMaterial&&!z.isRawShaderMaterial||z.clipping===!0)h0.clippingPlanes=E0.uniform;if(CX(z,O0),x.needsLights=X5(z),x.lightsStateVersion=_0,x.needsLights)h0.ambientLightColor.value=p.state.ambient,h0.lightProbe.value=p.state.probe,h0.directionalLights.value=p.state.directional,h0.directionalLightShadows.value=p.state.directionalShadow,h0.spotLights.value=p.state.spot,h0.spotLightShadows.value=p.state.spotShadow,h0.rectAreaLights.value=p.state.rectArea,h0.ltc_1.value=p.state.rectAreaLTC1,h0.ltc_2.value=p.state.rectAreaLTC2,h0.pointLights.value=p.state.point,h0.pointLightShadows.value=p.state.pointShadow,h0.hemisphereLights.value=p.state.hemi,h0.directionalShadowMatrix.value=p.state.directionalShadowMatrix,h0.spotLightMatrix.value=p.state.spotLightMatrix,h0.spotLightMap.value=p.state.spotLightMap,h0.pointShadowMatrix.value=p.state.pointShadowMatrix;return x.lightProbeGrid=_.state.lightProbeGridArray.length>0,x.currentProgram=QJ,x.uniformsList=null,QJ}function AX(z){if(z.uniformsList===null){let v=z.currentProgram.getUniforms();z.uniformsList=qQ.seqWithValue(v.seq,z.uniforms)}return z.uniformsList}function CX(z,v){let d=A0.get(z);d.outputColorSpace=v.outputColorSpace,d.batching=v.batching,d.batchingColor=v.batchingColor,d.instancing=v.instancing,d.instancingColor=v.instancingColor,d.instancingMorph=v.instancingMorph,d.skinning=v.skinning,d.morphTargets=v.morphTargets,d.morphNormals=v.morphNormals,d.morphColors=v.morphColors,d.morphTargetsCount=v.morphTargetsCount,d.numClippingPlanes=v.numClippingPlanes,d.numIntersection=v.numClipIntersection,d.vertexAlphas=v.vertexAlphas,d.vertexTangents=v.vertexTangents,d.toneMapping=v.toneMapping}function W5(z,v){if(z.length===0)return null;if(z.length===1)return z[0].texture!==null?z[0]:null;M.setFromMatrixPosition(v.matrixWorld);for(let d=0,x=z.length;d<x;d++){let p=z[d];if(p.texture!==null&&p.boundingBox.containsPoint(M))return p}return null}function K5(z,v,d,x,p){if(v.isScene!==!0)v=L0;w.resetTextureUnits();let k0=v.fog,_0=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?v.environment:null,O0=y===null?I.outputColorSpace:y.isXRRenderTarget===!0?y.texture.colorSpace:$J.workingColorSpace,S0=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,f0=B.get(x.envMap||_0,S0),i0=x.vertexColors===!0&&!!d.attributes.color&&d.attributes.color.itemSize===4,QJ=!!d.attributes.tangent&&(!!x.normalMap||x.anisotropy>0),h0=!!d.morphAttributes.position,NJ=!!d.morphAttributes.normal,BJ=!!d.morphAttributes.color,MJ=U9;if(x.toneMapped){if(y===null||y.isXRRenderTarget===!0)MJ=I.toneMapping}let DJ=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,bJ=DJ!==void 0?DJ.length:0,I0=A0.get(x),tJ=_.state.lights;if(p0===!0){if(l0===!0||z!==h){let RJ=z===h&&x.id===l;E0.setState(x,z,RJ)}}let XJ=!1;if(x.version===I0.__version){if(I0.needsLights&&I0.lightsStateVersion!==tJ.state.version)XJ=!0;else if(I0.outputColorSpace!==O0)XJ=!0;else if(p.isBatchedMesh&&I0.batching===!1)XJ=!0;else if(!p.isBatchedMesh&&I0.batching===!0)XJ=!0;else if(p.isBatchedMesh&&I0.batchingColor===!0&&p.colorTexture===null)XJ=!0;else if(p.isBatchedMesh&&I0.batchingColor===!1&&p.colorTexture!==null)XJ=!0;else if(p.isInstancedMesh&&I0.instancing===!1)XJ=!0;else if(!p.isInstancedMesh&&I0.instancing===!0)XJ=!0;else if(p.isSkinnedMesh&&I0.skinning===!1)XJ=!0;else if(!p.isSkinnedMesh&&I0.skinning===!0)XJ=!0;else if(p.isInstancedMesh&&I0.instancingColor===!0&&p.instanceColor===null)XJ=!0;else if(p.isInstancedMesh&&I0.instancingColor===!1&&p.instanceColor!==null)XJ=!0;else if(p.isInstancedMesh&&I0.instancingMorph===!0&&p.morphTexture===null)XJ=!0;else if(p.isInstancedMesh&&I0.instancingMorph===!1&&p.morphTexture!==null)XJ=!0;else if(I0.envMap!==f0)XJ=!0;else if(x.fog===!0&&I0.fog!==k0)XJ=!0;else if(I0.numClippingPlanes!==void 0&&(I0.numClippingPlanes!==E0.numPlanes||I0.numIntersection!==E0.numIntersection))XJ=!0;else if(I0.vertexAlphas!==i0)XJ=!0;else if(I0.vertexTangents!==QJ)XJ=!0;else if(I0.morphTargets!==h0)XJ=!0;else if(I0.morphNormals!==NJ)XJ=!0;else if(I0.morphColors!==BJ)XJ=!0;else if(I0.toneMapping!==MJ)XJ=!0;else if(I0.morphTargetsCount!==bJ)XJ=!0;else if(!!I0.lightProbeGrid!==_.state.lightProbeGridArray.length>0)XJ=!0}else XJ=!0,I0.__version=x.version;let K9=I0.currentProgram;if(XJ===!0){if(K9=OQ(x,v,p),T&&x.isNodeMaterial)T.onUpdateProgram(x,K9,I0)}let z9=!1,a9=!1,e8=!1,FJ=K9.getUniforms(),zJ=I0.uniforms;if(K0.useProgram(K9.program))z9=!0,a9=!0,e8=!0;if(x.id!==l)l=x.id,a9=!0;if(I0.needsLights){let RJ=W5(_.state.lightProbeGridArray,p);if(I0.lightProbeGrid!==RJ)I0.lightProbeGrid=RJ,a9=!0}if(z9||h!==z){if(K0.buffers.depth.getReversed()&&z.reversedDepth!==!0)z._reversedDepth=!0,z.updateProjectionMatrix();FJ.setValue(S,"projectionMatrix",z.projectionMatrix),FJ.setValue(S,"viewMatrix",z.matrixWorldInverse);let t9=FJ.map.cameraPosition;if(t9!==void 0)t9.setValue(S,$0.setFromMatrixPosition(z.matrixWorld));if(g0.logarithmicDepthBuffer)FJ.setValue(S,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2));if(x.isMeshPhongMaterial||x.isMeshToonMaterial||x.isMeshLambertMaterial||x.isMeshBasicMaterial||x.isMeshStandardMaterial||x.isShaderMaterial)FJ.setValue(S,"isOrthographic",z.isOrthographicCamera===!0);if(h!==z)h=z,a9=!0,e8=!0}if(I0.needsLights){if(tJ.state.directionalShadowMap.length>0)FJ.setValue(S,"directionalShadowMap",tJ.state.directionalShadowMap,w);if(tJ.state.spotShadowMap.length>0)FJ.setValue(S,"spotShadowMap",tJ.state.spotShadowMap,w);if(tJ.state.pointShadowMap.length>0)FJ.setValue(S,"pointShadowMap",tJ.state.pointShadowMap,w)}if(p.isSkinnedMesh){FJ.setOptional(S,p,"bindMatrix"),FJ.setOptional(S,p,"bindMatrixInverse");let RJ=p.skeleton;if(RJ){if(RJ.boneTexture===null)RJ.computeBoneTexture();FJ.setValue(S,"boneTexture",RJ.boneTexture,w)}}if(p.isBatchedMesh){if(FJ.setOptional(S,p,"batchingTexture"),FJ.setValue(S,"batchingTexture",p._matricesTexture,w),FJ.setOptional(S,p,"batchingIdTexture"),FJ.setValue(S,"batchingIdTexture",p._indirectTexture,w),FJ.setOptional(S,p,"batchingColorTexture"),p._colorsTexture!==null)FJ.setValue(S,"batchingColorTexture",p._colorsTexture,w)}let r9=d.morphAttributes;if(r9.position!==void 0||r9.normal!==void 0||r9.color!==void 0)F0.update(p,d,K9);if(a9||I0.receiveShadow!==p.receiveShadow)I0.receiveShadow=p.receiveShadow,FJ.setValue(S,"receiveShadow",p.receiveShadow);if((x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial)&&x.envMap===null&&v.environment!==null)zJ.envMapIntensity.value=v.environmentIntensity;if(zJ.dfgLUT!==void 0)zJ.dfgLUT.value=s1();if(a9){if(FJ.setValue(S,"toneMappingExposure",I.toneMappingExposure),I0.needsLights)Y5(zJ,e8);if(k0&&x.fog===!0)q0.refreshFogUniforms(zJ,k0);if(q0.refreshMaterialUniforms(zJ,x,t0,ZJ,_.state.transmissionRenderTarget[z.id]),I0.needsLights&&I0.lightProbeGrid){let RJ=I0.lightProbeGrid;zJ.probesSH.value=RJ.texture,zJ.probesMin.value.copy(RJ.boundingBox.min),zJ.probesMax.value.copy(RJ.boundingBox.max),zJ.probesResolution.value.copy(RJ.resolution)}qQ.upload(S,AX(I0),zJ,w)}if(x.isShaderMaterial&&x.uniformsNeedUpdate===!0)qQ.upload(S,AX(I0),zJ,w),x.uniformsNeedUpdate=!1;if(x.isSpriteMaterial)FJ.setValue(S,"center",p.center);if(FJ.setValue(S,"modelViewMatrix",p.modelViewMatrix),FJ.setValue(S,"normalMatrix",p.normalMatrix),FJ.setValue(S,"modelMatrix",p.matrixWorld),x.uniformsGroups!==void 0){let RJ=x.uniformsGroups;for(let t9=0,J7=RJ.length;t9<J7;t9++){let wX=RJ[t9];U0.update(wX,K9),U0.bind(wX,K9)}}return K9}function Y5(z,v){z.ambientLightColor.needsUpdate=v,z.lightProbe.needsUpdate=v,z.directionalLights.needsUpdate=v,z.directionalLightShadows.needsUpdate=v,z.pointLights.needsUpdate=v,z.pointLightShadows.needsUpdate=v,z.spotLights.needsUpdate=v,z.spotLightShadows.needsUpdate=v,z.rectAreaLights.needsUpdate=v,z.hemisphereLights.needsUpdate=v}function X5(z){return z.isMeshLambertMaterial||z.isMeshToonMaterial||z.isMeshPhongMaterial||z.isMeshStandardMaterial||z.isShadowMaterial||z.isShaderMaterial&&z.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return u},this.getRenderTarget=function(){return y},this.setRenderTargetTextures=function(z,v,d){let x=A0.get(z);if(x.__autoAllocateDepthBuffer=z.resolveDepthBuffer===!1,x.__autoAllocateDepthBuffer===!1)x.__useRenderToTexture=!1;A0.get(z.texture).__webglTexture=v,A0.get(z.depthTexture).__webglTexture=x.__autoAllocateDepthBuffer?void 0:d,x.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(z,v){let d=A0.get(z);d.__webglFramebuffer=v,d.__useDefaultFramebuffer=v===void 0};let H5=S.createFramebuffer();this.setRenderTarget=function(z,v=0,d=0){y=z,g=v,u=d;let x=null,p=!1,k0=!1;if(z){let O0=A0.get(z);if(O0.__useDefaultFramebuffer!==void 0){K0.bindFramebuffer(S.FRAMEBUFFER,O0.__webglFramebuffer),m.copy(z.viewport),a.copy(z.scissor),W0=z.scissorTest,K0.viewport(m),K0.scissor(a),K0.setScissorTest(W0),l=-1;return}else if(O0.__webglFramebuffer===void 0)w.setupRenderTarget(z);else if(O0.__hasExternalTextures)w.rebindTextures(z,A0.get(z.texture).__webglTexture,A0.get(z.depthTexture).__webglTexture);else if(z.depthBuffer){let i0=z.depthTexture;if(O0.__boundDepthTexture!==i0){if(i0!==null&&A0.has(i0)&&(z.width!==i0.image.width||z.height!==i0.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");w.setupDepthRenderbuffer(z)}}let S0=z.texture;if(S0.isData3DTexture||S0.isDataArrayTexture||S0.isCompressedArrayTexture)k0=!0;let f0=A0.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget){if(Array.isArray(f0[v]))x=f0[v][d];else x=f0[v];p=!0}else if(z.samples>0&&w.useMultisampledRTT(z)===!1)x=A0.get(z).__webglMultisampledFramebuffer;else if(Array.isArray(f0))x=f0[d];else x=f0;m.copy(z.viewport),a.copy(z.scissor),W0=z.scissorTest}else m.copy(P0).multiplyScalar(t0).floor(),a.copy(G0).multiplyScalar(t0).floor(),W0=b0;if(d!==0)x=H5;if(K0.bindFramebuffer(S.FRAMEBUFFER,x))K0.drawBuffers(z,x);if(K0.viewport(m),K0.scissor(a),K0.setScissorTest(W0),p){let O0=A0.get(z.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_CUBE_MAP_POSITIVE_X+v,O0.__webglTexture,d)}else if(k0){let O0=v;for(let S0=0;S0<z.textures.length;S0++){let f0=A0.get(z.textures[S0]);S.framebufferTextureLayer(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0+S0,f0.__webglTexture,d,O0)}}else if(z!==null&&d!==0){let O0=A0.get(z.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,O0.__webglTexture,d)}l=-1},this.readRenderTargetPixels=function(z,v,d,x,p,k0,_0,O0=0){if(!(z&&z.isWebGLRenderTarget)){T0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let S0=A0.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&_0!==void 0)S0=S0[_0];if(S0){K0.bindFramebuffer(S.FRAMEBUFFER,S0);try{let f0=z.textures[O0],i0=f0.format,QJ=f0.type;if(z.textures.length>1)S.readBuffer(S.COLOR_ATTACHMENT0+O0);if(!g0.textureFormatReadable(i0)){T0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!g0.textureTypeReadable(QJ)){T0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(v>=0&&v<=z.width-x&&(d>=0&&d<=z.height-p))S.readPixels(v,d,x,p,JJ.convert(i0),JJ.convert(QJ),k0)}finally{let f0=y!==null?A0.get(y).__webglFramebuffer:null;K0.bindFramebuffer(S.FRAMEBUFFER,f0)}}},this.readRenderTargetPixelsAsync=async function(z,v,d,x,p,k0,_0,O0=0){if(!(z&&z.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let S0=A0.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&_0!==void 0)S0=S0[_0];if(S0)if(v>=0&&v<=z.width-x&&(d>=0&&d<=z.height-p)){K0.bindFramebuffer(S.FRAMEBUFFER,S0);let f0=z.textures[O0],i0=f0.format,QJ=f0.type;if(z.textures.length>1)S.readBuffer(S.COLOR_ATTACHMENT0+O0);if(!g0.textureFormatReadable(i0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!g0.textureTypeReadable(QJ))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let h0=S.createBuffer();S.bindBuffer(S.PIXEL_PACK_BUFFER,h0),S.bufferData(S.PIXEL_PACK_BUFFER,k0.byteLength,S.STREAM_READ),S.readPixels(v,d,x,p,JJ.convert(i0),JJ.convert(QJ),0);let NJ=y!==null?A0.get(y).__webglFramebuffer:null;K0.bindFramebuffer(S.FRAMEBUFFER,NJ);let BJ=S.fenceSync(S.SYNC_GPU_COMMANDS_COMPLETE,0);return S.flush(),await QG(S,BJ,4),S.bindBuffer(S.PIXEL_PACK_BUFFER,h0),S.getBufferSubData(S.PIXEL_PACK_BUFFER,0,k0),S.deleteBuffer(h0),S.deleteSync(BJ),k0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(z,v=null,d=0){let x=Math.pow(2,-d),p=Math.floor(z.image.width*x),k0=Math.floor(z.image.height*x),_0=v!==null?v.x:0,O0=v!==null?v.y:0;w.setTexture2D(z,0),S.copyTexSubImage2D(S.TEXTURE_2D,d,0,0,_0,O0,p,k0),K0.unbindTexture()};let U5=S.createFramebuffer(),G5=S.createFramebuffer();if(this.copyTextureToTexture=function(z,v,d=null,x=null,p=0,k0=0){let _0,O0,S0,f0,i0,QJ,h0,NJ,BJ,MJ=z.isCompressedTexture?z.mipmaps[k0]:z.image;if(d!==null)_0=d.max.x-d.min.x,O0=d.max.y-d.min.y,S0=d.isBox3?d.max.z-d.min.z:1,f0=d.min.x,i0=d.min.y,QJ=d.isBox3?d.min.z:0;else{let zJ=Math.pow(2,-p);if(_0=Math.floor(MJ.width*zJ),O0=Math.floor(MJ.height*zJ),z.isDataArrayTexture)S0=MJ.depth;else if(z.isData3DTexture)S0=Math.floor(MJ.depth*zJ);else S0=1;f0=0,i0=0,QJ=0}if(x!==null)h0=x.x,NJ=x.y,BJ=x.z;else h0=0,NJ=0,BJ=0;let DJ=JJ.convert(v.format),bJ=JJ.convert(v.type),I0;if(v.isData3DTexture)w.setTexture3D(v,0),I0=S.TEXTURE_3D;else if(v.isDataArrayTexture||v.isCompressedArrayTexture)w.setTexture2DArray(v,0),I0=S.TEXTURE_2D_ARRAY;else w.setTexture2D(v,0),I0=S.TEXTURE_2D;K0.activeTexture(S.TEXTURE0),K0.pixelStorei(S.UNPACK_FLIP_Y_WEBGL,v.flipY),K0.pixelStorei(S.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),K0.pixelStorei(S.UNPACK_ALIGNMENT,v.unpackAlignment);let tJ=K0.getParameter(S.UNPACK_ROW_LENGTH),XJ=K0.getParameter(S.UNPACK_IMAGE_HEIGHT),K9=K0.getParameter(S.UNPACK_SKIP_PIXELS),z9=K0.getParameter(S.UNPACK_SKIP_ROWS),a9=K0.getParameter(S.UNPACK_SKIP_IMAGES);K0.pixelStorei(S.UNPACK_ROW_LENGTH,MJ.width),K0.pixelStorei(S.UNPACK_IMAGE_HEIGHT,MJ.height),K0.pixelStorei(S.UNPACK_SKIP_PIXELS,f0),K0.pixelStorei(S.UNPACK_SKIP_ROWS,i0),K0.pixelStorei(S.UNPACK_SKIP_IMAGES,QJ);let e8=z.isDataArrayTexture||z.isData3DTexture,FJ=v.isDataArrayTexture||v.isData3DTexture;if(z.isDepthTexture){let zJ=A0.get(z),r9=A0.get(v),RJ=A0.get(zJ.__renderTarget),t9=A0.get(r9.__renderTarget);K0.bindFramebuffer(S.READ_FRAMEBUFFER,RJ.__webglFramebuffer),K0.bindFramebuffer(S.DRAW_FRAMEBUFFER,t9.__webglFramebuffer);for(let J7=0;J7<S0;J7++){if(e8)S.framebufferTextureLayer(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,A0.get(z).__webglTexture,p,QJ+J7),S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,A0.get(v).__webglTexture,k0,BJ+J7);S.blitFramebuffer(f0,i0,_0,O0,h0,NJ,_0,O0,S.DEPTH_BUFFER_BIT,S.NEAREST)}K0.bindFramebuffer(S.READ_FRAMEBUFFER,null),K0.bindFramebuffer(S.DRAW_FRAMEBUFFER,null)}else if(p!==0||z.isRenderTargetTexture||A0.has(z)){let zJ=A0.get(z),r9=A0.get(v);K0.bindFramebuffer(S.READ_FRAMEBUFFER,U5),K0.bindFramebuffer(S.DRAW_FRAMEBUFFER,G5);for(let RJ=0;RJ<S0;RJ++){if(e8)S.framebufferTextureLayer(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,zJ.__webglTexture,p,QJ+RJ);else S.framebufferTexture2D(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,zJ.__webglTexture,p);if(FJ)S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,r9.__webglTexture,k0,BJ+RJ);else S.framebufferTexture2D(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,r9.__webglTexture,k0);if(p!==0)S.blitFramebuffer(f0,i0,_0,O0,h0,NJ,_0,O0,S.COLOR_BUFFER_BIT,S.NEAREST);else if(FJ)S.copyTexSubImage3D(I0,k0,h0,NJ,BJ+RJ,f0,i0,_0,O0);else S.copyTexSubImage2D(I0,k0,h0,NJ,f0,i0,_0,O0)}K0.bindFramebuffer(S.READ_FRAMEBUFFER,null),K0.bindFramebuffer(S.DRAW_FRAMEBUFFER,null)}else if(FJ)if(z.isDataTexture||z.isData3DTexture)S.texSubImage3D(I0,k0,h0,NJ,BJ,_0,O0,S0,DJ,bJ,MJ.data);else if(v.isCompressedArrayTexture)S.compressedTexSubImage3D(I0,k0,h0,NJ,BJ,_0,O0,S0,DJ,MJ.data);else S.texSubImage3D(I0,k0,h0,NJ,BJ,_0,O0,S0,DJ,bJ,MJ);else if(z.isDataTexture)S.texSubImage2D(S.TEXTURE_2D,k0,h0,NJ,_0,O0,DJ,bJ,MJ.data);else if(z.isCompressedTexture)S.compressedTexSubImage2D(S.TEXTURE_2D,k0,h0,NJ,MJ.width,MJ.height,DJ,MJ.data);else S.texSubImage2D(S.TEXTURE_2D,k0,h0,NJ,_0,O0,DJ,bJ,MJ);if(K0.pixelStorei(S.UNPACK_ROW_LENGTH,tJ),K0.pixelStorei(S.UNPACK_IMAGE_HEIGHT,XJ),K0.pixelStorei(S.UNPACK_SKIP_PIXELS,K9),K0.pixelStorei(S.UNPACK_SKIP_ROWS,z9),K0.pixelStorei(S.UNPACK_SKIP_IMAGES,a9),k0===0&&v.generateMipmaps)S.generateMipmap(I0);K0.unbindTexture()},this.initRenderTarget=function(z){if(A0.get(z).__webglFramebuffer===void 0)w.setupRenderTarget(z)},this.initTexture=function(z){if(z.isCubeTexture)w.setTextureCube(z,0);else if(z.isData3DTexture)w.setTexture3D(z,0);else if(z.isDataArrayTexture||z.isCompressedArrayTexture)w.setTexture2DArray(z,0);else w.setTexture2D(z,0);K0.unbindTexture()},this.resetState=function(){g=0,u=0,y=null,K0.reset(),j.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return HZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=$J._getDrawingBufferColorSpace(J),Q.unpackColorSpace=$J._getUnpackColorSpace()}}var UN=`#ifdef USE_ALPHAHASH
357
357
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
358
- #endif`,ZN=`#ifdef USE_ALPHAHASH
358
+ #endif`,GN=`#ifdef USE_ALPHAHASH
359
359
  const float ALPHA_HASH_SCALE = 0.05;
360
360
  float hash2D( vec2 value ) {
361
361
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -390,20 +390,20 @@ Program Info Log: `+c+`
390
390
  : cases.z;
391
391
  return clamp( threshold , 1.0e-6, 1.0 );
392
392
  }
393
- #endif`,WN=`#ifdef USE_ALPHAMAP
393
+ #endif`,EN=`#ifdef USE_ALPHAMAP
394
394
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
395
- #endif`,KN=`#ifdef USE_ALPHAMAP
395
+ #endif`,NN=`#ifdef USE_ALPHAMAP
396
396
  uniform sampler2D alphaMap;
397
- #endif`,HN=`#ifdef USE_ALPHATEST
397
+ #endif`,qN=`#ifdef USE_ALPHATEST
398
398
  #ifdef ALPHA_TO_COVERAGE
399
399
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
400
400
  if ( diffuseColor.a == 0.0 ) discard;
401
401
  #else
402
402
  if ( diffuseColor.a < alphaTest ) discard;
403
403
  #endif
404
- #endif`,YN=`#ifdef USE_ALPHATEST
404
+ #endif`,DN=`#ifdef USE_ALPHATEST
405
405
  uniform float alphaTest;
406
- #endif`,XN=`#ifdef USE_AOMAP
406
+ #endif`,FN=`#ifdef USE_AOMAP
407
407
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
408
408
  reflectedLight.indirectDiffuse *= ambientOcclusion;
409
409
  #if defined( USE_CLEARCOAT )
@@ -416,10 +416,10 @@ Program Info Log: `+c+`
416
416
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
417
417
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
418
418
  #endif
419
- #endif`,UN=`#ifdef USE_AOMAP
419
+ #endif`,RN=`#ifdef USE_AOMAP
420
420
  uniform sampler2D aoMap;
421
421
  uniform float aoMapIntensity;
422
- #endif`,GN=`#ifdef USE_BATCHING
422
+ #endif`,ON=`#ifdef USE_BATCHING
423
423
  #if ! defined( GL_ANGLE_multi_draw )
424
424
  #define gl_DrawID _gl_DrawID
425
425
  uniform int _gl_DrawID;
@@ -453,15 +453,15 @@ Program Info Log: `+c+`
453
453
  int y = j / size;
454
454
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
455
455
  }
456
- #endif`,EN=`#ifdef USE_BATCHING
456
+ #endif`,kN=`#ifdef USE_BATCHING
457
457
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
458
- #endif`,NN=`vec3 transformed = vec3( position );
458
+ #endif`,MN=`vec3 transformed = vec3( position );
459
459
  #ifdef USE_ALPHAHASH
460
460
  vPosition = vec3( position );
461
- #endif`,qN=`vec3 objectNormal = vec3( normal );
461
+ #endif`,LN=`vec3 objectNormal = vec3( normal );
462
462
  #ifdef USE_TANGENT
463
463
  vec3 objectTangent = vec3( tangent.xyz );
464
- #endif`,DN=`float G_BlinnPhong_Implicit( ) {
464
+ #endif`,VN=`float G_BlinnPhong_Implicit( ) {
465
465
  return 0.25;
466
466
  }
467
467
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -475,7 +475,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
475
475
  float G = G_BlinnPhong_Implicit( );
476
476
  float D = D_BlinnPhong( shininess, dotNH );
477
477
  return F * ( G * D );
478
- } // validated`,FN=`#ifdef USE_IRIDESCENCE
478
+ } // validated`,BN=`#ifdef USE_IRIDESCENCE
479
479
  const mat3 XYZ_TO_REC709 = mat3(
480
480
  3.2404542, -0.9692660, 0.0556434,
481
481
  -1.5371385, 1.8760108, -0.2040259,
@@ -538,7 +538,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
538
538
  }
539
539
  return max( I, vec3( 0.0 ) );
540
540
  }
541
- #endif`,RN=`#ifdef USE_BUMPMAP
541
+ #endif`,zN=`#ifdef USE_BUMPMAP
542
542
  uniform sampler2D bumpMap;
543
543
  uniform float bumpScale;
544
544
  vec2 dHdxy_fwd() {
@@ -559,7 +559,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
559
559
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
560
560
  return normalize( abs( fDet ) * surf_norm - vGrad );
561
561
  }
562
- #endif`,ON=`#if NUM_CLIPPING_PLANES > 0
562
+ #endif`,IN=`#if NUM_CLIPPING_PLANES > 0
563
563
  vec4 plane;
564
564
  #ifdef ALPHA_TO_COVERAGE
565
565
  float distanceToPlane, distanceGradient;
@@ -605,20 +605,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
605
605
  if ( clipped ) discard;
606
606
  #endif
607
607
  #endif
608
- #endif`,kN=`#if NUM_CLIPPING_PLANES > 0
608
+ #endif`,_N=`#if NUM_CLIPPING_PLANES > 0
609
609
  varying vec3 vClipPosition;
610
610
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
611
- #endif`,MN=`#if NUM_CLIPPING_PLANES > 0
611
+ #endif`,AN=`#if NUM_CLIPPING_PLANES > 0
612
612
  varying vec3 vClipPosition;
613
- #endif`,LN=`#if NUM_CLIPPING_PLANES > 0
613
+ #endif`,CN=`#if NUM_CLIPPING_PLANES > 0
614
614
  vClipPosition = - mvPosition.xyz;
615
- #endif`,VN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
615
+ #endif`,wN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
616
616
  diffuseColor *= vColor;
617
- #endif`,BN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
617
+ #endif`,PN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
618
618
  varying vec4 vColor;
619
- #endif`,zN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
619
+ #endif`,TN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
620
620
  varying vec4 vColor;
621
- #endif`,IN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
621
+ #endif`,SN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
622
622
  vColor = vec4( 1.0 );
623
623
  #endif
624
624
  #ifdef USE_COLOR_ALPHA
@@ -631,7 +631,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
631
631
  #endif
632
632
  #ifdef USE_BATCHING_COLOR
633
633
  vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
634
- #endif`,_N=`#define PI 3.141592653589793
634
+ #endif`,jN=`#define PI 3.141592653589793
635
635
  #define PI2 6.283185307179586
636
636
  #define PI_HALF 1.5707963267948966
637
637
  #define RECIPROCAL_PI 0.3183098861837907
@@ -698,7 +698,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
698
698
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
699
699
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
700
700
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
701
- } // validated`,AN=`#ifdef ENVMAP_TYPE_CUBE_UV
701
+ } // validated`,yN=`#ifdef ENVMAP_TYPE_CUBE_UV
702
702
  #define cubeUV_minMipLevel 4.0
703
703
  #define cubeUV_minTileSize 16.0
704
704
  float getFace( vec3 direction ) {
@@ -791,7 +791,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
791
791
  return vec4( mix( color0, color1, mipF ), 1.0 );
792
792
  }
793
793
  }
794
- #endif`,CN=`vec3 transformedNormal = objectNormal;
794
+ #endif`,vN=`vec3 transformedNormal = objectNormal;
795
795
  #ifdef USE_TANGENT
796
796
  vec3 transformedTangent = objectTangent;
797
797
  #endif
@@ -820,21 +820,21 @@ transformedNormal = normalMatrix * transformedNormal;
820
820
  #ifdef FLIP_SIDED
821
821
  transformedTangent = - transformedTangent;
822
822
  #endif
823
- #endif`,wN=`#ifdef USE_DISPLACEMENTMAP
823
+ #endif`,fN=`#ifdef USE_DISPLACEMENTMAP
824
824
  uniform sampler2D displacementMap;
825
825
  uniform float displacementScale;
826
826
  uniform float displacementBias;
827
- #endif`,PN=`#ifdef USE_DISPLACEMENTMAP
827
+ #endif`,bN=`#ifdef USE_DISPLACEMENTMAP
828
828
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
829
- #endif`,TN=`#ifdef USE_EMISSIVEMAP
829
+ #endif`,hN=`#ifdef USE_EMISSIVEMAP
830
830
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
831
831
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
832
832
  emissiveColor = sRGBTransferEOTF( emissiveColor );
833
833
  #endif
834
834
  totalEmissiveRadiance *= emissiveColor.rgb;
835
- #endif`,SN=`#ifdef USE_EMISSIVEMAP
835
+ #endif`,xN=`#ifdef USE_EMISSIVEMAP
836
836
  uniform sampler2D emissiveMap;
837
- #endif`,jN="gl_FragColor = linearToOutputTexel( gl_FragColor );",yN=`vec4 LinearTransferOETF( in vec4 value ) {
837
+ #endif`,gN="gl_FragColor = linearToOutputTexel( gl_FragColor );",pN=`vec4 LinearTransferOETF( in vec4 value ) {
838
838
  return value;
839
839
  }
840
840
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -842,7 +842,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
842
842
  }
843
843
  vec4 sRGBTransferOETF( in vec4 value ) {
844
844
  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 );
845
- }`,vN=`#ifdef USE_ENVMAP
845
+ }`,mN=`#ifdef USE_ENVMAP
846
846
  #ifdef ENV_WORLDPOS
847
847
  vec3 cameraToFrag;
848
848
  if ( isOrthographic ) {
@@ -860,7 +860,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
860
860
  vec3 reflectVec = vReflect;
861
861
  #endif
862
862
  #ifdef ENVMAP_TYPE_CUBE
863
- vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
863
+ vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
864
864
  #ifdef ENVMAP_BLENDING_MULTIPLY
865
865
  outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
866
866
  #elif defined( ENVMAP_BLENDING_MIX )
@@ -869,16 +869,15 @@ vec4 sRGBTransferOETF( in vec4 value ) {
869
869
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
870
870
  #endif
871
871
  #endif
872
- #endif`,fN=`#ifdef USE_ENVMAP
872
+ #endif`,dN=`#ifdef USE_ENVMAP
873
873
  uniform float envMapIntensity;
874
- uniform float flipEnvMap;
875
874
  uniform mat3 envMapRotation;
876
875
  #ifdef ENVMAP_TYPE_CUBE
877
876
  uniform samplerCube envMap;
878
877
  #else
879
878
  uniform sampler2D envMap;
880
879
  #endif
881
- #endif`,bN=`#ifdef USE_ENVMAP
880
+ #endif`,lN=`#ifdef USE_ENVMAP
882
881
  uniform float reflectivity;
883
882
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
884
883
  #define ENV_WORLDPOS
@@ -889,7 +888,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
889
888
  #else
890
889
  varying vec3 vReflect;
891
890
  #endif
892
- #endif`,hN=`#ifdef USE_ENVMAP
891
+ #endif`,uN=`#ifdef USE_ENVMAP
893
892
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
894
893
  #define ENV_WORLDPOS
895
894
  #endif
@@ -900,7 +899,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
900
899
  varying vec3 vReflect;
901
900
  uniform float refractionRatio;
902
901
  #endif
903
- #endif`,xN=`#ifdef USE_ENVMAP
902
+ #endif`,cN=`#ifdef USE_ENVMAP
904
903
  #ifdef ENV_WORLDPOS
905
904
  vWorldPosition = worldPosition.xyz;
906
905
  #else
@@ -917,18 +916,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
917
916
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
918
917
  #endif
919
918
  #endif
920
- #endif`,gN=`#ifdef USE_FOG
919
+ #endif`,nN=`#ifdef USE_FOG
921
920
  vFogDepth = - mvPosition.z;
922
- #endif`,pN=`#ifdef USE_FOG
921
+ #endif`,sN=`#ifdef USE_FOG
923
922
  varying float vFogDepth;
924
- #endif`,mN=`#ifdef USE_FOG
923
+ #endif`,iN=`#ifdef USE_FOG
925
924
  #ifdef FOG_EXP2
926
925
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
927
926
  #else
928
927
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
929
928
  #endif
930
929
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
931
- #endif`,dN=`#ifdef USE_FOG
930
+ #endif`,oN=`#ifdef USE_FOG
932
931
  uniform vec3 fogColor;
933
932
  varying float vFogDepth;
934
933
  #ifdef FOG_EXP2
@@ -937,7 +936,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
937
936
  uniform float fogNear;
938
937
  uniform float fogFar;
939
938
  #endif
940
- #endif`,lN=`#ifdef USE_GRADIENTMAP
939
+ #endif`,aN=`#ifdef USE_GRADIENTMAP
941
940
  uniform sampler2D gradientMap;
942
941
  #endif
943
942
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -949,12 +948,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
949
948
  vec2 fw = fwidth( coord ) * 0.5;
950
949
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
951
950
  #endif
952
- }`,uN=`#ifdef USE_LIGHTMAP
951
+ }`,rN=`#ifdef USE_LIGHTMAP
953
952
  uniform sampler2D lightMap;
954
953
  uniform float lightMapIntensity;
955
- #endif`,cN=`LambertMaterial material;
954
+ #endif`,tN=`LambertMaterial material;
956
955
  material.diffuseColor = diffuseColor.rgb;
957
- material.specularStrength = specularStrength;`,nN=`varying vec3 vViewPosition;
956
+ material.specularStrength = specularStrength;`,eN=`varying vec3 vViewPosition;
958
957
  struct LambertMaterial {
959
958
  vec3 diffuseColor;
960
959
  float specularStrength;
@@ -968,7 +967,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
968
967
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
969
968
  }
970
969
  #define RE_Direct RE_Direct_Lambert
971
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,sN=`uniform bool receiveShadow;
970
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Jq=`uniform bool receiveShadow;
972
971
  uniform vec3 ambientLightColor;
973
972
  #if defined( USE_LIGHT_PROBES )
974
973
  uniform vec3 lightProbe[ 9 ];
@@ -1084,7 +1083,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
1084
1083
  vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
1085
1084
  return irradiance;
1086
1085
  }
1087
- #endif`,iN=`#ifdef USE_ENVMAP
1086
+ #endif
1087
+ #include <lightprobes_pars_fragment>`,Qq=`#ifdef USE_ENVMAP
1088
1088
  vec3 getIBLIrradiance( const in vec3 normal ) {
1089
1089
  #ifdef ENVMAP_TYPE_CUBE_UV
1090
1090
  vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -1117,8 +1117,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
1117
1117
  #endif
1118
1118
  }
1119
1119
  #endif
1120
- #endif`,oN=`ToonMaterial material;
1121
- material.diffuseColor = diffuseColor.rgb;`,aN=`varying vec3 vViewPosition;
1120
+ #endif`,$q=`ToonMaterial material;
1121
+ material.diffuseColor = diffuseColor.rgb;`,Zq=`varying vec3 vViewPosition;
1122
1122
  struct ToonMaterial {
1123
1123
  vec3 diffuseColor;
1124
1124
  };
@@ -1130,11 +1130,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
1130
1130
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1131
1131
  }
1132
1132
  #define RE_Direct RE_Direct_Toon
1133
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,rN=`BlinnPhongMaterial material;
1133
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Wq=`BlinnPhongMaterial material;
1134
1134
  material.diffuseColor = diffuseColor.rgb;
1135
1135
  material.specularColor = specular;
1136
1136
  material.specularShininess = shininess;
1137
- material.specularStrength = specularStrength;`,tN=`varying vec3 vViewPosition;
1137
+ material.specularStrength = specularStrength;`,Kq=`varying vec3 vViewPosition;
1138
1138
  struct BlinnPhongMaterial {
1139
1139
  vec3 diffuseColor;
1140
1140
  vec3 specularColor;
@@ -1151,7 +1151,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
1151
1151
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1152
1152
  }
1153
1153
  #define RE_Direct RE_Direct_BlinnPhong
1154
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,eN=`PhysicalMaterial material;
1154
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Yq=`PhysicalMaterial material;
1155
1155
  material.diffuseColor = diffuseColor.rgb;
1156
1156
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
1157
1157
  material.metalness = metalnessFactor;
@@ -1241,7 +1241,7 @@ material.roughness = min( material.roughness, 1.0 );
1241
1241
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1242
1242
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
1243
1243
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
1244
- #endif`,Jq=`uniform sampler2D dfgLUT;
1244
+ #endif`,Xq=`uniform sampler2D dfgLUT;
1245
1245
  struct PhysicalMaterial {
1246
1246
  vec3 diffuseColor;
1247
1247
  vec3 diffuseContribution;
@@ -1312,8 +1312,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
1312
1312
  float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1313
1313
  float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1314
1314
  float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1315
- float v = 0.5 / ( gv + gl );
1316
- return v;
1315
+ return 0.5 / max( gv + gl, EPSILON );
1317
1316
  }
1318
1317
  float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1319
1318
  float a2 = alphaT * alphaB;
@@ -1602,7 +1601,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1602
1601
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1603
1602
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1604
1603
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1605
- }`,Qq=`
1604
+ }`,Hq=`
1606
1605
  vec3 geometryPosition = - vViewPosition;
1607
1606
  vec3 geometryNormal = normal;
1608
1607
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1715,11 +1714,16 @@ IncidentLight directLight;
1715
1714
  }
1716
1715
  #pragma unroll_loop_end
1717
1716
  #endif
1717
+ #ifdef USE_LIGHT_PROBES_GRID
1718
+ vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1719
+ vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );
1720
+ irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1721
+ #endif
1718
1722
  #endif
1719
1723
  #if defined( RE_IndirectSpecular )
1720
1724
  vec3 radiance = vec3( 0.0 );
1721
1725
  vec3 clearcoatRadiance = vec3( 0.0 );
1722
- #endif`,$q=`#if defined( RE_IndirectDiffuse )
1726
+ #endif`,Uq=`#if defined( RE_IndirectDiffuse )
1723
1727
  #ifdef USE_LIGHTMAP
1724
1728
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1725
1729
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1740,7 +1744,7 @@ IncidentLight directLight;
1740
1744
  #ifdef USE_CLEARCOAT
1741
1745
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1742
1746
  #endif
1743
- #endif`,Zq=`#if defined( RE_IndirectDiffuse )
1747
+ #endif`,Gq=`#if defined( RE_IndirectDiffuse )
1744
1748
  #if defined( LAMBERT ) || defined( PHONG )
1745
1749
  irradiance += iblIrradiance;
1746
1750
  #endif
@@ -1748,27 +1752,72 @@ IncidentLight directLight;
1748
1752
  #endif
1749
1753
  #if defined( RE_IndirectSpecular )
1750
1754
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1751
- #endif`,Wq=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1755
+ #endif`,Eq=`#ifdef USE_LIGHT_PROBES_GRID
1756
+ uniform highp sampler3D probesSH;
1757
+ uniform vec3 probesMin;
1758
+ uniform vec3 probesMax;
1759
+ uniform vec3 probesResolution;
1760
+ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1761
+ vec3 res = probesResolution;
1762
+ vec3 gridRange = probesMax - probesMin;
1763
+ vec3 resMinusOne = res - 1.0;
1764
+ vec3 probeSpacing = gridRange / resMinusOne;
1765
+ vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1766
+ vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1767
+ uvw = uvw * resMinusOne / res + 0.5 / res;
1768
+ float nz = res.z;
1769
+ float paddedSlices = nz + 2.0;
1770
+ float atlasDepth = 7.0 * paddedSlices;
1771
+ float uvZBase = uvw.z * nz + 1.0;
1772
+ vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );
1773
+ vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
1774
+ vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
1775
+ vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
1776
+ vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
1777
+ vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
1778
+ vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
1779
+ vec3 c0 = s0.xyz;
1780
+ vec3 c1 = vec3( s0.w, s1.xy );
1781
+ vec3 c2 = vec3( s1.zw, s2.x );
1782
+ vec3 c3 = s2.yzw;
1783
+ vec3 c4 = s3.xyz;
1784
+ vec3 c5 = vec3( s3.w, s4.xy );
1785
+ vec3 c6 = vec3( s4.zw, s5.x );
1786
+ vec3 c7 = s5.yzw;
1787
+ vec3 c8 = s6.xyz;
1788
+ float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1789
+ vec3 result = c0 * 0.886227;
1790
+ result += c1 * 2.0 * 0.511664 * y;
1791
+ result += c2 * 2.0 * 0.511664 * z;
1792
+ result += c3 * 2.0 * 0.511664 * x;
1793
+ result += c4 * 2.0 * 0.429043 * x * y;
1794
+ result += c5 * 2.0 * 0.429043 * y * z;
1795
+ result += c6 * ( 0.743125 * z * z - 0.247708 );
1796
+ result += c7 * 2.0 * 0.429043 * x * z;
1797
+ result += c8 * 0.429043 * ( x * x - y * y );
1798
+ return max( result, vec3( 0.0 ) );
1799
+ }
1800
+ #endif`,Nq=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1752
1801
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1753
- #endif`,Kq=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1802
+ #endif`,qq=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1754
1803
  uniform float logDepthBufFC;
1755
1804
  varying float vFragDepth;
1756
1805
  varying float vIsPerspective;
1757
- #endif`,Hq=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1806
+ #endif`,Dq=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1758
1807
  varying float vFragDepth;
1759
1808
  varying float vIsPerspective;
1760
- #endif`,Yq=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1809
+ #endif`,Fq=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1761
1810
  vFragDepth = 1.0 + gl_Position.w;
1762
1811
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1763
- #endif`,Xq=`#ifdef USE_MAP
1812
+ #endif`,Rq=`#ifdef USE_MAP
1764
1813
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1765
1814
  #ifdef DECODE_VIDEO_TEXTURE
1766
1815
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1767
1816
  #endif
1768
1817
  diffuseColor *= sampledDiffuseColor;
1769
- #endif`,Uq=`#ifdef USE_MAP
1818
+ #endif`,Oq=`#ifdef USE_MAP
1770
1819
  uniform sampler2D map;
1771
- #endif`,Gq=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1820
+ #endif`,kq=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1772
1821
  #if defined( USE_POINTS_UV )
1773
1822
  vec2 uv = vUv;
1774
1823
  #else
@@ -1780,7 +1829,7 @@ IncidentLight directLight;
1780
1829
  #endif
1781
1830
  #ifdef USE_ALPHAMAP
1782
1831
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1783
- #endif`,Eq=`#if defined( USE_POINTS_UV )
1832
+ #endif`,Mq=`#if defined( USE_POINTS_UV )
1784
1833
  varying vec2 vUv;
1785
1834
  #else
1786
1835
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1792,19 +1841,19 @@ IncidentLight directLight;
1792
1841
  #endif
1793
1842
  #ifdef USE_ALPHAMAP
1794
1843
  uniform sampler2D alphaMap;
1795
- #endif`,Nq=`float metalnessFactor = metalness;
1844
+ #endif`,Lq=`float metalnessFactor = metalness;
1796
1845
  #ifdef USE_METALNESSMAP
1797
1846
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1798
1847
  metalnessFactor *= texelMetalness.b;
1799
- #endif`,qq=`#ifdef USE_METALNESSMAP
1848
+ #endif`,Vq=`#ifdef USE_METALNESSMAP
1800
1849
  uniform sampler2D metalnessMap;
1801
- #endif`,Dq=`#ifdef USE_INSTANCING_MORPH
1850
+ #endif`,Bq=`#ifdef USE_INSTANCING_MORPH
1802
1851
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1803
1852
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1804
1853
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1805
1854
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1806
1855
  }
1807
- #endif`,Fq=`#if defined( USE_MORPHCOLORS )
1856
+ #endif`,zq=`#if defined( USE_MORPHCOLORS )
1808
1857
  vColor *= morphTargetBaseInfluence;
1809
1858
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1810
1859
  #if defined( USE_COLOR_ALPHA )
@@ -1813,12 +1862,12 @@ IncidentLight directLight;
1813
1862
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1814
1863
  #endif
1815
1864
  }
1816
- #endif`,Rq=`#ifdef USE_MORPHNORMALS
1865
+ #endif`,Iq=`#ifdef USE_MORPHNORMALS
1817
1866
  objectNormal *= morphTargetBaseInfluence;
1818
1867
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1819
1868
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1820
1869
  }
1821
- #endif`,Oq=`#ifdef USE_MORPHTARGETS
1870
+ #endif`,_q=`#ifdef USE_MORPHTARGETS
1822
1871
  #ifndef USE_INSTANCING_MORPH
1823
1872
  uniform float morphTargetBaseInfluence;
1824
1873
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1832,12 +1881,12 @@ IncidentLight directLight;
1832
1881
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1833
1882
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1834
1883
  }
1835
- #endif`,kq=`#ifdef USE_MORPHTARGETS
1884
+ #endif`,Aq=`#ifdef USE_MORPHTARGETS
1836
1885
  transformed *= morphTargetBaseInfluence;
1837
1886
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1838
1887
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1839
1888
  }
1840
- #endif`,Mq=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1889
+ #endif`,Cq=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1841
1890
  #ifdef FLAT_SHADED
1842
1891
  vec3 fdx = dFdx( vViewPosition );
1843
1892
  vec3 fdy = dFdy( vViewPosition );
@@ -1878,7 +1927,7 @@ IncidentLight directLight;
1878
1927
  tbn2[1] *= faceDirection;
1879
1928
  #endif
1880
1929
  #endif
1881
- vec3 nonPerturbedNormal = normal;`,Lq=`#ifdef USE_NORMALMAP_OBJECTSPACE
1930
+ vec3 nonPerturbedNormal = normal;`,wq=`#ifdef USE_NORMALMAP_OBJECTSPACE
1882
1931
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1883
1932
  #ifdef FLIP_SIDED
1884
1933
  normal = - normal;
@@ -1889,29 +1938,32 @@ vec3 nonPerturbedNormal = normal;`,Lq=`#ifdef USE_NORMALMAP_OBJECTSPACE
1889
1938
  normal = normalize( normalMatrix * normal );
1890
1939
  #elif defined( USE_NORMALMAP_TANGENTSPACE )
1891
1940
  vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1941
+ #if defined( USE_PACKED_NORMALMAP )
1942
+ mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1943
+ #endif
1892
1944
  mapN.xy *= normalScale;
1893
1945
  normal = normalize( tbn * mapN );
1894
1946
  #elif defined( USE_BUMPMAP )
1895
1947
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1896
- #endif`,Vq=`#ifndef FLAT_SHADED
1948
+ #endif`,Pq=`#ifndef FLAT_SHADED
1897
1949
  varying vec3 vNormal;
1898
1950
  #ifdef USE_TANGENT
1899
1951
  varying vec3 vTangent;
1900
1952
  varying vec3 vBitangent;
1901
1953
  #endif
1902
- #endif`,Bq=`#ifndef FLAT_SHADED
1954
+ #endif`,Tq=`#ifndef FLAT_SHADED
1903
1955
  varying vec3 vNormal;
1904
1956
  #ifdef USE_TANGENT
1905
1957
  varying vec3 vTangent;
1906
1958
  varying vec3 vBitangent;
1907
1959
  #endif
1908
- #endif`,zq=`#ifndef FLAT_SHADED
1960
+ #endif`,Sq=`#ifndef FLAT_SHADED
1909
1961
  vNormal = normalize( transformedNormal );
1910
1962
  #ifdef USE_TANGENT
1911
1963
  vTangent = normalize( transformedTangent );
1912
1964
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1913
1965
  #endif
1914
- #endif`,Iq=`#ifdef USE_NORMALMAP
1966
+ #endif`,jq=`#ifdef USE_NORMALMAP
1915
1967
  uniform sampler2D normalMap;
1916
1968
  uniform vec2 normalScale;
1917
1969
  #endif
@@ -1933,13 +1985,13 @@ vec3 nonPerturbedNormal = normal;`,Lq=`#ifdef USE_NORMALMAP_OBJECTSPACE
1933
1985
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1934
1986
  return mat3( T * scale, B * scale, N );
1935
1987
  }
1936
- #endif`,_q=`#ifdef USE_CLEARCOAT
1988
+ #endif`,yq=`#ifdef USE_CLEARCOAT
1937
1989
  vec3 clearcoatNormal = nonPerturbedNormal;
1938
- #endif`,Aq=`#ifdef USE_CLEARCOAT_NORMALMAP
1990
+ #endif`,vq=`#ifdef USE_CLEARCOAT_NORMALMAP
1939
1991
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1940
1992
  clearcoatMapN.xy *= clearcoatNormalScale;
1941
1993
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1942
- #endif`,Cq=`#ifdef USE_CLEARCOATMAP
1994
+ #endif`,fq=`#ifdef USE_CLEARCOATMAP
1943
1995
  uniform sampler2D clearcoatMap;
1944
1996
  #endif
1945
1997
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1948,18 +2000,18 @@ vec3 nonPerturbedNormal = normal;`,Lq=`#ifdef USE_NORMALMAP_OBJECTSPACE
1948
2000
  #endif
1949
2001
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1950
2002
  uniform sampler2D clearcoatRoughnessMap;
1951
- #endif`,wq=`#ifdef USE_IRIDESCENCEMAP
2003
+ #endif`,bq=`#ifdef USE_IRIDESCENCEMAP
1952
2004
  uniform sampler2D iridescenceMap;
1953
2005
  #endif
1954
2006
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1955
2007
  uniform sampler2D iridescenceThicknessMap;
1956
- #endif`,Pq=`#ifdef OPAQUE
2008
+ #endif`,hq=`#ifdef OPAQUE
1957
2009
  diffuseColor.a = 1.0;
1958
2010
  #endif
1959
2011
  #ifdef USE_TRANSMISSION
1960
2012
  diffuseColor.a *= material.transmissionAlpha;
1961
2013
  #endif
1962
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Tq=`vec3 packNormalToRGB( const in vec3 normal ) {
2014
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,xq=`vec3 packNormalToRGB( const in vec3 normal ) {
1963
2015
  return normalize( normal ) * 0.5 + 0.5;
1964
2016
  }
1965
2017
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -2038,9 +2090,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
2038
2090
  #else
2039
2091
  return ( near * far ) / ( ( far - near ) * depth - far );
2040
2092
  #endif
2041
- }`,Sq=`#ifdef PREMULTIPLIED_ALPHA
2093
+ }`,gq=`#ifdef PREMULTIPLIED_ALPHA
2042
2094
  gl_FragColor.rgb *= gl_FragColor.a;
2043
- #endif`,jq=`vec4 mvPosition = vec4( transformed, 1.0 );
2095
+ #endif`,pq=`vec4 mvPosition = vec4( transformed, 1.0 );
2044
2096
  #ifdef USE_BATCHING
2045
2097
  mvPosition = batchingMatrix * mvPosition;
2046
2098
  #endif
@@ -2048,22 +2100,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
2048
2100
  mvPosition = instanceMatrix * mvPosition;
2049
2101
  #endif
2050
2102
  mvPosition = modelViewMatrix * mvPosition;
2051
- gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2103
+ gl_Position = projectionMatrix * mvPosition;`,mq=`#ifdef DITHERING
2052
2104
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2053
- #endif`,vq=`#ifdef DITHERING
2105
+ #endif`,dq=`#ifdef DITHERING
2054
2106
  vec3 dithering( vec3 color ) {
2055
2107
  float grid_position = rand( gl_FragCoord.xy );
2056
2108
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
2057
2109
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
2058
2110
  return color + dither_shift_RGB;
2059
2111
  }
2060
- #endif`,fq=`float roughnessFactor = roughness;
2112
+ #endif`,lq=`float roughnessFactor = roughness;
2061
2113
  #ifdef USE_ROUGHNESSMAP
2062
2114
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
2063
2115
  roughnessFactor *= texelRoughness.g;
2064
- #endif`,bq=`#ifdef USE_ROUGHNESSMAP
2116
+ #endif`,uq=`#ifdef USE_ROUGHNESSMAP
2065
2117
  uniform sampler2D roughnessMap;
2066
- #endif`,hq=`#if NUM_SPOT_LIGHT_COORDS > 0
2118
+ #endif`,cq=`#if NUM_SPOT_LIGHT_COORDS > 0
2067
2119
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2068
2120
  #endif
2069
2121
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -2263,7 +2315,7 @@ gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2263
2315
  }
2264
2316
  #endif
2265
2317
  #endif
2266
- #endif`,xq=`#if NUM_SPOT_LIGHT_COORDS > 0
2318
+ #endif`,nq=`#if NUM_SPOT_LIGHT_COORDS > 0
2267
2319
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2268
2320
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2269
2321
  #endif
@@ -2304,8 +2356,12 @@ gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2304
2356
  };
2305
2357
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2306
2358
  #endif
2307
- #endif`,gq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2308
- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2359
+ #endif`,sq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2360
+ #ifdef HAS_NORMAL
2361
+ vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2362
+ #else
2363
+ vec3 shadowWorldNormal = vec3( 0.0 );
2364
+ #endif
2309
2365
  vec4 shadowWorldPosition;
2310
2366
  #endif
2311
2367
  #if defined( USE_SHADOWMAP )
@@ -2336,7 +2392,7 @@ gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2336
2392
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2337
2393
  }
2338
2394
  #pragma unroll_loop_end
2339
- #endif`,pq=`float getShadowMask() {
2395
+ #endif`,iq=`float getShadowMask() {
2340
2396
  float shadow = 1.0;
2341
2397
  #ifdef USE_SHADOWMAP
2342
2398
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2368,12 +2424,12 @@ gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2368
2424
  #endif
2369
2425
  #endif
2370
2426
  return shadow;
2371
- }`,mq=`#ifdef USE_SKINNING
2427
+ }`,oq=`#ifdef USE_SKINNING
2372
2428
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
2373
2429
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
2374
2430
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2375
2431
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
2376
- #endif`,dq=`#ifdef USE_SKINNING
2432
+ #endif`,aq=`#ifdef USE_SKINNING
2377
2433
  uniform mat4 bindMatrix;
2378
2434
  uniform mat4 bindMatrixInverse;
2379
2435
  uniform highp sampler2D boneTexture;
@@ -2388,7 +2444,7 @@ gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2388
2444
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2389
2445
  return mat4( v1, v2, v3, v4 );
2390
2446
  }
2391
- #endif`,lq=`#ifdef USE_SKINNING
2447
+ #endif`,rq=`#ifdef USE_SKINNING
2392
2448
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2393
2449
  vec4 skinned = vec4( 0.0 );
2394
2450
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2396,7 +2452,7 @@ gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2396
2452
  skinned += boneMatZ * skinVertex * skinWeight.z;
2397
2453
  skinned += boneMatW * skinVertex * skinWeight.w;
2398
2454
  transformed = ( bindMatrixInverse * skinned ).xyz;
2399
- #endif`,uq=`#ifdef USE_SKINNING
2455
+ #endif`,tq=`#ifdef USE_SKINNING
2400
2456
  mat4 skinMatrix = mat4( 0.0 );
2401
2457
  skinMatrix += skinWeight.x * boneMatX;
2402
2458
  skinMatrix += skinWeight.y * boneMatY;
@@ -2407,17 +2463,17 @@ gl_Position = projectionMatrix * mvPosition;`,yq=`#ifdef DITHERING
2407
2463
  #ifdef USE_TANGENT
2408
2464
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2409
2465
  #endif
2410
- #endif`,cq=`float specularStrength;
2466
+ #endif`,eq=`float specularStrength;
2411
2467
  #ifdef USE_SPECULARMAP
2412
2468
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2413
2469
  specularStrength = texelSpecular.r;
2414
2470
  #else
2415
2471
  specularStrength = 1.0;
2416
- #endif`,nq=`#ifdef USE_SPECULARMAP
2472
+ #endif`,JD=`#ifdef USE_SPECULARMAP
2417
2473
  uniform sampler2D specularMap;
2418
- #endif`,sq=`#if defined( TONE_MAPPING )
2474
+ #endif`,QD=`#if defined( TONE_MAPPING )
2419
2475
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2420
- #endif`,iq=`#ifndef saturate
2476
+ #endif`,$D=`#ifndef saturate
2421
2477
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2422
2478
  #endif
2423
2479
  uniform float toneMappingExposure;
@@ -2514,7 +2570,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2514
2570
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2515
2571
  return mix( color, vec3( newPeak ), g );
2516
2572
  }
2517
- vec3 CustomToneMapping( vec3 color ) { return color; }`,oq=`#ifdef USE_TRANSMISSION
2573
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZD=`#ifdef USE_TRANSMISSION
2518
2574
  material.transmission = transmission;
2519
2575
  material.transmissionAlpha = 1.0;
2520
2576
  material.thickness = thickness;
@@ -2535,7 +2591,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oq=`#ifdef USE_TRANSMISS
2535
2591
  material.attenuationColor, material.attenuationDistance );
2536
2592
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2537
2593
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2538
- #endif`,aq=`#ifdef USE_TRANSMISSION
2594
+ #endif`,WD=`#ifdef USE_TRANSMISSION
2539
2595
  uniform float transmission;
2540
2596
  uniform float thickness;
2541
2597
  uniform float attenuationDistance;
@@ -2661,7 +2717,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oq=`#ifdef USE_TRANSMISS
2661
2717
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2662
2718
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2663
2719
  }
2664
- #endif`,rq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2720
+ #endif`,KD=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2665
2721
  varying vec2 vUv;
2666
2722
  #endif
2667
2723
  #ifdef USE_MAP
@@ -2731,7 +2787,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oq=`#ifdef USE_TRANSMISS
2731
2787
  #ifdef USE_THICKNESSMAP
2732
2788
  uniform mat3 thicknessMapTransform;
2733
2789
  varying vec2 vThicknessMapUv;
2734
- #endif`,tq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2790
+ #endif`,YD=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2735
2791
  varying vec2 vUv;
2736
2792
  #endif
2737
2793
  #ifdef USE_MAP
@@ -2825,7 +2881,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oq=`#ifdef USE_TRANSMISS
2825
2881
  #ifdef USE_THICKNESSMAP
2826
2882
  uniform mat3 thicknessMapTransform;
2827
2883
  varying vec2 vThicknessMapUv;
2828
- #endif`,eq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2884
+ #endif`,XD=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2829
2885
  vUv = vec3( uv, 1 ).xy;
2830
2886
  #endif
2831
2887
  #ifdef USE_MAP
@@ -2896,7 +2952,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oq=`#ifdef USE_TRANSMISS
2896
2952
  #endif
2897
2953
  #ifdef USE_THICKNESSMAP
2898
2954
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2899
- #endif`,JD=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2955
+ #endif`,HD=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2900
2956
  vec4 worldPosition = vec4( transformed, 1.0 );
2901
2957
  #ifdef USE_BATCHING
2902
2958
  worldPosition = batchingMatrix * worldPosition;
@@ -2905,12 +2961,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oq=`#ifdef USE_TRANSMISS
2905
2961
  worldPosition = instanceMatrix * worldPosition;
2906
2962
  #endif
2907
2963
  worldPosition = modelMatrix * worldPosition;
2908
- #endif`,QD=`varying vec2 vUv;
2964
+ #endif`,UD=`varying vec2 vUv;
2909
2965
  uniform mat3 uvTransform;
2910
2966
  void main() {
2911
2967
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2912
2968
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2913
- }`,$D=`uniform sampler2D t2D;
2969
+ }`,GD=`uniform sampler2D t2D;
2914
2970
  uniform float backgroundIntensity;
2915
2971
  varying vec2 vUv;
2916
2972
  void main() {
@@ -2922,19 +2978,18 @@ void main() {
2922
2978
  gl_FragColor = texColor;
2923
2979
  #include <tonemapping_fragment>
2924
2980
  #include <colorspace_fragment>
2925
- }`,ZD=`varying vec3 vWorldDirection;
2981
+ }`,ED=`varying vec3 vWorldDirection;
2926
2982
  #include <common>
2927
2983
  void main() {
2928
2984
  vWorldDirection = transformDirection( position, modelMatrix );
2929
2985
  #include <begin_vertex>
2930
2986
  #include <project_vertex>
2931
2987
  gl_Position.z = gl_Position.w;
2932
- }`,WD=`#ifdef ENVMAP_TYPE_CUBE
2988
+ }`,ND=`#ifdef ENVMAP_TYPE_CUBE
2933
2989
  uniform samplerCube envMap;
2934
2990
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2935
2991
  uniform sampler2D envMap;
2936
2992
  #endif
2937
- uniform float flipEnvMap;
2938
2993
  uniform float backgroundBlurriness;
2939
2994
  uniform float backgroundIntensity;
2940
2995
  uniform mat3 backgroundRotation;
@@ -2942,7 +2997,7 @@ varying vec3 vWorldDirection;
2942
2997
  #include <cube_uv_reflection_fragment>
2943
2998
  void main() {
2944
2999
  #ifdef ENVMAP_TYPE_CUBE
2945
- vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
3000
+ vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2946
3001
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2947
3002
  vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2948
3003
  #else
@@ -2952,14 +3007,14 @@ void main() {
2952
3007
  gl_FragColor = texColor;
2953
3008
  #include <tonemapping_fragment>
2954
3009
  #include <colorspace_fragment>
2955
- }`,KD=`varying vec3 vWorldDirection;
3010
+ }`,qD=`varying vec3 vWorldDirection;
2956
3011
  #include <common>
2957
3012
  void main() {
2958
3013
  vWorldDirection = transformDirection( position, modelMatrix );
2959
3014
  #include <begin_vertex>
2960
3015
  #include <project_vertex>
2961
3016
  gl_Position.z = gl_Position.w;
2962
- }`,HD=`uniform samplerCube tCube;
3017
+ }`,DD=`uniform samplerCube tCube;
2963
3018
  uniform float tFlip;
2964
3019
  uniform float opacity;
2965
3020
  varying vec3 vWorldDirection;
@@ -2969,7 +3024,7 @@ void main() {
2969
3024
  gl_FragColor.a *= opacity;
2970
3025
  #include <tonemapping_fragment>
2971
3026
  #include <colorspace_fragment>
2972
- }`,YD=`#include <common>
3027
+ }`,FD=`#include <common>
2973
3028
  #include <batching_pars_vertex>
2974
3029
  #include <uv_pars_vertex>
2975
3030
  #include <displacementmap_pars_vertex>
@@ -2996,7 +3051,7 @@ void main() {
2996
3051
  #include <logdepthbuf_vertex>
2997
3052
  #include <clipping_planes_vertex>
2998
3053
  vHighPrecisionZW = gl_Position.zw;
2999
- }`,XD=`#if DEPTH_PACKING == 3200
3054
+ }`,RD=`#if DEPTH_PACKING == 3200
3000
3055
  uniform float opacity;
3001
3056
  #endif
3002
3057
  #include <common>
@@ -3034,7 +3089,7 @@ void main() {
3034
3089
  #elif DEPTH_PACKING == 3203
3035
3090
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
3036
3091
  #endif
3037
- }`,UD=`#define DISTANCE
3092
+ }`,OD=`#define DISTANCE
3038
3093
  varying vec3 vWorldPosition;
3039
3094
  #include <common>
3040
3095
  #include <batching_pars_vertex>
@@ -3061,7 +3116,7 @@ void main() {
3061
3116
  #include <worldpos_vertex>
3062
3117
  #include <clipping_planes_vertex>
3063
3118
  vWorldPosition = worldPosition.xyz;
3064
- }`,GD=`#define DISTANCE
3119
+ }`,kD=`#define DISTANCE
3065
3120
  uniform vec3 referencePosition;
3066
3121
  uniform float nearDistance;
3067
3122
  uniform float farDistance;
@@ -3084,13 +3139,13 @@ void main () {
3084
3139
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
3085
3140
  dist = saturate( dist );
3086
3141
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
3087
- }`,ED=`varying vec3 vWorldDirection;
3142
+ }`,MD=`varying vec3 vWorldDirection;
3088
3143
  #include <common>
3089
3144
  void main() {
3090
3145
  vWorldDirection = transformDirection( position, modelMatrix );
3091
3146
  #include <begin_vertex>
3092
3147
  #include <project_vertex>
3093
- }`,ND=`uniform sampler2D tEquirect;
3148
+ }`,LD=`uniform sampler2D tEquirect;
3094
3149
  varying vec3 vWorldDirection;
3095
3150
  #include <common>
3096
3151
  void main() {
@@ -3099,7 +3154,7 @@ void main() {
3099
3154
  gl_FragColor = texture2D( tEquirect, sampleUV );
3100
3155
  #include <tonemapping_fragment>
3101
3156
  #include <colorspace_fragment>
3102
- }`,qD=`uniform float scale;
3157
+ }`,VD=`uniform float scale;
3103
3158
  attribute float lineDistance;
3104
3159
  varying float vLineDistance;
3105
3160
  #include <common>
@@ -3121,7 +3176,7 @@ void main() {
3121
3176
  #include <logdepthbuf_vertex>
3122
3177
  #include <clipping_planes_vertex>
3123
3178
  #include <fog_vertex>
3124
- }`,DD=`uniform vec3 diffuse;
3179
+ }`,BD=`uniform vec3 diffuse;
3125
3180
  uniform float opacity;
3126
3181
  uniform float dashSize;
3127
3182
  uniform float totalSize;
@@ -3149,7 +3204,7 @@ void main() {
3149
3204
  #include <colorspace_fragment>
3150
3205
  #include <fog_fragment>
3151
3206
  #include <premultiplied_alpha_fragment>
3152
- }`,FD=`#include <common>
3207
+ }`,zD=`#include <common>
3153
3208
  #include <batching_pars_vertex>
3154
3209
  #include <uv_pars_vertex>
3155
3210
  #include <envmap_pars_vertex>
@@ -3181,7 +3236,7 @@ void main() {
3181
3236
  #include <worldpos_vertex>
3182
3237
  #include <envmap_vertex>
3183
3238
  #include <fog_vertex>
3184
- }`,RD=`uniform vec3 diffuse;
3239
+ }`,ID=`uniform vec3 diffuse;
3185
3240
  uniform float opacity;
3186
3241
  #ifndef FLAT_SHADED
3187
3242
  varying vec3 vNormal;
@@ -3229,7 +3284,7 @@ void main() {
3229
3284
  #include <fog_fragment>
3230
3285
  #include <premultiplied_alpha_fragment>
3231
3286
  #include <dithering_fragment>
3232
- }`,OD=`#define LAMBERT
3287
+ }`,_D=`#define LAMBERT
3233
3288
  varying vec3 vViewPosition;
3234
3289
  #include <common>
3235
3290
  #include <batching_pars_vertex>
@@ -3268,7 +3323,7 @@ void main() {
3268
3323
  #include <envmap_vertex>
3269
3324
  #include <shadowmap_vertex>
3270
3325
  #include <fog_vertex>
3271
- }`,kD=`#define LAMBERT
3326
+ }`,AD=`#define LAMBERT
3272
3327
  uniform vec3 diffuse;
3273
3328
  uniform vec3 emissive;
3274
3329
  uniform float opacity;
@@ -3326,7 +3381,7 @@ void main() {
3326
3381
  #include <fog_fragment>
3327
3382
  #include <premultiplied_alpha_fragment>
3328
3383
  #include <dithering_fragment>
3329
- }`,MD=`#define MATCAP
3384
+ }`,CD=`#define MATCAP
3330
3385
  varying vec3 vViewPosition;
3331
3386
  #include <common>
3332
3387
  #include <batching_pars_vertex>
@@ -3360,7 +3415,7 @@ void main() {
3360
3415
  #include <clipping_planes_vertex>
3361
3416
  #include <fog_vertex>
3362
3417
  vViewPosition = - mvPosition.xyz;
3363
- }`,LD=`#define MATCAP
3418
+ }`,wD=`#define MATCAP
3364
3419
  uniform vec3 diffuse;
3365
3420
  uniform float opacity;
3366
3421
  uniform sampler2D matcap;
@@ -3406,7 +3461,7 @@ void main() {
3406
3461
  #include <fog_fragment>
3407
3462
  #include <premultiplied_alpha_fragment>
3408
3463
  #include <dithering_fragment>
3409
- }`,VD=`#define NORMAL
3464
+ }`,PD=`#define NORMAL
3410
3465
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3411
3466
  varying vec3 vViewPosition;
3412
3467
  #endif
@@ -3439,7 +3494,7 @@ void main() {
3439
3494
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3440
3495
  vViewPosition = - mvPosition.xyz;
3441
3496
  #endif
3442
- }`,BD=`#define NORMAL
3497
+ }`,TD=`#define NORMAL
3443
3498
  uniform float opacity;
3444
3499
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3445
3500
  varying vec3 vViewPosition;
@@ -3460,7 +3515,7 @@ void main() {
3460
3515
  #ifdef OPAQUE
3461
3516
  gl_FragColor.a = 1.0;
3462
3517
  #endif
3463
- }`,zD=`#define PHONG
3518
+ }`,SD=`#define PHONG
3464
3519
  varying vec3 vViewPosition;
3465
3520
  #include <common>
3466
3521
  #include <batching_pars_vertex>
@@ -3499,7 +3554,7 @@ void main() {
3499
3554
  #include <envmap_vertex>
3500
3555
  #include <shadowmap_vertex>
3501
3556
  #include <fog_vertex>
3502
- }`,ID=`#define PHONG
3557
+ }`,jD=`#define PHONG
3503
3558
  uniform vec3 diffuse;
3504
3559
  uniform vec3 emissive;
3505
3560
  uniform vec3 specular;
@@ -3559,7 +3614,7 @@ void main() {
3559
3614
  #include <fog_fragment>
3560
3615
  #include <premultiplied_alpha_fragment>
3561
3616
  #include <dithering_fragment>
3562
- }`,_D=`#define STANDARD
3617
+ }`,yD=`#define STANDARD
3563
3618
  varying vec3 vViewPosition;
3564
3619
  #ifdef USE_TRANSMISSION
3565
3620
  varying vec3 vWorldPosition;
@@ -3602,7 +3657,7 @@ void main() {
3602
3657
  #ifdef USE_TRANSMISSION
3603
3658
  vWorldPosition = worldPosition.xyz;
3604
3659
  #endif
3605
- }`,AD=`#define STANDARD
3660
+ }`,vD=`#define STANDARD
3606
3661
  #ifdef PHYSICAL
3607
3662
  #define IOR
3608
3663
  #define USE_SPECULAR
@@ -3727,7 +3782,7 @@ void main() {
3727
3782
  #include <fog_fragment>
3728
3783
  #include <premultiplied_alpha_fragment>
3729
3784
  #include <dithering_fragment>
3730
- }`,CD=`#define TOON
3785
+ }`,fD=`#define TOON
3731
3786
  varying vec3 vViewPosition;
3732
3787
  #include <common>
3733
3788
  #include <batching_pars_vertex>
@@ -3764,7 +3819,7 @@ void main() {
3764
3819
  #include <worldpos_vertex>
3765
3820
  #include <shadowmap_vertex>
3766
3821
  #include <fog_vertex>
3767
- }`,wD=`#define TOON
3822
+ }`,bD=`#define TOON
3768
3823
  uniform vec3 diffuse;
3769
3824
  uniform vec3 emissive;
3770
3825
  uniform float opacity;
@@ -3816,7 +3871,7 @@ void main() {
3816
3871
  #include <fog_fragment>
3817
3872
  #include <premultiplied_alpha_fragment>
3818
3873
  #include <dithering_fragment>
3819
- }`,PD=`uniform float size;
3874
+ }`,hD=`uniform float size;
3820
3875
  uniform float scale;
3821
3876
  #include <common>
3822
3877
  #include <color_pars_vertex>
@@ -3847,7 +3902,7 @@ void main() {
3847
3902
  #include <clipping_planes_vertex>
3848
3903
  #include <worldpos_vertex>
3849
3904
  #include <fog_vertex>
3850
- }`,TD=`uniform vec3 diffuse;
3905
+ }`,xD=`uniform vec3 diffuse;
3851
3906
  uniform float opacity;
3852
3907
  #include <common>
3853
3908
  #include <color_pars_fragment>
@@ -3872,7 +3927,7 @@ void main() {
3872
3927
  #include <colorspace_fragment>
3873
3928
  #include <fog_fragment>
3874
3929
  #include <premultiplied_alpha_fragment>
3875
- }`,SD=`#include <common>
3930
+ }`,gD=`#include <common>
3876
3931
  #include <batching_pars_vertex>
3877
3932
  #include <fog_pars_vertex>
3878
3933
  #include <morphtarget_pars_vertex>
@@ -3895,7 +3950,7 @@ void main() {
3895
3950
  #include <worldpos_vertex>
3896
3951
  #include <shadowmap_vertex>
3897
3952
  #include <fog_vertex>
3898
- }`,jD=`uniform vec3 color;
3953
+ }`,pD=`uniform vec3 color;
3899
3954
  uniform float opacity;
3900
3955
  #include <common>
3901
3956
  #include <fog_pars_fragment>
@@ -3911,7 +3966,7 @@ void main() {
3911
3966
  #include <colorspace_fragment>
3912
3967
  #include <fog_fragment>
3913
3968
  #include <premultiplied_alpha_fragment>
3914
- }`,yD=`uniform float rotation;
3969
+ }`,mD=`uniform float rotation;
3915
3970
  uniform vec2 center;
3916
3971
  #include <common>
3917
3972
  #include <uv_pars_vertex>
@@ -3935,7 +3990,7 @@ void main() {
3935
3990
  #include <logdepthbuf_vertex>
3936
3991
  #include <clipping_planes_vertex>
3937
3992
  #include <fog_vertex>
3938
- }`,vD=`uniform vec3 diffuse;
3993
+ }`,dD=`uniform vec3 diffuse;
3939
3994
  uniform float opacity;
3940
3995
  #include <common>
3941
3996
  #include <uv_pars_fragment>
@@ -3960,9 +4015,9 @@ void main() {
3960
4015
  #include <tonemapping_fragment>
3961
4016
  #include <colorspace_fragment>
3962
4017
  #include <fog_fragment>
3963
- }`,a0,F0,O9,JW,o8,fD,F8=4,FG,r8=20,mD=256,YQ,RG,XY=null,UY=0,GY=0,EY=!1,dD,WW,eD,xG,DY,gG,pG,mG,LG,VG,BG,zG,IG,NY,dF=37297,lF=0,CG,sF,QW,eF,J1,$1,W1,H1,X1,G1,D1=0,V1=0,_1=`void main() {
4018
+ }`,r0,D0,V9,WW,lD,dG,L8=4,MG,t8=20,oD=256,GQ,LG,GX=null,EX=0,NX=0,qX=!1,aD,HW,XF,lG,RX,uG,cG,nG,IG,_G,AG,CG,wG,DX,aF=37297,rF=0,SG,Q1,KW,X1,H1,G1,N1,D1,R1,k1,B1=0,T1=0,v1=`void main() {
3964
4019
  gl_Position = vec4( position, 1.0 );
3965
- }`,A1=`uniform sampler2D shadow_pass;
4020
+ }`,f1=`uniform sampler2D shadow_pass;
3966
4021
  uniform vec2 resolution;
3967
4022
  uniform float radius;
3968
4023
  void main() {
@@ -3987,12 +4042,12 @@ void main() {
3987
4042
  squared_mean = squared_mean / samples;
3988
4043
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
3989
4044
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
3990
- }`,C1,w1,bG,XQ,qY,j1=`
4045
+ }`,b1,h1,pG,EQ,FX,m1=`
3991
4046
  void main() {
3992
4047
 
3993
4048
  gl_Position = vec4( position, 1.0 );
3994
4049
 
3995
- }`,y1=`
4050
+ }`,d1=`
3996
4051
  uniform sampler2DArray depthColor;
3997
4052
  uniform float depthWidth;
3998
4053
  uniform float depthHeight;
@@ -4011,7 +4066,7 @@ void main() {
4011
4066
 
4012
4067
  }
4013
4068
 
4014
- }`,oG,a8,v1,h1,T9=null;var YW=CY(()=>{YY();YY();a0={alphahash_fragment:$N,alphahash_pars_fragment:ZN,alphamap_fragment:WN,alphamap_pars_fragment:KN,alphatest_fragment:HN,alphatest_pars_fragment:YN,aomap_fragment:XN,aomap_pars_fragment:UN,batching_pars_vertex:GN,batching_vertex:EN,begin_vertex:NN,beginnormal_vertex:qN,bsdfs:DN,iridescence_fragment:FN,bumpmap_pars_fragment:RN,clipping_planes_fragment:ON,clipping_planes_pars_fragment:kN,clipping_planes_pars_vertex:MN,clipping_planes_vertex:LN,color_fragment:VN,color_pars_fragment:BN,color_pars_vertex:zN,color_vertex:IN,common:_N,cube_uv_reflection_fragment:AN,defaultnormal_vertex:CN,displacementmap_pars_vertex:wN,displacementmap_vertex:PN,emissivemap_fragment:TN,emissivemap_pars_fragment:SN,colorspace_fragment:jN,colorspace_pars_fragment:yN,envmap_fragment:vN,envmap_common_pars_fragment:fN,envmap_pars_fragment:bN,envmap_pars_vertex:hN,envmap_physical_pars_fragment:iN,envmap_vertex:xN,fog_vertex:gN,fog_pars_vertex:pN,fog_fragment:mN,fog_pars_fragment:dN,gradientmap_pars_fragment:lN,lightmap_pars_fragment:uN,lights_lambert_fragment:cN,lights_lambert_pars_fragment:nN,lights_pars_begin:sN,lights_toon_fragment:oN,lights_toon_pars_fragment:aN,lights_phong_fragment:rN,lights_phong_pars_fragment:tN,lights_physical_fragment:eN,lights_physical_pars_fragment:Jq,lights_fragment_begin:Qq,lights_fragment_maps:$q,lights_fragment_end:Zq,logdepthbuf_fragment:Wq,logdepthbuf_pars_fragment:Kq,logdepthbuf_pars_vertex:Hq,logdepthbuf_vertex:Yq,map_fragment:Xq,map_pars_fragment:Uq,map_particle_fragment:Gq,map_particle_pars_fragment:Eq,metalnessmap_fragment:Nq,metalnessmap_pars_fragment:qq,morphinstance_vertex:Dq,morphcolor_vertex:Fq,morphnormal_vertex:Rq,morphtarget_pars_vertex:Oq,morphtarget_vertex:kq,normal_fragment_begin:Mq,normal_fragment_maps:Lq,normal_pars_fragment:Vq,normal_pars_vertex:Bq,normal_vertex:zq,normalmap_pars_fragment:Iq,clearcoat_normal_fragment_begin:_q,clearcoat_normal_fragment_maps:Aq,clearcoat_pars_fragment:Cq,iridescence_pars_fragment:wq,opaque_fragment:Pq,packing:Tq,premultiplied_alpha_fragment:Sq,project_vertex:jq,dithering_fragment:yq,dithering_pars_fragment:vq,roughnessmap_fragment:fq,roughnessmap_pars_fragment:bq,shadowmap_pars_fragment:hq,shadowmap_pars_vertex:xq,shadowmap_vertex:gq,shadowmask_pars_fragment:pq,skinbase_vertex:mq,skinning_pars_vertex:dq,skinning_vertex:lq,skinnormal_vertex:uq,specularmap_fragment:cq,specularmap_pars_fragment:nq,tonemapping_fragment:sq,tonemapping_pars_fragment:iq,transmission_fragment:oq,transmission_pars_fragment:aq,uv_pars_fragment:rq,uv_pars_vertex:tq,uv_vertex:eq,worldpos_vertex:JD,background_vert:QD,background_frag:$D,backgroundCube_vert:ZD,backgroundCube_frag:WD,cube_vert:KD,cube_frag:HD,depth_vert:YD,depth_frag:XD,distance_vert:UD,distance_frag:GD,equirect_vert:ED,equirect_frag:ND,linedashed_vert:qD,linedashed_frag:DD,meshbasic_vert:FD,meshbasic_frag:RD,meshlambert_vert:OD,meshlambert_frag:kD,meshmatcap_vert:MD,meshmatcap_frag:LD,meshnormal_vert:VD,meshnormal_frag:BD,meshphong_vert:zD,meshphong_frag:ID,meshphysical_vert:_D,meshphysical_frag:AD,meshtoon_vert:CD,meshtoon_frag:wD,points_vert:PD,points_frag:TD,shadow_vert:SD,shadow_frag:jD,sprite_vert:yD,sprite_frag:vD},F0={common:{diffuse:{value:new M0(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new c0},alphaMap:{value:null},alphaMapTransform:{value:new c0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new c0}},envmap:{envMap:{value:null},envMapRotation:{value:new c0},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new c0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new c0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new c0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new c0},normalScale:{value:new r(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new c0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new c0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new c0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new c0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new M0(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}},points:{diffuse:{value:new M0(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new c0},alphaTest:{value:0},uvTransform:{value:new c0}},sprite:{diffuse:{value:new M0(16777215)},opacity:{value:1},center:{value:new r(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new c0},alphaMap:{value:null},alphaMapTransform:{value:new c0},alphaTest:{value:0}}},O9={basic:{uniforms:hJ([F0.common,F0.specularmap,F0.envmap,F0.aomap,F0.lightmap,F0.fog]),vertexShader:a0.meshbasic_vert,fragmentShader:a0.meshbasic_frag},lambert:{uniforms:hJ([F0.common,F0.specularmap,F0.envmap,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.fog,F0.lights,{emissive:{value:new M0(0)},envMapIntensity:{value:1}}]),vertexShader:a0.meshlambert_vert,fragmentShader:a0.meshlambert_frag},phong:{uniforms:hJ([F0.common,F0.specularmap,F0.envmap,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.fog,F0.lights,{emissive:{value:new M0(0)},specular:{value:new M0(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:a0.meshphong_vert,fragmentShader:a0.meshphong_frag},standard:{uniforms:hJ([F0.common,F0.envmap,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.roughnessmap,F0.metalnessmap,F0.fog,F0.lights,{emissive:{value:new M0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:a0.meshphysical_vert,fragmentShader:a0.meshphysical_frag},toon:{uniforms:hJ([F0.common,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.gradientmap,F0.fog,F0.lights,{emissive:{value:new M0(0)}}]),vertexShader:a0.meshtoon_vert,fragmentShader:a0.meshtoon_frag},matcap:{uniforms:hJ([F0.common,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.fog,{matcap:{value:null}}]),vertexShader:a0.meshmatcap_vert,fragmentShader:a0.meshmatcap_frag},points:{uniforms:hJ([F0.points,F0.fog]),vertexShader:a0.points_vert,fragmentShader:a0.points_frag},dashed:{uniforms:hJ([F0.common,F0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:a0.linedashed_vert,fragmentShader:a0.linedashed_frag},depth:{uniforms:hJ([F0.common,F0.displacementmap]),vertexShader:a0.depth_vert,fragmentShader:a0.depth_frag},normal:{uniforms:hJ([F0.common,F0.bumpmap,F0.normalmap,F0.displacementmap,{opacity:{value:1}}]),vertexShader:a0.meshnormal_vert,fragmentShader:a0.meshnormal_frag},sprite:{uniforms:hJ([F0.sprite,F0.fog]),vertexShader:a0.sprite_vert,fragmentShader:a0.sprite_frag},background:{uniforms:{uvTransform:{value:new c0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:a0.background_vert,fragmentShader:a0.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new c0}},vertexShader:a0.backgroundCube_vert,fragmentShader:a0.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:a0.cube_vert,fragmentShader:a0.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:a0.equirect_vert,fragmentShader:a0.equirect_frag},distance:{uniforms:hJ([F0.common,F0.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:a0.distance_vert,fragmentShader:a0.distance_frag},shadow:{uniforms:hJ([F0.lights,F0.fog,{color:{value:new M0(0)},opacity:{value:1}}]),vertexShader:a0.shadow_vert,fragmentShader:a0.shadow_frag}};O9.physical={uniforms:hJ([O9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new c0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new c0},clearcoatNormalScale:{value:new r(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new c0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new c0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new c0},sheen:{value:0},sheenColor:{value:new M0(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new c0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new c0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new c0},transmissionSamplerSize:{value:new r},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new c0},attenuationDistance:{value:0},attenuationColor:{value:new M0(0)},specularColor:{value:new M0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new c0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new c0},anisotropyVector:{value:new r},anisotropyMap:{value:null},anisotropyMapTransform:{value:new c0}}]),vertexShader:a0.meshphysical_vert,fragmentShader:a0.meshphysical_frag};JW={r:0,b:0,g:0},o8=new sJ,fD=new m0;FG=[0.125,0.215,0.35,0.446,0.526,0.582],YQ=new i8,RG=new M0,dD=new P;WW=class WW extends uJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new u8(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:`
4069
+ }`,J5,l1,Q5,n1,v9=null;var FQ=PX(()=>{UX();UX();r0={alphahash_fragment:UN,alphahash_pars_fragment:GN,alphamap_fragment:EN,alphamap_pars_fragment:NN,alphatest_fragment:qN,alphatest_pars_fragment:DN,aomap_fragment:FN,aomap_pars_fragment:RN,batching_pars_vertex:ON,batching_vertex:kN,begin_vertex:MN,beginnormal_vertex:LN,bsdfs:VN,iridescence_fragment:BN,bumpmap_pars_fragment:zN,clipping_planes_fragment:IN,clipping_planes_pars_fragment:_N,clipping_planes_pars_vertex:AN,clipping_planes_vertex:CN,color_fragment:wN,color_pars_fragment:PN,color_pars_vertex:TN,color_vertex:SN,common:jN,cube_uv_reflection_fragment:yN,defaultnormal_vertex:vN,displacementmap_pars_vertex:fN,displacementmap_vertex:bN,emissivemap_fragment:hN,emissivemap_pars_fragment:xN,colorspace_fragment:gN,colorspace_pars_fragment:pN,envmap_fragment:mN,envmap_common_pars_fragment:dN,envmap_pars_fragment:lN,envmap_pars_vertex:uN,envmap_physical_pars_fragment:Qq,envmap_vertex:cN,fog_vertex:nN,fog_pars_vertex:sN,fog_fragment:iN,fog_pars_fragment:oN,gradientmap_pars_fragment:aN,lightmap_pars_fragment:rN,lights_lambert_fragment:tN,lights_lambert_pars_fragment:eN,lights_pars_begin:Jq,lights_toon_fragment:$q,lights_toon_pars_fragment:Zq,lights_phong_fragment:Wq,lights_phong_pars_fragment:Kq,lights_physical_fragment:Yq,lights_physical_pars_fragment:Xq,lights_fragment_begin:Hq,lights_fragment_maps:Uq,lights_fragment_end:Gq,lightprobes_pars_fragment:Eq,logdepthbuf_fragment:Nq,logdepthbuf_pars_fragment:qq,logdepthbuf_pars_vertex:Dq,logdepthbuf_vertex:Fq,map_fragment:Rq,map_pars_fragment:Oq,map_particle_fragment:kq,map_particle_pars_fragment:Mq,metalnessmap_fragment:Lq,metalnessmap_pars_fragment:Vq,morphinstance_vertex:Bq,morphcolor_vertex:zq,morphnormal_vertex:Iq,morphtarget_pars_vertex:_q,morphtarget_vertex:Aq,normal_fragment_begin:Cq,normal_fragment_maps:wq,normal_pars_fragment:Pq,normal_pars_vertex:Tq,normal_vertex:Sq,normalmap_pars_fragment:jq,clearcoat_normal_fragment_begin:yq,clearcoat_normal_fragment_maps:vq,clearcoat_pars_fragment:fq,iridescence_pars_fragment:bq,opaque_fragment:hq,packing:xq,premultiplied_alpha_fragment:gq,project_vertex:pq,dithering_fragment:mq,dithering_pars_fragment:dq,roughnessmap_fragment:lq,roughnessmap_pars_fragment:uq,shadowmap_pars_fragment:cq,shadowmap_pars_vertex:nq,shadowmap_vertex:sq,shadowmask_pars_fragment:iq,skinbase_vertex:oq,skinning_pars_vertex:aq,skinning_vertex:rq,skinnormal_vertex:tq,specularmap_fragment:eq,specularmap_pars_fragment:JD,tonemapping_fragment:QD,tonemapping_pars_fragment:$D,transmission_fragment:ZD,transmission_pars_fragment:WD,uv_pars_fragment:KD,uv_pars_vertex:YD,uv_vertex:XD,worldpos_vertex:HD,background_vert:UD,background_frag:GD,backgroundCube_vert:ED,backgroundCube_frag:ND,cube_vert:qD,cube_frag:DD,depth_vert:FD,depth_frag:RD,distance_vert:OD,distance_frag:kD,equirect_vert:MD,equirect_frag:LD,linedashed_vert:VD,linedashed_frag:BD,meshbasic_vert:zD,meshbasic_frag:ID,meshlambert_vert:_D,meshlambert_frag:AD,meshmatcap_vert:CD,meshmatcap_frag:wD,meshnormal_vert:PD,meshnormal_frag:TD,meshphong_vert:SD,meshphong_frag:jD,meshphysical_vert:yD,meshphysical_frag:vD,meshtoon_vert:fD,meshtoon_frag:bD,points_vert:hD,points_frag:xD,shadow_vert:gD,shadow_frag:pD,sprite_vert:mD,sprite_frag:dD},D0={common:{diffuse:{value:new V0(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new u0},alphaMap:{value:null},alphaMapTransform:{value:new u0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new u0}},envmap:{envMap:{value:null},envMapRotation:{value:new u0},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new u0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new u0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new u0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new u0},normalScale:{value:new r(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new u0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new u0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new u0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new u0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new V0(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 P},probesMax:{value:new P},probesResolution:{value:new P}},points:{diffuse:{value:new V0(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new u0},alphaTest:{value:0},uvTransform:{value:new u0}},sprite:{diffuse:{value:new V0(16777215)},opacity:{value:1},center:{value:new r(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new u0},alphaMap:{value:null},alphaMapTransform:{value:new u0},alphaTest:{value:0}}},V9={basic:{uniforms:pJ([D0.common,D0.specularmap,D0.envmap,D0.aomap,D0.lightmap,D0.fog]),vertexShader:r0.meshbasic_vert,fragmentShader:r0.meshbasic_frag},lambert:{uniforms:pJ([D0.common,D0.specularmap,D0.envmap,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.fog,D0.lights,{emissive:{value:new V0(0)},envMapIntensity:{value:1}}]),vertexShader:r0.meshlambert_vert,fragmentShader:r0.meshlambert_frag},phong:{uniforms:pJ([D0.common,D0.specularmap,D0.envmap,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.fog,D0.lights,{emissive:{value:new V0(0)},specular:{value:new V0(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:r0.meshphong_vert,fragmentShader:r0.meshphong_frag},standard:{uniforms:pJ([D0.common,D0.envmap,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.roughnessmap,D0.metalnessmap,D0.fog,D0.lights,{emissive:{value:new V0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:r0.meshphysical_vert,fragmentShader:r0.meshphysical_frag},toon:{uniforms:pJ([D0.common,D0.aomap,D0.lightmap,D0.emissivemap,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.gradientmap,D0.fog,D0.lights,{emissive:{value:new V0(0)}}]),vertexShader:r0.meshtoon_vert,fragmentShader:r0.meshtoon_frag},matcap:{uniforms:pJ([D0.common,D0.bumpmap,D0.normalmap,D0.displacementmap,D0.fog,{matcap:{value:null}}]),vertexShader:r0.meshmatcap_vert,fragmentShader:r0.meshmatcap_frag},points:{uniforms:pJ([D0.points,D0.fog]),vertexShader:r0.points_vert,fragmentShader:r0.points_frag},dashed:{uniforms:pJ([D0.common,D0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:r0.linedashed_vert,fragmentShader:r0.linedashed_frag},depth:{uniforms:pJ([D0.common,D0.displacementmap]),vertexShader:r0.depth_vert,fragmentShader:r0.depth_frag},normal:{uniforms:pJ([D0.common,D0.bumpmap,D0.normalmap,D0.displacementmap,{opacity:{value:1}}]),vertexShader:r0.meshnormal_vert,fragmentShader:r0.meshnormal_frag},sprite:{uniforms:pJ([D0.sprite,D0.fog]),vertexShader:r0.sprite_vert,fragmentShader:r0.sprite_frag},background:{uniforms:{uvTransform:{value:new u0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:r0.background_vert,fragmentShader:r0.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new u0}},vertexShader:r0.backgroundCube_vert,fragmentShader:r0.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:r0.cube_vert,fragmentShader:r0.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:r0.equirect_vert,fragmentShader:r0.equirect_frag},distance:{uniforms:pJ([D0.common,D0.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:r0.distance_vert,fragmentShader:r0.distance_frag},shadow:{uniforms:pJ([D0.lights,D0.fog,{color:{value:new V0(0)},opacity:{value:1}}]),vertexShader:r0.shadow_vert,fragmentShader:r0.shadow_frag}};V9.physical={uniforms:pJ([V9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new u0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new u0},clearcoatNormalScale:{value:new r(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new u0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new u0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new u0},sheen:{value:0},sheenColor:{value:new V0(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new u0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new u0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new u0},transmissionSamplerSize:{value:new r},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new u0},attenuationDistance:{value:0},attenuationColor:{value:new V0(0)},specularColor:{value:new V0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new u0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new u0},anisotropyVector:{value:new r},anisotropyMap:{value:null},anisotropyMapTransform:{value:new u0}}]),vertexShader:r0.meshphysical_vert,fragmentShader:r0.meshphysical_frag};WW={r:0,b:0,g:0},lD=new d0,dG=new u0;dG.set(-1,0,0,0,1,0,0,0,1);MG=[0.125,0.215,0.35,0.446,0.526,0.582],GQ=new r8,LG=new V0,aD=new P;HW=class HW extends sJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new s8(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:`
4015
4070
 
4016
4071
  varying vec3 vWorldDirection;
4017
4072
 
@@ -4046,7 +4101,7 @@ void main() {
4046
4101
  gl_FragColor = texture2D( tEquirect, sampleUV );
4047
4102
 
4048
4103
  }
4049
- `},Z=new q8(5,5,5),W=new iJ({name:"CubemapFromEquirect",uniforms:n8($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:dJ,blending:F9});W.uniforms.tEquirect.value=Q;let K=new kJ(Z,W),H=Q.minFilter;if(Q.minFilter===H8)Q.minFilter=lJ;return new cZ(1,10,this).update(J,K),Q.minFilter=H,K.geometry.dispose(),K.material.dispose(),this}clear(J,Q=!0,$=!0,Z=!0){let W=J.getRenderTarget();for(let K=0;K<6;K++)J.setRenderTarget(this,K),J.clear(Q,$,Z);J.setRenderTarget(W)}};eD={[E$]:"LINEAR_TONE_MAPPING",[N$]:"REINHARD_TONE_MAPPING",[q$]:"CINEON_TONE_MAPPING",[D$]:"ACES_FILMIC_TONE_MAPPING",[R$]:"AGX_TONE_MAPPING",[O$]:"NEUTRAL_TONE_MAPPING",[F$]:"CUSTOM_TONE_MAPPING"};xG=new FJ,DY=new N8(1,1),gG=new y7,pG=new v7,mG=new u8,LG=[],VG=[],BG=new Float32Array(16),zG=new Float32Array(9),IG=new Float32Array(4);NY=/(\w+)(\])?(\[|\.)?/g;CG=new c0;sF={[E$]:"Linear",[N$]:"Reinhard",[q$]:"Cineon",[D$]:"ACESFilmic",[R$]:"AgX",[O$]:"Neutral",[F$]:"Custom"};QW=new P;eF=/^[ \t]*#include +<([\w\d./]+)>/gm;J1=new Map;$1=/#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;W1={[C7]:"SHADOWMAP_TYPE_PCF",[x8]:"SHADOWMAP_TYPE_VSM"};H1={[m8]:"ENVMAP_TYPE_CUBE",[K8]:"ENVMAP_TYPE_CUBE",[P7]:"ENVMAP_TYPE_CUBE_UV"};X1={[K8]:"ENVMAP_MODE_REFRACTION"};G1={[PK]:"ENVMAP_BLENDING_MULTIPLY",[TK]:"ENVMAP_BLENDING_MIX",[SK]:"ENVMAP_BLENDING_ADD"};C1=[new P(1,0,0),new P(-1,0,0),new P(0,1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1)],w1=[new P(0,-1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1),new P(0,-1,0),new P(0,-1,0)],bG=new m0,XQ=new P,qY=new P;oG=class oG extends H9{constructor(J,Q){super();let $=this,Z=null,W=1,K=null,H="local-floor",Y=1,X=null,U=null,G=null,N=null,E=null,q=null,R=typeof XRWebGLBinding<"u",O=new iG,F={},D=Q.getContextAttributes(),k=null,L=null,V=[],w=[],_=new r,A=null,M=new BJ;M.viewport=new GJ;let C=new BJ;C.viewport=new GJ;let h=[M,C],S=new nZ,b=null,l=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(s){let E0=V[s];if(E0===void 0)E0=new b7,V[s]=E0;return E0.getTargetRaySpace()},this.getControllerGrip=function(s){let E0=V[s];if(E0===void 0)E0=new b7,V[s]=E0;return E0.getGripSpace()},this.getHand=function(s){let E0=V[s];if(E0===void 0)E0=new b7,V[s]=E0;return E0.getHandSpace()};function v(s){let E0=w.indexOf(s.inputSource);if(E0===-1)return;let B0=V[E0];if(B0!==void 0)B0.update(s.inputSource,s.frame,X||K),B0.dispatchEvent({type:s.type,data:s.inputSource})}function c(){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",c),Z.removeEventListener("inputsourceschange",x);for(let s=0;s<V.length;s++){let E0=w[s];if(E0===null)continue;w[s]=null,V[s].disconnect(E0)}b=null,l=null,O.reset();for(let s in F)delete F[s];J.setRenderTarget(k),E=null,N=null,G=null,Z=null,L=null,WJ.stop(),$.isPresenting=!1,J.setPixelRatio(A),J.setSize(_.width,_.height,!1),$.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(s){if(W=s,$.isPresenting===!0)U0("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(s){if(H=s,$.isPresenting===!0)U0("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return X||K},this.setReferenceSpace=function(s){X=s},this.getBaseLayer=function(){return N!==null?N:E},this.getBinding=function(){if(G===null&&R)G=new XRWebGLBinding(Z,Q);return G},this.getFrame=function(){return q},this.getSession=function(){return Z},this.setSession=async function(s){if(Z=s,Z!==null){if(k=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",c),Z.addEventListener("inputsourceschange",x),D.xrCompatible!==!0)await Q.makeXRCompatible();if(A=J.getPixelRatio(),J.getSize(_),!(R&&("createProjectionLayer"in XRWebGLBinding.prototype))){let B0={antialias:D.antialias,alpha:!0,depth:D.depth,stencil:D.stencil,framebufferScaleFactor:W};E=new XRWebGLLayer(Z,Q,B0),Z.updateRenderState({baseLayer:E}),J.setPixelRatio(1),J.setSize(E.framebufferWidth,E.framebufferHeight,!1),L=new uJ(E.framebufferWidth,E.framebufferHeight,{format:R9,type:K9,colorSpace:J.outputColorSpace,stencilBuffer:D.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}else{let B0=null,q0=null,f0=null;if(D.depth)f0=D.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,B0=D.stencil?X8:Y8,q0=D.stencil?d8:d9;let JJ={colorFormat:Q.RGBA8,depthFormat:f0,scaleFactor:W};G=this.getBinding(),N=G.createProjectionLayer(JJ),Z.updateRenderState({layers:[N]}),J.setPixelRatio(1),J.setSize(N.textureWidth,N.textureHeight,!1),L=new uJ(N.textureWidth,N.textureHeight,{format:R9,type:K9,depthTexture:new N8(N.textureWidth,N.textureHeight,q0,void 0,void 0,void 0,void 0,void 0,void 0,B0),stencilBuffer:D.stencil,colorSpace:J.outputColorSpace,samples:D.antialias?4:0,resolveDepthBuffer:N.ignoreDepthValues===!1,resolveStencilBuffer:N.ignoreDepthValues===!1})}L.isXRRenderTarget=!0,this.setFoveation(Y),X=null,K=await Z.requestReferenceSpace(H),WJ.setContext(Z),WJ.start(),$.isPresenting=!0,$.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Z!==null)return Z.environmentBlendMode},this.getDepthTexture=function(){return O.getDepthTexture()};function x(s){for(let E0=0;E0<s.removed.length;E0++){let B0=s.removed[E0],q0=w.indexOf(B0);if(q0>=0)w[q0]=null,V[q0].disconnect(B0)}for(let E0=0;E0<s.added.length;E0++){let B0=s.added[E0],q0=w.indexOf(B0);if(q0===-1){for(let JJ=0;JJ<V.length;JJ++)if(JJ>=w.length){w.push(B0),q0=JJ;break}else if(w[JJ]===null){w[JJ]=B0,q0=JJ;break}if(q0===-1)break}let f0=V[q0];if(f0)f0.connect(B0)}}let m=new P,Q0=new P;function $0(s,E0,B0){m.setFromMatrixPosition(E0.matrixWorld),Q0.setFromMatrixPosition(B0.matrixWorld);let q0=m.distanceTo(Q0),f0=E0.projectionMatrix.elements,JJ=B0.projectionMatrix.elements,n0=f0[14]/(f0[10]-1),s0=f0[14]/(f0[10]+1),a=(f0[9]+1)/f0[5],Z0=(f0[9]-1)/f0[5],e=(f0[8]-1)/f0[0],R0=(JJ[8]+1)/JJ[0],T=n0*e,h0=n0*R0,N0=q0/(-e+R0),x0=N0*-e;if(E0.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(x0),s.translateZ(N0),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),f0[10]===-1)s.projectionMatrix.copy(E0.projectionMatrix),s.projectionMatrixInverse.copy(E0.projectionMatrixInverse);else{let H0=n0+N0,d0=s0+N0,I=T-x0,B=h0+(q0-x0),f=a*s0/d0*H0,n=Z0*s0/d0*H0;s.projectionMatrix.makePerspective(I,B,f,n,H0,d0),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function G0(s,E0){if(E0===null)s.matrixWorld.copy(s.matrix);else s.matrixWorld.multiplyMatrices(E0.matrixWorld,s.matrix);s.matrixWorldInverse.copy(s.matrixWorld).invert()}this.updateCamera=function(s){if(Z===null)return;let{near:E0,far:B0}=s;if(O.texture!==null){if(O.depthNear>0)E0=O.depthNear;if(O.depthFar>0)B0=O.depthFar}if(S.near=C.near=M.near=E0,S.far=C.far=M.far=B0,b!==S.near||l!==S.far)Z.updateRenderState({depthNear:S.near,depthFar:S.far}),b=S.near,l=S.far;S.layers.mask=s.layers.mask|6,M.layers.mask=S.layers.mask&-5,C.layers.mask=S.layers.mask&-3;let q0=s.parent,f0=S.cameras;G0(S,q0);for(let JJ=0;JJ<f0.length;JJ++)G0(f0[JJ],q0);if(f0.length===2)$0(S,M,C);else S.projectionMatrix.copy(M.projectionMatrix);w0(s,S,q0)};function w0(s,E0,B0){if(B0===null)s.matrix.copy(E0.matrixWorld);else s.matrix.copy(B0.matrixWorld),s.matrix.invert(),s.matrix.multiply(E0.matrixWorld);if(s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(E0.projectionMatrix),s.projectionMatrixInverse.copy(E0.projectionMatrixInverse),s.isPerspectiveCamera)s.fov=j8*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1}this.getCamera=function(){return S},this.getFoveation=function(){if(N===null&&E===null)return;return Y},this.setFoveation=function(s){if(Y=s,N!==null)N.fixedFoveation=s;if(E!==null&&E.fixedFoveation!==void 0)E.fixedFoveation=s},this.hasDepthSensing=function(){return O.texture!==null},this.getDepthSensingMesh=function(){return O.getMesh(S)},this.getCameraTexture=function(s){return F[s]};let K0=null;function HJ(s,E0){if(U=E0.getViewerPose(X||K),q=E0,U!==null){let B0=U.views;if(E!==null)J.setRenderTargetFramebuffer(L,E.framebuffer),J.setRenderTarget(L);let q0=!1;if(B0.length!==S.cameras.length)S.cameras.length=0,q0=!0;for(let s0=0;s0<B0.length;s0++){let a=B0[s0],Z0=null;if(E!==null)Z0=E.getViewport(a);else{let R0=G.getViewSubImage(N,a);if(Z0=R0.viewport,s0===0)J.setRenderTargetTextures(L,R0.colorTexture,R0.depthStencilTexture),J.setRenderTarget(L)}let e=h[s0];if(e===void 0)e=new BJ,e.layers.enable(s0),e.viewport=new GJ,h[s0]=e;if(e.matrix.fromArray(a.transform.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale),e.projectionMatrix.fromArray(a.projectionMatrix),e.projectionMatrixInverse.copy(e.projectionMatrix).invert(),e.viewport.set(Z0.x,Z0.y,Z0.width,Z0.height),s0===0)S.matrix.copy(e.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale);if(q0===!0)S.cameras.push(e)}let f0=Z.enabledFeatures;if(f0&&f0.includes("depth-sensing")&&Z.depthUsage=="gpu-optimized"&&R){G=$.getBinding();let s0=G.getDepthInformation(B0[0]);if(s0&&s0.isValid&&s0.texture)O.init(s0,Z.renderState)}if(f0&&f0.includes("camera-access")&&R){J.state.unbindTexture(),G=$.getBinding();for(let s0=0;s0<B0.length;s0++){let a=B0[s0].camera;if(a){let Z0=F[a];if(!Z0)Z0=new y6,F[a]=Z0;let e=G.getCameraImage(a);Z0.sourceTexture=e}}}}for(let B0=0;B0<V.length;B0++){let q0=w[B0],f0=V[B0];if(q0!==null&&f0!==void 0)f0.update(q0,E0,X||K)}if(K0)K0(s,E0);if(E0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:E0});q=null}let WJ=new hG;WJ.setAnimationLoop(HJ),this.setAnimationLoop=function(s){K0=s},this.dispose=function(){}}};a8=new sJ,v1=new m0;h1=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])});import{definePlugin as g1}from"ecspresso";import{createTransform3DPlugin as p1,createTransform3D as m1,DEFAULT_LOCAL_TRANSFORM_3D as RY}from"ecspresso/plugins/spatial/transform3D";import{createTransform3D as QR,createLocalTransform3D as $R,createWorldTransform3D as ZR,DEFAULT_LOCAL_TRANSFORM_3D as WR,DEFAULT_WORLD_TRANSFORM_3D as KR}from"ecspresso/plugins/spatial/transform3D";function kY(J,Q){let $=Q?.scale,Z=typeof $==="number"?{scale:$}:$?{scaleX:$.x,scaleY:$.y,scaleZ:$.z}:void 0;return m1(J?.x??0,J?.y??0,J?.z??0,{rotation:Q?.rotation,...Z})}function o1(J,Q,$){return{mesh:J,...kY(Q,$),visible3d:{visible:$?.visible??!0}}}function a1(J,Q,$){return{group:J,...kY(Q,$),visible3d:{visible:$?.visible??!0}}}function r1(J,Q,$){return{object3d:J,...kY(Q,$),visible3d:{visible:$?.visible??!0}}}function OY(J,Q,$,Z){J.position.set(Q.x,Q.y,Q.z),J.rotation.set(Q.rx,Q.ry,Q.rz),J.scale.set(Q.sx,Q.sy,Q.sz),J.visible=$.visible,J.updateMatrix(),J.matrixWorld.multiplyMatrices(Z.matrixWorld,J.matrix)}function t1(J){let{systemGroup:Q="renderer3d",renderSyncPriority:$=500,transform:Z,startLoop:W=!0}=J,K=new Map,H=null,Y=null,X=null,U=!(("renderer"in J)&&J.renderer!==void 0);return g1("renderer3d").withComponentTypes().withEventTypes().withResourceTypes().withLabels().withGroups().withReactiveQueryNames().install((G)=>{if(G.installPlugin(p1(Z)),U){let N=J,{background:E,width:q,height:R,antialias:O=!0,shadows:F=!1,cameraOptions:D,threeInit:k}=N,L=N.container??document.body;G.addResource("threeRenderer",async()=>{let{WebGLRenderer:V}=await Promise.resolve().then(() => (YW(),HW)),w=typeof L==="string"?document.querySelector(L):L,_={antialias:O,powerPreference:"high-performance",...k},A=new V(_);if(F)A.shadowMap.enabled=!0;let M=q??w?.clientWidth??window.innerWidth,C=R??w?.clientHeight??window.innerHeight;if(A.setSize(M,C),w)w.appendChild(A.domElement);else if(typeof L==="string")console.warn(`Renderer3D plugin: container selector "${L}" not found`);return A}),G.addResource("scene",{dependsOn:["threeRenderer"],factory:async()=>{let{Scene:V,Color:w}=await Promise.resolve().then(() => (YW(),HW)),_=new V;if(E!==void 0)_.background=new w(E);return _}}),G.addResource("camera",{dependsOn:["threeRenderer"],factory:async(V)=>{let w=V.getResource("threeRenderer"),{PerspectiveCamera:_}=await Promise.resolve().then(() => (YW(),HW)),A=D?.fov??75,M=D?.near??0.1,C=D?.far??1000,h=w.domElement.width/w.domElement.height,S=new _(A,h,M,C);if(D?.position)S.position.set(D.position.x,D.position.y,D.position.z);if(D?.lookAt)S.lookAt(D.lookAt.x,D.lookAt.y,D.lookAt.z);return S}})}else{let N=J;G.addResource("threeRenderer",N.renderer),G.addResource("scene",N.scene),G.addResource("camera",N.camera)}G.registerDispose("mesh",({value:N})=>{if(N.parent)N.parent.remove(N)}),G.registerDispose("group",({value:N})=>{if(N.parent)N.parent.remove(N)}),G.registerDispose("object3d",({value:N})=>{if(N.parent)N.parent.remove(N)}),G.registerRequired("mesh","localTransform3D",()=>({...RY})),G.registerRequired("mesh","visible3d",()=>({visible:!0})),G.registerRequired("group","localTransform3D",()=>({...RY})),G.registerRequired("group","visible3d",()=>({visible:!0})),G.registerRequired("object3d","localTransform3D",()=>({...RY})),G.registerRequired("object3d","visible3d",()=>({visible:!0})),G.addSystem("renderer3d-sync").setPriority($).inPhase("render").inGroup(Q).addQuery("meshes",{with:["mesh","worldTransform3D","visible3d"],changed:["worldTransform3D"]}).addQuery("groups",{with:["group","worldTransform3D","visible3d"],changed:["worldTransform3D"]}).addQuery("objects",{with:["object3d","worldTransform3D","visible3d"],changed:["worldTransform3D"]}).setProcess(({queries:N})=>{let E=Y;if(!E)return;for(let q of N.meshes){let{mesh:R,worldTransform3D:O,visible3d:F}=q.components;OY(R,O,F,E)}for(let q of N.groups){let{group:R,worldTransform3D:O,visible3d:F}=q.components;OY(R,O,F,E)}for(let q of N.objects){let{object3d:R,worldTransform3D:O,visible3d:F}=q.components;OY(R,O,F,E)}}),G.addSystem("renderer3d-scene-graph").setPriority(9999).inGroup(Q).setOnInitialize(async(N)=>{let E=N.getResource("scene"),q=N.getResource("threeRenderer"),R=N.getResource("camera");H=q,Y=E,X=R;function O(D,k){k.matrixAutoUpdate=!1,k.matrixWorldAutoUpdate=!1,K.set(D,k),E.add(k)}N.addReactiveQuery("renderer3d-meshes",{with:["mesh"],onEnter:(D)=>{O(D.id,D.components.mesh)},onExit:(D)=>{K.delete(D)}}),N.addReactiveQuery("renderer3d-groups",{with:["group"],onEnter:(D)=>{O(D.id,D.components.group)},onExit:(D)=>{K.delete(D)}}),N.addReactiveQuery("renderer3d-objects",{with:["object3d"],onEnter:(D)=>{O(D.id,D.components.object3d)},onExit:(D)=>{K.delete(D)}}),N.on("hierarchyChanged",({entityId:D})=>{let k=K.get(D);if(!k)return;if(k.parent!==E)E.add(k)});let F=()=>{let D=q.domElement.parentElement?.clientWidth??window.innerWidth,k=q.domElement.parentElement?.clientHeight??window.innerHeight;if(q.setSize(D,k),"aspect"in R){let L=R;L.aspect=D/k,L.updateProjectionMatrix()}};if(window.addEventListener("resize",F),W){let D=0,k=(L)=>{requestAnimationFrame(k);let V=D===0?0:(L-D)/1000;D=L,N.update(V)};requestAnimationFrame(k)}}),G.addSystem("renderer3d-render").setPriority(9999).inPhase("render").inGroup(Q).setProcess(()=>{if(H&&Y&&X)H.render(Y,X)})})}export{ZR as createWorldTransform3D,QR as createTransform3D,t1 as createRenderer3DPlugin,r1 as createObject3DComponents,o1 as createMeshComponents,$R as createLocalTransform3D,a1 as createGroupComponents,KR as DEFAULT_WORLD_TRANSFORM_3D,WR as DEFAULT_LOCAL_TRANSFORM_3D};
4104
+ `},Z=new k8(5,5,5),W=new aJ({name:"CubemapFromEquirect",uniforms:o8($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:cJ,blending:M9});W.uniforms.tEquirect.value=Q;let K=new VJ(Z,W),Y=Q.minFilter;if(Q.minFilter===E8)Q.minFilter=nJ;return new oZ(1,10,this).update(J,K),Q.minFilter=Y,K.geometry.dispose(),K.material.dispose(),this}clear(J,Q=!0,$=!0,Z=!0){let W=J.getRenderTarget();for(let K=0;K<6;K++)J.setRenderTarget(this,K),J.clear(Q,$,Z);J.setRenderTarget(W)}};XF={[F$]:"LINEAR_TONE_MAPPING",[R$]:"REINHARD_TONE_MAPPING",[O$]:"CINEON_TONE_MAPPING",[k$]:"ACES_FILMIC_TONE_MAPPING",[L$]:"AGX_TONE_MAPPING",[V$]:"NEUTRAL_TONE_MAPPING",[M$]:"CUSTOM_TONE_MAPPING"};lG=new OJ,RX=new n9(1,1),uG=new j7,cG=new y7,nG=new s8,IG=[],_G=[],AG=new Float32Array(16),CG=new Float32Array(9),wG=new Float32Array(4);DX=/(\w+)(\])?(\[|\.)?/g;SG=new u0;Q1={[F$]:"Linear",[R$]:"Reinhard",[O$]:"Cineon",[k$]:"ACESFilmic",[L$]:"AgX",[V$]:"Neutral",[M$]:"Custom"};KW=new P;X1=/^[ \t]*#include +<([\w\d./]+)>/gm;H1=new Map;G1=/#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;N1={[C7]:"SHADOWMAP_TYPE_PCF",[d8]:"SHADOWMAP_TYPE_VSM"};D1={[c8]:"ENVMAP_TYPE_CUBE",[G8]:"ENVMAP_TYPE_CUBE",[P7]:"ENVMAP_TYPE_CUBE_UV"};R1={[G8]:"ENVMAP_MODE_REFRACTION"};k1={[SK]:"ENVMAP_BLENDING_MULTIPLY",[jK]:"ENVMAP_BLENDING_MIX",[yK]:"ENVMAP_BLENDING_ADD"};b1=[new P(1,0,0),new P(-1,0,0),new P(0,1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1)],h1=[new P(0,-1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1),new P(0,-1,0),new P(0,-1,0)],pG=new d0,EQ=new P,FX=new P;J5=class J5 extends Z9{constructor(J,Q){super();let $=this,Z=null,W=1,K=null,Y="local-floor",X=1,H=null,U=null,E=null,N=null,G=null,q=null,R=typeof XRWebGLBinding<"u",O=new eG,F={},D=Q.getContextAttributes(),k=null,M=null,V=[],_=[],A=new r,C=null,L=new CJ;L.viewport=new GJ;let I=new CJ;I.viewport=new GJ;let b=[L,I],T=new aZ,g=null,u=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(s){let R0=V[s];if(R0===void 0)R0=new f7,V[s]=R0;return R0.getTargetRaySpace()},this.getControllerGrip=function(s){let R0=V[s];if(R0===void 0)R0=new f7,V[s]=R0;return R0.getGripSpace()},this.getHand=function(s){let R0=V[s];if(R0===void 0)R0=new f7,V[s]=R0;return R0.getHandSpace()};function y(s){let R0=_.indexOf(s.inputSource);if(R0===-1)return;let P0=V[R0];if(P0!==void 0)P0.update(s.inputSource,s.frame,H||K),P0.dispatchEvent({type:s.type,data:s.inputSource})}function l(){Z.removeEventListener("select",y),Z.removeEventListener("selectstart",y),Z.removeEventListener("selectend",y),Z.removeEventListener("squeeze",y),Z.removeEventListener("squeezestart",y),Z.removeEventListener("squeezeend",y),Z.removeEventListener("end",l),Z.removeEventListener("inputsourceschange",h);for(let s=0;s<V.length;s++){let R0=_[s];if(R0===null)continue;_[s]=null,V[s].disconnect(R0)}g=null,u=null,O.reset();for(let s in F)delete F[s];J.setRenderTarget(k),G=null,N=null,E=null,Z=null,M=null,t0.stop(),$.isPresenting=!1,J.setPixelRatio(C),J.setSize(A.width,A.height,!1),$.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(s){if(W=s,$.isPresenting===!0)H0("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(s){if(Y=s,$.isPresenting===!0)H0("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return H||K},this.setReferenceSpace=function(s){H=s},this.getBaseLayer=function(){return N!==null?N:G},this.getBinding=function(){if(E===null&&R)E=new XRWebGLBinding(Z,Q);return E},this.getFrame=function(){return q},this.getSession=function(){return Z},this.setSession=async function(s){if(Z=s,Z!==null){if(k=J.getRenderTarget(),Z.addEventListener("select",y),Z.addEventListener("selectstart",y),Z.addEventListener("selectend",y),Z.addEventListener("squeeze",y),Z.addEventListener("squeezestart",y),Z.addEventListener("squeezeend",y),Z.addEventListener("end",l),Z.addEventListener("inputsourceschange",h),D.xrCompatible!==!0)await Q.makeXRCompatible();if(C=J.getPixelRatio(),J.getSize(A),!(R&&("createProjectionLayer"in XRWebGLBinding.prototype))){let P0={antialias:D.antialias,alpha:!0,depth:D.depth,stencil:D.stencil,framebufferScaleFactor:W};G=new XRWebGLLayer(Z,Q,P0),Z.updateRenderState({baseLayer:G}),J.setPixelRatio(1),J.setSize(G.framebufferWidth,G.framebufferHeight,!1),M=new sJ(G.framebufferWidth,G.framebufferHeight,{format:L9,type:G9,colorSpace:J.outputColorSpace,stencilBuffer:D.stencil,resolveDepthBuffer:G.ignoreDepthValues===!1,resolveStencilBuffer:G.ignoreDepthValues===!1})}else{let P0=null,G0=null,b0=null;if(D.depth)b0=D.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,P0=D.stencil?q8:N8,G0=D.stencil?n8:c9;let YJ={colorFormat:Q.RGBA8,depthFormat:b0,scaleFactor:W};E=this.getBinding(),N=E.createProjectionLayer(YJ),Z.updateRenderState({layers:[N]}),J.setPixelRatio(1),J.setSize(N.textureWidth,N.textureHeight,!1),M=new sJ(N.textureWidth,N.textureHeight,{format:L9,type:G9,depthTexture:new n9(N.textureWidth,N.textureHeight,G0,void 0,void 0,void 0,void 0,void 0,void 0,P0),stencilBuffer:D.stencil,colorSpace:J.outputColorSpace,samples:D.antialias?4:0,resolveDepthBuffer:N.ignoreDepthValues===!1,resolveStencilBuffer:N.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(X),H=null,K=await Z.requestReferenceSpace(Y),t0.setContext(Z),t0.start(),$.isPresenting=!0,$.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Z!==null)return Z.environmentBlendMode},this.getDepthTexture=function(){return O.getDepthTexture()};function h(s){for(let R0=0;R0<s.removed.length;R0++){let P0=s.removed[R0],G0=_.indexOf(P0);if(G0>=0)_[G0]=null,V[G0].disconnect(P0)}for(let R0=0;R0<s.added.length;R0++){let P0=s.added[R0],G0=_.indexOf(P0);if(G0===-1){for(let YJ=0;YJ<V.length;YJ++)if(YJ>=_.length){_.push(P0),G0=YJ;break}else if(_[YJ]===null){_[YJ]=P0,G0=YJ;break}if(G0===-1)break}let b0=V[G0];if(b0)b0.connect(P0)}}let m=new P,a=new P;function W0(s,R0,P0){m.setFromMatrixPosition(R0.matrixWorld),a.setFromMatrixPosition(P0.matrixWorld);let G0=m.distanceTo(a),b0=R0.projectionMatrix.elements,YJ=P0.projectionMatrix.elements,p0=b0[14]/(b0[10]-1),l0=b0[14]/(b0[10]+1),t=(b0[9]+1)/b0[5],$0=(b0[9]-1)/b0[5],e=(b0[8]-1)/b0[0],L0=(YJ[8]+1)/YJ[0],M0=p0*e,x0=p0*L0,S=G0/(-e+L0),e0=S*-e;if(R0.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(e0),s.translateZ(S),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),b0[10]===-1)s.projectionMatrix.copy(R0.projectionMatrix),s.projectionMatrixInverse.copy(R0.projectionMatrixInverse);else{let y0=p0+S,g0=l0+S,K0=M0-e0,HJ=x0+(G0-e0),A0=t*l0/g0*y0,w=$0*l0/g0*y0;s.projectionMatrix.makePerspective(K0,HJ,A0,w,y0,g0),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function N0(s,R0){if(R0===null)s.matrixWorld.copy(s.matrix);else s.matrixWorld.multiplyMatrices(R0.matrixWorld,s.matrix);s.matrixWorldInverse.copy(s.matrixWorld).invert()}this.updateCamera=function(s){if(Z===null)return;let{near:R0,far:P0}=s;if(O.texture!==null){if(O.depthNear>0)R0=O.depthNear;if(O.depthFar>0)P0=O.depthFar}if(T.near=I.near=L.near=R0,T.far=I.far=L.far=P0,g!==T.near||u!==T.far)Z.updateRenderState({depthNear:T.near,depthFar:T.far}),g=T.near,u=T.far;T.layers.mask=s.layers.mask|6,L.layers.mask=T.layers.mask&-5,I.layers.mask=T.layers.mask&-3;let G0=s.parent,b0=T.cameras;N0(T,G0);for(let YJ=0;YJ<b0.length;YJ++)N0(b0[YJ],G0);if(b0.length===2)W0(T,L,I);else T.projectionMatrix.copy(L.projectionMatrix);j0(s,T,G0)};function j0(s,R0,P0){if(P0===null)s.matrix.copy(R0.matrixWorld);else s.matrix.copy(P0.matrixWorld),s.matrix.invert(),s.matrix.multiply(R0.matrixWorld);if(s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(R0.projectionMatrix),s.projectionMatrixInverse.copy(R0.projectionMatrixInverse),s.isPerspectiveCamera)s.fov=b8*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1}this.getCamera=function(){return T},this.getFoveation=function(){if(N===null&&G===null)return;return X},this.setFoveation=function(s){if(X=s,N!==null)N.fixedFoveation=s;if(G!==null&&G.fixedFoveation!==void 0)G.fixedFoveation=s},this.hasDepthSensing=function(){return O.texture!==null},this.getDepthSensingMesh=function(){return O.getMesh(T)},this.getCameraTexture=function(s){return F[s]};let B0=null;function ZJ(s,R0){if(U=R0.getViewerPose(H||K),q=R0,U!==null){let P0=U.views;if(G!==null)J.setRenderTargetFramebuffer(M,G.framebuffer),J.setRenderTarget(M);let G0=!1;if(P0.length!==T.cameras.length)T.cameras.length=0,G0=!0;for(let l0=0;l0<P0.length;l0++){let t=P0[l0],$0=null;if(G!==null)$0=G.getViewport(t);else{let L0=E.getViewSubImage(N,t);if($0=L0.viewport,l0===0)J.setRenderTargetTextures(M,L0.colorTexture,L0.depthStencilTexture),J.setRenderTarget(M)}let e=b[l0];if(e===void 0)e=new CJ,e.layers.enable(l0),e.viewport=new GJ,b[l0]=e;if(e.matrix.fromArray(t.transform.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale),e.projectionMatrix.fromArray(t.projectionMatrix),e.projectionMatrixInverse.copy(e.projectionMatrix).invert(),e.viewport.set($0.x,$0.y,$0.width,$0.height),l0===0)T.matrix.copy(e.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale);if(G0===!0)T.cameras.push(e)}let b0=Z.enabledFeatures;if(b0&&b0.includes("depth-sensing")&&Z.depthUsage=="gpu-optimized"&&R){E=$.getBinding();let l0=E.getDepthInformation(P0[0]);if(l0&&l0.isValid&&l0.texture)O.init(l0,Z.renderState)}if(b0&&b0.includes("camera-access")&&R){J.state.unbindTexture(),E=$.getBinding();for(let l0=0;l0<P0.length;l0++){let t=P0[l0].camera;if(t){let $0=F[t];if(!$0)$0=new b6,F[t]=$0;let e=E.getCameraImage(t);$0.sourceTexture=e}}}}for(let P0=0;P0<V.length;P0++){let G0=_[P0],b0=V[P0];if(G0!==null&&b0!==void 0)b0.update(G0,R0,H||K)}if(B0)B0(s,R0);if(R0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:R0});q=null}let t0=new mG;t0.setAnimationLoop(ZJ),this.setAnimationLoop=function(s){B0=s},this.dispose=function(){}}};l1=new d0,Q5=new u0;Q5.set(-1,0,0,0,1,0,0,0,1);n1=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])});import{definePlugin as i1}from"ecspresso";import{createTransform3DPlugin as o1,createTransform3D as a1,DEFAULT_LOCAL_TRANSFORM_3D as kX}from"ecspresso/plugins/spatial/transform3D";import{createTransform3D as GR,createLocalTransform3D as ER,createWorldTransform3D as NR,DEFAULT_LOCAL_TRANSFORM_3D as qR,DEFAULT_WORLD_TRANSFORM_3D as DR}from"ecspresso/plugins/spatial/transform3D";function LX(J,Q){let $=Q?.scale,Z=typeof $==="number"?{scale:$}:$?{scaleX:$.x,scaleY:$.y,scaleZ:$.z}:void 0;return a1(J?.x??0,J?.y??0,J?.z??0,{rotation:Q?.rotation,...Z})}function WR(J,Q,$){return{mesh:J,...LX(Q,$),visible3d:{visible:$?.visible??!0}}}function KR(J,Q,$){return{group:J,...LX(Q,$),visible3d:{visible:$?.visible??!0}}}function YR(J,Q,$){return{object3d:J,...LX(Q,$),visible3d:{visible:$?.visible??!0}}}function MX(J,Q,$,Z){J.position.set(Q.x,Q.y,Q.z),J.rotation.set(Q.rx,Q.ry,Q.rz),J.scale.set(Q.sx,Q.sy,Q.sz),J.visible=$.visible,J.updateMatrix(),J.matrixWorld.multiplyMatrices(Z.matrixWorld,J.matrix)}function XR(J){let{systemGroup:Q="renderer3d",renderSyncPriority:$=500,transform:Z,startLoop:W=!0}=J,K=new Map,Y=null,X=null,H=null,U=!(("renderer"in J)&&J.renderer!==void 0);return i1("renderer3d").withComponentTypes().withEventTypes().withResourceTypes().withLabels().withGroups().withReactiveQueryNames().install((E)=>{if(E.installPlugin(o1(Z)),U){let N=J,{background:G,width:q,height:R,antialias:O=!0,shadows:F=!1,cameraOptions:D,threeInit:k}=N,M=N.container??document.body;E.addResource("threeRenderer",async()=>{let{WebGLRenderer:V}=await Promise.resolve().then(() => (FQ(),DQ)),_=typeof M==="string"?document.querySelector(M):M,A={antialias:O,powerPreference:"high-performance",...k},C=new V(A);if(F)C.shadowMap.enabled=!0;let L=q??_?.clientWidth??window.innerWidth,I=R??_?.clientHeight??window.innerHeight;if(C.setSize(L,I),_)_.appendChild(C.domElement);else if(typeof M==="string")console.warn(`Renderer3D plugin: container selector "${M}" not found`);return C}),E.addResource("scene",{dependsOn:["threeRenderer"],factory:async()=>{let{Scene:V,Color:_}=await Promise.resolve().then(() => (FQ(),DQ)),A=new V;if(G!==void 0)A.background=new _(G);return A}}),E.addResource("camera",{dependsOn:["threeRenderer"],factory:async(V)=>{let _=V.getResource("threeRenderer"),A=_.domElement.width/_.domElement.height,C=D?.near??0.1,L=D?.far??1000,I;if(D?.projection==="orthographic"){let{OrthographicCamera:b}=await Promise.resolve().then(() => (FQ(),DQ)),g=(D.viewSize??10)/2,u=g*A,y=new b(-u,u,g,-g,C,L);y.zoom=D.zoom??1,y.updateProjectionMatrix(),I=y}else{let{PerspectiveCamera:b}=await Promise.resolve().then(() => (FQ(),DQ)),T=D?.fov??75;I=new b(T,A,C,L)}if(D?.position)I.position.set(D.position.x,D.position.y,D.position.z);if(D?.lookAt)I.lookAt(D.lookAt.x,D.lookAt.y,D.lookAt.z);return I}})}else{let N=J;E.addResource("threeRenderer",N.renderer),E.addResource("scene",N.scene),E.addResource("camera",N.camera)}E.registerDispose("mesh",({value:N})=>{if(N.parent)N.parent.remove(N)}),E.registerDispose("group",({value:N})=>{if(N.parent)N.parent.remove(N)}),E.registerDispose("object3d",({value:N})=>{if(N.parent)N.parent.remove(N)}),E.registerRequired("mesh","localTransform3D",()=>({...kX})),E.registerRequired("mesh","visible3d",()=>({visible:!0})),E.registerRequired("group","localTransform3D",()=>({...kX})),E.registerRequired("group","visible3d",()=>({visible:!0})),E.registerRequired("object3d","localTransform3D",()=>({...kX})),E.registerRequired("object3d","visible3d",()=>({visible:!0})),E.addSystem("renderer3d-sync").setPriority($).inPhase("render").inGroup(Q).addQuery("meshes",{with:["mesh","worldTransform3D","visible3d"],changed:["worldTransform3D"]}).addQuery("groups",{with:["group","worldTransform3D","visible3d"],changed:["worldTransform3D"]}).addQuery("objects",{with:["object3d","worldTransform3D","visible3d"],changed:["worldTransform3D"]}).setProcess(({queries:N})=>{let G=X;if(!G)return;for(let q of N.meshes){let{mesh:R,worldTransform3D:O,visible3d:F}=q.components;MX(R,O,F,G)}for(let q of N.groups){let{group:R,worldTransform3D:O,visible3d:F}=q.components;MX(R,O,F,G)}for(let q of N.objects){let{object3d:R,worldTransform3D:O,visible3d:F}=q.components;MX(R,O,F,G)}}),E.addSystem("renderer3d-scene-graph").setPriority(9999).inGroup(Q).setOnInitialize(async(N)=>{let G=N.getResource("scene"),q=N.getResource("threeRenderer"),R=N.getResource("camera");Y=q,X=G,H=R;function O(D,k){k.matrixAutoUpdate=!1,k.matrixWorldAutoUpdate=!1,K.set(D,k),G.add(k)}N.addReactiveQuery("renderer3d-meshes",{with:["mesh"],onEnter:(D)=>{O(D.id,D.components.mesh)},onExit:(D)=>{K.delete(D)}}),N.addReactiveQuery("renderer3d-groups",{with:["group"],onEnter:(D)=>{O(D.id,D.components.group)},onExit:(D)=>{K.delete(D)}}),N.addReactiveQuery("renderer3d-objects",{with:["object3d"],onEnter:(D)=>{O(D.id,D.components.object3d)},onExit:(D)=>{K.delete(D)}}),N.on("hierarchyChanged",({entityId:D})=>{let k=K.get(D);if(!k)return;if(k.parent!==G)G.add(k)});let F=()=>{let D=q.domElement.parentElement?.clientWidth??window.innerWidth,k=q.domElement.parentElement?.clientHeight??window.innerHeight;if(q.setSize(D,k),R.isPerspectiveCamera){let M=R;M.aspect=D/k,M.updateProjectionMatrix()}else if(R.isOrthographicCamera){let M=R,V=(M.top-M.bottom)/2,_=V*(D/k);M.left=-_,M.right=_,M.top=V,M.bottom=-V,M.updateProjectionMatrix()}};if(window.addEventListener("resize",F),W){let D=0,k=(M)=>{requestAnimationFrame(k);let V=D===0?0:(M-D)/1000;D=M,N.update(V)};requestAnimationFrame(k)}}),E.addSystem("renderer3d-render").setPriority(9999).inPhase("render").inGroup(Q).setProcess(()=>{if(Y&&X&&H)Y.render(X,H)})})}export{NR as createWorldTransform3D,GR as createTransform3D,XR as createRenderer3DPlugin,YR as createObject3DComponents,WR as createMeshComponents,ER as createLocalTransform3D,KR as createGroupComponents,DR as DEFAULT_WORLD_TRANSFORM_3D,qR as DEFAULT_LOCAL_TRANSFORM_3D};
4050
4105
 
4051
- //# debugId=F6B6A76D1417CDF864756E2164756E21
4106
+ //# debugId=542261026831CFD164756E2164756E21
4052
4107
  //# sourceMappingURL=renderer3D.js.map