humemory 0.2.16 → 0.2.26
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.
- package/AGENTS.md +3 -3
- package/CHANGELOG.md +66 -0
- package/README.md +26 -2
- package/dist/agent/mcp-client-setup.d.ts +3 -1
- package/dist/agent/mcp-client-setup.js +85 -8
- package/dist/api/intentions-routes.js +4 -1
- package/dist/cli/index.js +14 -8
- package/dist/core/cue-arg.js +3 -0
- package/dist/core/cues.js +2 -0
- package/package.json +14 -14
- package/public/app/galaxy-bnqbm7cf.js +10 -0
- package/public/app/{index-gbfwa9vq.js → index-18hnqcxx.js} +1 -1
- package/public/app/index-23jznef0.js +2 -0
- package/public/app/{index-0fw784fa.js → index-5gn06sf9.js} +6 -6
- package/public/app/{index-5kwkpwkp.js → index-xv716176.js} +1 -1
- package/public/app/index.html +1 -1
- package/public/app/{promenade-fa0tb6jx.js → promenade-b9k933ve.js} +1 -1
- package/public/app/river-h2jckhks.js +5 -0
- package/src/agent/mcp-client-setup.ts +84 -10
- package/src/api/intentions-routes.ts +4 -0
- package/src/cli/index.ts +14 -8
- package/src/core/cue-arg.ts +2 -0
- package/src/core/cues.ts +1 -0
- package/public/app/galaxy-cgbkc6e1.js +0 -10
- package/public/app/index-epqg22cp.js +0 -1
- package/public/app/river-01hs4f06.js +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as ZK}from"./index-gbfwa9vq.js";import{D as WK}from"./index-5kwkpwkp.js";var NW="184";var EW=0,u6=1,qW=2;var x8=1,DW=2,k8=3,M8=0,jJ=1,Q9=2,$9=0,g8=1,c6=2,n6=3,s6=4,FW=5;var L8=100,OW=101,RW=102,kW=103,MW=104,LW=200,VW=201,BW=202,zW=203,IW=204,_W=205,AW=206,wW=207,CW=208,PW=209,TW=210,SW=211,jW=212,yW=213,vW=214,fW=0,bW=1,hW=2,i6=3,xW=4,gW=5,pW=6,mW=7,dW=0,lW=1,uW=2,oJ=0,o6=1,a6=2,r6=3,t6=4,e6=5,JQ=6,QQ=7;var V8=301,h9=302,b7=303,h7=304,p8=306,cW=1000,x7=1001,nW=1002,C9=1003,sW=1004;var m8=1005;var yJ=1006,g7=1007;var x9=1008;var aJ=1009,iW=1010,oW=1011,d8=1012,$Q=1013,P9=1014,q9=1015,D9=1016,WQ=1017,ZQ=1018,B8=1020,aW=35902,rW=35899,tW=1021,eW=1022,W9=1023,g9=1026,p9=1027,JZ=1028,KQ=1029,m9=1030,YQ=1031;var HQ=1033,p7=33776,m7=33777,d7=33778,l7=33779,XQ=35840,UQ=35841,GQ=35842,NQ=35843,EQ=36196,qQ=37492,DQ=37496,FQ=37488,OQ=37489,u7=37490,RQ=37491,kQ=37808,MQ=37809,LQ=37810,VQ=37811,BQ=37812,zQ=37813,IQ=37814,_Q=37815,AQ=37816,wQ=37817,CQ=37818,PQ=37819,TQ=37820,SQ=37821,jQ=36492,yQ=36494,vQ=36495,fQ=36283,bQ=36284,c7=36285,hQ=36286;var xQ=0,QZ=1,d9="",$Z="srgb",gQ="srgb-linear",pQ="linear",ZJ="srgb";var WZ=512,ZZ=513,KZ=514,n7=515,YZ=516,HZ=517,s7=518,XZ=519;var mQ="300 es",dQ=2000;function qK(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function DK(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function f8(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function UZ(){let J=f8("canvas");return J.style.display="block",J}var h$={},R8=null;function b8(...J){let Q="THREE."+J.shift();if(R8)R8("log",Q,...J);else console.log(Q,...J)}function GZ(J){let Q=J[0];if(typeof Q==="string"&&Q.startsWith("TSL:")){let $=J[1];if($&&$.isStackTrace)J[0]+=" "+$.getLocation();else J[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return J}function C0(...J){J=GZ(J);let Q="THREE."+J.shift();if(R8)R8("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function T0(...J){J=GZ(J);let Q="THREE."+J.shift();if(R8)R8("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function j7(...J){let Q=J.join(" ");if(Q in h$)return;h$[Q]=!0,C0(...J)}function NZ(J,Q,$){return new Promise(function(W,Z){function K(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:Z();break;case J.TIMEOUT_EXPIRED:setTimeout(K,$);break;default:W()}}setTimeout(K,$)})}var EZ={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class F9{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 W=$[J];if(W!==void 0){let Z=W.indexOf(Q);if(Z!==-1)W.splice(Z,1)}}dispatchEvent(J){let Q=this._listeners;if(Q===void 0)return;let $=Q[J.type];if($!==void 0){J.target=this;let W=$.slice(0);for(let Z=0,K=W.length;Z<K;Z++)W[Z].call(this,J);J.target=null}}}var _J=["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"];var R6=Math.PI/180,y7=180/Math.PI;function w9(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,W=Math.random()*4294967295|0;return(_J[J&255]+_J[J>>8&255]+_J[J>>16&255]+_J[J>>24&255]+"-"+_J[Q&255]+_J[Q>>8&255]+"-"+_J[Q>>16&15|64]+_J[Q>>24&255]+"-"+_J[$&63|128]+_J[$>>8&255]+"-"+_J[$>>16&255]+_J[$>>24&255]+_J[W&255]+_J[W>>8&255]+_J[W>>16&255]+_J[W>>24&255]).toLowerCase()}function o0(J,Q,$){return Math.max(Q,Math.min($,J))}function FK(J,Q){return(J%Q+Q)%Q}function k6(J,Q,$){return(1-$)*J+$*Q}function J9(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return J/4294967295;case Uint16Array:return J/65535;case Uint8Array:return J/255;case Int32Array:return Math.max(J/2147483647,-1);case Int16Array:return Math.max(J/32767,-1);case Int8Array:return Math.max(J/127,-1);default:throw Error("Invalid component type.")}}function QJ(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return Math.round(J*4294967295);case Uint16Array:return Math.round(J*65535);case Uint8Array:return Math.round(J*255);case Int32Array:return Math.round(J*2147483647);case Int16Array:return Math.round(J*32767);case Int8Array:return Math.round(J*127);default:throw Error("Invalid component type.")}}class h0{static{h0.prototype.isVector2=!0}constructor(J=0,Q=0){this.x=J,this.y=Q}get width(){return this.x}set width(J){this.x=J}get height(){return this.y}set height(J){this.y=J}set(J,Q){return this.x=J,this.y=Q,this}setScalar(J){return this.x=J,this.y=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y)}copy(J){return this.x=J.x,this.y=J.y,this}add(J){return this.x+=J.x,this.y+=J.y,this}addScalar(J){return this.x+=J,this.y+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this}subScalar(J){return this.x-=J,this.y-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this}multiply(J){return this.x*=J.x,this.y*=J.y,this}multiplyScalar(J){return this.x*=J,this.y*=J,this}divide(J){return this.x/=J.x,this.y/=J.y,this}divideScalar(J){return this.multiplyScalar(1/J)}applyMatrix3(J){let Q=this.x,$=this.y,W=J.elements;return this.x=W[0]*Q+W[3]*$+W[6],this.y=W[1]*Q+W[4]*$+W[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=o0(this.x,J.x,Q.x),this.y=o0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=o0(this.x,J,Q),this.y=o0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(o0($,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(o0($,-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),W=Math.sin(Q),Z=this.x-J.x,K=this.y-J.y;return this.x=Z*$-K*W+J.x,this.y=Z*W+K*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class O9{constructor(J=0,Q=0,$=0,W=1){this.isQuaternion=!0,this._x=J,this._y=Q,this._z=$,this._w=W}static slerpFlat(J,Q,$,W,Z,K,Y){let H=$[W+0],X=$[W+1],U=$[W+2],q=$[W+3],E=Z[K+0],G=Z[K+1],F=Z[K+2],k=Z[K+3];if(q!==k||H!==E||X!==G||U!==F){let z=H*E+X*G+U*F+q*k;if(z<0)E=-E,G=-G,F=-F,k=-k,z=-z;let N=1-Y;if(z<0.9995){let D=Math.acos(z),V=Math.sin(D);N=Math.sin(N*D)/V,Y=Math.sin(Y*D)/V,H=H*N+E*Y,X=X*N+G*Y,U=U*N+F*Y,q=q*N+k*Y}else{H=H*N+E*Y,X=X*N+G*Y,U=U*N+F*Y,q=q*N+k*Y;let D=1/Math.sqrt(H*H+X*X+U*U+q*q);H*=D,X*=D,U*=D,q*=D}}J[Q]=H,J[Q+1]=X,J[Q+2]=U,J[Q+3]=q}static multiplyQuaternionsFlat(J,Q,$,W,Z,K){let Y=$[W],H=$[W+1],X=$[W+2],U=$[W+3],q=Z[K],E=Z[K+1],G=Z[K+2],F=Z[K+3];return J[Q]=Y*F+U*q+H*G-X*E,J[Q+1]=H*F+U*E+X*q-Y*G,J[Q+2]=X*F+U*G+Y*E-H*q,J[Q+3]=U*F-Y*q-H*E-X*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,$,W){return this._x=J,this._y=Q,this._z=$,this._w=W,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:W,_z:Z,_order:K}=J,Y=Math.cos,H=Math.sin,X=Y($/2),U=Y(W/2),q=Y(Z/2),E=H($/2),G=H(W/2),F=H(Z/2);switch(K){case"XYZ":this._x=E*U*q+X*G*F,this._y=X*G*q-E*U*F,this._z=X*U*F+E*G*q,this._w=X*U*q-E*G*F;break;case"YXZ":this._x=E*U*q+X*G*F,this._y=X*G*q-E*U*F,this._z=X*U*F-E*G*q,this._w=X*U*q+E*G*F;break;case"ZXY":this._x=E*U*q-X*G*F,this._y=X*G*q+E*U*F,this._z=X*U*F+E*G*q,this._w=X*U*q-E*G*F;break;case"ZYX":this._x=E*U*q-X*G*F,this._y=X*G*q+E*U*F,this._z=X*U*F-E*G*q,this._w=X*U*q+E*G*F;break;case"YZX":this._x=E*U*q+X*G*F,this._y=X*G*q+E*U*F,this._z=X*U*F-E*G*q,this._w=X*U*q-E*G*F;break;case"XZY":this._x=E*U*q-X*G*F,this._y=X*G*q-E*U*F,this._z=X*U*F+E*G*q,this._w=X*U*q+E*G*F;break;default:C0("Quaternion: .setFromEuler() encountered an unknown order: "+K)}if(Q===!0)this._onChangeCallback();return this}setFromAxisAngle(J,Q){let $=Q/2,W=Math.sin($);return this._x=J.x*W,this._y=J.y*W,this._z=J.z*W,this._w=Math.cos($),this._onChangeCallback(),this}setFromRotationMatrix(J){let Q=J.elements,$=Q[0],W=Q[4],Z=Q[8],K=Q[1],Y=Q[5],H=Q[9],X=Q[2],U=Q[6],q=Q[10],E=$+Y+q;if(E>0){let G=0.5/Math.sqrt(E+1);this._w=0.25/G,this._x=(U-H)*G,this._y=(Z-X)*G,this._z=(K-W)*G}else if($>Y&&$>q){let G=2*Math.sqrt(1+$-Y-q);this._w=(U-H)/G,this._x=0.25*G,this._y=(W+K)/G,this._z=(Z+X)/G}else if(Y>q){let G=2*Math.sqrt(1+Y-$-q);this._w=(Z-X)/G,this._x=(W+K)/G,this._y=0.25*G,this._z=(H+U)/G}else{let G=2*Math.sqrt(1+q-$-Y);this._w=(K-W)/G,this._x=(Z+X)/G,this._y=(H+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(o0(this.dot(J),-1,1)))}rotateTowards(J,Q){let $=this.angleTo(J);if($===0)return this;let W=Math.min(1,Q/$);return this.slerp(J,W),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:W,_z:Z,_w:K}=J,Y=Q._x,H=Q._y,X=Q._z,U=Q._w;return this._x=$*U+K*Y+W*X-Z*H,this._y=W*U+K*H+Z*Y-$*X,this._z=Z*U+K*X+$*H-W*Y,this._w=K*U-$*Y-W*H-Z*X,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:W,_z:Z,_w:K}=J,Y=this.dot(J);if(Y<0)$=-$,W=-W,Z=-Z,K=-K,Y=-Y;let H=1-Q;if(Y<0.9995){let X=Math.acos(Y),U=Math.sin(X);H=Math.sin(H*X)/U,Q=Math.sin(Q*X)/U,this._x=this._x*H+$*Q,this._y=this._y*H+W*Q,this._z=this._z*H+Z*Q,this._w=this._w*H+K*Q,this._onChangeCallback()}else this._x=this._x*H+$*Q,this._y=this._y*H+W*Q,this._z=this._z*H+Z*Q,this._w=this._w*H+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(),W=Math.sqrt(1-$),Z=Math.sqrt($);return this.set(W*Math.sin(J),W*Math.cos(J),Z*Math.sin(Q),Z*Math.cos(Q))}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._w===this._w}fromArray(J,Q=0){return this._x=J[Q],this._y=J[Q+1],this._z=J[Q+2],this._w=J[Q+3],this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._w,J}fromBufferAttribute(J,Q){return this._x=J.getX(Q),this._y=J.getY(Q),this._z=J.getZ(Q),this._w=J.getW(Q),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class y{static{y.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(x$.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(x$.setFromAxisAngle(J,Q))}applyMatrix3(J){let Q=this.x,$=this.y,W=this.z,Z=J.elements;return this.x=Z[0]*Q+Z[3]*$+Z[6]*W,this.y=Z[1]*Q+Z[4]*$+Z[7]*W,this.z=Z[2]*Q+Z[5]*$+Z[8]*W,this}applyNormalMatrix(J){return this.applyMatrix3(J).normalize()}applyMatrix4(J){let Q=this.x,$=this.y,W=this.z,Z=J.elements,K=1/(Z[3]*Q+Z[7]*$+Z[11]*W+Z[15]);return this.x=(Z[0]*Q+Z[4]*$+Z[8]*W+Z[12])*K,this.y=(Z[1]*Q+Z[5]*$+Z[9]*W+Z[13])*K,this.z=(Z[2]*Q+Z[6]*$+Z[10]*W+Z[14])*K,this}applyQuaternion(J){let Q=this.x,$=this.y,W=this.z,Z=J.x,K=J.y,Y=J.z,H=J.w,X=2*(K*W-Y*$),U=2*(Y*Q-Z*W),q=2*(Z*$-K*Q);return this.x=Q+H*X+K*q-Y*U,this.y=$+H*U+Y*X-Z*q,this.z=W+H*q+Z*U-K*X,this}project(J){return this.applyMatrix4(J.matrixWorldInverse).applyMatrix4(J.projectionMatrix)}unproject(J){return this.applyMatrix4(J.projectionMatrixInverse).applyMatrix4(J.matrixWorld)}transformDirection(J){let Q=this.x,$=this.y,W=this.z,Z=J.elements;return this.x=Z[0]*Q+Z[4]*$+Z[8]*W,this.y=Z[1]*Q+Z[5]*$+Z[9]*W,this.z=Z[2]*Q+Z[6]*$+Z[10]*W,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=o0(this.x,J.x,Q.x),this.y=o0(this.y,J.y,Q.y),this.z=o0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=o0(this.x,J,Q),this.y=o0(this.y,J,Q),this.z=o0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(o0($,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:W,z:Z}=J,K=Q.x,Y=Q.y,H=Q.z;return this.x=W*H-Z*Y,this.y=Z*K-$*H,this.z=$*Y-W*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 M6.copy(this).projectOnVector(J),this.sub(M6)}reflect(J){return this.sub(M6.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(o0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y,W=this.z-J.z;return Q*Q+$*$+W*W}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 W=Math.sin(Q)*J;return this.x=W*Math.sin($),this.y=Math.cos(Q)*J,this.z=W*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(),W=this.setFromMatrixColumn(J,2).length();return this.x=Q,this.y=$,this.z=W,this}setFromMatrixColumn(J,Q){return this.fromArray(J.elements,Q*4)}setFromMatrix3Column(J,Q){return this.fromArray(J.elements,Q*3)}setFromEuler(J){return this.x=J._x,this.y=J._y,this.z=J._z,this}setFromColor(J){return this.x=J.r,this.y=J.g,this.z=J.b,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let J=Math.random()*Math.PI*2,Q=Math.random()*2-1,$=Math.sqrt(1-Q*Q);return this.x=$*Math.cos(J),this.y=Q,this.z=$*Math.sin(J),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var M6=new y,x$=new O9;class j0{static{j0.prototype.isMatrix3=!0}constructor(J,Q,$,W,Z,K,Y,H,X){if(this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,W,Z,K,Y,H,X)}set(J,Q,$,W,Z,K,Y,H,X){let U=this.elements;return U[0]=J,U[1]=W,U[2]=Y,U[3]=Q,U[4]=Z,U[5]=H,U[6]=$,U[7]=K,U[8]=X,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],this}extractBasis(J,Q,$){return J.setFromMatrix3Column(this,0),Q.setFromMatrix3Column(this,1),$.setFromMatrix3Column(this,2),this}setFromMatrix4(J){let Q=J.elements;return this.set(Q[0],Q[4],Q[8],Q[1],Q[5],Q[9],Q[2],Q[6],Q[10]),this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,W=Q.elements,Z=this.elements,K=$[0],Y=$[3],H=$[6],X=$[1],U=$[4],q=$[7],E=$[2],G=$[5],F=$[8],k=W[0],z=W[3],N=W[6],D=W[1],V=W[4],_=W[7],I=W[2],P=W[5],w=W[8];return Z[0]=K*k+Y*D+H*I,Z[3]=K*z+Y*V+H*P,Z[6]=K*N+Y*_+H*w,Z[1]=X*k+U*D+q*I,Z[4]=X*z+U*V+q*P,Z[7]=X*N+U*_+q*w,Z[2]=E*k+G*D+F*I,Z[5]=E*z+G*V+F*P,Z[8]=E*N+G*_+F*w,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[3]*=J,Q[6]*=J,Q[1]*=J,Q[4]*=J,Q[7]*=J,Q[2]*=J,Q[5]*=J,Q[8]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[1],W=J[2],Z=J[3],K=J[4],Y=J[5],H=J[6],X=J[7],U=J[8];return Q*K*U-Q*Y*X-$*Z*U+$*Y*H+W*Z*X-W*K*H}invert(){let J=this.elements,Q=J[0],$=J[1],W=J[2],Z=J[3],K=J[4],Y=J[5],H=J[6],X=J[7],U=J[8],q=U*K-Y*X,E=Y*H-U*Z,G=X*Z-K*H,F=Q*q+$*E+W*G;if(F===0)return this.set(0,0,0,0,0,0,0,0,0);let k=1/F;return J[0]=q*k,J[1]=(W*X-U*$)*k,J[2]=(Y*$-W*K)*k,J[3]=E*k,J[4]=(U*Q-W*H)*k,J[5]=(W*Z-Y*Q)*k,J[6]=G*k,J[7]=($*H-X*Q)*k,J[8]=(K*Q-$*Z)*k,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,$,W,Z,K,Y){let H=Math.cos(Z),X=Math.sin(Z);return this.set($*H,$*X,-$*(H*K+X*Y)+K+J,-W*X,W*H,-W*(-X*K+H*Y)+Y+Q,0,0,1),this}scale(J,Q){return this.premultiply(L6.makeScale(J,Q)),this}rotate(J){return this.premultiply(L6.makeRotation(-J)),this}translate(J,Q){return this.premultiply(L6.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 W=0;W<9;W++)if(Q[W]!==$[W])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<9;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J}clone(){return new this.constructor().fromArray(this.elements)}}var L6=new j0,g$=new j0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),p$=new j0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function OK(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(Z,K,Y){if(this.enabled===!1||K===Y||!K||!Y)return Z;if(this.spaces[K].transfer==="srgb")Z.r=E9(Z.r),Z.g=E9(Z.g),Z.b=E9(Z.b);if(this.spaces[K].primaries!==this.spaces[Y].primaries)Z.applyMatrix3(this.spaces[K].toXYZ),Z.applyMatrix3(this.spaces[Y].fromXYZ);if(this.spaces[Y].transfer==="srgb")Z.r=O8(Z.r),Z.g=O8(Z.g),Z.b=O8(Z.b);return Z},workingToColorSpace:function(Z,K){return this.convert(Z,this.workingColorSpace,K)},colorSpaceToWorking:function(Z,K){return this.convert(Z,K,this.workingColorSpace)},getPrimaries:function(Z){return this.spaces[Z].primaries},getTransfer:function(Z){if(Z==="")return"linear";return this.spaces[Z].transfer},getToneMappingMode:function(Z){return this.spaces[Z].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(Z,K=this.workingColorSpace){return Z.fromArray(this.spaces[K].luminanceCoefficients)},define:function(Z){Object.assign(this.spaces,Z)},_getMatrix:function(Z,K,Y){return Z.copy(this.spaces[K].toXYZ).multiply(this.spaces[Y].fromXYZ)},_getDrawingBufferColorSpace:function(Z){return this.spaces[Z].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(Z=this.workingColorSpace){return this.spaces[Z].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(Z,K){return j7("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(Z,K)},toWorkingColorSpace:function(Z,K){return j7("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(Z,K)}},Q=[0.64,0.33,0.3,0.6,0.15,0.06],$=[0.2126,0.7152,0.0722],W=[0.3127,0.329];return J.define({["srgb-linear"]:{primaries:Q,whitePoint:W,transfer:"linear",toXYZ:g$,fromXYZ:p$,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:W,transfer:"srgb",toXYZ:g$,fromXYZ:p$,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var i0=OK();function E9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function O8(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var e9;class lQ{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(e9===void 0)e9=f8("canvas");e9.width=J.width,e9.height=J.height;let W=e9.getContext("2d");if(J instanceof ImageData)W.putImageData(J,0,0);else W.drawImage(J,0,0,J.width,J.height);$=e9}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=f8("canvas");Q.width=J.width,Q.height=J.height;let $=Q.getContext("2d");$.drawImage(J,0,0,J.width,J.height);let W=$.getImageData(0,0,J.width,J.height),Z=W.data;for(let K=0;K<Z.length;K++)Z[K]=E9(Z[K]/255)*255;return $.putImageData(W,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(E9(Q[$]/255)*255);else Q[$]=E9(Q[$]);return{data:Q,width:J.width,height:J.height}}else return C0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}var RK=0;class l8{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:RK++}),this.uuid=w9(),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:""},W=this.data;if(W!==null){let Z;if(Array.isArray(W)){Z=[];for(let K=0,Y=W.length;K<Y;K++)if(W[K].isDataTexture)Z.push(V6(W[K].image));else Z.push(V6(W[K]))}else Z=V6(W);$.url=Z}if(!Q)J.images[this.uuid]=$;return $}}function V6(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return lQ.getDataURL(J);else if(J.data)return{data:Array.from(J.data),width:J.width,height:J.height,type:J.data.constructor.name};else return C0("Texture: Unable to serialize Texture."),{}}var kK=0,B6=new y;class zJ extends F9{constructor(J=zJ.DEFAULT_IMAGE,Q=zJ.DEFAULT_MAPPING,$=1001,W=1001,Z=1006,K=1008,Y=1023,H=1009,X=zJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:kK++}),this.uuid=w9(),this.name="",this.source=new l8(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=W,this.magFilter=Z,this.minFilter=K,this.anisotropy=X,this.format=Y,this.internalFormat=null,this.type=H,this.offset=new h0(0,0),this.repeat=new h0(1,1),this.center=new h0(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new j0,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(B6).x}get height(){return this.source.getSize(B6).y}get depth(){return this.source.getSize(B6).z}get image(){return this.source.data}set image(J){this.source.data=J}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(J){return this.name=J.name,this.source=J.source,this.mipmaps=J.mipmaps.slice(0),this.mapping=J.mapping,this.channel=J.channel,this.wrapS=J.wrapS,this.wrapT=J.wrapT,this.magFilter=J.magFilter,this.minFilter=J.minFilter,this.anisotropy=J.anisotropy,this.format=J.format,this.internalFormat=J.internalFormat,this.type=J.type,this.normalized=J.normalized,this.offset.copy(J.offset),this.repeat.copy(J.repeat),this.center.copy(J.center),this.rotation=J.rotation,this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrix.copy(J.matrix),this.generateMipmaps=J.generateMipmaps,this.premultiplyAlpha=J.premultiplyAlpha,this.flipY=J.flipY,this.unpackAlignment=J.unpackAlignment,this.colorSpace=J.colorSpace,this.renderTarget=J.renderTarget,this.isRenderTargetTexture=J.isRenderTargetTexture,this.isArrayTexture=J.isArrayTexture,this.userData=JSON.parse(JSON.stringify(J.userData)),this.needsUpdate=!0,this}setValues(J){for(let Q in J){let $=J[Q];if($===void 0){C0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let W=this[Q];if(W===void 0){C0(`Texture.setValues(): property '${Q}' does not exist.`);continue}if(W&&$&&(W.isVector2&&$.isVector2))W.copy($);else if(W&&$&&(W.isVector3&&$.isVector3))W.copy($);else if(W&&$&&(W.isMatrix3&&$.isMatrix3))W.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++}}zJ.DEFAULT_IMAGE=null;zJ.DEFAULT_MAPPING=300;zJ.DEFAULT_ANISOTROPY=1;class UJ{static{UJ.prototype.isVector4=!0}constructor(J=0,Q=0,$=0,W=1){this.x=J,this.y=Q,this.z=$,this.w=W}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,$,W){return this.x=J,this.y=Q,this.z=$,this.w=W,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,W=this.z,Z=this.w,K=J.elements;return this.x=K[0]*Q+K[4]*$+K[8]*W+K[12]*Z,this.y=K[1]*Q+K[5]*$+K[9]*W+K[13]*Z,this.z=K[2]*Q+K[6]*$+K[10]*W+K[14]*Z,this.w=K[3]*Q+K[7]*$+K[11]*W+K[15]*Z,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,$,W,Z,K=0.01,Y=0.1,H=J.elements,X=H[0],U=H[4],q=H[8],E=H[1],G=H[5],F=H[9],k=H[2],z=H[6],N=H[10];if(Math.abs(U-E)<0.01&&Math.abs(q-k)<0.01&&Math.abs(F-z)<0.01){if(Math.abs(U+E)<0.1&&Math.abs(q+k)<0.1&&Math.abs(F+z)<0.1&&Math.abs(X+G+N-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let V=(X+1)/2,_=(G+1)/2,I=(N+1)/2,P=(U+E)/4,w=(q+k)/4,C=(F+z)/4;if(V>_&&V>I)if(V<0.01)$=0,W=0.707106781,Z=0.707106781;else $=Math.sqrt(V),W=P/$,Z=w/$;else if(_>I)if(_<0.01)$=0.707106781,W=0,Z=0.707106781;else W=Math.sqrt(_),$=P/W,Z=C/W;else if(I<0.01)$=0.707106781,W=0.707106781,Z=0;else Z=Math.sqrt(I),$=w/Z,W=C/Z;return this.set($,W,Z,Q),this}let D=Math.sqrt((z-F)*(z-F)+(q-k)*(q-k)+(E-U)*(E-U));if(Math.abs(D)<0.001)D=1;return this.x=(z-F)/D,this.y=(q-k)/D,this.z=(E-U)/D,this.w=Math.acos((X+G+N-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=o0(this.x,J.x,Q.x),this.y=o0(this.y,J.y,Q.y),this.z=o0(this.z,J.z,Q.z),this.w=o0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=o0(this.x,J,Q),this.y=o0(this.y,J,Q),this.z=o0(this.z,J,Q),this.w=o0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(o0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z+this.w*J.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this.w+=(J.w-this.w)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this.w=J.w+(Q.w-J.w)*$,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z&&J.w===this.w}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this.w=J[Q+3],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J[Q+3]=this.w,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this.w=J.getW(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class uQ extends F9{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 UJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new UJ(0,0,J,Q),this.textures=[];let W={width:J,height:Q,depth:$.depth},Z=new zJ(W),K=$.count;for(let Y=0;Y<K;Y++)this.textures[Y]=Z.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 W=0,Z=this.textures.length;W<Z;W++)if(this.textures[W].image.width=J,this.textures[W].image.height=Q,this.textures[W].image.depth=$,this.textures[W].isData3DTexture!==!0)this.textures[W].isArrayTexture=this.textures[W].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 W=Object.assign({},J.textures[Q].image);this.textures[Q].source=new l8(W)}if(this.depthBuffer=J.depthBuffer,this.stencilBuffer=J.stencilBuffer,this.resolveDepthBuffer=J.resolveDepthBuffer,this.resolveStencilBuffer=J.resolveStencilBuffer,J.depthTexture!==null)this.depthTexture=J.depthTexture.clone();return this.samples=J.samples,this.multiview=J.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class dJ extends uQ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class i7 extends zJ{constructor(J=null,Q=1,$=1,W=1){super(null);this.isDataArrayTexture=!0,this.image={data:J,width:Q,height:$,depth:W},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class cQ extends zJ{constructor(J=null,Q=1,$=1,W=1){super(null);this.isData3DTexture=!0,this.image={data:J,width:Q,height:$,depth:W},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class YJ{static{YJ.prototype.isMatrix4=!0}constructor(J,Q,$,W,Z,K,Y,H,X,U,q,E,G,F,k,z){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,$,W,Z,K,Y,H,X,U,q,E,G,F,k,z)}set(J,Q,$,W,Z,K,Y,H,X,U,q,E,G,F,k,z){let N=this.elements;return N[0]=J,N[4]=Q,N[8]=$,N[12]=W,N[1]=Z,N[5]=K,N[9]=Y,N[13]=H,N[2]=X,N[6]=U,N[10]=q,N[14]=E,N[3]=G,N[7]=F,N[11]=k,N[15]=z,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 YJ().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,W=1/J8.setFromMatrixColumn(J,0).length(),Z=1/J8.setFromMatrixColumn(J,1).length(),K=1/J8.setFromMatrixColumn(J,2).length();return Q[0]=$[0]*W,Q[1]=$[1]*W,Q[2]=$[2]*W,Q[3]=0,Q[4]=$[4]*Z,Q[5]=$[5]*Z,Q[6]=$[6]*Z,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,W=J.y,Z=J.z,K=Math.cos($),Y=Math.sin($),H=Math.cos(W),X=Math.sin(W),U=Math.cos(Z),q=Math.sin(Z);if(J.order==="XYZ"){let E=K*U,G=K*q,F=Y*U,k=Y*q;Q[0]=H*U,Q[4]=-H*q,Q[8]=X,Q[1]=G+F*X,Q[5]=E-k*X,Q[9]=-Y*H,Q[2]=k-E*X,Q[6]=F+G*X,Q[10]=K*H}else if(J.order==="YXZ"){let E=H*U,G=H*q,F=X*U,k=X*q;Q[0]=E+k*Y,Q[4]=F*Y-G,Q[8]=K*X,Q[1]=K*q,Q[5]=K*U,Q[9]=-Y,Q[2]=G*Y-F,Q[6]=k+E*Y,Q[10]=K*H}else if(J.order==="ZXY"){let E=H*U,G=H*q,F=X*U,k=X*q;Q[0]=E-k*Y,Q[4]=-K*q,Q[8]=F+G*Y,Q[1]=G+F*Y,Q[5]=K*U,Q[9]=k-E*Y,Q[2]=-K*X,Q[6]=Y,Q[10]=K*H}else if(J.order==="ZYX"){let E=K*U,G=K*q,F=Y*U,k=Y*q;Q[0]=H*U,Q[4]=F*X-G,Q[8]=E*X+k,Q[1]=H*q,Q[5]=k*X+E,Q[9]=G*X-F,Q[2]=-X,Q[6]=Y*H,Q[10]=K*H}else if(J.order==="YZX"){let E=K*H,G=K*X,F=Y*H,k=Y*X;Q[0]=H*U,Q[4]=k-E*q,Q[8]=F*q+G,Q[1]=q,Q[5]=K*U,Q[9]=-Y*U,Q[2]=-X*U,Q[6]=G*q+F,Q[10]=E-k*q}else if(J.order==="XZY"){let E=K*H,G=K*X,F=Y*H,k=Y*X;Q[0]=H*U,Q[4]=-q,Q[8]=X*U,Q[1]=E*q+k,Q[5]=K*U,Q[9]=G*q-F,Q[2]=F*q-G,Q[6]=Y*U,Q[10]=k*q+E}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(MK,J,LK)}lookAt(J,Q,$){let W=this.elements;if(fJ.subVectors(J,Q),fJ.lengthSq()===0)fJ.z=1;if(fJ.normalize(),V9.crossVectors($,fJ),V9.lengthSq()===0){if(Math.abs($.z)===1)fJ.x+=0.0001;else fJ.z+=0.0001;fJ.normalize(),V9.crossVectors($,fJ)}return V9.normalize(),H7.crossVectors(fJ,V9),W[0]=V9.x,W[4]=H7.x,W[8]=fJ.x,W[1]=V9.y,W[5]=H7.y,W[9]=fJ.y,W[2]=V9.z,W[6]=H7.z,W[10]=fJ.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,W=Q.elements,Z=this.elements,K=$[0],Y=$[4],H=$[8],X=$[12],U=$[1],q=$[5],E=$[9],G=$[13],F=$[2],k=$[6],z=$[10],N=$[14],D=$[3],V=$[7],_=$[11],I=$[15],P=W[0],w=W[4],C=W[8],M=W[12],B=W[1],l=W[5],A=W[9],p=W[13],c=W[2],v=W[6],d=W[10],x=W[14],g=W[3],a=W[7],J0=W[11],U0=W[15];return Z[0]=K*P+Y*B+H*c+X*g,Z[4]=K*w+Y*l+H*v+X*a,Z[8]=K*C+Y*A+H*d+X*J0,Z[12]=K*M+Y*p+H*x+X*U0,Z[1]=U*P+q*B+E*c+G*g,Z[5]=U*w+q*l+E*v+G*a,Z[9]=U*C+q*A+E*d+G*J0,Z[13]=U*M+q*p+E*x+G*U0,Z[2]=F*P+k*B+z*c+N*g,Z[6]=F*w+k*l+z*v+N*a,Z[10]=F*C+k*A+z*d+N*J0,Z[14]=F*M+k*p+z*x+N*U0,Z[3]=D*P+V*B+_*c+I*g,Z[7]=D*w+V*l+_*v+I*a,Z[11]=D*C+V*A+_*d+I*J0,Z[15]=D*M+V*p+_*x+I*U0,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],W=J[8],Z=J[12],K=J[1],Y=J[5],H=J[9],X=J[13],U=J[2],q=J[6],E=J[10],G=J[14],F=J[3],k=J[7],z=J[11],N=J[15],D=H*G-X*E,V=Y*G-X*q,_=Y*E-H*q,I=K*G-X*U,P=K*E-H*U,w=K*q-Y*U;return Q*(k*D-z*V+N*_)-$*(F*D-z*I+N*P)+W*(F*V-k*I+N*w)-Z*(F*_-k*P+z*w)}transpose(){let J=this.elements,Q;return Q=J[1],J[1]=J[4],J[4]=Q,Q=J[2],J[2]=J[8],J[8]=Q,Q=J[6],J[6]=J[9],J[9]=Q,Q=J[3],J[3]=J[12],J[12]=Q,Q=J[7],J[7]=J[13],J[13]=Q,Q=J[11],J[11]=J[14],J[14]=Q,this}setPosition(J,Q,$){let W=this.elements;if(J.isVector3)W[12]=J.x,W[13]=J.y,W[14]=J.z;else W[12]=J,W[13]=Q,W[14]=$;return this}invert(){let J=this.elements,Q=J[0],$=J[1],W=J[2],Z=J[3],K=J[4],Y=J[5],H=J[6],X=J[7],U=J[8],q=J[9],E=J[10],G=J[11],F=J[12],k=J[13],z=J[14],N=J[15],D=Q*Y-$*K,V=Q*H-W*K,_=Q*X-Z*K,I=$*H-W*Y,P=$*X-Z*Y,w=W*X-Z*H,C=U*k-q*F,M=U*z-E*F,B=U*N-G*F,l=q*z-E*k,A=q*N-G*k,p=E*N-G*z,c=D*p-V*A+_*l+I*B-P*M+w*C;if(c===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let v=1/c;return J[0]=(Y*p-H*A+X*l)*v,J[1]=(W*A-$*p-Z*l)*v,J[2]=(k*w-z*P+N*I)*v,J[3]=(E*P-q*w-G*I)*v,J[4]=(H*B-K*p-X*M)*v,J[5]=(Q*p-W*B+Z*M)*v,J[6]=(z*_-F*w-N*V)*v,J[7]=(U*w-E*_+G*V)*v,J[8]=(K*A-Y*B+X*C)*v,J[9]=($*B-Q*A-Z*C)*v,J[10]=(F*P-k*_+N*D)*v,J[11]=(q*_-U*P-G*D)*v,J[12]=(Y*M-K*l-H*C)*v,J[13]=(Q*l-$*M+W*C)*v,J[14]=(k*V-F*I-z*D)*v,J[15]=(U*I-q*V+E*D)*v,this}scale(J){let Q=this.elements,$=J.x,W=J.y,Z=J.z;return Q[0]*=$,Q[4]*=W,Q[8]*=Z,Q[1]*=$,Q[5]*=W,Q[9]*=Z,Q[2]*=$,Q[6]*=W,Q[10]*=Z,Q[3]*=$,Q[7]*=W,Q[11]*=Z,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],W=J[8]*J[8]+J[9]*J[9]+J[10]*J[10];return Math.sqrt(Math.max(Q,$,W))}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),W=Math.sin(Q),Z=1-$,K=J.x,Y=J.y,H=J.z,X=Z*K,U=Z*Y;return this.set(X*K+$,X*Y-W*H,X*H+W*Y,0,X*Y+W*H,U*Y+$,U*H-W*K,0,X*H-W*Y,U*H+W*K,Z*H*H+$,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,$,W,Z,K){return this.set(1,$,Z,0,J,1,K,0,Q,W,1,0,0,0,0,1),this}compose(J,Q,$){let W=this.elements,Z=Q._x,K=Q._y,Y=Q._z,H=Q._w,X=Z+Z,U=K+K,q=Y+Y,E=Z*X,G=Z*U,F=Z*q,k=K*U,z=K*q,N=Y*q,D=H*X,V=H*U,_=H*q,I=$.x,P=$.y,w=$.z;return W[0]=(1-(k+N))*I,W[1]=(G+_)*I,W[2]=(F-V)*I,W[3]=0,W[4]=(G-_)*P,W[5]=(1-(E+N))*P,W[6]=(z+D)*P,W[7]=0,W[8]=(F+V)*w,W[9]=(z-D)*w,W[10]=(1-(E+k))*w,W[11]=0,W[12]=J.x,W[13]=J.y,W[14]=J.z,W[15]=1,this}decompose(J,Q,$){let W=this.elements;J.x=W[12],J.y=W[13],J.z=W[14];let Z=this.determinant();if(Z===0)return $.set(1,1,1),Q.identity(),this;let K=J8.set(W[0],W[1],W[2]).length(),Y=J8.set(W[4],W[5],W[6]).length(),H=J8.set(W[8],W[9],W[10]).length();if(Z<0)K=-K;nJ.copy(this);let X=1/K,U=1/Y,q=1/H;return nJ.elements[0]*=X,nJ.elements[1]*=X,nJ.elements[2]*=X,nJ.elements[4]*=U,nJ.elements[5]*=U,nJ.elements[6]*=U,nJ.elements[8]*=q,nJ.elements[9]*=q,nJ.elements[10]*=q,Q.setFromRotationMatrix(nJ),$.x=K,$.y=Y,$.z=H,this}makePerspective(J,Q,$,W,Z,K,Y=2000,H=!1){let X=this.elements,U=2*Z/(Q-J),q=2*Z/($-W),E=(Q+J)/(Q-J),G=($+W)/($-W),F,k;if(H)F=Z/(K-Z),k=K*Z/(K-Z);else if(Y===2000)F=-(K+Z)/(K-Z),k=-2*K*Z/(K-Z);else if(Y===2001)F=-K/(K-Z),k=-K*Z/(K-Z);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Y);return X[0]=U,X[4]=0,X[8]=E,X[12]=0,X[1]=0,X[5]=q,X[9]=G,X[13]=0,X[2]=0,X[6]=0,X[10]=F,X[14]=k,X[3]=0,X[7]=0,X[11]=-1,X[15]=0,this}makeOrthographic(J,Q,$,W,Z,K,Y=2000,H=!1){let X=this.elements,U=2/(Q-J),q=2/($-W),E=-(Q+J)/(Q-J),G=-($+W)/($-W),F,k;if(H)F=1/(K-Z),k=K/(K-Z);else if(Y===2000)F=-2/(K-Z),k=-(K+Z)/(K-Z);else if(Y===2001)F=-1/(K-Z),k=-Z/(K-Z);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Y);return X[0]=U,X[4]=0,X[8]=0,X[12]=E,X[1]=0,X[5]=q,X[9]=0,X[13]=G,X[2]=0,X[6]=0,X[10]=F,X[14]=k,X[3]=0,X[7]=0,X[11]=0,X[15]=1,this}equals(J){let Q=this.elements,$=J.elements;for(let W=0;W<16;W++)if(Q[W]!==$[W])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<16;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J[Q+9]=$[9],J[Q+10]=$[10],J[Q+11]=$[11],J[Q+12]=$[12],J[Q+13]=$[13],J[Q+14]=$[14],J[Q+15]=$[15],J}}var J8=new y,nJ=new YJ,MK=new y(0,0,0),LK=new y(1,1,1),V9=new y,H7=new y,fJ=new y,m$=new YJ,d$=new O9;class mJ{constructor(J=0,Q=0,$=0,W=mJ.DEFAULT_ORDER){this.isEuler=!0,this._x=J,this._y=Q,this._z=$,this._order=W}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,$,W=this._order){return this._x=J,this._y=Q,this._z=$,this._order=W,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 W=J.elements,Z=W[0],K=W[4],Y=W[8],H=W[1],X=W[5],U=W[9],q=W[2],E=W[6],G=W[10];switch(Q){case"XYZ":if(this._y=Math.asin(o0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(-U,G),this._z=Math.atan2(-K,Z);else this._x=Math.atan2(E,X),this._z=0;break;case"YXZ":if(this._x=Math.asin(-o0(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(Y,G),this._z=Math.atan2(H,X);else this._y=Math.atan2(-q,Z),this._z=0;break;case"ZXY":if(this._x=Math.asin(o0(E,-1,1)),Math.abs(E)<0.9999999)this._y=Math.atan2(-q,G),this._z=Math.atan2(-K,X);else this._y=0,this._z=Math.atan2(H,Z);break;case"ZYX":if(this._y=Math.asin(-o0(q,-1,1)),Math.abs(q)<0.9999999)this._x=Math.atan2(E,G),this._z=Math.atan2(H,Z);else this._x=0,this._z=Math.atan2(-K,X);break;case"YZX":if(this._z=Math.asin(o0(H,-1,1)),Math.abs(H)<0.9999999)this._x=Math.atan2(-U,X),this._y=Math.atan2(-q,Z);else this._x=0,this._y=Math.atan2(Y,G);break;case"XZY":if(this._z=Math.asin(-o0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(E,X),this._y=Math.atan2(Y,Z);else this._x=Math.atan2(-U,G),this._y=0;break;default:C0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return m$.makeRotationFromQuaternion(J),this.setFromRotationMatrix(m$,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return d$.setFromEuler(this),this.setFromQuaternion(d$,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}}mJ.DEFAULT_ORDER="XYZ";class u8{constructor(){this.mask=1}set(J){this.mask=(1<<J|0)>>>0}enable(J){this.mask|=1<<J|0}enableAll(){this.mask=-1}toggle(J){this.mask^=1<<J|0}disable(J){this.mask&=~(1<<J|0)}disableAll(){this.mask=0}test(J){return(this.mask&J.mask)!==0}isEnabled(J){return(this.mask&(1<<J|0))!==0}}var VK=0,l$=new y,Q8=new O9,Y9=new YJ,X7=new y,w8=new y,BK=new y,zK=new O9,u$=new y(1,0,0),c$=new y(0,1,0),n$=new y(0,0,1),s$={type:"added"},IK={type:"removed"},$8={type:"childadded",child:null},z6={type:"childremoved",child:null};class RJ extends F9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:VK++}),this.uuid=w9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=RJ.DEFAULT_UP.clone();let J=new y,Q=new mJ,$=new O9,W=new y(1,1,1);function Z(){$.setFromEuler(Q,!1)}function K(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(Z),$._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:W},modelViewMatrix:{value:new YJ},normalMatrix:{value:new j0}}),this.matrix=new YJ,this.matrixWorld=new YJ,this.matrixAutoUpdate=RJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=RJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new u8,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 Q8.setFromAxisAngle(J,Q),this.quaternion.multiply(Q8),this}rotateOnWorldAxis(J,Q){return Q8.setFromAxisAngle(J,Q),this.quaternion.premultiply(Q8),this}rotateX(J){return this.rotateOnAxis(u$,J)}rotateY(J){return this.rotateOnAxis(c$,J)}rotateZ(J){return this.rotateOnAxis(n$,J)}translateOnAxis(J,Q){return l$.copy(J).applyQuaternion(this.quaternion),this.position.add(l$.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(u$,J)}translateY(J){return this.translateOnAxis(c$,J)}translateZ(J){return this.translateOnAxis(n$,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(Y9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)X7.copy(J);else X7.set(J,Q,$);let W=this.parent;if(this.updateWorldMatrix(!0,!1),w8.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)Y9.lookAt(w8,X7,this.up);else Y9.lookAt(X7,w8,this.up);if(this.quaternion.setFromRotationMatrix(Y9),W)Y9.extractRotation(W.matrixWorld),Q8.setFromRotationMatrix(Y9),this.quaternion.premultiply(Q8.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(s$),$8.child=J,this.dispatchEvent($8),$8.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(IK),z6.child=J,this.dispatchEvent(z6),z6.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),Y9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),Y9.multiply(J.parent.matrixWorld);return J.applyMatrix4(Y9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(s$),$8.child=J,this.dispatchEvent($8),$8.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,W=this.children.length;$<W;$++){let K=this.children[$].getObjectByProperty(J,Q);if(K!==void 0)return K}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let W=this.children;for(let Z=0,K=W.length;Z<K;Z++)W[Z].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(w8,J,BK),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(w8,zK,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,W=Q.length;$<W;$++)Q[$].traverse(J)}traverseVisible(J){if(this.visible===!1)return;J(this);let Q=this.children;for(let $=0,W=Q.length;$<W;$++)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:W}=J,Z=this.matrix.elements;Z[12]+=Q-Z[0]*Q-Z[4]*$-Z[8]*W,Z[13]+=$-Z[1]*Q-Z[5]*$-Z[9]*W,Z[14]+=W-Z[2]*Q-Z[6]*$-Z[10]*W}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,W=Q.length;$<W;$++)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 W=this.children;for(let Z=0,K=W.length;Z<K;Z++)W[Z].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 W={};if(W.uuid=this.uuid,W.type=this.type,this.name!=="")W.name=this.name;if(this.castShadow===!0)W.castShadow=!0;if(this.receiveShadow===!0)W.receiveShadow=!0;if(this.visible===!1)W.visible=!1;if(this.frustumCulled===!1)W.frustumCulled=!1;if(this.renderOrder!==0)W.renderOrder=this.renderOrder;if(this.static!==!1)W.static=this.static;if(Object.keys(this.userData).length>0)W.userData=this.userData;if(W.layers=this.layers.mask,W.matrix=this.matrix.toArray(),W.up=this.up.toArray(),this.pivot!==null)W.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)W.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)W.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)W.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(W.type="InstancedMesh",W.count=this.count,W.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)W.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(W.type="BatchedMesh",W.perObjectFrustumCulled=this.perObjectFrustumCulled,W.sortObjects=this.sortObjects,W.drawRanges=this._drawRanges,W.reservedRanges=this._reservedRanges,W.geometryInfo=this._geometryInfo.map((Y)=>({...Y,boundingBox:Y.boundingBox?Y.boundingBox.toJSON():void 0,boundingSphere:Y.boundingSphere?Y.boundingSphere.toJSON():void 0})),W.instanceInfo=this._instanceInfo.map((Y)=>({...Y})),W.availableInstanceIds=this._availableInstanceIds.slice(),W.availableGeometryIds=this._availableGeometryIds.slice(),W.nextIndexStart=this._nextIndexStart,W.nextVertexStart=this._nextVertexStart,W.geometryCount=this._geometryCount,W.maxInstanceCount=this._maxInstanceCount,W.maxVertexCount=this._maxVertexCount,W.maxIndexCount=this._maxIndexCount,W.geometryInitialized=this._geometryInitialized,W.matricesTexture=this._matricesTexture.toJSON(J),W.indirectTexture=this._indirectTexture.toJSON(J),this._colorsTexture!==null)W.colorsTexture=this._colorsTexture.toJSON(J);if(this.boundingSphere!==null)W.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)W.boundingBox=this.boundingBox.toJSON()}function Z(Y,H){if(Y[H.uuid]===void 0)Y[H.uuid]=H.toJSON(J);return H.uuid}if(this.isScene){if(this.background){if(this.background.isColor)W.background=this.background.toJSON();else if(this.background.isTexture)W.background=this.background.toJSON(J).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)W.environment=this.environment.toJSON(J).uuid}else if(this.isMesh||this.isLine||this.isPoints){W.geometry=Z(J.geometries,this.geometry);let Y=this.geometry.parameters;if(Y!==void 0&&Y.shapes!==void 0){let H=Y.shapes;if(Array.isArray(H))for(let X=0,U=H.length;X<U;X++){let q=H[X];Z(J.shapes,q)}else Z(J.shapes,H)}}if(this.isSkinnedMesh){if(W.bindMode=this.bindMode,W.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)Z(J.skeletons,this.skeleton),W.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let Y=[];for(let H=0,X=this.material.length;H<X;H++)Y.push(Z(J.materials,this.material[H]));W.material=Y}else W.material=Z(J.materials,this.material);if(this.children.length>0){W.children=[];for(let Y=0;Y<this.children.length;Y++)W.children.push(this.children[Y].toJSON(J).object)}if(this.animations.length>0){W.animations=[];for(let Y=0;Y<this.animations.length;Y++){let H=this.animations[Y];W.animations.push(Z(J.animations,H))}}if(Q){let Y=K(J.geometries),H=K(J.materials),X=K(J.textures),U=K(J.images),q=K(J.shapes),E=K(J.skeletons),G=K(J.animations),F=K(J.nodes);if(Y.length>0)$.geometries=Y;if(H.length>0)$.materials=H;if(X.length>0)$.textures=X;if(U.length>0)$.images=U;if(q.length>0)$.shapes=q;if(E.length>0)$.skeletons=E;if(G.length>0)$.animations=G;if(F.length>0)$.nodes=F}return $.object=W,$;function K(Y){let H=[];for(let X in Y){let U=Y[X];delete U.metadata,H.push(U)}return H}}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 W=J.children[$];this.add(W.clone())}return this}}RJ.DEFAULT_UP=new y(0,1,0);RJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;RJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class F8 extends RJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var _K={type:"move"};class c8{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new F8,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 F8,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new y;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new F8,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new y,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 W=null,Z=null,K=null,Y=this._targetRay,H=this._grip,X=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(X&&J.hand){K=!0;for(let k of J.hand.values()){let z=Q.getJointPose(k,$),N=this._getHandJoint(X,k);if(z!==null)N.matrix.fromArray(z.transform.matrix),N.matrix.decompose(N.position,N.rotation,N.scale),N.matrixWorldNeedsUpdate=!0,N.jointRadius=z.radius;N.visible=z!==null}let U=X.joints["index-finger-tip"],q=X.joints["thumb-tip"],E=U.position.distanceTo(q.position),G=0.02,F=0.005;if(X.inputState.pinching&&E>G+F)X.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!X.inputState.pinching&&E<=G-F)X.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(H!==null&&J.gripSpace){if(Z=Q.getPose(J.gripSpace,$),Z!==null){if(H.matrix.fromArray(Z.transform.matrix),H.matrix.decompose(H.position,H.rotation,H.scale),H.matrixWorldNeedsUpdate=!0,Z.linearVelocity)H.hasLinearVelocity=!0,H.linearVelocity.copy(Z.linearVelocity);else H.hasLinearVelocity=!1;if(Z.angularVelocity)H.hasAngularVelocity=!0,H.angularVelocity.copy(Z.angularVelocity);else H.hasAngularVelocity=!1;if(H.eventsEnabled)H.dispatchEvent({type:"gripUpdated",data:J,target:this})}}if(Y!==null){if(W=Q.getPose(J.targetRaySpace,$),W===null&&Z!==null)W=Z;if(W!==null){if(Y.matrix.fromArray(W.transform.matrix),Y.matrix.decompose(Y.position,Y.rotation,Y.scale),Y.matrixWorldNeedsUpdate=!0,W.linearVelocity)Y.hasLinearVelocity=!0,Y.linearVelocity.copy(W.linearVelocity);else Y.hasLinearVelocity=!1;if(W.angularVelocity)Y.hasAngularVelocity=!0,Y.angularVelocity.copy(W.angularVelocity);else Y.hasAngularVelocity=!1;this.dispatchEvent(_K)}}}if(Y!==null)Y.visible=W!==null;if(H!==null)H.visible=Z!==null;if(X!==null)X.visible=K!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new F8;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var qZ={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},B9={h:0,s:0,l:0},U7={h:0,s:0,l:0};function I6(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 g0{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 W=J;if(W&&W.isColor)this.copy(W);else if(typeof W==="number")this.setHex(W);else if(typeof W==="string")this.setStyle(W)}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,i0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,W=i0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,i0.colorSpaceToWorking(this,W),this}setHSL(J,Q,$,W=i0.workingColorSpace){if(J=FK(J,1),Q=o0(Q,0,1),$=o0($,0,1),Q===0)this.r=this.g=this.b=$;else{let Z=$<=0.5?$*(1+Q):$+Q-$*Q,K=2*$-Z;this.r=I6(K,Z,J+0.3333333333333333),this.g=I6(K,Z,J),this.b=I6(K,Z,J-0.3333333333333333)}return i0.colorSpaceToWorking(this,W),this}setStyle(J,Q="srgb"){function $(Z){if(Z===void 0)return;if(parseFloat(Z)<1)C0("Color: Alpha component of "+J+" will be ignored.")}let W;if(W=/^(\w+)\(([^\)]*)\)/.exec(J)){let Z,K=W[1],Y=W[2];switch(K){case"rgb":case"rgba":if(Z=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Y))return $(Z[4]),this.setRGB(Math.min(255,parseInt(Z[1],10))/255,Math.min(255,parseInt(Z[2],10))/255,Math.min(255,parseInt(Z[3],10))/255,Q);if(Z=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Y))return $(Z[4]),this.setRGB(Math.min(100,parseInt(Z[1],10))/100,Math.min(100,parseInt(Z[2],10))/100,Math.min(100,parseInt(Z[3],10))/100,Q);break;case"hsl":case"hsla":if(Z=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Y))return $(Z[4]),this.setHSL(parseFloat(Z[1])/360,parseFloat(Z[2])/100,parseFloat(Z[3])/100,Q);break;default:C0("Color: Unknown color model "+J)}}else if(W=/^\#([A-Fa-f\d]+)$/.exec(J)){let Z=W[1],K=Z.length;if(K===3)return this.setRGB(parseInt(Z.charAt(0),16)/15,parseInt(Z.charAt(1),16)/15,parseInt(Z.charAt(2),16)/15,Q);else if(K===6)return this.setHex(parseInt(Z,16),Q);else C0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=qZ[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else C0("Color: Unknown color "+J);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(J){return this.r=J.r,this.g=J.g,this.b=J.b,this}copySRGBToLinear(J){return this.r=E9(J.r),this.g=E9(J.g),this.b=E9(J.b),this}copyLinearToSRGB(J){return this.r=O8(J.r),this.g=O8(J.g),this.b=O8(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return i0.workingToColorSpace(AJ.copy(this),J),Math.round(o0(AJ.r*255,0,255))*65536+Math.round(o0(AJ.g*255,0,255))*256+Math.round(o0(AJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=i0.workingColorSpace){i0.workingToColorSpace(AJ.copy(this),Q);let{r:$,g:W,b:Z}=AJ,K=Math.max($,W,Z),Y=Math.min($,W,Z),H,X,U=(Y+K)/2;if(Y===K)H=0,X=0;else{let q=K-Y;switch(X=U<=0.5?q/(K+Y):q/(2-K-Y),K){case $:H=(W-Z)/q+(W<Z?6:0);break;case W:H=(Z-$)/q+2;break;case Z:H=($-W)/q+4;break}H/=6}return J.h=H,J.s=X,J.l=U,J}getRGB(J,Q=i0.workingColorSpace){return i0.workingToColorSpace(AJ.copy(this),Q),J.r=AJ.r,J.g=AJ.g,J.b=AJ.b,J}getStyle(J="srgb"){i0.workingToColorSpace(AJ.copy(this),J);let{r:Q,g:$,b:W}=AJ;if(J!=="srgb")return`color(${J} ${Q.toFixed(3)} ${$.toFixed(3)} ${W.toFixed(3)})`;return`rgb(${Math.round(Q*255)},${Math.round($*255)},${Math.round(W*255)})`}offsetHSL(J,Q,$){return this.getHSL(B9),this.setHSL(B9.h+J,B9.s+Q,B9.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(B9),J.getHSL(U7);let $=k6(B9.h,U7.h,Q),W=k6(B9.s,U7.s,Q),Z=k6(B9.l,U7.l,Q);return this.setHSL($,W,Z),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,W=this.b,Z=J.elements;return this.r=Z[0]*Q+Z[3]*$+Z[6]*W,this.g=Z[1]*Q+Z[4]*$+Z[7]*W,this.b=Z[2]*Q+Z[5]*$+Z[8]*W,this}equals(J){return J.r===this.r&&J.g===this.g&&J.b===this.b}fromArray(J,Q=0){return this.r=J[Q],this.g=J[Q+1],this.b=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.r,J[Q+1]=this.g,J[Q+2]=this.b,J}fromBufferAttribute(J,Q){return this.r=J.getX(Q),this.g=J.getY(Q),this.b=J.getZ(Q),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var AJ=new g0;g0.NAMES=qZ;class n8{constructor(J,Q=1,$=1000){this.isFog=!0,this.name="",this.color=new g0(J),this.near=Q,this.far=$}clone(){return new n8(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class o7 extends RJ{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 mJ,this.environmentIntensity=1,this.environmentRotation=new mJ,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(J,Q){if(super.copy(J,Q),J.background!==null)this.background=J.background.clone();if(J.environment!==null)this.environment=J.environment.clone();if(J.fog!==null)this.fog=J.fog.clone();if(this.backgroundBlurriness=J.backgroundBlurriness,this.backgroundIntensity=J.backgroundIntensity,this.backgroundRotation.copy(J.backgroundRotation),this.environmentIntensity=J.environmentIntensity,this.environmentRotation.copy(J.environmentRotation),J.overrideMaterial!==null)this.overrideMaterial=J.overrideMaterial.clone();return this.matrixAutoUpdate=J.matrixAutoUpdate,this}toJSON(J){let Q=super.toJSON(J);if(this.fog!==null)Q.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)Q.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)Q.object.backgroundIntensity=this.backgroundIntensity;if(Q.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)Q.object.environmentIntensity=this.environmentIntensity;return Q.object.environmentRotation=this.environmentRotation.toArray(),Q}}var sJ=new y,H9=new y,_6=new y,X9=new y,W8=new y,Z8=new y,i$=new y,A6=new y,w6=new y,C6=new y,P6=new UJ,T6=new UJ,S6=new UJ;class hJ{constructor(J=new y,Q=new y,$=new y){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,W){W.subVectors($,Q),sJ.subVectors(J,Q),W.cross(sJ);let Z=W.lengthSq();if(Z>0)return W.multiplyScalar(1/Math.sqrt(Z));return W.set(0,0,0)}static getBarycoord(J,Q,$,W,Z){sJ.subVectors(W,Q),H9.subVectors($,Q),_6.subVectors(J,Q);let K=sJ.dot(sJ),Y=sJ.dot(H9),H=sJ.dot(_6),X=H9.dot(H9),U=H9.dot(_6),q=K*X-Y*Y;if(q===0)return Z.set(0,0,0),null;let E=1/q,G=(X*H-Y*U)*E,F=(K*U-Y*H)*E;return Z.set(1-G-F,F,G)}static containsPoint(J,Q,$,W){if(this.getBarycoord(J,Q,$,W,X9)===null)return!1;return X9.x>=0&&X9.y>=0&&X9.x+X9.y<=1}static getInterpolation(J,Q,$,W,Z,K,Y,H){if(this.getBarycoord(J,Q,$,W,X9)===null){if(H.x=0,H.y=0,"z"in H)H.z=0;if("w"in H)H.w=0;return null}return H.setScalar(0),H.addScaledVector(Z,X9.x),H.addScaledVector(K,X9.y),H.addScaledVector(Y,X9.z),H}static getInterpolatedAttribute(J,Q,$,W,Z,K){return P6.setScalar(0),T6.setScalar(0),S6.setScalar(0),P6.fromBufferAttribute(J,Q),T6.fromBufferAttribute(J,$),S6.fromBufferAttribute(J,W),K.setScalar(0),K.addScaledVector(P6,Z.x),K.addScaledVector(T6,Z.y),K.addScaledVector(S6,Z.z),K}static isFrontFacing(J,Q,$,W){return sJ.subVectors($,Q),H9.subVectors(J,Q),sJ.cross(H9).dot(W)<0}set(J,Q,$){return this.a.copy(J),this.b.copy(Q),this.c.copy($),this}setFromPointsAndIndices(J,Q,$,W){return this.a.copy(J[Q]),this.b.copy(J[$]),this.c.copy(J[W]),this}setFromAttributeAndIndices(J,Q,$,W){return this.a.fromBufferAttribute(J,Q),this.b.fromBufferAttribute(J,$),this.c.fromBufferAttribute(J,W),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 sJ.subVectors(this.c,this.b),H9.subVectors(this.a,this.b),sJ.cross(H9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return hJ.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return hJ.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,W,Z){return hJ.getInterpolation(J,this.a,this.b,this.c,Q,$,W,Z)}containsPoint(J){return hJ.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return hJ.isFrontFacing(this.a,this.b,this.c,J)}intersectsBox(J){return J.intersectsTriangle(this)}closestPointToPoint(J,Q){let $=this.a,W=this.b,Z=this.c,K,Y;W8.subVectors(W,$),Z8.subVectors(Z,$),A6.subVectors(J,$);let H=W8.dot(A6),X=Z8.dot(A6);if(H<=0&&X<=0)return Q.copy($);w6.subVectors(J,W);let U=W8.dot(w6),q=Z8.dot(w6);if(U>=0&&q<=U)return Q.copy(W);let E=H*q-U*X;if(E<=0&&H>=0&&U<=0)return K=H/(H-U),Q.copy($).addScaledVector(W8,K);C6.subVectors(J,Z);let G=W8.dot(C6),F=Z8.dot(C6);if(F>=0&&G<=F)return Q.copy(Z);let k=G*X-H*F;if(k<=0&&X>=0&&F<=0)return Y=X/(X-F),Q.copy($).addScaledVector(Z8,Y);let z=U*F-G*q;if(z<=0&&q-U>=0&&G-F>=0)return i$.subVectors(Z,W),Y=(q-U)/(q-U+(G-F)),Q.copy(W).addScaledVector(i$,Y);let N=1/(z+k+E);return K=k*N,Y=E*N,Q.copy($).addScaledVector(W8,K).addScaledVector(Z8,Y)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class l9{constructor(J=new y(1/0,1/0,1/0),Q=new y(-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(iJ.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(iJ.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 $=iJ.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 Z=$.getAttribute("position");if(Q===!0&&Z!==void 0&&J.isInstancedMesh!==!0)for(let K=0,Y=Z.count;K<Y;K++){if(J.isMesh===!0)J.getVertexPosition(K,iJ);else iJ.fromBufferAttribute(Z,K);iJ.applyMatrix4(J.matrixWorld),this.expandByPoint(iJ)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();G7.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();G7.copy($.boundingBox)}G7.applyMatrix4(J.matrixWorld),this.union(G7)}}let W=J.children;for(let Z=0,K=W.length;Z<K;Z++)this.expandByObject(W[Z],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,iJ),iJ.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(C8),N7.subVectors(this.max,C8),K8.subVectors(J.a,C8),Y8.subVectors(J.b,C8),H8.subVectors(J.c,C8),z9.subVectors(Y8,K8),I9.subVectors(H8,Y8),y9.subVectors(K8,H8);let Q=[0,-z9.z,z9.y,0,-I9.z,I9.y,0,-y9.z,y9.y,z9.z,0,-z9.x,I9.z,0,-I9.x,y9.z,0,-y9.x,-z9.y,z9.x,0,-I9.y,I9.x,0,-y9.y,y9.x,0];if(!j6(Q,K8,Y8,H8,N7))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!j6(Q,K8,Y8,H8,N7))return!1;return E7.crossVectors(z9,I9),Q=[E7.x,E7.y,E7.z],j6(Q,K8,Y8,H8,N7)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,iJ).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(iJ).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 U9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),U9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),U9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),U9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),U9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),U9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),U9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),U9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(U9),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(J){return this.min.fromArray(J.min),this.max.fromArray(J.max),this}}var U9=[new y,new y,new y,new y,new y,new y,new y,new y],iJ=new y,G7=new l9,K8=new y,Y8=new y,H8=new y,z9=new y,I9=new y,y9=new y,C8=new y,N7=new y,E7=new y,v9=new y;function j6(J,Q,$,W,Z){for(let K=0,Y=J.length-3;K<=Y;K+=3){v9.fromArray(J,K);let H=Z.x*Math.abs(v9.x)+Z.y*Math.abs(v9.y)+Z.z*Math.abs(v9.z),X=Q.dot(v9),U=$.dot(v9),q=W.dot(v9);if(Math.max(-Math.max(X,U,q),Math.min(X,U,q))>H)return!1}return!0}var OJ=new y,q7=new h0,AK=0;class xJ extends F9{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:AK++}),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 W=0,Z=this.itemSize;W<Z;W++)this.array[J+W]=Q.array[$+W];return this}copyArray(J){return this.array.set(J),this}applyMatrix3(J){if(this.itemSize===2)for(let Q=0,$=this.count;Q<$;Q++)q7.fromBufferAttribute(this,Q),q7.applyMatrix3(J),this.setXY(Q,q7.x,q7.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.applyMatrix3(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.applyMatrix4(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.applyNormalMatrix(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.transformDirection(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.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)$=J9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=J9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize]=Q,this}getY(J){let Q=this.array[J*this.itemSize+1];if(this.normalized)Q=J9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+1]=Q,this}getZ(J){let Q=this.array[J*this.itemSize+2];if(this.normalized)Q=J9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+2]=Q,this}getW(J){let Q=this.array[J*this.itemSize+3];if(this.normalized)Q=J9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,W){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=W,this}setXYZW(J,Q,$,W,Z){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array),Z=QJ(Z,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=W,this.array[J+3]=Z,this}onUpload(J){return this.onUploadCallback=J,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let J={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")J.name=this.name;if(this.usage!==35044)J.usage=this.usage;return J}dispose(){this.dispatchEvent({type:"dispose"})}}class a7 extends xJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class r7 extends xJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class HJ extends xJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var wK=new l9,P8=new y,y6=new y;class z8{constructor(J=new y,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 wK.setFromPoints(J).getCenter($);let W=0;for(let Z=0,K=J.length;Z<K;Z++)W=Math.max(W,$.distanceToSquared(J[Z]));return this.radius=Math.sqrt(W),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;P8.subVectors(J,this.center);let Q=P8.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),W=($-this.radius)*0.5;this.center.addScaledVector(P8,W/$),this.radius+=W}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 y6.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(P8.copy(J.center).add(y6)),this.expandByPoint(P8.copy(J.center).sub(y6));return this}equals(J){return J.center.equals(this.center)&&J.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(J){return this.radius=J.radius,this.center.fromArray(J.center),this}}var CK=0,pJ=new YJ,v6=new RJ,X8=new y,bJ=new l9,T8=new l9,BJ=new y;class CJ extends F9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CK++}),this.uuid=w9(),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((qK(J))?r7:a7)(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 Z=new j0().getNormalMatrix(J);$.applyNormalMatrix(Z),$.needsUpdate=!0}let W=this.attributes.tangent;if(W!==void 0)W.transformDirection(J),W.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this}applyQuaternion(J){return pJ.makeRotationFromQuaternion(J),this.applyMatrix4(pJ),this}rotateX(J){return pJ.makeRotationX(J),this.applyMatrix4(pJ),this}rotateY(J){return pJ.makeRotationY(J),this.applyMatrix4(pJ),this}rotateZ(J){return pJ.makeRotationZ(J),this.applyMatrix4(pJ),this}translate(J,Q,$){return pJ.makeTranslation(J,Q,$),this.applyMatrix4(pJ),this}scale(J,Q,$){return pJ.makeScale(J,Q,$),this.applyMatrix4(pJ),this}lookAt(J){return v6.lookAt(J),v6.updateMatrix(),this.applyMatrix4(v6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(X8).negate(),this.translate(X8.x,X8.y,X8.z),this}setFromPoints(J){let Q=this.getAttribute("position");if(Q===void 0){let $=[];for(let W=0,Z=J.length;W<Z;W++){let K=J[W];$.push(K.x,K.y,K.z||0)}this.setAttribute("position",new HJ($,3))}else{let $=Math.min(J.length,Q.count);for(let W=0;W<$;W++){let Z=J[W];Q.setXYZ(W,Z.x,Z.y,Z.z||0)}if(J.length>Q.count)C0("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");Q.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new l9;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 y(-1/0,-1/0,-1/0),new y(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,W=Q.length;$<W;$++){let Z=Q[$];if(bJ.setFromBufferAttribute(Z),this.morphTargetsRelative)BJ.addVectors(this.boundingBox.min,bJ.min),this.boundingBox.expandByPoint(BJ),BJ.addVectors(this.boundingBox.max,bJ.max),this.boundingBox.expandByPoint(BJ);else this.boundingBox.expandByPoint(bJ.min),this.boundingBox.expandByPoint(bJ.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 z8;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 y,1/0);return}if(J){let $=this.boundingSphere.center;if(bJ.setFromBufferAttribute(J),Q)for(let Z=0,K=Q.length;Z<K;Z++){let Y=Q[Z];if(T8.setFromBufferAttribute(Y),this.morphTargetsRelative)BJ.addVectors(bJ.min,T8.min),bJ.expandByPoint(BJ),BJ.addVectors(bJ.max,T8.max),bJ.expandByPoint(BJ);else bJ.expandByPoint(T8.min),bJ.expandByPoint(T8.max)}bJ.getCenter($);let W=0;for(let Z=0,K=J.count;Z<K;Z++)BJ.fromBufferAttribute(J,Z),W=Math.max(W,$.distanceToSquared(BJ));if(Q)for(let Z=0,K=Q.length;Z<K;Z++){let Y=Q[Z],H=this.morphTargetsRelative;for(let X=0,U=Y.count;X<U;X++){if(BJ.fromBufferAttribute(Y,X),H)X8.fromBufferAttribute(J,X),BJ.add(X8);W=Math.max(W,$.distanceToSquared(BJ))}}if(this.boundingSphere.radius=Math.sqrt(W),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:W,uv:Z}=Q;if(this.hasAttribute("tangent")===!1)this.setAttribute("tangent",new xJ(new Float32Array(4*$.count),4));let K=this.getAttribute("tangent"),Y=[],H=[];for(let C=0;C<$.count;C++)Y[C]=new y,H[C]=new y;let X=new y,U=new y,q=new y,E=new h0,G=new h0,F=new h0,k=new y,z=new y;function N(C,M,B){X.fromBufferAttribute($,C),U.fromBufferAttribute($,M),q.fromBufferAttribute($,B),E.fromBufferAttribute(Z,C),G.fromBufferAttribute(Z,M),F.fromBufferAttribute(Z,B),U.sub(X),q.sub(X),G.sub(E),F.sub(E);let l=1/(G.x*F.y-F.x*G.y);if(!isFinite(l))return;k.copy(U).multiplyScalar(F.y).addScaledVector(q,-G.y).multiplyScalar(l),z.copy(q).multiplyScalar(G.x).addScaledVector(U,-F.x).multiplyScalar(l),Y[C].add(k),Y[M].add(k),Y[B].add(k),H[C].add(z),H[M].add(z),H[B].add(z)}let D=this.groups;if(D.length===0)D=[{start:0,count:J.count}];for(let C=0,M=D.length;C<M;++C){let B=D[C],l=B.start,A=B.count;for(let p=l,c=l+A;p<c;p+=3)N(J.getX(p+0),J.getX(p+1),J.getX(p+2))}let V=new y,_=new y,I=new y,P=new y;function w(C){I.fromBufferAttribute(W,C),P.copy(I);let M=Y[C];V.copy(M),V.sub(I.multiplyScalar(I.dot(M))).normalize(),_.crossVectors(P,M);let l=_.dot(H[C])<0?-1:1;K.setXYZW(C,V.x,V.y,V.z,l)}for(let C=0,M=D.length;C<M;++C){let B=D[C],l=B.start,A=B.count;for(let p=l,c=l+A;p<c;p+=3)w(J.getX(p+0)),w(J.getX(p+1)),w(J.getX(p+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new xJ(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let E=0,G=$.count;E<G;E++)$.setXYZ(E,0,0,0);let W=new y,Z=new y,K=new y,Y=new y,H=new y,X=new y,U=new y,q=new y;if(J)for(let E=0,G=J.count;E<G;E+=3){let F=J.getX(E+0),k=J.getX(E+1),z=J.getX(E+2);W.fromBufferAttribute(Q,F),Z.fromBufferAttribute(Q,k),K.fromBufferAttribute(Q,z),U.subVectors(K,Z),q.subVectors(W,Z),U.cross(q),Y.fromBufferAttribute($,F),H.fromBufferAttribute($,k),X.fromBufferAttribute($,z),Y.add(U),H.add(U),X.add(U),$.setXYZ(F,Y.x,Y.y,Y.z),$.setXYZ(k,H.x,H.y,H.z),$.setXYZ(z,X.x,X.y,X.z)}else for(let E=0,G=Q.count;E<G;E+=3)W.fromBufferAttribute(Q,E+0),Z.fromBufferAttribute(Q,E+1),K.fromBufferAttribute(Q,E+2),U.subVectors(K,Z),q.subVectors(W,Z),U.cross(q),$.setXYZ(E+0,U.x,U.y,U.z),$.setXYZ(E+1,U.x,U.y,U.z),$.setXYZ(E+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++)BJ.fromBufferAttribute(J,Q),BJ.normalize(),J.setXYZ(Q,BJ.x,BJ.y,BJ.z)}toNonIndexed(){function J(Y,H){let{array:X,itemSize:U,normalized:q}=Y,E=new X.constructor(H.length*U),G=0,F=0;for(let k=0,z=H.length;k<z;k++){if(Y.isInterleavedBufferAttribute)G=H[k]*Y.data.stride+Y.offset;else G=H[k]*U;for(let N=0;N<U;N++)E[F++]=X[G++]}return new xJ(E,U,q)}if(this.index===null)return C0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new CJ,$=this.index.array,W=this.attributes;for(let Y in W){let H=W[Y],X=J(H,$);Q.setAttribute(Y,X)}let Z=this.morphAttributes;for(let Y in Z){let H=[],X=Z[Y];for(let U=0,q=X.length;U<q;U++){let E=X[U],G=J(E,$);H.push(G)}Q.morphAttributes[Y]=H}Q.morphTargetsRelative=this.morphTargetsRelative;let K=this.groups;for(let Y=0,H=K.length;Y<H;Y++){let X=K[Y];Q.addGroup(X.start,X.count,X.materialIndex)}return Q}toJSON(){let J={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(J.uuid=this.uuid,J.type=this.type,this.name!=="")J.name=this.name;if(Object.keys(this.userData).length>0)J.userData=this.userData;if(this.parameters!==void 0){let H=this.parameters;for(let X in H)if(H[X]!==void 0)J[X]=H[X];return J}J.data={attributes:{}};let Q=this.index;if(Q!==null)J.data.index={type:Q.array.constructor.name,array:Array.prototype.slice.call(Q.array)};let $=this.attributes;for(let H in $){let X=$[H];J.data.attributes[H]=X.toJSON(J.data)}let W={},Z=!1;for(let H in this.morphAttributes){let X=this.morphAttributes[H],U=[];for(let q=0,E=X.length;q<E;q++){let G=X[q];U.push(G.toJSON(J.data))}if(U.length>0)W[H]=U,Z=!0}if(Z)J.data.morphAttributes=W,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 W=J.attributes;for(let X in W){let U=W[X];this.setAttribute(X,U.clone(Q))}let Z=J.morphAttributes;for(let X in Z){let U=[],q=Z[X];for(let E=0,G=q.length;E<G;E++)U.push(q[E].clone(Q));this.morphAttributes[X]=U}this.morphTargetsRelative=J.morphTargetsRelative;let K=J.groups;for(let X=0,U=K.length;X<U;X++){let q=K[X];this.addGroup(q.start,q.count,q.materialIndex)}let Y=J.boundingBox;if(Y!==null)this.boundingBox=Y.clone();let H=J.boundingSphere;if(H!==null)this.boundingSphere=H.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class nQ{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=w9()}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 W=0,Z=this.stride;W<Z;W++)this.array[J+W]=Q.array[$+W];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=w9();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=w9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var SJ=new y;class h8{constructor(J,Q,$,W=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=J,this.itemSize=Q,this.offset=$,this.normalized=W}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++)SJ.fromBufferAttribute(this,Q),SJ.applyMatrix4(J),this.setXYZ(Q,SJ.x,SJ.y,SJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)SJ.fromBufferAttribute(this,Q),SJ.applyNormalMatrix(J),this.setXYZ(Q,SJ.x,SJ.y,SJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)SJ.fromBufferAttribute(this,Q),SJ.transformDirection(J),this.setXYZ(Q,SJ.x,SJ.y,SJ.z);return this}getComponent(J,Q){let $=this.array[J*this.data.stride+this.offset+Q];if(this.normalized)$=J9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+3]=Q,this}getX(J){let Q=this.data.array[J*this.data.stride+this.offset];if(this.normalized)Q=J9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=J9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=J9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=J9(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this}setXYZ(J,Q,$,W){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=W,this}setXYZW(J,Q,$,W,Z){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array),Z=QJ(Z,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=W,this.data.array[J+3]=Z,this}clone(J){if(J===void 0){b8("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let W=$*this.data.stride+this.offset;for(let Z=0;Z<this.itemSize;Z++)Q.push(this.data.array[W+Z])}return new xJ(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){b8("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let W=$*this.data.stride+this.offset;for(let Z=0;Z<this.itemSize;Z++)Q.push(this.data.array[W+Z])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Q,normalized:this.normalized}}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.toJSON(J);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var PK=0;class R9 extends F9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:PK++}),this.uuid=w9(),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 g0(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(J){if(this._alphaTest>0!==J>0)this.version++;this._alphaTest=J}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(J){if(J===void 0)return;for(let Q in J){let $=J[Q];if($===void 0){C0(`Material: parameter '${Q}' has value of undefined.`);continue}let W=this[Q];if(W===void 0){C0(`Material: '${Q}' is not a property of THREE.${this.type}.`);continue}if(W&&W.isColor)W.set($);else if(W&&W.isVector3&&($&&$.isVector3))W.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 W(Z){let K=[];for(let Y in Z){let H=Z[Y];delete H.metadata,K.push(H)}return K}if(Q){let Z=W(J.textures),K=W(J.images);if(Z.length>0)$.textures=Z;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 W=Q.length;$=Array(W);for(let Z=0;Z!==W;++Z)$[Z]=Q[Z].clone()}return this.clippingPlanes=$,this.clipIntersection=J.clipIntersection,this.clipShadows=J.clipShadows,this.shadowSide=J.shadowSide,this.colorWrite=J.colorWrite,this.precision=J.precision,this.polygonOffset=J.polygonOffset,this.polygonOffsetFactor=J.polygonOffsetFactor,this.polygonOffsetUnits=J.polygonOffsetUnits,this.dithering=J.dithering,this.alphaTest=J.alphaTest,this.alphaHash=J.alphaHash,this.alphaToCoverage=J.alphaToCoverage,this.premultipliedAlpha=J.premultipliedAlpha,this.forceSinglePass=J.forceSinglePass,this.allowOverride=J.allowOverride,this.visible=J.visible,this.toneMapped=J.toneMapped,this.userData=JSON.parse(JSON.stringify(J.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(J){if(J===!0)this.version++}}class s8 extends R9{constructor(J){super();this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new g0(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.rotation=J.rotation,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var U8,S8=new y,G8=new y,N8=new y,E8=new h0,j8=new h0,DZ=new YJ,D7=new y,y8=new y,F7=new y,o$=new h0,f6=new h0,a$=new h0;class t7 extends RJ{constructor(J=new s8){super();if(this.isSprite=!0,this.type="Sprite",U8===void 0){U8=new CJ;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 nQ(Q,5);U8.setIndex([0,1,2,0,2,3]),U8.setAttribute("position",new h8($,3,0,!1)),U8.setAttribute("uv",new h8($,2,3,!1))}this.geometry=U8,this.material=J,this.center=new h0(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(G8.setFromMatrixScale(this.matrixWorld),DZ.copy(J.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(J.camera.matrixWorldInverse,this.matrixWorld),N8.setFromMatrixPosition(this.modelViewMatrix),J.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1)G8.multiplyScalar(-N8.z);let $=this.material.rotation,W,Z;if($!==0)Z=Math.cos($),W=Math.sin($);let K=this.center;O7(D7.set(-0.5,-0.5,0),N8,K,G8,W,Z),O7(y8.set(0.5,-0.5,0),N8,K,G8,W,Z),O7(F7.set(0.5,0.5,0),N8,K,G8,W,Z),o$.set(0,0),f6.set(1,0),a$.set(1,1);let Y=J.ray.intersectTriangle(D7,y8,F7,!1,S8);if(Y===null){if(O7(y8.set(-0.5,0.5,0),N8,K,G8,W,Z),f6.set(0,1),Y=J.ray.intersectTriangle(D7,F7,y8,!1,S8),Y===null)return}let H=J.ray.origin.distanceTo(S8);if(H<J.near||H>J.far)return;Q.push({distance:H,point:S8.clone(),uv:hJ.getInterpolation(S8,D7,y8,F7,o$,f6,a$,new h0),face:null,object:this})}copy(J,Q){if(super.copy(J,Q),J.center!==void 0)this.center.copy(J.center);return this.material=J.material,this}}function O7(J,Q,$,W,Z,K){if(E8.subVectors(J,$).addScalar(0.5).multiply(W),Z!==void 0)j8.x=K*E8.x-Z*E8.y,j8.y=Z*E8.x+K*E8.y;else j8.copy(E8);J.copy(Q),J.x+=j8.x,J.y+=j8.y,J.applyMatrix4(DZ)}var G9=new y,b6=new y,R7=new y,_9=new y,h6=new y,k7=new y,x6=new y;class i8{constructor(J=new y,Q=new y(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,$,W){b6.copy(J).add(Q).multiplyScalar(0.5),R7.copy(Q).sub(J).normalize(),_9.copy(this.origin).sub(b6);let Z=J.distanceTo(Q)*0.5,K=-this.direction.dot(R7),Y=_9.dot(this.direction),H=-_9.dot(R7),X=_9.lengthSq(),U=Math.abs(1-K*K),q,E,G,F;if(U>0)if(q=K*H-Y,E=K*Y-H,F=Z*U,q>=0)if(E>=-F)if(E<=F){let k=1/U;q*=k,E*=k,G=q*(q+K*E+2*Y)+E*(K*q+E+2*H)+X}else E=Z,q=Math.max(0,-(K*E+Y)),G=-q*q+E*(E+2*H)+X;else E=-Z,q=Math.max(0,-(K*E+Y)),G=-q*q+E*(E+2*H)+X;else if(E<=-F)q=Math.max(0,-(-K*Z+Y)),E=q>0?-Z:Math.min(Math.max(-Z,-H),Z),G=-q*q+E*(E+2*H)+X;else if(E<=F)q=0,E=Math.min(Math.max(-Z,-H),Z),G=E*(E+2*H)+X;else q=Math.max(0,-(K*Z+Y)),E=q>0?Z:Math.min(Math.max(-Z,-H),Z),G=-q*q+E*(E+2*H)+X;else E=K>0?-Z:Z,q=Math.max(0,-(K*E+Y)),G=-q*q+E*(E+2*H)+X;if($)$.copy(this.origin).addScaledVector(this.direction,q);if(W)W.copy(b6).addScaledVector(R7,E);return G}intersectSphere(J,Q){G9.subVectors(J.center,this.origin);let $=G9.dot(this.direction),W=G9.dot(G9)-$*$,Z=J.radius*J.radius;if(W>Z)return null;let K=Math.sqrt(Z-W),Y=$-K,H=$+K;if(H<0)return null;if(Y<0)return this.at(H,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 $,W,Z,K,Y,H,X=1/this.direction.x,U=1/this.direction.y,q=1/this.direction.z,E=this.origin;if(X>=0)$=(J.min.x-E.x)*X,W=(J.max.x-E.x)*X;else $=(J.max.x-E.x)*X,W=(J.min.x-E.x)*X;if(U>=0)Z=(J.min.y-E.y)*U,K=(J.max.y-E.y)*U;else Z=(J.max.y-E.y)*U,K=(J.min.y-E.y)*U;if($>K||Z>W)return null;if(Z>$||isNaN($))$=Z;if(K<W||isNaN(W))W=K;if(q>=0)Y=(J.min.z-E.z)*q,H=(J.max.z-E.z)*q;else Y=(J.max.z-E.z)*q,H=(J.min.z-E.z)*q;if($>H||Y>W)return null;if(Y>$||$!==$)$=Y;if(H<W||W!==W)W=H;if(W<0)return null;return this.at($>=0?$:W,Q)}intersectsBox(J){return this.intersectBox(J,G9)!==null}intersectTriangle(J,Q,$,W,Z){h6.subVectors(Q,J),k7.subVectors($,J),x6.crossVectors(h6,k7);let K=this.direction.dot(x6),Y;if(K>0){if(W)return null;Y=1}else if(K<0)Y=-1,K=-K;else return null;_9.subVectors(this.origin,J);let H=Y*this.direction.dot(k7.crossVectors(_9,k7));if(H<0)return null;let X=Y*this.direction.dot(h6.cross(_9));if(X<0)return null;if(H+X>K)return null;let U=-Y*_9.dot(x6);if(U<0)return null;return this.at(U/K,Z)}applyMatrix4(J){return this.origin.applyMatrix4(J),this.direction.transformDirection(J),this}equals(J){return J.origin.equals(this.origin)&&J.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class e7 extends R9{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new g0(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 mJ,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}var r$=new YJ,f9=new i8,M7=new z8,t$=new y,L7=new y,V7=new y,B7=new y,g6=new y,z7=new y,e$=new y,I7=new y;class PJ extends RJ{constructor(J=new CJ,Q=new e7){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 W=Q[$[0]];if(W!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let Z=0,K=W.length;Z<K;Z++){let Y=W[Z].name||String(Z);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Y]=Z}}}}getVertexPosition(J,Q){let $=this.geometry,W=$.attributes.position,Z=$.morphAttributes.position,K=$.morphTargetsRelative;Q.fromBufferAttribute(W,J);let Y=this.morphTargetInfluences;if(Z&&Y){z7.set(0,0,0);for(let H=0,X=Z.length;H<X;H++){let U=Y[H],q=Z[H];if(U===0)continue;if(g6.fromBufferAttribute(q,J),K)z7.addScaledVector(g6,U);else z7.addScaledVector(g6.sub(Q),U)}Q.add(z7)}return Q}raycast(J,Q){let $=this.geometry,W=this.material,Z=this.matrixWorld;if(W===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(M7.copy($.boundingSphere),M7.applyMatrix4(Z),f9.copy(J.ray).recast(J.near),M7.containsPoint(f9.origin)===!1){if(f9.intersectSphere(M7,t$)===null)return;if(f9.origin.distanceToSquared(t$)>(J.far-J.near)**2)return}if(r$.copy(Z).invert(),f9.copy(J.ray).applyMatrix4(r$),$.boundingBox!==null){if(f9.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,f9)}_computeIntersections(J,Q,$){let W,Z=this.geometry,K=this.material,Y=Z.index,H=Z.attributes.position,X=Z.attributes.uv,U=Z.attributes.uv1,q=Z.attributes.normal,E=Z.groups,G=Z.drawRange;if(Y!==null)if(Array.isArray(K))for(let F=0,k=E.length;F<k;F++){let z=E[F],N=K[z.materialIndex],D=Math.max(z.start,G.start),V=Math.min(Y.count,Math.min(z.start+z.count,G.start+G.count));for(let _=D,I=V;_<I;_+=3){let P=Y.getX(_),w=Y.getX(_+1),C=Y.getX(_+2);if(W=_7(this,N,J,$,X,U,q,P,w,C),W)W.faceIndex=Math.floor(_/3),W.face.materialIndex=z.materialIndex,Q.push(W)}}else{let F=Math.max(0,G.start),k=Math.min(Y.count,G.start+G.count);for(let z=F,N=k;z<N;z+=3){let D=Y.getX(z),V=Y.getX(z+1),_=Y.getX(z+2);if(W=_7(this,K,J,$,X,U,q,D,V,_),W)W.faceIndex=Math.floor(z/3),Q.push(W)}}else if(H!==void 0)if(Array.isArray(K))for(let F=0,k=E.length;F<k;F++){let z=E[F],N=K[z.materialIndex],D=Math.max(z.start,G.start),V=Math.min(H.count,Math.min(z.start+z.count,G.start+G.count));for(let _=D,I=V;_<I;_+=3){let P=_,w=_+1,C=_+2;if(W=_7(this,N,J,$,X,U,q,P,w,C),W)W.faceIndex=Math.floor(_/3),W.face.materialIndex=z.materialIndex,Q.push(W)}}else{let F=Math.max(0,G.start),k=Math.min(H.count,G.start+G.count);for(let z=F,N=k;z<N;z+=3){let D=z,V=z+1,_=z+2;if(W=_7(this,K,J,$,X,U,q,D,V,_),W)W.faceIndex=Math.floor(z/3),Q.push(W)}}}}function TK(J,Q,$,W,Z,K,Y,H){let X;if(Q.side===1)X=W.intersectTriangle(Y,K,Z,!0,H);else X=W.intersectTriangle(Z,K,Y,Q.side===0,H);if(X===null)return null;I7.copy(H),I7.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(I7);if(U<$.near||U>$.far)return null;return{distance:U,point:I7.clone(),object:J}}function _7(J,Q,$,W,Z,K,Y,H,X,U){J.getVertexPosition(H,L7),J.getVertexPosition(X,V7),J.getVertexPosition(U,B7);let q=TK(J,Q,$,W,L7,V7,B7,e$);if(q){let E=new y;if(hJ.getBarycoord(e$,L7,V7,B7,E),Z)q.uv=hJ.getInterpolatedAttribute(Z,H,X,U,E,new h0);if(K)q.uv1=hJ.getInterpolatedAttribute(K,H,X,U,E,new h0);if(Y){if(q.normal=hJ.getInterpolatedAttribute(Y,H,X,U,E,new y),q.normal.dot(W.direction)>0)q.normal.multiplyScalar(-1)}let G={a:H,b:X,c:U,normal:new y,materialIndex:0};hJ.getNormal(L7,V7,B7,G.normal),q.face=G,q.barycoord=E}return q}class sQ extends zJ{constructor(J=null,Q=1,$=1,W,Z,K,Y,H,X=1003,U=1003,q,E){super(null,K,Y,H,X,U,W,Z,q,E);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var p6=new y,SK=new y,jK=new j0;class N9{constructor(J=new y(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,$,W){return this.normal.set(J,Q,$),this.constant=W,this}setFromNormalAndCoplanarPoint(J,Q){return this.normal.copy(J),this.constant=-Q.dot(this.normal),this}setFromCoplanarPoints(J,Q,$){let W=p6.subVectors($,Q).cross(SK.subVectors(J,Q)).normalize();return this.setFromNormalAndCoplanarPoint(W,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 W=J.delta(p6),Z=this.normal.dot(W);if(Z===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let K=-(J.start.dot(this.normal)+this.constant)/Z;if($===!0&&(K<0||K>1))return null;return Q.copy(J.start).addScaledVector(W,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||jK.getNormalMatrix(J),W=this.coplanarPoint(p6).applyMatrix4(J),Z=this.normal.applyMatrix3($).normalize();return this.constant=-W.dot(Z),this}translate(J){return this.constant-=J.dot(this.normal),this}equals(J){return J.normal.equals(this.normal)&&J.constant===this.constant}clone(){return new this.constructor().copy(this)}}var b9=new z8,yK=new h0(0.5,0.5),A7=new y;class o8{constructor(J=new N9,Q=new N9,$=new N9,W=new N9,Z=new N9,K=new N9){this.planes=[J,Q,$,W,Z,K]}set(J,Q,$,W,Z,K){let Y=this.planes;return Y[0].copy(J),Y[1].copy(Q),Y[2].copy($),Y[3].copy(W),Y[4].copy(Z),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 W=this.planes,Z=J.elements,K=Z[0],Y=Z[1],H=Z[2],X=Z[3],U=Z[4],q=Z[5],E=Z[6],G=Z[7],F=Z[8],k=Z[9],z=Z[10],N=Z[11],D=Z[12],V=Z[13],_=Z[14],I=Z[15];if(W[0].setComponents(X-K,G-U,N-F,I-D).normalize(),W[1].setComponents(X+K,G+U,N+F,I+D).normalize(),W[2].setComponents(X+Y,G+q,N+k,I+V).normalize(),W[3].setComponents(X-Y,G-q,N-k,I-V).normalize(),$)W[4].setComponents(H,E,z,_).normalize(),W[5].setComponents(X-H,G-E,N-z,I-_).normalize();else if(W[4].setComponents(X-H,G-E,N-z,I-_).normalize(),Q===2000)W[5].setComponents(X+H,G+E,N+z,I+_).normalize();else if(Q===2001)W[5].setComponents(H,E,z,_).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();b9.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();b9.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(b9)}intersectsSprite(J){b9.center.set(0,0,0);let Q=yK.distanceTo(J.center);return b9.radius=0.7071067811865476+Q,b9.applyMatrix4(J.matrixWorld),this.intersectsSphere(b9)}intersectsSphere(J){let Q=this.planes,$=J.center,W=-J.radius;for(let Z=0;Z<6;Z++)if(Q[Z].distanceToPoint($)<W)return!1;return!0}intersectsBox(J){let Q=this.planes;for(let $=0;$<6;$++){let W=Q[$];if(A7.x=W.normal.x>0?J.max.x:J.min.x,A7.y=W.normal.y>0?J.max.y:J.min.y,A7.z=W.normal.z>0?J.max.z:J.min.z,W.distanceToPoint(A7)<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 J6 extends R9{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new g0(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.linewidth=J.linewidth,this.linecap=J.linecap,this.linejoin=J.linejoin,this.fog=J.fog,this}}var v7=new y,f7=new y,JW=new YJ,v8=new i8,w7=new z8,m6=new y,QW=new y;class iQ extends RJ{constructor(J=new CJ,Q=new J6){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 W=1,Z=Q.count;W<Z;W++)v7.fromBufferAttribute(Q,W-1),f7.fromBufferAttribute(Q,W),$[W]=$[W-1],$[W]+=v7.distanceTo(f7);J.setAttribute("lineDistance",new HJ($,1))}else C0("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(J,Q){let $=this.geometry,W=this.matrixWorld,Z=J.params.Line.threshold,K=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(w7.copy($.boundingSphere),w7.applyMatrix4(W),w7.radius+=Z,J.ray.intersectsSphere(w7)===!1)return;JW.copy(W).invert(),v8.copy(J.ray).applyMatrix4(JW);let Y=Z/((this.scale.x+this.scale.y+this.scale.z)/3),H=Y*Y,X=this.isLineSegments?2:1,U=$.index,E=$.attributes.position;if(U!==null){let G=Math.max(0,K.start),F=Math.min(U.count,K.start+K.count);for(let k=G,z=F-1;k<z;k+=X){let N=U.getX(k),D=U.getX(k+1),V=C7(this,J,v8,H,N,D,k);if(V)Q.push(V)}if(this.isLineLoop){let k=U.getX(F-1),z=U.getX(G),N=C7(this,J,v8,H,k,z,F-1);if(N)Q.push(N)}}else{let G=Math.max(0,K.start),F=Math.min(E.count,K.start+K.count);for(let k=G,z=F-1;k<z;k+=X){let N=C7(this,J,v8,H,k,k+1,k);if(N)Q.push(N)}if(this.isLineLoop){let k=C7(this,J,v8,H,F-1,G,F-1);if(k)Q.push(k)}}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let W=Q[$[0]];if(W!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let Z=0,K=W.length;Z<K;Z++){let Y=W[Z].name||String(Z);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Y]=Z}}}}}function C7(J,Q,$,W,Z,K,Y){let H=J.geometry.attributes.position;if(v7.fromBufferAttribute(H,Z),f7.fromBufferAttribute(H,K),$.distanceSqToSegment(v7,f7,m6,QW)>W)return;m6.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(m6);if(U<Q.near||U>Q.far)return;return{distance:U,point:QW.clone().applyMatrix4(J.matrixWorld),index:Y,face:null,faceIndex:null,barycoord:null,object:J}}var $W=new y,WW=new y;class oQ extends iQ{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 W=0,Z=Q.count;W<Z;W+=2)$W.fromBufferAttribute(Q,W),WW.fromBufferAttribute(Q,W+1),$[W]=W===0?0:$[W-1],$[W+1]=$[W]+$W.distanceTo(WW);J.setAttribute("lineDistance",new HJ($,1))}else C0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Q6 extends zJ{constructor(J=[],Q=301,$,W,Z,K,Y,H,X,U){super(J,Q,$,W,Z,K,Y,H,X,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}}class $6 extends zJ{constructor(J,Q,$,W,Z,K,Y,H,X){super(J,Q,$,W,Z,K,Y,H,X);this.isCanvasTexture=!0,this.needsUpdate=!0}}class T9 extends zJ{constructor(J,Q,$=1014,W,Z,K,Y=1003,H=1003,X,U=1026,q=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let E={width:J,height:Q,depth:q};super(E,W,Z,K,Y,H,U,$,X);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new l8(Object.assign({},J.image)),this.compareFunction=J.compareFunction,this}toJSON(J){let Q=super.toJSON(J);if(this.compareFunction!==null)Q.compareFunction=this.compareFunction;return Q}}class aQ extends T9{constructor(J,Q=1014,$=301,W,Z,K=1003,Y=1003,H,X=1026){let U={width:J,height:J,depth:1},q=[U,U,U,U,U,U];super(J,J,Q,$,W,Z,K,Y,H,X);this.image=q,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}}class W6 extends zJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class I8 extends CJ{constructor(J=1,Q=1,$=1,W=1,Z=1,K=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:W,heightSegments:Z,depthSegments:K};let Y=this;W=Math.floor(W),Z=Math.floor(Z),K=Math.floor(K);let H=[],X=[],U=[],q=[],E=0,G=0;F("z","y","x",-1,-1,$,Q,J,K,Z,0),F("z","y","x",1,-1,$,Q,-J,K,Z,1),F("x","z","y",1,1,J,$,Q,W,K,2),F("x","z","y",1,-1,J,$,-Q,W,K,3),F("x","y","z",1,-1,J,Q,$,W,Z,4),F("x","y","z",-1,-1,J,Q,-$,W,Z,5),this.setIndex(H),this.setAttribute("position",new HJ(X,3)),this.setAttribute("normal",new HJ(U,3)),this.setAttribute("uv",new HJ(q,2));function F(k,z,N,D,V,_,I,P,w,C,M){let B=_/w,l=I/C,A=_/2,p=I/2,c=P/2,v=w+1,d=C+1,x=0,g=0,a=new y;for(let J0=0;J0<d;J0++){let U0=J0*l-p;for(let z0=0;z0<v;z0++){let e=z0*B-A;a[k]=e*D,a[z]=U0*V,a[N]=c,X.push(a.x,a.y,a.z),a[k]=0,a[z]=0,a[N]=P>0?1:-1,U.push(a.x,a.y,a.z),q.push(z0/w),q.push(1-J0/C),x+=1}}for(let J0=0;J0<C;J0++)for(let U0=0;U0<w;U0++){let z0=E+U0+v*J0,e=E+U0+v*(J0+1),V0=E+(U0+1)+v*(J0+1),_0=E+(U0+1)+v*J0;H.push(z0,e,_0),H.push(e,V0,_0),g+=6}Y.addGroup(G,g,M),G+=g,E+=x}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new I8(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class a8 extends CJ{constructor(J=1,Q=1,$=1,W=32,Z=1,K=!1,Y=0,H=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:W,heightSegments:Z,openEnded:K,thetaStart:Y,thetaLength:H};let X=this;W=Math.floor(W),Z=Math.floor(Z);let U=[],q=[],E=[],G=[],F=0,k=[],z=$/2,N=0;if(D(),K===!1){if(J>0)V(!0);if(Q>0)V(!1)}this.setIndex(U),this.setAttribute("position",new HJ(q,3)),this.setAttribute("normal",new HJ(E,3)),this.setAttribute("uv",new HJ(G,2));function D(){let _=new y,I=new y,P=0,w=(Q-J)/$;for(let C=0;C<=Z;C++){let M=[],B=C/Z,l=B*(Q-J)+J;for(let A=0;A<=W;A++){let p=A/W,c=p*H+Y,v=Math.sin(c),d=Math.cos(c);I.x=l*v,I.y=-B*$+z,I.z=l*d,q.push(I.x,I.y,I.z),_.set(v,w,d).normalize(),E.push(_.x,_.y,_.z),G.push(p,1-B),M.push(F++)}k.push(M)}for(let C=0;C<W;C++)for(let M=0;M<Z;M++){let B=k[M][C],l=k[M+1][C],A=k[M+1][C+1],p=k[M][C+1];if(J>0||M!==0)U.push(B,l,p),P+=3;if(Q>0||M!==Z-1)U.push(l,A,p),P+=3}X.addGroup(N,P,0),N+=P}function V(_){let I=F,P=new h0,w=new y,C=0,M=_===!0?J:Q,B=_===!0?1:-1;for(let A=1;A<=W;A++)q.push(0,z*B,0),E.push(0,B,0),G.push(0.5,0.5),F++;let l=F;for(let A=0;A<=W;A++){let c=A/W*H+Y,v=Math.cos(c),d=Math.sin(c);w.x=M*d,w.y=z*B,w.z=M*v,q.push(w.x,w.y,w.z),E.push(0,B,0),P.x=v*0.5+0.5,P.y=d*0.5*B+0.5,G.push(P.x,P.y),F++}for(let A=0;A<W;A++){let p=I+A,c=l+A;if(_===!0)U.push(c,c+1,p);else U.push(c+1,c,p);C+=3}X.addGroup(N,C,_===!0?1:2),N+=C}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new a8(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class u9 extends CJ{constructor(J=1,Q=1,$=1,W=1){super();this.type="PlaneGeometry",this.parameters={width:J,height:Q,widthSegments:$,heightSegments:W};let Z=J/2,K=Q/2,Y=Math.floor($),H=Math.floor(W),X=Y+1,U=H+1,q=J/Y,E=Q/H,G=[],F=[],k=[],z=[];for(let N=0;N<U;N++){let D=N*E-K;for(let V=0;V<X;V++){let _=V*q-Z;F.push(_,-D,0),k.push(0,0,1),z.push(V/Y),z.push(1-N/H)}}for(let N=0;N<H;N++)for(let D=0;D<Y;D++){let V=D+X*N,_=D+X*(N+1),I=D+1+X*(N+1),P=D+1+X*N;G.push(V,_,P),G.push(_,I,P)}this.setIndex(G),this.setAttribute("position",new HJ(F,3)),this.setAttribute("normal",new HJ(k,3)),this.setAttribute("uv",new HJ(z,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new u9(J.width,J.height,J.widthSegments,J.heightSegments)}}class r8 extends CJ{constructor(J=1,Q=32,$=16,W=0,Z=Math.PI*2,K=0,Y=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:W,phiLength:Z,thetaStart:K,thetaLength:Y},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let H=Math.min(K+Y,Math.PI),X=0,U=[],q=new y,E=new y,G=[],F=[],k=[],z=[];for(let N=0;N<=$;N++){let D=[],V=N/$,_=0;if(N===0&&K===0)_=0.5/Q;else if(N===$&&H===Math.PI)_=-0.5/Q;for(let I=0;I<=Q;I++){let P=I/Q;q.x=-J*Math.cos(W+P*Z)*Math.sin(K+V*Y),q.y=J*Math.cos(K+V*Y),q.z=J*Math.sin(W+P*Z)*Math.sin(K+V*Y),F.push(q.x,q.y,q.z),E.copy(q).normalize(),k.push(E.x,E.y,E.z),z.push(P+_,1-V),D.push(X++)}U.push(D)}for(let N=0;N<$;N++)for(let D=0;D<Q;D++){let V=U[N][D+1],_=U[N][D],I=U[N+1][D],P=U[N+1][D+1];if(N!==0||K>0)G.push(V,_,P);if(N!==$-1||H<Math.PI)G.push(_,I,P)}this.setIndex(G),this.setAttribute("position",new HJ(F,3)),this.setAttribute("normal",new HJ(k,3)),this.setAttribute("uv",new HJ(z,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new r8(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class t8 extends CJ{constructor(J=1,Q=0.4,$=12,W=48,Z=Math.PI*2,K=0,Y=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:W,arc:Z,thetaStart:K,thetaLength:Y},$=Math.floor($),W=Math.floor(W);let H=[],X=[],U=[],q=[],E=new y,G=new y,F=new y;for(let k=0;k<=$;k++){let z=K+k/$*Y;for(let N=0;N<=W;N++){let D=N/W*Z;G.x=(J+Q*Math.cos(z))*Math.cos(D),G.y=(J+Q*Math.cos(z))*Math.sin(D),G.z=Q*Math.sin(z),X.push(G.x,G.y,G.z),E.x=J*Math.cos(D),E.y=J*Math.sin(D),F.subVectors(G,E).normalize(),U.push(F.x,F.y,F.z),q.push(N/W),q.push(k/$)}}for(let k=1;k<=$;k++)for(let z=1;z<=W;z++){let N=(W+1)*k+z-1,D=(W+1)*(k-1)+z-1,V=(W+1)*(k-1)+z,_=(W+1)*k+z;H.push(N,D,_),H.push(D,V,_)}this.setIndex(H),this.setAttribute("position",new HJ(X,3)),this.setAttribute("normal",new HJ(U,3)),this.setAttribute("uv",new HJ(q,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new t8(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}function c9(J){let Q={};for(let $ in J){Q[$]={};for(let W in J[$]){let Z=J[$][W];if(ZW(Z))if(Z.isRenderTargetTexture)C0("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Q[$][W]=null;else Q[$][W]=Z.clone();else if(Array.isArray(Z))if(ZW(Z[0])){let K=[];for(let Y=0,H=Z.length;Y<H;Y++)K[Y]=Z[Y].clone();Q[$][W]=K}else Q[$][W]=Z.slice();else Q[$][W]=Z}}return Q}function TJ(J){let Q={};for(let $=0;$<J.length;$++){let W=c9(J[$]);for(let Z in W)Q[Z]=W[Z]}return Q}function ZW(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function vK(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function rQ(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return i0.workingColorSpace}var FZ={clone:c9,merge:TJ},fK=`void main() {
|
|
1
|
+
import{u as ZK}from"./index-18hnqcxx.js";import{E as WK}from"./index-xv716176.js";var NW="184";var EW=0,u6=1,qW=2;var x8=1,DW=2,k8=3,M8=0,jJ=1,Q9=2,$9=0,g8=1,c6=2,n6=3,s6=4,FW=5;var L8=100,OW=101,RW=102,kW=103,MW=104,LW=200,VW=201,BW=202,zW=203,IW=204,_W=205,AW=206,wW=207,CW=208,PW=209,TW=210,SW=211,jW=212,yW=213,vW=214,fW=0,bW=1,hW=2,i6=3,xW=4,gW=5,pW=6,mW=7,dW=0,lW=1,uW=2,oJ=0,o6=1,a6=2,r6=3,t6=4,e6=5,JQ=6,QQ=7;var V8=301,h9=302,b7=303,h7=304,p8=306,cW=1000,x7=1001,nW=1002,C9=1003,sW=1004;var m8=1005;var yJ=1006,g7=1007;var x9=1008;var aJ=1009,iW=1010,oW=1011,d8=1012,$Q=1013,P9=1014,q9=1015,D9=1016,WQ=1017,ZQ=1018,B8=1020,aW=35902,rW=35899,tW=1021,eW=1022,W9=1023,g9=1026,p9=1027,JZ=1028,KQ=1029,m9=1030,YQ=1031;var HQ=1033,p7=33776,m7=33777,d7=33778,l7=33779,XQ=35840,UQ=35841,GQ=35842,NQ=35843,EQ=36196,qQ=37492,DQ=37496,FQ=37488,OQ=37489,u7=37490,RQ=37491,kQ=37808,MQ=37809,LQ=37810,VQ=37811,BQ=37812,zQ=37813,IQ=37814,_Q=37815,AQ=37816,wQ=37817,CQ=37818,PQ=37819,TQ=37820,SQ=37821,jQ=36492,yQ=36494,vQ=36495,fQ=36283,bQ=36284,c7=36285,hQ=36286;var xQ=0,QZ=1,d9="",$Z="srgb",gQ="srgb-linear",pQ="linear",ZJ="srgb";var WZ=512,ZZ=513,KZ=514,n7=515,YZ=516,HZ=517,s7=518,XZ=519;var mQ="300 es",dQ=2000;function qK(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function DK(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function f8(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function UZ(){let J=f8("canvas");return J.style.display="block",J}var h$={},R8=null;function b8(...J){let Q="THREE."+J.shift();if(R8)R8("log",Q,...J);else console.log(Q,...J)}function GZ(J){let Q=J[0];if(typeof Q==="string"&&Q.startsWith("TSL:")){let $=J[1];if($&&$.isStackTrace)J[0]+=" "+$.getLocation();else J[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return J}function C0(...J){J=GZ(J);let Q="THREE."+J.shift();if(R8)R8("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function T0(...J){J=GZ(J);let Q="THREE."+J.shift();if(R8)R8("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function j7(...J){let Q=J.join(" ");if(Q in h$)return;h$[Q]=!0,C0(...J)}function NZ(J,Q,$){return new Promise(function(W,Z){function K(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:Z();break;case J.TIMEOUT_EXPIRED:setTimeout(K,$);break;default:W()}}setTimeout(K,$)})}var EZ={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class F9{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 W=$[J];if(W!==void 0){let Z=W.indexOf(Q);if(Z!==-1)W.splice(Z,1)}}dispatchEvent(J){let Q=this._listeners;if(Q===void 0)return;let $=Q[J.type];if($!==void 0){J.target=this;let W=$.slice(0);for(let Z=0,K=W.length;Z<K;Z++)W[Z].call(this,J);J.target=null}}}var _J=["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"];var R6=Math.PI/180,y7=180/Math.PI;function w9(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,W=Math.random()*4294967295|0;return(_J[J&255]+_J[J>>8&255]+_J[J>>16&255]+_J[J>>24&255]+"-"+_J[Q&255]+_J[Q>>8&255]+"-"+_J[Q>>16&15|64]+_J[Q>>24&255]+"-"+_J[$&63|128]+_J[$>>8&255]+"-"+_J[$>>16&255]+_J[$>>24&255]+_J[W&255]+_J[W>>8&255]+_J[W>>16&255]+_J[W>>24&255]).toLowerCase()}function o0(J,Q,$){return Math.max(Q,Math.min($,J))}function FK(J,Q){return(J%Q+Q)%Q}function k6(J,Q,$){return(1-$)*J+$*Q}function J9(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return J/4294967295;case Uint16Array:return J/65535;case Uint8Array:return J/255;case Int32Array:return Math.max(J/2147483647,-1);case Int16Array:return Math.max(J/32767,-1);case Int8Array:return Math.max(J/127,-1);default:throw Error("Invalid component type.")}}function QJ(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return Math.round(J*4294967295);case Uint16Array:return Math.round(J*65535);case Uint8Array:return Math.round(J*255);case Int32Array:return Math.round(J*2147483647);case Int16Array:return Math.round(J*32767);case Int8Array:return Math.round(J*127);default:throw Error("Invalid component type.")}}class h0{static{h0.prototype.isVector2=!0}constructor(J=0,Q=0){this.x=J,this.y=Q}get width(){return this.x}set width(J){this.x=J}get height(){return this.y}set height(J){this.y=J}set(J,Q){return this.x=J,this.y=Q,this}setScalar(J){return this.x=J,this.y=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y)}copy(J){return this.x=J.x,this.y=J.y,this}add(J){return this.x+=J.x,this.y+=J.y,this}addScalar(J){return this.x+=J,this.y+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this}subScalar(J){return this.x-=J,this.y-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this}multiply(J){return this.x*=J.x,this.y*=J.y,this}multiplyScalar(J){return this.x*=J,this.y*=J,this}divide(J){return this.x/=J.x,this.y/=J.y,this}divideScalar(J){return this.multiplyScalar(1/J)}applyMatrix3(J){let Q=this.x,$=this.y,W=J.elements;return this.x=W[0]*Q+W[3]*$+W[6],this.y=W[1]*Q+W[4]*$+W[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=o0(this.x,J.x,Q.x),this.y=o0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=o0(this.x,J,Q),this.y=o0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(o0($,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(o0($,-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),W=Math.sin(Q),Z=this.x-J.x,K=this.y-J.y;return this.x=Z*$-K*W+J.x,this.y=Z*W+K*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class O9{constructor(J=0,Q=0,$=0,W=1){this.isQuaternion=!0,this._x=J,this._y=Q,this._z=$,this._w=W}static slerpFlat(J,Q,$,W,Z,K,Y){let H=$[W+0],X=$[W+1],U=$[W+2],q=$[W+3],E=Z[K+0],G=Z[K+1],F=Z[K+2],k=Z[K+3];if(q!==k||H!==E||X!==G||U!==F){let z=H*E+X*G+U*F+q*k;if(z<0)E=-E,G=-G,F=-F,k=-k,z=-z;let N=1-Y;if(z<0.9995){let D=Math.acos(z),V=Math.sin(D);N=Math.sin(N*D)/V,Y=Math.sin(Y*D)/V,H=H*N+E*Y,X=X*N+G*Y,U=U*N+F*Y,q=q*N+k*Y}else{H=H*N+E*Y,X=X*N+G*Y,U=U*N+F*Y,q=q*N+k*Y;let D=1/Math.sqrt(H*H+X*X+U*U+q*q);H*=D,X*=D,U*=D,q*=D}}J[Q]=H,J[Q+1]=X,J[Q+2]=U,J[Q+3]=q}static multiplyQuaternionsFlat(J,Q,$,W,Z,K){let Y=$[W],H=$[W+1],X=$[W+2],U=$[W+3],q=Z[K],E=Z[K+1],G=Z[K+2],F=Z[K+3];return J[Q]=Y*F+U*q+H*G-X*E,J[Q+1]=H*F+U*E+X*q-Y*G,J[Q+2]=X*F+U*G+Y*E-H*q,J[Q+3]=U*F-Y*q-H*E-X*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,$,W){return this._x=J,this._y=Q,this._z=$,this._w=W,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:W,_z:Z,_order:K}=J,Y=Math.cos,H=Math.sin,X=Y($/2),U=Y(W/2),q=Y(Z/2),E=H($/2),G=H(W/2),F=H(Z/2);switch(K){case"XYZ":this._x=E*U*q+X*G*F,this._y=X*G*q-E*U*F,this._z=X*U*F+E*G*q,this._w=X*U*q-E*G*F;break;case"YXZ":this._x=E*U*q+X*G*F,this._y=X*G*q-E*U*F,this._z=X*U*F-E*G*q,this._w=X*U*q+E*G*F;break;case"ZXY":this._x=E*U*q-X*G*F,this._y=X*G*q+E*U*F,this._z=X*U*F+E*G*q,this._w=X*U*q-E*G*F;break;case"ZYX":this._x=E*U*q-X*G*F,this._y=X*G*q+E*U*F,this._z=X*U*F-E*G*q,this._w=X*U*q+E*G*F;break;case"YZX":this._x=E*U*q+X*G*F,this._y=X*G*q+E*U*F,this._z=X*U*F-E*G*q,this._w=X*U*q-E*G*F;break;case"XZY":this._x=E*U*q-X*G*F,this._y=X*G*q-E*U*F,this._z=X*U*F+E*G*q,this._w=X*U*q+E*G*F;break;default:C0("Quaternion: .setFromEuler() encountered an unknown order: "+K)}if(Q===!0)this._onChangeCallback();return this}setFromAxisAngle(J,Q){let $=Q/2,W=Math.sin($);return this._x=J.x*W,this._y=J.y*W,this._z=J.z*W,this._w=Math.cos($),this._onChangeCallback(),this}setFromRotationMatrix(J){let Q=J.elements,$=Q[0],W=Q[4],Z=Q[8],K=Q[1],Y=Q[5],H=Q[9],X=Q[2],U=Q[6],q=Q[10],E=$+Y+q;if(E>0){let G=0.5/Math.sqrt(E+1);this._w=0.25/G,this._x=(U-H)*G,this._y=(Z-X)*G,this._z=(K-W)*G}else if($>Y&&$>q){let G=2*Math.sqrt(1+$-Y-q);this._w=(U-H)/G,this._x=0.25*G,this._y=(W+K)/G,this._z=(Z+X)/G}else if(Y>q){let G=2*Math.sqrt(1+Y-$-q);this._w=(Z-X)/G,this._x=(W+K)/G,this._y=0.25*G,this._z=(H+U)/G}else{let G=2*Math.sqrt(1+q-$-Y);this._w=(K-W)/G,this._x=(Z+X)/G,this._y=(H+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(o0(this.dot(J),-1,1)))}rotateTowards(J,Q){let $=this.angleTo(J);if($===0)return this;let W=Math.min(1,Q/$);return this.slerp(J,W),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:W,_z:Z,_w:K}=J,Y=Q._x,H=Q._y,X=Q._z,U=Q._w;return this._x=$*U+K*Y+W*X-Z*H,this._y=W*U+K*H+Z*Y-$*X,this._z=Z*U+K*X+$*H-W*Y,this._w=K*U-$*Y-W*H-Z*X,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:W,_z:Z,_w:K}=J,Y=this.dot(J);if(Y<0)$=-$,W=-W,Z=-Z,K=-K,Y=-Y;let H=1-Q;if(Y<0.9995){let X=Math.acos(Y),U=Math.sin(X);H=Math.sin(H*X)/U,Q=Math.sin(Q*X)/U,this._x=this._x*H+$*Q,this._y=this._y*H+W*Q,this._z=this._z*H+Z*Q,this._w=this._w*H+K*Q,this._onChangeCallback()}else this._x=this._x*H+$*Q,this._y=this._y*H+W*Q,this._z=this._z*H+Z*Q,this._w=this._w*H+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(),W=Math.sqrt(1-$),Z=Math.sqrt($);return this.set(W*Math.sin(J),W*Math.cos(J),Z*Math.sin(Q),Z*Math.cos(Q))}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._w===this._w}fromArray(J,Q=0){return this._x=J[Q],this._y=J[Q+1],this._z=J[Q+2],this._w=J[Q+3],this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._w,J}fromBufferAttribute(J,Q){return this._x=J.getX(Q),this._y=J.getY(Q),this._z=J.getZ(Q),this._w=J.getW(Q),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class y{static{y.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(x$.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(x$.setFromAxisAngle(J,Q))}applyMatrix3(J){let Q=this.x,$=this.y,W=this.z,Z=J.elements;return this.x=Z[0]*Q+Z[3]*$+Z[6]*W,this.y=Z[1]*Q+Z[4]*$+Z[7]*W,this.z=Z[2]*Q+Z[5]*$+Z[8]*W,this}applyNormalMatrix(J){return this.applyMatrix3(J).normalize()}applyMatrix4(J){let Q=this.x,$=this.y,W=this.z,Z=J.elements,K=1/(Z[3]*Q+Z[7]*$+Z[11]*W+Z[15]);return this.x=(Z[0]*Q+Z[4]*$+Z[8]*W+Z[12])*K,this.y=(Z[1]*Q+Z[5]*$+Z[9]*W+Z[13])*K,this.z=(Z[2]*Q+Z[6]*$+Z[10]*W+Z[14])*K,this}applyQuaternion(J){let Q=this.x,$=this.y,W=this.z,Z=J.x,K=J.y,Y=J.z,H=J.w,X=2*(K*W-Y*$),U=2*(Y*Q-Z*W),q=2*(Z*$-K*Q);return this.x=Q+H*X+K*q-Y*U,this.y=$+H*U+Y*X-Z*q,this.z=W+H*q+Z*U-K*X,this}project(J){return this.applyMatrix4(J.matrixWorldInverse).applyMatrix4(J.projectionMatrix)}unproject(J){return this.applyMatrix4(J.projectionMatrixInverse).applyMatrix4(J.matrixWorld)}transformDirection(J){let Q=this.x,$=this.y,W=this.z,Z=J.elements;return this.x=Z[0]*Q+Z[4]*$+Z[8]*W,this.y=Z[1]*Q+Z[5]*$+Z[9]*W,this.z=Z[2]*Q+Z[6]*$+Z[10]*W,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=o0(this.x,J.x,Q.x),this.y=o0(this.y,J.y,Q.y),this.z=o0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=o0(this.x,J,Q),this.y=o0(this.y,J,Q),this.z=o0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(o0($,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:W,z:Z}=J,K=Q.x,Y=Q.y,H=Q.z;return this.x=W*H-Z*Y,this.y=Z*K-$*H,this.z=$*Y-W*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 M6.copy(this).projectOnVector(J),this.sub(M6)}reflect(J){return this.sub(M6.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(o0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y,W=this.z-J.z;return Q*Q+$*$+W*W}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 W=Math.sin(Q)*J;return this.x=W*Math.sin($),this.y=Math.cos(Q)*J,this.z=W*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(),W=this.setFromMatrixColumn(J,2).length();return this.x=Q,this.y=$,this.z=W,this}setFromMatrixColumn(J,Q){return this.fromArray(J.elements,Q*4)}setFromMatrix3Column(J,Q){return this.fromArray(J.elements,Q*3)}setFromEuler(J){return this.x=J._x,this.y=J._y,this.z=J._z,this}setFromColor(J){return this.x=J.r,this.y=J.g,this.z=J.b,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let J=Math.random()*Math.PI*2,Q=Math.random()*2-1,$=Math.sqrt(1-Q*Q);return this.x=$*Math.cos(J),this.y=Q,this.z=$*Math.sin(J),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var M6=new y,x$=new O9;class j0{static{j0.prototype.isMatrix3=!0}constructor(J,Q,$,W,Z,K,Y,H,X){if(this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,W,Z,K,Y,H,X)}set(J,Q,$,W,Z,K,Y,H,X){let U=this.elements;return U[0]=J,U[1]=W,U[2]=Y,U[3]=Q,U[4]=Z,U[5]=H,U[6]=$,U[7]=K,U[8]=X,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],this}extractBasis(J,Q,$){return J.setFromMatrix3Column(this,0),Q.setFromMatrix3Column(this,1),$.setFromMatrix3Column(this,2),this}setFromMatrix4(J){let Q=J.elements;return this.set(Q[0],Q[4],Q[8],Q[1],Q[5],Q[9],Q[2],Q[6],Q[10]),this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,W=Q.elements,Z=this.elements,K=$[0],Y=$[3],H=$[6],X=$[1],U=$[4],q=$[7],E=$[2],G=$[5],F=$[8],k=W[0],z=W[3],N=W[6],D=W[1],V=W[4],_=W[7],I=W[2],P=W[5],w=W[8];return Z[0]=K*k+Y*D+H*I,Z[3]=K*z+Y*V+H*P,Z[6]=K*N+Y*_+H*w,Z[1]=X*k+U*D+q*I,Z[4]=X*z+U*V+q*P,Z[7]=X*N+U*_+q*w,Z[2]=E*k+G*D+F*I,Z[5]=E*z+G*V+F*P,Z[8]=E*N+G*_+F*w,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[3]*=J,Q[6]*=J,Q[1]*=J,Q[4]*=J,Q[7]*=J,Q[2]*=J,Q[5]*=J,Q[8]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[1],W=J[2],Z=J[3],K=J[4],Y=J[5],H=J[6],X=J[7],U=J[8];return Q*K*U-Q*Y*X-$*Z*U+$*Y*H+W*Z*X-W*K*H}invert(){let J=this.elements,Q=J[0],$=J[1],W=J[2],Z=J[3],K=J[4],Y=J[5],H=J[6],X=J[7],U=J[8],q=U*K-Y*X,E=Y*H-U*Z,G=X*Z-K*H,F=Q*q+$*E+W*G;if(F===0)return this.set(0,0,0,0,0,0,0,0,0);let k=1/F;return J[0]=q*k,J[1]=(W*X-U*$)*k,J[2]=(Y*$-W*K)*k,J[3]=E*k,J[4]=(U*Q-W*H)*k,J[5]=(W*Z-Y*Q)*k,J[6]=G*k,J[7]=($*H-X*Q)*k,J[8]=(K*Q-$*Z)*k,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,$,W,Z,K,Y){let H=Math.cos(Z),X=Math.sin(Z);return this.set($*H,$*X,-$*(H*K+X*Y)+K+J,-W*X,W*H,-W*(-X*K+H*Y)+Y+Q,0,0,1),this}scale(J,Q){return this.premultiply(L6.makeScale(J,Q)),this}rotate(J){return this.premultiply(L6.makeRotation(-J)),this}translate(J,Q){return this.premultiply(L6.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 W=0;W<9;W++)if(Q[W]!==$[W])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<9;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J}clone(){return new this.constructor().fromArray(this.elements)}}var L6=new j0,g$=new j0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),p$=new j0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function OK(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(Z,K,Y){if(this.enabled===!1||K===Y||!K||!Y)return Z;if(this.spaces[K].transfer==="srgb")Z.r=E9(Z.r),Z.g=E9(Z.g),Z.b=E9(Z.b);if(this.spaces[K].primaries!==this.spaces[Y].primaries)Z.applyMatrix3(this.spaces[K].toXYZ),Z.applyMatrix3(this.spaces[Y].fromXYZ);if(this.spaces[Y].transfer==="srgb")Z.r=O8(Z.r),Z.g=O8(Z.g),Z.b=O8(Z.b);return Z},workingToColorSpace:function(Z,K){return this.convert(Z,this.workingColorSpace,K)},colorSpaceToWorking:function(Z,K){return this.convert(Z,K,this.workingColorSpace)},getPrimaries:function(Z){return this.spaces[Z].primaries},getTransfer:function(Z){if(Z==="")return"linear";return this.spaces[Z].transfer},getToneMappingMode:function(Z){return this.spaces[Z].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(Z,K=this.workingColorSpace){return Z.fromArray(this.spaces[K].luminanceCoefficients)},define:function(Z){Object.assign(this.spaces,Z)},_getMatrix:function(Z,K,Y){return Z.copy(this.spaces[K].toXYZ).multiply(this.spaces[Y].fromXYZ)},_getDrawingBufferColorSpace:function(Z){return this.spaces[Z].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(Z=this.workingColorSpace){return this.spaces[Z].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(Z,K){return j7("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(Z,K)},toWorkingColorSpace:function(Z,K){return j7("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(Z,K)}},Q=[0.64,0.33,0.3,0.6,0.15,0.06],$=[0.2126,0.7152,0.0722],W=[0.3127,0.329];return J.define({["srgb-linear"]:{primaries:Q,whitePoint:W,transfer:"linear",toXYZ:g$,fromXYZ:p$,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:W,transfer:"srgb",toXYZ:g$,fromXYZ:p$,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var i0=OK();function E9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function O8(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var e9;class lQ{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(e9===void 0)e9=f8("canvas");e9.width=J.width,e9.height=J.height;let W=e9.getContext("2d");if(J instanceof ImageData)W.putImageData(J,0,0);else W.drawImage(J,0,0,J.width,J.height);$=e9}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=f8("canvas");Q.width=J.width,Q.height=J.height;let $=Q.getContext("2d");$.drawImage(J,0,0,J.width,J.height);let W=$.getImageData(0,0,J.width,J.height),Z=W.data;for(let K=0;K<Z.length;K++)Z[K]=E9(Z[K]/255)*255;return $.putImageData(W,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(E9(Q[$]/255)*255);else Q[$]=E9(Q[$]);return{data:Q,width:J.width,height:J.height}}else return C0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}var RK=0;class l8{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:RK++}),this.uuid=w9(),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:""},W=this.data;if(W!==null){let Z;if(Array.isArray(W)){Z=[];for(let K=0,Y=W.length;K<Y;K++)if(W[K].isDataTexture)Z.push(V6(W[K].image));else Z.push(V6(W[K]))}else Z=V6(W);$.url=Z}if(!Q)J.images[this.uuid]=$;return $}}function V6(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return lQ.getDataURL(J);else if(J.data)return{data:Array.from(J.data),width:J.width,height:J.height,type:J.data.constructor.name};else return C0("Texture: Unable to serialize Texture."),{}}var kK=0,B6=new y;class zJ extends F9{constructor(J=zJ.DEFAULT_IMAGE,Q=zJ.DEFAULT_MAPPING,$=1001,W=1001,Z=1006,K=1008,Y=1023,H=1009,X=zJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:kK++}),this.uuid=w9(),this.name="",this.source=new l8(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=W,this.magFilter=Z,this.minFilter=K,this.anisotropy=X,this.format=Y,this.internalFormat=null,this.type=H,this.offset=new h0(0,0),this.repeat=new h0(1,1),this.center=new h0(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new j0,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(B6).x}get height(){return this.source.getSize(B6).y}get depth(){return this.source.getSize(B6).z}get image(){return this.source.data}set image(J){this.source.data=J}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(J){return this.name=J.name,this.source=J.source,this.mipmaps=J.mipmaps.slice(0),this.mapping=J.mapping,this.channel=J.channel,this.wrapS=J.wrapS,this.wrapT=J.wrapT,this.magFilter=J.magFilter,this.minFilter=J.minFilter,this.anisotropy=J.anisotropy,this.format=J.format,this.internalFormat=J.internalFormat,this.type=J.type,this.normalized=J.normalized,this.offset.copy(J.offset),this.repeat.copy(J.repeat),this.center.copy(J.center),this.rotation=J.rotation,this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrix.copy(J.matrix),this.generateMipmaps=J.generateMipmaps,this.premultiplyAlpha=J.premultiplyAlpha,this.flipY=J.flipY,this.unpackAlignment=J.unpackAlignment,this.colorSpace=J.colorSpace,this.renderTarget=J.renderTarget,this.isRenderTargetTexture=J.isRenderTargetTexture,this.isArrayTexture=J.isArrayTexture,this.userData=JSON.parse(JSON.stringify(J.userData)),this.needsUpdate=!0,this}setValues(J){for(let Q in J){let $=J[Q];if($===void 0){C0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let W=this[Q];if(W===void 0){C0(`Texture.setValues(): property '${Q}' does not exist.`);continue}if(W&&$&&(W.isVector2&&$.isVector2))W.copy($);else if(W&&$&&(W.isVector3&&$.isVector3))W.copy($);else if(W&&$&&(W.isMatrix3&&$.isMatrix3))W.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++}}zJ.DEFAULT_IMAGE=null;zJ.DEFAULT_MAPPING=300;zJ.DEFAULT_ANISOTROPY=1;class UJ{static{UJ.prototype.isVector4=!0}constructor(J=0,Q=0,$=0,W=1){this.x=J,this.y=Q,this.z=$,this.w=W}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,$,W){return this.x=J,this.y=Q,this.z=$,this.w=W,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,W=this.z,Z=this.w,K=J.elements;return this.x=K[0]*Q+K[4]*$+K[8]*W+K[12]*Z,this.y=K[1]*Q+K[5]*$+K[9]*W+K[13]*Z,this.z=K[2]*Q+K[6]*$+K[10]*W+K[14]*Z,this.w=K[3]*Q+K[7]*$+K[11]*W+K[15]*Z,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,$,W,Z,K=0.01,Y=0.1,H=J.elements,X=H[0],U=H[4],q=H[8],E=H[1],G=H[5],F=H[9],k=H[2],z=H[6],N=H[10];if(Math.abs(U-E)<0.01&&Math.abs(q-k)<0.01&&Math.abs(F-z)<0.01){if(Math.abs(U+E)<0.1&&Math.abs(q+k)<0.1&&Math.abs(F+z)<0.1&&Math.abs(X+G+N-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let V=(X+1)/2,_=(G+1)/2,I=(N+1)/2,P=(U+E)/4,w=(q+k)/4,C=(F+z)/4;if(V>_&&V>I)if(V<0.01)$=0,W=0.707106781,Z=0.707106781;else $=Math.sqrt(V),W=P/$,Z=w/$;else if(_>I)if(_<0.01)$=0.707106781,W=0,Z=0.707106781;else W=Math.sqrt(_),$=P/W,Z=C/W;else if(I<0.01)$=0.707106781,W=0.707106781,Z=0;else Z=Math.sqrt(I),$=w/Z,W=C/Z;return this.set($,W,Z,Q),this}let D=Math.sqrt((z-F)*(z-F)+(q-k)*(q-k)+(E-U)*(E-U));if(Math.abs(D)<0.001)D=1;return this.x=(z-F)/D,this.y=(q-k)/D,this.z=(E-U)/D,this.w=Math.acos((X+G+N-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=o0(this.x,J.x,Q.x),this.y=o0(this.y,J.y,Q.y),this.z=o0(this.z,J.z,Q.z),this.w=o0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=o0(this.x,J,Q),this.y=o0(this.y,J,Q),this.z=o0(this.z,J,Q),this.w=o0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(o0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z+this.w*J.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this.w+=(J.w-this.w)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this.w=J.w+(Q.w-J.w)*$,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z&&J.w===this.w}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this.w=J[Q+3],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J[Q+3]=this.w,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this.w=J.getW(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class uQ extends F9{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 UJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new UJ(0,0,J,Q),this.textures=[];let W={width:J,height:Q,depth:$.depth},Z=new zJ(W),K=$.count;for(let Y=0;Y<K;Y++)this.textures[Y]=Z.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 W=0,Z=this.textures.length;W<Z;W++)if(this.textures[W].image.width=J,this.textures[W].image.height=Q,this.textures[W].image.depth=$,this.textures[W].isData3DTexture!==!0)this.textures[W].isArrayTexture=this.textures[W].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 W=Object.assign({},J.textures[Q].image);this.textures[Q].source=new l8(W)}if(this.depthBuffer=J.depthBuffer,this.stencilBuffer=J.stencilBuffer,this.resolveDepthBuffer=J.resolveDepthBuffer,this.resolveStencilBuffer=J.resolveStencilBuffer,J.depthTexture!==null)this.depthTexture=J.depthTexture.clone();return this.samples=J.samples,this.multiview=J.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class dJ extends uQ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class i7 extends zJ{constructor(J=null,Q=1,$=1,W=1){super(null);this.isDataArrayTexture=!0,this.image={data:J,width:Q,height:$,depth:W},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class cQ extends zJ{constructor(J=null,Q=1,$=1,W=1){super(null);this.isData3DTexture=!0,this.image={data:J,width:Q,height:$,depth:W},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class YJ{static{YJ.prototype.isMatrix4=!0}constructor(J,Q,$,W,Z,K,Y,H,X,U,q,E,G,F,k,z){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,$,W,Z,K,Y,H,X,U,q,E,G,F,k,z)}set(J,Q,$,W,Z,K,Y,H,X,U,q,E,G,F,k,z){let N=this.elements;return N[0]=J,N[4]=Q,N[8]=$,N[12]=W,N[1]=Z,N[5]=K,N[9]=Y,N[13]=H,N[2]=X,N[6]=U,N[10]=q,N[14]=E,N[3]=G,N[7]=F,N[11]=k,N[15]=z,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 YJ().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,W=1/J8.setFromMatrixColumn(J,0).length(),Z=1/J8.setFromMatrixColumn(J,1).length(),K=1/J8.setFromMatrixColumn(J,2).length();return Q[0]=$[0]*W,Q[1]=$[1]*W,Q[2]=$[2]*W,Q[3]=0,Q[4]=$[4]*Z,Q[5]=$[5]*Z,Q[6]=$[6]*Z,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,W=J.y,Z=J.z,K=Math.cos($),Y=Math.sin($),H=Math.cos(W),X=Math.sin(W),U=Math.cos(Z),q=Math.sin(Z);if(J.order==="XYZ"){let E=K*U,G=K*q,F=Y*U,k=Y*q;Q[0]=H*U,Q[4]=-H*q,Q[8]=X,Q[1]=G+F*X,Q[5]=E-k*X,Q[9]=-Y*H,Q[2]=k-E*X,Q[6]=F+G*X,Q[10]=K*H}else if(J.order==="YXZ"){let E=H*U,G=H*q,F=X*U,k=X*q;Q[0]=E+k*Y,Q[4]=F*Y-G,Q[8]=K*X,Q[1]=K*q,Q[5]=K*U,Q[9]=-Y,Q[2]=G*Y-F,Q[6]=k+E*Y,Q[10]=K*H}else if(J.order==="ZXY"){let E=H*U,G=H*q,F=X*U,k=X*q;Q[0]=E-k*Y,Q[4]=-K*q,Q[8]=F+G*Y,Q[1]=G+F*Y,Q[5]=K*U,Q[9]=k-E*Y,Q[2]=-K*X,Q[6]=Y,Q[10]=K*H}else if(J.order==="ZYX"){let E=K*U,G=K*q,F=Y*U,k=Y*q;Q[0]=H*U,Q[4]=F*X-G,Q[8]=E*X+k,Q[1]=H*q,Q[5]=k*X+E,Q[9]=G*X-F,Q[2]=-X,Q[6]=Y*H,Q[10]=K*H}else if(J.order==="YZX"){let E=K*H,G=K*X,F=Y*H,k=Y*X;Q[0]=H*U,Q[4]=k-E*q,Q[8]=F*q+G,Q[1]=q,Q[5]=K*U,Q[9]=-Y*U,Q[2]=-X*U,Q[6]=G*q+F,Q[10]=E-k*q}else if(J.order==="XZY"){let E=K*H,G=K*X,F=Y*H,k=Y*X;Q[0]=H*U,Q[4]=-q,Q[8]=X*U,Q[1]=E*q+k,Q[5]=K*U,Q[9]=G*q-F,Q[2]=F*q-G,Q[6]=Y*U,Q[10]=k*q+E}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(MK,J,LK)}lookAt(J,Q,$){let W=this.elements;if(fJ.subVectors(J,Q),fJ.lengthSq()===0)fJ.z=1;if(fJ.normalize(),V9.crossVectors($,fJ),V9.lengthSq()===0){if(Math.abs($.z)===1)fJ.x+=0.0001;else fJ.z+=0.0001;fJ.normalize(),V9.crossVectors($,fJ)}return V9.normalize(),H7.crossVectors(fJ,V9),W[0]=V9.x,W[4]=H7.x,W[8]=fJ.x,W[1]=V9.y,W[5]=H7.y,W[9]=fJ.y,W[2]=V9.z,W[6]=H7.z,W[10]=fJ.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,W=Q.elements,Z=this.elements,K=$[0],Y=$[4],H=$[8],X=$[12],U=$[1],q=$[5],E=$[9],G=$[13],F=$[2],k=$[6],z=$[10],N=$[14],D=$[3],V=$[7],_=$[11],I=$[15],P=W[0],w=W[4],C=W[8],M=W[12],B=W[1],l=W[5],A=W[9],p=W[13],c=W[2],v=W[6],d=W[10],x=W[14],g=W[3],a=W[7],J0=W[11],U0=W[15];return Z[0]=K*P+Y*B+H*c+X*g,Z[4]=K*w+Y*l+H*v+X*a,Z[8]=K*C+Y*A+H*d+X*J0,Z[12]=K*M+Y*p+H*x+X*U0,Z[1]=U*P+q*B+E*c+G*g,Z[5]=U*w+q*l+E*v+G*a,Z[9]=U*C+q*A+E*d+G*J0,Z[13]=U*M+q*p+E*x+G*U0,Z[2]=F*P+k*B+z*c+N*g,Z[6]=F*w+k*l+z*v+N*a,Z[10]=F*C+k*A+z*d+N*J0,Z[14]=F*M+k*p+z*x+N*U0,Z[3]=D*P+V*B+_*c+I*g,Z[7]=D*w+V*l+_*v+I*a,Z[11]=D*C+V*A+_*d+I*J0,Z[15]=D*M+V*p+_*x+I*U0,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],W=J[8],Z=J[12],K=J[1],Y=J[5],H=J[9],X=J[13],U=J[2],q=J[6],E=J[10],G=J[14],F=J[3],k=J[7],z=J[11],N=J[15],D=H*G-X*E,V=Y*G-X*q,_=Y*E-H*q,I=K*G-X*U,P=K*E-H*U,w=K*q-Y*U;return Q*(k*D-z*V+N*_)-$*(F*D-z*I+N*P)+W*(F*V-k*I+N*w)-Z*(F*_-k*P+z*w)}transpose(){let J=this.elements,Q;return Q=J[1],J[1]=J[4],J[4]=Q,Q=J[2],J[2]=J[8],J[8]=Q,Q=J[6],J[6]=J[9],J[9]=Q,Q=J[3],J[3]=J[12],J[12]=Q,Q=J[7],J[7]=J[13],J[13]=Q,Q=J[11],J[11]=J[14],J[14]=Q,this}setPosition(J,Q,$){let W=this.elements;if(J.isVector3)W[12]=J.x,W[13]=J.y,W[14]=J.z;else W[12]=J,W[13]=Q,W[14]=$;return this}invert(){let J=this.elements,Q=J[0],$=J[1],W=J[2],Z=J[3],K=J[4],Y=J[5],H=J[6],X=J[7],U=J[8],q=J[9],E=J[10],G=J[11],F=J[12],k=J[13],z=J[14],N=J[15],D=Q*Y-$*K,V=Q*H-W*K,_=Q*X-Z*K,I=$*H-W*Y,P=$*X-Z*Y,w=W*X-Z*H,C=U*k-q*F,M=U*z-E*F,B=U*N-G*F,l=q*z-E*k,A=q*N-G*k,p=E*N-G*z,c=D*p-V*A+_*l+I*B-P*M+w*C;if(c===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let v=1/c;return J[0]=(Y*p-H*A+X*l)*v,J[1]=(W*A-$*p-Z*l)*v,J[2]=(k*w-z*P+N*I)*v,J[3]=(E*P-q*w-G*I)*v,J[4]=(H*B-K*p-X*M)*v,J[5]=(Q*p-W*B+Z*M)*v,J[6]=(z*_-F*w-N*V)*v,J[7]=(U*w-E*_+G*V)*v,J[8]=(K*A-Y*B+X*C)*v,J[9]=($*B-Q*A-Z*C)*v,J[10]=(F*P-k*_+N*D)*v,J[11]=(q*_-U*P-G*D)*v,J[12]=(Y*M-K*l-H*C)*v,J[13]=(Q*l-$*M+W*C)*v,J[14]=(k*V-F*I-z*D)*v,J[15]=(U*I-q*V+E*D)*v,this}scale(J){let Q=this.elements,$=J.x,W=J.y,Z=J.z;return Q[0]*=$,Q[4]*=W,Q[8]*=Z,Q[1]*=$,Q[5]*=W,Q[9]*=Z,Q[2]*=$,Q[6]*=W,Q[10]*=Z,Q[3]*=$,Q[7]*=W,Q[11]*=Z,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],W=J[8]*J[8]+J[9]*J[9]+J[10]*J[10];return Math.sqrt(Math.max(Q,$,W))}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),W=Math.sin(Q),Z=1-$,K=J.x,Y=J.y,H=J.z,X=Z*K,U=Z*Y;return this.set(X*K+$,X*Y-W*H,X*H+W*Y,0,X*Y+W*H,U*Y+$,U*H-W*K,0,X*H-W*Y,U*H+W*K,Z*H*H+$,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,$,W,Z,K){return this.set(1,$,Z,0,J,1,K,0,Q,W,1,0,0,0,0,1),this}compose(J,Q,$){let W=this.elements,Z=Q._x,K=Q._y,Y=Q._z,H=Q._w,X=Z+Z,U=K+K,q=Y+Y,E=Z*X,G=Z*U,F=Z*q,k=K*U,z=K*q,N=Y*q,D=H*X,V=H*U,_=H*q,I=$.x,P=$.y,w=$.z;return W[0]=(1-(k+N))*I,W[1]=(G+_)*I,W[2]=(F-V)*I,W[3]=0,W[4]=(G-_)*P,W[5]=(1-(E+N))*P,W[6]=(z+D)*P,W[7]=0,W[8]=(F+V)*w,W[9]=(z-D)*w,W[10]=(1-(E+k))*w,W[11]=0,W[12]=J.x,W[13]=J.y,W[14]=J.z,W[15]=1,this}decompose(J,Q,$){let W=this.elements;J.x=W[12],J.y=W[13],J.z=W[14];let Z=this.determinant();if(Z===0)return $.set(1,1,1),Q.identity(),this;let K=J8.set(W[0],W[1],W[2]).length(),Y=J8.set(W[4],W[5],W[6]).length(),H=J8.set(W[8],W[9],W[10]).length();if(Z<0)K=-K;nJ.copy(this);let X=1/K,U=1/Y,q=1/H;return nJ.elements[0]*=X,nJ.elements[1]*=X,nJ.elements[2]*=X,nJ.elements[4]*=U,nJ.elements[5]*=U,nJ.elements[6]*=U,nJ.elements[8]*=q,nJ.elements[9]*=q,nJ.elements[10]*=q,Q.setFromRotationMatrix(nJ),$.x=K,$.y=Y,$.z=H,this}makePerspective(J,Q,$,W,Z,K,Y=2000,H=!1){let X=this.elements,U=2*Z/(Q-J),q=2*Z/($-W),E=(Q+J)/(Q-J),G=($+W)/($-W),F,k;if(H)F=Z/(K-Z),k=K*Z/(K-Z);else if(Y===2000)F=-(K+Z)/(K-Z),k=-2*K*Z/(K-Z);else if(Y===2001)F=-K/(K-Z),k=-K*Z/(K-Z);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Y);return X[0]=U,X[4]=0,X[8]=E,X[12]=0,X[1]=0,X[5]=q,X[9]=G,X[13]=0,X[2]=0,X[6]=0,X[10]=F,X[14]=k,X[3]=0,X[7]=0,X[11]=-1,X[15]=0,this}makeOrthographic(J,Q,$,W,Z,K,Y=2000,H=!1){let X=this.elements,U=2/(Q-J),q=2/($-W),E=-(Q+J)/(Q-J),G=-($+W)/($-W),F,k;if(H)F=1/(K-Z),k=K/(K-Z);else if(Y===2000)F=-2/(K-Z),k=-(K+Z)/(K-Z);else if(Y===2001)F=-1/(K-Z),k=-Z/(K-Z);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Y);return X[0]=U,X[4]=0,X[8]=0,X[12]=E,X[1]=0,X[5]=q,X[9]=0,X[13]=G,X[2]=0,X[6]=0,X[10]=F,X[14]=k,X[3]=0,X[7]=0,X[11]=0,X[15]=1,this}equals(J){let Q=this.elements,$=J.elements;for(let W=0;W<16;W++)if(Q[W]!==$[W])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<16;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J[Q+9]=$[9],J[Q+10]=$[10],J[Q+11]=$[11],J[Q+12]=$[12],J[Q+13]=$[13],J[Q+14]=$[14],J[Q+15]=$[15],J}}var J8=new y,nJ=new YJ,MK=new y(0,0,0),LK=new y(1,1,1),V9=new y,H7=new y,fJ=new y,m$=new YJ,d$=new O9;class mJ{constructor(J=0,Q=0,$=0,W=mJ.DEFAULT_ORDER){this.isEuler=!0,this._x=J,this._y=Q,this._z=$,this._order=W}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,$,W=this._order){return this._x=J,this._y=Q,this._z=$,this._order=W,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 W=J.elements,Z=W[0],K=W[4],Y=W[8],H=W[1],X=W[5],U=W[9],q=W[2],E=W[6],G=W[10];switch(Q){case"XYZ":if(this._y=Math.asin(o0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(-U,G),this._z=Math.atan2(-K,Z);else this._x=Math.atan2(E,X),this._z=0;break;case"YXZ":if(this._x=Math.asin(-o0(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(Y,G),this._z=Math.atan2(H,X);else this._y=Math.atan2(-q,Z),this._z=0;break;case"ZXY":if(this._x=Math.asin(o0(E,-1,1)),Math.abs(E)<0.9999999)this._y=Math.atan2(-q,G),this._z=Math.atan2(-K,X);else this._y=0,this._z=Math.atan2(H,Z);break;case"ZYX":if(this._y=Math.asin(-o0(q,-1,1)),Math.abs(q)<0.9999999)this._x=Math.atan2(E,G),this._z=Math.atan2(H,Z);else this._x=0,this._z=Math.atan2(-K,X);break;case"YZX":if(this._z=Math.asin(o0(H,-1,1)),Math.abs(H)<0.9999999)this._x=Math.atan2(-U,X),this._y=Math.atan2(-q,Z);else this._x=0,this._y=Math.atan2(Y,G);break;case"XZY":if(this._z=Math.asin(-o0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(E,X),this._y=Math.atan2(Y,Z);else this._x=Math.atan2(-U,G),this._y=0;break;default:C0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return m$.makeRotationFromQuaternion(J),this.setFromRotationMatrix(m$,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return d$.setFromEuler(this),this.setFromQuaternion(d$,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}}mJ.DEFAULT_ORDER="XYZ";class u8{constructor(){this.mask=1}set(J){this.mask=(1<<J|0)>>>0}enable(J){this.mask|=1<<J|0}enableAll(){this.mask=-1}toggle(J){this.mask^=1<<J|0}disable(J){this.mask&=~(1<<J|0)}disableAll(){this.mask=0}test(J){return(this.mask&J.mask)!==0}isEnabled(J){return(this.mask&(1<<J|0))!==0}}var VK=0,l$=new y,Q8=new O9,Y9=new YJ,X7=new y,w8=new y,BK=new y,zK=new O9,u$=new y(1,0,0),c$=new y(0,1,0),n$=new y(0,0,1),s$={type:"added"},IK={type:"removed"},$8={type:"childadded",child:null},z6={type:"childremoved",child:null};class RJ extends F9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:VK++}),this.uuid=w9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=RJ.DEFAULT_UP.clone();let J=new y,Q=new mJ,$=new O9,W=new y(1,1,1);function Z(){$.setFromEuler(Q,!1)}function K(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(Z),$._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:W},modelViewMatrix:{value:new YJ},normalMatrix:{value:new j0}}),this.matrix=new YJ,this.matrixWorld=new YJ,this.matrixAutoUpdate=RJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=RJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new u8,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 Q8.setFromAxisAngle(J,Q),this.quaternion.multiply(Q8),this}rotateOnWorldAxis(J,Q){return Q8.setFromAxisAngle(J,Q),this.quaternion.premultiply(Q8),this}rotateX(J){return this.rotateOnAxis(u$,J)}rotateY(J){return this.rotateOnAxis(c$,J)}rotateZ(J){return this.rotateOnAxis(n$,J)}translateOnAxis(J,Q){return l$.copy(J).applyQuaternion(this.quaternion),this.position.add(l$.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(u$,J)}translateY(J){return this.translateOnAxis(c$,J)}translateZ(J){return this.translateOnAxis(n$,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(Y9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)X7.copy(J);else X7.set(J,Q,$);let W=this.parent;if(this.updateWorldMatrix(!0,!1),w8.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)Y9.lookAt(w8,X7,this.up);else Y9.lookAt(X7,w8,this.up);if(this.quaternion.setFromRotationMatrix(Y9),W)Y9.extractRotation(W.matrixWorld),Q8.setFromRotationMatrix(Y9),this.quaternion.premultiply(Q8.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(s$),$8.child=J,this.dispatchEvent($8),$8.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(IK),z6.child=J,this.dispatchEvent(z6),z6.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),Y9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),Y9.multiply(J.parent.matrixWorld);return J.applyMatrix4(Y9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(s$),$8.child=J,this.dispatchEvent($8),$8.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,W=this.children.length;$<W;$++){let K=this.children[$].getObjectByProperty(J,Q);if(K!==void 0)return K}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let W=this.children;for(let Z=0,K=W.length;Z<K;Z++)W[Z].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(w8,J,BK),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(w8,zK,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,W=Q.length;$<W;$++)Q[$].traverse(J)}traverseVisible(J){if(this.visible===!1)return;J(this);let Q=this.children;for(let $=0,W=Q.length;$<W;$++)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:W}=J,Z=this.matrix.elements;Z[12]+=Q-Z[0]*Q-Z[4]*$-Z[8]*W,Z[13]+=$-Z[1]*Q-Z[5]*$-Z[9]*W,Z[14]+=W-Z[2]*Q-Z[6]*$-Z[10]*W}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,W=Q.length;$<W;$++)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 W=this.children;for(let Z=0,K=W.length;Z<K;Z++)W[Z].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 W={};if(W.uuid=this.uuid,W.type=this.type,this.name!=="")W.name=this.name;if(this.castShadow===!0)W.castShadow=!0;if(this.receiveShadow===!0)W.receiveShadow=!0;if(this.visible===!1)W.visible=!1;if(this.frustumCulled===!1)W.frustumCulled=!1;if(this.renderOrder!==0)W.renderOrder=this.renderOrder;if(this.static!==!1)W.static=this.static;if(Object.keys(this.userData).length>0)W.userData=this.userData;if(W.layers=this.layers.mask,W.matrix=this.matrix.toArray(),W.up=this.up.toArray(),this.pivot!==null)W.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)W.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)W.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)W.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(W.type="InstancedMesh",W.count=this.count,W.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)W.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(W.type="BatchedMesh",W.perObjectFrustumCulled=this.perObjectFrustumCulled,W.sortObjects=this.sortObjects,W.drawRanges=this._drawRanges,W.reservedRanges=this._reservedRanges,W.geometryInfo=this._geometryInfo.map((Y)=>({...Y,boundingBox:Y.boundingBox?Y.boundingBox.toJSON():void 0,boundingSphere:Y.boundingSphere?Y.boundingSphere.toJSON():void 0})),W.instanceInfo=this._instanceInfo.map((Y)=>({...Y})),W.availableInstanceIds=this._availableInstanceIds.slice(),W.availableGeometryIds=this._availableGeometryIds.slice(),W.nextIndexStart=this._nextIndexStart,W.nextVertexStart=this._nextVertexStart,W.geometryCount=this._geometryCount,W.maxInstanceCount=this._maxInstanceCount,W.maxVertexCount=this._maxVertexCount,W.maxIndexCount=this._maxIndexCount,W.geometryInitialized=this._geometryInitialized,W.matricesTexture=this._matricesTexture.toJSON(J),W.indirectTexture=this._indirectTexture.toJSON(J),this._colorsTexture!==null)W.colorsTexture=this._colorsTexture.toJSON(J);if(this.boundingSphere!==null)W.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)W.boundingBox=this.boundingBox.toJSON()}function Z(Y,H){if(Y[H.uuid]===void 0)Y[H.uuid]=H.toJSON(J);return H.uuid}if(this.isScene){if(this.background){if(this.background.isColor)W.background=this.background.toJSON();else if(this.background.isTexture)W.background=this.background.toJSON(J).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)W.environment=this.environment.toJSON(J).uuid}else if(this.isMesh||this.isLine||this.isPoints){W.geometry=Z(J.geometries,this.geometry);let Y=this.geometry.parameters;if(Y!==void 0&&Y.shapes!==void 0){let H=Y.shapes;if(Array.isArray(H))for(let X=0,U=H.length;X<U;X++){let q=H[X];Z(J.shapes,q)}else Z(J.shapes,H)}}if(this.isSkinnedMesh){if(W.bindMode=this.bindMode,W.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)Z(J.skeletons,this.skeleton),W.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let Y=[];for(let H=0,X=this.material.length;H<X;H++)Y.push(Z(J.materials,this.material[H]));W.material=Y}else W.material=Z(J.materials,this.material);if(this.children.length>0){W.children=[];for(let Y=0;Y<this.children.length;Y++)W.children.push(this.children[Y].toJSON(J).object)}if(this.animations.length>0){W.animations=[];for(let Y=0;Y<this.animations.length;Y++){let H=this.animations[Y];W.animations.push(Z(J.animations,H))}}if(Q){let Y=K(J.geometries),H=K(J.materials),X=K(J.textures),U=K(J.images),q=K(J.shapes),E=K(J.skeletons),G=K(J.animations),F=K(J.nodes);if(Y.length>0)$.geometries=Y;if(H.length>0)$.materials=H;if(X.length>0)$.textures=X;if(U.length>0)$.images=U;if(q.length>0)$.shapes=q;if(E.length>0)$.skeletons=E;if(G.length>0)$.animations=G;if(F.length>0)$.nodes=F}return $.object=W,$;function K(Y){let H=[];for(let X in Y){let U=Y[X];delete U.metadata,H.push(U)}return H}}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 W=J.children[$];this.add(W.clone())}return this}}RJ.DEFAULT_UP=new y(0,1,0);RJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;RJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class F8 extends RJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var _K={type:"move"};class c8{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new F8,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 F8,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new y;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new F8,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new y,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 W=null,Z=null,K=null,Y=this._targetRay,H=this._grip,X=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(X&&J.hand){K=!0;for(let k of J.hand.values()){let z=Q.getJointPose(k,$),N=this._getHandJoint(X,k);if(z!==null)N.matrix.fromArray(z.transform.matrix),N.matrix.decompose(N.position,N.rotation,N.scale),N.matrixWorldNeedsUpdate=!0,N.jointRadius=z.radius;N.visible=z!==null}let U=X.joints["index-finger-tip"],q=X.joints["thumb-tip"],E=U.position.distanceTo(q.position),G=0.02,F=0.005;if(X.inputState.pinching&&E>G+F)X.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!X.inputState.pinching&&E<=G-F)X.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(H!==null&&J.gripSpace){if(Z=Q.getPose(J.gripSpace,$),Z!==null){if(H.matrix.fromArray(Z.transform.matrix),H.matrix.decompose(H.position,H.rotation,H.scale),H.matrixWorldNeedsUpdate=!0,Z.linearVelocity)H.hasLinearVelocity=!0,H.linearVelocity.copy(Z.linearVelocity);else H.hasLinearVelocity=!1;if(Z.angularVelocity)H.hasAngularVelocity=!0,H.angularVelocity.copy(Z.angularVelocity);else H.hasAngularVelocity=!1;if(H.eventsEnabled)H.dispatchEvent({type:"gripUpdated",data:J,target:this})}}if(Y!==null){if(W=Q.getPose(J.targetRaySpace,$),W===null&&Z!==null)W=Z;if(W!==null){if(Y.matrix.fromArray(W.transform.matrix),Y.matrix.decompose(Y.position,Y.rotation,Y.scale),Y.matrixWorldNeedsUpdate=!0,W.linearVelocity)Y.hasLinearVelocity=!0,Y.linearVelocity.copy(W.linearVelocity);else Y.hasLinearVelocity=!1;if(W.angularVelocity)Y.hasAngularVelocity=!0,Y.angularVelocity.copy(W.angularVelocity);else Y.hasAngularVelocity=!1;this.dispatchEvent(_K)}}}if(Y!==null)Y.visible=W!==null;if(H!==null)H.visible=Z!==null;if(X!==null)X.visible=K!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new F8;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var qZ={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},B9={h:0,s:0,l:0},U7={h:0,s:0,l:0};function I6(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 g0{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 W=J;if(W&&W.isColor)this.copy(W);else if(typeof W==="number")this.setHex(W);else if(typeof W==="string")this.setStyle(W)}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,i0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,W=i0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,i0.colorSpaceToWorking(this,W),this}setHSL(J,Q,$,W=i0.workingColorSpace){if(J=FK(J,1),Q=o0(Q,0,1),$=o0($,0,1),Q===0)this.r=this.g=this.b=$;else{let Z=$<=0.5?$*(1+Q):$+Q-$*Q,K=2*$-Z;this.r=I6(K,Z,J+0.3333333333333333),this.g=I6(K,Z,J),this.b=I6(K,Z,J-0.3333333333333333)}return i0.colorSpaceToWorking(this,W),this}setStyle(J,Q="srgb"){function $(Z){if(Z===void 0)return;if(parseFloat(Z)<1)C0("Color: Alpha component of "+J+" will be ignored.")}let W;if(W=/^(\w+)\(([^\)]*)\)/.exec(J)){let Z,K=W[1],Y=W[2];switch(K){case"rgb":case"rgba":if(Z=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Y))return $(Z[4]),this.setRGB(Math.min(255,parseInt(Z[1],10))/255,Math.min(255,parseInt(Z[2],10))/255,Math.min(255,parseInt(Z[3],10))/255,Q);if(Z=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Y))return $(Z[4]),this.setRGB(Math.min(100,parseInt(Z[1],10))/100,Math.min(100,parseInt(Z[2],10))/100,Math.min(100,parseInt(Z[3],10))/100,Q);break;case"hsl":case"hsla":if(Z=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Y))return $(Z[4]),this.setHSL(parseFloat(Z[1])/360,parseFloat(Z[2])/100,parseFloat(Z[3])/100,Q);break;default:C0("Color: Unknown color model "+J)}}else if(W=/^\#([A-Fa-f\d]+)$/.exec(J)){let Z=W[1],K=Z.length;if(K===3)return this.setRGB(parseInt(Z.charAt(0),16)/15,parseInt(Z.charAt(1),16)/15,parseInt(Z.charAt(2),16)/15,Q);else if(K===6)return this.setHex(parseInt(Z,16),Q);else C0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=qZ[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else C0("Color: Unknown color "+J);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(J){return this.r=J.r,this.g=J.g,this.b=J.b,this}copySRGBToLinear(J){return this.r=E9(J.r),this.g=E9(J.g),this.b=E9(J.b),this}copyLinearToSRGB(J){return this.r=O8(J.r),this.g=O8(J.g),this.b=O8(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return i0.workingToColorSpace(AJ.copy(this),J),Math.round(o0(AJ.r*255,0,255))*65536+Math.round(o0(AJ.g*255,0,255))*256+Math.round(o0(AJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=i0.workingColorSpace){i0.workingToColorSpace(AJ.copy(this),Q);let{r:$,g:W,b:Z}=AJ,K=Math.max($,W,Z),Y=Math.min($,W,Z),H,X,U=(Y+K)/2;if(Y===K)H=0,X=0;else{let q=K-Y;switch(X=U<=0.5?q/(K+Y):q/(2-K-Y),K){case $:H=(W-Z)/q+(W<Z?6:0);break;case W:H=(Z-$)/q+2;break;case Z:H=($-W)/q+4;break}H/=6}return J.h=H,J.s=X,J.l=U,J}getRGB(J,Q=i0.workingColorSpace){return i0.workingToColorSpace(AJ.copy(this),Q),J.r=AJ.r,J.g=AJ.g,J.b=AJ.b,J}getStyle(J="srgb"){i0.workingToColorSpace(AJ.copy(this),J);let{r:Q,g:$,b:W}=AJ;if(J!=="srgb")return`color(${J} ${Q.toFixed(3)} ${$.toFixed(3)} ${W.toFixed(3)})`;return`rgb(${Math.round(Q*255)},${Math.round($*255)},${Math.round(W*255)})`}offsetHSL(J,Q,$){return this.getHSL(B9),this.setHSL(B9.h+J,B9.s+Q,B9.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(B9),J.getHSL(U7);let $=k6(B9.h,U7.h,Q),W=k6(B9.s,U7.s,Q),Z=k6(B9.l,U7.l,Q);return this.setHSL($,W,Z),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,W=this.b,Z=J.elements;return this.r=Z[0]*Q+Z[3]*$+Z[6]*W,this.g=Z[1]*Q+Z[4]*$+Z[7]*W,this.b=Z[2]*Q+Z[5]*$+Z[8]*W,this}equals(J){return J.r===this.r&&J.g===this.g&&J.b===this.b}fromArray(J,Q=0){return this.r=J[Q],this.g=J[Q+1],this.b=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.r,J[Q+1]=this.g,J[Q+2]=this.b,J}fromBufferAttribute(J,Q){return this.r=J.getX(Q),this.g=J.getY(Q),this.b=J.getZ(Q),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var AJ=new g0;g0.NAMES=qZ;class n8{constructor(J,Q=1,$=1000){this.isFog=!0,this.name="",this.color=new g0(J),this.near=Q,this.far=$}clone(){return new n8(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class o7 extends RJ{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 mJ,this.environmentIntensity=1,this.environmentRotation=new mJ,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(J,Q){if(super.copy(J,Q),J.background!==null)this.background=J.background.clone();if(J.environment!==null)this.environment=J.environment.clone();if(J.fog!==null)this.fog=J.fog.clone();if(this.backgroundBlurriness=J.backgroundBlurriness,this.backgroundIntensity=J.backgroundIntensity,this.backgroundRotation.copy(J.backgroundRotation),this.environmentIntensity=J.environmentIntensity,this.environmentRotation.copy(J.environmentRotation),J.overrideMaterial!==null)this.overrideMaterial=J.overrideMaterial.clone();return this.matrixAutoUpdate=J.matrixAutoUpdate,this}toJSON(J){let Q=super.toJSON(J);if(this.fog!==null)Q.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)Q.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)Q.object.backgroundIntensity=this.backgroundIntensity;if(Q.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)Q.object.environmentIntensity=this.environmentIntensity;return Q.object.environmentRotation=this.environmentRotation.toArray(),Q}}var sJ=new y,H9=new y,_6=new y,X9=new y,W8=new y,Z8=new y,i$=new y,A6=new y,w6=new y,C6=new y,P6=new UJ,T6=new UJ,S6=new UJ;class hJ{constructor(J=new y,Q=new y,$=new y){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,W){W.subVectors($,Q),sJ.subVectors(J,Q),W.cross(sJ);let Z=W.lengthSq();if(Z>0)return W.multiplyScalar(1/Math.sqrt(Z));return W.set(0,0,0)}static getBarycoord(J,Q,$,W,Z){sJ.subVectors(W,Q),H9.subVectors($,Q),_6.subVectors(J,Q);let K=sJ.dot(sJ),Y=sJ.dot(H9),H=sJ.dot(_6),X=H9.dot(H9),U=H9.dot(_6),q=K*X-Y*Y;if(q===0)return Z.set(0,0,0),null;let E=1/q,G=(X*H-Y*U)*E,F=(K*U-Y*H)*E;return Z.set(1-G-F,F,G)}static containsPoint(J,Q,$,W){if(this.getBarycoord(J,Q,$,W,X9)===null)return!1;return X9.x>=0&&X9.y>=0&&X9.x+X9.y<=1}static getInterpolation(J,Q,$,W,Z,K,Y,H){if(this.getBarycoord(J,Q,$,W,X9)===null){if(H.x=0,H.y=0,"z"in H)H.z=0;if("w"in H)H.w=0;return null}return H.setScalar(0),H.addScaledVector(Z,X9.x),H.addScaledVector(K,X9.y),H.addScaledVector(Y,X9.z),H}static getInterpolatedAttribute(J,Q,$,W,Z,K){return P6.setScalar(0),T6.setScalar(0),S6.setScalar(0),P6.fromBufferAttribute(J,Q),T6.fromBufferAttribute(J,$),S6.fromBufferAttribute(J,W),K.setScalar(0),K.addScaledVector(P6,Z.x),K.addScaledVector(T6,Z.y),K.addScaledVector(S6,Z.z),K}static isFrontFacing(J,Q,$,W){return sJ.subVectors($,Q),H9.subVectors(J,Q),sJ.cross(H9).dot(W)<0}set(J,Q,$){return this.a.copy(J),this.b.copy(Q),this.c.copy($),this}setFromPointsAndIndices(J,Q,$,W){return this.a.copy(J[Q]),this.b.copy(J[$]),this.c.copy(J[W]),this}setFromAttributeAndIndices(J,Q,$,W){return this.a.fromBufferAttribute(J,Q),this.b.fromBufferAttribute(J,$),this.c.fromBufferAttribute(J,W),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 sJ.subVectors(this.c,this.b),H9.subVectors(this.a,this.b),sJ.cross(H9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return hJ.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return hJ.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,W,Z){return hJ.getInterpolation(J,this.a,this.b,this.c,Q,$,W,Z)}containsPoint(J){return hJ.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return hJ.isFrontFacing(this.a,this.b,this.c,J)}intersectsBox(J){return J.intersectsTriangle(this)}closestPointToPoint(J,Q){let $=this.a,W=this.b,Z=this.c,K,Y;W8.subVectors(W,$),Z8.subVectors(Z,$),A6.subVectors(J,$);let H=W8.dot(A6),X=Z8.dot(A6);if(H<=0&&X<=0)return Q.copy($);w6.subVectors(J,W);let U=W8.dot(w6),q=Z8.dot(w6);if(U>=0&&q<=U)return Q.copy(W);let E=H*q-U*X;if(E<=0&&H>=0&&U<=0)return K=H/(H-U),Q.copy($).addScaledVector(W8,K);C6.subVectors(J,Z);let G=W8.dot(C6),F=Z8.dot(C6);if(F>=0&&G<=F)return Q.copy(Z);let k=G*X-H*F;if(k<=0&&X>=0&&F<=0)return Y=X/(X-F),Q.copy($).addScaledVector(Z8,Y);let z=U*F-G*q;if(z<=0&&q-U>=0&&G-F>=0)return i$.subVectors(Z,W),Y=(q-U)/(q-U+(G-F)),Q.copy(W).addScaledVector(i$,Y);let N=1/(z+k+E);return K=k*N,Y=E*N,Q.copy($).addScaledVector(W8,K).addScaledVector(Z8,Y)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class l9{constructor(J=new y(1/0,1/0,1/0),Q=new y(-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(iJ.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(iJ.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 $=iJ.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 Z=$.getAttribute("position");if(Q===!0&&Z!==void 0&&J.isInstancedMesh!==!0)for(let K=0,Y=Z.count;K<Y;K++){if(J.isMesh===!0)J.getVertexPosition(K,iJ);else iJ.fromBufferAttribute(Z,K);iJ.applyMatrix4(J.matrixWorld),this.expandByPoint(iJ)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();G7.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();G7.copy($.boundingBox)}G7.applyMatrix4(J.matrixWorld),this.union(G7)}}let W=J.children;for(let Z=0,K=W.length;Z<K;Z++)this.expandByObject(W[Z],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,iJ),iJ.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(C8),N7.subVectors(this.max,C8),K8.subVectors(J.a,C8),Y8.subVectors(J.b,C8),H8.subVectors(J.c,C8),z9.subVectors(Y8,K8),I9.subVectors(H8,Y8),y9.subVectors(K8,H8);let Q=[0,-z9.z,z9.y,0,-I9.z,I9.y,0,-y9.z,y9.y,z9.z,0,-z9.x,I9.z,0,-I9.x,y9.z,0,-y9.x,-z9.y,z9.x,0,-I9.y,I9.x,0,-y9.y,y9.x,0];if(!j6(Q,K8,Y8,H8,N7))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!j6(Q,K8,Y8,H8,N7))return!1;return E7.crossVectors(z9,I9),Q=[E7.x,E7.y,E7.z],j6(Q,K8,Y8,H8,N7)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,iJ).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(iJ).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 U9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),U9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),U9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),U9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),U9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),U9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),U9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),U9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(U9),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(J){return this.min.fromArray(J.min),this.max.fromArray(J.max),this}}var U9=[new y,new y,new y,new y,new y,new y,new y,new y],iJ=new y,G7=new l9,K8=new y,Y8=new y,H8=new y,z9=new y,I9=new y,y9=new y,C8=new y,N7=new y,E7=new y,v9=new y;function j6(J,Q,$,W,Z){for(let K=0,Y=J.length-3;K<=Y;K+=3){v9.fromArray(J,K);let H=Z.x*Math.abs(v9.x)+Z.y*Math.abs(v9.y)+Z.z*Math.abs(v9.z),X=Q.dot(v9),U=$.dot(v9),q=W.dot(v9);if(Math.max(-Math.max(X,U,q),Math.min(X,U,q))>H)return!1}return!0}var OJ=new y,q7=new h0,AK=0;class xJ extends F9{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:AK++}),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 W=0,Z=this.itemSize;W<Z;W++)this.array[J+W]=Q.array[$+W];return this}copyArray(J){return this.array.set(J),this}applyMatrix3(J){if(this.itemSize===2)for(let Q=0,$=this.count;Q<$;Q++)q7.fromBufferAttribute(this,Q),q7.applyMatrix3(J),this.setXY(Q,q7.x,q7.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.applyMatrix3(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.applyMatrix4(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.applyNormalMatrix(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)OJ.fromBufferAttribute(this,Q),OJ.transformDirection(J),this.setXYZ(Q,OJ.x,OJ.y,OJ.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)$=J9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=J9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize]=Q,this}getY(J){let Q=this.array[J*this.itemSize+1];if(this.normalized)Q=J9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+1]=Q,this}getZ(J){let Q=this.array[J*this.itemSize+2];if(this.normalized)Q=J9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+2]=Q,this}getW(J){let Q=this.array[J*this.itemSize+3];if(this.normalized)Q=J9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,W){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=W,this}setXYZW(J,Q,$,W,Z){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array),Z=QJ(Z,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=W,this.array[J+3]=Z,this}onUpload(J){return this.onUploadCallback=J,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let J={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")J.name=this.name;if(this.usage!==35044)J.usage=this.usage;return J}dispose(){this.dispatchEvent({type:"dispose"})}}class a7 extends xJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class r7 extends xJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class HJ extends xJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var wK=new l9,P8=new y,y6=new y;class z8{constructor(J=new y,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 wK.setFromPoints(J).getCenter($);let W=0;for(let Z=0,K=J.length;Z<K;Z++)W=Math.max(W,$.distanceToSquared(J[Z]));return this.radius=Math.sqrt(W),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;P8.subVectors(J,this.center);let Q=P8.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),W=($-this.radius)*0.5;this.center.addScaledVector(P8,W/$),this.radius+=W}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 y6.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(P8.copy(J.center).add(y6)),this.expandByPoint(P8.copy(J.center).sub(y6));return this}equals(J){return J.center.equals(this.center)&&J.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(J){return this.radius=J.radius,this.center.fromArray(J.center),this}}var CK=0,pJ=new YJ,v6=new RJ,X8=new y,bJ=new l9,T8=new l9,BJ=new y;class CJ extends F9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CK++}),this.uuid=w9(),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((qK(J))?r7:a7)(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 Z=new j0().getNormalMatrix(J);$.applyNormalMatrix(Z),$.needsUpdate=!0}let W=this.attributes.tangent;if(W!==void 0)W.transformDirection(J),W.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this}applyQuaternion(J){return pJ.makeRotationFromQuaternion(J),this.applyMatrix4(pJ),this}rotateX(J){return pJ.makeRotationX(J),this.applyMatrix4(pJ),this}rotateY(J){return pJ.makeRotationY(J),this.applyMatrix4(pJ),this}rotateZ(J){return pJ.makeRotationZ(J),this.applyMatrix4(pJ),this}translate(J,Q,$){return pJ.makeTranslation(J,Q,$),this.applyMatrix4(pJ),this}scale(J,Q,$){return pJ.makeScale(J,Q,$),this.applyMatrix4(pJ),this}lookAt(J){return v6.lookAt(J),v6.updateMatrix(),this.applyMatrix4(v6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(X8).negate(),this.translate(X8.x,X8.y,X8.z),this}setFromPoints(J){let Q=this.getAttribute("position");if(Q===void 0){let $=[];for(let W=0,Z=J.length;W<Z;W++){let K=J[W];$.push(K.x,K.y,K.z||0)}this.setAttribute("position",new HJ($,3))}else{let $=Math.min(J.length,Q.count);for(let W=0;W<$;W++){let Z=J[W];Q.setXYZ(W,Z.x,Z.y,Z.z||0)}if(J.length>Q.count)C0("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");Q.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new l9;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 y(-1/0,-1/0,-1/0),new y(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,W=Q.length;$<W;$++){let Z=Q[$];if(bJ.setFromBufferAttribute(Z),this.morphTargetsRelative)BJ.addVectors(this.boundingBox.min,bJ.min),this.boundingBox.expandByPoint(BJ),BJ.addVectors(this.boundingBox.max,bJ.max),this.boundingBox.expandByPoint(BJ);else this.boundingBox.expandByPoint(bJ.min),this.boundingBox.expandByPoint(bJ.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 z8;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 y,1/0);return}if(J){let $=this.boundingSphere.center;if(bJ.setFromBufferAttribute(J),Q)for(let Z=0,K=Q.length;Z<K;Z++){let Y=Q[Z];if(T8.setFromBufferAttribute(Y),this.morphTargetsRelative)BJ.addVectors(bJ.min,T8.min),bJ.expandByPoint(BJ),BJ.addVectors(bJ.max,T8.max),bJ.expandByPoint(BJ);else bJ.expandByPoint(T8.min),bJ.expandByPoint(T8.max)}bJ.getCenter($);let W=0;for(let Z=0,K=J.count;Z<K;Z++)BJ.fromBufferAttribute(J,Z),W=Math.max(W,$.distanceToSquared(BJ));if(Q)for(let Z=0,K=Q.length;Z<K;Z++){let Y=Q[Z],H=this.morphTargetsRelative;for(let X=0,U=Y.count;X<U;X++){if(BJ.fromBufferAttribute(Y,X),H)X8.fromBufferAttribute(J,X),BJ.add(X8);W=Math.max(W,$.distanceToSquared(BJ))}}if(this.boundingSphere.radius=Math.sqrt(W),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:W,uv:Z}=Q;if(this.hasAttribute("tangent")===!1)this.setAttribute("tangent",new xJ(new Float32Array(4*$.count),4));let K=this.getAttribute("tangent"),Y=[],H=[];for(let C=0;C<$.count;C++)Y[C]=new y,H[C]=new y;let X=new y,U=new y,q=new y,E=new h0,G=new h0,F=new h0,k=new y,z=new y;function N(C,M,B){X.fromBufferAttribute($,C),U.fromBufferAttribute($,M),q.fromBufferAttribute($,B),E.fromBufferAttribute(Z,C),G.fromBufferAttribute(Z,M),F.fromBufferAttribute(Z,B),U.sub(X),q.sub(X),G.sub(E),F.sub(E);let l=1/(G.x*F.y-F.x*G.y);if(!isFinite(l))return;k.copy(U).multiplyScalar(F.y).addScaledVector(q,-G.y).multiplyScalar(l),z.copy(q).multiplyScalar(G.x).addScaledVector(U,-F.x).multiplyScalar(l),Y[C].add(k),Y[M].add(k),Y[B].add(k),H[C].add(z),H[M].add(z),H[B].add(z)}let D=this.groups;if(D.length===0)D=[{start:0,count:J.count}];for(let C=0,M=D.length;C<M;++C){let B=D[C],l=B.start,A=B.count;for(let p=l,c=l+A;p<c;p+=3)N(J.getX(p+0),J.getX(p+1),J.getX(p+2))}let V=new y,_=new y,I=new y,P=new y;function w(C){I.fromBufferAttribute(W,C),P.copy(I);let M=Y[C];V.copy(M),V.sub(I.multiplyScalar(I.dot(M))).normalize(),_.crossVectors(P,M);let l=_.dot(H[C])<0?-1:1;K.setXYZW(C,V.x,V.y,V.z,l)}for(let C=0,M=D.length;C<M;++C){let B=D[C],l=B.start,A=B.count;for(let p=l,c=l+A;p<c;p+=3)w(J.getX(p+0)),w(J.getX(p+1)),w(J.getX(p+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new xJ(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let E=0,G=$.count;E<G;E++)$.setXYZ(E,0,0,0);let W=new y,Z=new y,K=new y,Y=new y,H=new y,X=new y,U=new y,q=new y;if(J)for(let E=0,G=J.count;E<G;E+=3){let F=J.getX(E+0),k=J.getX(E+1),z=J.getX(E+2);W.fromBufferAttribute(Q,F),Z.fromBufferAttribute(Q,k),K.fromBufferAttribute(Q,z),U.subVectors(K,Z),q.subVectors(W,Z),U.cross(q),Y.fromBufferAttribute($,F),H.fromBufferAttribute($,k),X.fromBufferAttribute($,z),Y.add(U),H.add(U),X.add(U),$.setXYZ(F,Y.x,Y.y,Y.z),$.setXYZ(k,H.x,H.y,H.z),$.setXYZ(z,X.x,X.y,X.z)}else for(let E=0,G=Q.count;E<G;E+=3)W.fromBufferAttribute(Q,E+0),Z.fromBufferAttribute(Q,E+1),K.fromBufferAttribute(Q,E+2),U.subVectors(K,Z),q.subVectors(W,Z),U.cross(q),$.setXYZ(E+0,U.x,U.y,U.z),$.setXYZ(E+1,U.x,U.y,U.z),$.setXYZ(E+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++)BJ.fromBufferAttribute(J,Q),BJ.normalize(),J.setXYZ(Q,BJ.x,BJ.y,BJ.z)}toNonIndexed(){function J(Y,H){let{array:X,itemSize:U,normalized:q}=Y,E=new X.constructor(H.length*U),G=0,F=0;for(let k=0,z=H.length;k<z;k++){if(Y.isInterleavedBufferAttribute)G=H[k]*Y.data.stride+Y.offset;else G=H[k]*U;for(let N=0;N<U;N++)E[F++]=X[G++]}return new xJ(E,U,q)}if(this.index===null)return C0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new CJ,$=this.index.array,W=this.attributes;for(let Y in W){let H=W[Y],X=J(H,$);Q.setAttribute(Y,X)}let Z=this.morphAttributes;for(let Y in Z){let H=[],X=Z[Y];for(let U=0,q=X.length;U<q;U++){let E=X[U],G=J(E,$);H.push(G)}Q.morphAttributes[Y]=H}Q.morphTargetsRelative=this.morphTargetsRelative;let K=this.groups;for(let Y=0,H=K.length;Y<H;Y++){let X=K[Y];Q.addGroup(X.start,X.count,X.materialIndex)}return Q}toJSON(){let J={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(J.uuid=this.uuid,J.type=this.type,this.name!=="")J.name=this.name;if(Object.keys(this.userData).length>0)J.userData=this.userData;if(this.parameters!==void 0){let H=this.parameters;for(let X in H)if(H[X]!==void 0)J[X]=H[X];return J}J.data={attributes:{}};let Q=this.index;if(Q!==null)J.data.index={type:Q.array.constructor.name,array:Array.prototype.slice.call(Q.array)};let $=this.attributes;for(let H in $){let X=$[H];J.data.attributes[H]=X.toJSON(J.data)}let W={},Z=!1;for(let H in this.morphAttributes){let X=this.morphAttributes[H],U=[];for(let q=0,E=X.length;q<E;q++){let G=X[q];U.push(G.toJSON(J.data))}if(U.length>0)W[H]=U,Z=!0}if(Z)J.data.morphAttributes=W,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 W=J.attributes;for(let X in W){let U=W[X];this.setAttribute(X,U.clone(Q))}let Z=J.morphAttributes;for(let X in Z){let U=[],q=Z[X];for(let E=0,G=q.length;E<G;E++)U.push(q[E].clone(Q));this.morphAttributes[X]=U}this.morphTargetsRelative=J.morphTargetsRelative;let K=J.groups;for(let X=0,U=K.length;X<U;X++){let q=K[X];this.addGroup(q.start,q.count,q.materialIndex)}let Y=J.boundingBox;if(Y!==null)this.boundingBox=Y.clone();let H=J.boundingSphere;if(H!==null)this.boundingSphere=H.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class nQ{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=w9()}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 W=0,Z=this.stride;W<Z;W++)this.array[J+W]=Q.array[$+W];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=w9();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=w9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var SJ=new y;class h8{constructor(J,Q,$,W=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=J,this.itemSize=Q,this.offset=$,this.normalized=W}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++)SJ.fromBufferAttribute(this,Q),SJ.applyMatrix4(J),this.setXYZ(Q,SJ.x,SJ.y,SJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)SJ.fromBufferAttribute(this,Q),SJ.applyNormalMatrix(J),this.setXYZ(Q,SJ.x,SJ.y,SJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)SJ.fromBufferAttribute(this,Q),SJ.transformDirection(J),this.setXYZ(Q,SJ.x,SJ.y,SJ.z);return this}getComponent(J,Q){let $=this.array[J*this.data.stride+this.offset+Q];if(this.normalized)$=J9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+3]=Q,this}getX(J){let Q=this.data.array[J*this.data.stride+this.offset];if(this.normalized)Q=J9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=J9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=J9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=J9(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this}setXYZ(J,Q,$,W){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=W,this}setXYZW(J,Q,$,W,Z){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),W=QJ(W,this.array),Z=QJ(Z,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=W,this.data.array[J+3]=Z,this}clone(J){if(J===void 0){b8("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let W=$*this.data.stride+this.offset;for(let Z=0;Z<this.itemSize;Z++)Q.push(this.data.array[W+Z])}return new xJ(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){b8("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let W=$*this.data.stride+this.offset;for(let Z=0;Z<this.itemSize;Z++)Q.push(this.data.array[W+Z])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Q,normalized:this.normalized}}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.toJSON(J);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var PK=0;class R9 extends F9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:PK++}),this.uuid=w9(),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 g0(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(J){if(this._alphaTest>0!==J>0)this.version++;this._alphaTest=J}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(J){if(J===void 0)return;for(let Q in J){let $=J[Q];if($===void 0){C0(`Material: parameter '${Q}' has value of undefined.`);continue}let W=this[Q];if(W===void 0){C0(`Material: '${Q}' is not a property of THREE.${this.type}.`);continue}if(W&&W.isColor)W.set($);else if(W&&W.isVector3&&($&&$.isVector3))W.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 W(Z){let K=[];for(let Y in Z){let H=Z[Y];delete H.metadata,K.push(H)}return K}if(Q){let Z=W(J.textures),K=W(J.images);if(Z.length>0)$.textures=Z;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 W=Q.length;$=Array(W);for(let Z=0;Z!==W;++Z)$[Z]=Q[Z].clone()}return this.clippingPlanes=$,this.clipIntersection=J.clipIntersection,this.clipShadows=J.clipShadows,this.shadowSide=J.shadowSide,this.colorWrite=J.colorWrite,this.precision=J.precision,this.polygonOffset=J.polygonOffset,this.polygonOffsetFactor=J.polygonOffsetFactor,this.polygonOffsetUnits=J.polygonOffsetUnits,this.dithering=J.dithering,this.alphaTest=J.alphaTest,this.alphaHash=J.alphaHash,this.alphaToCoverage=J.alphaToCoverage,this.premultipliedAlpha=J.premultipliedAlpha,this.forceSinglePass=J.forceSinglePass,this.allowOverride=J.allowOverride,this.visible=J.visible,this.toneMapped=J.toneMapped,this.userData=JSON.parse(JSON.stringify(J.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(J){if(J===!0)this.version++}}class s8 extends R9{constructor(J){super();this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new g0(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.rotation=J.rotation,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var U8,S8=new y,G8=new y,N8=new y,E8=new h0,j8=new h0,DZ=new YJ,D7=new y,y8=new y,F7=new y,o$=new h0,f6=new h0,a$=new h0;class t7 extends RJ{constructor(J=new s8){super();if(this.isSprite=!0,this.type="Sprite",U8===void 0){U8=new CJ;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 nQ(Q,5);U8.setIndex([0,1,2,0,2,3]),U8.setAttribute("position",new h8($,3,0,!1)),U8.setAttribute("uv",new h8($,2,3,!1))}this.geometry=U8,this.material=J,this.center=new h0(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(G8.setFromMatrixScale(this.matrixWorld),DZ.copy(J.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(J.camera.matrixWorldInverse,this.matrixWorld),N8.setFromMatrixPosition(this.modelViewMatrix),J.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1)G8.multiplyScalar(-N8.z);let $=this.material.rotation,W,Z;if($!==0)Z=Math.cos($),W=Math.sin($);let K=this.center;O7(D7.set(-0.5,-0.5,0),N8,K,G8,W,Z),O7(y8.set(0.5,-0.5,0),N8,K,G8,W,Z),O7(F7.set(0.5,0.5,0),N8,K,G8,W,Z),o$.set(0,0),f6.set(1,0),a$.set(1,1);let Y=J.ray.intersectTriangle(D7,y8,F7,!1,S8);if(Y===null){if(O7(y8.set(-0.5,0.5,0),N8,K,G8,W,Z),f6.set(0,1),Y=J.ray.intersectTriangle(D7,F7,y8,!1,S8),Y===null)return}let H=J.ray.origin.distanceTo(S8);if(H<J.near||H>J.far)return;Q.push({distance:H,point:S8.clone(),uv:hJ.getInterpolation(S8,D7,y8,F7,o$,f6,a$,new h0),face:null,object:this})}copy(J,Q){if(super.copy(J,Q),J.center!==void 0)this.center.copy(J.center);return this.material=J.material,this}}function O7(J,Q,$,W,Z,K){if(E8.subVectors(J,$).addScalar(0.5).multiply(W),Z!==void 0)j8.x=K*E8.x-Z*E8.y,j8.y=Z*E8.x+K*E8.y;else j8.copy(E8);J.copy(Q),J.x+=j8.x,J.y+=j8.y,J.applyMatrix4(DZ)}var G9=new y,b6=new y,R7=new y,_9=new y,h6=new y,k7=new y,x6=new y;class i8{constructor(J=new y,Q=new y(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,$,W){b6.copy(J).add(Q).multiplyScalar(0.5),R7.copy(Q).sub(J).normalize(),_9.copy(this.origin).sub(b6);let Z=J.distanceTo(Q)*0.5,K=-this.direction.dot(R7),Y=_9.dot(this.direction),H=-_9.dot(R7),X=_9.lengthSq(),U=Math.abs(1-K*K),q,E,G,F;if(U>0)if(q=K*H-Y,E=K*Y-H,F=Z*U,q>=0)if(E>=-F)if(E<=F){let k=1/U;q*=k,E*=k,G=q*(q+K*E+2*Y)+E*(K*q+E+2*H)+X}else E=Z,q=Math.max(0,-(K*E+Y)),G=-q*q+E*(E+2*H)+X;else E=-Z,q=Math.max(0,-(K*E+Y)),G=-q*q+E*(E+2*H)+X;else if(E<=-F)q=Math.max(0,-(-K*Z+Y)),E=q>0?-Z:Math.min(Math.max(-Z,-H),Z),G=-q*q+E*(E+2*H)+X;else if(E<=F)q=0,E=Math.min(Math.max(-Z,-H),Z),G=E*(E+2*H)+X;else q=Math.max(0,-(K*Z+Y)),E=q>0?Z:Math.min(Math.max(-Z,-H),Z),G=-q*q+E*(E+2*H)+X;else E=K>0?-Z:Z,q=Math.max(0,-(K*E+Y)),G=-q*q+E*(E+2*H)+X;if($)$.copy(this.origin).addScaledVector(this.direction,q);if(W)W.copy(b6).addScaledVector(R7,E);return G}intersectSphere(J,Q){G9.subVectors(J.center,this.origin);let $=G9.dot(this.direction),W=G9.dot(G9)-$*$,Z=J.radius*J.radius;if(W>Z)return null;let K=Math.sqrt(Z-W),Y=$-K,H=$+K;if(H<0)return null;if(Y<0)return this.at(H,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 $,W,Z,K,Y,H,X=1/this.direction.x,U=1/this.direction.y,q=1/this.direction.z,E=this.origin;if(X>=0)$=(J.min.x-E.x)*X,W=(J.max.x-E.x)*X;else $=(J.max.x-E.x)*X,W=(J.min.x-E.x)*X;if(U>=0)Z=(J.min.y-E.y)*U,K=(J.max.y-E.y)*U;else Z=(J.max.y-E.y)*U,K=(J.min.y-E.y)*U;if($>K||Z>W)return null;if(Z>$||isNaN($))$=Z;if(K<W||isNaN(W))W=K;if(q>=0)Y=(J.min.z-E.z)*q,H=(J.max.z-E.z)*q;else Y=(J.max.z-E.z)*q,H=(J.min.z-E.z)*q;if($>H||Y>W)return null;if(Y>$||$!==$)$=Y;if(H<W||W!==W)W=H;if(W<0)return null;return this.at($>=0?$:W,Q)}intersectsBox(J){return this.intersectBox(J,G9)!==null}intersectTriangle(J,Q,$,W,Z){h6.subVectors(Q,J),k7.subVectors($,J),x6.crossVectors(h6,k7);let K=this.direction.dot(x6),Y;if(K>0){if(W)return null;Y=1}else if(K<0)Y=-1,K=-K;else return null;_9.subVectors(this.origin,J);let H=Y*this.direction.dot(k7.crossVectors(_9,k7));if(H<0)return null;let X=Y*this.direction.dot(h6.cross(_9));if(X<0)return null;if(H+X>K)return null;let U=-Y*_9.dot(x6);if(U<0)return null;return this.at(U/K,Z)}applyMatrix4(J){return this.origin.applyMatrix4(J),this.direction.transformDirection(J),this}equals(J){return J.origin.equals(this.origin)&&J.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class e7 extends R9{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new g0(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 mJ,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}var r$=new YJ,f9=new i8,M7=new z8,t$=new y,L7=new y,V7=new y,B7=new y,g6=new y,z7=new y,e$=new y,I7=new y;class PJ extends RJ{constructor(J=new CJ,Q=new e7){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 W=Q[$[0]];if(W!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let Z=0,K=W.length;Z<K;Z++){let Y=W[Z].name||String(Z);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Y]=Z}}}}getVertexPosition(J,Q){let $=this.geometry,W=$.attributes.position,Z=$.morphAttributes.position,K=$.morphTargetsRelative;Q.fromBufferAttribute(W,J);let Y=this.morphTargetInfluences;if(Z&&Y){z7.set(0,0,0);for(let H=0,X=Z.length;H<X;H++){let U=Y[H],q=Z[H];if(U===0)continue;if(g6.fromBufferAttribute(q,J),K)z7.addScaledVector(g6,U);else z7.addScaledVector(g6.sub(Q),U)}Q.add(z7)}return Q}raycast(J,Q){let $=this.geometry,W=this.material,Z=this.matrixWorld;if(W===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(M7.copy($.boundingSphere),M7.applyMatrix4(Z),f9.copy(J.ray).recast(J.near),M7.containsPoint(f9.origin)===!1){if(f9.intersectSphere(M7,t$)===null)return;if(f9.origin.distanceToSquared(t$)>(J.far-J.near)**2)return}if(r$.copy(Z).invert(),f9.copy(J.ray).applyMatrix4(r$),$.boundingBox!==null){if(f9.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,f9)}_computeIntersections(J,Q,$){let W,Z=this.geometry,K=this.material,Y=Z.index,H=Z.attributes.position,X=Z.attributes.uv,U=Z.attributes.uv1,q=Z.attributes.normal,E=Z.groups,G=Z.drawRange;if(Y!==null)if(Array.isArray(K))for(let F=0,k=E.length;F<k;F++){let z=E[F],N=K[z.materialIndex],D=Math.max(z.start,G.start),V=Math.min(Y.count,Math.min(z.start+z.count,G.start+G.count));for(let _=D,I=V;_<I;_+=3){let P=Y.getX(_),w=Y.getX(_+1),C=Y.getX(_+2);if(W=_7(this,N,J,$,X,U,q,P,w,C),W)W.faceIndex=Math.floor(_/3),W.face.materialIndex=z.materialIndex,Q.push(W)}}else{let F=Math.max(0,G.start),k=Math.min(Y.count,G.start+G.count);for(let z=F,N=k;z<N;z+=3){let D=Y.getX(z),V=Y.getX(z+1),_=Y.getX(z+2);if(W=_7(this,K,J,$,X,U,q,D,V,_),W)W.faceIndex=Math.floor(z/3),Q.push(W)}}else if(H!==void 0)if(Array.isArray(K))for(let F=0,k=E.length;F<k;F++){let z=E[F],N=K[z.materialIndex],D=Math.max(z.start,G.start),V=Math.min(H.count,Math.min(z.start+z.count,G.start+G.count));for(let _=D,I=V;_<I;_+=3){let P=_,w=_+1,C=_+2;if(W=_7(this,N,J,$,X,U,q,P,w,C),W)W.faceIndex=Math.floor(_/3),W.face.materialIndex=z.materialIndex,Q.push(W)}}else{let F=Math.max(0,G.start),k=Math.min(H.count,G.start+G.count);for(let z=F,N=k;z<N;z+=3){let D=z,V=z+1,_=z+2;if(W=_7(this,K,J,$,X,U,q,D,V,_),W)W.faceIndex=Math.floor(z/3),Q.push(W)}}}}function TK(J,Q,$,W,Z,K,Y,H){let X;if(Q.side===1)X=W.intersectTriangle(Y,K,Z,!0,H);else X=W.intersectTriangle(Z,K,Y,Q.side===0,H);if(X===null)return null;I7.copy(H),I7.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(I7);if(U<$.near||U>$.far)return null;return{distance:U,point:I7.clone(),object:J}}function _7(J,Q,$,W,Z,K,Y,H,X,U){J.getVertexPosition(H,L7),J.getVertexPosition(X,V7),J.getVertexPosition(U,B7);let q=TK(J,Q,$,W,L7,V7,B7,e$);if(q){let E=new y;if(hJ.getBarycoord(e$,L7,V7,B7,E),Z)q.uv=hJ.getInterpolatedAttribute(Z,H,X,U,E,new h0);if(K)q.uv1=hJ.getInterpolatedAttribute(K,H,X,U,E,new h0);if(Y){if(q.normal=hJ.getInterpolatedAttribute(Y,H,X,U,E,new y),q.normal.dot(W.direction)>0)q.normal.multiplyScalar(-1)}let G={a:H,b:X,c:U,normal:new y,materialIndex:0};hJ.getNormal(L7,V7,B7,G.normal),q.face=G,q.barycoord=E}return q}class sQ extends zJ{constructor(J=null,Q=1,$=1,W,Z,K,Y,H,X=1003,U=1003,q,E){super(null,K,Y,H,X,U,W,Z,q,E);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var p6=new y,SK=new y,jK=new j0;class N9{constructor(J=new y(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,$,W){return this.normal.set(J,Q,$),this.constant=W,this}setFromNormalAndCoplanarPoint(J,Q){return this.normal.copy(J),this.constant=-Q.dot(this.normal),this}setFromCoplanarPoints(J,Q,$){let W=p6.subVectors($,Q).cross(SK.subVectors(J,Q)).normalize();return this.setFromNormalAndCoplanarPoint(W,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 W=J.delta(p6),Z=this.normal.dot(W);if(Z===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let K=-(J.start.dot(this.normal)+this.constant)/Z;if($===!0&&(K<0||K>1))return null;return Q.copy(J.start).addScaledVector(W,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||jK.getNormalMatrix(J),W=this.coplanarPoint(p6).applyMatrix4(J),Z=this.normal.applyMatrix3($).normalize();return this.constant=-W.dot(Z),this}translate(J){return this.constant-=J.dot(this.normal),this}equals(J){return J.normal.equals(this.normal)&&J.constant===this.constant}clone(){return new this.constructor().copy(this)}}var b9=new z8,yK=new h0(0.5,0.5),A7=new y;class o8{constructor(J=new N9,Q=new N9,$=new N9,W=new N9,Z=new N9,K=new N9){this.planes=[J,Q,$,W,Z,K]}set(J,Q,$,W,Z,K){let Y=this.planes;return Y[0].copy(J),Y[1].copy(Q),Y[2].copy($),Y[3].copy(W),Y[4].copy(Z),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 W=this.planes,Z=J.elements,K=Z[0],Y=Z[1],H=Z[2],X=Z[3],U=Z[4],q=Z[5],E=Z[6],G=Z[7],F=Z[8],k=Z[9],z=Z[10],N=Z[11],D=Z[12],V=Z[13],_=Z[14],I=Z[15];if(W[0].setComponents(X-K,G-U,N-F,I-D).normalize(),W[1].setComponents(X+K,G+U,N+F,I+D).normalize(),W[2].setComponents(X+Y,G+q,N+k,I+V).normalize(),W[3].setComponents(X-Y,G-q,N-k,I-V).normalize(),$)W[4].setComponents(H,E,z,_).normalize(),W[5].setComponents(X-H,G-E,N-z,I-_).normalize();else if(W[4].setComponents(X-H,G-E,N-z,I-_).normalize(),Q===2000)W[5].setComponents(X+H,G+E,N+z,I+_).normalize();else if(Q===2001)W[5].setComponents(H,E,z,_).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();b9.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();b9.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(b9)}intersectsSprite(J){b9.center.set(0,0,0);let Q=yK.distanceTo(J.center);return b9.radius=0.7071067811865476+Q,b9.applyMatrix4(J.matrixWorld),this.intersectsSphere(b9)}intersectsSphere(J){let Q=this.planes,$=J.center,W=-J.radius;for(let Z=0;Z<6;Z++)if(Q[Z].distanceToPoint($)<W)return!1;return!0}intersectsBox(J){let Q=this.planes;for(let $=0;$<6;$++){let W=Q[$];if(A7.x=W.normal.x>0?J.max.x:J.min.x,A7.y=W.normal.y>0?J.max.y:J.min.y,A7.z=W.normal.z>0?J.max.z:J.min.z,W.distanceToPoint(A7)<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 J6 extends R9{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new g0(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.linewidth=J.linewidth,this.linecap=J.linecap,this.linejoin=J.linejoin,this.fog=J.fog,this}}var v7=new y,f7=new y,JW=new YJ,v8=new i8,w7=new z8,m6=new y,QW=new y;class iQ extends RJ{constructor(J=new CJ,Q=new J6){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 W=1,Z=Q.count;W<Z;W++)v7.fromBufferAttribute(Q,W-1),f7.fromBufferAttribute(Q,W),$[W]=$[W-1],$[W]+=v7.distanceTo(f7);J.setAttribute("lineDistance",new HJ($,1))}else C0("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(J,Q){let $=this.geometry,W=this.matrixWorld,Z=J.params.Line.threshold,K=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(w7.copy($.boundingSphere),w7.applyMatrix4(W),w7.radius+=Z,J.ray.intersectsSphere(w7)===!1)return;JW.copy(W).invert(),v8.copy(J.ray).applyMatrix4(JW);let Y=Z/((this.scale.x+this.scale.y+this.scale.z)/3),H=Y*Y,X=this.isLineSegments?2:1,U=$.index,E=$.attributes.position;if(U!==null){let G=Math.max(0,K.start),F=Math.min(U.count,K.start+K.count);for(let k=G,z=F-1;k<z;k+=X){let N=U.getX(k),D=U.getX(k+1),V=C7(this,J,v8,H,N,D,k);if(V)Q.push(V)}if(this.isLineLoop){let k=U.getX(F-1),z=U.getX(G),N=C7(this,J,v8,H,k,z,F-1);if(N)Q.push(N)}}else{let G=Math.max(0,K.start),F=Math.min(E.count,K.start+K.count);for(let k=G,z=F-1;k<z;k+=X){let N=C7(this,J,v8,H,k,k+1,k);if(N)Q.push(N)}if(this.isLineLoop){let k=C7(this,J,v8,H,F-1,G,F-1);if(k)Q.push(k)}}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let W=Q[$[0]];if(W!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let Z=0,K=W.length;Z<K;Z++){let Y=W[Z].name||String(Z);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Y]=Z}}}}}function C7(J,Q,$,W,Z,K,Y){let H=J.geometry.attributes.position;if(v7.fromBufferAttribute(H,Z),f7.fromBufferAttribute(H,K),$.distanceSqToSegment(v7,f7,m6,QW)>W)return;m6.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(m6);if(U<Q.near||U>Q.far)return;return{distance:U,point:QW.clone().applyMatrix4(J.matrixWorld),index:Y,face:null,faceIndex:null,barycoord:null,object:J}}var $W=new y,WW=new y;class oQ extends iQ{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 W=0,Z=Q.count;W<Z;W+=2)$W.fromBufferAttribute(Q,W),WW.fromBufferAttribute(Q,W+1),$[W]=W===0?0:$[W-1],$[W+1]=$[W]+$W.distanceTo(WW);J.setAttribute("lineDistance",new HJ($,1))}else C0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Q6 extends zJ{constructor(J=[],Q=301,$,W,Z,K,Y,H,X,U){super(J,Q,$,W,Z,K,Y,H,X,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}}class $6 extends zJ{constructor(J,Q,$,W,Z,K,Y,H,X){super(J,Q,$,W,Z,K,Y,H,X);this.isCanvasTexture=!0,this.needsUpdate=!0}}class T9 extends zJ{constructor(J,Q,$=1014,W,Z,K,Y=1003,H=1003,X,U=1026,q=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let E={width:J,height:Q,depth:q};super(E,W,Z,K,Y,H,U,$,X);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new l8(Object.assign({},J.image)),this.compareFunction=J.compareFunction,this}toJSON(J){let Q=super.toJSON(J);if(this.compareFunction!==null)Q.compareFunction=this.compareFunction;return Q}}class aQ extends T9{constructor(J,Q=1014,$=301,W,Z,K=1003,Y=1003,H,X=1026){let U={width:J,height:J,depth:1},q=[U,U,U,U,U,U];super(J,J,Q,$,W,Z,K,Y,H,X);this.image=q,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}}class W6 extends zJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class I8 extends CJ{constructor(J=1,Q=1,$=1,W=1,Z=1,K=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:W,heightSegments:Z,depthSegments:K};let Y=this;W=Math.floor(W),Z=Math.floor(Z),K=Math.floor(K);let H=[],X=[],U=[],q=[],E=0,G=0;F("z","y","x",-1,-1,$,Q,J,K,Z,0),F("z","y","x",1,-1,$,Q,-J,K,Z,1),F("x","z","y",1,1,J,$,Q,W,K,2),F("x","z","y",1,-1,J,$,-Q,W,K,3),F("x","y","z",1,-1,J,Q,$,W,Z,4),F("x","y","z",-1,-1,J,Q,-$,W,Z,5),this.setIndex(H),this.setAttribute("position",new HJ(X,3)),this.setAttribute("normal",new HJ(U,3)),this.setAttribute("uv",new HJ(q,2));function F(k,z,N,D,V,_,I,P,w,C,M){let B=_/w,l=I/C,A=_/2,p=I/2,c=P/2,v=w+1,d=C+1,x=0,g=0,a=new y;for(let J0=0;J0<d;J0++){let U0=J0*l-p;for(let z0=0;z0<v;z0++){let e=z0*B-A;a[k]=e*D,a[z]=U0*V,a[N]=c,X.push(a.x,a.y,a.z),a[k]=0,a[z]=0,a[N]=P>0?1:-1,U.push(a.x,a.y,a.z),q.push(z0/w),q.push(1-J0/C),x+=1}}for(let J0=0;J0<C;J0++)for(let U0=0;U0<w;U0++){let z0=E+U0+v*J0,e=E+U0+v*(J0+1),V0=E+(U0+1)+v*(J0+1),_0=E+(U0+1)+v*J0;H.push(z0,e,_0),H.push(e,V0,_0),g+=6}Y.addGroup(G,g,M),G+=g,E+=x}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new I8(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class a8 extends CJ{constructor(J=1,Q=1,$=1,W=32,Z=1,K=!1,Y=0,H=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:W,heightSegments:Z,openEnded:K,thetaStart:Y,thetaLength:H};let X=this;W=Math.floor(W),Z=Math.floor(Z);let U=[],q=[],E=[],G=[],F=0,k=[],z=$/2,N=0;if(D(),K===!1){if(J>0)V(!0);if(Q>0)V(!1)}this.setIndex(U),this.setAttribute("position",new HJ(q,3)),this.setAttribute("normal",new HJ(E,3)),this.setAttribute("uv",new HJ(G,2));function D(){let _=new y,I=new y,P=0,w=(Q-J)/$;for(let C=0;C<=Z;C++){let M=[],B=C/Z,l=B*(Q-J)+J;for(let A=0;A<=W;A++){let p=A/W,c=p*H+Y,v=Math.sin(c),d=Math.cos(c);I.x=l*v,I.y=-B*$+z,I.z=l*d,q.push(I.x,I.y,I.z),_.set(v,w,d).normalize(),E.push(_.x,_.y,_.z),G.push(p,1-B),M.push(F++)}k.push(M)}for(let C=0;C<W;C++)for(let M=0;M<Z;M++){let B=k[M][C],l=k[M+1][C],A=k[M+1][C+1],p=k[M][C+1];if(J>0||M!==0)U.push(B,l,p),P+=3;if(Q>0||M!==Z-1)U.push(l,A,p),P+=3}X.addGroup(N,P,0),N+=P}function V(_){let I=F,P=new h0,w=new y,C=0,M=_===!0?J:Q,B=_===!0?1:-1;for(let A=1;A<=W;A++)q.push(0,z*B,0),E.push(0,B,0),G.push(0.5,0.5),F++;let l=F;for(let A=0;A<=W;A++){let c=A/W*H+Y,v=Math.cos(c),d=Math.sin(c);w.x=M*d,w.y=z*B,w.z=M*v,q.push(w.x,w.y,w.z),E.push(0,B,0),P.x=v*0.5+0.5,P.y=d*0.5*B+0.5,G.push(P.x,P.y),F++}for(let A=0;A<W;A++){let p=I+A,c=l+A;if(_===!0)U.push(c,c+1,p);else U.push(c+1,c,p);C+=3}X.addGroup(N,C,_===!0?1:2),N+=C}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new a8(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class u9 extends CJ{constructor(J=1,Q=1,$=1,W=1){super();this.type="PlaneGeometry",this.parameters={width:J,height:Q,widthSegments:$,heightSegments:W};let Z=J/2,K=Q/2,Y=Math.floor($),H=Math.floor(W),X=Y+1,U=H+1,q=J/Y,E=Q/H,G=[],F=[],k=[],z=[];for(let N=0;N<U;N++){let D=N*E-K;for(let V=0;V<X;V++){let _=V*q-Z;F.push(_,-D,0),k.push(0,0,1),z.push(V/Y),z.push(1-N/H)}}for(let N=0;N<H;N++)for(let D=0;D<Y;D++){let V=D+X*N,_=D+X*(N+1),I=D+1+X*(N+1),P=D+1+X*N;G.push(V,_,P),G.push(_,I,P)}this.setIndex(G),this.setAttribute("position",new HJ(F,3)),this.setAttribute("normal",new HJ(k,3)),this.setAttribute("uv",new HJ(z,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new u9(J.width,J.height,J.widthSegments,J.heightSegments)}}class r8 extends CJ{constructor(J=1,Q=32,$=16,W=0,Z=Math.PI*2,K=0,Y=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:W,phiLength:Z,thetaStart:K,thetaLength:Y},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let H=Math.min(K+Y,Math.PI),X=0,U=[],q=new y,E=new y,G=[],F=[],k=[],z=[];for(let N=0;N<=$;N++){let D=[],V=N/$,_=0;if(N===0&&K===0)_=0.5/Q;else if(N===$&&H===Math.PI)_=-0.5/Q;for(let I=0;I<=Q;I++){let P=I/Q;q.x=-J*Math.cos(W+P*Z)*Math.sin(K+V*Y),q.y=J*Math.cos(K+V*Y),q.z=J*Math.sin(W+P*Z)*Math.sin(K+V*Y),F.push(q.x,q.y,q.z),E.copy(q).normalize(),k.push(E.x,E.y,E.z),z.push(P+_,1-V),D.push(X++)}U.push(D)}for(let N=0;N<$;N++)for(let D=0;D<Q;D++){let V=U[N][D+1],_=U[N][D],I=U[N+1][D],P=U[N+1][D+1];if(N!==0||K>0)G.push(V,_,P);if(N!==$-1||H<Math.PI)G.push(_,I,P)}this.setIndex(G),this.setAttribute("position",new HJ(F,3)),this.setAttribute("normal",new HJ(k,3)),this.setAttribute("uv",new HJ(z,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new r8(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class t8 extends CJ{constructor(J=1,Q=0.4,$=12,W=48,Z=Math.PI*2,K=0,Y=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:W,arc:Z,thetaStart:K,thetaLength:Y},$=Math.floor($),W=Math.floor(W);let H=[],X=[],U=[],q=[],E=new y,G=new y,F=new y;for(let k=0;k<=$;k++){let z=K+k/$*Y;for(let N=0;N<=W;N++){let D=N/W*Z;G.x=(J+Q*Math.cos(z))*Math.cos(D),G.y=(J+Q*Math.cos(z))*Math.sin(D),G.z=Q*Math.sin(z),X.push(G.x,G.y,G.z),E.x=J*Math.cos(D),E.y=J*Math.sin(D),F.subVectors(G,E).normalize(),U.push(F.x,F.y,F.z),q.push(N/W),q.push(k/$)}}for(let k=1;k<=$;k++)for(let z=1;z<=W;z++){let N=(W+1)*k+z-1,D=(W+1)*(k-1)+z-1,V=(W+1)*(k-1)+z,_=(W+1)*k+z;H.push(N,D,_),H.push(D,V,_)}this.setIndex(H),this.setAttribute("position",new HJ(X,3)),this.setAttribute("normal",new HJ(U,3)),this.setAttribute("uv",new HJ(q,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new t8(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}function c9(J){let Q={};for(let $ in J){Q[$]={};for(let W in J[$]){let Z=J[$][W];if(ZW(Z))if(Z.isRenderTargetTexture)C0("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Q[$][W]=null;else Q[$][W]=Z.clone();else if(Array.isArray(Z))if(ZW(Z[0])){let K=[];for(let Y=0,H=Z.length;Y<H;Y++)K[Y]=Z[Y].clone();Q[$][W]=K}else Q[$][W]=Z.slice();else Q[$][W]=Z}}return Q}function TJ(J){let Q={};for(let $=0;$<J.length;$++){let W=c9(J[$]);for(let Z in W)Q[Z]=W[Z]}return Q}function ZW(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function vK(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function rQ(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return i0.workingColorSpace}var FZ={clone:c9,merge:TJ},fK=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
3
|
}`,bK=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|