ecspresso 0.14.2 → 0.14.4

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 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() {
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 E6(...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 H6(J,Q,$){return(1-$)*J+$*Q}function M5(J,Q,$,Z){return H6(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 E6("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,K)},toWorkingColorSpace:function(W,K){return E6("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 T,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new T;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 T,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new T,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 P6{constructor(J,Q=0.00025){this.isFogExp2=!0,this.name="",this.color=new V0(J),this.density=Q}clone(){return new P6(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class T6{constructor(J,Q=1,$=1000){this.isFog=!0,this.name="",this.color=new V0(J),this.near=Q,this.far=$}clone(){return new T6(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 T,Q=new T,$=new T){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 T(1/0,1/0,1/0),Q=new T(-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(o7),BQ.subVectors(this.max,o7),X7.subVectors(J.a,o7),H7.subVectors(J.b,o7),U7.subVectors(J.c,o7),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 Y6(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 Y6(J)}}class wJ{constructor(J=new T,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;a7.subVectors(J,this.center);let Q=a7.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(a7,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(a7.copy(J.center).add(_W)),this.expandByPoint(a7.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)e7.x=K*D7.x-W*D7.y,e7.y=W*D7.x+K*D7.y;else e7.copy(D7);J.copy(Q),J.x+=e7.x,J.y+=e7.y,J.applyMatrix4(KG)}class R8{constructor(J=new T,Q=new T(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 T;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 T),E.normal.dot(Z.direction)>0)E.normal.multiplyScalar(-1)}let G={a:X,b:H,c:U,normal:new T,materialIndex:0};uJ.getNormal(jQ,yQ,vQ,G.normal),E.face=G,E.barycoord=N}return E}class f6{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 f6(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 v6;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 T(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],L=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,L).normalize(),Z[5].setComponents(H-X,G-N,F-O,V-L).normalize();else if(Z[4].setComponents(H-X,G-N,F-O,V-L).normalize(),Q===2000)Z[5].setComponents(H+X,G+N,F+O,V+L).normalize();else if(Q===2001)Z[5].setComponents(X,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();_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 b6{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 b6}}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 T;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 T);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 T,Z=[],W=[],K=[],Y=new T,X=new d0;for(let G=0;G<=J;G++){let q=G/J;Z[G]=this.getTangentAt(q,new T)}W[0]=new T,K[0]=new T;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 U6(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 G6(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 N6(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))D6(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(D6($),$=Q=$.prev,$===$.next)break;Z=!0}else $=$.next;while(Z||$!==Q);return Q}function N6(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),D6(J),J=U.next,X=U.next;continue}if(J=U,J===X){if(!Y)N6(h8(J),Q,$,Z,W,K,1);else if(Y===1)J=OE(h8(J),Q),N6(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&&X6(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),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!==Y&&X6(X,E,H,N,U,G,L.x,L.y)&&kJ(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!==Y&&X6(X,E,H,N,U,G,V.x,V.y)&&kJ(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!==Y&&X6(X,E,H,N,U,G,L.x,L.y)&&kJ(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!==Y&&X6(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)&&q6(Z,W)&&q6(W,Z))Q.push(Z.i,$.i,W.i),D6($),D6($.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),N6(Y,Q,$,Z,W,K,0),N6(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(q6($,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 X6(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)&&(q6(J,Q)&&q6(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 q6(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 D6(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,L=N-E;D.evaluate(K),O=D.resultBuffer.slice(k,L)}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 L=q-G*2;for(let V=0;V<L;++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 YQ(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 XQ;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 HQ{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 UQ{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let J=0;J<9;J++)this.coefficients.push(new T)}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 F6{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 EQ{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],L=k[R],V=k[q];if(k[q]=L,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],L=D[q];D[E]=k,D[N]=L,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 T,Q=new T){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,L=F.length;k<L;k++){let V=F[k],_=new l9;_.curves=V.curves,D.push(_)}return D}function $(F,D){let k=D.length,L=!1;for(let V=k-1,_=0;_<k;V=_++){let C=D[V],A=D[_],M=A.x-C.x,z=A.y-C.y;if(Math.abs(z)>Number.EPSILON){if(z<0)C=D[_],M=-M,A=D[V],z=-z;if(F.y<C.y||F.y>A.y)continue;if(F.y===C.y){if(F.x===C.x)return!0}else{let y=z*(F.x-C.x)-M*(F.y-C.y);if(y===0)return!0;if(y<0)continue;L=!L}}else{if(F.y!==C.y)continue;if(A.x<=F.x&&F.x<=C.x||C.x<=F.x&&F.x<=A.x)return!0}}return L}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,L=N.length;k<L;k++)E[k]=[];for(let k=0,L=N.length;k<L;k++){let V=G[k];for(let _=0;_<V.length;_++){let C=V[_],A=!0;for(let M=0;M<N.length;M++)if($(C.p,N[M].p)){if(k!==M)D++;if(A)A=!1,E[M].push(C);else F=!0}if(A)E[k].push(C)}}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,L=O.length;k<L;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,R6=303,O6=304,P7=306,vK=1000,k6=1001,fK=1002,u9=1003,bK=1004,sH=1004,T7=1005,iH=1005,nJ=1006,M6=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,L6=33776,V6=33777,B6=33778,z6=33779,w$=35840,P$=35841,T$=35842,S$=35843,j$=36196,y$=37492,v$=37496,f$=37488,b$=37489,I6=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,_6=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,A6=515,oK=516,aK=517,C6=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,T,EW,jX,u0,NW,yX,vX,$J,Q7,v5=0,f5=0,DW,OJ,GJ,w6,sJ,j7,JY,y7,QY,d0,$7,q9,b5,h5,e9,kQ,eJ,fX,bX,H9,x5=0,hX,Z7,f9,MQ,i7,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,o7,BQ,zQ,z8,m9,AJ,IQ,u5=0,UJ,ZY,WY,KY,YY,S6,XY,j6,HY,z0,c5,a7,_W,n5=0,Y9,AW,G7,J9,r7,SJ,c0,dJ,s5=0,yJ,y6,E7,t7,N7,q7,D7,e7,KG,_Q,J6,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,Q6,oX,aX,o5,rX,xQ,jW,tX,yW,qZ,v6,$9,eX,a5,U8,F7,JH,gQ,QH,r5,$6,Z6,DZ,vW,t5,e5,_8,JE,pQ,I9,_9,iJ,ZE,$H,WE,mQ,A8,W6,ZH,KE,bW,gJ,dQ,FZ,fJ,X$,H$,WH,K6,lQ,hW,KH,P9,YH,XH,E9,RZ,h6,HH,oW,cQ,nQ,OZ,kZ,UY,GY,h7,EY,NY,s8,qY,DY,n9,MZ,x6,k8,g6,p6,x7,g7,s9,m6,sQ,iQ,xW,oQ,LZ,p7,VZ,GH,EH,gW,pW,mW,BZ,d6,zZ,l6,IZ,u6,c6,n6,U$,_Z,_7,l9,s6,SE,i6,o6,m7,i8,a6,r6,d7,t6,e6,JQ,QQ,AZ,OH,CZ,OY,fE=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
3
  }`,bE=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
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:`
5
+ }`,aJ,$Q,ZQ,wZ,PZ,TZ,SZ,jZ,WQ,KQ,yZ,vZ,fZ,YQ,bZ,hZ,i9,XQ,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,GQ,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:H6,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}};T=class T{static{T.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 T,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],L=Z[7],V=Z[2],_=Z[5],C=Z[8];return W[0]=K*R+Y*D+X*V,W[3]=K*O+Y*k+X*_,W[6]=K*F+Y*L+X*C,W[1]=H*R+U*D+E*V,W[4]=H*O+U*k+E*_,W[7]=H*F+U*L+E*C,W[2]=N*R+G*D+q*V,W[5]=N*O+G*k+q*_,W[8]=N*F+G*L+q*C,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 T;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,L=(G+1)/2,V=(F+1)/2,_=(U+N)/4,C=(E+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=C/$;else if(L>V)if(L<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(L),$=_/Z,W=A/Z;else if(V<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(V),$=C/W,Z=A/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}};w6=class w6 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 w6{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],L=$[11],V=$[15],_=Z[0],C=Z[4],A=Z[8],M=Z[12],z=Z[1],y=Z[5],P=Z[9],x=Z[13],u=Z[2],v=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*z+X*u+H*m,W[4]=K*C+Y*y+X*v+H*a,W[8]=K*A+Y*P+X*l+H*W0,W[12]=K*M+Y*x+X*h+H*N0,W[1]=U*_+E*z+N*u+G*m,W[5]=U*C+E*y+N*v+G*a,W[9]=U*A+E*P+N*l+G*W0,W[13]=U*M+E*x+N*h+G*N0,W[2]=q*_+R*z+O*u+F*m,W[6]=q*C+R*y+O*v+F*a,W[10]=q*A+R*P+O*l+F*W0,W[14]=q*M+R*x+O*h+F*N0,W[3]=D*_+k*z+L*u+V*m,W[7]=D*C+k*y+L*v+V*a,W[11]=D*A+k*P+L*l+V*W0,W[15]=D*M+k*x+L*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,L=Y*N-X*E,V=K*G-H*U,_=K*N-X*U,C=K*E-Y*U;return Q*(R*D-O*k+F*L)-$*(q*D-O*V+F*_)+Z*(q*k-R*V+F*C)-W*(q*L-R*_+O*C)}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,L=Q*H-W*K,V=$*X-Z*Y,_=$*H-W*Y,C=Z*H-W*X,A=U*R-E*q,M=U*O-N*q,z=U*F-G*q,y=E*O-N*R,P=E*F-G*R,x=N*F-G*O,u=D*x-k*P+L*y+V*z-_*M+C*A;if(u===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let v=1/u;return J[0]=(Y*x-X*P+H*y)*v,J[1]=(Z*P-$*x-W*y)*v,J[2]=(R*C-O*_+F*V)*v,J[3]=(N*_-E*C-G*V)*v,J[4]=(X*z-K*x-H*M)*v,J[5]=(Q*x-Z*z+W*M)*v,J[6]=(O*L-q*C-F*k)*v,J[7]=(U*C-N*L+G*k)*v,J[8]=(K*P-Y*z+H*A)*v,J[9]=($*z-Q*P-W*A)*v,J[10]=(q*_-R*L+F*D)*v,J[11]=(E*L-U*_-G*D)*v,J[12]=(Y*M-K*y-X*A)*v,J[13]=(Q*y-$*M+Z*A)*v,J[14]=(R*k-q*V-O*D)*v,J[15]=(U*V-E*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,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,L=X*E,V=$.x,_=$.y,C=$.z;return Z[0]=(1-(R+F))*V,Z[1]=(G+L)*V,Z[2]=(q-k)*V,Z[3]=0,Z[4]=(G-L)*_,Z[5]=(1-(N+F))*_,Z[6]=(O+D)*_,Z[7]=0,Z[8]=(q+k)*C,Z[9]=(O-D)*C,Z[10]=(1-(N+R))*C,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 T,q9=new d0,b5=new T(0,0,0),h5=new T(1,1,1),e9=new T,kQ=new T,eJ=new T,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 T,Z7=new vJ,f9=new d0,MQ=new T,i7=new T,g5=new T,p5=new vJ,xX=new T(1,0,0),gX=new T(0,1,0),pX=new T(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 T,Q=new H9,$=new vJ,Z=new T(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),i7.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)f9.lookAt(i7,MQ,this.up);else f9.lookAt(MQ,i7,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(i7,J,g5),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(i7,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 T(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 $=H6(J8.h,LQ.h,Q),Z=H6(J8.s,LQ.s,Q),W=H6(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 T,b9=new T,OW=new T,h9=new T,K7=new T,Y7=new T,dX=new T,kW=new T,MW=new T,LW=new T,VW=new GJ,BW=new GJ,zW=new GJ;x9=[new T,new T,new T,new T,new T,new T,new T,new T],F9=new T,VQ=new jJ,X7=new T,H7=new T,U7=new T,Q8=new T,$8=new T,B8=new T,o7=new T,BQ=new T,zQ=new T,z8=new T;m9=l5();AJ=new T,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,$)}};S6=class S6 extends UJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}};XY=class XY extends UJ{constructor(J,Q,$){super(new Int32Array(J),Q,$)}};j6=class j6 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=Y6(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=Y6(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=Y6(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=Y6(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,a7=new T,_W=new T;Y9=new d0,AW=new KJ,G7=new T,J9=new jJ,r7=new jJ,SJ=new T;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))?j6:S6)(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 T(-1/0,-1/0,-1/0),new T(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 T,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(r7.setFromBufferAttribute(Y),this.morphTargetsRelative)SJ.addVectors(J9.min,r7.min),J9.expandByPoint(SJ),SJ.addVectors(J9.max,r7.max),J9.expandByPoint(SJ);else J9.expandByPoint(r7.min),J9.expandByPoint(r7.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 A=0;A<$.count;A++)Y[A]=new T,X[A]=new T;let H=new T,U=new T,E=new T,N=new r,G=new r,q=new r,R=new T,O=new T;function F(A,M,z){H.fromBufferAttribute($,A),U.fromBufferAttribute($,M),E.fromBufferAttribute($,z),N.fromBufferAttribute(W,A),G.fromBufferAttribute(W,M),q.fromBufferAttribute(W,z),U.sub(H),E.sub(H),G.sub(N),q.sub(N);let y=1/(G.x*q.y-q.x*G.y);if(!isFinite(y))return;R.copy(U).multiplyScalar(q.y).addScaledVector(E,-G.y).multiplyScalar(y),O.copy(E).multiplyScalar(G.x).addScaledVector(U,-q.x).multiplyScalar(y),Y[A].add(R),Y[M].add(R),Y[z].add(R),X[A].add(O),X[M].add(O),X[z].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 z=D[A],y=z.start,P=z.count;for(let x=y,u=y+P;x<u;x+=3)F(J.getX(x+0),J.getX(x+1),J.getX(x+2))}let k=new T,L=new T,V=new T,_=new T;function C(A){V.fromBufferAttribute(Z,A),_.copy(V);let M=Y[A];k.copy(M),k.sub(V.multiplyScalar(V.dot(M))).normalize(),L.crossVectors(_,M);let y=L.dot(X[A])<0?-1:1;K.setXYZW(A,k.x,k.y,k.z,y)}for(let A=0,M=D.length;A<M;++A){let z=D[A],y=z.start,P=z.count;for(let x=y,u=y+P;x<u;x+=3)C(J.getX(x+0)),C(J.getX(x+1)),C(J.getX(x+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 T,W=new T,K=new T,Y=new T,X=new T,H=new T,U=new T,E=new T;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 T;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++}};y6=class y6 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}};t7=new T,N7=new T,q7=new T,D7=new r,e7=new r,KG=new d0,_Q=new T,J6=new T,AQ=new T,lX=new r,CW=new r,uX=new r;EZ=class EZ extends KJ{constructor(J=new y6){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(J6.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,J6,AQ,!1,t7);if(Y===null){if(CQ(J6.set(-0.5,0.5,0),q7,K,N7,Z,W),CW.set(0,1),Y=J.ray.intersectTriangle(_Q,AQ,J6,!1,t7),Y===null)return}let X=J.ray.origin.distanceTo(t7);if(X<J.near||X>J.far)return;Q.push({distance:X,point:t7.clone(),uv:uJ.getInterpolation(t7,_Q,J6,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 T,cX=new T;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 T,wW=new T,PQ=new T,Z8=new T,PW=new T,TQ=new T,TW=new T;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 T,jQ=new T,yQ=new T,vQ=new T,SW=new T,fQ=new T,iX=new T,bQ=new T;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 L=D,V=k;L<V;L+=3){let _=Y.getX(L),C=Y.getX(L+1),A=Y.getX(L+2);if(Z=hQ(this,F,J,$,H,U,E,_,C,A),Z)Z.faceIndex=Math.floor(L/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),L=Y.getX(O+2);if(Z=hQ(this,K,J,$,H,U,E,D,k,L),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 L=D,V=k;L<V;L+=3){let _=L,C=L+1,A=L+2;if(Z=hQ(this,F,J,$,H,U,E,_,C,A),Z)Z.faceIndex=Math.floor(L/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,L=O+2;if(Z=hQ(this,K,J,$,H,U,E,D,k,L),Z)Z.faceIndex=Math.floor(O/3),Q.push(Z)}}}};Q6=new GJ,oX=new GJ,aX=new GJ,o5=new GJ,rX=new d0,xQ=new T,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)Q6.copy(Q),Q.set(0,0,0,0);else Q6.set(...Q,1),Q.set(0,0,0);Q6.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(Q6).applyMatrix4(rX),K)}}if(Q.isVector4)Q.w=Q6.w;return Q.applyMatrix4(this.bindMatrixInverse)}};v6=class v6 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,$6=new VJ,Z6=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),Z6.copy(J.boundingSphere).applyMatrix4(F7),this.boundingSphere.union(Z6)}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($6.geometry=this.geometry,$6.material=this.material,$6.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Z6.copy(this.boundingSphere),Z6.applyMatrix4($),J.ray.intersectsSphere(Z6)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,F7),JH.multiplyMatrices($,F7),$6.matrixWorld=JH,$6.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 T,t5=new T,e5=new u0;_8=new wJ,JE=new r(0.5,0.5),pQ=new T;I9=new d0,_9=new O8;iJ=new d0,ZE=new V0(1,1,1),$H=new O8,WE=new b6,mQ=new jJ,A8=new wJ,W6=new T,ZH=new T,KE=new T,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(W6.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);W6.fromBufferAttribute(Y,E),X=Math.max(X,W.center.distanceToSquared(W6))}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(),W6.setFromMatrixPosition($.matrixWorld).applyMatrix4(iJ),ZH.set(0,0,-1).transformDirection($.matrixWorld).transformDirection(iJ);for(let L=0,V=H.length;L<V;L++)if(H[L].visible&&H[L].active){let _=H[L].geometryIndex;this.getMatrixAt(L,iJ),this.getBoundingSphereAt(_,A8).applyMatrix4(iJ);let C=!1;if(G)C=!O.intersectsSphere(A8,$);if(!C){let A=N[_],M=KE.subVectors(A8.center,W6).dot(ZH);bW.push(A.start,A.count,M,L)}}let D=bW.list,k=this.customSort;if(k===null)D.sort(W.transparent?$E:QE);else k.call(this,D,$);for(let L=0,V=D.length;L<V;L++){let _=D[L];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 L=H[D].geometryIndex,V=!1;if(G)this.getMatrixAt(D,iJ),this.getBoundingSphereAt(L,A8).applyMatrix4(iJ),V=!O.intersectsSphere(A8,$);if(!V){let _=N[L];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 T,H$=new T,WH=new d0,K6=new R8,lQ=new wJ,hW=new T,KH=new T;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(),K6.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,K6,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,K6,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,K6,X,R,R+1,R);if(F)Q.push(F)}if(this.isLineLoop){let R=uQ(this,J,K6,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 T,XH=new T;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"}};h6=class h6 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 T;OZ=class OZ extends KJ{constructor(J=new c0,Q=new h6){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}};x6=class x6 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,L,V,_,C,A,M){let z=L/C,y=V/A,P=L/2,x=V/2,u=_/2,v=C+1,l=A+1,h=0,m=0,a=new T;for(let W0=0;W0<l;W0++){let N0=W0*y-x;for(let j0=0;j0<v;j0++){let B0=j0*z-P;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/C),E.push(1-W0/A),h+=1}}for(let W0=0;W0<A;W0++)for(let N0=0;N0<C;N0++){let j0=N+N0+v*W0,B0=N+N0+v*(W0+1),ZJ=N+(N0+1)+v*(W0+1),t0=N+(N0+1)+v*W0;X.push(j0,B0,t0),X.push(B0,ZJ,t0),m+=6}Y.addGroup(G,m,M),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)}};g6=class g6 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 T,F=new T;for(let D=0;D<=q;D++){let k=0,L=0,V=0,_=0;if(D<=$){let M=D/$,z=M*Math.PI/2;L=-U-J*Math.cos(z),V=J*Math.sin(z),_=-J*Math.cos(z),k=M*E}else if(D<=$+W){let M=(D-$)/W;L=-U+M*Q,V=J,_=0,k=E+M*N}else{let M=(D-$-W)/$,z=M*Math.PI/2;L=U+J*Math.sin(z),V=J*Math.cos(z),_=J*Math.sin(z),k=E+N+M*E}let C=Math.max(0,Math.min(1,k/G)),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 z=M/Z,y=z*Math.PI*2,P=Math.sin(y),x=Math.cos(y);F.x=-V*x,F.y=L,F.z=V*P,Y.push(F.x,F.y,F.z),O.set(-V*x,_,V*P),O.normalize(),X.push(O.x,O.y,O.z),H.push(z+A,C)}if(D>0){let M=(D-1)*R;for(let z=0;z<Z;z++){let y=M+z,P=M+z+1,x=D*R+z,u=D*R+z+1;K.push(y,P,x),K.push(P,u,x)}}}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 g6(J.radius,J.height,J.capSegments,J.radialSegments,J.heightSegments)}};p6=class p6 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 T,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 p6(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 L=new T,V=new T,_=0,C=(Q-J)/$;for(let A=0;A<=W;A++){let M=[],z=A/W,y=z*(Q-J)+J;for(let P=0;P<=Z;P++){let x=P/Z,u=x*X+Y,v=Math.sin(u),l=Math.cos(u);V.x=y*v,V.y=-z*$+O,V.z=y*l,E.push(V.x,V.y,V.z),L.set(v,C,l).normalize(),N.push(L.x,L.y,L.z),G.push(x,1-z),M.push(q++)}R.push(M)}for(let A=0;A<Z;A++)for(let M=0;M<W;M++){let z=R[M][A],y=R[M+1][A],P=R[M+1][A+1],x=R[M][A+1];if(J>0||M!==0)U.push(z,y,x),_+=3;if(Q>0||M!==W-1)U.push(y,P,x),_+=3}H.addGroup(F,_,0),F+=_}function k(L){let V=q,_=new r,C=new T,A=0,M=L===!0?J:Q,z=L===!0?1:-1;for(let P=1;P<=Z;P++)E.push(0,O*z,0),N.push(0,z,0),G.push(0.5,0.5),q++;let y=q;for(let P=0;P<=Z;P++){let u=P/Z*X+Y,v=Math.cos(u),l=Math.sin(u);C.x=M*l,C.y=O*z,C.z=M*v,E.push(C.x,C.y,C.z),N.push(0,z,0),_.x=v*0.5+0.5,_.y=l*0.5*z+0.5,G.push(_.x,_.y),q++}for(let P=0;P<Z;P++){let x=V+P,u=y+P;if(L===!0)U.push(u,u+1,x);else U.push(u+1,u,x);A+=3}H.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 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 T,L=new T,V=new T;for(let _=0;_<Q.length;_+=3)G(Q[_+0],k),G(Q[_+1],L),G(Q[_+2],V),X(k,L,V,D)}function X(D,k,L,V){let _=V+1,C=[];for(let A=0;A<=_;A++){C[A]=[];let M=D.clone().lerp(L,A/_),z=k.clone().lerp(L,A/_),y=_-A;for(let P=0;P<=y;P++)if(P===0&&A===_)C[A][P]=M;else C[A][P]=M.clone().lerp(z,P/y)}for(let A=0;A<_;A++)for(let M=0;M<2*(_-A)-1;M++){let z=Math.floor(M/2);if(M%2===0)N(C[A][z+1]),N(C[A+1][z]),N(C[A][z]);else N(C[A][z+1]),N(C[A+1][z+1]),N(C[A+1][z])}}function H(D){let k=new T;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 T;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(),E()}function E(){for(let D=0;D<K.length;D+=6){let k=K[D+0],L=K[D+2],V=K[D+4],_=Math.max(k,L,V),C=Math.min(k,L,V);if(_>0.9&&C<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 G(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 T,k=new T,L=new T,V=new T,_=new r,C=new r,A=new r;for(let M=0,z=0;M<W.length;M+=9,z+=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]),_.set(K[z+0],K[z+1]),C.set(K[z+2],K[z+3]),A.set(K[z+4],K[z+5]),V.copy(D).add(k).add(L).divideScalar(3);let y=O(V);R(_,z+0,D,y),R(C,z+2,k,y),R(A,z+4,L,y)}}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 s9(J.vertices,J.indices,J.radius,J.detail)}};m6=class m6 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 m6(J.radius,J.detail)}};sQ=new T,iQ=new T,xW=new T,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,L=E[D],V=E[k],_=oQ[U[D]],C=oQ[U[k]],A=`${L}_${V}`,M=`${V}_${L}`;if(M in N&&N[M]){if(xW.dot(N[M].normal)<=W)G.push(_.x,_.y,_.z),G.push(C.x,C.y,C.z);N[M]=null}else if(!(A in N))N[A]={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 T,EH=new T,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 T){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 T().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}};d6=class d6 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(G6(J,Z.x,W.x,K.x,Y.x),G6(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 T,Q=new T,$=new T,Z=new T){super();this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new T){let $=Q,Z=this.v0,W=this.v1,K=this.v2,Y=this.v3;return $.set(G6(J,Z.x,W.x,K.x,Y.x),G6(J,Z.y,W.y,K.y,Y.y),G6(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}};l6=class l6 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 T,Q=new T){super();this.isLineCurve3=!0,this.type="LineCurve3",this.v1=J,this.v2=Q}getPoint(J,Q=new T){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 T){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}};u6=class u6 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(U6(J,Z.x,W.x,K.x),U6(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}};c6=class c6 extends W9{constructor(J=new T,Q=new T,$=new T){super();this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new T){let $=Q,Z=this.v0,W=this.v1,K=this.v2;return $.set(U6(J,Z.x,W.x,K.x),U6(J,Z.y,W.y,K.y),U6(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}};n6=class n6 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:d6,CubicBezierCurve3:zZ,EllipseCurve:p7,LineCurve:l6,LineCurve3:IZ,QuadraticBezierCurve:u6,QuadraticBezierCurve3:c6,SplineCurve:n6});_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 l6(this.currentPoint.clone(),new r(J,Q));return this.curves.push($),this.currentPoint.set(J,Q),this}quadraticCurveTo(J,Q,$,Z){let W=new u6(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 d6(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 n6(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}};s6=class s6 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,L=!1,V,_,C,A;if(F){k=F.getSpacedPoints(U),L=!0,N=!1;let t=F.isCatmullRomCurve3?F.closed:!1;V=F.computeFrenetFrames(U,t),_=new T,C=new T,A=new T}if(!N)O=0,G=0,q=0,R=0;let M=Y.extractPoints(H),z=M.shape,y=M.holes;if(!X9.isClockWise(z)){z=z.reverse();for(let t=0,$0=y.length;t<$0;t++){let e=y[t];if(X9.isClockWise(e))y[t]=e.reverse()}}function x(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}}x(z),y.forEach(x);let u=y.length,v=z;for(let t=0;t<u;t++){let $0=y[t];z=z.concat($0)}function l(t,$0,e){if(!$0)T0("ExtrudeGeometry: vec does not exist");return t.clone().addScaledVector($0,e)}let h=z.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,b=$0.y+S/A0,i=e.x-g0/w,J0=e.y+y0/w,Z0=((i-B)*g0-(J0-b)*y0)/(S*g0-e0*y0);L0=B+S*Z0-t.x,M0=b+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=v.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(v[t],v[e],v[L0])}let W0=[],N0,j0=a.concat();for(let t=0,$0=u;t<$0;t++){let e=y[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(v,y);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=v.length;S<e0;S++){let y0=l(v[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=y[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(z[t],j0[t],t0):z[t];if(!L)G0($0.x,$0.y,0);else C.copy(V.normals[0]).multiplyScalar($0.x),_.copy(V.binormals[0]).multiplyScalar($0.y),A.copy(k[0]).add(C).add(_),G0(A.x,A.y,A.z)}for(let t=1;t<=U;t++)for(let $0=0;$0<h;$0++){let e=N?l(z[$0],j0[$0],t0):z[$0];if(!L)G0(e.x,e.y,E/U*t);else C.copy(V.normals[t]).multiplyScalar(e.x),_.copy(V.binormals[t]).multiplyScalar(e.y),A.copy(k[t]).add(C).add(_),G0(A.x,A.y,A.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=v.length;M0<x0;M0++){let S=l(v[M0],a[M0],L0);G0(S.x,S.y,E+e)}for(let M0=0,x0=y.length;M0<x0;M0++){let S=y[M0];N0=W0[M0];for(let e0=0,y0=S.length;e0<y0;e0++){let g0=l(S[e0],N0[e0],L0);if(!L)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(v,$0),$0+=v.length;for(let e=0,L0=y.length;e<L0;e++){let M0=y[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 s6($,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)]}};i6=class i6 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 i6(J.radius,J.detail)}};o6=class o6 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 T,N=new r,G=new T,q=new T,R=new T,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,L=Math.sin(k),V=Math.cos(k);for(let _=0;_<=J.length-1;_++){E.x=J[_].x*L,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 C=X[3*_+0]*L,A=X[3*_+1],M=X[3*_+0]*V;H.push(C,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,_=L+J.length,C=L+J.length+1,A=L+1;W.push(V,_,A),W.push(C,A,_)}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 o6(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 L=k*E-W;q.push(L,-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,L=D+H*(F+1),V=D+1+H*(F+1),_=D+1+H*F;G.push(k,L,_),G.push(L,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)}};a6=class a6 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 T,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,L=D+$+1,V=D+$+2,_=D+1;Y.push(k,L,_),Y.push(L,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 a6(J.innerRadius,J.outerRadius,J.thetaSegments,J.phiSegments,J.thetaStart,J.thetaLength)}};r6=class r6 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,L=D[1]+E,V=D[2]+E;$.push(k,L,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 r6($,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 T,N=new T,G=[],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===$&&X===Math.PI)L=-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(_+L,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],L=U[F][D],V=U[F+1][D],_=U[F+1][D+1];if(F!==0||K>0)G.push(k,L,_);if(F!==$-1||X<Math.PI)G.push(L,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)}};t6=class t6 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 t6(J.radius,J.detail)}};e6=class e6 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 T,G=new T,q=new T;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,L=(Z+1)*R+O;X.push(F,D,L),X.push(D,k,L)}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 e6(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}};JQ=class JQ 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 T,N=new T,G=new T,q=new T,R=new T,O=new T,F=new T;for(let k=0;k<=$;++k){let L=k/$*W*Math.PI*2;D(L,W,K,J,G),D(L+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,C=-Q*Math.cos(_),A=Q*Math.sin(_);E.x=G.x+(C*F.x+A*R.x),E.y=G.y+(C*F.y+A*R.y),E.z=G.z+(C*F.z+A*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 L=1;L<=Z;L++){let V=(Z+1)*(k-1)+(L-1),_=(Z+1)*k+(L-1),C=(Z+1)*k+L,A=(Z+1)*(k-1)+L;Y.push(V,_,A),Y.push(_,C,A)}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,L,V,_,C){let A=Math.cos(k),M=Math.sin(k),z=V/L*k,y=Math.cos(z);C.x=_*(2+y)*0.5*A,C.y=_*(2+y)*M*0.5,C.z=_*Math.sin(z)*0.5}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new JQ(J.radius,J.tube,J.tubularSegments,J.radialSegments,J.p,J.q)}};QQ=class QQ extends c0{constructor(J=new c6(new T(-1,-1,0),new T(-1,1,0),new T(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 T,X=new T,H=new r,U=new T,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 L=K.normals[k],V=K.binormals[k];for(let _=0;_<=Z;_++){let C=_/Z*Math.PI*2,A=Math.sin(C),M=-Math.cos(C);X.x=M*L.x+A*V.x,X.y=M*L.y+A*V.y,X.z=M*L.z+A*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 L=1;L<=Z;L++){let V=(Z+1)*(k-1)+(L-1),_=(Z+1)*k+(L-1),C=(Z+1)*k+L,A=(Z+1)*(k-1)+L;q.push(V,_,A),q.push(_,C,A)}}function D(){for(let k=0;k<=Q;k++)for(let L=0;L<=Z;L++)H.x=k/Q,H.y=L/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 QQ(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 T,W=new T;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:g6,CircleGeometry:p6,ConeGeometry:g7,CylinderGeometry:x7,DodecahedronGeometry:m6,EdgesGeometry:LZ,ExtrudeGeometry:s6,IcosahedronGeometry:i6,LatheGeometry:o6,OctahedronGeometry:m7,PlaneGeometry:i8,PolyhedronGeometry:s9,RingGeometry:a6,ShapeGeometry:r6,SphereGeometry:d7,TetrahedronGeometry:t6,TorusGeometry:e6,TorusKnotGeometry:JQ,TubeGeometry:QQ,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}};$Q=class $Q extends aJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};ZQ=class ZQ 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 ZQ{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}};WQ=class WQ 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}};KQ=class KQ 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,L=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]+L*K[E+V];return W}};YQ=class YQ 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],L=N[D+1],V=J*G+R*2,_=E[V],C=E[V+1],A=($-Q)/(Z-Q),M,z,y,P,x;for(let u=0;u<8;u++){M=A*A,z=M*A,y=1-A,P=y*y,x=P*y;let l=x*Q+3*P*A*k+3*y*M*_+z*Z-$;if(Math.abs(l)<0.0000000001)break;let h=3*P*(k-Q)+6*y*A*(_-k)+3*M*(Z-_);if(Math.abs(h)<0.0000000001)break;A=A-l/h,A=Math.max(0,Math.min(1,A))}W[R]=x*O+3*P*A*L+3*y*M*C+z*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;XQ=class XQ extends rJ{constructor(J,Q,$,Z){super(J,Q,$,Z)}};XQ.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 HQ;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:L})=>{if(k)F.close();else{R+=L.byteLength;let V=new ProgressEvent("progress",{lengthComputable:q,loaded:R,total:G});for(let _=0,C=U.length;_<C;_++){let A=U[_];if(A.onProgress)A.onProgress(V)}F.enqueue(L),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 T,VH=new T;tQ=new T,eQ=new vJ,A9=new T;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 T,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 UQ,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}};GQ=class GQ 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 T().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 GQ.createMaterialFromType(J)}static createMaterialFromType(J){return new{ShadowMaterial:CZ,SpriteMaterial:y6,RawShaderMaterial:$Q,ShaderMaterial:aJ,PointsMaterial:h6,MeshPhysicalMaterial:wZ,MeshStandardMaterial:ZQ,MeshPhongMaterial:PZ,MeshToonMaterial:TZ,MeshNormalMaterial:SZ,MeshLambertMaterial:jZ,MeshDepthMaterial:WQ,MeshDistanceMaterial:KQ,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 L=Z(J.data,D.data);k=new H8(L,D.itemSize,D.offset,D.normalized)}else{let L=V7(D.type,D.array);k=new UJ(L,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===""?F6.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===""?F6.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 f6().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 GQ;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 HQ(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 T6(J.fog.color,J.fog.near,J.fog.far);else if(J.fog.type==="FogExp2")K.fog=new P6(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 UQ().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 v6;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 T().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=EQ.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 T,cW=new vJ,lE=new T,T8=new T,S8=new T;TY=class TY extends KJ{constructor(){super();this.type="AudioListener",this.context=EQ.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 T,wH=new vJ,uE=new T,y8=new T;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 YQ(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 w6{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 T,Q$=new T,M7=new T,L7=new T,nW=new T,QN=new T,$N=new T;yH=new T;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 T,$$=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 T,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 T,Z$=new T,hH=new T;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 T,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 T;WX=class WX extends KJ{constructor(J=new T(0,0,1),Q=new T(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 n7={};D5(n7,{warnOnce:()=>E6,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:()=>T,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:()=>j6,Uint16BufferAttribute:()=>S6,UVMapping:()=>nH,TubeGeometry:()=>QQ,TrianglesDrawMode:()=>GU,TriangleStripDrawMode:()=>EU,TriangleFanDrawMode:()=>NU,Triangle:()=>uJ,TorusKnotGeometry:()=>JQ,TorusGeometry:()=>e6,TimestampQuery:()=>sU,Timer:()=>rZ,TextureUtils:()=>HX,TextureLoader:()=>_Y,Texture:()=>OJ,TetrahedronGeometry:()=>t6,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:()=>y6,Sprite:()=>EZ,SpotLightHelper:()=>sY,SpotLight:()=>mZ,SplineCurve:()=>n6,SphericalHarmonics3:()=>UQ,Spherical:()=>lY,SphereGeometry:()=>d7,Sphere:()=>wJ,Source:()=>w9,SkinnedMesh:()=>qZ,SkeletonHelper:()=>iY,Skeleton:()=>f6,ShortType:()=>xK,ShapeUtils:()=>X9,ShapePath:()=>YX,ShapeGeometry:()=>r6,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:()=>a6,ReverseSubtractEquation:()=>YK,ReplaceStencilOp:()=>BU,RepeatWrapping:()=>vK,RenderTarget3D:()=>hY,RenderTarget:()=>w6,ReinhardToneMapping:()=>R$,RedIntegerFormat:()=>_$,RedFormat:()=>lK,RectAreaLight:()=>cZ,Raycaster:()=>mY,Ray:()=>R8,RawShaderMaterial:()=>$Q,RGIntegerFormat:()=>A$,RGFormat:()=>D8,RGDepthPacking:()=>RU,RGB_S3TC_DXT1_Format:()=>L6,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:()=>z6,RGBA_S3TC_DXT3_Format:()=>B6,RGBA_S3TC_DXT1_Format:()=>V6,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:()=>I6,REVISION:()=>JK,RED_RGTC1_Format:()=>QZ,RED_GREEN_RGTC2_Format:()=>_6,R11_EAC_Format:()=>f$,QuaternionLinearInterpolant:()=>xZ,QuaternionKeyframeTrack:()=>a8,Quaternion:()=>vJ,QuadraticBezierCurve3:()=>c6,QuadraticBezierCurve:()=>u6,PropertyMixer:()=>eZ,PropertyBinding:()=>WJ,PositionalAudio:()=>SY,PolyhedronGeometry:()=>s9,PolarGridHelper:()=>tY,PointsMaterial:()=>h6,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:()=>ZQ,MeshPhysicalMaterial:()=>wZ,MeshPhongMaterial:()=>PZ,MeshNormalMaterial:()=>SZ,MeshMatcapMaterial:()=>yZ,MeshLambertMaterial:()=>jZ,MeshDistanceMaterial:()=>KQ,MeshDepthMaterial:()=>WQ,MeshBasicMaterial:()=>j9,Mesh:()=>VJ,MaxEquation:()=>HK,Matrix4:()=>d0,Matrix3:()=>u0,Matrix2:()=>$W,MathUtils:()=>ZG,MaterialLoader:()=>GQ,MaterialBlending:()=>lH,Material:()=>yJ,MOUSE:()=>gH,LoopRepeat:()=>eH,LoopPingPong:()=>JU,LoopOnce:()=>tH,LoadingManager:()=>HQ,LoaderUtils:()=>F6,Loader:()=>mJ,LinearTransfer:()=>YZ,LinearToneMapping:()=>F$,LinearSRGBColorSpace:()=>KZ,LinearMipmapNearestFilter:()=>M6,LinearMipmapLinearFilter:()=>E8,LinearMipMapNearestFilter:()=>oH,LinearMipMapLinearFilter:()=>aH,LinearInterpolant:()=>YQ,LinearFilter:()=>nJ,LineSegments:()=>E9,LineLoop:()=>RZ,LineDashedMaterial:()=>vZ,LineCurve3:()=>IZ,LineCurve:()=>l6,LineBasicMaterial:()=>fJ,Line3:()=>nY,Line:()=>P9,LightProbe:()=>nZ,Light:()=>y9,LessStencilFunc:()=>PU,LessEqualStencilFunc:()=>SU,LessEqualDepth:()=>D$,LessEqualCompare:()=>A6,LessDepth:()=>AK,LessCompare:()=>sK,Layers:()=>v7,LatheGeometry:()=>o6,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:()=>i6,HemisphereLightHelper:()=>aY,HemisphereLight:()=>gZ,HalfFloatType:()=>S9,HTMLTexture:()=>DY,Group:()=>Y8,GridHelper:()=>rY,GreaterStencilFunc:()=>jU,GreaterEqualStencilFunc:()=>vU,GreaterEqualDepth:()=>wK,GreaterEqualCompare:()=>C6,GreaterDepth:()=>PK,GreaterCompare:()=>oK,GLSL3:()=>XZ,GLSL1:()=>cU,GLBufferAttribute:()=>pY,FrustumArray:()=>b6,Frustum:()=>O8,FrontSide:()=>l8,FramebufferTexture:()=>GY,FogExp2:()=>P6,Fog:()=>T6,FloatType:()=>T9,Float32BufferAttribute:()=>z0,Float16BufferAttribute:()=>HY,FileLoader:()=>O9,ExtrudeGeometry:()=>s6,ExternalTexture:()=>x6,EventDispatcher:()=>Z9,Euler:()=>H9,EquirectangularRefractionMapping:()=>O6,EquirectangularReflectionMapping:()=>R6,EqualStencilFunc:()=>TU,EqualDepth:()=>CK,EqualCompare:()=>iK,EllipseCurve:()=>p7,EdgesGeometry:()=>LZ,DynamicReadUsage:()=>pU,DynamicDrawUsage:()=>hU,DynamicCopyUsage:()=>lU,DstColorFactor:()=>OK,DstAlphaFactor:()=>FK,DoubleSide:()=>k9,DodecahedronGeometry:()=>m6,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:()=>d6,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:()=>XQ,Color:()=>V0,Clock:()=>dY,ClampToEdgeWrapping:()=>k6,CircleGeometry:()=>p6,CineonToneMapping:()=>O$,CatmullRomCurve3:()=>BZ,CapsuleGeometry:()=>g6,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:()=>v6,BezierInterpolant:()=>hZ,BatchedMesh:()=>FZ,BasicShadowMap:()=>dH,BasicDepthPacking:()=>qU,BackSide:()=>cJ,AxesHelper:()=>KX,AudioLoader:()=>wY,AudioListener:()=>TY,AudioContext:()=>EQ,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 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(Y,X);else if(V&&V.isColor)F(V,1),L=!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||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 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(_,C,A){this.matrixWorld.copyPosition(A.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=L.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(lD.makeRotationFromEuler(L.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=L.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,L){k.getRGB(WW,RY(J)),$.buffers.color.setClear(WW.r,WW.g,WW.b,L,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,L=1){Y.set(k),X=L,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(P,x,u,v,l){let h=!1,m=N(P,v,u,x);if(K!==m)K=m,U(K.object);if(h=q(P,v,u,l),h)R(P,v,u,l);if(l!==null)Q.update(l,J.ELEMENT_ARRAY_BUFFER);if(h||Y){if(Y=!1,V(P,x,u,v),l!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(l).buffer)}}function H(){return J.createVertexArray()}function U(P){return J.bindVertexArray(P)}function E(P){return J.deleteVertexArray(P)}function N(P,x,u,v){let l=v.wireframe===!0,h=Z[x.id];if(h===void 0)h={},Z[x.id]=h;let m=P.isInstancedMesh===!0?P.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(P){let x=[],u=[],v=[];for(let l=0;l<$;l++)x[l]=0,u[l]=0,v[l]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:x,enabledAttributes:u,attributeDivisors:v,object:P,attributes:{},index:null}}function q(P,x,u,v){let l=K.attributes,h=x.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"&&P.instanceMatrix)B0=P.instanceMatrix;if(W0==="instanceColor"&&P.instanceColor)B0=P.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!==v)return!0;return!1}function R(P,x,u,v){let l={},h=x.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"&&P.instanceMatrix)j0=P.instanceMatrix;if(W0==="instanceColor"&&P.instanceColor)j0=P.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=v}function O(){let P=K.newAttributes;for(let x=0,u=P.length;x<u;x++)P[x]=0}function F(P){D(P,0)}function D(P,x){let{newAttributes:u,enabledAttributes:v,attributeDivisors:l}=K;if(u[P]=1,v[P]===0)J.enableVertexAttribArray(P),v[P]=1;if(l[P]!==x)J.vertexAttribDivisor(P,x),l[P]=x}function k(){let{newAttributes:P,enabledAttributes:x}=K;for(let u=0,v=x.length;u<v;u++)if(x[u]!==P[u])J.disableVertexAttribArray(u),x[u]=0}function L(P,x,u,v,l,h,m){if(m===!0)J.vertexAttribIPointer(P,x,u,l,h);else J.vertexAttribPointer(P,x,u,v,l,h)}function V(P,x,u,v){O();let l=v.attributes,h=u.getAttributes(),m=x.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"&&P.instanceMatrix)N0=P.instanceMatrix;if(a==="instanceColor"&&P.instanceColor)N0=P.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(P.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._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++)L(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(P.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._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++)L(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 _(){z();for(let P in Z){let x=Z[P];for(let u in x){let v=x[u];for(let l in v){let h=v[l];for(let m in h)E(h[m].object),delete h[m];delete v[l]}}delete Z[P]}}function C(P){if(Z[P.id]===void 0)return;let x=Z[P.id];for(let u in x){let v=x[u];for(let l in v){let h=v[l];for(let m in h)E(h[m].object),delete h[m];delete v[l]}}delete Z[P.id]}function A(P){for(let x in Z){let u=Z[x];for(let v in u){let l=u[v];if(l[P.id]===void 0)continue;let h=l[P.id];for(let m in h)E(h[m].object),delete h[m];delete l[P.id]}}}function M(P){for(let x in Z){let u=Z[x],v=P.isInstancedMesh===!0?P.id:0,l=u[v];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[v],Object.keys(u).length===0)delete Z[x]}}function z(){if(y(),Y=!0,K===W)return;K=W,U(K.object)}function y(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:X,reset:z,resetDefaultState:y,dispose:_,releaseStatesOfGeometry:C,releaseStatesOfObject:M,releaseStatesOfProgram:A,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 A=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function Y(A){if(A!==L9&&Z.convert(A)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function X(A){let M=A===S9&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(A!==G9&&Z.convert(A)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==T9&&!M)return!1;return!0}function H(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",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),L=J.getParameter(J.MAX_VARYING_VECTORS),V=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),_=J.getParameter(J.MAX_SAMPLES),C=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:L,maxFragmentUniforms:V,maxSamples:_,samples:C}}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,L=k*4,V=D.clippingState||null;H.value=V,V=E(R,G,L,q);for(let _=0;_!==L;++_)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 L=0,V=q;L!==O;++L,V+=4)Y.copy(N[L]).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,NQ)}_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 L=k%3;if(L===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(L===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,L*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,NQ)}_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,NQ),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,NQ)}_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 C=0;C<t8;++C){let A=C/R,M=Math.exp(-A*A/2);if(F.push(M),C===0)D+=M;else if(C<O)D+=2*M}for(let C=0;C<F.length;C++)F[C]=F[C]/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 L=this._sizeLods[Z],V=3*L*(Z>k-L8?Z-k+L8:0),_=4*(this._cubeSize-L);u7(Q,V,_,3*L,2*L),X.setRenderTarget(Q),X.render(E,NQ)}}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),L=new Float32Array(F*R*q),V=new Float32Array(D*R*q);for(let C=0;C<q;C++){let A=C%3*2/3-1,M=C>2?0:-1,z=[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(z,O*R*C),L.set(G,F*R*C);let y=[C,C,C,C,C,C];V.set(y,D*R*C)}let _=new c0;if(_.setAttribute("position",new UJ(k,O)),_.setAttribute("uv",new UJ(L,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 E5=Object.defineProperty;var N5=(J)=>J;function q5(J,Q){this[J]=N5.bind(null
106
106
 
107
107
  gl_FragColor = vec4(prefilteredColor, 1.0);
108
108
  }
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:`
109
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function eD(J,Q,$){let Z=new Float32Array(t8),W=new T(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;
@@ -256,7 +256,7 @@ var E5=Object.defineProperty;var N5=(J)=>J;function q5(J,Q){this[J]=N5.bind(null
256
256
  gl_Position = vec4( position, 1.0 );
257
257
 
258
258
  }
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:`
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===R6||q===O6)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===R6||q===O6,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===R6)G.mapping=c8;else if(q===O6)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)E6("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 L=0,V=k.length;L<V;L+=3){let _=k[L+0],C=k[L+1],A=k[L+2];G.push(_,C,C,A,A,_)}}else{let k=R.array;O=R.version;for(let L=0,V=k.length/3-1;L<V;L+=3){let _=L+0,C=L+1,A=L+2;G.push(_,C,C,A,A,_)}}let F=new(R.count>=65535?j6:S6)(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 z=function(){A.dispose(),Z.delete(X),X.removeEventListener("dispose",z)};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||[],L=0;if(q===!0)L=1;if(R===!0)L=2;if(O===!0)L=3;let V=X.attributes.position.count*L,_=1;if(V>Q.maxTextureSize)_=Math.ceil(V/Q.maxTextureSize),V=Q.maxTextureSize;let C=new Float32Array(V*_*4*N),A=new j7(C,V,_,N);A.type=T9,A.needsUpdate=!0;let M=L*4;for(let y=0;y<N;y++){let P=F[y],x=D[y],u=k[y],v=V*_*4*y;for(let l=0;l<P.count;l++){let h=l*M;if(q===!0)W.fromBufferAttribute(P,l),C[v+h+0]=W.x,C[v+h+1]=W.y,C[v+h+2]=W.z,C[v+h+3]=0;if(R===!0)W.fromBufferAttribute(x,l),C[v+h+4]=W.x,C[v+h+5]=W.y,C[v+h+6]=W.z,C[v+h+7]=0;if(O===!0)W.fromBufferAttribute(u,l),C[v+h+8]=W.x,C[v+h+9]=W.y,C[v+h+10]=W.z,C[v+h+11]=u.itemSize===4?W.w:1}}G={count:N,texture:A,size:new r(V,_)},Z.set(X,G),X.addEventListener("dispose",z)}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 $Q({uniforms:{tDiffuse:{value:null}},vertexShader:`
260
260
  precision highp float;
261
261
 
262
262
  uniform mat4 modelViewMatrix;
@@ -302,7 +302,7 @@ var E5=Object.defineProperty;var N5=(J)=>J;function q5(J,Q){this[J]=N5.bind(null
302
302
  #ifdef SRGB_TRANSFER
303
303
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
304
304
  #endif
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(`
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,L){K.setSize(k,L),Y.setSize(k,L);for(let V=0;V<F.length;V++){let _=F[V];if(_.setSize)_.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 _=0;_<F.length;_++){let C=F[_];if(C.setSize)C.setSize(L,V)}},this.begin=function(k,L){if(q)return!1;if(k.toneMapping===U9&&F.length===0)return!1;if(O=L,L!==null){let{width:V,height:_}=L;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,L){k.toneMapping=R,q=!0;let V=K,_=Y;for(let C=0;C<F.length;C++){let A=F[C];if(A.enabled===!1)continue;if(A.render(k,_,V,L),A.needsSwap!==!1){let M=V;V=_,_=M}}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 C=XF[G];if(C)H.defines[C]="";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()?C6:A6,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 FQ{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
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
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
 
@@ -310,9 +310,9 @@ var E5=Object.defineProperty;var N5=(J)=>J;function q5(J,Q){this[J]=N5.bind(null
310
310
 
311
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
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(`
313
+ `)}function W1(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(DQ).join(`
314
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;
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 DQ(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;
@@ -333,27 +333,27 @@ var E5=Object.defineProperty;var N5=(J)=>J;function q5(J,Q){this[J]=N5.bind(null
333
333
  #define HIGH_PRECISION`;else if(J.precision==="mediump")Q+=`
334
334
  #define MEDIUM_PRECISION`;else if(J.precision==="lowp")Q+=`
335
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(`
336
+ `:"";if($.isRawShaderMaterial){if(F=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(DQ).join(`
337
337
  `),F.length>0)F+=`
338
- `;if(D=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(NQ).join(`
338
+ `;if(D=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(DQ).join(`
339
339
  `),D.length>0)D+=`
340
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(`
341
+ `].filter(DQ).join(`
342
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(`
343
+ `].filter(DQ).join(`
344
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
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 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)+`
349
+ `+D;let L=k+F+Y,V=k+D+X,_=TG(W,W.VERTEX_SHADER,L),C=TG(W,W.FRAGMENT_SHADER,V);if(W.attachShader(O,_),W.attachShader(O,C),$.index0AttributeName!==void 0)W.bindAttribLocation(O,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(O,0,"position");W.linkProgram(O);function A(P){if(J.debug.checkShaderErrors){let x=W.getProgramInfoLog(O)||"",u=W.getShaderInfoLog(_)||"",v=W.getShaderInfoLog(C)||"",l=x.trim(),h=u.trim(),m=v.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,_,C);else{let N0=jG(W,_,"vertex"),j0=jG(W,C,"fragment");T0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(O,W.VALIDATE_STATUS)+`
350
350
 
351
- Material Name: `+T.name+`
352
- Material Type: `+T.type+`
351
+ Material Name: `+P.name+`
352
+ Material Type: `+P.type+`
353
353
 
354
354
  Program Info Log: `+l+`
355
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
356
+ `+j0)}else if(l!=="")H0("WebGLProgram: Program Info Log:",l);else if(h===""||m==="")W0=!1;if(W0)P.diagnostics={runnable:a,programLog:l,vertexShader:{log:h,prefix:F},fragmentShader:{log:m,prefix:D}}}W.deleteShader(_),W.deleteShader(C),M=new FQ(W,O),z=Y1(W,O)}let M;this.getUniforms=function(){if(M===void 0)A(this);return M};let z;this.getAttributes=function(){if(z===void 0)A(this);return z};let y=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(y===!1)y=W.getProgramParameter(O,aF);return y},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=C,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===I6||J===_6}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(M){if(H.add(M),M===0)return"uv";return`uv${M}`}function O(M,z,y,P,x,u){let v=P.fog,l=x.geometry,h=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?P.environment:null,m=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap,a=Q.get(M.envMap||h,m),W0=!!a&&a.mapping===P7?a.image.height:null,N0=q[M.type];if(M.precision!==null){if(G=Z.getMaxPrecision(M.precision),G!==M.precision)H0("WebGLProgram.getParameters:",M.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=M.vertexShader,s=M.fragmentShader,X.update(M),R0=X.getVertexShaderID(M),P0=X.getFragmentShaderID(M);let G0=J.getRenderTarget(),b0=J.state.buffers.depth.getReversed(),YJ=x.isInstancedMesh===!0,p0=x.isBatchedMesh===!0,l0=!!M.map,t=!!M.matcap,$0=!!a,e=!!M.aoMap,L0=!!M.lightMap,M0=!!M.bumpMap,x0=!!M.normalMap,S=!!M.displacementMap,e0=!!M.emissiveMap,y0=!!M.metalnessMap,g0=!!M.roughnessMap,K0=M.anisotropy>0,HJ=M.clearcoat>0,A0=M.dispersion>0,w=M.iridescence>0,B=M.sheen>0,b=M.transmission>0,i=K0&&!!M.anisotropyMap,J0=HJ&&!!M.clearcoatMap,Z0=HJ&&!!M.clearcoatNormalMap,q0=HJ&&!!M.clearcoatRoughnessMap,c=w&&!!M.iridescenceMap,o=w&&!!M.iridescenceThicknessMap,E0=B&&!!M.sheenColorMap,C0=B&&!!M.sheenRoughnessMap,X0=!!M.specularMap,F0=!!M.specularColorMap,n0=!!M.specularIntensityMap,a0=b&&!!M.transmissionMap,JJ=b&&!!M.thicknessMap,j=!!M.gradientMap,U0=!!M.alphaMap,n=M.alphaTest>0,Y0=!!M.alphaHash,w0=!!M.extensions,Q0=U9;if(M.toneMapped){if(G0===null||G0.isXRRenderTarget===!0)Q0=J.toneMapping}let v0={shaderID:N0,shaderType:M.type,shaderName:M.name,vertexShader:t0,fragmentShader:s,defines:M.defines,customVertexShaderID:R0,customFragmentShaderID:P0,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:G,batching:p0,batchingColor:p0&&x._colorsTexture!==null,instancing:YJ,instancingColor:YJ&&x.instanceColor!==null,instancingMorph:YJ&&x.morphTexture!==null,outputColorSpace:G0===null?J.outputColorSpace:G0.isXRRenderTarget===!0?G0.texture.colorSpace:$J.workingColorSpace,alphaToCoverage:!!M.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&&M.normalMapType===uK,normalMapTangentSpace:x0&&M.normalMapType===WZ,packedNormalMap:x0&&M.normalMapType===WZ&&z1(M.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:b,transmissionMap:a0,thicknessMap:JJ,gradientMap:j,opaque:M.transparent===!1&&M.blending===w7&&M.alphaToCoverage===!1,alphaMap:U0,alphaTest:n,alphaHash:Y0,combine:M.combine,mapUv:l0&&R(M.map.channel),aoMapUv:e&&R(M.aoMap.channel),lightMapUv:L0&&R(M.lightMap.channel),bumpMapUv:M0&&R(M.bumpMap.channel),normalMapUv:x0&&R(M.normalMap.channel),displacementMapUv:S&&R(M.displacementMap.channel),emissiveMapUv:e0&&R(M.emissiveMap.channel),metalnessMapUv:y0&&R(M.metalnessMap.channel),roughnessMapUv:g0&&R(M.roughnessMap.channel),anisotropyMapUv:i&&R(M.anisotropyMap.channel),clearcoatMapUv:J0&&R(M.clearcoatMap.channel),clearcoatNormalMapUv:Z0&&R(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:q0&&R(M.clearcoatRoughnessMap.channel),iridescenceMapUv:c&&R(M.iridescenceMap.channel),iridescenceThicknessMapUv:o&&R(M.iridescenceThicknessMap.channel),sheenColorMapUv:E0&&R(M.sheenColorMap.channel),sheenRoughnessMapUv:C0&&R(M.sheenRoughnessMap.channel),specularMapUv:X0&&R(M.specularMap.channel),specularColorMapUv:F0&&R(M.specularColorMap.channel),specularIntensityMapUv:n0&&R(M.specularIntensityMap.channel),transmissionMapUv:a0&&R(M.transmissionMap.channel),thicknessMapUv:JJ&&R(M.thicknessMap.channel),alphaMapUv:U0&&R(M.alphaMap.channel),vertexTangents:!!l.attributes.tangent&&(x0||K0),vertexNormals:!!l.attributes.normal,vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,pointsUvs:x.isPoints===!0&&!!l.attributes.uv&&(l0||U0),fog:!!v,useFog:M.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:M.wireframe===!1&&(M.flatShading===!0||l.attributes.normal===void 0&&x0===!1&&(M.isMeshLambertMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isMeshPhysicalMaterial)),sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:N,reversedDepthBuffer:b0,skinning:x.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:z.directional.length,numPointLights:z.point.length,numSpotLights:z.spot.length,numSpotLightMaps:z.spotLightMap.length,numRectAreaLights:z.rectArea.length,numHemiLights:z.hemi.length,numDirLightShadows:z.directionalShadowMap.length,numPointLightShadows:z.pointShadowMap.length,numSpotLightShadows:z.spotShadowMap.length,numSpotLightShadowsWithMaps:z.numSpotLightShadowsWithMaps,numLightProbes:z.numLightProbes,numLightProbeGrids:u.length,numClippingPlanes:K.numPlanes,numClipIntersection:K.numIntersection,dithering:M.dithering,shadowMapEnabled:J.shadowMap.enabled&&y.length>0,shadowMapType:J.shadowMap.type,toneMapping:Q0,decodeVideoTexture:l0&&M.map.isVideoTexture===!0&&$J.getTransfer(M.map.colorSpace)===qJ,decodeVideoTextureEmissive:e0&&M.emissiveMap.isVideoTexture===!0&&$J.getTransfer(M.emissiveMap.colorSpace)===qJ,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===k9,flipSided:M.side===cJ,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:w0&&M.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(w0&&M.extensions.multiDraw===!0||p0)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return v0.vertexUv1s=H.has(1),v0.vertexUv2s=H.has(2),v0.vertexUv3s=H.has(3),H.clear(),v0}function F(M){let z=[];if(M.shaderID)z.push(M.shaderID);else z.push(M.customVertexShaderID),z.push(M.customFragmentShaderID);if(M.defines!==void 0)for(let y in M.defines)z.push(y),z.push(M.defines[y]);if(M.isRawShaderMaterial===!1)D(z,M),k(z,M),z.push(J.outputColorSpace);return z.push(M.customProgramCacheKey),z.join()}function D(M,z){M.push(z.precision),M.push(z.outputColorSpace),M.push(z.envMapMode),M.push(z.envMapCubeUVHeight),M.push(z.mapUv),M.push(z.alphaMapUv),M.push(z.lightMapUv),M.push(z.aoMapUv),M.push(z.bumpMapUv),M.push(z.normalMapUv),M.push(z.displacementMapUv),M.push(z.emissiveMapUv),M.push(z.metalnessMapUv),M.push(z.roughnessMapUv),M.push(z.anisotropyMapUv),M.push(z.clearcoatMapUv),M.push(z.clearcoatNormalMapUv),M.push(z.clearcoatRoughnessMapUv),M.push(z.iridescenceMapUv),M.push(z.iridescenceThicknessMapUv),M.push(z.sheenColorMapUv),M.push(z.sheenRoughnessMapUv),M.push(z.specularMapUv),M.push(z.specularColorMapUv),M.push(z.specularIntensityMapUv),M.push(z.transmissionMapUv),M.push(z.thicknessMapUv),M.push(z.combine),M.push(z.fogExp2),M.push(z.sizeAttenuation),M.push(z.morphTargetsCount),M.push(z.morphAttributeCount),M.push(z.numDirLights),M.push(z.numPointLights),M.push(z.numSpotLights),M.push(z.numSpotLightMaps),M.push(z.numHemiLights),M.push(z.numRectAreaLights),M.push(z.numDirLightShadows),M.push(z.numPointLightShadows),M.push(z.numSpotLightShadows),M.push(z.numSpotLightShadowsWithMaps),M.push(z.numLightProbes),M.push(z.shadowMapType),M.push(z.toneMapping),M.push(z.numClippingPlanes),M.push(z.numClipIntersection),M.push(z.depthPacking)}function k(M,z){if(Y.disableAll(),z.instancing)Y.enable(0);if(z.instancingColor)Y.enable(1);if(z.instancingMorph)Y.enable(2);if(z.matcap)Y.enable(3);if(z.envMap)Y.enable(4);if(z.normalMapObjectSpace)Y.enable(5);if(z.normalMapTangentSpace)Y.enable(6);if(z.clearcoat)Y.enable(7);if(z.iridescence)Y.enable(8);if(z.alphaTest)Y.enable(9);if(z.vertexColors)Y.enable(10);if(z.vertexAlphas)Y.enable(11);if(z.vertexUv1s)Y.enable(12);if(z.vertexUv2s)Y.enable(13);if(z.vertexUv3s)Y.enable(14);if(z.vertexTangents)Y.enable(15);if(z.anisotropy)Y.enable(16);if(z.alphaHash)Y.enable(17);if(z.batching)Y.enable(18);if(z.dispersion)Y.enable(19);if(z.batchingColor)Y.enable(20);if(z.gradientMap)Y.enable(21);if(z.packedNormalMap)Y.enable(22);if(z.vertexNormals)Y.enable(23);if(M.push(Y.mask),Y.disableAll(),z.fog)Y.enable(0);if(z.useFog)Y.enable(1);if(z.flatShading)Y.enable(2);if(z.logarithmicDepthBuffer)Y.enable(3);if(z.reversedDepthBuffer)Y.enable(4);if(z.skinning)Y.enable(5);if(z.morphTargets)Y.enable(6);if(z.morphNormals)Y.enable(7);if(z.morphColors)Y.enable(8);if(z.premultipliedAlpha)Y.enable(9);if(z.shadowMapEnabled)Y.enable(10);if(z.doubleSided)Y.enable(11);if(z.flipSided)Y.enable(12);if(z.useDepthPacking)Y.enable(13);if(z.dithering)Y.enable(14);if(z.transmission)Y.enable(15);if(z.sheen)Y.enable(16);if(z.opaque)Y.enable(17);if(z.pointsUvs)Y.enable(18);if(z.decodeVideoTexture)Y.enable(19);if(z.decodeVideoTextureEmissive)Y.enable(20);if(z.alphaToCoverage)Y.enable(21);if(z.numLightProbeGrids>0)Y.enable(22);M.push(Y.mask)}function L(M){let z=q[M.type],y;if(z){let P=V9[z];y=OY.clone(P.uniforms)}else y=M.uniforms;return y}function V(M,z){let y=E.get(z);if(y!==void 0)++y.usedTimes;else y=new V1(J,z,M,W),U.push(y),E.set(z,y);return y}function _(M){if(--M.usedTimes===0){let z=U.indexOf(M);U[z]=U[U.length-1],U.pop(),E.delete(M.cacheKey),M.destroy()}}function C(M){X.remove(M)}function A(){X.dispose()}return{getParameters:O,getProgramCacheKey:F,getUniforms:L,acquireProgram:V,releaseProgram:_,releaseShaderCache:C,programs:U,dispose:A}}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 T,color:new V0};break;case"SpotLight":$={position:new T,direction:new T,color:new V0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new T,color:new V0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new T,skyColor:new V0,groundColor:new V0};break;case"RectAreaLight":$={color:new V0,position:new T,halfWidth:new T,halfHeight:new T};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 T);let W=new T,K=new d0,Y=new d0;function X(U){let E=0,N=0,G=0;for(let z=0;z<9;z++)Z.probe[z].set(0,0,0);let q=0,R=0,O=0,F=0,D=0,k=0,L=0,V=0,_=0,C=0,A=0;U.sort(S1);for(let z=0,y=U.length;z<y;z++){let P=U[z],x=P.color,u=P.intensity,v=P.distance,l=null;if(P.shadow&&P.shadow.map)if(P.shadow.map.texture.format===D8)l=P.shadow.map.texture;else l=P.shadow.map.depthTexture||P.shadow.map.texture;if(P.isAmbientLight)E+=x.r*u,N+=x.g*u,G+=x.b*u;else if(P.isLightProbe){for(let h=0;h<9;h++)Z.probe[h].addScaledVector(P.sh.coefficients[h],u);A++}else if(P.isDirectionalLight){let h=Q.get(P);if(h.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){let m=P.shadow,a=$.get(P);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]=P.shadow.matrix,k++}Z.directional[q]=h,q++}else if(P.isSpotLight){let h=Q.get(P);h.position.setFromMatrixPosition(P.matrixWorld),h.color.copy(x).multiplyScalar(u),h.distance=v,h.coneCos=Math.cos(P.angle),h.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),h.decay=P.decay,Z.spot[O]=h;let m=P.shadow;if(P.map){if(Z.spotLightMap[_]=P.map,_++,m.updateMatrices(P),P.castShadow)C++}if(Z.spotLightMatrix[O]=m.matrix,P.castShadow){let a=$.get(P);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(P.isRectAreaLight){let h=Q.get(P);h.color.copy(x).multiplyScalar(u),h.halfWidth.set(P.width*0.5,0,0),h.halfHeight.set(0,P.height*0.5,0),Z.rectArea[F]=h,F++}else if(P.isPointLight){let h=Q.get(P);if(h.color.copy(P.color).multiplyScalar(P.intensity),h.distance=P.distance,h.decay=P.decay,P.castShadow){let m=P.shadow,a=$.get(P);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]=P.shadow.matrix,L++}Z.point[R]=h,R++}else if(P.isHemisphereLight){let h=Q.get(P);h.skyColor.copy(P.color).multiplyScalar(u),h.groundColor.copy(P.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 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!==_||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+_-C,Z.spotLightMap.length=_,Z.numSpotLightShadowsWithMaps=C,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=_,M.numLightProbes=A,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 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),Y.identity(),K.copy(L.matrixWorld),K.premultiply(F),Y.extractRotation(K),V.halfWidth.set(L.width*0.5,0,0),V.halfHeight.set(0,L.height*0.5,0),V.halfWidth.applyMatrix4(Y),V.halfHeight.applyMatrix4(Y),R++}else if(L.isPointLight){let V=Z.point[G];V.position.setFromMatrixPosition(L.matrixWorld),V.position.applyMatrix4(F),G++}else if(L.isHemisphereLight){let V=Z.hemi[O];V.direction.setFromMatrixPosition(L.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 WQ,H=new KQ,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(C,A,M){if(F.enabled===!1)return;if(F.autoUpdate===!1&&F.needsUpdate===!1)return;if(C.length===0)return;if(this.type===ZK)H0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=C7;let z=J.getRenderTarget(),y=J.getActiveCubeFace(),P=J.getActiveMipmapLevel(),x=J.state;if(x.setBlending(M9),x.buffers.depth.getReversed()===!0)x.buffers.color.setClear(0,0,0,0);else x.buffers.color.setClear(1,1,1,1);x.buffers.depth.setTest(!0),x.setScissorTest(!1);let u=D!==this.type;if(u)A.traverse(function(v){if(v.material)if(Array.isArray(v.material))v.material.forEach((l)=>l.needsUpdate=!0);else v.material.needsUpdate=!0});for(let v=0,l=C.length;v<l;v++){let h=C[v],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?C6:A6,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),x.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();qQ.setFromMatrixPosition(h.matrixWorld),B0.position.copy(qQ),FX.copy(B0.position),FX.add(b1[j0]),B0.up.copy(h1[j0]),B0.lookAt(FX),B0.updateMatrixWorld(),ZJ.makeTranslation(-qQ.x,-qQ.y,-qQ.z),pG.multiplyMatrices(B0.projectionMatrix,B0.matrixWorldInverse),m._frustum.setFromProjectionMatrix(pG,B0.coordinateSystem,B0.reversedDepth)}else m.updateMatrices(h);Z=m.getFrustum(),V(A,M,m.camera,h,this.type)}if(m.isPointLightShadow!==!0&&this.type===d8)k(m,M);m.needsUpdate=!1}D=this.type,F.needsUpdate=!1,J.setRenderTarget(z,y,P)};function k(C,A){let M=Q.update(O);if(G.defines.VSM_SAMPLES!==C.blurSamples)G.defines.VSM_SAMPLES=C.blurSamples,q.defines.VSM_SAMPLES=C.blurSamples,G.needsUpdate=!0,q.needsUpdate=!0;if(C.mapPass===null)C.mapPass=new sJ(W.x,W.y,{format:D8,type:S9});G.uniforms.shadow_pass.value=C.map.depthTexture,G.uniforms.resolution.value=C.mapSize,G.uniforms.radius.value=C.radius,J.setRenderTarget(C.mapPass),J.clear(),J.renderBufferDirect(A,null,M,G,O,null),q.uniforms.shadow_pass.value=C.mapPass.texture,q.uniforms.resolution.value=C.mapSize,q.uniforms.radius.value=C.radius,J.setRenderTarget(C.map),J.clear(),J.renderBufferDirect(A,null,M,q,O,null)}function L(C,A,M,z){let y=null,P=M.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(P!==void 0)y=P;else if(y=M.isPointLight===!0?H:X,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 x=y.uuid,u=A.uuid,v=U[x];if(v===void 0)v={},U[x]=v;let l=v[u];if(l===void 0)l=y.clone(),v[u]=l,A.addEventListener("dispose",_);y=l}if(y.visible=A.visible,y.wireframe=A.wireframe,z===d8)y.side=A.shadowSide!==null?A.shadowSide:A.side;else y.side=A.shadowSide!==null?A.shadowSide:N[A.side];if(y.alphaMap=A.alphaMap,y.alphaTest=A.alphaToCoverage===!0?0.5:A.alphaTest,y.map=A.map,y.clipShadows=A.clipShadows,y.clippingPlanes=A.clippingPlanes,y.clipIntersection=A.clipIntersection,y.displacementMap=A.displacementMap,y.displacementScale=A.displacementScale,y.displacementBias=A.displacementBias,y.wireframeLinewidth=A.wireframeLinewidth,y.linewidth=A.linewidth,M.isPointLight===!0&&y.isMeshDistanceMaterial===!0){let x=J.properties.get(y);x.light=M}return y}function V(C,A,M,z,y){if(C.visible===!1)return;if(C.layers.test(A.layers)&&(C.isMesh||C.isLine||C.isPoints)){if((C.castShadow||C.receiveShadow&&y===d8)&&(!C.frustumCulled||Z.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,C.matrixWorld);let u=Q.update(C),v=C.material;if(Array.isArray(v)){let l=u.groups;for(let h=0,m=l.length;h<m;h++){let a=l[h],W0=v[a.materialIndex];if(W0&&W0.visible){let N0=L(C,W0,z,y);C.onBeforeShadow(J,C,A,M,u,N0,a),J.renderBufferDirect(M,null,u,N0,C,a),C.onAfterShadow(J,C,A,M,u,N0,a)}}}else if(v.visible){let l=L(C,v,z,y);C.onBeforeShadow(J,C,A,M,u,l,null),J.renderBufferDirect(M,null,u,l,C,null),C.onAfterShadow(J,C,A,M,u,l,null)}}}let x=C.children;for(let u=0,v=x.length;u<v;u++)V(x[u],A,M,z,y)}function _(C){C.target.removeEventListener("dispose",_);for(let M in U){let z=U[M],y=C.target.uuid;if(y in z)z[y].dispose(),delete z[y]}}}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,L=null,V=null,_=null,C=null,A=null,M=new V0(0,0,0),z=0,y=!1,P=null,x=null,u=null,v=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!==y){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}L=null,V=null,C=null,A=null,M.set(0,0,0),z=0,D=j,y=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!==L||Y0!==V||Q0!==C||v0!==A)J.blendFuncSeparate($0[n],$0[Y0],$0[Q0],$0[v0]),L=n,V=Y0,C=Q0,A=v0;if(s0.equals(M)===!1||_J!==z)J.blendColor(s0.r,s0.g,s0.b,_J),M.copy(s0),z=_J;D=j,y=!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(P!==j){if(j)J.frontFace(J.CW);else J.frontFace(J.CCW);P=j}}function x0(j){if(j!==QK){if(G0(J.CULL_FACE),j!==x)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);x=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),v!==U0||l!==n){if(v=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 b(){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,L=null,V=null,_=null,C=null,A=null,M=new V0(0,0,0),z=0,y=!1,P=null,x=null,u=null,v=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:b,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,b){let i=1,J0=A0(w);if(J0.width>b||J0.height>b)i=b/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 L(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,b,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(b===J.FLOAT)c=J.R32F;if(b===J.HALF_FLOAT)c=J.R16F;if(b===J.UNSIGNED_BYTE)c=J.R8;if(b===J.UNSIGNED_SHORT&&q0)c=q0.R16_EXT;if(b===J.SHORT&&q0)c=q0.R16_SNORM_EXT}if(B===J.RED_INTEGER){if(b===J.UNSIGNED_BYTE)c=J.R8UI;if(b===J.UNSIGNED_SHORT)c=J.R16UI;if(b===J.UNSIGNED_INT)c=J.R32UI;if(b===J.BYTE)c=J.R8I;if(b===J.SHORT)c=J.R16I;if(b===J.INT)c=J.R32I}if(B===J.RG){if(b===J.FLOAT)c=J.RG32F;if(b===J.HALF_FLOAT)c=J.RG16F;if(b===J.UNSIGNED_BYTE)c=J.RG8;if(b===J.UNSIGNED_SHORT&&q0)c=q0.RG16_EXT;if(b===J.SHORT&&q0)c=q0.RG16_SNORM_EXT}if(B===J.RG_INTEGER){if(b===J.UNSIGNED_BYTE)c=J.RG8UI;if(b===J.UNSIGNED_SHORT)c=J.RG16UI;if(b===J.UNSIGNED_INT)c=J.RG32UI;if(b===J.BYTE)c=J.RG8I;if(b===J.SHORT)c=J.RG16I;if(b===J.INT)c=J.RG32I}if(B===J.RGB_INTEGER){if(b===J.UNSIGNED_BYTE)c=J.RGB8UI;if(b===J.UNSIGNED_SHORT)c=J.RGB16UI;if(b===J.UNSIGNED_INT)c=J.RGB32UI;if(b===J.BYTE)c=J.RGB8I;if(b===J.SHORT)c=J.RGB16I;if(b===J.INT)c=J.RGB32I}if(B===J.RGBA_INTEGER){if(b===J.UNSIGNED_BYTE)c=J.RGBA8UI;if(b===J.UNSIGNED_SHORT)c=J.RGBA16UI;if(b===J.UNSIGNED_INT)c=J.RGBA32UI;if(b===J.BYTE)c=J.RGBA8I;if(b===J.SHORT)c=J.RGBA16I;if(b===J.INT)c=J.RGBA32I}if(B===J.RGB){if(b===J.UNSIGNED_SHORT&&q0)c=q0.RGB16_EXT;if(b===J.SHORT&&q0)c=q0.RGB16_SNORM_EXT;if(b===J.UNSIGNED_INT_5_9_9_9_REV)c=J.RGB9_E5;if(b===J.UNSIGNED_INT_10F_11F_11F_REV)c=J.R11F_G11F_B10F}if(B===J.RGBA){let o=Z0?YZ:$J.getTransfer(J0);if(b===J.FLOAT)c=J.RGBA32F;if(b===J.HALF_FLOAT)c=J.RGBA16F;if(b===J.UNSIGNED_BYTE)c=o===qJ?J.SRGB8_ALPHA8:J.RGBA8;if(b===J.UNSIGNED_SHORT&&q0)c=q0.RGBA16_EXT;if(b===J.SHORT&&q0)c=q0.RGBA16_SNORM_EXT;if(b===J.UNSIGNED_SHORT_4_4_4_4)c=J.RGBA4;if(b===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 b;if(w){if(B===null||B===c9||B===n8)b=J.DEPTH24_STENCIL8;else if(B===T9)b=J.DEPTH32F_STENCIL8;else if(B===S7)b=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)b=J.DEPTH_COMPONENT24;else if(B===T9)b=J.DEPTH_COMPONENT32F;else if(B===S7)b=J.DEPTH_COMPONENT16;return b}function C(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 A(w){let B=w.target;if(B.removeEventListener("dispose",A),z(B),B.isVideoTexture)E.delete(B);if(B.isHTMLTexture)N.delete(B)}function M(w){let B=w.target;B.removeEventListener("dispose",M),P(B)}function z(w){let B=Z.get(w);if(B.__webglInit===void 0)return;let b=w.source,i=q.get(b);if(i){let J0=i[B.__cacheKey];if(J0.usedTimes--,J0.usedTimes===0)y(w);if(Object.keys(i).length===0)q.delete(b)}Z.remove(w)}function y(w){let B=Z.get(w);J.deleteTexture(B.__webglTexture);let b=w.source,i=q.get(b);delete i[B.__cacheKey],Y.memory.textures--}function P(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 b=w.textures;for(let i=0,J0=b.length;i<J0;i++){let Z0=Z.get(b[i]);if(Z0.__webglTexture)J.deleteTexture(Z0.__webglTexture),Y.memory.textures--;Z.remove(b[i])}Z.remove(w)}let x=0;function u(){x=0}function v(){return x}function l(w){x=w}function h(){let w=x;if(w>=W.maxTextures)H0("WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+W.maxTextures);return x+=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 b=Z.get(w);if(w.isVideoTexture)K0(w);if(w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&b.__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(b,w,B);return}}else if(w.isExternalTexture)b.__webglTexture=w.sourceTexture?w.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,b.__webglTexture,J.TEXTURE0+B)}function W0(w,B){let b=Z.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&b.__version!==w.version){b0(b,w,B);return}else if(w.isExternalTexture)b.__webglTexture=w.sourceTexture?w.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,b.__webglTexture,J.TEXTURE0+B)}function N0(w,B){let b=Z.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&b.__version!==w.version){b0(b,w,B);return}$.bindTexture(J.TEXTURE_3D,b.__webglTexture,J.TEXTURE0+B)}function j0(w,B){let b=Z.get(w);if(w.isCubeDepthTexture!==!0&&w.version>0&&b.__version!==w.version){YJ(b,w,B);return}$.bindTexture(J.TEXTURE_CUBE_MAP,b.__webglTexture,J.TEXTURE0+B)}let B0={[vK]:J.REPEAT,[k6]: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,[M6]:J.LINEAR_MIPMAP_NEAREST,[E8]:J.LINEAR_MIPMAP_LINEAR},t0={[nK]:J.NEVER,[rK]:J.ALWAYS,[sK]:J.LESS,[A6]:J.LEQUAL,[iK]:J.EQUAL,[C6]: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===M6||B.magFilter===T7||B.magFilter===E8||B.minFilter===nJ||B.minFilter===M6||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 b=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(w,b.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,W.getMaxAnisotropy())),Z.get(B).__currentAnisotropy=B.anisotropy}}}function R0(w,B){let b=!1;if(w.__webglInit===void 0)w.__webglInit=!0,B.addEventListener("dispose",A);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++,b=!0;J0[Z0].usedTimes++;let q0=J0[w.__cacheKey];if(q0!==void 0){if(J0[w.__cacheKey].usedTimes--,q0.usedTimes===0)y(B)}w.__cacheKey=Z0,w.__webglTexture=J0[Z0].texture}return b}function P0(w,B,b){return Math.floor(Math.floor(w/b)/B)}function G0(w,B,b,i){let Z0=w.updateRanges;if(Z0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,B.width,B.height,b,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,b,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,b){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+b);let q0=Z.get(Z0);if(Z0.version!==q0.__version||J0===!0){if($.activeTexture(J.TEXTURE0+b),(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=C(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,b){if(B.image.length!==6)return;let i=R0(w,B),J0=B.source;$.bindTexture(J.TEXTURE_CUBE_MAP,w.__webglTexture,J.TEXTURE0+b);let Z0=Z.get(J0);if(J0.version!==Z0.__version||i===!0){$.activeTexture(J.TEXTURE0+b);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=C(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,b,i,J0,Z0){let q0=K.convert(b.format,b.colorSpace),c=K.convert(b.type),o=V(b.internalFormat,q0,c,b.normalized,b.colorSpace),E0=Z.get(B),C0=Z.get(b);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,b){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(b)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(b)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,b){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",A);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+b: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),b=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(b)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(b){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,b){let i=Z.get(w);if(B!==void 0)p0(i.__webglFramebuffer,w,w.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(b!==void 0)$0(w)}function L0(w){let B=w.texture,b=Z.get(w),i=Z.get(B);w.addEventListener("dispose",M);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){b.__webglFramebuffer=[];for(let c=0;c<6;c++)if(B.mipmaps&&B.mipmaps.length>0){b.__webglFramebuffer[c]=[];for(let o=0;o<B.mipmaps.length;o++)b.__webglFramebuffer[c][o]=J.createFramebuffer()}else b.__webglFramebuffer[c]=J.createFramebuffer()}else{if(B.mipmaps&&B.mipmaps.length>0){b.__webglFramebuffer=[];for(let c=0;c<B.mipmaps.length;c++)b.__webglFramebuffer[c]=J.createFramebuffer()}else b.__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){b.__webglMultisampledFramebuffer=J.createFramebuffer(),b.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,b.__webglMultisampledFramebuffer);for(let c=0;c<J0.length;c++){let o=J0[c];b.__webglColorRenderbuffer[c]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,b.__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,b.__webglColorRenderbuffer[c])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),w.depthBuffer)b.__webglDepthRenderbuffer=J.createRenderbuffer(),l0(b.__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(b.__webglFramebuffer[c][o],w,B,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+c,o);else p0(b.__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(b.__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(b.__webglFramebuffer[o],w,B,J.COLOR_ATTACHMENT0,c,o);else p0(b.__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 b=0,i=B.length;b<i;b++){let J0=B[b];if(D(J0)){let Z0=L(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:b,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,b,i,0,0,b,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:b,format:i,type:J0}=w;if(w.isCompressedTexture===!0||w.isVideoTexture===!0)return B;if(b!==KZ&&b!==F8)if($J.getTransfer(b)===qJ){if(i!==L9||J0!==G9)H0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else T0("WebGLTextures: Unsupported texture color space:",b);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=v,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===L6||Z===V6||Z===B6||Z===z6)if(Y===qJ)if(K=Q.get("WEBGL_compressed_texture_s3tc_srgb"),K!==null){if(Z===L6)return K.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===V6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===B6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===z6)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(K=Q.get("WEBGL_compressed_texture_s3tc"),K!==null){if(Z===L6)return K.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===V6)return K.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===B6)return K.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===z6)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===I6||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===I6)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===_6||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===_6)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 x6(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,L,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,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===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),L=k.envMap,V=k.envMapRotation;if(L){if(F.envMap.value=L,F.envMapRotation.value.setFromMatrix4(l1.makeRotationFromEuler(V)).transpose(),L.isCubeTexture&&L.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,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 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,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=E(k),W[k.id]=V,k.addEventListener("dispose",F);let _=L.program;Z.updateUBOMapping(k,_);let C=Q.render.frame;if(K[k.id]!==C)G(k),K[k.id]=C}function E(k){let L=N();k.__bindingPointIndex=L;let V=J.createBuffer(),_=k.__size,C=k.usage;return J.bindBuffer(J.UNIFORM_BUFFER,V),J.bufferData(J.UNIFORM_BUFFER,_,C),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,L,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 L=W[k.id],V=k.uniforms,_=k.__cache;J.bindBuffer(J.UNIFORM_BUFFER,L);for(let C=0,A=V.length;C<A;C++){let M=Array.isArray(V[C])?V[C]:[V[C]];for(let z=0,y=M.length;z<y;z++){let P=M[z];if(q(P,C,z,_)===!0){let x=P.__offset,u=Array.isArray(P.value)?P.value:[P.value],v=0;for(let l=0;l<u.length;l++){let h=u[l],m=O(h);if(typeof h==="number"||typeof h==="boolean")P.__data[0]=h,J.bufferSubData(J.UNIFORM_BUFFER,x+v,P.__data);else if(h.isMatrix3)P.__data[0]=h.elements[0],P.__data[1]=h.elements[1],P.__data[2]=h.elements[2],P.__data[3]=0,P.__data[4]=h.elements[3],P.__data[5]=h.elements[4],P.__data[6]=h.elements[5],P.__data[7]=0,P.__data[8]=h.elements[6],P.__data[9]=h.elements[7],P.__data[10]=h.elements[8],P.__data[11]=0;else if(ArrayBuffer.isView(h))P.__data.set(new h.constructor(h.buffer,h.byteOffset,P.__data.length));else h.toArray(P.__data,v),v+=m.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,x,P.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function q(k,L,V,_){let C=k.value,A=L+"_"+V;if(_[A]===void 0){if(typeof C==="number"||typeof C==="boolean")_[A]=C;else if(ArrayBuffer.isView(C))_[A]=C.slice();else _[A]=C.clone();return!0}else{let M=_[A];if(typeof C==="number"||typeof C==="boolean"){if(M!==C)return _[A]=C,!0}else if(ArrayBuffer.isView(C))return!0;else if(M.equals(C)===!1)return M.copy(C),!0}return!1}function R(k){let L=k.uniforms,V=0,_=16;for(let A=0,M=L.length;A<M;A++){let z=Array.isArray(L[A])?L[A]:[L[A]];for(let y=0,P=z.length;y<P;y++){let x=z[y],u=Array.isArray(x.value)?x.value:[x.value];for(let v=0,l=u.length;v<l;v++){let h=u[v],m=O(h),a=V%_,W0=a%m.boundary,N0=a+W0;if(V+=W0,N0!==0&&_-N0<m.storage)V+=_-N0;x.__data=new Float32Array(m.storage/Float32Array.BYTES_PER_ELEMENT),x.__offset=V,V+=m.storage}}}let C=V%_;if(C>0)V+=_-C;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)H0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(k))L.boundary=16,L.storage=k.byteLength;else H0("WebGLRenderer: Unsupported uniform value type.",k);return L}function F(k){let L=k.target;L.removeEventListener("dispose",F);let V=Y.indexOf(L.__bindingPointIndex);Y.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]);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=k6,v9.wrapT=k6,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),L=new T,V=null,_=null,C=[],A=[],M=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 z=this,y=!1,P=null;this._outputColorSpace=cK;let x=0,u=0,v=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 T,e=new GJ,L0={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},M0=!1;function x0(){return v===null?t0:1}let S=$;function e0(I,f){return Q.getContext(I,f)}try{let I={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",I),S===null)if(e0("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(I){throw T0("WebGLRenderer: "+I.message),I}let y0,g0,K0,HJ,A0,w,B,b,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(z),b=new HN(S),j=new cD(S,b),i=new $F(S,b,HJ,j),J0=new YF(S,i,b,j,HJ),F0=new KF(S,g0,w),E0=new iD(A0),Z0=new I1(z,B,y0,g0,j,E0),q0=new u1(z,A0),c=new C1,o=new y1(y0),X0=new uD(z,B,K0,J0,q,X),C0=new x1(z,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,z.capabilities=g0,z.extensions=y0,z.properties=A0,z.renderLists=c,z.shadowMap=C0,z.state=K0,z.info=HJ}if(n(),R!==G9)M=new HF(R,Q.width,Q.height,Z,W);let Y0=new J5(z,S);this.xr=Y0,this.getContext=function(){return S},this.getContextAttributes=function(){return S.getContextAttributes()},this.forceContextLoss=function(){let I=y0.get("WEBGL_lose_context");if(I)I.loseContext()},this.forceContextRestore=function(){let I=y0.get("WEBGL_lose_context");if(I)I.restoreContext()},this.getPixelRatio=function(){return t0},this.setPixelRatio=function(I){if(I===void 0)return;t0=I,this.setSize(B0,ZJ,!1)},this.getSize=function(I){return I.set(B0,ZJ)},this.setSize=function(I,f,d=!0){if(Y0.isPresenting){H0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(B0=I,ZJ=f,Q.width=Math.floor(I*t0),Q.height=Math.floor(f*t0),d===!0)Q.style.width=I+"px",Q.style.height=f+"px";if(M!==null)M.setSize(Q.width,Q.height);this.setViewport(0,0,I,f)},this.getDrawingBufferSize=function(I){return I.set(B0*t0,ZJ*t0).floor()},this.setDrawingBufferSize=function(I,f,d){B0=I,ZJ=f,t0=d,Q.width=Math.floor(I*d),Q.height=Math.floor(f*d),this.setViewport(0,0,I,f)},this.setEffects=function(I){if(R===G9){T0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(I){for(let f=0;f<I.length;f++)if(I[f].isOutputPass===!0){H0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}M.setEffects(I||[])},this.getCurrentViewport=function(I){return I.copy(m)},this.getViewport=function(I){return I.copy(P0)},this.setViewport=function(I,f,d,g){if(I.isVector4)P0.set(I.x,I.y,I.z,I.w);else P0.set(I,f,d,g);K0.viewport(m.copy(P0).multiplyScalar(t0).round())},this.getScissor=function(I){return I.copy(G0)},this.setScissor=function(I,f,d,g){if(I.isVector4)G0.set(I.x,I.y,I.z,I.w);else G0.set(I,f,d,g);K0.scissor(a.copy(G0).multiplyScalar(t0).round())},this.getScissorTest=function(){return b0},this.setScissorTest=function(I){K0.setScissorTest(b0=I)},this.setOpaqueSort=function(I){s=I},this.setTransparentSort=function(I){R0=I},this.getClearColor=function(I){return I.copy(X0.getClearColor())},this.setClearColor=function(){X0.setClearColor(...arguments)},this.getClearAlpha=function(){return X0.getClearAlpha()},this.setClearAlpha=function(){X0.setClearAlpha(...arguments)},this.clear=function(I=!0,f=!0,d=!0){let g=0;if(I){let p=!1;if(v!==null){let k0=v.texture.format;p=O.has(k0)}if(p){let k0=v.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 g|=S.COLOR_BUFFER_BIT}if(f)g|=S.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(d)g|=S.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(g!==0)S.clear(g)},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(I){I.setRenderer(this),P=I},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(I){I.preventDefault(),I7("WebGLRenderer: Context Lost."),y=!0}function Q0(){I7("WebGLRenderer: Context Restored."),y=!1;let I=HJ.autoReset,f=C0.enabled,d=C0.autoUpdate,g=C0.needsUpdate,p=C0.type;n(),HJ.autoReset=I,C0.enabled=f,C0.autoUpdate=d,C0.needsUpdate=g,C0.type=p}function v0(I){T0("WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function s0(I){let f=I.target;f.removeEventListener("dispose",s0),_J(f)}function _J(I){EJ(I),A0.remove(I)}function EJ(I){let f=A0.get(I).programs;if(f!==void 0){if(f.forEach(function(d){Z0.releaseProgram(d)}),I.isShaderMaterial)Z0.releaseShaderCache(I)}}this.renderBufferDirect=function(I,f,d,g,p,k0){if(f===null)f=L0;let _0=p.isMesh&&p.matrixWorld.determinant()<0,O0=K5(I,f,d,g,p);K0.setMaterial(g,_0);let S0=d.index,f0=1;if(g.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,g,O0,d,S0);let MJ,DJ=n0;if(S0!==null)MJ=b.get(S0),DJ=a0,DJ.setIndex(MJ);if(p.isMesh)if(g.wireframe===!0)K0.setLineWidth(g.wireframeLinewidth*x0()),DJ.setMode(S.LINES);else DJ.setMode(S.TRIANGLES);else if(p.isLine){let bJ=g.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?b.get(S0).bytesPerElement:1,K9=A0.get(g).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(I,f,d){if(I.transparent===!0&&I.side===k9&&I.forceSinglePass===!1)I.side=cJ,I.needsUpdate=!0,OQ(I,f,d),I.side=l8,I.needsUpdate=!0,OQ(I,f,d),I.side=k9;else OQ(I,f,d)}this.compile=function(I,f,d=null){if(d===null)d=I;if(_=o.get(d),_.init(f),A.push(_),d.traverseVisible(function(p){if(p.isLight&&p.layers.test(f.layers)){if(_.pushLight(p),p.castShadow)_.pushShadow(p)}}),I!==d)I.traverseVisible(function(p){if(p.isLight&&p.layers.test(f.layers)){if(_.pushLight(p),p.castShadow)_.pushShadow(p)}});_.setupLights();let g=new Set;return I.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),g.add(O0)}else B9(k0,d,p),g.add(k0)}),_=A.pop(),g},this.compileAsync=function(I,f,d=null){let g=this.compile(I,f,d);return new Promise((p)=>{function k0(){if(g.forEach(function(_0){if(A0.get(_0).currentProgram.isReady())g.delete(_0)}),g.size===0){p(I);return}setTimeout(k0,10)}if(y0.get("KHR_parallel_shader_compile")!==null)k0();else setTimeout(k0,10)})};let N9=null;function Z5(I){if(N9)N9(I)}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(I){N9=I,Y0.setAnimationLoop(I),I===null?V8.stop():V8.start()},Y0.addEventListener("sessionstart",VX),Y0.addEventListener("sessionend",BX),this.render=function(I,f){if(f!==void 0&&f.isCamera!==!0){T0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(P!==null)P.renderStart(I,f);let d=Y0.enabled===!0&&Y0.isPresenting===!0,g=M!==null&&(v===null||d)&&M.begin(z,v);if(I.matrixWorldAutoUpdate===!0)I.updateMatrixWorld();if(f.parent===null&&f.matrixWorldAutoUpdate===!0)f.updateMatrixWorld();if(Y0.enabled===!0&&Y0.isPresenting===!0&&(M===null||M.isCompositing()===!1)){if(Y0.cameraAutoUpdate===!0)Y0.updateCamera(f);f=Y0.getCamera()}if(I.isScene===!0)I.onBeforeRender(z,I,f,v);if(_=o.get(I,A.length),_.init(f),_.state.textureUnits=w.getTextureUnits(),A.push(_),t.multiplyMatrices(f.projectionMatrix,f.matrixWorldInverse),YJ.setFromProjectionMatrix(t,HZ,f.reversedDepth),l0=this.localClippingEnabled,p0=E0.init(this.clippingPlanes,l0),V=c.get(I,C.length),V.init(),C.push(V),Y0.enabled===!0&&Y0.isPresenting===!0){let _0=z.xr.getDepthSensingMesh();if(_0!==null)GW(_0,f,-1/0,z.sortObjects)}if(GW(I,f,0,z.sortObjects),V.finish(),z.sortObjects===!0)V.sort(s,R0);if(M0=Y0.enabled===!1||Y0.isPresenting===!1||Y0.hasDepthSensing()===!1,M0)X0.addToRenderList(V,I);if(this.info.render.frame++,p0===!0)E0.beginShadows();let p=_.state.shadowsArray;if(C0.render(p,I,f),p0===!0)E0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((g&&M.hasRenderPass())===!1){let{opaque:_0,transmissive:O0}=V;if(_.setupLights(),f.isArrayCamera){let S0=f.cameras;if(O0.length>0)for(let f0=0,i0=S0.length;f0<i0;f0++){let QJ=S0[f0];IX(_0,O0,I,QJ)}if(M0)X0.render(I);for(let f0=0,i0=S0.length;f0<i0;f0++){let QJ=S0[f0];zX(V,I,QJ,QJ.viewport)}}else{if(O0.length>0)IX(_0,O0,I,f);if(M0)X0.render(I);zX(V,I,f)}}if(v!==null&&u===0)w.updateMultisampleRenderTarget(v),w.updateRenderTargetMipmap(v);if(g)M.end(z);if(I.isScene===!0)I.onAfterRender(z,I,f);if(j.resetDefaultState(),l=-1,h=null,A.pop(),A.length>0){if(_=A[A.length-1],w.setTextureUnits(_.state.textureUnits),p0===!0)E0.setGlobalState(z.clippingPlanes,_.state.camera)}else _=null;if(C.pop(),C.length>0)V=C[C.length-1];else V=null;if(P!==null)P.renderEnd()};function GW(I,f,d,g){if(I.visible===!1)return;if(I.layers.test(f.layers)){if(I.isGroup)d=I.renderOrder;else if(I.isLOD){if(I.autoUpdate===!0)I.update(f)}else if(I.isLightProbeGrid)_.pushLightProbeGrid(I);else if(I.isLight){if(_.pushLight(I),I.castShadow)_.pushShadow(I)}else if(I.isSprite){if(!I.frustumCulled||YJ.intersectsSprite(I)){if(g)e.setFromMatrixPosition(I.matrixWorld).applyMatrix4(t);let _0=J0.update(I),O0=I.material;if(O0.visible)V.push(I,_0,O0,d,e.z,null)}}else if(I.isMesh||I.isLine||I.isPoints){if(!I.frustumCulled||YJ.intersectsObject(I)){let _0=J0.update(I),O0=I.material;if(g){if(I.boundingSphere!==void 0){if(I.boundingSphere===null)I.computeBoundingSphere();e.copy(I.boundingSphere.center)}else{if(_0.boundingSphere===null)_0.computeBoundingSphere();e.copy(_0.boundingSphere.center)}e.applyMatrix4(I.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(I,_0,h0,d,e.z,QJ)}}else if(O0.visible)V.push(I,_0,O0,d,e.z,null)}}}let k0=I.children;for(let _0=0,O0=k0.length;_0<O0;_0++)GW(k0[_0],f,d,g)}function zX(I,f,d,g){let{opaque:p,transmissive:k0,transparent:_0}=I;if(_.setupLightsView(d),p0===!0)E0.setGlobalState(z.clippingPlanes,d);if(g)K0.viewport(m.copy(g));if(p.length>0)RQ(p,f,d);if(k0.length>0)RQ(k0,f,d);if(_0.length>0)RQ(_0,f,d);K0.buffers.depth.setTest(!0),K0.buffers.depth.setMask(!0),K0.buffers.color.setMask(!0),K0.setPolygonOffset(!1)}function IX(I,f,d,g){if((d.isScene===!0?d.overrideMaterial:null)!==null)return;if(_.state.transmissionRenderTarget[g.id]===void 0){let h0=y0.has("EXT_color_buffer_half_float")||y0.has("EXT_color_buffer_float");_.state.transmissionRenderTarget[g.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[g.id],_0=g.viewport||m;k0.setSize(_0.z*z.transmissionResolutionScale,_0.w*z.transmissionResolutionScale);let O0=z.getRenderTarget(),S0=z.getActiveCubeFace(),f0=z.getActiveMipmapLevel();if(z.setRenderTarget(k0),z.getClearColor(N0),j0=z.getClearAlpha(),j0<1)z.setClearColor(16777215,0.5);if(z.clear(),M0)X0.render(d);let i0=z.toneMapping;z.toneMapping=U9;let QJ=g.viewport;if(g.viewport!==void 0)g.viewport=void 0;if(_.setupLightsView(g),p0===!0)E0.setGlobalState(z.clippingPlanes,g);if(RQ(I,d,g),w.updateMultisampleRenderTarget(k0),w.updateRenderTargetMipmap(k0),y0.has("WEBGL_multisampled_render_to_texture")===!1){let h0=!1;for(let NJ=0,BJ=f.length;NJ<BJ;NJ++){let MJ=f[NJ],{object:DJ,geometry:bJ,material:I0,group:tJ}=MJ;if(I0.side===k9&&DJ.layers.test(g.layers)){let XJ=I0.side;I0.side=cJ,I0.needsUpdate=!0,_X(DJ,d,g,bJ,I0,tJ),I0.side=XJ,I0.needsUpdate=!0,h0=!0}}if(h0===!0)w.updateMultisampleRenderTarget(k0),w.updateRenderTargetMipmap(k0)}if(z.setRenderTarget(O0,S0,f0),z.setClearColor(N0,j0),QJ!==void 0)g.viewport=QJ;z.toneMapping=i0}function RQ(I,f,d){let g=f.isScene===!0?f.overrideMaterial:null;for(let p=0,k0=I.length;p<k0;p++){let _0=I[p],{object:O0,geometry:S0,group:f0}=_0,i0=_0.material;if(i0.allowOverride===!0&&g!==null)i0=g;if(O0.layers.test(d.layers))_X(O0,f,d,S0,i0,f0)}}function _X(I,f,d,g,p,k0){if(I.onBeforeRender(z,f,d,g,p,k0),I.modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),p.onBeforeRender(z,f,d,g,I,k0),p.transparent===!0&&p.side===k9&&p.forceSinglePass===!1)p.side=cJ,p.needsUpdate=!0,z.renderBufferDirect(d,f,g,p,I,k0),p.side=l8,p.needsUpdate=!0,z.renderBufferDirect(d,f,g,p,I,k0),p.side=k9;else z.renderBufferDirect(d,f,g,p,I,k0);I.onAfterRender(z,f,d,g,p,k0)}function OQ(I,f,d){if(f.isScene!==!0)f=L0;let g=A0.get(I),p=_.state.lights,k0=_.state.shadowsArray,_0=p.state.version,O0=Z0.getParameters(I,p.state,k0,f,d,_.state.lightProbeGridArray),S0=Z0.getProgramCacheKey(O0),f0=g.programs;g.environment=I.isMeshStandardMaterial||I.isMeshLambertMaterial||I.isMeshPhongMaterial?f.environment:null,g.fog=f.fog;let i0=I.isMeshStandardMaterial||I.isMeshLambertMaterial&&!I.envMap||I.isMeshPhongMaterial&&!I.envMap;if(g.envMap=B.get(I.envMap||g.environment,i0),g.envMapRotation=g.environment!==null&&I.envMap===null?f.environmentRotation:I.envMapRotation,f0===void 0)I.addEventListener("dispose",s0),f0=new Map,g.programs=f0;let QJ=f0.get(S0);if(QJ!==void 0){if(g.currentProgram===QJ&&g.lightsStateVersion===_0)return CX(I,O0),QJ}else{if(O0.uniforms=Z0.getUniforms(I),P!==null&&I.isNodeMaterial)P.build(I,d,O0);I.onBeforeCompile(O0,z),QJ=Z0.acquireProgram(O0,S0),f0.set(S0,QJ),g.uniforms=O0.uniforms}let h0=g.uniforms;if(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)h0.clippingPlanes=E0.uniform;if(CX(I,O0),g.needsLights=X5(I),g.lightsStateVersion=_0,g.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 g.lightProbeGrid=_.state.lightProbeGridArray.length>0,g.currentProgram=QJ,g.uniformsList=null,QJ}function AX(I){if(I.uniformsList===null){let f=I.currentProgram.getUniforms();I.uniformsList=FQ.seqWithValue(f.seq,I.uniforms)}return I.uniformsList}function CX(I,f){let d=A0.get(I);d.outputColorSpace=f.outputColorSpace,d.batching=f.batching,d.batchingColor=f.batchingColor,d.instancing=f.instancing,d.instancingColor=f.instancingColor,d.instancingMorph=f.instancingMorph,d.skinning=f.skinning,d.morphTargets=f.morphTargets,d.morphNormals=f.morphNormals,d.morphColors=f.morphColors,d.morphTargetsCount=f.morphTargetsCount,d.numClippingPlanes=f.numClippingPlanes,d.numIntersection=f.numClipIntersection,d.vertexAlphas=f.vertexAlphas,d.vertexTangents=f.vertexTangents,d.toneMapping=f.toneMapping}function W5(I,f){if(I.length===0)return null;if(I.length===1)return I[0].texture!==null?I[0]:null;L.setFromMatrixPosition(f.matrixWorld);for(let d=0,g=I.length;d<g;d++){let p=I[d];if(p.texture!==null&&p.boundingBox.containsPoint(L))return p}return null}function K5(I,f,d,g,p){if(f.isScene!==!0)f=L0;w.resetTextureUnits();let k0=f.fog,_0=g.isMeshStandardMaterial||g.isMeshLambertMaterial||g.isMeshPhongMaterial?f.environment:null,O0=v===null?z.outputColorSpace:v.isXRRenderTarget===!0?v.texture.colorSpace:$J.workingColorSpace,S0=g.isMeshStandardMaterial||g.isMeshLambertMaterial&&!g.envMap||g.isMeshPhongMaterial&&!g.envMap,f0=B.get(g.envMap||_0,S0),i0=g.vertexColors===!0&&!!d.attributes.color&&d.attributes.color.itemSize===4,QJ=!!d.attributes.tangent&&(!!g.normalMap||g.anisotropy>0),h0=!!d.morphAttributes.position,NJ=!!d.morphAttributes.normal,BJ=!!d.morphAttributes.color,MJ=U9;if(g.toneMapped){if(v===null||v.isXRRenderTarget===!0)MJ=z.toneMapping}let DJ=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,bJ=DJ!==void 0?DJ.length:0,I0=A0.get(g),tJ=_.state.lights;if(p0===!0){if(l0===!0||I!==h){let RJ=I===h&&g.id===l;E0.setState(g,I,RJ)}}let XJ=!1;if(g.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(g.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=g.version;let K9=I0.currentProgram;if(XJ===!0){if(K9=OQ(g,f,p),P&&g.isNodeMaterial)P.onUpdateProgram(g,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(g.id!==l)l=g.id,a9=!0;if(I0.needsLights){let RJ=W5(_.state.lightProbeGridArray,p);if(I0.lightProbeGrid!==RJ)I0.lightProbeGrid=RJ,a9=!0}if(z9||h!==I){if(K0.buffers.depth.getReversed()&&I.reversedDepth!==!0)I._reversedDepth=!0,I.updateProjectionMatrix();FJ.setValue(S,"projectionMatrix",I.projectionMatrix),FJ.setValue(S,"viewMatrix",I.matrixWorldInverse);let t9=FJ.map.cameraPosition;if(t9!==void 0)t9.setValue(S,$0.setFromMatrixPosition(I.matrixWorld));if(g0.logarithmicDepthBuffer)FJ.setValue(S,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2));if(g.isMeshPhongMaterial||g.isMeshToonMaterial||g.isMeshLambertMaterial||g.isMeshBasicMaterial||g.isMeshStandardMaterial||g.isShaderMaterial)FJ.setValue(S,"isOrthographic",I.isOrthographicCamera===!0);if(h!==I)h=I,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((g.isMeshStandardMaterial||g.isMeshLambertMaterial||g.isMeshPhongMaterial)&&g.envMap===null&&f.environment!==null)zJ.envMapIntensity.value=f.environmentIntensity;if(zJ.dfgLUT!==void 0)zJ.dfgLUT.value=s1();if(a9){if(FJ.setValue(S,"toneMappingExposure",z.toneMappingExposure),I0.needsLights)Y5(zJ,e8);if(k0&&g.fog===!0)q0.refreshFogUniforms(zJ,k0);if(q0.refreshMaterialUniforms(zJ,g,t0,ZJ,_.state.transmissionRenderTarget[I.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)}FQ.upload(S,AX(I0),zJ,w)}if(g.isShaderMaterial&&g.uniformsNeedUpdate===!0)FQ.upload(S,AX(I0),zJ,w),g.uniformsNeedUpdate=!1;if(g.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),g.uniformsGroups!==void 0){let RJ=g.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(I,f){I.ambientLightColor.needsUpdate=f,I.lightProbe.needsUpdate=f,I.directionalLights.needsUpdate=f,I.directionalLightShadows.needsUpdate=f,I.pointLights.needsUpdate=f,I.pointLightShadows.needsUpdate=f,I.spotLights.needsUpdate=f,I.spotLightShadows.needsUpdate=f,I.rectAreaLights.needsUpdate=f,I.hemisphereLights.needsUpdate=f}function X5(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return u},this.getRenderTarget=function(){return v},this.setRenderTargetTextures=function(I,f,d){let g=A0.get(I);if(g.__autoAllocateDepthBuffer=I.resolveDepthBuffer===!1,g.__autoAllocateDepthBuffer===!1)g.__useRenderToTexture=!1;A0.get(I.texture).__webglTexture=f,A0.get(I.depthTexture).__webglTexture=g.__autoAllocateDepthBuffer?void 0:d,g.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(I,f){let d=A0.get(I);d.__webglFramebuffer=f,d.__useDefaultFramebuffer=f===void 0};let H5=S.createFramebuffer();this.setRenderTarget=function(I,f=0,d=0){v=I,x=f,u=d;let g=null,p=!1,k0=!1;if(I){let O0=A0.get(I);if(O0.__useDefaultFramebuffer!==void 0){K0.bindFramebuffer(S.FRAMEBUFFER,O0.__webglFramebuffer),m.copy(I.viewport),a.copy(I.scissor),W0=I.scissorTest,K0.viewport(m),K0.scissor(a),K0.setScissorTest(W0),l=-1;return}else if(O0.__webglFramebuffer===void 0)w.setupRenderTarget(I);else if(O0.__hasExternalTextures)w.rebindTextures(I,A0.get(I.texture).__webglTexture,A0.get(I.depthTexture).__webglTexture);else if(I.depthBuffer){let i0=I.depthTexture;if(O0.__boundDepthTexture!==i0){if(i0!==null&&A0.has(i0)&&(I.width!==i0.image.width||I.height!==i0.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");w.setupDepthRenderbuffer(I)}}let S0=I.texture;if(S0.isData3DTexture||S0.isDataArrayTexture||S0.isCompressedArrayTexture)k0=!0;let f0=A0.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget){if(Array.isArray(f0[f]))g=f0[f][d];else g=f0[f];p=!0}else if(I.samples>0&&w.useMultisampledRTT(I)===!1)g=A0.get(I).__webglMultisampledFramebuffer;else if(Array.isArray(f0))g=f0[d];else g=f0;m.copy(I.viewport),a.copy(I.scissor),W0=I.scissorTest}else m.copy(P0).multiplyScalar(t0).floor(),a.copy(G0).multiplyScalar(t0).floor(),W0=b0;if(d!==0)g=H5;if(K0.bindFramebuffer(S.FRAMEBUFFER,g))K0.drawBuffers(I,g);if(K0.viewport(m),K0.scissor(a),K0.setScissorTest(W0),p){let O0=A0.get(I.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_CUBE_MAP_POSITIVE_X+f,O0.__webglTexture,d)}else if(k0){let O0=f;for(let S0=0;S0<I.textures.length;S0++){let f0=A0.get(I.textures[S0]);S.framebufferTextureLayer(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0+S0,f0.__webglTexture,d,O0)}}else if(I!==null&&d!==0){let O0=A0.get(I.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,O0.__webglTexture,d)}l=-1},this.readRenderTargetPixels=function(I,f,d,g,p,k0,_0,O0=0){if(!(I&&I.isWebGLRenderTarget)){T0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let S0=A0.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&_0!==void 0)S0=S0[_0];if(S0){K0.bindFramebuffer(S.FRAMEBUFFER,S0);try{let f0=I.textures[O0],i0=f0.format,QJ=f0.type;if(I.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(f>=0&&f<=I.width-g&&(d>=0&&d<=I.height-p))S.readPixels(f,d,g,p,JJ.convert(i0),JJ.convert(QJ),k0)}finally{let f0=v!==null?A0.get(v).__webglFramebuffer:null;K0.bindFramebuffer(S.FRAMEBUFFER,f0)}}},this.readRenderTargetPixelsAsync=async function(I,f,d,g,p,k0,_0,O0=0){if(!(I&&I.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let S0=A0.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&_0!==void 0)S0=S0[_0];if(S0)if(f>=0&&f<=I.width-g&&(d>=0&&d<=I.height-p)){K0.bindFramebuffer(S.FRAMEBUFFER,S0);let f0=I.textures[O0],i0=f0.format,QJ=f0.type;if(I.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(f,d,g,p,JJ.convert(i0),JJ.convert(QJ),0);let NJ=v!==null?A0.get(v).__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(I,f=null,d=0){let g=Math.pow(2,-d),p=Math.floor(I.image.width*g),k0=Math.floor(I.image.height*g),_0=f!==null?f.x:0,O0=f!==null?f.y:0;w.setTexture2D(I,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(I,f,d=null,g=null,p=0,k0=0){let _0,O0,S0,f0,i0,QJ,h0,NJ,BJ,MJ=I.isCompressedTexture?I.mipmaps[k0]:I.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),I.isDataArrayTexture)S0=MJ.depth;else if(I.isData3DTexture)S0=Math.floor(MJ.depth*zJ);else S0=1;f0=0,i0=0,QJ=0}if(g!==null)h0=g.x,NJ=g.y,BJ=g.z;else h0=0,NJ=0,BJ=0;let DJ=JJ.convert(f.format),bJ=JJ.convert(f.type),I0;if(f.isData3DTexture)w.setTexture3D(f,0),I0=S.TEXTURE_3D;else if(f.isDataArrayTexture||f.isCompressedArrayTexture)w.setTexture2DArray(f,0),I0=S.TEXTURE_2D_ARRAY;else w.setTexture2D(f,0),I0=S.TEXTURE_2D;K0.activeTexture(S.TEXTURE0),K0.pixelStorei(S.UNPACK_FLIP_Y_WEBGL,f.flipY),K0.pixelStorei(S.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),K0.pixelStorei(S.UNPACK_ALIGNMENT,f.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=I.isDataArrayTexture||I.isData3DTexture,FJ=f.isDataArrayTexture||f.isData3DTexture;if(I.isDepthTexture){let zJ=A0.get(I),r9=A0.get(f),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(I).__webglTexture,p,QJ+J7),S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,A0.get(f).__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||I.isRenderTargetTexture||A0.has(I)){let zJ=A0.get(I),r9=A0.get(f);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(I.isDataTexture||I.isData3DTexture)S.texSubImage3D(I0,k0,h0,NJ,BJ,_0,O0,S0,DJ,bJ,MJ.data);else if(f.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(I.isDataTexture)S.texSubImage2D(S.TEXTURE_2D,k0,h0,NJ,_0,O0,DJ,bJ,MJ.data);else if(I.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&&f.generateMipmaps)S.generateMipmap(I0);K0.unbindTexture()},this.initRenderTarget=function(I){if(A0.get(I).__webglFramebuffer===void 0)w.setupRenderTarget(I)},this.initTexture=function(I){if(I.isCubeTexture)w.setTextureCube(I,0);else if(I.isData3DTexture)w.setTexture3D(I,0);else if(I.isDataArrayTexture||I.isCompressedArrayTexture)w.setTexture2DArray(I,0);else w.setTexture2D(I,0);K0.unbindTexture()},this.resetState=function(){x=0,u=0,v=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
358
  #endif`,GN=`#ifdef USE_ALPHAHASH
359
359
  const float ALPHA_HASH_SCALE = 0.05;
@@ -4015,7 +4015,7 @@ void main() {
4015
4015
  #include <tonemapping_fragment>
4016
4016
  #include <colorspace_fragment>
4017
4017
  #include <fog_fragment>
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() {
4018
+ }`,r0,D0,V9,WW,lD,dG,L8=4,MG,t8=20,oD=256,NQ,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() {
4019
4019
  gl_Position = vec4( position, 1.0 );
4020
4020
  }`,f1=`uniform sampler2D shadow_pass;
4021
4021
  uniform vec2 resolution;
@@ -4042,7 +4042,7 @@ void main() {
4042
4042
  squared_mean = squared_mean / samples;
4043
4043
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4044
4044
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4045
- }`,b1,h1,pG,EQ,FX,m1=`
4045
+ }`,b1,h1,pG,qQ,FX,m1=`
4046
4046
  void main() {
4047
4047
 
4048
4048
  gl_Position = vec4( position, 1.0 );
@@ -4066,7 +4066,7 @@ void main() {
4066
4066
 
4067
4067
  }
4068
4068
 
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:`
4069
+ }`,J5,l1,Q5,n1,v9=null;var s7=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 T},probesMax:{value:new T},probesResolution:{value:new T}},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 T},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],NQ=new r8,LG=new V0,aD=new T;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:`
4070
4070
 
4071
4071
  varying vec3 vWorldDirection;
4072
4072
 
@@ -4101,7 +4101,7 @@ void main() {
4101
4101
  gl_FragColor = texture2D( tEquirect, sampleUV );
4102
4102
 
4103
4103
  }
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};
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 T;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 T(1,0,0),new T(-1,0,0),new T(0,1,0),new T(0,-1,0),new T(0,0,1),new T(0,0,-1)],h1=[new T(0,-1,0),new T(0,-1,0),new T(0,0,1),new T(0,0,-1),new T(0,-1,0),new T(0,-1,0)],pG=new d0,qQ=new T,FX=new T;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,L=null,V=[],_=[],C=new r,A=null,M=new CJ;M.viewport=new GJ;let z=new CJ;z.viewport=new GJ;let y=[M,z],P=new aZ,x=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 v(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",v),Z.removeEventListener("selectstart",v),Z.removeEventListener("selectend",v),Z.removeEventListener("squeeze",v),Z.removeEventListener("squeezestart",v),Z.removeEventListener("squeezeend",v),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)}x=null,u=null,O.reset();for(let s in F)delete F[s];J.setRenderTarget(k),G=null,N=null,E=null,Z=null,L=null,t0.stop(),$.isPresenting=!1,J.setPixelRatio(A),J.setSize(C.width,C.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",v),Z.addEventListener("selectstart",v),Z.addEventListener("selectend",v),Z.addEventListener("squeeze",v),Z.addEventListener("squeezestart",v),Z.addEventListener("squeezeend",v),Z.addEventListener("end",l),Z.addEventListener("inputsourceschange",h),D.xrCompatible!==!0)await Q.makeXRCompatible();if(A=J.getPixelRatio(),J.getSize(C),!(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),L=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),L=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})}L.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 T,a=new T;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(P.near=z.near=M.near=R0,P.far=z.far=M.far=P0,x!==P.near||u!==P.far)Z.updateRenderState({depthNear:P.near,depthFar:P.far}),x=P.near,u=P.far;P.layers.mask=s.layers.mask|6,M.layers.mask=P.layers.mask&-5,z.layers.mask=P.layers.mask&-3;let G0=s.parent,b0=P.cameras;N0(P,G0);for(let YJ=0;YJ<b0.length;YJ++)N0(b0[YJ],G0);if(b0.length===2)W0(P,M,z);else P.projectionMatrix.copy(M.projectionMatrix);j0(s,P,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 P},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(P)},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(L,G.framebuffer),J.setRenderTarget(L);let G0=!1;if(P0.length!==P.cameras.length)P.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(L,L0.colorTexture,L0.depthStencilTexture),J.setRenderTarget(L)}let e=y[l0];if(e===void 0)e=new CJ,e.layers.enable(l0),e.viewport=new GJ,y[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)P.matrix.copy(e.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale);if(G0===!0)P.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 x6,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,W,K,Y){Z.set(Q.x,Q.y,Q.z),W.set(Q.rx,Q.ry,Q.rz,"XYZ"),K.setFromEuler(W),Y.set(Q.sx,Q.sy,Q.sz),J.matrix.compose(Z,K,Y),J.matrixWorld.copy(J.matrix),J.visible=$.visible}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=null,E=null,N=null,G=null,q=!(("renderer"in J)&&J.renderer!==void 0);return i1("renderer3d").withComponentTypes().withEventTypes().withResourceTypes().withLabels().withGroups().withReactiveQueryNames().install((R)=>{if(R.installPlugin(o1(Z)),q){let O=J,{background:F,width:D,height:k,antialias:L=!0,shadows:V=!1,cameraOptions:_,threeInit:C}=O,A=O.container??document.body;R.addResource("threeRenderer",async()=>{let{WebGLRenderer:M}=await Promise.resolve().then(() => (s7(),n7)),z=typeof A==="string"?document.querySelector(A):A,y={antialias:L,powerPreference:"high-performance",...C},P=new M(y);if(V)P.shadowMap.enabled=!0;let x=D??z?.clientWidth??window.innerWidth,u=k??z?.clientHeight??window.innerHeight;if(P.setSize(x,u),z)z.appendChild(P.domElement);else if(typeof A==="string")console.warn(`Renderer3D plugin: container selector "${A}" not found`);return P}),R.addResource("scene",{dependsOn:["threeRenderer"],factory:async()=>{let{Scene:M,Color:z}=await Promise.resolve().then(() => (s7(),n7)),y=new M;if(F!==void 0)y.background=new z(F);return y}}),R.addResource("camera",{dependsOn:["threeRenderer"],factory:async(M)=>{let z=M.getResource("threeRenderer"),y=z.domElement.width/z.domElement.height,P=_?.near??0.1,x=_?.far??1000,u;if(_?.projection==="orthographic"){let{OrthographicCamera:v}=await Promise.resolve().then(() => (s7(),n7)),h=(_.viewSize??10)/2,m=h*y,a=new v(-m,m,h,-h,P,x);a.zoom=_.zoom??1,a.updateProjectionMatrix(),u=a}else{let{PerspectiveCamera:v}=await Promise.resolve().then(() => (s7(),n7)),l=_?.fov??75;u=new v(l,y,P,x)}if(_?.position)u.position.set(_.position.x,_.position.y,_.position.z);if(_?.lookAt)u.lookAt(_.lookAt.x,_.lookAt.y,_.lookAt.z);return u}})}else{let O=J;R.addResource("threeRenderer",O.renderer),R.addResource("scene",O.scene),R.addResource("camera",O.camera)}R.registerDispose("mesh",({value:O})=>{if(O.parent)O.parent.remove(O)}),R.registerDispose("group",({value:O})=>{if(O.parent)O.parent.remove(O)}),R.registerDispose("object3d",({value:O})=>{if(O.parent)O.parent.remove(O)}),R.registerRequired("mesh","localTransform3D",()=>({...kX})),R.registerRequired("mesh","visible3d",()=>({visible:!0})),R.registerRequired("group","localTransform3D",()=>({...kX})),R.registerRequired("group","visible3d",()=>({visible:!0})),R.registerRequired("object3d","localTransform3D",()=>({...kX})),R.registerRequired("object3d","visible3d",()=>({visible:!0})),R.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:O})=>{let F=U,D=E,k=N,L=G;if(!F||!D||!k||!L)return;for(let V of O.meshes){let{mesh:_,worldTransform3D:C,visible3d:A}=V.components;MX(_,C,A,F,D,k,L)}for(let V of O.groups){let{group:_,worldTransform3D:C,visible3d:A}=V.components;MX(_,C,A,F,D,k,L)}for(let V of O.objects){let{object3d:_,worldTransform3D:C,visible3d:A}=V.components;MX(_,C,A,F,D,k,L)}}),R.addSystem("renderer3d-scene-graph").setPriority(9999).inGroup(Q).setOnInitialize(async(O)=>{let{Vector3:F,Euler:D,Quaternion:k}=await Promise.resolve().then(() => (s7(),n7));U=new F,E=new D,N=new k,G=new F;let L=O.getResource("scene"),V=O.getResource("threeRenderer"),_=O.getResource("camera");Y=V,X=L,H=_;function C(M,z){z.matrixAutoUpdate=!1,z.matrixWorldAutoUpdate=!1,K.set(M,z),L.add(z)}O.addReactiveQuery("renderer3d-meshes",{with:["mesh"],onEnter:(M)=>{C(M.id,M.components.mesh)},onExit:(M)=>{K.delete(M)}}),O.addReactiveQuery("renderer3d-groups",{with:["group"],onEnter:(M)=>{C(M.id,M.components.group)},onExit:(M)=>{K.delete(M)}}),O.addReactiveQuery("renderer3d-objects",{with:["object3d"],onEnter:(M)=>{C(M.id,M.components.object3d)},onExit:(M)=>{K.delete(M)}}),O.on("hierarchyChanged",({entityId:M})=>{let z=K.get(M);if(!z)return;if(z.parent!==L)L.add(z)});let A=()=>{let M=V.domElement.parentElement?.clientWidth??window.innerWidth,z=V.domElement.parentElement?.clientHeight??window.innerHeight;if(V.setSize(M,z),_.isPerspectiveCamera){let y=_;y.aspect=M/z,y.updateProjectionMatrix()}else if(_.isOrthographicCamera){let y=_,P=(y.top-y.bottom)/2,x=P*(M/z);y.left=-x,y.right=x,y.top=P,y.bottom=-P,y.updateProjectionMatrix()}};if(window.addEventListener("resize",A),W){let M=0,z=(y)=>{requestAnimationFrame(z);let P=M===0?0:(y-M)/1000;M=y,O.update(P)};requestAnimationFrame(z)}}),R.addSystem("renderer3d-render").setPriority(0).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};
4105
4105
 
4106
- //# debugId=542261026831CFD164756E2164756E21
4106
+ //# debugId=D79B33B5D2E4AC3F64756E2164756E21
4107
4107
  //# sourceMappingURL=renderer3D.js.map